Skip to contentSkip to conversation

input: Add new sun4i-lradc-keys driver

PATCH Superseded Hans de Goede 2 participants 7 messages Jan 2, 2014 – Sep 1, 2014

Subsystems (5)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover input: Add new sun4i-lradc-keys driver

Hi Dimitri et al,

Here is v2 of the sun4i-lradc-keys driver, changes since v1:

- Use include/dt-bindings/input/input.h
- Rename the keycodes property to linux,chan0-keycodes

Regards,

Hans

#1 lore raw

PATCH v2 1/4 input: Add new sun4i-lradc-keys driver

Allwinnner sunxi SoCs have a low resolution adc (called lradc) which is specifically designed to have various (tablet) keys (ie home, back, search, etc). attached to it using a resistor network. This adds a driver for this.

There are 2 channels, currently this driver only supports chan0 since there are no boards known to use chan1. The devicetree properties are already prefixed with chan0 as preparation for chan1 support in the future.

This has been tested on an olimex a10s-olinuxino-micro, a13-olinuxino, and a20-olinuxino-micro.

---
 .../devicetree/bindings/input/sun4i-lradc-keys.txt |  22 ++
 drivers/input/keyboard/Kconfig                     |  10 +
 drivers/input/keyboard/Makefile                    |   1 +
 drivers/input/keyboard/sun4i-lradc-keys.c          | 243 +++++++++++++++++++++
 4 files changed, 276 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/sun4i-lradc-keys.txt
 create mode 100644 drivers/input/keyboard/sun4i-lradc-keys.c
Documentation/devicetree/bindings/input/sun4i-lradc-keys.txt new file +22 -0
new file mode 100644
index 0000000..7801264
@@ -0,0 +1,22 @@
+Allwinner sun4i low res adc attached tablet keys
+------------------------------------------------
+
+Required properties:
+ - compatible: "allwinner,sun4i-lradc-keys"
+ - reg: mmio address range of the chip
+ - interrupts: interrupt to which the chip is connected
+ - allwinner,chan0-step: step in mV between keys must be 150 or 200
+ - linux,chan0-keycodes: array of dt-bindings/input/input.h KEY_ codes
+
+Example:
+
+#include <dt-bindings/input/input.h>
+
+	lradc: lradc at 01c22800 {
+		compatible = "allwinner,sun4i-lradc-keys";
+		reg = <0x01c22800 0x100>;
+		interrupts = <31>;
+		allwinner,chan0-step = <200>;
+		linux,chan0-keycodes = <KEY_VOLUMEUP KEY_VOLUMEDOWN
+					KEY_MENU KEY_ENTER KEY_HOME>;
+	};
drivers/input/keyboard/Kconfig +10 -0
index bb174c1..d95e6e4 100644
@@ -544,6 +544,16 @@ config KEYBOARD_STMPE
 	  To compile this driver as a module, choose M here: the module will be
 	  called stmpe-keypad.
 
+config KEYBOARD_SUN4I_LRADC
+	tristate "Allwinner sun4i low res adc attached tablet keys support"
+	depends on ARCH_SUNXI
+	help
+	  This selects support for the Allwinner low res adc attached tablet
+	  keys found on Allwinner sunxi SoCs.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called sun4i-lradc-keys.
+
 config KEYBOARD_DAVINCI
 	tristate "TI DaVinci Key Scan"
 	depends on ARCH_DAVINCI_DM365
drivers/input/keyboard/Makefile +1 -0
index a699b61..f3265bd 100644
@@ -50,6 +50,7 @@ obj-$(CONFIG_KEYBOARD_SH_KEYSC)		+= sh_keysc.o
 obj-$(CONFIG_KEYBOARD_SPEAR)		+= spear-keyboard.o
 obj-$(CONFIG_KEYBOARD_STMPE)		+= stmpe-keypad.o
 obj-$(CONFIG_KEYBOARD_STOWAWAY)		+= stowaway.o
