Commit 78e0d2e3 authored by Ville Syrjälä's avatar Ville Syrjälä

drm/i915: Store DVO SRCDIM register offset under intel_dvo_device

Store the DVO SRCDIM register offset alongside the DVO control register
offset in intel_dvo_device. This gets rid of the switch statement whose
case values are the DVO control register offsets. Such a construct would
cause problems for register type safety.
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1446672017-24497-12-git-send-email-ville.syrjala@linux.intel.comReviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
parent 2a5c0832
...@@ -33,6 +33,7 @@ struct intel_dvo_device { ...@@ -33,6 +33,7 @@ struct intel_dvo_device {
int type; int type;
/* DVOA/B/C output register */ /* DVOA/B/C output register */
u32 dvo_reg; u32 dvo_reg;
u32 dvo_srcdim_reg;
/* GPIO register used for i2c bus to control this device */ /* GPIO register used for i2c bus to control this device */
u32 gpio; u32 gpio;
int slave_addr; int slave_addr;
......
...@@ -44,6 +44,7 @@ static const struct intel_dvo_device intel_dvo_devices[] = { ...@@ -44,6 +44,7 @@ static const struct intel_dvo_device intel_dvo_devices[] = {
.type = INTEL_DVO_CHIP_TMDS, .type = INTEL_DVO_CHIP_TMDS,
.name = "sil164", .name = "sil164",
.dvo_reg = DVOC, .dvo_reg = DVOC,
.dvo_srcdim_reg = DVOC_SRCDIM,
.slave_addr = SIL164_ADDR, .slave_addr = SIL164_ADDR,
.dev_ops = &sil164_ops, .dev_ops = &sil164_ops,
}, },
...@@ -51,6 +52,7 @@ static const struct intel_dvo_device intel_dvo_devices[] = { ...@@ -51,6 +52,7 @@ static const struct intel_dvo_device intel_dvo_devices[] = {
.type = INTEL_DVO_CHIP_TMDS, .type = INTEL_DVO_CHIP_TMDS,
.name = "ch7xxx", .name = "ch7xxx",
.dvo_reg = DVOC, .dvo_reg = DVOC,
.dvo_srcdim_reg = DVOC_SRCDIM,
.slave_addr = CH7xxx_ADDR, .slave_addr = CH7xxx_ADDR,
.dev_ops = &ch7xxx_ops, .dev_ops = &ch7xxx_ops,
}, },
...@@ -58,6 +60,7 @@ static const struct intel_dvo_device intel_dvo_devices[] = { ...@@ -58,6 +60,7 @@ static const struct intel_dvo_device intel_dvo_devices[] = {
.type = INTEL_DVO_CHIP_TMDS, .type = INTEL_DVO_CHIP_TMDS,
.name = "ch7xxx", .name = "ch7xxx",
.dvo_reg = DVOC, .dvo_reg = DVOC,
.dvo_srcdim_reg = DVOC_SRCDIM,
.slave_addr = 0x75, /* For some ch7010 */ .slave_addr = 0x75, /* For some ch7010 */
.dev_ops = &ch7xxx_ops, .dev_ops = &ch7xxx_ops,
}, },
...@@ -65,6 +68,7 @@ static const struct intel_dvo_device intel_dvo_devices[] = { ...@@ -65,6 +68,7 @@ static const struct intel_dvo_device intel_dvo_devices[] = {
.type = INTEL_DVO_CHIP_LVDS, .type = INTEL_DVO_CHIP_LVDS,
.name = "ivch", .name = "ivch",
.dvo_reg = DVOA, .dvo_reg = DVOA,
.dvo_srcdim_reg = DVOA_SRCDIM,
.slave_addr = 0x02, /* Might also be 0x44, 0x84, 0xc4 */ .slave_addr = 0x02, /* Might also be 0x44, 0x84, 0xc4 */
.dev_ops = &ivch_ops, .dev_ops = &ivch_ops,
}, },
...@@ -72,6 +76,7 @@ static const struct intel_dvo_device intel_dvo_devices[] = { ...@@ -72,6 +76,7 @@ static const struct intel_dvo_device intel_dvo_devices[] = {
.type = INTEL_DVO_CHIP_TMDS, .type = INTEL_DVO_CHIP_TMDS,
.name = "tfp410", .name = "tfp410",
.dvo_reg = DVOC, .dvo_reg = DVOC,
.dvo_srcdim_reg = DVOC_SRCDIM,
.slave_addr = TFP410_ADDR, .slave_addr = TFP410_ADDR,
.dev_ops = &tfp410_ops, .dev_ops = &tfp410_ops,
}, },
...@@ -79,6 +84,7 @@ static const struct intel_dvo_device intel_dvo_devices[] = { ...@@ -79,6 +84,7 @@ static const struct intel_dvo_device intel_dvo_devices[] = {
.type = INTEL_DVO_CHIP_LVDS, .type = INTEL_DVO_CHIP_LVDS,
.name = "ch7017", .name = "ch7017",
.dvo_reg = DVOC, .dvo_reg = DVOC,
.dvo_srcdim_reg = DVOC_SRCDIM,
.slave_addr = 0x75, .slave_addr = 0x75,
.gpio = GMBUS_PIN_DPB, .gpio = GMBUS_PIN_DPB,
.dev_ops = &ch7017_ops, .dev_ops = &ch7017_ops,
...@@ -87,6 +93,7 @@ static const struct intel_dvo_device intel_dvo_devices[] = { ...@@ -87,6 +93,7 @@ static const struct intel_dvo_device intel_dvo_devices[] = {
.type = INTEL_DVO_CHIP_TMDS, .type = INTEL_DVO_CHIP_TMDS,
.name = "ns2501", .name = "ns2501",
.dvo_reg = DVOB, .dvo_reg = DVOB,
.dvo_srcdim_reg = DVOB_SRCDIM,
.slave_addr = NS2501_ADDR, .slave_addr = NS2501_ADDR,
.dev_ops = &ns2501_ops, .dev_ops = &ns2501_ops,
} }
...@@ -255,20 +262,8 @@ static void intel_dvo_pre_enable(struct intel_encoder *encoder) ...@@ -255,20 +262,8 @@ static void intel_dvo_pre_enable(struct intel_encoder *encoder)
struct intel_dvo *intel_dvo = enc_to_dvo(encoder); struct intel_dvo *intel_dvo = enc_to_dvo(encoder);
int pipe = crtc->pipe; int pipe = crtc->pipe;
u32 dvo_val; u32 dvo_val;
u32 dvo_reg = intel_dvo->dev.dvo_reg, dvo_srcdim_reg; u32 dvo_reg = intel_dvo->dev.dvo_reg;
u32 dvo_srcdim_reg = intel_dvo->dev.dvo_srcdim_reg;
switch (dvo_reg) {
case DVOA:
default:
dvo_srcdim_reg = DVOA_SRCDIM;
break;
case DVOB:
dvo_srcdim_reg = DVOB_SRCDIM;
break;
case DVOC:
dvo_srcdim_reg = DVOC_SRCDIM;
break;
}
/* Save the data order, since I don't know what it should be set to. */ /* Save the data order, since I don't know what it should be set to. */
dvo_val = I915_READ(dvo_reg) & dvo_val = I915_READ(dvo_reg) &
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment