All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] toshiba_acpi: Qosmio backlight and keymap fixes
@ 2014-08-04 15:21 Azael Avalos
  2014-08-04 15:21 ` [PATCH 1/2] toshiba_acpi: Add extra check to backlight code Azael Avalos
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Azael Avalos @ 2014-08-04 15:21 UTC (permalink / raw)
  To: Matthew Garrett, platform-driver-x86, stable; +Cc: Azael Avalos

The following two patches fixes some issues regarding
the backlight method on Qosmios series X500/X505 and
X75-A (and probably others too), as well as adding
the latter to the new alternate keymap list.

Azael Avalos (2):
  toshiba_acpi: Add extra check to backlight code
  toshiba_acpi: Add Qosmio X75-A to the alt keymap dmi list

 drivers/platform/x86/toshiba_acpi.c | 28 ++++++++++++++++++++++++----
 1 file changed, 24 insertions(+), 4 deletions(-)

-- 
2.0.0

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] toshiba_acpi: Add extra check to backlight code
  2014-08-04 15:21 [PATCH 0/2] toshiba_acpi: Qosmio backlight and keymap fixes Azael Avalos
@ 2014-08-04 15:21 ` Azael Avalos
  2014-08-04 18:19   ` Greg KH
  2014-08-04 15:21 ` [PATCH 2/2] toshiba_acpi: Add Qosmio X75-A to the alt keymap dmi list Azael Avalos
  2014-08-04 18:19 ` [PATCH 0/2] toshiba_acpi: Qosmio backlight and keymap fixes Greg KH
  2 siblings, 1 reply; 6+ messages in thread
From: Azael Avalos @ 2014-08-04 15:21 UTC (permalink / raw)
  To: Matthew Garrett, platform-driver-x86, stable; +Cc: Azael Avalos

Some Toshiba models (most notably Qosmios) come with an
incomplete backlight method where the AML code doesn't
check for write or read commands and always returns
HCI_SUCCESS and the actual brightness (and in some
cases the max brightness), thus allowing the backlight
interface to be registered without write support.

This patch changes the set_lcd_brightness function,
checking the returned values for values greater than
zero to avoid registering a broken backlight interface.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
---
 drivers/platform/x86/toshiba_acpi.c | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c
index 76441dc..1ed2ffc 100644
--- a/drivers/platform/x86/toshiba_acpi.c
+++ b/drivers/platform/x86/toshiba_acpi.c
@@ -872,7 +872,9 @@ static int lcd_proc_open(struct inode *inode, struct file *file)
 
 static int set_lcd_brightness(struct toshiba_acpi_dev *dev, int value)
 {
-	u32 hci_result;
+	u32 in[HCI_WORDS] = { HCI_SET, HCI_LCD_BRIGHTNESS, 0, 0, 0, 0 };
+	u32 out[HCI_WORDS];
+	acpi_status status;
 
 	if (dev->tr_backlight_supported) {
 		bool enable = !value;
@@ -883,9 +885,20 @@ static int set_lcd_brightness(struct toshiba_acpi_dev *dev, int value)
 			value--;
 	}
 
-	value = value << HCI_LCD_BRIGHTNESS_SHIFT;
-	hci_write1(dev, HCI_LCD_BRIGHTNESS, value, &hci_result);
-	return hci_result == HCI_SUCCESS ? 0 : -EIO;
+	in[2] = value << HCI_LCD_BRIGHTNESS_SHIFT;
+	status = hci_raw(dev, in, out);
+	if (ACPI_FAILURE(status) || out[0] == HCI_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 HCI_SUCCESS,
+	 * the actual brightness, and in some cases the max brightness.
+	 */
+	if (out[2] > 0  || out[3] == 0xE000)
+		return -ENODEV;
+
+	return out[0] == HCI_SUCCESS ? 0 : -EIO;
 }
 
 static int set_lcd_status(struct backlight_device *bd)
-- 
2.0.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] toshiba_acpi: Add Qosmio X75-A to the alt keymap dmi list
  2014-08-04 15:21 [PATCH 0/2] toshiba_acpi: Qosmio backlight and keymap fixes Azael Avalos
  2014-08-04 15:21 ` [PATCH 1/2] toshiba_acpi: Add extra check to backlight code Azael Avalos
@ 2014-08-04 15:21 ` Azael Avalos
  2014-08-04 18:19   ` Greg KH
  2014-08-04 18:19 ` [PATCH 0/2] toshiba_acpi: Qosmio backlight and keymap fixes Greg KH
  2 siblings, 1 reply; 6+ messages in thread
From: Azael Avalos @ 2014-08-04 15:21 UTC (permalink / raw)
  To: Matthew Garrett, platform-driver-x86, stable; +Cc: Azael Avalos

The Toshiba Qosmio X75-A series models also come with
the new keymap layout.

This patch adds this model to the alt_keymap_dmi list,
along with an extra key found on these models.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
---
 drivers/platform/x86/toshiba_acpi.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c
index 1ed2ffc..34b7303 100644
--- a/drivers/platform/x86/toshiba_acpi.c
+++ b/drivers/platform/x86/toshiba_acpi.c
@@ -222,6 +222,12 @@ static const struct dmi_system_id toshiba_alt_keymap_dmi[] = {
 			DMI_MATCH(DMI_PRODUCT_NAME, "Satellite M840"),
 		},
 	},
+	{
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "Qosmio X75-A"),
+		},
+	},
 	{}
 };
 
@@ -229,6 +235,7 @@ static const struct key_entry toshiba_acpi_alt_keymap[] = {
 	{ KE_KEY, 0x157, { KEY_MUTE } },
 	{ KE_KEY, 0x102, { KEY_ZOOMOUT } },
 	{ KE_KEY, 0x103, { KEY_ZOOMIN } },
+	{ KE_KEY, 0x12c, { KEY_KBDILLUMTOGGLE } },
 	{ KE_KEY, 0x139, { KEY_ZOOMRESET } },
 	{ KE_KEY, 0x13e, { KEY_SWITCHVIDEOMODE } },
 	{ KE_KEY, 0x13c, { KEY_BRIGHTNESSDOWN } },
-- 
2.0.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] toshiba_acpi: Add extra check to backlight code
  2014-08-04 15:21 ` [PATCH 1/2] toshiba_acpi: Add extra check to backlight code Azael Avalos
