Skip to contentSkip to conversation

Input: synaptics-rmi4: Add F30 support

PATCH In review Andrew Duggan 2 participants 5 messages Jul 24, 2014 – Aug 13, 2015

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

PATCH v4 1/1 Input: synaptics-rmi4: Add F30 support

RMI4 Function 0x30 provides support for GPIOs, LEDs and mechanical buttons. In particular, the mechanical button support is used in an increasing number of touchpads.

---
I discovered that the v3 version of this patch from March wasn't compatible with the version of the driver currently in the synaptics-rmi4 branch. This patch fixes that. The only difference from v3 is adding a #define and fixing a spacing issue.

 drivers/input/rmi4/Kconfig   |  12 ++
 drivers/input/rmi4/Makefile  |   1 +
 drivers/input/rmi4/rmi_f30.c | 400 +++++++++++++++++++++++++++++++++++++++++++
 include/linux/rmi.h          |   7 +-
 4 files changed, 419 insertions(+), 1 deletion(-)
 create mode 100644 drivers/input/rmi4/rmi_f30.c
drivers/input/rmi4/Kconfig +12 -0
index d0c7b6e..14d5f49 100644
@@ -63,3 +63,15 @@ config RMI4_F11_PEN
 	  If your system is not recognizing pen touches and you know your
 	  sensor supports pen input, you probably want to turn this feature
 	  off.
+
+config RMI4_F30
+        tristate "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.
+
+          To compile this driver as a module, choose M here: the
+          module will be called rmi-f30.
drivers/input/rmi4/Makefile +1 -0
index 5c6bad5..ecffd72 100644
@@ -3,6 +3,7 @@ rmi_core-y := rmi_bus.o rmi_driver.o rmi_f01.o
 
 # Function drivers
 obj-$(CONFIG_RMI4_F11) += rmi_f11.o
+obj-$(CONFIG_RMI4_F30) += rmi_f30.o
 
 # Transports
 obj-$(CONFIG_RMI4_I2C) += rmi_i2c.o
drivers/input/rmi4/rmi_f30.c new file +400 -0

400 lines not on this page · raw message

include/linux/rmi.h +6 -1
index ca35b2f..5150eb9 100644
@@ -146,9 +146,14 @@ struct rmi_button_map {
 	u8 *map;
 };
 