+obj-$(CONFIG_KEYBOARD_SUN4I_LRADC)	+= sun4i-lradc-keys.o
 obj-$(CONFIG_KEYBOARD_SUNKBD)		+= sunkbd.o
 obj-$(CONFIG_KEYBOARD_TC3589X)		+= tc3589x-keypad.o
 obj-$(CONFIG_KEYBOARD_TEGRA)		+= tegra-kbc.o
drivers/input/keyboard/sun4i-lradc-keys.c new file +243 -0

243 lines not on this page · raw message

Signature · 1 line
1.8.4.2
#2 lore raw

PATCH v2 2/4 ARM: dts: sun4i: Add lradc node

In reply to Hans de Goede
---
 arch/arm/boot/dts/sun4i-a10.dtsi | 7 +++++++
 1 file changed, 7 insertions(+)
arch/arm/boot/dts/sun4i-a10.dtsi +7 -0
index 502f3e2..88f119a 100644
@@ -447,6 +447,13 @@
 			interrupts = <24>;
 		};
 
+		lradc: lradc at 01c22800 {
+			compatible = "allwinner,sun4i-lradc-keys";
+			reg = <0x01c22800 0x100>;
+			interrupts = <31>;
+			status = "disabled";
+		};
+
 		sid: eeprom at 01c23800 {
 			compatible = "allwinner,sun4i-sid";
 			reg = <0x01c23800 0x10>;
Signature · 1 line
1.8.4.2
#3 lore raw

PATCH v2 3/4 ARM: dts: sun5i: Add lradc node

In reply to Hans de Goede
---
 arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts | 8 ++++++++
 arch/arm/boot/dts/sun5i-a10s.dtsi                | 7 +++++++
 arch/arm/boot/dts/sun5i-a13-olinuxino.dts        | 8 ++++++++
 arch/arm/boot/dts/sun5i-a13.dtsi                 | 7 +++++++
 4 files changed, 30 insertions(+)
arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts +8 -0
index e53fb12..d93318a 100644
@@ -13,6 +13,7 @@
 
 /dts-v1/;
 /include/ "sun5i-a10s.dtsi"
+#include <dt-bindings/input/input.h>
 
 / {
 	model = "Olimex A10s-Olinuxino Micro";
@@ -75,6 +76,13 @@
 			};
 		};
 
+		lradc: lradc at 01c22800 {
+			allwinner,chan0-step = <200>;
+			linux,chan0-keycodes = <KEY_VOLUMEUP KEY_VOLUMEDOWN
+						KEY_MENU KEY_ENTER KEY_HOME>;
+			status = "okay";
+		};
+
 		uart0: serial at 01c28000 {
 			pinctrl-names = "default";
 			pinctrl-0 = <&uart0_pins_a>;
arch/arm/boot/dts/sun5i-a10s.dtsi +7 -0
index 34dd303..8775bad 100644
@@ -404,6 +404,13 @@
 			reg = <0x01c20c90 0x10>;
 		};
 
+		lradc: lradc at 01c22800 {
+			compatible = "allwinner,sun4i-lradc-keys";
+			reg = <0x01c22800 0x100>;
+			interrupts = <31>;
+			status = "disabled";
+		};
+
 		sid: eeprom at 01c23800 {
 			compatible = "allwinner,sun4i-sid";
 			reg = <0x01c23800 0x10>;
arch/arm/boot/dts/sun5i-a13-olinuxino.dts +8 -0
index ab566f7..4e99f43 100644
@@ -13,6 +13,7 @@
 
 /dts-v1/;
 /include/ "sun5i-a13.dtsi"
+#include <dt-bindings/input/input.h>
 
 / {
 	model = "Olimex A13-Olinuxino";
@@ -55,6 +56,13 @@
 			};
 		};
 
