Skip to contentSkip to conversation

Input: synaptics-rmi4: Add SPI transport driver

PATCH In review Andrew Duggan 2 participants 2 messages Nov 5, 2015 – Nov 9, 2015

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

PATCH 18/26 Input: synaptics-rmi4: Add SPI transport driver

Add a transport driver for devices using RMI4 over SPI.

---
 .../devicetree/bindings/input/rmi4/rmi_spi.txt     |  57 +++
 drivers/input/rmi4/Kconfig                         |   9 +
 drivers/input/rmi4/Makefile                        |   1 +
 drivers/input/rmi4/rmi_spi.c                       | 464 +++++++++++++++++++++
 include/linux/rmi.h                                |   2 +
 5 files changed, 533 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/rmi4/rmi_spi.txt
 create mode 100644 drivers/input/rmi4/rmi_spi.c
Documentation/devicetree/bindings/input/rmi4/rmi_spi.txt new file +57 -0
new file mode 100644
index 0000000..f20366b6
@@ -0,0 +1,57 @@
+Synaptics RMI4 SPI 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 using the SPI tranport driver. Complete documentation
+for other transports and functions cen be found ini
+Documentation/devicetree/bindings/input/rmi4.
+
+Required Properties:
+- compatible: syna,rmi-spi
+- reg: Chip select address for the device
+- #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,spi-read-delay: millisecond delay between read byte transfers.
+- syna,spi-write-delay: millisecond delay between write byte transfers.
+
+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:
+	spi@7000d800 {
+		rmi-spi-dev@0 {
+			compatible = "syna,rmi-spi";
+			reg = <0x0>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+			spi-max-frequency = <4000000>;
+			spi-cpha;
+			spi-cpol;
+			interrupt-parent = <&gpio>;
+			interrupts = <TEGRA_GPIO(K, 2) 0x2>;
+			syna,spi-read-delay = <30>;
+
+			rmi-f01@1 {
+				reg = <0x1>;
+				syna,nosleep-mode = <1>;
+			};
+
+			rmi-f11@11 {
+				reg = <0x11>;
+				syna,flip-y;
+				syna,sensor-type = <2>;
+			};
+		};
+	};
drivers/input/rmi4/Kconfig +9 -0
index 5e3890e..88a3919 100644
@@ -36,6 +36,15 @@ config RMI4_I2C
 
 	  This feature is not currently available as a loadable module.
 
+config RMI4_SPI
+	tristate "RMI4 SPI Support"
+	depends on RMI4_CORE && SPI
+	help
+	  Say Y here if you want to support RMI4 devices connected to a SPI
+	  bus.
+
+	  If unsure, say N.
+
 config RMI4_F11
 	bool "RMI4 Function 11 (2D pointing)"
 	depends on RMI4_CORE
drivers/input/rmi4/Makefile +1 -0
index 37b6789..1745757 100644
@@ -6,5 +6,6 @@ rmi_core-$(CONFIG_RMI4_F11) += rmi_f11.o
 
 # Transports
 obj-$(CONFIG_RMI4_I2C) += rmi_i2c.o
+obj-$(CONFIG_RMI4_SPI) += rmi_spi.o
 
 ccflags-$(CONFIG_RMI4_DEBUG) += -DDEBUG
drivers/input/rmi4/rmi_spi.c new file +464 -0

464 lines not on this page · raw message

include/linux/rmi.h +2 -0
index fef482a..c781d09 100644
@@ -205,6 +205,8 @@ struct rmi_device_platform_data_spi {
 	u32 split_read_byte_delay_us;
 	u32 pre_delay_us;
 	u32 post_delay_us;
+	u8 bits_per_word;
+	u16 mode;
 
 	void *cs_assert_data;
 	int (*cs_assert) (const void *cs_assert_data, const bool assert);
Signature · 1 line
2.1.4
Reviewed-by Acked-by on v1 18/26
#1 lore raw
Quoted 6 lines · Andrew Duggan

Add a transport driver for devices using RMI4 over SPI.

 .../devicetree/bindings/input/rmi4/rmi_spi.txt     |  57 +++

Split off bindings in a separate patch and send to [email protected]

This binding

drivers/input/rmi4/Kconfig config RMI4_I2C · line 46

Quoted 8 lines
drivers/input/rmi4/Kconfig +8 -0
+config RMI4_SPI
+       tristate "RMI4 SPI Support"
+       depends on RMI4_CORE && SPI
+       help
+         Say Y here if you want to support RMI4 devices connected to a SPI
+         bus.
+
+         If unsure, say N.

It never hurts to put Mark Brown on CC for SPI drivers. The patch looks good to me (TM)

Yours,
Linus Walleij