Input: synaptics-rmi4: Synaptics RMI4 Driver rebased on 4.3
Subsystems (3)
PATCH 2/10 Input: synaptics-rmi4: Add I2C transport driver
In reply to Andrew DugganAdd the transport driver for devices using RMI4 over I2C.
--- drivers/input/rmi4/Kconfig | 11 ++ drivers/input/rmi4/Makefile | 3 + drivers/input/rmi4/rmi_i2c.c | 260 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 274 insertions(+) create mode 100644 drivers/input/rmi4/rmi_i2c.c
drivers/input/rmi4/Kconfig +11 -0
@@ -24,3 +24,14 @@ config RMI4_DEBUG if you are actively developing/debugging RMI4 features. If unsure, say N. + +config RMI4_I2C + tristate "RMI4 I2C Support" + depends on RMI4_CORE && I2C + help + Say Y here if you want to support RMI4 devices connected to an I2C + bus. + + If unsure, say Y. + + This feature is not currently available as a loadable module.
drivers/input/rmi4/Makefile +3 -0
@@ -1,4 +1,7 @@ obj-$(CONFIG_RMI4_CORE) += rmi_core.o rmi_core-y := rmi_bus.o rmi_driver.o rmi_f01.o +# Transports +obj-$(CONFIG_RMI4_I2C) += rmi_i2c.o + ccflags-$(CONFIG_RMI4_DEBUG) += -DDEBUG
drivers/input/rmi4/rmi_i2c.c new file +260 -0
260 lines not on this page · raw message
Signature · 1 line
2.5.0
PATCH 3/10 Input: synaptics-rmi4: Add device tree support for RMI4 I2C devices
In reply to Andrew DugganAdd devicetree binding for I2C devices and add bindings for optional parameters in the function drivers. Parameters for function drivers are defined in child nodes for each of the functions.
--- .../devicetree/bindings/input/rmi4/rmi_f01.txt | 39 ++++++++++++ .../devicetree/bindings/input/rmi4/rmi_i2c.txt | 53 ++++++++++++++++ .../devicetree/bindings/vendor-prefixes.txt | 1 + drivers/input/rmi4/rmi_bus.c | 71 ++++++++++++++++++++++ drivers/input/rmi4/rmi_driver.c | 28 +++++++++ drivers/input/rmi4/rmi_i2c.c | 12 +++- 6 files changed, 203 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/input/rmi4/rmi_f01.txt create mode 100644 Documentation/devicetree/bindings/input/rmi4/rmi_i2c.txt
Documentation/devicetree/bindings/input/rmi4/rmi_f01.txt new file +39 -0
@@ -0,0 +1,39 @@ +Synaptics RMI4 F01 Device Binding + +The Synaptics RMI4 core is able to support RMI4 devices using differnet +transports and differnet functions. This file describes the device tree +bindings for devices which contain Function 1. Complete documentation +for transports and other functions can be found in: +Documentation/devicetree/bindings/input/rmi4. + +Additional documentation for F01 can be found at: +http://www.synaptics.com/sites/default/files/511-000136-01-Rev-E-RMI4-Interfacing-Guide.pdf + +Optional Properties: +- syna,nosleep-mode: If set the device will run at full power without sleeping. + nosleep has 3 modes, 0 will not change the default + setting, 1 will disable nosleep (allow sleeping), + and 2 will enable nosleep (disabling sleep). +- syna,wakeup-threshold: Defines the amplitude of the disturbance to the + background capacitance that will cause the + device to wake from dozing. +- syna,doze-holdoff: The delay to wait after the last finger lift and the + first doze cycle (in 0.1 second units). +- syna,doze-interval: The time period that the device sleeps between finger + activity (in 10 ms units). + + +Example of a RMI4 I2C device with F01: + Example: + &i2c1 { + rmi-i2c-dev@2c { + compatible = "syna,rmi-i2c"; + + ... + + rmi-f01@1 { + reg = <0x1>; + syna,nosleep-mode = <1>; + }; + }; + };
Documentation/devicetree/bindings/input/rmi4/rmi_i2c.txt new file +53 -0
53 lines not on this page · raw message
Documentation/devicetree/bindings/vendor-prefixes.txt +1 -0
@@ -212,6 +212,7 @@ sprd Spreadtrum Communications Inc. st STMicroelectronics ste ST-Ericsson stericsson ST-Ericsson +syna Synaptics Inc. synology Synology, Inc. tbs TBS Technologies tcl Toby Churchill Ltd.
drivers/input/rmi4/rmi_bus.c +71 -0
89 lines not on this page · raw message
drivers/input/rmi4/rmi_driver.c +28 -0
@@ -20,6 +20,7 @@#include <linux/kconfig.h> #include <linux/pm.h> #include <linux/slab.h> +#include <linux/of.h> #include <uapi/linux/input.h> #include <linux/rmi.h> #include "rmi_bus.h"
@@ -864,6 +865,27 @@ static int rmi_driver_remove(struct device *dev)return 0 ; } +#ifdef CONFIG_OF +static int rmi_driver_of_probe (struct device *dev, +struct rmi_device_platform_data *pdata) +{ +int retval; + + retval =rmi_of_property_read_u32 (dev, &pdata->reset_delay_ms, +"syna,reset-delay-ms" ,1 ); +if (retval) +return retval; + +return 0 ; +} +#else +static inline int rmi_driver_of_probe (struct device *dev, +struct rmi_device_platform_data *pdata) +{ +return -ENODEV ; +} +#endif +static int rmi_driver_probe (struct device *dev) {struct rmi_driver *rmi_driver;
@@ -888,6 +910,12 @@ static int rmi_driver_probe(struct device *dev) pdata =rmi_get_platform_data (rmi_dev); +if (rmi_dev->xport->dev->of_node) { + retval =rmi_driver_of_probe (rmi_dev->xport->dev, pdata); +if (retval) +return retval; + } + data =devm_kzalloc (dev,sizeof (struct rmi_driver_data ),GFP_KERNEL );if (!data)return -ENOMEM ;
drivers/input/rmi4/rmi_i2c.c +11 -1
@@ -9,6 +9,7 @@#include <linux/i2c.h> #include <linux/rmi.h> +#include <linux/of.h> #include "rmi_driver.h" #define BUFFER_SIZE_INCREMENT 32
@@ -168,6 +169,14 @@ static const struct rmi_transport_ops rmi_i2c_ops = { .read_block = rmi_i2c_read_block, }; +#ifdef CONFIG_OF +static const struct of_device_id rmi_i2c_of_match[] = { + { .compatible ="syna,rmi-i2c" }, + {}, +}; +MODULE_DEVICE_TABLE (of, rmi_i2c_of_match); +#endif +static int rmi_i2c_probe (struct i2c_client *client,const struct i2c_device_id *id) {
@@ -184,7 +193,7 @@ static int rmi_i2c_probe(struct i2c_client *client, pdata = &rmi_i2c->xport.pdata; -if (client_pdata) +if (!client->dev.of_node && client_pdata) *pdata = *client_pdata;dev_dbg (&client->dev,"Probing %s.\n" ,dev_name (&client->dev));
@@ -246,6 +255,7 @@ static struct i2c_driver rmi_i2c_driver = { .driver = { .owner = THIS_MODULE, .name = "rmi_i2c", + .of_match_table = of_match_ptr(rmi_i2c_of_match), }, .id_table = rmi_id, .probe = rmi_i2c_probe,
Signature · 1 line
2.5.0
PATCH 4/10 Input: synaptics-rmi4: Add support for 2D sensors and F11
In reply to Andrew DugganRMI4 currently defines two functions for reporting data for 2D sensors (F11 and F12). This patch adds the common functionality which is shared by devices with 2D reporting along with implementing functionality for F11.
--- drivers/input/rmi4/Kconfig | 29 + drivers/input/rmi4/Makefile | 5 + drivers/input/rmi4/rmi_2d_sensor.c | 220 ++++++ drivers/input/rmi4/rmi_2d_sensor.h | 85 +++ drivers/input/rmi4/rmi_bus.c | 13 +- drivers/input/rmi4/rmi_driver.h | 8 + drivers/input/rmi4/rmi_f11.c | 1349 ++++++++++++++++++++++++++++++++++++ include/linux/rmi.h | 83 +++ 8 files changed, 1790 insertions(+), 2 deletions(-) create mode 100644 drivers/input/rmi4/rmi_2d_sensor.c create mode 100644 drivers/input/rmi4/rmi_2d_sensor.h create mode 100644 drivers/input/rmi4/rmi_f11.c
drivers/input/rmi4/Kconfig +29 -0
@@ -35,3 +35,32 @@ config RMI4_I2C If unsure, say Y. This feature is not currently available as a loadable module. + +config RMI4_2D_SENSOR + bool + depends on RMI4_CORE + +config RMI4_F11 + bool "RMI4 Function 11 (2D pointing)" + select RMI4_2D_SENSOR + help + Say Y here if you want to add support for RMI4 function 11. + + Function 11 provides 2D multifinger pointing for touchscreens and + touchpads. For sensors that support relative pointing, F11 also + provides mouse input. + +config RMI4_F11_PEN + bool "RMI4 F11 Pen Support" + depends on RMI4_F11 + help + Say Y here to add support for pen input to RMI4 function 11. + + If this feature is enabled, when pen inputs are detected they + will be reported to the input stream as MT_TOOL_PEN. Otherwise, + pens will be treated the same as fingers. + + Not all UI implementations deal gracefully with pen discrimination. + If your system is not recognizing pen touches and you know your + sensor supports pen input, you probably want to turn this feature + off.
drivers/input/rmi4/Makefile +5 -0
@@ -1,6 +1,11 @@ obj-$(CONFIG_RMI4_CORE) += rmi_core.o rmi_core-y := rmi_bus.o rmi_driver.o rmi_f01.o +rmi_core-$(CONFIG_RMI4_2D_SENSOR) += rmi_2d_sensor.o + +# Function drivers +rmi_core-$(CONFIG_RMI4_F11) += rmi_f11.o + # Transports obj-$(CONFIG_RMI4_I2C) += rmi_i2c.o
drivers/input/rmi4/rmi_2d_sensor.c new file +220 -0
220 lines not on this page · raw message
drivers/input/rmi4/rmi_2d_sensor.h new file +85 -0
85 lines not on this page · raw message
drivers/input/rmi4/rmi_bus.c +11 -2
@@ -352,15 +352,23 @@ static int __init rmi_bus_init(void) goto err_unregister_bus; } + error =rmi_register_f11_handler (); +if (error) { +pr_err ("%s: error registering the RMI F11 handler: %d\n" , + __func__, error); + goto err_unregister_f01; + } + error =rmi_register_physical_driver ();if (error) {pr_err ("%s: error registering the RMI physical driver: %d\n" , __func__, error); - goto err_unregister_f01; + goto err_unregister_f11; }return 0 ; - +err_unregister_f11: +rmi_unregister_f11_handler (); err_unregister_f01:rmi_unregister_f01_handler (); err_unregister_bus:
@@ -377,6 +385,7 @@ static void __exit rmi_bus_exit(void)*/ rmi_unregister_physical_driver (); +rmi_unregister_f11_handler ();rmi_unregister_f01_handler ();bus_unregister (&rmi_bus_type); }
drivers/input/rmi4/rmi_driver.h +8 -0
@@ -99,4 +99,12 @@ void rmi_unregister_physical_driver(void);int rmi_register_f01_handler (void );void rmi_unregister_f01_handler (void );char *rmi_f01_get_product_ID (struct rmi_function *fn); + +#ifdef CONFIG_RMI4_F11 +int rmi_register_f11_handler (void ); +void rmi_unregister_f11_handler (void ); +#else +static inline int rmi_register_f11_handler (void ) {return 0 ; } +static inline void rmi_unregister_f11_handler (void ) {} +#endif #endif
drivers/input/rmi4/rmi_f11.c new file +1349 -0
1,349 lines not on this page · raw message
include/linux/rmi.h +83 -0
95 lines not on this page · raw message
Signature · 1 line
2.5.0
cover Input: synaptics-rmi4: Synaptics RMI4 Driver rebased on 4.3
This is a new patch series which squashes all of the development history of the RMI4 driver into patches based on functionality. The first patch adds the core RMI4 functionality needed by all RMI4 devices and then the additional patches add transport and function drivers for supporting various devices.
Touchpads which are currently using hid-rmi should have the same functionality, but now knowledge of RMI is handled in the core instead of in hid-rmi. These patches also provide basic finger reporting for a wide range of RMI4 touchscreens connected to I2C and SPI busses. However, additional work may need to be done to implement product specific features.
I tried to include all of the feedback I received from the previous patches I posted. However, I did not come up with a satisfactory solution for allowing function drivers to be built as modules. I think it is fine to allow function drivers to be enabled or disabled in the core at build time. However, if supporting function drivers as modules is a must have for upstreaming I can continue to try to find a solution. Also, I went ahead and removed support for polling.
Thanks,
Andrew
Andrew Duggan (10):
Input: synaptics-rmi4: Add support for Synaptics RMI4 devices
Input: synaptics-rmi4: Add I2C transport driver
Input: synaptics-rmi4: Add device tree support for RMI4 I2C devices
Input: synaptics-rmi4: Add support for 2D sensors and F11
Input: synaptics-rmi4: Add device tree support for 2d sensors and F11
Input: synaptics-rmi4: Add support for F12
Input: synaptics-rmi4: Add support for F30
Input: synaptics-rmi4: Add SPI transport driver
Input: synaptics-rmi4: Add device tree support to the SPI transport
driver
HID: rmi: Make hid-rmi a transport driver for synaptics-rmi4
.../bindings/input/rmi4/rmi_2d_sensor.txt | 55 + .../devicetree/bindings/input/rmi4/rmi_f01.txt | 40 + .../devicetree/bindings/input/rmi4/rmi_i2c.txt | 53 + .../devicetree/bindings/input/rmi4/rmi_spi.txt | 57 + .../devicetree/bindings/vendor-prefixes.txt | 1 + drivers/hid/hid-rmi.c | 922 ++----------- drivers/input/Kconfig | 2 + drivers/input/Makefile | 2 + drivers/input/rmi4/Kconfig | 94 ++ drivers/input/rmi4/Makefile | 15 + drivers/input/rmi4/rmi_2d_sensor.c | 323 +++++ drivers/input/rmi4/rmi_2d_sensor.h | 88 ++ drivers/input/rmi4/rmi_bus.c | 419 ++++++ drivers/input/rmi4/rmi_bus.h | 195 +++ drivers/input/rmi4/rmi_driver.c | 1112 ++++++++++++++++ drivers/input/rmi4/rmi_driver.h | 126 ++ drivers/input/rmi4/rmi_f01.c | 570 ++++++++ drivers/input/rmi4/rmi_f11.c | 1354 ++++++++++++++++++++ drivers/input/rmi4/rmi_f12.c | 487 +++++++ drivers/input/rmi4/rmi_f30.c | 419 ++++++ drivers/input/rmi4/rmi_i2c.c | 270 ++++ drivers/input/rmi4/rmi_spi.c | 464 +++++++ include/linux/rmi.h | 415 ++++++ include/uapi/linux/input.h | 1 + 24 files changed, 6638 insertions(+), 846 deletions(-) create mode 100644 Documentation/devicetree/bindings/input/rmi4/rmi_2d_sensor.txt create mode 100644 Documentation/devicetree/bindings/input/rmi4/rmi_f01.txt create mode 100644 Documentation/devicetree/bindings/input/rmi4/rmi_i2c.txt create mode 100644 Documentation/devicetree/bindings/input/rmi4/rmi_spi.txt create mode 100644 drivers/input/rmi4/Kconfig create mode 100644 drivers/input/rmi4/Makefile create mode 100644 drivers/input/rmi4/rmi_2d_sensor.c create mode 100644 drivers/input/rmi4/rmi_2d_sensor.h create mode 100644 drivers/input/rmi4/rmi_bus.c create mode 100644 drivers/input/rmi4/rmi_bus.h create mode 100644 drivers/input/rmi4/rmi_driver.c create mode 100644 drivers/input/rmi4/rmi_driver.h create mode 100644 drivers/input/rmi4/rmi_f01.c create mode 100644 drivers/input/rmi4/rmi_f11.c create mode 100644 drivers/input/rmi4/rmi_f12.c create mode 100644 drivers/input/rmi4/rmi_f30.c create mode 100644 drivers/input/rmi4/rmi_i2c.c create mode 100644 drivers/input/rmi4/rmi_spi.c create mode 100644 include/linux/rmi.h
Signature · 1 line
2.5.0
PATCH 1/10 Input: synaptics-rmi4: Add support for Synaptics RMI4 devices
Synaptics uses the Register Mapped Interface (RMI) protocol as a communications interface for their devices. This driver adds the core functionality needed to interface with RMI4 devices.
RMI devices can be connected to the host via several transport protocols and can supports a wide variety of functionality defined by RMI functions. Support for transport protocols and RMI functions are implemented in individual drivers. The RMI4 core driver uses a bus architecture to facilitate the various combinations of transport and function drivers needed by a particular device.
--- drivers/input/Kconfig | 2 + drivers/input/Makefile | 2 + drivers/input/rmi4/Kconfig | 26 + drivers/input/rmi4/Makefile | 4 + drivers/input/rmi4/rmi_bus.c | 318 ++++++++++++ drivers/input/rmi4/rmi_bus.h | 195 +++++++ drivers/input/rmi4/rmi_driver.c | 1085 +++++++++++++++++++++++++++++++++++++++ drivers/input/rmi4/rmi_driver.h | 102 ++++ drivers/input/rmi4/rmi_f01.c | 570 ++++++++++++++++++++ include/linux/rmi.h | 263 ++++++++++ include/uapi/linux/input.h | 1 + 11 files changed, 2568 insertions(+) create mode 100644 drivers/input/rmi4/Kconfig create mode 100644 drivers/input/rmi4/Makefile create mode 100644 drivers/input/rmi4/rmi_bus.c create mode 100644 drivers/input/rmi4/rmi_bus.h create mode 100644 drivers/input/rmi4/rmi_driver.c create mode 100644 drivers/input/rmi4/rmi_driver.h create mode 100644 drivers/input/rmi4/rmi_f01.c create mode 100644 include/linux/rmi.h
drivers/input/Kconfig +2 -0
@@ -201,6 +201,8 @@ source "drivers/input/touchscreen/Kconfig" source "drivers/input/misc/Kconfig" +source "drivers/input/rmi4/Kconfig" + endif menu "Hardware I/O ports"
drivers/input/Makefile +2 -0
@@ -26,3 +26,5 @@ obj-$(CONFIG_INPUT_TOUCHSCREEN) += touchscreen/ obj-$(CONFIG_INPUT_MISC) += misc/ obj-$(CONFIG_INPUT_APMPOWER) += apm-power.o + +obj-$(CONFIG_RMI4_CORE) += rmi4/
drivers/input/rmi4/Kconfig new file +26 -0
@@ -0,0 +1,26 @@ +# +# RMI4 configuration +# +config RMI4_CORE + tristate "Synaptics RMI4 bus support" + help + Say Y here if you want to support the Synaptics RMI4 bus. This is + required for all RMI4 device support. + + If unsure, say Y. + + This feature is not currently available as a loadable module. + +config RMI4_DEBUG + bool "RMI4 Debugging" + depends on RMI4_CORE + select DEBUG_FS + help + Say Y here to enable debug feature in the RMI4 driver. + + Note that the RMI4 driver debug features can generate a lot of + output (potentially clogging up your dmesg output) and generally + slow down driver operation. It's recommended to enable them only + if you are actively developing/debugging RMI4 features. + + If unsure, say N.
drivers/input/rmi4/Makefile new file +4 -0
@@ -0,0 +1,4 @@ +obj-$(CONFIG_RMI4_CORE) += rmi_core.o +rmi_core-y := rmi_bus.o rmi_driver.o rmi_f01.o + +ccflags-$(CONFIG_RMI4_DEBUG) += -DDEBUG
drivers/input/rmi4/rmi_bus.c new file +318 -0
318 lines not on this page · raw message
drivers/input/rmi4/rmi_bus.h new file +195 -0
195 lines not on this page · raw message
drivers/input/rmi4/rmi_driver.c new file +1085 -0
1,085 lines not on this page · raw message
drivers/input/rmi4/rmi_driver.h new file +102 -0
102 lines not on this page · raw message
drivers/input/rmi4/rmi_f01.c new file +570 -0
570 lines not on this page · raw message
include/linux/rmi.h new file +263 -0
263 lines not on this page · raw message
include/uapi/linux/input.h +1 -0
@@ -972,6 +972,7 @@ struct input_keymap_entry {#define BUS_GSC 0x1A#define BUS_ATARI 0x1B#define BUS_SPI 0x1C +#define BUS_RMI 0x1D/* * MT_TOOL types
Signature · 1 line
2.5.0
Hi Andrew,
Quoted 5 lines · Andrew Duggan
This is a new patch series which squashes all of the development history of the RMI4 driver into patches based on functionality. The first patch adds the core RMI4 functionality needed by all RMI4 devices and then the additional patches add transport and function drivers for supporting various devices.
Thanks for this hard work. I did not do a full review of the series yet, but caught some general design questions that I am writing here.
Quoted 3 lines
Touchpads which are currently using hid-rmi should have the same functionality, but now knowledge of RMI is handled in the core instead
I tried applying the series on top of a 4.4-rc2, and git am failed. I think it's good to keep this one in the series, but we might want to postpone its application when rmi4 hits Linus' tree so Jiri will be able to take it without conflicting with Dmitry's tree. Well, Jiri and Dmitry can sort this out :)
Quoted 9 lines
of in hid-rmi. These patches also provide basic finger reporting for a wide range of RMI4 touchscreens connected to I2C and SPI busses. However, additional work may need to be done to implement product specific features.
I tried to include all of the feedback I received from the previous patches I posted. However, I did not come up with a satisfactory solution for allowing function drivers to be built as modules. I think it is fine to allow function drivers to be enabled or disabled in the core at build
I agree. I do not like the implementation however (I know, I contributed a lot to it). How about we keep a static array of struct rmi_function_handler? If we add a .registered file in struct rmi_function_handler, we could simplify the registering/unregistering of the functions more easily by looping through the array.
Quoted 3 lines
time. However, if supporting function drivers as modules is a must have for upstreaming I can continue to try to find a solution. Also, I went ahead and removed support for polling.
Thanks for removing polling.
I have 2 other general concerns for rmi_bus:
- interrupts:
the current implementation has 2 type of interrupt handling depending on the transport driver: either generic irqs or specific ones that are triggered by the transport driver.
I think it would make sense to remove the generic irq handling in rmi4_bus and let the transport driver handle it. This way, it will be easier for the transport driver to decide whether or not forwarding the interrupts to the bus.
This is what is done with the HID bus for the record. The transport driver calls hid_input_report() when an irq has been processed.
- suspend/resume:
with the smbus implementation, we have quite some troubles with the suspend/resume part. The reason is that both the rmi_bus and the serio bus are registering to the pm subsystem and this leads to races between them. Our current solution is to disable the pm registering in rmi_bus and let the transport driver handle it at his level (which is in fine triggered by the serio pm resume actually, not its own pm registration).
I wonder if having the pm functions directly in the bus is a good idea and if we should not let the transport driver handle those. We should still keep the rmi specific functions in rmi_core/bus, I am just talking about the registration of the bus to the subsystem.
[just thinking out loud: maybe we encounter problems of ordering due to the fact that the bus is registered to the pm subsystem. Maybe if the device itself in the transport driver registers, there will be guarantee that the serio resume is called before the rmi_smbus one, which would solve our problems].
Cheers,
Benjamin
Quoted 65 lines
Thanks,
AndrewAndrew Duggan (10):
Input: synaptics-rmi4: Add support for Synaptics RMI4 devices
Input: synaptics-rmi4: Add I2C transport driver
Input: synaptics-rmi4: Add device tree support for RMI4 I2C devices
Input: synaptics-rmi4: Add support for 2D sensors and F11
Input: synaptics-rmi4: Add device tree support for 2d sensors and F11
Input: synaptics-rmi4: Add support for F12
Input: synaptics-rmi4: Add support for F30
Input: synaptics-rmi4: Add SPI transport driver
Input: synaptics-rmi4: Add device tree support to the SPI transport
driver
HID: rmi: Make hid-rmi a transport driver for synaptics-rmi4.../bindings/input/rmi4/rmi_2d_sensor.txt | 55 + .../devicetree/bindings/input/rmi4/rmi_f01.txt | 40 + .../devicetree/bindings/input/rmi4/rmi_i2c.txt | 53 + .../devicetree/bindings/input/rmi4/rmi_spi.txt | 57 + .../devicetree/bindings/vendor-prefixes.txt | 1 + drivers/hid/hid-rmi.c | 922 ++----------- drivers/input/Kconfig | 2 + drivers/input/Makefile | 2 + drivers/input/rmi4/Kconfig | 94 ++ drivers/input/rmi4/Makefile | 15 + drivers/input/rmi4/rmi_2d_sensor.c | 323 +++++ drivers/input/rmi4/rmi_2d_sensor.h | 88 ++ drivers/input/rmi4/rmi_bus.c | 419 ++++++ drivers/input/rmi4/rmi_bus.h | 195 +++ drivers/input/rmi4/rmi_driver.c | 1112 ++++++++++++++++ drivers/input/rmi4/rmi_driver.h | 126 ++ drivers/input/rmi4/rmi_f01.c | 570 ++++++++ drivers/input/rmi4/rmi_f11.c | 1354 ++++++++++++++++++++ drivers/input/rmi4/rmi_f12.c | 487 +++++++ drivers/input/rmi4/rmi_f30.c | 419 ++++++ drivers/input/rmi4/rmi_i2c.c | 270 ++++ drivers/input/rmi4/rmi_spi.c | 464 +++++++ include/linux/rmi.h | 415 ++++++ include/uapi/linux/input.h | 1 + 24 files changed, 6638 insertions(+), 846 deletions(-) create mode 100644 Documentation/devicetree/bindings/input/rmi4/rmi_2d_sensor.txt create mode 100644 Documentation/devicetree/bindings/input/rmi4/rmi_f01.txt create mode 100644 Documentation/devicetree/bindings/input/rmi4/rmi_i2c.txt create mode 100644 Documentation/devicetree/bindings/input/rmi4/rmi_spi.txt create mode 100644 drivers/input/rmi4/Kconfig create mode 100644 drivers/input/rmi4/Makefile create mode 100644 drivers/input/rmi4/rmi_2d_sensor.c create mode 100644 drivers/input/rmi4/rmi_2d_sensor.h create mode 100644 drivers/input/rmi4/rmi_bus.c create mode 100644 drivers/input/rmi4/rmi_bus.h create mode 100644 drivers/input/rmi4/rmi_driver.c create mode 100644 drivers/input/rmi4/rmi_driver.h create mode 100644 drivers/input/rmi4/rmi_f01.c create mode 100644 drivers/input/rmi4/rmi_f11.c create mode 100644 drivers/input/rmi4/rmi_f12.c create mode 100644 drivers/input/rmi4/rmi_f30.c create mode 100644 drivers/input/rmi4/rmi_i2c.c create mode 100644 drivers/input/rmi4/rmi_spi.c create mode 100644 include/linux/rmi.hSignature · 1 line
2.5.0
Rob Herring
maintainerRe: [PATCH 03/10] Input: synaptics-rmi4: Add device tree support for RMI4 I2C devices
In reply to Andrew DugganQuoted 22 lines · Andrew Duggan
Add devicetree binding for I2C devices and add bindings for optional parameters in the function drivers. Parameters for function drivers are defined in child nodes for each of the functions.
Signed-off-by Andrew Duggan <[email protected]>--- .../devicetree/bindings/input/rmi4/rmi_f01.txt | 39 ++++++++++++ .../devicetree/bindings/input/rmi4/rmi_i2c.txt | 53 ++++++++++++++++ .../devicetree/bindings/vendor-prefixes.txt | 1 + drivers/input/rmi4/rmi_bus.c | 71 ++++++++++++++++++++++ drivers/input/rmi4/rmi_driver.c | 28 +++++++++ drivers/input/rmi4/rmi_i2c.c | 12 +++- 6 files changed, 203 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/input/rmi4/rmi_f01.txt create mode 100644 Documentation/devicetree/bindings/input/rmi4/rmi_i2c.txtDocumentation/devicetree/bindings/input/rmi4/rmi_f01.txt new file +0
-0
Documentation/devicetree/bindings/input/rmi4/rmi_f01.txt line 4
Quoted 4 lines
Documentation/devicetree/bindings/input/rmi4/rmi_f01.txt new file +4
-0@@ -0,0 +1,39 @@ +Synaptics RMI4 F01 Device Binding + +The Synaptics RMI4 core is able to support RMI4 devices using differnet +transports and differnet functions. This file describes the device tree
s/differnet/different/
Quoted 10 lines
Documentation/devicetree/bindings/input/rmi4/rmi_f01.txt new file +10
-0+bindings for devices which contain Function 1. Complete documentation +for transports and other functions can be found in: +Documentation/devicetree/bindings/input/rmi4. + +Additional documentation for F01 can be found at: +http://www.synaptics.com/sites/default/files/511-000136-01-Rev-E-RMI4-Interfacing-Guide.pdf + +Optional Properties: +- syna,nosleep-mode: If set the device will run at full power without sleeping. + nosleep has 3 modes, 0 will not change the default
Documentation/devicetree/bindings/input/rmi4/rmi_f01.txt line 23
Quoted 10 lines
Documentation/devicetree/bindings/input/rmi4/rmi_f01.txt new file +9
-0+ setting, 1 will disable nosleep (allow sleeping), + and 2 will enable nosleep (disabling sleep). +- syna,wakeup-threshold: Defines the amplitude of the disturbance to the + background capacitance that will cause the + device to wake from dozing. +- syna,doze-holdoff: The delay to wait after the last finger lift and the + first doze cycle (in 0.1 second units). +- syna,doze-interval: The time period that the device sleeps between finger + activity (in 10 ms units).
Use millisec units and -msec suffix.
Quoted 22 lines
Documentation/devicetree/bindings/input/rmi4/rmi_f01.txt new file +16
-0+ + +Example of a RMI4 I2C device with F01: + Example: + &i2c1 { + rmi-i2c-dev@2c { + compatible = "syna,rmi-i2c"; + + ... + + rmi-f01@1 { + reg = <0x1>; + syna,nosleep-mode = <1>; + }; + }; + };Documentation/devicetree/bindings/input/rmi4/rmi_i2c.txt new file +0
-0
Documentation/devicetree/bindings/input/rmi4/rmi_i2c.txt line 4
Quoted 4 lines
Documentation/devicetree/bindings/input/rmi4/rmi_i2c.txt new file +4
-0@@ -0,0 +1,53 @@ +Synaptics RMI4 I2C Device Binding + +The Synaptics RMI4 core is able to support RMI4 devices using differnet +transports and differnet functions. This file describes the device tree
s/differnet/different/
Documentation/devicetree/bindings/input/rmi4/rmi_i2c.txt line 10
Quoted 6 lines
Documentation/devicetree/bindings/input/rmi4/rmi_i2c.txt new file +6
-0+bindings for devices using the I2C tranport driver. Complete documentation +for other transports and functions cen be found ini +Documentation/devicetree/bindings/input/rmi4. + +Required Properties: +- compatible: syna,rmi-i2c
This is not very specific. Perhaps at least "rmi4" instead of just rmi.
Documentation/devicetree/bindings/input/rmi4/rmi_i2c.txt line 22
Quoted 12 lines
Documentation/devicetree/bindings/input/rmi4/rmi_i2c.txt new file +12
-0+- reg: I2C address +- #address-cells: Set to 1 to indicate that the function child nodes + consist of only on uint32 value. +- #size-cells: Set to 0 to indicate that the function child nodes do not + have a size property. + +Optional Properties: +- interrupts: interrupt which the rmi device is connected to. +- interrupt-parent: The interrupt controller. +See Documentation/devicetree/bindings/interrupt-controller/interrupts.txt + +- syna,reset-delay-ms: The number of milliseconds to wait after resetting the
"-msec" is the more commonly used abreviation in bindings.
Quoted 31 lines
Documentation/devicetree/bindings/input/rmi4/rmi_i2c.txt new file +31
-0+ device. + +Function Parameters: +Parameters specific to RMI functions are contained in child nodes of the rmi device + node. Documentation for the parameters of each function can be found in: +Documentation/devicetree/bindings/input/rmi4/rmi_f*.txt. + + + +Example: + &i2c1 { + rmi-i2c-dev@2c { + compatible = "syna,rmi-i2c"; + reg = <0x2c>; + #address-cells = <1>; + #size-cells = <0>; + interrupt-parent = <&gpio>; + interrupts = <4 2>; + + rmi-f01@1 { + reg = <0x1>; + syna,nosleep-mode = <1>; + }; + + rmi-f11@11 { + reg = <0x11>; + syna,flip-y; + syna,sensor-type = <2>; + }; + }; + };
Quoted 11 lines · Benjamin Tissoires
Hi Andrew,
Quoted 5 lines · Andrew Duggan
This is a new patch series which squashes all of the development history of the RMI4 driver into patches based on functionality. The first patch adds the core RMI4 functionality needed by all RMI4 devices and then the additional patches add transport and function drivers for supporting various devices.
Thanks for this hard work. I did not do a full review of the series yet, but caught some general design questions that I am writing here.
Quoted 7 lines
Quoted 2 lines
Touchpads which are currently using hid-rmi should have the same functionality, but now knowledge of RMI is handled in the core instead
I tried applying the series on top of a 4.4-rc2, and git am failed. I think it's good to keep this one in the series, but we might want to postpone its application when rmi4 hits Linus' tree so Jiri will be able to take it without conflicting with Dmitry's tree. Well, Jiri and Dmitry can sort this out :)
I forgot there were in changes to hid-rmi in 4.4. I can fix it up to work with whatever version the core ends up being applied to.
Quoted 9 lines
Quoted 9 lines
of in hid-rmi. These patches also provide basic finger reporting for a wide range of RMI4 touchscreens connected to I2C and SPI busses. However, additional work may need to be done to implement product specific features.
I tried to include all of the feedback I received from the previous patches I posted. However, I did not come up with a satisfactory solution for allowing function drivers to be built as modules. I think it is fine to allow function drivers to be enabled or disabled in the core at build
Quoted 5 lines
I agree. I do not like the implementation however (I know, I contributed a lot to it). How about we keep a static array of struct
rmi_function_handler? If we add a .registered file in structrmi_function_handler, we could simplify the registering/unregistering of the functions more easily by looping through the array.
Sounds like a good idea. Right you it takes several lines in multiple files to register and unregister function drivers and its really easy to forget something.
Quoted 11 lines
Quoted 3 lines
time. However, if supporting function drivers as modules is a must have for upstreaming I can continue to try to find a solution. Also, I went ahead and removed support for polling.
Thanks for removing polling.
I have 2 other general concerns for
rmi_bus:
- interrupts:
the current implementation has 2 type of interrupt handling depending on the transport driver: either generic irqs or specific ones that are triggered by the transport driver.
Quoted 7 lines
I think it would make sense to remove the generic irq handling in
rmi4_busand let the transport driver handle it. This way, it will be easier for the transport driver to decide whether or not forwarding the interrupts to the bus.This is what is done with the HID bus for the record. The transport driver calls
hid_input_report()when an irq has been processed.
The driver was handling the IRQs originally to avoid duplicating a lot of code in each of the transport devices. But, now that the custom GPIO code has been removed the reasoning for handling it in rmi_driver is less compelling. Plus, now we have SMBus and HID transports which don't handle the IRQs directly. It might also be better to enable and disable IRQs in the transport drivers pm callbacks.
Quoted 7 lines
- suspend/resume:
with the smbus implementation, we have quite some troubles with the suspend/resume part. The reason is that both thermi_busand the serio bus are registering to the pm subsystem and this leads to races between them. Our current solution is to disable the pm registering inrmi_busand let the transport driver handle it at his level (which is in fine triggered by the serio pm resume actually, not its own pm registration).
The interaction between the SMBus and the PS/2 interface does complicate things. I have not noticed any similar issues with PS/2 + HID/I2C. Probably, because PS/2 + HID/I2C was designed to work without any driver interaction.
Quoted 4 lines
I wonder if having the pm functions directly in the bus is a good idea and if we should not let the transport driver handle those. We should still keep the rmi specific functions in rmi_core/bus, I am just talking about the registration of the bus to the subsystem.
I guess we could just call rmi_driver_suspend/resume() from the transports and have it loop through all of the function drivers and call their suspend/resume functions. So far it has just made sense to use the pm subsystem instead of doing things manually. But, none of the other transports have dependencies on devices in separate driver stacks.
Quoted 5 lines
[just thinking out loud: maybe we encounter problems of ordering due to the fact that the bus is registered to the pm subsystem. Maybe if the device itself in the transport driver registers, there will be guarantee that the serio resume is called before the
rmi_smbusone, which would solve our problems].
Well if rmi_smbus can register itself with the pm subsystem, could we just make the transport device the parent of the bus device? Would that ensure that all of the pm callbacks get called together? Sounds like some more investigating is needed for figuring out how best to handle suspend/resume.
Thanks,
Andrew
Quoted 67 lines
Cheers,
BenjaminQuoted 64 lines
Thanks,
AndrewAndrew Duggan (10):
Input: synaptics-rmi4: Add support for Synaptics RMI4 devices
Input: synaptics-rmi4: Add I2C transport driver
Input: synaptics-rmi4: Add device tree support for RMI4 I2C devices
Input: synaptics-rmi4: Add support for 2D sensors and F11
Input: synaptics-rmi4: Add device tree support for 2d sensors and F11
Input: synaptics-rmi4: Add support for F12
Input: synaptics-rmi4: Add support for F30
Input: synaptics-rmi4: Add SPI transport driver
Input: synaptics-rmi4: Add device tree support to the SPI transport
driver
HID: rmi: Make hid-rmi a transport driver for synaptics-rmi4.../bindings/input/rmi4/rmi_2d_sensor.txt | 55 + .../devicetree/bindings/input/rmi4/rmi_f01.txt | 40 + .../devicetree/bindings/input/rmi4/rmi_i2c.txt | 53 + .../devicetree/bindings/input/rmi4/rmi_spi.txt | 57 + .../devicetree/bindings/vendor-prefixes.txt | 1 + drivers/hid/hid-rmi.c | 922 ++----------- drivers/input/Kconfig | 2 + drivers/input/Makefile | 2 + drivers/input/rmi4/Kconfig | 94 ++ drivers/input/rmi4/Makefile | 15 + drivers/input/rmi4/rmi_2d_sensor.c | 323 +++++ drivers/input/rmi4/rmi_2d_sensor.h | 88 ++ drivers/input/rmi4/rmi_bus.c | 419 ++++++ drivers/input/rmi4/rmi_bus.h | 195 +++ drivers/input/rmi4/rmi_driver.c | 1112 ++++++++++++++++ drivers/input/rmi4/rmi_driver.h | 126 ++ drivers/input/rmi4/rmi_f01.c | 570 ++++++++ drivers/input/rmi4/rmi_f11.c | 1354 ++++++++++++++++++++ drivers/input/rmi4/rmi_f12.c | 487 +++++++ drivers/input/rmi4/rmi_f30.c | 419 ++++++ drivers/input/rmi4/rmi_i2c.c | 270 ++++ drivers/input/rmi4/rmi_spi.c | 464 +++++++ include/linux/rmi.h | 415 ++++++ include/uapi/linux/input.h | 1 + 24 files changed, 6638 insertions(+), 846 deletions(-)create mode 100644
Documentation/devicetree/bindings/input/rmi4/rmi_2d_sensor.txtcreate mode 100644Documentation/devicetree/bindings/input/rmi4/rmi_f01.txtcreate mode 100644Documentation/devicetree/bindings/input/rmi4/rmi_i2c.txtcreate mode 100644Documentation/devicetree/bindings/input/rmi4/rmi_spi.txtcreate mode 100644drivers/input/rmi4/Kconfig
create mode 100644drivers/input/rmi4/Makefile
create mode 100644drivers/input/rmi4/rmi_2d_sensor.c
create mode 100644drivers/input/rmi4/rmi_2d_sensor.h
create mode 100644drivers/input/rmi4/rmi_bus.c
create mode 100644drivers/input/rmi4/rmi_bus.h
create mode 100644drivers/input/rmi4/rmi_driver.c
create mode 100644drivers/input/rmi4/rmi_driver.h
create mode 100644drivers/input/rmi4/rmi_f01.c
create mode 100644drivers/input/rmi4/rmi_f11.c
create mode 100644drivers/input/rmi4/rmi_f12.c
create mode 100644drivers/input/rmi4/rmi_f30.c
create mode 100644drivers/input/rmi4/rmi_i2c.c
create mode 100644drivers/input/rmi4/rmi_spi.c
create mode 100644include/linux/rmi.hSignature · 1 line
2.5.0
Quoted 5 lines · Andrew Duggan
I tried to include all of the feedback I received from the previous patches I posted. However, I did not come up with a satisfactory solution for allowing function drivers to be built as modules. I think it is fine to allow function drivers to be enabled or disabled in the core at build time.
I am happy with this. If people need something else they can put in the work, I'm just happy to have my hardware working.
A large slew of the systems using this will be Androids with tailored kernels anyway, they will all build this in.
Yours,
Linus Walleij