+		lradc: lradc at 01c22800 {
+			allwinner,chan0-step = <200>;
+			linux,chan0-keycodes = <KEY_VOLUMEUP KEY_VOLUMEDOWN
+						KEY_MENU KEY_ENTER KEY_HOME>;
+			status = "okay";
+		};
+
 		uart1: serial at 01c28400 {
 			pinctrl-names = "default";
 			pinctrl-0 = <&uart1_pins_b>;
arch/arm/boot/dts/sun5i-a13.dtsi +7 -0
index 264cfa4..90c1ed3 100644
@@ -362,6 +362,13 @@
 			reg = <0x01c20c90 0x10>;
 		};
 
+		lradc: lradc at 01c22800 {
+			compatible = "allwinner,sun4i-lradc-keys";
+			reg = <0x01c22800 0x100>;
+			interrupts = <31>;
+			status = "disabled";
+		};
+
 		sid: eeprom at 01c23800 {
 			compatible = "allwinner,sun4i-sid";
 			reg = <0x01c23800 0x10>;
Signature · 1 line
1.8.4.2
#4 lore raw

PATCH v2 4/4 ARM: dts: sun7i: Add lradc node

In reply to Hans de Goede
---
 arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts | 9 +++++++++
 arch/arm/boot/dts/sun7i-a20.dtsi                | 7 +++++++
 2 files changed, 16 insertions(+)
arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts +9 -0
index 0ee2641..2c9a38f 100644
@@ -13,6 +13,7 @@
 
 /dts-v1/;
 /include/ "sun7i-a20.dtsi"
+#include <dt-bindings/input/input.h>
 
 / {
 	model = "Olimex A20-Olinuxino Micro";
@@ -86,6 +87,14 @@
 			};
 		};
 
+		lradc: lradc at 01c22800 {
+			allwinner,chan0-step = <200>;
+			linux,chan0-keycodes = <KEY_VOLUMEUP KEY_VOLUMEDOWN
+						KEY_MENU KEY_SEARCH KEY_HOME
+						KEY_ESC KEY_ENTER>;
+			status = "okay";
+		};
+
 		uart0: serial at 01c28000 {
 			pinctrl-names = "default";
 			pinctrl-0 = <&uart0_pins_a>;
arch/arm/boot/dts/sun7i-a20.dtsi +7 -0
index 68e825a..3484275 100644
@@ -531,6 +531,13 @@
 			interrupts = <0 24 1>;
 		};
 
+		lradc: lradc at 01c22800 {
+			compatible = "allwinner,sun4i-lradc-keys";
+			reg = <0x01c22800 0x100>;
+			interrupts = <0 31 4>;
+			status = "disabled";
+		};
+
 		sid: eeprom at 01c23800 {
 			compatible = "allwinner,sun7i-a20-sid";
 			reg = <0x01c23800 0x200>;
Signature · 1 line
1.8.4.2
#5 lore raw

v2 cover input: Add new sun4i-lradc-keys driver

In reply to Hans de Goede

Hi Hans,

It seems this series didn't get any attention. Care to respin on top of the latest tree?

FYI, I have the series rebased on top of sunxi-next:
https://github.com/wens/linux/commits/others/sunxi-lradc-input-v2

ChenYu

Quoted 15 lines · Hans de Goede

Hi Dimitri et al,

Here is v2 of the sun4i-lradc-keys driver, changes since v1:

- Use include/dt-bindings/input/input.h
- Rename the keycodes property to linux,chan0-keycodes

Regards,

Hans

--
You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe at googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.

#6 lore raw

v2 cover input: Add new sun4i-lradc-keys driver

Hi,

Quoted 7 lines · Chen-Yu Tsai

Hi Hans,

It seems this series didn't get any attention. Care to respin on top of the latest tree?

FYI, I have the series rebased on top of sunxi-next:
https://github.com/wens/linux/commits/others/sunxi-lradc-input-v2

The problem is not it not getting attention, the problem is people were unhappy with the dt-bindings for this. I've a pretty good idea of how to fix up the bindings, but -ENOTIME so far. If you've a board you can test this on and want to take a shot at fixing it up, I can get into a little bit more detail.

Regards,

Hans