Skip to contentSkip to conversation

Introduce the Atmel PTC subsystem

PATCH Superseded Ludovic Desroches 1 participant 7 messages Apr 21, 2017

Subsystems (5)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover Introduce the Atmel PTC subsystem

Hi,

The Atmel Peripheral touch controller subsystem offers built-in hardware for capacitive touch measurement on sensors that function as buttons, sliders and wheels. It is available on SAMA5D2.

A firmware and a configuration file describing the topology and the parameters of the sensor are loaded when probing the driver.

Changes:
- v2:
- reorder patches to get the bindings documentation in first
- remove the header from the uapi since it may change in the future. Declare only the few structures needed in the driver.
- add this driver to the sama5_defconfig

Ludovic Desroches (5):
dt-bindings: input: Add Atmel PTC subsystem bindings
input: misc: introduce Atmel PTC driver
MAINTAINERS: add Atmel PTC entries
ARM: dts: at91: sama5d2: add PTC subsystem device
ARM: at91/defconfig: add PTC driver to sama5_defconfig

 .../devicetree/bindings/input/atmel,ptc.txt        |  67 ++
 MAINTAINERS                                        |   7 +
 arch/arm/boot/dts/sama5d2.dtsi                     |  16 +
 arch/arm/configs/sama5_defconfig                   |   2 +
 drivers/input/misc/Kconfig                         |  12 +
 drivers/input/misc/Makefile                        |   1 +
 drivers/input/misc/atmel_ptc.c                     | 723 +++++++++++++++++++++
 7 files changed, 828 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/atmel,ptc.txt
 create mode 100644 drivers/input/misc/atmel_ptc.c
Signature · 1 line
2.9.0
#1 lore raw

PATCH v2 1/5 dt-bindings: input: Add Atmel PTC subsystem bindings

Add description of the Atmel PTC subsystem bindings.

---
 .../devicetree/bindings/input/atmel,ptc.txt        | 67 ++++++++++++++++++++++
 1 file changed, 67 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/atmel,ptc.txt
Documentation/devicetree/bindings/input/atmel,ptc.txt new file +67 -0
new file mode 100644
index 0000000..a183fd5
@@ -0,0 +1,67 @@
+Atmel PTC Subsystem
+
+The Atmel Peripheral Touch Controller subsystem offers built-in hardware
+for capacitive touch measurement on sensors that function as buttons, sliders
+and wheels.
+
+1) PTC Subsystem node
+
+Required properties:
+- compatible: 		Must be "atmel,sama5d2-ptc"
+- reg: 			Address, length of the shared memory and ppp registers location
+			and length.
+- clocks: 		Phandlers to the clocks.
+- clock-names: 		Must be "ptc_clk", "ptc_int_osc", "slow_clk".
+- #address-cells:	Must be one. The cell is the button or scroller id.
+- #size-cells: 		Must be zero.
+
+Example:
+	ptc at fc060000 {
+		compatible = "atmel,sama5d2-ptc";
+		reg = <0x00800000 0x10000
+		       0xfc060000 0xcf>;
+		interrupts = <58 IRQ_TYPE_LEVEL_HIGH 7>;
+		clocks = <&ptc_clk>, <&main>, <&clk32k>;
+		clock-names = "ptc_clk", "ptc_int_osc", "slow_clk";
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		[ child node definitions... ]
+	};
+
+2) Scroller / buttons subnodes
+
+Subnodes describe the kind of sensors the customer want to use. They have to be
+named according to their function: button, slider or wheel.
+
+2.1) Scroller subnodes
+
+Required properties:
+- reg:	Id of the scroller, each id must be different.
+
+Example:
+	slider at 0 {
+		reg = <0>;
+	};
+
+	wheel at 1 {
+		reg = <1>;
+	};
+
+2.2) Button subnodes
+
+Required properties:
+- reg:			Id of node used for the button, each id must be
+			different.
+- linux,keycode: 	Key code of the button.
+
+Example:
+		button at 8 {
+			reg = <8>;
+			linux,keycode = <2>;
+		};
+
+		button at 9 {
+			reg = <9>;
+			linux,keycode = <3>;
+		};
Signature · 1 line
2.9.0
#2 lore raw

