Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Link: https://lore.kernel.org/r/20220224110241.9613-2-hdegoede@redhat.com

+28 -1
+5
drivers/acpi/scan.c
··· 1750 1750 /* Non-conforming _HID for Cirrus Logic already released */ 1751 1751 {"CLSA0100", }, 1752 1752 /* 1753 + * Some ACPI devs contain SerialBus resources even though they are not 1754 + * attached to a serial bus at all. 1755 + */ 1756 + {"MSHW0028", }, 1757 + /* 1753 1758 * HIDs of device with an UartSerialBusV2 resource for which userspace 1754 1759 * expects a regular tty cdev to be created (instead of the in kernel 1755 1760 * serdev) and which have a kernel driver which expects a platform_dev
+23 -1
drivers/input/misc/soc_button_array.c
··· 470 470 }; 471 471 472 472 /* 473 + * Button info for Microsoft Surface 3 (non pro), this is indentical to 474 + * the PNP0C40 info except that the home button is active-high. 475 + * 476 + * The Surface 3 Pro also has a MSHW0028 ACPI device, but that uses a custom 477 + * version of the drivers/platform/x86/intel/hid.c 5 button array ACPI API 478 + * instead. A check() callback is not necessary though as the Surface 3 Pro 479 + * MSHW0028 ACPI device's resource table does not contain any GPIOs. 480 + */ 481 + static const struct soc_button_info soc_button_MSHW0028[] = { 482 + { "power", 0, EV_KEY, KEY_POWER, false, true, true }, 483 + { "home", 1, EV_KEY, KEY_LEFTMETA, false, true, false }, 484 + { "volume_up", 2, EV_KEY, KEY_VOLUMEUP, true, false, true }, 485 + { "volume_down", 3, EV_KEY, KEY_VOLUMEDOWN, true, false, true }, 486 + { } 487 + }; 488 + 489 + static const struct soc_device_data soc_device_MSHW0028 = { 490 + .button_info = soc_button_MSHW0028, 491 + }; 492 + 493 + /* 473 494 * Special device check for Surface Book 2 and Surface Pro (2017). 474 495 * Both, the Surface Pro 4 (surfacepro3_button.c) and the above mentioned 475 496 * devices use MSHW0040 for power and volume buttons, however the way they ··· 556 535 { "ID9001", (unsigned long)&soc_device_INT33D3 }, 557 536 { "ACPI0011", 0 }, 558 537 559 - /* Microsoft Surface Devices (5th and 6th generation) */ 538 + /* Microsoft Surface Devices (3th, 5th and 6th generation) */ 539 + { "MSHW0028", (unsigned long)&soc_device_MSHW0028 }, 560 540 { "MSHW0040", (unsigned long)&soc_device_MSHW0040 }, 561 541 562 542 { }