[linux-sunxi] Re: [PATCH v2 1/4] input: Add new sun4i-lradc-keys driver

2014-10-22 Thread Hans de Goede
Hi,

On 10/21/2014 07:04 PM, Maxime Ripard wrote:
 Hi Hans,
 
 Thanks, a lot for respinning this.
 
 On Tue, Oct 21, 2014 at 10:24:47AM +0200, Hans de Goede wrote:
 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 hdego...@redhat.com
 --
 Changes in v2:
 -Change devicetree bindings to use a per key subnode, like gpio-keys does
 ---
  .../devicetree/bindings/input/sun4i-lradc-keys.txt |  57 +
  MAINTAINERS|   7 +
  drivers/input/keyboard/Kconfig |  10 +
  drivers/input/keyboard/Makefile|   1 +
  drivers/input/keyboard/sun4i-lradc-keys.c  | 259 
 +
  5 files changed, 334 insertions(+)
  create mode 100644 
 Documentation/devicetree/bindings/input/sun4i-lradc-keys.txt
  create mode 100644 drivers/input/keyboard/sun4i-lradc-keys.c

 diff --git a/Documentation/devicetree/bindings/input/sun4i-lradc-keys.txt 
 b/Documentation/devicetree/bindings/input/sun4i-lradc-keys.txt
 new file mode 100644
 index 000..36a141b
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/input/sun4i-lradc-keys.txt
 @@ -0,0 +1,57 @@
 +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
 + - vref-supply: powersupply for the lradc reference voltage
 +
 +Each key is represented as a sub-node of allwinner,sun4i-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@01c22800 {
 +compatible = allwinner,sun4i-lradc-keys;
 
 You're still using the old pattern for the compatible here, it should
 be allwinner,sun4i-a10-lradc-keys.

Will fix for the next version.

 
 +reg = 0x01c22800 0x100;
 +interrupts = 31;
 +vref-supply = reg_vcc3v0;
 +button@19 {
 
 I guess the node address in centivolts aren't really that common,
 maybe in mV instead?

Ack for using mV, will fix for the next version.

 
 +label = Volume Up;
 +linux,code = KEY_VOLUMEUP;
 +channel = 0;
 +voltage = 191274;
 +};
 
 And a newline between the nodes please.

Will fix for the next version.

 +button@39 {
 +label = Volume Down;
 +linux,code = KEY_VOLUMEDOWN;
 +channel = 0;
 +voltage = 392644;
 +};
 +button@60 {
 +label = Menu;
 +linux,code = KEY_MENU;
 +channel = 0;
 +voltage = 601151;
 +};
 +button@80 {
 +label = Enter;
 +linux,code = KEY_ENTER;
 +channel = 0;
 +voltage = 795090;
 +};
 +button@98 {
 +label = Home;
 +linux,code = KEY_HOME;
 +channel = 0;
 +voltage = 987387;
 +};
 +};
 diff --git a/MAINTAINERS b/MAINTAINERS
 index a20df9b..73d1aef 100644
 --- a/MAINTAINERS
 +++ b/MAINTAINERS
 @@ -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 hdego...@redhat.com
 +L:  linux-in...@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 k...@linux-powerpc.org
  L:  net...@vger.kernel.org
 diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
 index a3958c6..2d11b44 100644
 --- a/drivers/input/keyboard/Kconfig
 +++ b/drivers/input/keyboard/Kconfig
 @@ -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 

[linux-sunxi] Re: [PATCH v2 1/4] input: Add new sun4i-lradc-keys driver

2014-10-21 Thread Maxime Ripard
Hi Hans,

Thanks, a lot for respinning this.

On Tue, Oct 21, 2014 at 10:24:47AM +0200, Hans de Goede wrote:
 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 hdego...@redhat.com
 --
 Changes in v2:
 -Change devicetree bindings to use a per key subnode, like gpio-keys does
 ---
  .../devicetree/bindings/input/sun4i-lradc-keys.txt |  57 +
  MAINTAINERS|   7 +
  drivers/input/keyboard/Kconfig |  10 +
  drivers/input/keyboard/Makefile|   1 +
  drivers/input/keyboard/sun4i-lradc-keys.c  | 259 
 +
  5 files changed, 334 insertions(+)
  create mode 100644 
 Documentation/devicetree/bindings/input/sun4i-lradc-keys.txt
  create mode 100644 drivers/input/keyboard/sun4i-lradc-keys.c
 
 diff --git a/Documentation/devicetree/bindings/input/sun4i-lradc-keys.txt 
 b/Documentation/devicetree/bindings/input/sun4i-lradc-keys.txt
 new file mode 100644
 index 000..36a141b
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/input/sun4i-lradc-keys.txt
 @@ -0,0 +1,57 @@
 +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
 + - vref-supply: powersupply for the lradc reference voltage
 +
 +Each key is represented as a sub-node of allwinner,sun4i-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@01c22800 {
 + compatible = allwinner,sun4i-lradc-keys;

You're still using the old pattern for the compatible here, it should
be allwinner,sun4i-a10-lradc-keys.

 + reg = 0x01c22800 0x100;
 + interrupts = 31;
 + vref-supply = reg_vcc3v0;
 + button@19 {

I guess the node address in centivolts aren't really that common,
maybe in mV instead?

 + label = Volume Up;
 + linux,code = KEY_VOLUMEUP;
 + channel = 0;
 + voltage = 191274;
 + };

And a newline between the nodes please.

 + button@39 {
 + label = Volume Down;
 + linux,code = KEY_VOLUMEDOWN;
 + channel = 0;
 + voltage = 392644;
 + };
 + button@60 {
 + label = Menu;
 + linux,code = KEY_MENU;
 + channel = 0;
 + voltage = 601151;
 + };
 + button@80 {
 + label = Enter;
 + linux,code = KEY_ENTER;
 + channel = 0;
 + voltage = 795090;
 + };
 + button@98 {
 + label = Home;
 + linux,code = KEY_HOME;
 + channel = 0;
 + voltage = 987387;
 + };
 + };
 diff --git a/MAINTAINERS b/MAINTAINERS
 index a20df9b..73d1aef 100644
 --- a/MAINTAINERS
 +++ b/MAINTAINERS
 @@ -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 hdego...@redhat.com
 +L:   linux-in...@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 k...@linux-powerpc.org
  L:   net...@vger.kernel.org
 diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
 index a3958c6..2d11b44 100644
 --- a/drivers/input/keyboard/Kconfig
 +++ b/drivers/input/keyboard/Kconfig
 @@ -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
 +