PATCH v2 2/5 input: misc: introduce Atmel PTC driver

In reply to Ludovic Desroches

The Atmel Peripheral Touch Controller subsystem offers built-in hardware for capacitive touch measurement on sensors that function as buttons, sliders and wheels.

Two files are loaded when probing the driver:
- a firmware for the Pico Power Processor that computes raw data from the ADC front end to provide high level information as button touch or untouch, slider position, etc.
- a configuration file that describe the topology and the parameters of the sensors.

---
 drivers/input/misc/Kconfig     |  12 +
 drivers/input/misc/Makefile    |   1 +
 drivers/input/misc/atmel_ptc.c | 723 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 736 insertions(+)
 create mode 100644 drivers/input/misc/atmel_ptc.c
drivers/input/misc/Kconfig +12 -0
index 79d0be9..5e27378 100644
@@ -96,6 +96,18 @@ config INPUT_ATMEL_CAPTOUCH
 	  To compile this driver as a module, choose M here: the
 	  module will be called atmel_captouch.
 
+config INPUT_ATMEL_PTC
+	tristate "Atmel PTC Driver"
+	depends on OF || COMPILE_TEST
+	depends on SOC_SAMA5D2
+	help
+	  Say Y to enable support for the Atmel PTC Subsystem.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called atmel_ptc.
+	  If you compile it as a built-in driver, you have to build the
+	  firmware into the kernel or to use an initrd.
+
 config INPUT_BMA150
 	tristate "BMA150/SMB380 acceleration sensor support"
 	depends on I2C
drivers/input/misc/Makefile +1 -0
index b10523f..9470ec7 100644
@@ -18,6 +18,7 @@ obj-$(CONFIG_INPUT_ARIZONA_HAPTICS)	+= arizona-haptics.o
 obj-$(CONFIG_INPUT_ATI_REMOTE2)		+= ati_remote2.o
 obj-$(CONFIG_INPUT_ATLAS_BTNS)		+= atlas_btns.o
 obj-$(CONFIG_INPUT_ATMEL_CAPTOUCH)	+= atmel_captouch.o
+obj-$(CONFIG_INPUT_ATMEL_PTC)		+= atmel_ptc.o
 obj-$(CONFIG_INPUT_BFIN_ROTARY)		+= bfin_rotary.o
 obj-$(CONFIG_INPUT_BMA150)		+= bma150.o
 obj-$(CONFIG_INPUT_CM109)		+= cm109.o
drivers/input/misc/atmel_ptc.c new file +723 -0

723 lines not on this page · raw message

Signature · 1 line
2.9.0
#3 lore raw

PATCH v2 3/5 MAINTAINERS: add Atmel PTC entries

In reply to Ludovic Desroches

Add entries for the Atmel PTC Subsystem.

---
 MAINTAINERS | 7 +++++++
 1 file changed, 7 insertions(+)
MAINTAINERS +7 -0
index 860dacb..e1b8b0e 100644
@@ -2323,6 +2323,13 @@ F:	Documentation/devicetree/bindings/input/atmel,maxtouch.txt
 F:	drivers/input/touchscreen/atmel_mxt_ts.c
 F:	include/linux/platform_data/atmel_mxt_ts.h
 
+ATMEL PTC SUBSYSTEM DRIVER
+M:	Ludovic Desroches <[email protected]>
+L:	linux-input at vger.kernel.org
+S:	Supported
+F:	drivers/input/misc/atmel_ptc.c
+F:	include/uapi/linux/atmel_ptc.h
+
 ATTO EXPRESSSAS SAS/SATA RAID SCSI DRIVER
 M:	Bradley Grove <[email protected]>
 L:	linux-scsi at vger.kernel.org
