From 73bff90a60eab40ea2ad007133cd17056f63b016 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 22 Jan 2010 07:14:27 -0800 Subject: [PATCH] more .32 patches --- ...after-issuing-ddc-bus-switch-command.patch | 100 ++++++++++++++++++ ...he-sdvo-device-with-multiple-outputs.patch | 59 +++++++++++ ...ile-iterating-enclosure_status-array.patch | 49 +++++++++ queue-2.6.32/series | 3 + 4 files changed, 211 insertions(+) create mode 100644 queue-2.6.32/drm-i915-read-the-response-after-issuing-ddc-bus-switch-command.patch create mode 100644 queue-2.6.32/drm-i915-try-another-possible-ddc-bus-for-the-sdvo-device-with-multiple-outputs.patch create mode 100644 queue-2.6.32/scsi-enclosure-fix-oops-while-iterating-enclosure_status-array.patch diff --git a/queue-2.6.32/drm-i915-read-the-response-after-issuing-ddc-bus-switch-command.patch b/queue-2.6.32/drm-i915-read-the-response-after-issuing-ddc-bus-switch-command.patch new file mode 100644 index 00000000000..e00da34b3c7 --- /dev/null +++ b/queue-2.6.32/drm-i915-read-the-response-after-issuing-ddc-bus-switch-command.patch @@ -0,0 +1,100 @@ +From 6a304caf0bf9c429fc261f260b86cabf5bde2cbb Mon Sep 17 00:00:00 2001 +From: Zhao Yakui +Date: Fri, 8 Jan 2010 10:58:19 +0800 +Subject: drm/i915: Read the response after issuing DDC bus switch command + +From: Zhao Yakui + +commit 6a304caf0bf9c429fc261f260b86cabf5bde2cbb upstream. + +For some SDVO cards based on conexant chip, we can't read the EDID if +we don't read the response after issuing SDVO DDC bus switch +command. + +From the SDVO spec once when another I2C transaction is finished after +completing the I2C transaction of issuing the bus switch command, it +will be switched back to the SDVO internal state again. So we can't +initiate a new I2C transaction to read the response after issuing the +DDC bus switch command. Instead we should issue DDC bus switch command +and read the response in the same I2C transaction. + +https://bugs.freedesktop.org/show_bug.cgi?id=23842 +https://bugs.freedesktop.org/show_bug.cgi?id=24458 +https://bugs.freedesktop.org/show_bug.cgi?id=24522 +https://bugs.freedesktop.org/show_bug.cgi?id=24282 + +Signed-off-by: Zhao Yakui +Tested-by: Sebastien Caty +Signed-off-by: Eric Anholt +Signed-off-by: Greg Kroah-Hartman + +--- a/drivers/gpu/drm/i915/intel_sdvo.c ++++ b/drivers/gpu/drm/i915/intel_sdvo.c +@@ -462,14 +462,63 @@ static int intel_sdvo_get_pixel_multiplier(struct drm_display_mode *mode) + } + + /** +- * Don't check status code from this as it switches the bus back to the +- * SDVO chips which defeats the purpose of doing a bus switch in the first +- * place. ++ * Try to read the response after issuie the DDC switch command. But it ++ * is noted that we must do the action of reading response and issuing DDC ++ * switch command in one I2C transaction. Otherwise when we try to start ++ * another I2C transaction after issuing the DDC bus switch, it will be ++ * switched to the internal SDVO register. + */ + static void intel_sdvo_set_control_bus_switch(struct intel_output *intel_output, + u8 target) + { +- intel_sdvo_write_cmd(intel_output, SDVO_CMD_SET_CONTROL_BUS_SWITCH, &target, 1); ++ struct intel_sdvo_priv *sdvo_priv = intel_output->dev_priv; ++ u8 out_buf[2], cmd_buf[2], ret_value[2], ret; ++ struct i2c_msg msgs[] = { ++ { ++ .addr = sdvo_priv->slave_addr >> 1, ++ .flags = 0, ++ .len = 2, ++ .buf = out_buf, ++ }, ++ /* the following two are to read the response */ ++ { ++ .addr = sdvo_priv->slave_addr >> 1, ++ .flags = 0, ++ .len = 1, ++ .buf = cmd_buf, ++ }, ++ { ++ .addr = sdvo_priv->slave_addr >> 1, ++ .flags = I2C_M_RD, ++ .len = 1, ++ .buf = ret_value, ++ }, ++ }; ++ ++ intel_sdvo_debug_write(intel_output, SDVO_CMD_SET_CONTROL_BUS_SWITCH, ++ &target, 1); ++ /* write the DDC switch command argument */ ++ intel_sdvo_write_byte(intel_output, SDVO_I2C_ARG_0, target); ++ ++ out_buf[0] = SDVO_I2C_OPCODE; ++ out_buf[1] = SDVO_CMD_SET_CONTROL_BUS_SWITCH; ++ cmd_buf[0] = SDVO_I2C_CMD_STATUS; ++ cmd_buf[1] = 0; ++ ret_value[0] = 0; ++ ret_value[1] = 0; ++ ++ ret = i2c_transfer(intel_output->i2c_bus, msgs, 3); ++ if (ret != 3) { ++ /* failure in I2C transfer */ ++ DRM_DEBUG_KMS("I2c transfer returned %d\n", ret); ++ return; ++ } ++ if (ret_value[0] != SDVO_CMD_STATUS_SUCCESS) { ++ DRM_DEBUG_KMS("DDC switch command returns response %d\n", ++ ret_value[0]); ++ return; ++ } ++ return; + } + + static bool intel_sdvo_set_target_input(struct intel_output *intel_output, bool target_0, bool target_1) diff --git a/queue-2.6.32/drm-i915-try-another-possible-ddc-bus-for-the-sdvo-device-with-multiple-outputs.patch b/queue-2.6.32/drm-i915-try-another-possible-ddc-bus-for-the-sdvo-device-with-multiple-outputs.patch new file mode 100644 index 00000000000..e3e9ba81c92 --- /dev/null +++ b/queue-2.6.32/drm-i915-try-another-possible-ddc-bus-for-the-sdvo-device-with-multiple-outputs.patch @@ -0,0 +1,59 @@ +From 7c3f0a2726fed78e0e0afe3b6fc3c1f5b298e447 Mon Sep 17 00:00:00 2001 +From: Zhao Yakui +Date: Fri, 8 Jan 2010 10:58:20 +0800 +Subject: drm/i915: try another possible DDC bus for the SDVO device with multiple outputs + +From: Zhao Yakui + +commit 7c3f0a2726fed78e0e0afe3b6fc3c1f5b298e447 upstream. + +There exist multiple DDC buses for the SDVO cards with multiple outputs. +When we can't get the EDID by using the select DDC bus, we can try the other +possible DDC bus to see whether the EDID can be obtained. + +https://bugs.freedesktop.org/show_bug.cgi?id=23842 + +Signed-off-by: Zhao Yakui +Tested-by: Sebastien Caty +Signed-off-by: Eric Anholt +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/i915/intel_sdvo.c | 26 ++++++++++++++++++++++++++ + 1 file changed, 26 insertions(+) + +--- a/drivers/gpu/drm/i915/intel_sdvo.c ++++ b/drivers/gpu/drm/i915/intel_sdvo.c +@@ -1638,6 +1638,32 @@ intel_sdvo_hdmi_sink_detect(struct drm_c + edid = drm_get_edid(&intel_output->base, + intel_output->ddc_bus); + ++ /* This is only applied to SDVO cards with multiple outputs */ ++ if (edid == NULL && intel_sdvo_multifunc_encoder(intel_output)) { ++ uint8_t saved_ddc, temp_ddc; ++ saved_ddc = sdvo_priv->ddc_bus; ++ temp_ddc = sdvo_priv->ddc_bus >> 1; ++ /* ++ * Don't use the 1 as the argument of DDC bus switch to get ++ * the EDID. It is used for SDVO SPD ROM. ++ */ ++ while(temp_ddc > 1) { ++ sdvo_priv->ddc_bus = temp_ddc; ++ edid = drm_get_edid(&intel_output->base, ++ intel_output->ddc_bus); ++ if (edid) { ++ /* ++ * When we can get the EDID, maybe it is the ++ * correct DDC bus. Update it. ++ */ ++ sdvo_priv->ddc_bus = temp_ddc; ++ break; ++ } ++ temp_ddc >>= 1; ++ } ++ if (edid == NULL) ++ sdvo_priv->ddc_bus = saved_ddc; ++ } + /* when there is no edid and no monitor is connected with VGA + * port, try to use the CRT ddc to read the EDID for DVI-connector + */ diff --git a/queue-2.6.32/scsi-enclosure-fix-oops-while-iterating-enclosure_status-array.patch b/queue-2.6.32/scsi-enclosure-fix-oops-while-iterating-enclosure_status-array.patch new file mode 100644 index 00000000000..c8eeacdf73d --- /dev/null +++ b/queue-2.6.32/scsi-enclosure-fix-oops-while-iterating-enclosure_status-array.patch @@ -0,0 +1,49 @@ +From cc9b2e9f6603190c009e5d2629ce8e3f99571346 Mon Sep 17 00:00:00 2001 +From: James Bottomley +Date: Thu, 26 Nov 2009 09:50:20 -0600 +Subject: SCSI: enclosure: fix oops while iterating enclosure_status array + +From: James Bottomley + +commit cc9b2e9f6603190c009e5d2629ce8e3f99571346 upstream. + +Based on patch originally by Jeff Mahoney + + enclosure_status is expected to be a NULL terminated array of strings + but isn't actually NULL terminated. When writing an invalid value to + /sys/class/enclosure/.../.../status, it goes off the end of the array + and Oopses. + + +Fix by making the assumption true and adding NULL at the end. + +Reported-by: Artur Wojcik +Signed-off-by: James Bottomley +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/misc/enclosure.c | 1 + + include/linux/enclosure.h | 2 ++ + 2 files changed, 3 insertions(+) + +--- a/drivers/misc/enclosure.c ++++ b/drivers/misc/enclosure.c +@@ -391,6 +391,7 @@ static const char *const enclosure_statu + [ENCLOSURE_STATUS_NOT_INSTALLED] = "not installed", + [ENCLOSURE_STATUS_UNKNOWN] = "unknown", + [ENCLOSURE_STATUS_UNAVAILABLE] = "unavailable", ++ [ENCLOSURE_STATUS_MAX] = NULL, + }; + + static const char *const enclosure_type [] = { +--- a/include/linux/enclosure.h ++++ b/include/linux/enclosure.h +@@ -42,6 +42,8 @@ enum enclosure_status { + ENCLOSURE_STATUS_NOT_INSTALLED, + ENCLOSURE_STATUS_UNKNOWN, + ENCLOSURE_STATUS_UNAVAILABLE, ++ /* last element for counting purposes */ ++ ENCLOSURE_STATUS_MAX + }; + + /* SFF-8485 activity light settings */ diff --git a/queue-2.6.32/series b/queue-2.6.32/series index 87916b3ac6c..71c2b34f052 100644 --- a/queue-2.6.32/series +++ b/queue-2.6.32/series @@ -16,3 +16,6 @@ usb-add-missing-delay-during-remote-wakeup.patch usb-add-speed-values-for-usb-3.0-and-wireless-controllers.patch acpi-ec-accelerate-query-execution.patch acpi-ec-add-wait-for-irq-storm.patch +scsi-enclosure-fix-oops-while-iterating-enclosure_status-array.patch +drm-i915-read-the-response-after-issuing-ddc-bus-switch-command.patch +drm-i915-try-another-possible-ddc-bus-for-the-sdvo-device-with-multiple-outputs.patch -- 2.47.3