Linux-ACPI Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] Input: soc_button_array - Add support for INT33D3 tablet-mode switch devices
@ 2020-05-14 20:51 Hans de Goede
  2020-05-14 20:52 ` Hans de Goede
  0 siblings, 1 reply; 2+ messages in thread
From: Hans de Goede @ 2020-05-14 20:51 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Hans de Goede, linux-acpi, linux-input, platform-driver-x86,
	Andy Shevchenko

According to the Microsoft documentation for Windows 8 convertible
devices, these devices should implement a PNP0C60 "laptop/slate mode state
indicator" ACPI device.

This device can work in 2 ways, if there is a GPIO which directly
indicates the device is in tablet-mode or not then the direct-gpio mode
should be used. If there is no such GPIO, but instead the events are
coming from e.g. the embedded-controller, then there should still be
a PNP0C60 ACPI device and event-injection should be used to send the
events. The drivers/platform/x86/intel-vbtn.c code is an example from
a standardized manner of doing the latter.

On various 2-in-1s with either a detachable keyboard, or with 360°
hinges, the direct GPIO mode is indicated by an ACPI device with a
HID of INT33D3, which contains a single GpioInt in its ACPI resource
table, which directly indicates if the device is in tablet-mode or not.

This commit adds support for this to the soc_button_array code, as
well as for the alternative ID9001 HID which some devices use
instead of the INT33D3 HID.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/input/misc/soc_button_array.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/input/misc/soc_button_array.c b/drivers/input/misc/soc_button_array.c
index e3a22a61f5d9..837c787e9c4b 100644
--- a/drivers/input/misc/soc_button_array.c
+++ b/drivers/input/misc/soc_button_array.c
@@ -397,6 +397,15 @@ static const struct soc_device_data soc_device_PNP0C40 = {
 	.button_info = soc_button_PNP0C40,
 };
 
+static const struct soc_button_info soc_button_INT33D3[] = {
+	{ "tablet_mode", 0, EV_SW, SW_TABLET_MODE, false, false, false },
+	{ }
+};
+
+static const struct soc_device_data soc_device_INT33D3 = {
+	.button_info = soc_button_INT33D3,
+};
+
 /*
  * Special device check for Surface Book 2 and Surface Pro (2017).
  * Both, the Surface Pro 4 (surfacepro3_button.c) and the above mentioned
@@ -459,6 +468,8 @@ static const struct soc_device_data soc_device_MSHW0040 = {
 
 static const struct acpi_device_id soc_button_acpi_match[] = {
 	{ "PNP0C40", (unsigned long)&soc_device_PNP0C40 },
+	{ "INT33D3", (unsigned long)&soc_device_INT33D3 },
+	{ "ID9001", (unsigned long)&soc_device_INT33D3 },
 	{ "ACPI0011", 0 },
 
 	/* Microsoft Surface Devices (5th and 6th generation) */
-- 
2.26.0


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

* Re: [PATCH] Input: soc_button_array - Add support for INT33D3 tablet-mode switch devices
  2020-05-14 20:51 [PATCH] Input: soc_button_array - Add support for INT33D3 tablet-mode switch devices Hans de Goede
@ 2020-05-14 20:52 ` Hans de Goede
  0 siblings, 0 replies; 2+ messages in thread
From: Hans de Goede @ 2020-05-14 20:52 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: linux-acpi, linux-input, platform-driver-x86, Andy Shevchenko

Hi,

This should have been 2/2 of a set of 2, let me resend, sorry.

Regards,

Hans


On 5/14/20 10:51 PM, Hans de Goede wrote:
> According to the Microsoft documentation for Windows 8 convertible
> devices, these devices should implement a PNP0C60 "laptop/slate mode state
> indicator" ACPI device.
> 
> This device can work in 2 ways, if there is a GPIO which directly
> indicates the device is in tablet-mode or not then the direct-gpio mode
> should be used. If there is no such GPIO, but instead the events are
> coming from e.g. the embedded-controller, then there should still be
> a PNP0C60 ACPI device and event-injection should be used to send the
> events. The drivers/platform/x86/intel-vbtn.c code is an example from
> a standardized manner of doing the latter.
> 
> On various 2-in-1s with either a detachable keyboard, or with 360°
> hinges, the direct GPIO mode is indicated by an ACPI device with a
> HID of INT33D3, which contains a single GpioInt in its ACPI resource
> table, which directly indicates if the device is in tablet-mode or not.
> 
> This commit adds support for this to the soc_button_array code, as
> well as for the alternative ID9001 HID which some devices use
> instead of the INT33D3 HID.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
>   drivers/input/misc/soc_button_array.c | 11 +++++++++++
>   1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/input/misc/soc_button_array.c b/drivers/input/misc/soc_button_array.c
> index e3a22a61f5d9..837c787e9c4b 100644
> --- a/drivers/input/misc/soc_button_array.c
> +++ b/drivers/input/misc/soc_button_array.c
> @@ -397,6 +397,15 @@ static const struct soc_device_data soc_device_PNP0C40 = {
>   	.button_info = soc_button_PNP0C40,
>   };
>   
> +static const struct soc_button_info soc_button_INT33D3[] = {
> +	{ "tablet_mode", 0, EV_SW, SW_TABLET_MODE, false, false, false },
> +	{ }
> +};
> +
> +static const struct soc_device_data soc_device_INT33D3 = {
> +	.button_info = soc_button_INT33D3,
> +};
> +
>   /*
>    * Special device check for Surface Book 2 and Surface Pro (2017).
>    * Both, the Surface Pro 4 (surfacepro3_button.c) and the above mentioned
> @@ -459,6 +468,8 @@ static const struct soc_device_data soc_device_MSHW0040 = {
>   
>   static const struct acpi_device_id soc_button_acpi_match[] = {
>   	{ "PNP0C40", (unsigned long)&soc_device_PNP0C40 },
> +	{ "INT33D3", (unsigned long)&soc_device_INT33D3 },
> +	{ "ID9001", (unsigned long)&soc_device_INT33D3 },
>   	{ "ACPI0011", 0 },
>   
>   	/* Microsoft Surface Devices (5th and 6th generation) */
> 


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

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-14 20:51 [PATCH] Input: soc_button_array - Add support for INT33D3 tablet-mode switch devices Hans de Goede
2020-05-14 20:52 ` Hans de Goede

Linux-ACPI Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-acpi/0 linux-acpi/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-acpi linux-acpi/ https://lore.kernel.org/linux-acpi \
		linux-acpi@vger.kernel.org
	public-inbox-index linux-acpi

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-acpi


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git