Skip to contentSkip to conversation

toshiba_acpi: Add a check for TOS_NOT_SUPPORTED in the sci_open function

PATCH In review Azael Avalos 2 participants 3 messages Jan 19, 2015 – Jan 29, 2015

Subsystems (2)
lore
Share & tools
lore

Azael Avalos

author maintainer
#0 lore raw

PATCH 1/1 toshiba_acpi: Add a check for TOS_NOT_SUPPORTED in the sci_open function

This was "toshiba_acpi: Change sci_open function return value"

Some Toshiba laptops have "poorly implemented" SCI calls on their BIOSes and are not checking for sci_{open, close} calls, therefore, the sci_open function is failing and making some of the supported features unavailable (kbd backlight, touchpad, illumination, etc.).

This patch checks wheter we receive TOS_NOT_SUPPORTED and returns 1, making the supported features work on such laptops.

In the case that some laptops really do not support the SCI, all the SCI dependent functions check for TOS_NOT_SUPPORTED, and thus, not registering support for the queried feature.

---
Darren,

Hopefully this new patch eases some of the concerns of the previous patch, and this time I added a comment block explaining a bit, but of course, let me know if there is something else that needs change.

Cheers
Azael

 drivers/platform/x86/toshiba_acpi.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
drivers/platform/x86/toshiba_acpi.c +13 -0
index fc34a71..899ead6b 100644
@@ -389,6 +389,19 @@ static int sci_open(struct toshiba_acpi_dev *dev)
 	} else if (out[0] == TOS_ALREADY_OPEN) {
 		pr_info("Toshiba SCI already opened\n");
 		return 1;
+	} else if (out[0] == TOS_NOT_SUPPORTED) {
+		/* Some BIOSes do not have the SCI open/close functions
+		 * implemented and return 0x8000 (Not Supported), failing to
+		 * register some supported features.
+		 *
+		 * Simply return 1 if we hit those affected laptops to make the
+		 * supported features work.
+		 *
+		 * In the case that some laptops really do not support the SCI,
+		 * all the SCI dependent functions check for TOS_NOT_SUPPORTED,
+		 * and thus, not registering support for the queried feature.
+		 */
+		return 1;
 	} else if (out[0] == TOS_NOT_PRESENT) {
 		pr_info("Toshiba SCI is not present\n");
 	}
Signature · 1 line
2.2.1
author maintainer
#1 lore raw

Hi Darren,

Any input on this patch?

2015-01-18 19:17 GMT-07:00 Azael Avalos <[email protected]>:

Quoted 55 lines

This was "toshiba_acpi: Change sci_open function return value"

Some Toshiba laptops have "poorly implemented" SCI calls on their BIOSes and are not checking for sci_{open, close} calls, therefore, the sci_open function is failing and making some of the supported features unavailable (kbd backlight, touchpad, illumination, etc.).

This patch checks wheter we receive TOS_NOT_SUPPORTED and returns 1, making the supported features work on such laptops.

In the case that some laptops really do not support the SCI, all the SCI dependent functions check for TOS_NOT_SUPPORTED, and thus, not registering support for the queried feature.

---
Darren,

Hopefully this new patch eases some of the concerns of the previous patch, and this time I added a comment block explaining a bit, but of course, let me know if there is something else that needs change.

Cheers
Azael

 drivers/platform/x86/toshiba_acpi.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
drivers/platform/x86/toshiba_acpi.c +13 -1
index fc34a71..899ead6b 100644
@@ -389,6 +389,19 @@ static int sci_open(struct toshiba_acpi_dev *dev)
        } else if (out[0] == TOS_ALREADY_OPEN) {
                pr_info("Toshiba SCI already opened\n");
                return 1;
+       } else if (out[0] == TOS_NOT_SUPPORTED) {
+               /* Some BIOSes do not have the SCI open/close functions
+                * implemented and return 0x8000 (Not Supported), failing to
+                * register some supported features.
+                *
+                * Simply return 1 if we hit those affected laptops to make the
+                * supported features work.
+                *
+                * In the case that some laptops really do not support the SCI,
+                * all the SCI dependent functions check for TOS_NOT_SUPPORTED,
+                * and thus, not registering support for the queried feature.
+                */
+               return 1;
        } else if (out[0] == TOS_NOT_PRESENT) {
                pr_info("Toshiba SCI is not present\n");
        }
--

2.2.1

Signature · 1 line
-- El mundo apesta y vosotros apestais tambien --
#2 lore raw
In reply to Azael Avalos
Quoted 8 lines · Azael Avalos

This was "toshiba_acpi: Change sci_open function return value"

Some Toshiba laptops have "poorly implemented" SCI calls on their BIOSes and are not checking for sci_{open, close} calls, therefore, the sci_open function is failing and making some of the supported features unavailable (kbd backlight, touchpad, illumination, etc.).

This patch checks wheter we receive TOS_NOT_SUPPORTED and returns

^ whether

(checkpatch.pl would catch this)

Since I'm late in review, this one's on me ;-)

Quoted 7 lines

1, making the supported features work on such laptops.

In the case that some laptops really do not support the SCI, all the SCI dependent functions check for TOS_NOT_SUPPORTED, and thus, not registering support for the queried feature.

Queued for 3.20.

Quoted 23 lines

---
Darren,

Hopefully this new patch eases some of the concerns of the previous patch, and this time I added a comment block explaining a bit, but of course, let me know if there is something else that needs change.

Cheers
Azael

 drivers/platform/x86/toshiba_acpi.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
drivers/platform/x86/toshiba_acpi.c +2 -0
index fc34a71..899ead6b 100644
@@ -389,6 +389,19 @@ static int sci_open(struct toshiba_acpi_dev *dev)
 	} else if (out[0] == TOS_ALREADY_OPEN) {
 		pr_info("Toshiba SCI already opened\n");
 		return 1;
+	} else if (out[0] == TOS_NOT_SUPPORTED) {
+		/* Some BIOSes do not have the SCI open/close functions

drivers/platform/x86/toshiba_acpi.c static int sci_open(struct toshiba_acpi_dev *dev) · line 403

Quoted 10 lines
drivers/platform/x86/toshiba_acpi.c +10 -0
+		 * implemented and return 0x8000 (Not Supported), failing to
+		 * register some supported features.
+		 *
+		 * Simply return 1 if we hit those affected laptops to make the
+		 * supported features work.
+		 *
+		 * In the case that some laptops really do not support the SCI,
+		 * all the SCI dependent functions check for TOS_NOT_SUPPORTED,
+		 * and thus, not registering support for the queried feature.
+		 */

This is great by the way, when things are just weird/broken, this is when we need really clear comments.

drivers/platform/x86/toshiba_acpi.c static int sci_open(struct toshiba_acpi_dev *dev) · line 407

Quoted 4 lines
drivers/platform/x86/toshiba_acpi.c +1 -0
+		return 1;
 	} else if (out[0] == TOS_NOT_PRESENT) {
 		pr_info("Toshiba SCI is not present\n");
 	}

Thanks,

Signature · 2 lines
Darren Hart
Intel Open Source Technology Center