#include <linux/pwm.h>
#include <linux/string_helpers.h>
+ #include <acpi/video.h>
+
+#include "i915_reg.h"
#include "intel_backlight.h"
#include "intel_backlight_regs.h"
#include "intel_connector.h"
#define __INTEL_GT_REGS__
#include "i915_reg_defs.h"
+#include "display/intel_display_reg_defs.h" /* VLV_DISPLAY_BASE */
+ #define MCR_REG(offset) ((const i915_mcr_reg_t){ .reg = (offset) })
+
+ /*
+ * The perf control registers are technically multicast registers, but the
+ * driver never needs to read/write them directly; we only use them to build
+ * lists of registers (where they're mixed in with other non-MCR registers)
+ * and then operate on the offset directly. For now we'll just define them
+ * as non-multicast so we can place them on the same list, but we may want
+ * to try to come up with a better way to handle heterogeneous lists of
+ * registers in the future.
+ */
+ #define PERF_REG(offset) _MMIO(offset)
+
/* RPM unit config (Gen8+) */
#define RPM_CONFIG0 _MMIO(0xd00)
#define GEN9_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_SHIFT 3
#define _MMIO(r) ((const i915_reg_t){ .reg = (r) })
- #define INVALID_MMIO_REG _MMIO(0)
-
- static __always_inline u32 i915_mmio_reg_offset(i915_reg_t reg)
- {
- return reg.reg;
- }
+ typedef struct {
+ u32 reg;
+ } i915_mcr_reg_t;
- static inline bool i915_mmio_reg_equal(i915_reg_t a, i915_reg_t b)
- {
- return i915_mmio_reg_offset(a) == i915_mmio_reg_offset(b);
- }
+ #define INVALID_MMIO_REG _MMIO(0)
- static inline bool i915_mmio_reg_valid(i915_reg_t reg)
- {
- return !i915_mmio_reg_equal(reg, INVALID_MMIO_REG);
- }
+ /*
+ * These macros can be used on either i915_reg_t or i915_mcr_reg_t since they're
+ * simply operations on the register's offset and don't care about the MCR vs
+ * non-MCR nature of the register.
+ */
+ #define i915_mmio_reg_offset(r) \
+ _Generic((r), i915_reg_t: (r).reg, i915_mcr_reg_t: (r).reg)
+ #define i915_mmio_reg_equal(a, b) (i915_mmio_reg_offset(a) == i915_mmio_reg_offset(b))
+ #define i915_mmio_reg_valid(r) (!i915_mmio_reg_equal(r, INVALID_MMIO_REG))
-#define VLV_DISPLAY_BASE 0x180000
-
#endif /* __I915_REG_DEFS__ */