Signature · 1 line
2.9.0
#4 lore raw

Re: [PATCH v2 3/5] MAINTAINERS: add Atmel PTC entries

Quoted 12 lines · Ludovic Desroches

Add entries for the Atmel PTC Subsystem.

---
 MAINTAINERS | 7 +++++++
 1 file changed, 7 insertions(+)
MAINTAINERS +0 -0
index 860dacb..e1b8b0e 100644

MAINTAINERS F: Documentation/devicetree/bindings/input/atmel,maxtouch.txt · line 2331

Quoted 9 lines
MAINTAINERS +6 -0
@@ -2323,6 +2323,13 @@ F:	Documentation/devicetree/bindings/input/atmel,maxtouch.txt
 F:	drivers/input/touchscreen/atmel_mxt_ts.c
 F:	include/linux/platform_data/atmel_mxt_ts.h
 
+ATMEL PTC SUBSYSTEM DRIVER
+M:	Ludovic Desroches <[email protected]>
+L:	linux-input at vger.kernel.org
+S:	Supported
+F:	drivers/input/misc/atmel_ptc.c
+F:	include/uapi/linux/atmel_ptc.h

I'll remove it in v3.

Quoted 7 lines
MAINTAINERS +1 -0
+
 ATTO EXPRESSSAS SAS/SATA RAID SCSI DRIVER
 M:	Bradley Grove <[email protected]>
 L:	linux-scsi at vger.kernel.org
Signature · 1 line
2.9.0
#5 lore raw

PATCH v2 4/5 ARM: dts: at91: sama5d2: add PTC subsystem device

In reply to Ludovic Desroches

Add the Atmel Peripheral Touch Controller subsystem.

---
 arch/arm/boot/dts/sama5d2.dtsi | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
arch/arm/boot/dts/sama5d2.dtsi +16 -0
index 8067c71..fa4ed56 100644
@@ -762,6 +762,12 @@
 						atmel,clk-output-range = <0 83000000>;
 					};
 
+					ptc_clk: ptc_clk {
+						#clock-cells = <0>;
+						reg = <58>;
+						atmel,clk-output-range = <0 83000000>;
+					};
+
 					classd_clk: classd_clk {
 						#clock-cells = <0>;
 						reg = <59>;
@@ -1310,6 +1316,16 @@
 				reg = <0xfc05c000 0x20>;
 			};
 
+			ptc at fc060000 {
+				compatible = "atmel,sama5d2-ptc";
+				reg = <0x00800000 0x10000
+				       0xfc060000 0xcf>;
+				interrupts = <58 IRQ_TYPE_LEVEL_HIGH 7>;
+				clocks = <&ptc_clk>, <&main>, <&clk32k>;
+				clock-names = "ptc_clk", "ptc_int_osc", "slow_clk";
+				status = "disabled";
+			};
+
 			chipid at fc069000 {
 				compatible = "atmel,sama5d2-chipid";
 				reg = <0xfc069000 0x8>;
Signature · 1 line
2.9.0
#6 lore raw

PATCH v2 5/5 ARM: at91/defconfig: add PTC driver to sama5_defconfig

In reply to Ludovic Desroches

Add Peripheral Touch Controller driver to sama5_defconfig.

---
 arch/arm/configs/sama5_defconfig | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/configs/sama5_defconfig +2 -0
index 777c9e9..7480665 100644
@@ -116,6 +116,8 @@ CONFIG_KEYBOARD_GPIO=y
 # CONFIG_INPUT_MOUSE is not set
 CONFIG_INPUT_TOUCHSCREEN=y
 CONFIG_TOUCHSCREEN_ATMEL_MXT=y
+CONFIG_INPUT_MISC=y
+CONFIG_INPUT_ATMEL_PTC=m
 # CONFIG_SERIO is not set
 CONFIG_LEGACY_PTY_COUNT=4
 CONFIG_SERIAL_ATMEL=y
Signature · 1 line
2.9.0