aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2012-03-23 18:43:35 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2012-03-24 10:55:53 -0400
commiteef4eacb6ed3940b4a15daf3fbd060243e54056c (patch)
treedaf7a93bfe8307fd5672ed72ae3f28fa4074c5d7 /drivers
parent7eea1ddf6168cbe4507f429da53752229e9ff5b7 (diff)
drm/i915/sdov: switch IS_SDVOB to a flag
With valleyview we'll have these at yet another address, so keeping track of this with an ever-growing list of registers will get ugly. This way intel_sdvo.c is fully independent of the base address of the output ports display register blocks. While at it, do 2 closely related cleanups: - use SDVO_NAME some more - change the sdvo_reg variables to uint32_t like other registers. Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/i915/intel_display.c6
-rw-r--r--drivers/gpu/drm/i915/intel_drv.h3
-rw-r--r--drivers/gpu/drm/i915/intel_sdvo.c33
3 files changed, 23 insertions, 19 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index a0e31660381c..a7c2ddc96f0e 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -7810,7 +7810,7 @@ static void intel_setup_outputs(struct drm_device *dev)
7810 7810
7811 if (I915_READ(HDMIB) & PORT_DETECTED) { 7811 if (I915_READ(HDMIB) & PORT_DETECTED) {
7812 /* PCH SDVOB multiplex with HDMIB */ 7812 /* PCH SDVOB multiplex with HDMIB */
7813 found = intel_sdvo_init(dev, PCH_SDVOB); 7813 found = intel_sdvo_init(dev, PCH_SDVOB, true);
7814 if (!found) 7814 if (!found)
7815 intel_hdmi_init(dev, HDMIB); 7815 intel_hdmi_init(dev, HDMIB);
7816 if (!found && (I915_READ(PCH_DP_B) & DP_DETECTED)) 7816 if (!found && (I915_READ(PCH_DP_B) & DP_DETECTED))
@@ -7834,7 +7834,7 @@ static void intel_setup_outputs(struct drm_device *dev)
7834 7834
7835 if (I915_READ(SDVOB) & SDVO_DETECTED) { 7835 if (I915_READ(SDVOB) & SDVO_DETECTED) {
7836 DRM_DEBUG_KMS("probing SDVOB\n"); 7836 DRM_DEBUG_KMS("probing SDVOB\n");
7837 found = intel_sdvo_init(dev, SDVOB); 7837 found = intel_sdvo_init(dev, SDVOB, true);
7838 if (!found && SUPPORTS_INTEGRATED_HDMI(dev)) { 7838 if (!found && SUPPORTS_INTEGRATED_HDMI(dev)) {
7839 DRM_DEBUG_KMS("probing HDMI on SDVOB\n"); 7839 DRM_DEBUG_KMS("probing HDMI on SDVOB\n");
7840 intel_hdmi_init(dev, SDVOB); 7840 intel_hdmi_init(dev, SDVOB);
@@ -7850,7 +7850,7 @@ static void intel_setup_outputs(struct drm_device *dev)
7850 7850
7851 if (I915_READ(SDVOB) & SDVO_DETECTED) { 7851 if (I915_READ(SDVOB) & SDVO_DETECTED) {
7852 DRM_DEBUG_KMS("probing SDVOC\n"); 7852 DRM_DEBUG_KMS("probing SDVOC\n");
7853 found = intel_sdvo_init(dev, SDVOC); 7853 found = intel_sdvo_init(dev, SDVOC, false);
7854 } 7854 }
7855 7855
7856 if (!found && (I915_READ(SDVOC) & SDVO_DETECTED)) { 7856 if (!found && (I915_READ(SDVOC) & SDVO_DETECTED)) {
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 9cec6c3937fa..219efe3b9ad5 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -293,7 +293,8 @@ extern void intel_attach_broadcast_rgb_property(struct drm_connector *connector)
293extern void intel_crt_init(struct drm_device *dev); 293extern void intel_crt_init(struct drm_device *dev);
294extern void intel_hdmi_init(struct drm_device *dev, int sdvox_reg); 294extern void intel_hdmi_init(struct drm_device *dev, int sdvox_reg);
295void intel_dip_infoframe_csum(struct dip_infoframe *avi_if); 295void intel_dip_infoframe_csum(struct dip_infoframe *avi_if);
296extern bool intel_sdvo_init(struct drm_device *dev, int output_device); 296extern bool intel_sdvo_init(struct drm_device *dev, uint32_t sdvo_reg,
297 bool is_sdvob);
297extern void intel_dvo_init(struct drm_device *dev); 298extern void intel_dvo_init(struct drm_device *dev);
298extern void intel_tv_init(struct drm_device *dev); 299extern void intel_tv_init(struct drm_device *dev);
299extern void intel_mark_busy(struct drm_device *dev, 300extern void intel_mark_busy(struct drm_device *dev,
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index e36b171c1e7d..70fb275cd205 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -74,7 +74,7 @@ struct intel_sdvo {
74 struct i2c_adapter ddc; 74 struct i2c_adapter ddc;
75 75
76 /* Register for the SDVO device: SDVOB or SDVOC */ 76 /* Register for the SDVO device: SDVOB or SDVOC */
77 int sdvo_reg; 77 uint32_t sdvo_reg;
78 78
79 /* Active outputs controlled by this SDVO output */ 79 /* Active outputs controlled by this SDVO output */
80 uint16_t controlled_output; 80 uint16_t controlled_output;
@@ -114,6 +114,9 @@ struct intel_sdvo {
114 */ 114 */
115 bool is_tv; 115 bool is_tv;
116 116
117 /* On different gens SDVOB is at different places. */
118 bool is_sdvob;
119
117 /* This is for current tv format name */ 120 /* This is for current tv format name */
118 int tv_format_index; 121 int tv_format_index;
119 122
@@ -403,8 +406,7 @@ static const struct _sdvo_cmd_name {
403 SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_HBUF_DATA), 406 SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_HBUF_DATA),
404}; 407};
405 408
406#define IS_SDVOB(reg) (reg == SDVOB || reg == PCH_SDVOB) 409#define SDVO_NAME(svdo) ((svdo)->is_sdvob ? "SDVOB" : "SDVOC")
407#define SDVO_NAME(svdo) (IS_SDVOB((svdo)->sdvo_reg) ? "SDVOB" : "SDVOC")
408 410
409static void intel_sdvo_debug_write(struct intel_sdvo *intel_sdvo, u8 cmd, 411static void intel_sdvo_debug_write(struct intel_sdvo *intel_sdvo, u8 cmd,
410 const void *args, int args_len) 412 const void *args, int args_len)
@@ -1893,7 +1895,7 @@ intel_sdvo_select_ddc_bus(struct drm_i915_private *dev_priv,
1893{ 1895{
1894 struct sdvo_device_mapping *mapping; 1896 struct sdvo_device_mapping *mapping;
1895 1897
1896 if (IS_SDVOB(reg)) 1898 if (sdvo->is_sdvob)
1897 mapping = &(dev_priv->sdvo_mappings[0]); 1899 mapping = &(dev_priv->sdvo_mappings[0]);
1898 else 1900 else
1899 mapping = &(dev_priv->sdvo_mappings[1]); 1901 mapping = &(dev_priv->sdvo_mappings[1]);
@@ -1911,7 +1913,7 @@ intel_sdvo_select_i2c_bus(struct drm_i915_private *dev_priv,
1911 struct sdvo_device_mapping *mapping; 1913 struct sdvo_device_mapping *mapping;
1912 u8 pin; 1914 u8 pin;
1913 1915
1914 if (IS_SDVOB(reg)) 1916 if (sdvo->is_sdvob)
1915 mapping = &dev_priv->sdvo_mappings[0]; 1917 mapping = &dev_priv->sdvo_mappings[0];
1916 else 1918 else
1917 mapping = &dev_priv->sdvo_mappings[1]; 1919 mapping = &dev_priv->sdvo_mappings[1];
@@ -1936,12 +1938,12 @@ intel_sdvo_is_hdmi_connector(struct intel_sdvo *intel_sdvo, int device)
1936} 1938}
1937 1939
1938static u8 1940static u8
1939intel_sdvo_get_slave_addr(struct drm_device *dev, int sdvo_reg) 1941intel_sdvo_get_slave_addr(struct drm_device *dev, struct intel_sdvo *sdvo)
1940{ 1942{
1941 struct drm_i915_private *dev_priv = dev->dev_private; 1943 struct drm_i915_private *dev_priv = dev->dev_private;
1942 struct sdvo_device_mapping *my_mapping, *other_mapping; 1944 struct sdvo_device_mapping *my_mapping, *other_mapping;
1943 1945
1944 if (IS_SDVOB(sdvo_reg)) { 1946 if (sdvo->is_sdvob) {
1945 my_mapping = &dev_priv->sdvo_mappings[0]; 1947 my_mapping = &dev_priv->sdvo_mappings[0];
1946 other_mapping = &dev_priv->sdvo_mappings[1]; 1948 other_mapping = &dev_priv->sdvo_mappings[1];
1947 } else { 1949 } else {
@@ -1966,7 +1968,7 @@ intel_sdvo_get_slave_addr(struct drm_device *dev, int sdvo_reg)
1966 /* No SDVO device info is found for another DVO port, 1968 /* No SDVO device info is found for another DVO port,
1967 * so use mapping assumption we had before BIOS parsing. 1969 * so use mapping assumption we had before BIOS parsing.
1968 */ 1970 */
1969 if (IS_SDVOB(sdvo_reg)) 1971 if (sdvo->is_sdvob)
1970 return 0x70; 1972 return 0x70;
1971 else 1973 else
1972 return 0x72; 1974 return 0x72;
@@ -2482,7 +2484,7 @@ intel_sdvo_init_ddc_proxy(struct intel_sdvo *sdvo,
2482 return i2c_add_adapter(&sdvo->ddc) == 0; 2484 return i2c_add_adapter(&sdvo->ddc) == 0;
2483} 2485}
2484 2486
2485bool intel_sdvo_init(struct drm_device *dev, int sdvo_reg) 2487bool intel_sdvo_init(struct drm_device *dev, uint32_t sdvo_reg, bool is_sdvob)
2486{ 2488{
2487 struct drm_i915_private *dev_priv = dev->dev_private; 2489 struct drm_i915_private *dev_priv = dev->dev_private;
2488 struct intel_encoder *intel_encoder; 2490 struct intel_encoder *intel_encoder;
@@ -2494,7 +2496,8 @@ bool intel_sdvo_init(struct drm_device *dev, int sdvo_reg)
2494 return false; 2496 return false;
2495 2497
2496 intel_sdvo->sdvo_reg = sdvo_reg; 2498 intel_sdvo->sdvo_reg = sdvo_reg;
2497 intel_sdvo->slave_addr = intel_sdvo_get_slave_addr(dev, sdvo_reg) >> 1; 2499 intel_sdvo->is_sdvob = is_sdvob;
2500 intel_sdvo->slave_addr = intel_sdvo_get_slave_addr(dev, intel_sdvo) >> 1;
2498 intel_sdvo_select_i2c_bus(dev_priv, intel_sdvo, sdvo_reg); 2501 intel_sdvo_select_i2c_bus(dev_priv, intel_sdvo, sdvo_reg);
2499 if (!intel_sdvo_init_ddc_proxy(intel_sdvo, dev)) { 2502 if (!intel_sdvo_init_ddc_proxy(intel_sdvo, dev)) {
2500 kfree(intel_sdvo); 2503 kfree(intel_sdvo);
@@ -2511,13 +2514,13 @@ bool intel_sdvo_init(struct drm_device *dev, int sdvo_reg)
2511 u8 byte; 2514 u8 byte;
2512 2515
2513 if (!intel_sdvo_read_byte(intel_sdvo, i, &byte)) { 2516 if (!intel_sdvo_read_byte(intel_sdvo, i, &byte)) {
2514 DRM_DEBUG_KMS("No SDVO device found on SDVO%c\n", 2517 DRM_DEBUG_KMS("No SDVO device found on %s\n",
2515 IS_SDVOB(sdvo_reg) ? 'B' : 'C'); 2518 SDVO_NAME(intel_sdvo));
2516 goto err; 2519 goto err;
2517 } 2520 }
2518 } 2521 }
2519 2522
2520 if (IS_SDVOB(sdvo_reg)) 2523 if (intel_sdvo->is_sdvob)
2521 dev_priv->hotplug_supported_mask |= SDVOB_HOTPLUG_INT_STATUS; 2524 dev_priv->hotplug_supported_mask |= SDVOB_HOTPLUG_INT_STATUS;
2522 else 2525 else
2523 dev_priv->hotplug_supported_mask |= SDVOC_HOTPLUG_INT_STATUS; 2526 dev_priv->hotplug_supported_mask |= SDVOC_HOTPLUG_INT_STATUS;
@@ -2538,8 +2541,8 @@ bool intel_sdvo_init(struct drm_device *dev, int sdvo_reg)
2538 2541
2539 if (intel_sdvo_output_setup(intel_sdvo, 2542 if (intel_sdvo_output_setup(intel_sdvo,
2540 intel_sdvo->caps.output_flags) != true) { 2543 intel_sdvo->caps.output_flags) != true) {
2541 DRM_DEBUG_KMS("SDVO output failed to setup on SDVO%c\n", 2544 DRM_DEBUG_KMS("SDVO output failed to setup on %s\n",
2542 IS_SDVOB(sdvo_reg) ? 'B' : 'C'); 2545 SDVO_NAME(intel_sdvo));
2543 goto err; 2546 goto err;
2544 } 2547 }
2545 2548