pvr_params.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /* SPDX-License-Identifier: GPL-2.0-only OR MIT */
  2. /* Copyright (c) 2023 Imagination Technologies Ltd. */
  3. #ifndef PVR_PARAMS_H
  4. #define PVR_PARAMS_H
  5. #include "pvr_rogue_fwif.h"
  6. #include <linux/cache.h>
  7. #include <linux/compiler_attributes.h>
  8. /*
  9. * This is the definitive list of types allowed in the definition of
  10. * %PVR_DEVICE_PARAMS.
  11. */
  12. #define PVR_PARAM_TYPE_X32_C u32
  13. /*
  14. * This macro defines all device-specific parameters; that is parameters which
  15. * are set independently per device.
  16. *
  17. * The X-macro accepts the following arguments. Arguments marked with [debugfs]
  18. * are ignored when debugfs is disabled; values used for these arguments may
  19. * safely be gated behind CONFIG_DEBUG_FS.
  20. *
  21. * @type_: The definitive list of allowed values is PVR_PARAM_TYPE_*_C.
  22. * @name_: Name of the parameter. This is used both as the field name in C and
  23. * stringified as the parameter name.
  24. * @value_: Initial/default value.
  25. * @desc_: String literal used as help text to describe the usage of this
  26. * parameter.
  27. * @mode_: [debugfs] One of {RO,RW}. The access mode of the debugfs entry for
  28. * this parameter.
  29. * @update_: [debugfs] When debugfs support is enabled, parameters may be
  30. * updated at runtime. When this happens, this function will be
  31. * called to allow changes to propagate. The signature of this
  32. * function is:
  33. *
  34. * void (*)(struct pvr_device *pvr_dev, T old_val, T new_val)
  35. *
  36. * Where T is the C type associated with @type_.
  37. *
  38. * If @mode_ does not allow write access, this function will never be
  39. * called. In this case, or if no update callback is required, you
  40. * should specify NULL for this argument.
  41. */
  42. #define PVR_DEVICE_PARAMS \
  43. X(X32, fw_trace_mask, ROGUE_FWIF_LOG_TYPE_NONE, \
  44. "Enable FW trace for the specified groups. Specifying 0 disables " \
  45. "all FW tracing.", \
  46. RW, pvr_fw_trace_mask_update)
  47. struct pvr_device_params {
  48. #define X(type_, name_, value_, desc_, ...) \
  49. PVR_PARAM_TYPE_##type_##_C name_;
  50. PVR_DEVICE_PARAMS
  51. #undef X
  52. };
  53. int pvr_device_params_init(struct pvr_device_params *params);
  54. #if defined(CONFIG_DEBUG_FS)
  55. /* Forward declaration from "pvr_device.h". */
  56. struct pvr_device;
  57. /* Forward declaration from <linux/dcache.h>. */
  58. struct dentry;
  59. void pvr_params_debugfs_init(struct pvr_device *pvr_dev, struct dentry *dir);
  60. #endif /* defined(CONFIG_DEBUG_FS) */
  61. #endif /* PVR_PARAMS_H */