]> git.baikalelectronics.ru Git - kernel.git/commit
drm/i915: introduce REG_BIT() and REG_GENMASK() to define register contents
authorJani Nikula <jani.nikula@intel.com>
Fri, 15 Mar 2019 13:56:18 +0000 (15:56 +0200)
committerJani Nikula <jani.nikula@intel.com>
Mon, 18 Mar 2019 14:27:42 +0000 (16:27 +0200)
commit5d60b92be53aa80d7b3d27dcdbd30a931ffab6c7
treeaf2d0bf787cf6ee53c14b7d66464f794cf92f3fa
parentce19a16988a058ea3ff7d165dd149a37c56b6f4c
drm/i915: introduce REG_BIT() and REG_GENMASK() to define register contents

Introduce REG_BIT(n) to define register bits and REG_GENMASK(h, l) to
define register bitfield masks.

We define the above as wrappers to BIT() and GENMASK() respectively to
force u32 type to go with our register size, and to add compile time
checks on the bit numbers.

The intention is that these are easier to get right and review against
the spec than hand rolled masks.

Convert power sequencer registers as an example.

v4:
- rebase

v3:
- rename macros to REG_BIT() and REG_GENMASK() to avoid underscore
  prefix and to be in line with kernel macros (Chris)
- add compile time checks (Mika)

v2:
- rename macros to just _BIT() and _MASK() to reduce verbosity

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Acked-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/787307c0ba9bc23471e5ff1e454b8af35771fa37.1552657998.git.jani.nikula@intel.com
drivers/gpu/drm/i915/i915_reg.h