Skip to contentSkip to conversation

toshiba_acpi: Fix regression caused by backlight extra check code

PATCH In review Azael Avalos 2 participants 2 messages Nov 25, 2014

Subsystems (2)
lore
Share & tools
lore

Azael Avalos

author maintainer
#0 lore raw

PATCH v2 1/1 toshiba_acpi: Fix regression caused by backlight extra check code

Bug 86521 uncovered that some TOS6208 devices also return non zero values on a write call to the backlight method, thus getting caught and bailed out by the extra check code.

This patch changes the set_lcd_brightness function to its "original" state by just adapting it to the new function format.

---
Changes since v1:
- Simply revert the commit to its original state by just adapting the code to the new function format

Darren,

This patch simply reverts the commit so the bug can be closed, I'll send a few patches later which will include the change needed to block the backlight on TOS1900 devices for review.

 drivers/platform/x86/toshiba_acpi.c | 21 ++++-----------------
 1 file changed, 4 insertions(+), 17 deletions(-)
drivers/platform/x86/toshiba_acpi.c +4 -17
index 96076d9..06362b7 100644
@@ -928,9 +928,7 @@ static int lcd_proc_open(struct inode *inode, struct file *file)
 
 static int set_lcd_brightness(struct toshiba_acpi_dev *dev, int value)
 {
-	u32 in[TCI_WORDS] = { HCI_SET, HCI_LCD_BRIGHTNESS, 0, 0, 0, 0 };
-	u32 out[TCI_WORDS];
-	acpi_status status;
+	u32 hci_result;
 
 	if (dev->tr_backlight_supported) {
 		bool enable = !value;
@@ -941,20 +939,9 @@ static int set_lcd_brightness(struct toshiba_acpi_dev *dev, int value)
 			value--;
 	}
 
-	in[2] = value << HCI_LCD_BRIGHTNESS_SHIFT;
-	status = tci_raw(dev, in, out);
-	if (ACPI_FAILURE(status) || out[0] == TOS_FAILURE) {
-		pr_err("ACPI call to set brightness failed");
-		return -EIO;
-	}
-	/* Extra check for "incomplete" backlight method, where the AML code
-	 * doesn't check for HCI_SET or HCI_GET and returns TOS_SUCCESS,
-	 * the actual brightness, and in some cases the max brightness.
-	 */
-	if (out[2] > 0  || out[3] == 0xE000)
-		return -ENODEV;
-
-	return out[0] == TOS_SUCCESS ? 0 : -EIO;
+	value = value << HCI_LCD_BRIGHTNESS_SHIFT;
+	hci_result = hci_write1(dev, HCI_LCD_BRIGHTNESS, value);
+	return hci_result == TOS_SUCCESS ? 0 : -EIO;
 }
 
 static int set_lcd_status(struct backlight_device *bd)
Signature · 1 line
2.1.2
#1 lore raw
Quoted 14 lines · Azael Avalos

Bug 86521 uncovered that some TOS6208 devices also return non zero values on a write call to the backlight method, thus getting caught and bailed out by the extra check code.

This patch changes the set_lcd_brightness function to its "original" state by just adapting it to the new function format.

---
Changes since v1:
- Simply revert the commit to its original state by just adapting the code to the new function format

Quoted 5 lines

Darren,

This patch simply reverts the commit so the bug can be closed, I'll send a few patches later which will include the change needed to block the backlight on TOS1900 devices for review.

Queued.

Thanks Azael,

Signature · 2 lines
Darren Hart
Intel Open Source Technology Center