Input: cros-ec-keyb: Only register keyboard if rows/columns exist
Subsystems (2)
PATCH v2 1/1 Input: cros-ec-keyb: Only register keyboard if rows/columns exist
If the device is a detachable, we may still probe this device because there are some button switches, e.g. volume buttons and power buttons, registered by this driver. Let's allow the device node to be missing row and column device properties to indicate that the keyboard matrix shouldn't be registered. This removes an input device on Trogdor devices such as Wormdingler that don't have a matrix keyboard, but still have power and volume buttons. That helps userspace understand there isn't a keyboard present when the detachable keyboard is disconnected.
---
Changes from v1 (https://lore.kernel.org/r/[email protected]):
* Use device_property_present
drivers/input/keyboard/cros_ec_keyb.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/input/keyboard/cros_ec_keyb.c +9 -0
@@ -537,6 +537,15 @@ static int cros_ec_keyb_register_matrix(struct cros_ec_keyb *ckdev)u32 key_pos;unsigned int row, col, scancode, n_physmap; +/* +* No rows and columns? There isn't a matrix but maybe there are +* switches to register in cros_ec_keyb_register_bs() because this is a +* detachable device. +*/ +if (!device_property_present (dev,"keypad,num-rows" ) && + !device_property_present (dev,"keypad,num-cols" )) +return 0 ; + err =matrix_keypad_parse_properties (dev, &ckdev->rows, &ckdev->cols);if (err)return err;
base-commit: 3123109284176b1532874591f7c81f3837bbdc17
Signature · 1 line
https://chromeos.dev
Quoted 10 lines · Stephen Boyd
If the device is a detachable, we may still probe this device because there are some button switches, e.g. volume buttons and power buttons, registered by this driver. Let's allow the device node to be missing row and column device properties to indicate that the keyboard matrix shouldn't be registered. This removes an input device on Trogdor devices such as Wormdingler that don't have a matrix keyboard, but still have power and volume buttons. That helps userspace understand there isn't a keyboard present when the detachable keyboard is disconnected.
Quoted 5 lines
Cc Benson Leung <[email protected]>Cc Guenter Roeck <[email protected]>Cc Douglas Anderson <[email protected]>Cc Hsin-Yi Wang <[email protected]>Signed-off-by Stephen Boyd <[email protected]>
Quoted 33 lines
---
Changes from v1 (https://lore.kernel.org/r/[email protected]):
* Usedevice_property_presentdrivers/input/keyboard/cros_ec_keyb.c | 9 +++++++++ 1 file changed, 9 insertions(+)drivers/input/keyboard/cros_ec_keyb.c +9
-0@@ -537,6 +537,15 @@ static int cros_ec_keyb_register_matrix(struct cros_ec_keyb *ckdev)u32 key_pos;unsigned int row, col, scancode, n_physmap; +/* +* No rows and columns? There isn't a matrix but maybe there are +* switches to register in cros_ec_keyb_register_bs() because this is a +* detachable device. +*/ +if (!device_property_present (dev,"keypad,num-rows" ) && + !device_property_present (dev,"keypad,num-cols" )) +return 0 ; + err =matrix_keypad_parse_properties (dev, &ckdev->rows, &ckdev->cols);if (err)return err;base-commit:
3123109284176b1532874591f7c81f3837bbdc17--
https://chromeos.dev
Hi,
Quoted 15 lines · Stephen Boyd
If the device is a detachable, we may still probe this device because there are some button switches, e.g. volume buttons and power buttons, registered by this driver. Let's allow the device node to be missing row and column device properties to indicate that the keyboard matrix shouldn't be registered. This removes an input device on Trogdor devices such as Wormdingler that don't have a matrix keyboard, but still have power and volume buttons. That helps userspace understand there isn't a keyboard present when the detachable keyboard is disconnected.
Cc Benson Leung <[email protected]>Cc Guenter Roeck <[email protected]>Cc Douglas Anderson <[email protected]>Cc Hsin-Yi Wang <[email protected]>Signed-off-by Stephen Boyd <[email protected]>
Quoted 7 lines
---
Changes from v1 (https://lore.kernel.org/r/[email protected]):
* Usedevice_property_presentdrivers/input/keyboard/cros_ec_keyb.c | 9 +++++++++ 1 file changed, 9 insertions(+)
Quoted 9 lines · Stephen Boyd
If the device is a detachable, we may still probe this device because there are some button switches, e.g. volume buttons and power buttons, registered by this driver. Let's allow the device node to be missing row and column device properties to indicate that the keyboard matrix shouldn't be registered. This removes an input device on Trogdor devices such as Wormdingler that don't have a matrix keyboard, but still have power and volume buttons. That helps userspace understand there isn't a keyboard present when the detachable keyboard is disconnected.
Quoted 5 lines
Cc Benson Leung <[email protected]>Cc Guenter Roeck <[email protected]>Cc Douglas Anderson <[email protected]>Cc Hsin-Yi Wang <[email protected]>Signed-off-by Stephen Boyd <[email protected]>
Applied, thank you.
Signature · 1 line
Dmitry