Skip to contentSkip to conversation

Input: synaptics-rmi4: Add support for F30

PATCH In review Andrew Duggan 1 participant 1 message Nov 26, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 7/10 Input: synaptics-rmi4: Add support for F30

RMI4 F30 supports input from clickpad buttons and controls LEDs located on the touchpad PCB. This patch adds support of the clickpad buttons and defers supporting LEDs for the future.

---
 drivers/input/rmi4/Kconfig      |   9 +
 drivers/input/rmi4/Makefile     |   1 +
 drivers/input/rmi4/rmi_bus.c    |  12 +-
 drivers/input/rmi4/rmi_driver.h |   8 +
 drivers/input/rmi4/rmi_f30.c    | 418 ++++++++++++++++++++++++++++++++++++++++
 include/linux/rmi.h             |  16 ++
 6 files changed, 463 insertions(+), 1 deletion(-)
 create mode 100644 drivers/input/rmi4/rmi_f30.c
drivers/input/rmi4/Kconfig +9 -0
index 00a5283..3668c1a 100644
@@ -74,3 +74,12 @@ config RMI4_F12
 	  Function 12 provides 2D multifinger pointing for touchscreens and
 	  touchpads. For sensors that support relative pointing, F12 also
 	  provides mouse input.
+
+config RMI4_F30
+	bool "RMI4 Function 30 (GPIO LED)"
+	depends on RMI4_CORE
+	help
+	  Say Y here if you want to add support for RMI4 function 30.
+
+	  Function 30 provides GPIO and LED support for RMI4 devices. This
+	  includes support for buttons on TouchPads and ClickPads.
drivers/input/rmi4/Makefile +1 -0
index 8db9500..16b3c60 100644
@@ -6,6 +6,7 @@ rmi_core-$(CONFIG_RMI4_2D_SENSOR) += rmi_2d_sensor.o
 # Function drivers
 rmi_core-$(CONFIG_RMI4_F11) += rmi_f11.o
 rmi_core-$(CONFIG_RMI4_F12) += rmi_f12.o
+rmi_core-$(CONFIG_RMI4_F30) += rmi_f30.o
 
 # Transports
 obj-$(CONFIG_RMI4_I2C) += rmi_i2c.o
drivers/input/rmi4/rmi_bus.c +11 -1
index 93e919d..5b12a0f 100644
@@ -366,15 +366,24 @@ static int __init rmi_bus_init(void)
 		goto err_unregister_f11;
 	}
 
+	error = rmi_register_f30_handler();
+	if (error) {
+		pr_err("%s: error registering the RMI F30 handler: %d\n",
+			__func__, error);
+		goto err_unregister_f12;
+	}
+
 	error = rmi_register_physical_driver();
 	if (error) {
 		pr_err("%s: error registering the RMI physical driver: %d\n",
 			__func__, error);
-		goto err_unregister_f12;
+		goto err_unregister_f30;
 	}
 
 	return 0;
 
+err_unregister_f30:
+	rmi_unregister_f30_handler();
 err_unregister_f12:
 	rmi_unregister_f12_handler();
 err_unregister_f11:
@@ -395,6 +404,7 @@ static void __exit rmi_bus_exit(void)
 	 */
 
 	rmi_unregister_physical_driver();
+	rmi_unregister_f30_handler();
 	rmi_unregister_f12_handler();
 	rmi_unregister_f11_handler();
 	rmi_unregister_f01_handler();
drivers/input/rmi4/rmi_driver.h +8 -0
index 670ba8a..04cfdf9 100644
@@ -115,4 +115,12 @@ void rmi_unregister_f12_handler(void);
 static inline int rmi_register_f12_handler(void) { return 0; }
 static inline void rmi_unregister_f12_handler(void) {}
 #endif
+
+#ifdef CONFIG_RMI4_F30
+int rmi_register_f30_handler(void);
+void rmi_unregister_f30_handler(void);
+#else
+static inline int rmi_register_f30_handler(void) { return 0; }
+static inline void rmi_unregister_f30_handler(void) {}
+#endif
 #endif
drivers/input/rmi4/rmi_f30.c new file +418 -0

418 lines not on this page · raw message

include/linux/rmi.h +16 -0
index ca71ce6..6bc5bc9 100644
@@ -102,6 +102,21 @@ struct rmi_2d_sensor_platform_data {
 };
 
 /**
+ * struct rmi_f30_data - overrides defaults for a single F30 GPIOs/LED chip.
+ * @buttonpad - the touchpad is a buttonpad, so enable only the first actual
+ * button that is found.
+ * @trackstick_buttons - Set when the function 30 is handling the physical
+ * buttons of the trackstick (as a PD/2 passthrough device.
+ * @disable - the touchpad incorrectly reports F30 and it should be ignored.
+ * This is a special case which is due to misconfigured firmware.
+ */
+struct rmi_f30_data {
+	bool buttonpad;
+	bool trackstick_buttons;
+	bool disable;
+};
+
+/**
  * struct rmi_f01_power - override default power management settings.
  *
  */
@@ -167,6 +182,7 @@ struct rmi_device_platform_data {
 	/* function handler pdata */
 	struct rmi_2d_sensor_platform_data *sensor_pdata;
 	struct rmi_f01_power_management power_management;
+	struct rmi_f30_data *f30_data;
 
 #ifdef	CONFIG_PM
 	void *pm_data;
Signature · 1 line
2.5.0