@ 2014-08-04 18:19   ` Greg KH
  0 siblings, 0 replies; 6+ messages in thread
From: Greg KH @ 2014-08-04 18:19 UTC (permalink / raw)
  To: Azael Avalos; +Cc: Matthew Garrett, platform-driver-x86, stable

On Mon, Aug 04, 2014 at 09:21:01AM -0600, Azael Avalos wrote:
> Some Toshiba models (most notably Qosmios) come with an
> incomplete backlight method where the AML code doesn't
> check for write or read commands and always returns
> HCI_SUCCESS and the actual brightness (and in some
> cases the max brightness), thus allowing the backlight
> interface to be registered without write support.
> 
> This patch changes the set_lcd_brightness function,
> checking the returned values for values greater than
> zero to avoid registering a broken backlight interface.
> 
> Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
> ---
>  drivers/platform/x86/toshiba_acpi.c | 21 +++++++++++++++++----
>  1 file changed, 17 insertions(+), 4 deletions(-)

<formletter>

This is not the correct way to submit patches for inclusion in the
stable kernel tree.  Please read Documentation/stable_kernel_rules.txt
for how to do this properly.

</formletter>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] toshiba_acpi: Add Qosmio X75-A to the alt keymap dmi list
  2014-08-04 15:21 ` [PATCH 2/2] toshiba_acpi: Add Qosmio X75-A to the alt keymap dmi list Azael Avalos
@ 2014-08-04 18:19   ` Greg KH
  0 siblings, 0 replies; 6+ messages in thread
From: Greg KH @ 2014-08-04 18:19 UTC (permalink / raw)
  To: Azael Avalos; +Cc: Matthew Garrett, platform-driver-x86, stable

On Mon, Aug 04, 2014 at 09:21:02AM -0600, Azael Avalos wrote:
> The Toshiba Qosmio X75-A series models also come with
> the new keymap layout.
> 
> This patch adds this model to the alt_keymap_dmi list,
> along with an extra key found on these models.
> 
> Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
> ---
>  drivers/platform/x86/toshiba_acpi.c | 7 +++++++
>  1 file changed, 7 insertions(+)

<formletter>

This is not the correct way to submit patches for inclusion in the
stable kernel tree.  Please read Documentation/stable_kernel_rules.txt
for how to do this properly.

</formletter>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/2] toshiba_acpi: Qosmio backlight and keymap fixes
  2014-08-04 15:21 [PATCH 0/2] toshiba_acpi: Qosmio backlight and keymap fixes Azael Avalos
  2014-08-04 15:21 ` [PATCH 1/2] toshiba_acpi: Add extra check to backlight code Azael Avalos
  2014-08-04 15:21 ` [PATCH 2/2] toshiba_acpi: Add Qosmio X75-A to the alt keymap dmi list Azael Avalos
@ 2014-08-04 18:19 ` Greg KH
  2 siblings, 0 replies; 6+ messages in thread
From: Greg KH @ 2014-08-04 18:19 UTC (permalink / raw)
  To: Azael Avalos; +Cc: Matthew Garrett, platform-driver-x86, stable

On Mon, Aug 04, 2014 at 09:21:00AM -0600, Azael Avalos wrote:
> The following two patches fixes some issues regarding
> the backlight method on Qosmios series X500/X505 and
> X75-A (and probably others too), as well as adding
> the latter to the new alternate keymap list.
> 
> Azael Avalos (2):
>   toshiba_acpi: Add extra check to backlight code
>   toshiba_acpi: Add Qosmio X75-A to the alt keymap dmi list
> 
>  drivers/platform/x86/toshiba_acpi.c | 28 ++++++++++++++++++++++++----
>  1 file changed, 24 insertions(+), 4 deletions(-)
> 

<formletter>

This is not the correct way to submit patches for inclusion in the
stable kernel tree.  Please read Documentation/stable_kernel_rules.txt
for how to do this properly.

</formletter>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-08-04 18:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-04 15:21 [PATCH 0/2] toshiba_acpi: Qosmio backlight and keymap fixes Azael Avalos
2014-08-04 15:21 ` [PATCH 1/2] toshiba_acpi: Add extra check to backlight code Azael Avalos
2014-08-04 18:19   ` Greg KH
2014-08-04 15:21 ` [PATCH 2/2] toshiba_acpi: Add Qosmio X75-A to the alt keymap dmi list Azael Avalos
2014-08-04 18:19   ` Greg KH
2014-08-04 18:19 ` [PATCH 0/2] toshiba_acpi: Qosmio backlight and keymap fixes Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.