drm/i915: Make CHICKEN_TRANS reg not depend on enum value
authorImre Deak <imre.deak@intel.com>
Mon, 19 Nov 2018 18:00:21 +0000 (20:00 +0200)
committerImre Deak <imre.deak@intel.com>
Wed, 21 Nov 2018 11:45:33 +0000 (13:45 +0200)
commit8f19b401a6fc6d1262c5bfbfc18146c5e8ecb491
treea0c463a7017d2b9bf9d6cbfe557d58b867ac3d28
parent8f78df90d84acd7a0b22c2b44a258421063a972f
drm/i915: Make CHICKEN_TRANS reg not depend on enum value

Depending on the transcoder enum values to translate from transcoder to
the corresponding CHICKEN_TRANS register can easily break if we add a
new transcoder. Add an explicit mapping instead, by using helpers to
look up the register instance either by transcoder or port (since
unconveniently the registers have both port and transcoder specific
bits).

While at it also check for the correctness of GEN, port, transcoder. I
wasn't sure if psr2_enabled can only be set for GEN9+, but that seems to
be the case indeed (see setting of sink_psr2_support in
intel_psr_init_dpcd()).

v2 (Ville):
- Make gen9_chicken_trans_reg() internal to intel_psr.c.
- s/trans/cpu_transcoder/

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: Mika Kahola <mika.kahola@intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181119180021.370-1-imre.deak@intel.com
drivers/gpu/drm/i915/i915_reg.h
drivers/gpu/drm/i915/intel_ddi.c
drivers/gpu/drm/i915/intel_psr.c