input: Add new sun4i-lradc-keys driver
Subsystems (5)
v3 cover input: Add new sun4i-lradc-keys driver
Hi All,
Here is v3 of my patchset for the lradc attached tablet keys found one some Allwinner boards.
Changes since v2:
-s/KEY_HOME/KEY_HOMEPAGE/ -s/sun4i-lradc-keys/sun4i-a10-lradc-keys/
-Use mV as address for the key subnodes in devicetree
-dts formatting fixes according to Maxime's review
-Do not set .owner field, as module_platform_driver already does that
Changes since previous postings a long time ago:
-device tree description now has one subnode per key just like gpio-keys
I hope this version is to everyones liking and can be merged soon :) The intend is for the actual driver to go upstream through Dmitry's tree, where as the 3 dts patches should go upstream through Maxime's tree.
Thanks & Regards,
Hans
PATCH v3 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.
This has been tested on an olimex a10s-olinuxino-micro, a13-olinuxino, and a20-olinuxino-micro.
--
Changes in v2:
-Change devicetree bindings to use a per key subnode, like gpio-keys does
--- .../devicetree/bindings/input/sun4i-lradc-keys.txt | 62 +++++ MAINTAINERS | 7 + drivers/input/keyboard/Kconfig | 10 + drivers/input/keyboard/Makefile | 1 + drivers/input/keyboard/sun4i-lradc-keys.c | 258 +++++++++++++++++++++ 5 files changed, 338 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 +62 -0
@@ -0,0 +1,62 @@ +Allwinner sun4i low res adc attached tablet keys +------------------------------------------------ + +Required properties: + - compatible: "allwinner,sun4i-a10-lradc-keys" + - reg: mmio address range of the chip + - interrupts: interrupt to which the chip is connected + - vref-supply: powersupply for the lradc reference voltage + +Each key is represented as a sub-node of "allwinner,sun4i-a10-lradc-keys": + +Required subnode-properties: + - label: Descriptive name of the key. + - linux,code: Keycode to emit. + - channel: Channel this key is attached to, mut be 0 or 1. + - voltage: Voltage in ?V at lradc input when this key is pressed. + +Example: + +#include <dt-bindings/input/input.h> + + lradc: lradc at 01c22800 { + compatible = "allwinner,sun4i-a10-lradc-keys"; + reg = <0x01c22800 0x100>; + interrupts = <31>; + vref-supply = <®_vcc3v0>; + + button at 191 { + label = "Volume Up"; + linux,code = <KEY_VOLUMEUP>; + channel = <0>; + voltage = <191274>; + }; + + button at 392 { + label = "Volume Down"; + linux,code = <KEY_VOLUMEDOWN>; + channel = <0>; + voltage = <392644>; + }; + + button at 601 { + label = "Menu"; + linux,code = <KEY_MENU>; + channel = <0>; + voltage = <601151>; + }; + + button at 795 { + label = "Enter"; + linux,code = <KEY_ENTER>; + channel = <0>; + voltage = <795090>; + }; + + button at 987 { + label = "Home"; + linux,code = <KEY_HOMEPAGE>; + channel = <0>; + voltage = <987387>; + }; + };
MAINTAINERS +7 -0
@@ -8932,6 +8932,13 @@ F: arch/m68k/sun3*/ F: arch/m68k/include/asm/sun3* F: drivers/net/ethernet/i825xx/sun3* +SUN4I LOW RES ADC ATTACHED TABLET KEYS DRIVER +M: Hans de Goede <[email protected]> +L: linux-input at vger.kernel.org +S: Maintained +F: Documentation/devicetree/bindings/input/sun4i-lradc-keys.txt +F: drivers/input/keyboard/sun4i-lradc-keys.c + SUNDANCE NETWORK DRIVER M: Denis Kirjanov <[email protected]> L: netdev at vger.kernel.org
drivers/input/keyboard/Kconfig +10 -0
@@ -567,6 +567,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
@@ -53,6 +53,7 @@ obj-$(CONFIG_KEYBOARD_SPEAR) += spear-keyboard.o obj-$(CONFIG_KEYBOARD_STMPE) += stmpe-keypad.o obj-$(CONFIG_KEYBOARD_STOWAWAY) += stowaway.o obj-$(CONFIG_KEYBOARD_ST_KEYSCAN) += st-keyscan.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 +258 -0
258 lines not on this page · raw message
Signature · 1 line
2.1.0
PATCH v3 1/4 input: Add new sun4i-lradc-keys driver
Hi Hans,
Quoted 11 lines · Hans de Goede
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.
This has been tested on an olimex a10s-olinuxino-micro, a13-olinuxino, and a20-olinuxino-micro.
Signed-off-by Hans de Goede <[email protected]>
Thanks!
Maxime
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141022/7c020a22/attachment.sig>
PATCH v3 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
@@ -669,6 +669,13 @@ status = "disabled"; }; + lradc: lradc at 01c22800 { + compatible = "allwinner,sun4i-a10-lradc-keys"; + reg = <0x01c22800 0x100>; + interrupts = <31>; + status = "disabled"; + }; + sid: eeprom at 01c23800 { compatible = "allwinner,sun4i-a10-sid"; reg = <0x01c23800 0x10>;
Signature · 1 line
2.1.0
PATCH v3 3/4 ARM: dts: sun5i: Add lradc node
In reply to Hans de Goede--- arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts | 45 ++++++++++++++++++++++-- arch/arm/boot/dts/sun5i-a10s.dtsi | 7 ++++ arch/arm/boot/dts/sun5i-a13-olinuxino.dts | 45 ++++++++++++++++++++++-- arch/arm/boot/dts/sun5i-a13.dtsi | 7 ++++ 4 files changed, 100 insertions(+), 4 deletions(-)
arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts +43 -2
@@ -12,8 +12,9 @@ */ /dts-v1/; -/include/ "sun5i-a10s.dtsi" -/include/ "sunxi-common-regulators.dtsi" +#include "sun5i-a10s.dtsi" +#include "sunxi-common-regulators.dtsi" +#include <dt-bindings/input/input.h> / { model = "Olimex A10s-Olinuxino Micro";
@@ -98,6 +99,46 @@ }; }; + lradc: lradc at 01c22800 { + vref-supply = <®_vcc3v0>; + status = "okay"; + + button at 191 { + label = "Volume Up"; + linux,code = <KEY_VOLUMEUP>; + channel = <0>; + voltage = <191274>; + }; + + button at 392 { + label = "Volume Down"; + linux,code = <KEY_VOLUMEDOWN>; + channel = <0>; + voltage = <392644>; + }; + + button at 601 { + label = "Menu"; + linux,code = <KEY_MENU>; + channel = <0>; + voltage = <601151>; + }; + + button at 795 { + label = "Enter"; + linux,code = <KEY_ENTER>; + channel = <0>; + voltage = <795090>; + }; + + button at 987 { + label = "Home"; + linux,code = <KEY_HOMEPAGE>; + channel = <0>; + voltage = <987387>; + }; + }; + uart0: serial at 01c28000 { pinctrl-names = "default"; pinctrl-0 = <&uart0_pins_a>;
arch/arm/boot/dts/sun5i-a10s.dtsi +7 -0
@@ -520,6 +520,13 @@ reg = <0x01c20c90 0x10>; }; + lradc: lradc at 01c22800 { + compatible = "allwinner,sun4i-a10-lradc-keys"; + reg = <0x01c22800 0x100>; + interrupts = <31>; + status = "disabled"; + }; + sid: eeprom at 01c23800 { compatible = "allwinner,sun4i-a10-sid"; reg = <0x01c23800 0x10>;
arch/arm/boot/dts/sun5i-a13-olinuxino.dts +43 -2
57 lines not on this page · raw message
arch/arm/boot/dts/sun5i-a13.dtsi +7 -0
@@ -468,6 +468,13 @@ reg = <0x01c20c90 0x10>; }; + lradc: lradc at 01c22800 { + compatible = "allwinner,sun4i-a10-lradc-keys"; + reg = <0x01c22800 0x100>; + interrupts = <31>; + status = "disabled"; + }; + sid: eeprom at 01c23800 { compatible = "allwinner,sun4i-a10-sid"; reg = <0x01c23800 0x10>;
Signature · 1 line
2.1.0
PATCH v3 4/4 ARM: dts: sun7i: Add lradc node
In reply to Hans de Goede--- arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts | 59 ++++++++++++++++++++++++- arch/arm/boot/dts/sun7i-a20.dtsi | 7 +++ 2 files changed, 64 insertions(+), 2 deletions(-)
arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts +57 -2
@@ -12,8 +12,9 @@ */ /dts-v1/; -/include/ "sun7i-a20.dtsi" -/include/ "sunxi-common-regulators.dtsi" +#include "sun7i-a20.dtsi" +#include "sunxi-common-regulators.dtsi" +#include <dt-bindings/input/input.h> / { model = "Olimex A20-Olinuxino Micro";
@@ -100,6 +101,60 @@ }; }; + lradc: lradc at 01c22800 { + vref-supply = <®_vcc3v0>; + status = "okay"; + + button at 191 { + label = "Volume Up"; + linux,code = <KEY_VOLUMEUP>; + channel = <0>; + voltage = <191274>; + }; + + button at 392 { + label = "Volume Down"; + linux,code = <KEY_VOLUMEDOWN>; + channel = <0>; + voltage = <392644>; + }; + + button at 601 { + label = "Menu"; + linux,code = <KEY_MENU>; + channel = <0>; + voltage = <601151>; + }; + + button at 795 { + label = "Search"; + linux,code = <KEY_SEARCH>; + channel = <0>; + voltage = <795090>; + }; + + button at 987 { + label = "Home"; + linux,code = <KEY_HOMEPAGE>; + channel = <0>; + voltage = <987387>; + }; + + button at 1184 { + label = "Esc"; + linux,code = <KEY_ESC>; + channel = <0>; + voltage = <1184678>; + }; + + button at 1398 { + label = "Enter"; + linux,code = <KEY_ENTER>; + channel = <0>; + voltage = <1398804>; + }; + }; + uart0: serial at 01c28000 { pinctrl-names = "default"; pinctrl-0 = <&uart0_pins_a>;
arch/arm/boot/dts/sun7i-a20.dtsi +7 -0
@@ -911,6 +911,13 @@ status = "disabled"; }; + lradc: lradc at 01c22800 { + compatible = "allwinner,sun4i-a10-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
2.1.0