aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_sdvo.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2010-09-14 14:11:56 -0400
committerChris Wilson <chris@chris-wilson.co.uk>2010-09-14 16:13:12 -0400
commit819f3fb7fe349d0e6aadbd7088529ab95fe5cd9f (patch)
tree81c64e8d0a6cb5565aff1b8970be8b1f04bc3299 /drivers/gpu/drm/i915/intel_sdvo.c
parent9d1a903d4ba1033b811ded8d3e5d0f01eeeaaa1d (diff)
drm/i915/sdvo: Propagate i2c error from switching DDC control bus.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_sdvo.c')
-rw-r--r--drivers/gpu/drm/i915/intel_sdvo.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index 05f5313e14a6..fa9dbb72fb46 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -530,8 +530,8 @@ static int intel_sdvo_get_pixel_multiplier(struct drm_display_mode *mode)
530 * another I2C transaction after issuing the DDC bus switch, it will be 530 * another I2C transaction after issuing the DDC bus switch, it will be
531 * switched to the internal SDVO register. 531 * switched to the internal SDVO register.
532 */ 532 */
533static void intel_sdvo_set_control_bus_switch(struct intel_sdvo *intel_sdvo, 533static int intel_sdvo_set_control_bus_switch(struct intel_sdvo *intel_sdvo,
534 u8 target) 534 u8 target)
535{ 535{
536 u8 out_buf[2], cmd_buf[2], ret_value[2], ret; 536 u8 out_buf[2], cmd_buf[2], ret_value[2], ret;
537 struct i2c_msg msgs[] = { 537 struct i2c_msg msgs[] = {
@@ -557,9 +557,10 @@ static void intel_sdvo_set_control_bus_switch(struct intel_sdvo *intel_sdvo,
557 }; 557 };
558 558
559 intel_sdvo_debug_write(intel_sdvo, SDVO_CMD_SET_CONTROL_BUS_SWITCH, 559 intel_sdvo_debug_write(intel_sdvo, SDVO_CMD_SET_CONTROL_BUS_SWITCH,
560 &target, 1); 560 &target, 1);
561 /* write the DDC switch command argument */ 561 /* write the DDC switch command argument */
562 intel_sdvo_write_byte(intel_sdvo, SDVO_I2C_ARG_0, target); 562 if (!intel_sdvo_write_byte(intel_sdvo, SDVO_I2C_ARG_0, target))
563 return -EIO;
563 564
564 out_buf[0] = SDVO_I2C_OPCODE; 565 out_buf[0] = SDVO_I2C_OPCODE;
565 out_buf[1] = SDVO_CMD_SET_CONTROL_BUS_SWITCH; 566 out_buf[1] = SDVO_CMD_SET_CONTROL_BUS_SWITCH;
@@ -569,17 +570,20 @@ static void intel_sdvo_set_control_bus_switch(struct intel_sdvo *intel_sdvo,
569 ret_value[1] = 0; 570 ret_value[1] = 0;
570 571
571 ret = i2c_transfer(intel_sdvo->base.i2c_bus, msgs, 3); 572 ret = i2c_transfer(intel_sdvo->base.i2c_bus, msgs, 3);
573 if (ret < 0)
574 return ret;
572 if (ret != 3) { 575 if (ret != 3) {
573 /* failure in I2C transfer */ 576 /* failure in I2C transfer */
574 DRM_DEBUG_KMS("I2c transfer returned %d\n", ret); 577 DRM_DEBUG_KMS("I2c transfer returned %d\n", ret);
575 return; 578 return -EIO;
576 } 579 }
577 if (ret_value[0] != SDVO_CMD_STATUS_SUCCESS) { 580 if (ret_value[0] != SDVO_CMD_STATUS_SUCCESS) {
578 DRM_DEBUG_KMS("DDC switch command returns response %d\n", 581 DRM_DEBUG_KMS("DDC switch command returns response %d\n",
579 ret_value[0]); 582 ret_value[0]);
580 return; 583 return -EIO;
581 } 584 }
582 return; 585
586 return 0;
583} 587}
584 588
585static bool intel_sdvo_set_value(struct intel_sdvo *intel_sdvo, u8 cmd, const void *data, int len) 589static bool intel_sdvo_set_value(struct intel_sdvo *intel_sdvo, u8 cmd, const void *data, int len)
@@ -1982,13 +1986,18 @@ static int intel_sdvo_master_xfer(struct i2c_adapter *i2c_adap,
1982{ 1986{
1983 struct intel_sdvo *intel_sdvo; 1987 struct intel_sdvo *intel_sdvo;
1984 const struct i2c_algorithm *algo; 1988 const struct i2c_algorithm *algo;
1989 int ret;
1985 1990
1986 intel_sdvo = container_of(i2c_adap->algo_data, 1991 intel_sdvo = container_of(i2c_adap->algo_data,
1987 struct intel_sdvo, 1992 struct intel_sdvo,
1988 base); 1993 base);
1989 algo = intel_sdvo->base.i2c_bus->algo; 1994 algo = intel_sdvo->base.i2c_bus->algo;
1990 1995
1991 intel_sdvo_set_control_bus_switch(intel_sdvo, intel_sdvo->ddc_bus); 1996 ret = intel_sdvo_set_control_bus_switch(intel_sdvo,
1997 intel_sdvo->ddc_bus);
1998 if (ret)
1999 return ret;
2000
1992 return algo->master_xfer(i2c_adap, msgs, num); 2001 return algo->master_xfer(i2c_adap, msgs, num);
1993} 2002}
1994 2003