Input: Replace surface3_button code with soc_button_array
Subsystems (5)
cover Input: Replace surface3_button code with soc_button_array
Hi All,
I noticed that the surface3_button code was pretty much a 1:1 copy of soc_button_array. This series adds support to soc_button_array for the MSHW0028 device on the Microsoft Surface 3 (non pro) and removes the now no longer needed surface3_button driver.
Rafael, this includes an addition to ignore_serial_bus_ids[] in drivers/apci/scan.c, may we have your ack for merging this through the input or pdx86 tree please ?
Dmitry, I believe it would be best to keep these 2 patches together and merge both through either the input or the pdx86 tree. If you are ok with me merging this through the pdx86 tree may I have your Ack for that ?
If you prefer merging this through the input tree please consider this my ack for also merge 2/2 through the input tree.
Note both patches can also be merged through separate trees without issues but keeping them together seems better to me.
Regards,
Hans
Hans de Goede (2):
Input: soc_button_array - add support for Microsoft Surface 3
(MSHW0028) buttons
platform/surface: Remove Surface 3 Button driver
drivers/acpi/scan.c | 5 + drivers/input/misc/soc_button_array.c | 24 +- drivers/platform/surface/Kconfig | 7 - drivers/platform/surface/Makefile | 1 - drivers/platform/surface/surface3_button.c | 247 --------------------- 5 files changed, 28 insertions(+), 256 deletions(-) delete mode 100644 drivers/platform/surface/surface3_button.c
Signature · 1 line
2.35.1
PATCH 1/2 Input: soc_button_array - add support for Microsoft Surface 3 (MSHW0028) buttons
The drivers/platform/surface/surface3_button.c code is alsmost a 1:1 copy of the soc_button_array code.
The only big difference is that it binds to an i2c_client rather then to a platform_device. The cause of this is the ACPI resources for the MSHW0028 device containing a bogus I2cSerialBusV2 resource which causes the kernel to instantiate an i2c_client for it instead of a platform_device.
Add "MSHW0028" to the ignore_serial_bus_ids[] list in drivers/apci/scan.c, so that a platform_device will be instantiated and add support for the MSHW0028 HID to soc_button_array.
This fully replaces surface3_button, which will be removed in a separate commit (since it binds to the now no longer created i2c_client it no longer does anyyhing after this commit).
Note the MSHW0028 id is used by Microsoft to describe the tablet buttons on both the Surface 3 and the Surface 3 Pro and the actual API/implementation for the Surface 3 Pro is quite different. The changes in this commit should not impact the separate surfacepro3_button driver:
1. Because of the bogus I2cSerialBusV2 resource problem that driver binds to the acpi_device itself, so instantiating a platform_device instead of an i2c_client does not matter.
2. The soc_button_array driver will not bind to the MSHW0028 device on the Surface 3 Pro, because it has no GPIO resources.
--- drivers/acpi/scan.c | 5 +++++ drivers/input/misc/soc_button_array.c | 24 +++++++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-)
drivers/acpi/scan.c +5 -0
@@ -1749,6 +1749,11 @@ static bool acpi_device_enumeration_by_parent(struct acpi_device *device) {"INT3515", }, /* Non-conforming _HID for Cirrus Logic already released */ {"CLSA0100", }, + /* + * Some ACPI devs contain SerialBus resources even though they are not + * attached to a serial bus at all. + */ + {"MSHW0028", }, /* * HIDs of device with an UartSerialBusV2 resource for which userspace * expects a regular tty cdev to be created (instead of the in kernel
drivers/input/misc/soc_button_array.c +23 -1
@@ -469,6 +469,27 @@ static const struct soc_device_data soc_device_INT33D3 = { .button_info = soc_button_INT33D3, }; +/* +* Button info for Microsoft Surface 3 (non pro), this is indentical to +* the PNP0C40 info except that the home button is active-high. +* +* The Surface 3 Pro also has a MSHW0028 ACPI device, but that uses a custom +* version of the drivers/platform/x86/intel/hid.c 5 button array ACPI API +* instead. A check() callback is not necessary though as the Surface 3 Pro +* MSHW0028 ACPI device's resource table does not contain any GPIOs. +*/ +static const struct soc_button_info soc_button_MSHW0028[] = { + {"power" ,0 ,EV_KEY ,KEY_POWER , false, true, true }, + {"home" ,1 ,EV_KEY ,KEY_LEFTMETA , false, true, false }, + {"volume_up" ,2 ,EV_KEY ,KEY_VOLUMEUP , true, false, true }, + {"volume_down" ,3 ,EV_KEY ,KEY_VOLUMEDOWN , true, false, true }, + { } +}; + +static const struct soc_device_data soc_device_MSHW0028 = { + .button_info = soc_button_MSHW0028, +}; +/* * Special device check for Surface Book 2 and Surface Pro (2017). * Both, the Surface Pro 4 (surfacepro3_button.c) and the above mentioned
@@ -535,7 +556,8 @@ static const struct acpi_device_id soc_button_acpi_match[] = { { "ID9001", (unsigned long)&soc_device_INT33D3 }, { "ACPI0011", 0 }, -/* Microsoft Surface Devices (5th and 6th generation) */ +/* Microsoft Surface Devices (3th, 5th and 6th generation) */ + { "MSHW0028", (unsigned long)&soc_device_MSHW0028 }, { "MSHW0040", (unsigned long)&soc_device_MSHW0040 }, { }
Signature · 1 line
2.35.1
Re: [PATCH 1/2] Input: soc_button_array - add support for Microsoft Surface 3 (MSHW0028) buttons
Quoted 21 lines · Hans de Goede
The
drivers/platform/surface/surface3_button.ccode is alsmost a 1:1 copy of thesoc_button_arraycode.The only big difference is that it binds to an
i2c_clientrather then to aplatform_device. The cause of this is the ACPI resources for the MSHW0028 device containing a bogus I2cSerialBusV2 resource which causes the kernel to instantiate ani2c_clientfor it instead of aplatform_device.Add "MSHW0028" to the ignore_serial_bus_ids[] list in
drivers/apci/scan.c, so that aplatform_devicewill be instantiated and add support for the MSHW0028 HID tosoc_button_array.This fully replaces
surface3_button, which will be removed in a separate commit (since it binds to the now no longer createdi2c_clientit no longer does anyyhing after this commit).Note the MSHW0028 id is used by Microsoft to describe the tablet buttons on both the Surface 3 and the Surface 3 Pro and the actual API/implementation for the Surface 3 Pro is quite different. The changes in this commit should not impact the separate
surfacepro3_buttondriver:
Quoted 8 lines
1. Because of the bogus I2cSerialBusV2 resource problem that driver binds to the
acpi_deviceitself, so instantiating aplatform_deviceinstead of ani2c_clientdoes not matter.2. The
soc_button_arraydriver will not bind to the MSHW0028 device on the Surface 3 Pro, because it has no GPIO resources.Signed-off-by Hans de Goede <[email protected]>
Looks good to me.
Re: [PATCH 1/2] Input: soc_button_array - add support for Microsoft Surface 3 (MSHW0028) buttons
In reply to Hans de GoedeQuoted 22 lines · Hans de Goede
The
drivers/platform/surface/surface3_button.ccode is alsmost a 1:1 copy of thesoc_button_arraycode.The only big difference is that it binds to an
i2c_clientrather then to aplatform_device. The cause of this is the ACPI resources for the MSHW0028 device containing a bogus I2cSerialBusV2 resource which causes the kernel to instantiate ani2c_clientfor it instead of aplatform_device.Add "MSHW0028" to the ignore_serial_bus_ids[] list in
drivers/apci/scan.c, so that aplatform_devicewill be instantiated and add support for the MSHW0028 HID tosoc_button_array.This fully replaces
surface3_button, which will be removed in a separate commit (since it binds to the now no longer createdi2c_clientit no longer does anyyhing after this commit).Note the MSHW0028 id is used by Microsoft to describe the tablet buttons on both the Surface 3 and the Surface 3 Pro and the actual API/implementation for the Surface 3 Pro is quite different. The changes in this commit should not impact the separate
surfacepro3_buttondriver:
Quoted 8 lines
1. Because of the bogus I2cSerialBusV2 resource problem that driver binds to the
acpi_deviceitself, so instantiating aplatform_deviceinstead of ani2c_clientdoes not matter.2. The
soc_button_arraydriver will not bind to the MSHW0028 device on the Surface 3 Pro, because it has no GPIO resources.Signed-off-by Hans de Goede <[email protected]>
for the change in scan.c and I'm expecting that you'll take care of this series yourself. Otherwise, please let me know.
Quoted 66 lines
--- drivers/acpi/scan.c | 5 +++++ drivers/input/misc/soc_button_array.c | 24 +++++++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-)drivers/acpi/scan.c +5
-0@@ -1749,6 +1749,11 @@ static bool acpi_device_enumeration_by_parent(struct acpi_device *device) {"INT3515", }, /* Non-conforming _HID for Cirrus Logic already released */ {"CLSA0100", }, + /* + * Some ACPI devs contain SerialBus resources even though they are not + * attached to a serial bus at all. + */ + {"MSHW0028", }, /* * HIDs of device with an UartSerialBusV2 resource for which userspace * expects a regular tty cdev to be created (instead of the in kerneldrivers/input/misc/soc_button_array.c +23
-2@@ -469,6 +469,27 @@ static const struct soc_device_data soc_device_INT33D3 = { .button_info = soc_button_INT33D3, }; +/* +* Button info for Microsoft Surface 3 (non pro), this is indentical to +* the PNP0C40 info except that the home button is active-high. +* +* The Surface 3 Pro also has a MSHW0028 ACPI device, but that uses a custom +* version of the drivers/platform/x86/intel/hid.c 5 button array ACPI API +* instead. A check() callback is not necessary though as the Surface 3 Pro +* MSHW0028 ACPI device's resource table does not contain any GPIOs. +*/ +static const struct soc_button_info soc_button_MSHW0028[] = { + {"power" ,0 ,EV_KEY ,KEY_POWER , false, true, true }, + {"home" ,1 ,EV_KEY ,KEY_LEFTMETA , false, true, false }, + {"volume_up" ,2 ,EV_KEY ,KEY_VOLUMEUP , true, false, true }, + {"volume_down" ,3 ,EV_KEY ,KEY_VOLUMEDOWN , true, false, true }, + { } +}; + +static const struct soc_device_data soc_device_MSHW0028 = { + .button_info = soc_button_MSHW0028, +}; +/* * Special device check for Surface Book 2 and Surface Pro (2017). * Both, the Surface Pro 4 (surfacepro3_button.c) and the above mentioned @@ -535,7 +556,8 @@ static const struct acpi_device_id soc_button_acpi_match[] = { { "ID9001", (unsigned long)&soc_device_INT33D3 }, { "ACPI0011", 0 }, -/* Microsoft Surface Devices (5th and 6th generation) */ +/* Microsoft Surface Devices (3th, 5th and 6th generation) */ + { "MSHW0028", (unsigned long)&soc_device_MSHW0028 }, { "MSHW0040", (unsigned long)&soc_device_MSHW0040 }, { } --2.35.1
Re: [PATCH 1/2] Input: soc_button_array - add support for Microsoft Surface 3 (MSHW0028) buttons
In reply to Hans de GoedeQuoted 21 lines · Hans de Goede
The
drivers/platform/surface/surface3_button.ccode is alsmost a 1:1 copy of thesoc_button_arraycode.The only big difference is that it binds to an
i2c_clientrather then to aplatform_device. The cause of this is the ACPI resources for the MSHW0028 device containing a bogus I2cSerialBusV2 resource which causes the kernel to instantiate ani2c_clientfor it instead of aplatform_device.Add "MSHW0028" to the ignore_serial_bus_ids[] list in
drivers/apci/scan.c, so that aplatform_devicewill be instantiated and add support for the MSHW0028 HID tosoc_button_array.This fully replaces
surface3_button, which will be removed in a separate commit (since it binds to the now no longer createdi2c_clientit no longer does anyyhing after this commit).Note the MSHW0028 id is used by Microsoft to describe the tablet buttons on both the Surface 3 and the Surface 3 Pro and the actual API/implementation for the Surface 3 Pro is quite different. The changes in this commit should not impact the separate
surfacepro3_buttondriver:
Quoted 8 lines
1. Because of the bogus I2cSerialBusV2 resource problem that driver binds to the
acpi_deviceitself, so instantiating aplatform_deviceinstead of ani2c_clientdoes not matter.2. The
soc_button_arraydriver will not bind to the MSHW0028 device on the Surface 3 Pro, because it has no GPIO resources.Signed-off-by Hans de Goede <[email protected]>
Please feel free to merge through platform tree.
Thanks.
Signature · 1 line
Dmitry
PATCH 2/2 platform/surface: Remove Surface 3 Button driver
In reply to Hans de GoedeThe Surface 3 buttons are now handled by the generic soc_button_array driver. As part of adding support to soc_button_array the ACPI code now instantiates a platform_device rather then an i2c_client so there no longer is an i2c_client for this driver to bind to.
--- drivers/platform/surface/Kconfig | 7 - drivers/platform/surface/Makefile | 1 - drivers/platform/surface/surface3_button.c | 247 --------------------- 3 files changed, 255 deletions(-) delete mode 100644 drivers/platform/surface/surface3_button.c
drivers/platform/surface/Kconfig +0 -7
@@ -28,13 +28,6 @@ config SURFACE3_WMI To compile this driver as a module, choose M here: the module will be called surface3-wmi. -config SURFACE_3_BUTTON - tristate "Power/home/volume buttons driver for Microsoft Surface 3 tablet" - depends on ACPI - depends on KEYBOARD_GPIO && I2C - help - This driver handles the power/home/volume buttons on the Microsoft Surface 3 tablet. - config SURFACE_3_POWER_OPREGION tristate "Surface 3 battery platform operation region support" depends on ACPI
drivers/platform/surface/Makefile +0 -1
@@ -5,7 +5,6 @@ # obj-$(CONFIG_SURFACE3_WMI) += surface3-wmi.o -obj-$(CONFIG_SURFACE_3_BUTTON) += surface3_button.o obj-$(CONFIG_SURFACE_3_POWER_OPREGION) += surface3_power.o obj-$(CONFIG_SURFACE_ACPI_NOTIFY) += surface_acpi_notify.o obj-$(CONFIG_SURFACE_AGGREGATOR) += aggregator/
drivers/platform/surface/surface3_button.c deleted +0 -247
247 lines not on this page · raw message
Signature · 1 line
2.35.1
Re: [PATCH 2/2] platform/surface: Remove Surface 3 Button driver
Quoted 6 lines · Hans de Goede
The Surface 3 buttons are now handled by the generic
soc_button_arraydriver. As part of adding support tosoc_button_arraythe ACPI code now instantiates aplatform_devicerather then ani2c_clientso there no longer is ani2c_clientfor this driver to bind to.Signed-off-by Hans de Goede <[email protected]>
Looks good to me.
Quoted 6 lines · Hans de Goede
Hi All,
I noticed that the
surface3_buttoncode was pretty much a 1:1 copy ofsoc_button_array. This series adds support tosoc_button_arrayfor the MSHW0028 device on the Microsoft Surface 3 (non pro) and removes the now no longer neededsurface3_buttondriver.
Thanks, I like esp. patch 2 in this series.
Quoted 14 lines
Rafael, this includes an addition to ignore_serial_bus_ids[] in
drivers/apci/scan.c, may we have your ack for merging this through the input or pdx86 tree please ?Dmitry, I believe it would be best to keep these 2 patches together and merge both through either the input or the pdx86 tree. If you are ok with me merging this through the pdx86 tree may I have your Ack for that ?
If you prefer merging this through the input tree please consider this my ack for also merge 2/2 through the input tree.
Note both patches can also be merged through separate trees without issues but keeping them together seems better to me.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Hi All,
Quoted 16 lines · Hans de Goede
Hi All,
I noticed that the
surface3_buttoncode was pretty much a 1:1 copy ofsoc_button_array. This series adds support tosoc_button_arrayfor the MSHW0028 device on the Microsoft Surface 3 (non pro) and removes the now no longer neededsurface3_buttondriver.Rafael, this includes an addition to ignore_serial_bus_ids[] in
drivers/apci/scan.c, may we have your ack for merging this through the input or pdx86 tree please ?Dmitry, I believe it would be best to keep these 2 patches together and merge both through either the input or the pdx86 tree. If you are ok with me merging this through the pdx86 tree may I have your Ack for that ?
Quoted 5 lines
If you prefer merging this through the input tree please consider this my ack for also merge 2/2 through the input tree.
Note both patches can also be merged through separate trees without issues but keeping them together seems better to me.
Thank you all for the reviews + acks,
I've added this series to my review-hans (soon to be for-next) branch now.
Regards,
Hans
Quoted 13 lines
Hans de Goede (2):
Input:soc_button_array- add support for Microsoft Surface 3(MSHW0028) buttonsplatform/surface: Remove Surface 3 Button driver
drivers/acpi/scan.c | 5 + drivers/input/misc/soc_button_array.c | 24 +- drivers/platform/surface/Kconfig | 7 - drivers/platform/surface/Makefile | 1 - drivers/platform/surface/surface3_button.c | 247 --------------------- 5 files changed, 28 insertions(+), 256 deletions(-) delete mode 100644 drivers/platform/surface/surface3_button.c