@@ -536,14 +536,10 @@ static int cros_ec_keyb_register_matrix(struct cros_ec_keyb *ckdev)
u32 *physmap;
u32 key_pos;
unsigned int row, col, scancode, n_physmap;
+ bool has_keyboard;
- /*
- * 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"))
+ has_keyboard = device_get_match_data(dev);
+ if (!has_keyboard)
return 0;
err = matrix_keypad_parse_properties(dev, &ckdev->rows, &ckdev->cols);
@@ -718,8 +714,13 @@ static int cros_ec_keyb_remove(struct platform_device *pdev)
#ifdef CONFIG_OF
static const struct of_device_id cros_ec_keyb_of_match[] = {
- { .compatible = "google,cros-ec-keyb" },
- {},
+ {
+ /* Must be first */
+ .compatible = "google,cros-ec-keyb",
+ .data = (void *)true
+ },
+ { .compatible = "google,cros-ec-keyb-switches" },
+ {}
};
MODULE_DEVICE_TABLE(of, cros_ec_keyb_of_match);
#endif