+struct rmi_f30_button {
+	u16 button;
+	int sense;
+};
+
 struct rmi_f30_gpioled_map {
 	u8 ngpioleds;
-	u8 *map;
+	struct rmi_f30_button *map;
 };
 
 /**
Signature · 1 line
1.9.1
maintainer
#1 lore raw

Hi Andrew,

Quoted 4 lines · Andrew Duggan

RMI4 Function 0x30 provides support for GPIOs, LEDs and mechanical buttons. In particular, the mechanical button support is used in an increasing number of touchpads.

I was reading the spec for F30 and it looks to me that instead instead of basic keymap it should actually implement a gpio chip plus LED devices (probably later). Then, if GPIOs are indeed attached to buttons one can use standard gpio_keys driver to create input device.

Thanks.

Signature · 1 line
Dmitry
#2 lore raw

Hi Dmitry,

With the renewed interest in supporting SMBus with the Synaptics RMI4 driver I thought I would look into this again. I'm sorry for not responding to your comments sooner, especially since you took the time to read the F30 spec. Now that it has been over a year later we may need to essentially start over. But, this time I will make sure to follow up and hopefully not waste your time in the future.

Quoted 4 lines · Dmitry Torokhov

Hi Andrew,

On Thu, Jul 24, 2014 at 04:47:21PM -0700, Andrew Duggan wrote:

Quoted 8 lines
Quoted 4 lines

RMI4 Function 0x30 provides support for GPIOs, LEDs and mechanical buttons. In particular, the mechanical button support is used in an increasing number of touchpads.

I was reading the spec for F30 and it looks to me that instead instead of basic keymap it should actually implement a gpio chip plus LED devices (probably later). Then, if GPIOs are indeed attached to buttons one can use standard gpio_keys driver to create input device.

The most common use of F30 is handling input from the tact switch on clickpads. Since the tact switch is wired up to the touch controller, it's the touch controller that handles the GPIO. The touch controller then asserts attention to the host, which then issues reads to see what interrupted, and then reads the F30 data register to get the state of the GPIO. Would gpio chip work with this setup? After looking at gpio chip a little bit I'm not really seeing how that would work. It looks like to work with gpio_keys each button would need it's own irq? I couldn't find an example of a driver doing something similar, but if there is one could you point me to it?

For touchpad buttons we know based on convention which GPIOs represent which buttons. In the case of touchpads we can avoid creating a button map in the platform data. For touchpads we also want to report the input events for F30 from the same input device which is reporting finger data. Benjamin's patchset contains a patch which allows for a unified input device which will allow more then one function to use the same input device.

The F30 spec is fairly generic so it could be used for things besides the touchpad buttons and we might want to report events independently of finger position. However, besides touchpad LEDs I'm not sure F30 has ever been used for other applications in production so I'm not sure its worth implementing something more generic at this time.

Quoted 2 lines

Thanks.

Also, the fact that it took me over a year to reply to these comments highlights that we at Synaptics have been inconsistent in our effort to get the synaptics-rmi4 driver upstreamed. I think it's about time we have a single upstreamed driver which can support all of our RMI devices so I'm willing do more on behalf of Synaptics to help get it upstreamed.

Thanks,
Andrew

maintainer
#3 lore raw

Hi Andrew,

Quoted 9 lines · Andrew Duggan

Hi Dmitry,

With the renewed interest in supporting SMBus with the Synaptics RMI4 driver I thought I would look into this again. I'm sorry for not responding to your comments sooner, especially since you took the time to read the F30 spec. Now that it has been over a year later we may need to essentially start over. But, this time I will make sure to follow up and hopefully not waste your time in the future.

This is great and I agree that we need to get RMI4 into kernel proper. Unfortunately it is quite large body of code and I am afraid that I wont be able to give it enough attention until mid-September.

In the meantime, Benjamin, maybe you could work with Andrew? You have done a lot of work on input side.

Thanks.

Quoted 35 lines · Dmitry Torokhov
Quoted 4 lines

Hi Andrew,

On Thu, Jul 24, 2014 at 04:47:21PM -0700, Andrew Duggan wrote:

Quoted 8 lines
Quoted 4 lines

RMI4 Function 0x30 provides support for GPIOs, LEDs and mechanical buttons. In particular, the mechanical button support is used in an increasing number of touchpads.

I was reading the spec for F30 and it looks to me that instead instead of basic keymap it should actually implement a gpio chip plus LED devices (probably later). Then, if GPIOs are indeed attached to buttons one can use standard gpio_keys driver to create input device.

The most common use of F30 is handling input from the tact switch on clickpads. Since the tact switch is wired up to the touch controller, it's the touch controller that handles the GPIO. The touch controller then asserts attention to the host, which then issues reads to see what interrupted, and then reads the F30 data register to get the state of the GPIO. Would gpio chip work with this setup? After looking at gpio chip a little bit I'm not really seeing how that would work. It looks like to work with gpio_keys each button would need it's own irq? I couldn't find an example of a driver doing something similar, but if there is one could you point me to it?

For touchpad buttons we know based on convention which GPIOs represent which buttons. In the case of touchpads we can avoid creating a button map in the platform data. For touchpads we also want to report the input events for F30 from the same input device which is reporting finger data. Benjamin's patchset contains a patch which allows for a unified input device which will allow more then one function to use the same input device.

Quoted 6 lines

The F30 spec is fairly generic so it could be used for things besides the touchpad buttons and we might want to report events independently of finger position. However, besides touchpad LEDs I'm not sure F30 has ever been used for other applications in production so I'm not sure its worth implementing something more generic at this time.

OK, fair enough. I'll have to take another look then - the details are quite hazy ;)

Quoted 11 lines
Quoted 3 lines

Thanks.

Also, the fact that it took me over a year to reply to these comments highlights that we at Synaptics have been inconsistent in our effort to get the synaptics-rmi4 driver upstreamed. I think it's about time we have a single upstreamed driver which can support all of our RMI devices so I'm willing do more on behalf of Synaptics to help get it upstreamed.

Quoted 2 lines

Thanks,
Andrew

Thanks.

Signature · 1 line
Dmitry
#4 lore raw

Hi Dmitry,

Quoted 12 lines · Dmitry Torokhov

Hi Andrew,

Quoted 9 lines · Andrew Duggan

Hi Dmitry,

With the renewed interest in supporting SMBus with the Synaptics RMI4 driver I thought I would look into this again. I'm sorry for not responding to your comments sooner, especially since you took the time to read the F30 spec. Now that it has been over a year later we may need to essentially start over. But, this time I will make sure to follow up and hopefully not waste your time in the future.

Quoted 6 lines

This is great and I agree that we need to get RMI4 into kernel proper. Unfortunately it is quite large body of code and I am afraid that I wont be able to give it enough attention until mid-September.

In the meantime, Benjamin, maybe you could work with Andrew? You have done a lot of work on input side.

I understand, it is a lot of code. If you have time later this year to work on it then that would be great! In the meantime, I'll post the device tree related patches I've been working on the last couple of days and then we can go from there when you have time.

Thanks,
Andrew

Quoted 57 lines

Thanks.

Quoted 33 lines · Dmitry Torokhov
Quoted 4 lines

Hi Andrew,

On Thu, Jul 24, 2014 at 04:47:21PM -0700, Andrew Duggan wrote:

Quoted 8 lines
Quoted 4 lines

RMI4 Function 0x30 provides support for GPIOs, LEDs and mechanical buttons. In particular, the mechanical button support is used in an increasing number of touchpads.

I was reading the spec for F30 and it looks to me that instead instead of basic keymap it should actually implement a gpio chip plus LED devices (probably later). Then, if GPIOs are indeed attached to buttons one can use standard gpio_keys driver to create input device.

The most common use of F30 is handling input from the tact switch on clickpads. Since the tact switch is wired up to the touch controller, it's the touch controller that handles the GPIO. The touch controller then asserts attention to the host, which then issues reads to see what interrupted, and then reads the F30 data register to get the state of the GPIO. Would gpio chip work with this setup? After looking at gpio chip a little bit I'm not really seeing how that would work. It looks like to work with gpio_keys each button would need it's own irq? I couldn't find an example of a driver doing something similar, but if there is one could you point me to it?

For touchpad buttons we know based on convention which GPIOs represent which buttons. In the case of touchpads we can avoid creating a button map in the platform data. For touchpads we also want to report the input events for F30 from the same input device which is reporting finger data. Benjamin's patchset contains a patch which allows for a unified input device which will allow more then one function to use the same input device.

Quoted 6 lines

The F30 spec is fairly generic so it could be used for things besides the touchpad buttons and we might want to report events independently of finger position. However, besides touchpad LEDs I'm not sure F30 has ever been used for other applications in production so I'm not sure its worth implementing something more generic at this time.

OK, fair enough. I'll have to take another look then - the details are quite hazy ;)

Quoted 11 lines
Quoted 2 lines

Thanks.

Also, the fact that it took me over a year to reply to these comments highlights that we at Synaptics have been inconsistent in our effort to get the synaptics-rmi4 driver upstreamed. I think it's about time we have a single upstreamed driver which can support all of our RMI devices so I'm willing do more on behalf of Synaptics to help get it upstreamed.

Thanks,
Andrew

Thanks.