* [PATCH v2 0/4] input: Add new sun4i-lradc-keys driver @ 2014-10-21 8:24 ` Hans de Goede 0 siblings, 0 replies; 28+ messages in thread From: Hans de Goede @ 2014-10-21 8:24 UTC (permalink / raw) To: Dmitry Torokhov Cc: Maxime Ripard, linux-input-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw Hi All, After a bit of a pause due to -ENOTIME, here is my 2nd attempt at getting support for the lradc attached tablet keys found one some Allwinner boards upstream. I've dubbed this v2 even though there has been more then one version before because I've lost count, and as said this represents the 2nd attempt at getting this upstream. The major change from the previous attempt is that now the devicetree description has one subnode per key just like gpio-keys has. 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 ^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH v2 0/4] input: Add new sun4i-lradc-keys driver @ 2014-10-21 8:24 ` Hans de Goede 0 siblings, 0 replies; 28+ messages in thread From: Hans de Goede @ 2014-10-21 8:24 UTC (permalink / raw) To: linux-arm-kernel Hi All, After a bit of a pause due to -ENOTIME, here is my 2nd attempt at getting support for the lradc attached tablet keys found one some Allwinner boards upstream. I've dubbed this v2 even though there has been more then one version before because I've lost count, and as said this represents the 2nd attempt at getting this upstream. The major change from the previous attempt is that now the devicetree description has one subnode per key just like gpio-keys has. 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 ^ permalink raw reply [flat|nested] 28+ messages in thread
[parent not found: <1413879890-7254-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>]
* [PATCH v2 1/4] input: Add new sun4i-lradc-keys driver 2014-10-21 8:24 ` Hans de Goede @ 2014-10-21 8:24 ` Hans de Goede -1 siblings, 0 replies; 28+ messages in thread From: Hans de Goede @ 2014-10-21 8:24 UTC (permalink / raw) To: Dmitry Torokhov Cc: Maxime Ripard, linux-input-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, 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 <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> -- 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 0000000..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"; + reg = <0x01c22800 0x100>; + interrupts = <31>; + vref-supply = <®_vcc3v0>; + button@19 { + label = "Volume Up"; + linux,code = <KEY_VOLUMEUP>; + channel = <0>; + voltage = <191274>; + }; + 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 <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> +L: linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.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 <kda-u1c8ncikuMvVAZt0uhVF+Ni2O/JbrIOy@public.gmane.org> L: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.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 + module will be called sun4i-lradc-keys. + config KEYBOARD_DAVINCI tristate "TI DaVinci Key Scan" depends on ARCH_DAVINCI_DM365 diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile index 0a33456..a35269a 100644 --- a/drivers/input/keyboard/Makefile +++ b/drivers/input/keyboard/Makefile @@ -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 diff --git a/drivers/input/keyboard/sun4i-lradc-keys.c b/drivers/input/keyboard/sun4i-lradc-keys.c new file mode 100644 index 0000000..63a1aff --- /dev/null +++ b/drivers/input/keyboard/sun4i-lradc-keys.c @@ -0,0 +1,259 @@ +/* + * Allwinner sun4i low res adc attached tablet keys driver + * + * Copyright (C) 2014 Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +/* + * Allwinnner sunxi SoCs have a lradc which is specifically designed to have + * various (tablet) keys (ie home, back, search, etc). attached to it using + * a resistor network. This driver is for the keys on such boards. + * + * There are 2 channels, currently this driver only supports channel 0 since + * there are no boards known to use channel 1. + */ + +#include <linux/err.h> +#include <linux/init.h> +#include <linux/input.h> +#include <linux/interrupt.h> +#include <linux/io.h> +#include <linux/module.h> +#include <linux/of_platform.h> +#include <linux/platform_device.h> +#include <linux/regulator/consumer.h> +#include <linux/slab.h> + +#define LRADC_CTRL 0x00 +#define LRADC_INTC 0x04 +#define LRADC_INTS 0x08 +#define LRADC_DATA0 0x0c +#define LRADC_DATA1 0x10 + +/* LRADC_CTRL bits */ +#define FIRST_CONVERT_DLY(x) ((x) << 24) /* 8 bits */ +#define CHAN_SELECT(x) ((x) << 22) /* 2 bits */ +#define CONTINUE_TIME_SEL(x) ((x) << 16) /* 4 bits */ +#define KEY_MODE_SEL(x) ((x) << 12) /* 2 bits */ +#define LEVELA_B_CNT(x) ((x) << 8) /* 4 bits */ +#define HOLD_EN(x) ((x) << 6) +#define LEVELB_VOL(x) ((x) << 4) /* 2 bits */ +#define SAMPLE_RATE(x) ((x) << 2) /* 2 bits */ +#define ENABLE(x) ((x) << 0) + +/* LRADC_INTC and LRADC_INTS bits */ +#define CHAN1_KEYUP_IRQ BIT(12) +#define CHAN1_ALRDY_HOLD_IRQ BIT(11) +#define CHAN1_HOLD_IRQ BIT(10) +#define CHAN1_KEYDOWN_IRQ BIT(9) +#define CHAN1_DATA_IRQ BIT(8) +#define CHAN0_KEYUP_IRQ BIT(4) +#define CHAN0_ALRDY_HOLD_IRQ BIT(3) +#define CHAN0_HOLD_IRQ BIT(2) +#define CHAN0_KEYDOWN_IRQ BIT(1) +#define CHAN0_DATA_IRQ BIT(0) + +struct sun4i_lradc_keymap { + u32 voltage; + u32 keycode; +}; + +struct sun4i_lradc_data { + struct device *dev; + struct input_dev *input; + void __iomem *base; + struct regulator *vref_supply; + struct sun4i_lradc_keymap *chan0_map; + u32 chan0_map_count; + u32 chan0_keycode; + u32 vref; +}; + +static irqreturn_t sun4i_lradc_irq(int irq, void *dev_id) +{ + struct sun4i_lradc_data *lradc = dev_id; + u32 i, ints, val, voltage, diff, keycode = 0, closest = 0xffffffff; + + ints = readl(lradc->base + LRADC_INTS); + + /* + * lradc supports only one keypress at a time, release does not give + * any info as to which key was released, so we cache the keycode. + */ + if ((ints & CHAN0_KEYDOWN_IRQ) && lradc->chan0_keycode == 0) { + val = readl(lradc->base + LRADC_DATA0) & 0x3f; + voltage = val * lradc->vref / 63; + + for (i = 0; i < lradc->chan0_map_count; i++) { + diff = abs(lradc->chan0_map[i].voltage - voltage); + if (diff < closest) { + closest = diff; + keycode = lradc->chan0_map[i].keycode; + } + } + + lradc->chan0_keycode = keycode; + input_report_key(lradc->input, lradc->chan0_keycode, 1); + } + + if (ints & CHAN0_KEYUP_IRQ) { + input_report_key(lradc->input, lradc->chan0_keycode, 0); + lradc->chan0_keycode = 0; + } + + input_sync(lradc->input); + + writel(ints, lradc->base + LRADC_INTS); + + return IRQ_HANDLED; +} + +static int sun4i_lradc_open(struct input_dev *dev) +{ + struct sun4i_lradc_data *lradc = input_get_drvdata(dev); + int ret; + + ret = regulator_enable(lradc->vref_supply); + if (ret) + return ret; + + /* lradc Vref internally is divided by 2/3 */ + lradc->vref = regulator_get_voltage(lradc->vref_supply) * 2 / 3; + + /* + * Set sample time to 4 ms / 250 Hz. Wait 2 * 4 ms for key to + * stabilize on press, wait (1 + 1) * 4 ms for key release + */ + writel(FIRST_CONVERT_DLY(2) | LEVELA_B_CNT(1) | HOLD_EN(1) | + SAMPLE_RATE(0) | ENABLE(1), lradc->base + LRADC_CTRL); + + writel(CHAN0_KEYUP_IRQ | CHAN0_KEYDOWN_IRQ, lradc->base + LRADC_INTC); + + return 0; +} + +static void sun4i_lradc_close(struct input_dev *dev) +{ + struct sun4i_lradc_data *lradc = input_get_drvdata(dev); + + /* Disable lradc, leave other settings unchanged */ + writel(FIRST_CONVERT_DLY(2) | LEVELA_B_CNT(1) | HOLD_EN(1) | + SAMPLE_RATE(2), lradc->base + LRADC_CTRL); + writel(0, lradc->base + LRADC_INTC); + + regulator_disable(lradc->vref_supply); +} + +static int sun4i_lradc_probe(struct platform_device *pdev) +{ + struct sun4i_lradc_data *lradc; + struct device *dev = &pdev->dev; + struct device_node *pp, *np = dev->of_node; + u32 channel; + int i, ret; + + lradc = devm_kzalloc(dev, sizeof(struct sun4i_lradc_data), GFP_KERNEL); + if (!lradc) + return -ENOMEM; + + lradc->chan0_map_count = of_get_child_count(np); + lradc->chan0_map = devm_kmalloc(dev, lradc->chan0_map_count * + sizeof(struct sun4i_lradc_keymap), GFP_KERNEL); + if (!lradc->chan0_map) + return -ENOMEM; + + i = 0; + for_each_child_of_node(np, pp) { + struct sun4i_lradc_keymap *map = &lradc->chan0_map[i]; + + ret = of_property_read_u32(pp, "channel", &channel); + if (ret || channel != 0) { + dev_err(dev, "%s: Inval channel prop\n", pp->name); + return -EINVAL; + } + + ret = of_property_read_u32(pp, "voltage", &map->voltage); + if (ret) { + dev_err(dev, "%s: Inval voltage prop\n", pp->name); + return -EINVAL; + } + + ret = of_property_read_u32(pp, "linux,code", &map->keycode); + if (ret) { + dev_err(dev, "%s: Inval linux,code prop\n", pp->name); + return -EINVAL; + } + + i++; + } + + lradc->vref_supply = devm_regulator_get(dev, "vref"); + if (IS_ERR(lradc->vref_supply)) + return PTR_ERR(lradc->vref_supply); + + lradc->dev = dev; + lradc->input = devm_input_allocate_device(dev); + if (!lradc->input) + return -ENOMEM; + + lradc->input->name = pdev->name; + lradc->input->phys = "sun4i_lradc/input0"; + lradc->input->open = sun4i_lradc_open; + lradc->input->close = sun4i_lradc_close; + lradc->input->id.bustype = BUS_HOST; + lradc->input->id.vendor = 0x0001; + lradc->input->id.product = 0x0001; + lradc->input->id.version = 0x0100; + lradc->input->evbit[0] = BIT(EV_SYN) | BIT(EV_KEY); + for (i = 0; i < lradc->chan0_map_count; i++) + set_bit(lradc->chan0_map[i].keycode, lradc->input->keybit); + input_set_drvdata(lradc->input, lradc); + + lradc->base = devm_ioremap_resource(dev, + platform_get_resource(pdev, IORESOURCE_MEM, 0)); + if (IS_ERR(lradc->base)) + return PTR_ERR(lradc->base); + + ret = devm_request_irq(dev, platform_get_irq(pdev, 0), sun4i_lradc_irq, + 0, "sun4i-lradc-keys", lradc); + if (ret) + return ret; + + ret = input_register_device(lradc->input); + if (ret) + return ret; + + platform_set_drvdata(pdev, lradc); + return 0; +} + +static const struct of_device_id sun4i_lradc_of_match[] = { + { .compatible = "allwinner,sun4i-lradc-keys", }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, sun4i_lradc_of_match); + +static struct platform_driver sun4i_lradc_driver = { + .driver = { + .owner = THIS_MODULE, + .name = "sun4i-lradc-keys", + .of_match_table = of_match_ptr(sun4i_lradc_of_match), + }, + .probe = sun4i_lradc_probe, +}; + +module_platform_driver(sun4i_lradc_driver); + +MODULE_DESCRIPTION("Allwinner sun4i low res adc attached tablet keys driver"); +MODULE_AUTHOR("Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>"); +MODULE_LICENSE("GPL"); -- 2.1.0 -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/d/optout. ^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH v2 1/4] input: Add new sun4i-lradc-keys driver @ 2014-10-21 8:24 ` Hans de Goede 0 siblings, 0 replies; 28+ messages in thread From: Hans de Goede @ 2014-10-21 8:24 UTC (permalink / raw) To: linux-arm-kernel 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 <hdegoede@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 0000000..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 at 01c22800 { + compatible = "allwinner,sun4i-lradc-keys"; + reg = <0x01c22800 0x100>; + interrupts = <31>; + vref-supply = <®_vcc3v0>; + button at 19 { + label = "Volume Up"; + linux,code = <KEY_VOLUMEUP>; + channel = <0>; + voltage = <191274>; + }; + button at 39 { + label = "Volume Down"; + linux,code = <KEY_VOLUMEDOWN>; + channel = <0>; + voltage = <392644>; + }; + button at 60 { + label = "Menu"; + linux,code = <KEY_MENU>; + channel = <0>; + voltage = <601151>; + }; + button at 80 { + label = "Enter"; + linux,code = <KEY_ENTER>; + channel = <0>; + voltage = <795090>; + }; + button at 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 <hdegoede@redhat.com> +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 <kda@linux-powerpc.org> L: netdev at 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 + module will be called sun4i-lradc-keys. + config KEYBOARD_DAVINCI tristate "TI DaVinci Key Scan" depends on ARCH_DAVINCI_DM365 diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile index 0a33456..a35269a 100644 --- a/drivers/input/keyboard/Makefile +++ b/drivers/input/keyboard/Makefile @@ -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 diff --git a/drivers/input/keyboard/sun4i-lradc-keys.c b/drivers/input/keyboard/sun4i-lradc-keys.c new file mode 100644 index 0000000..63a1aff --- /dev/null +++ b/drivers/input/keyboard/sun4i-lradc-keys.c @@ -0,0 +1,259 @@ +/* + * Allwinner sun4i low res adc attached tablet keys driver + * + * Copyright (C) 2014 Hans de Goede <hdegoede@redhat.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +/* + * Allwinnner sunxi SoCs have a lradc which is specifically designed to have + * various (tablet) keys (ie home, back, search, etc). attached to it using + * a resistor network. This driver is for the keys on such boards. + * + * There are 2 channels, currently this driver only supports channel 0 since + * there are no boards known to use channel 1. + */ + +#include <linux/err.h> +#include <linux/init.h> +#include <linux/input.h> +#include <linux/interrupt.h> +#include <linux/io.h> +#include <linux/module.h> +#include <linux/of_platform.h> +#include <linux/platform_device.h> +#include <linux/regulator/consumer.h> +#include <linux/slab.h> + +#define LRADC_CTRL 0x00 +#define LRADC_INTC 0x04 +#define LRADC_INTS 0x08 +#define LRADC_DATA0 0x0c +#define LRADC_DATA1 0x10 + +/* LRADC_CTRL bits */ +#define FIRST_CONVERT_DLY(x) ((x) << 24) /* 8 bits */ +#define CHAN_SELECT(x) ((x) << 22) /* 2 bits */ +#define CONTINUE_TIME_SEL(x) ((x) << 16) /* 4 bits */ +#define KEY_MODE_SEL(x) ((x) << 12) /* 2 bits */ +#define LEVELA_B_CNT(x) ((x) << 8) /* 4 bits */ +#define HOLD_EN(x) ((x) << 6) +#define LEVELB_VOL(x) ((x) << 4) /* 2 bits */ +#define SAMPLE_RATE(x) ((x) << 2) /* 2 bits */ +#define ENABLE(x) ((x) << 0) + +/* LRADC_INTC and LRADC_INTS bits */ +#define CHAN1_KEYUP_IRQ BIT(12) +#define CHAN1_ALRDY_HOLD_IRQ BIT(11) +#define CHAN1_HOLD_IRQ BIT(10) +#define CHAN1_KEYDOWN_IRQ BIT(9) +#define CHAN1_DATA_IRQ BIT(8) +#define CHAN0_KEYUP_IRQ BIT(4) +#define CHAN0_ALRDY_HOLD_IRQ BIT(3) +#define CHAN0_HOLD_IRQ BIT(2) +#define CHAN0_KEYDOWN_IRQ BIT(1) +#define CHAN0_DATA_IRQ BIT(0) + +struct sun4i_lradc_keymap { + u32 voltage; + u32 keycode; +}; + +struct sun4i_lradc_data { + struct device *dev; + struct input_dev *input; + void __iomem *base; + struct regulator *vref_supply; + struct sun4i_lradc_keymap *chan0_map; + u32 chan0_map_count; + u32 chan0_keycode; + u32 vref; +}; + +static irqreturn_t sun4i_lradc_irq(int irq, void *dev_id) +{ + struct sun4i_lradc_data *lradc = dev_id; + u32 i, ints, val, voltage, diff, keycode = 0, closest = 0xffffffff; + + ints = readl(lradc->base + LRADC_INTS); + + /* + * lradc supports only one keypress at a time, release does not give + * any info as to which key was released, so we cache the keycode. + */ + if ((ints & CHAN0_KEYDOWN_IRQ) && lradc->chan0_keycode == 0) { + val = readl(lradc->base + LRADC_DATA0) & 0x3f; + voltage = val * lradc->vref / 63; + + for (i = 0; i < lradc->chan0_map_count; i++) { + diff = abs(lradc->chan0_map[i].voltage - voltage); + if (diff < closest) { + closest = diff; + keycode = lradc->chan0_map[i].keycode; + } + } + + lradc->chan0_keycode = keycode; + input_report_key(lradc->input, lradc->chan0_keycode, 1); + } + + if (ints & CHAN0_KEYUP_IRQ) { + input_report_key(lradc->input, lradc->chan0_keycode, 0); + lradc->chan0_keycode = 0; + } + + input_sync(lradc->input); + + writel(ints, lradc->base + LRADC_INTS); + + return IRQ_HANDLED; +} + +static int sun4i_lradc_open(struct input_dev *dev) +{ + struct sun4i_lradc_data *lradc = input_get_drvdata(dev); + int ret; + + ret = regulator_enable(lradc->vref_supply); + if (ret) + return ret; + + /* lradc Vref internally is divided by 2/3 */ + lradc->vref = regulator_get_voltage(lradc->vref_supply) * 2 / 3; + + /* + * Set sample time to 4 ms / 250 Hz. Wait 2 * 4 ms for key to + * stabilize on press, wait (1 + 1) * 4 ms for key release + */ + writel(FIRST_CONVERT_DLY(2) | LEVELA_B_CNT(1) | HOLD_EN(1) | + SAMPLE_RATE(0) | ENABLE(1), lradc->base + LRADC_CTRL); + + writel(CHAN0_KEYUP_IRQ | CHAN0_KEYDOWN_IRQ, lradc->base + LRADC_INTC); + + return 0; +} + +static void sun4i_lradc_close(struct input_dev *dev) +{ + struct sun4i_lradc_data *lradc = input_get_drvdata(dev); + + /* Disable lradc, leave other settings unchanged */ + writel(FIRST_CONVERT_DLY(2) | LEVELA_B_CNT(1) | HOLD_EN(1) | + SAMPLE_RATE(2), lradc->base + LRADC_CTRL); + writel(0, lradc->base + LRADC_INTC); + + regulator_disable(lradc->vref_supply); +} + +static int sun4i_lradc_probe(struct platform_device *pdev) +{ + struct sun4i_lradc_data *lradc; + struct device *dev = &pdev->dev; + struct device_node *pp, *np = dev->of_node; + u32 channel; + int i, ret; + + lradc = devm_kzalloc(dev, sizeof(struct sun4i_lradc_data), GFP_KERNEL); + if (!lradc) + return -ENOMEM; + + lradc->chan0_map_count = of_get_child_count(np); + lradc->chan0_map = devm_kmalloc(dev, lradc->chan0_map_count * + sizeof(struct sun4i_lradc_keymap), GFP_KERNEL); + if (!lradc->chan0_map) + return -ENOMEM; + + i = 0; + for_each_child_of_node(np, pp) { + struct sun4i_lradc_keymap *map = &lradc->chan0_map[i]; + + ret = of_property_read_u32(pp, "channel", &channel); + if (ret || channel != 0) { + dev_err(dev, "%s: Inval channel prop\n", pp->name); + return -EINVAL; + } + + ret = of_property_read_u32(pp, "voltage", &map->voltage); + if (ret) { + dev_err(dev, "%s: Inval voltage prop\n", pp->name); + return -EINVAL; + } + + ret = of_property_read_u32(pp, "linux,code", &map->keycode); + if (ret) { + dev_err(dev, "%s: Inval linux,code prop\n", pp->name); + return -EINVAL; + } + + i++; + } + + lradc->vref_supply = devm_regulator_get(dev, "vref"); + if (IS_ERR(lradc->vref_supply)) + return PTR_ERR(lradc->vref_supply); + + lradc->dev = dev; + lradc->input = devm_input_allocate_device(dev); + if (!lradc->input) + return -ENOMEM; + + lradc->input->name = pdev->name; + lradc->input->phys = "sun4i_lradc/input0"; + lradc->input->open = sun4i_lradc_open; + lradc->input->close = sun4i_lradc_close; + lradc->input->id.bustype = BUS_HOST; + lradc->input->id.vendor = 0x0001; + lradc->input->id.product = 0x0001; + lradc->input->id.version = 0x0100; + lradc->input->evbit[0] = BIT(EV_SYN) | BIT(EV_KEY); + for (i = 0; i < lradc->chan0_map_count; i++) + set_bit(lradc->chan0_map[i].keycode, lradc->input->keybit); + input_set_drvdata(lradc->input, lradc); + + lradc->base = devm_ioremap_resource(dev, + platform_get_resource(pdev, IORESOURCE_MEM, 0)); + if (IS_ERR(lradc->base)) + return PTR_ERR(lradc->base); + + ret = devm_request_irq(dev, platform_get_irq(pdev, 0), sun4i_lradc_irq, + 0, "sun4i-lradc-keys", lradc); + if (ret) + return ret; + + ret = input_register_device(lradc->input); + if (ret) + return ret; + + platform_set_drvdata(pdev, lradc); + return 0; +} + +static const struct of_device_id sun4i_lradc_of_match[] = { + { .compatible = "allwinner,sun4i-lradc-keys", }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, sun4i_lradc_of_match); + +static struct platform_driver sun4i_lradc_driver = { + .driver = { + .owner = THIS_MODULE, + .name = "sun4i-lradc-keys", + .of_match_table = of_match_ptr(sun4i_lradc_of_match), + }, + .probe = sun4i_lradc_probe, +}; + +module_platform_driver(sun4i_lradc_driver); + +MODULE_DESCRIPTION("Allwinner sun4i low res adc attached tablet keys driver"); +MODULE_AUTHOR("Hans de Goede <hdegoede@redhat.com>"); +MODULE_LICENSE("GPL"); -- 2.1.0 ^ permalink raw reply related [flat|nested] 28+ messages in thread
[parent not found: <1413879890-7254-2-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>]
* Re: [PATCH v2 1/4] input: Add new sun4i-lradc-keys driver 2014-10-21 8:24 ` Hans de Goede @ 2014-10-21 17:04 ` Maxime Ripard -1 siblings, 0 replies; 28+ messages in thread From: Maxime Ripard @ 2014-10-21 17:04 UTC (permalink / raw) To: Hans de Goede Cc: Dmitry Torokhov, linux-input-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw [-- Attachment #1: Type: text/plain, Size: 14598 bytes --] 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 <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> > -- > 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 0000000..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 = <®_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 <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> > +L: linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.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 <kda-u1c8ncikuMvVAZt0uhVF+Ni2O/JbrIOy@public.gmane.org> > L: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.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 > + module will be called sun4i-lradc-keys. > + > config KEYBOARD_DAVINCI > tristate "TI DaVinci Key Scan" > depends on ARCH_DAVINCI_DM365 > diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile > index 0a33456..a35269a 100644 > --- a/drivers/input/keyboard/Makefile > +++ b/drivers/input/keyboard/Makefile > @@ -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 > diff --git a/drivers/input/keyboard/sun4i-lradc-keys.c b/drivers/input/keyboard/sun4i-lradc-keys.c > new file mode 100644 > index 0000000..63a1aff > --- /dev/null > +++ b/drivers/input/keyboard/sun4i-lradc-keys.c > @@ -0,0 +1,259 @@ > +/* > + * Allwinner sun4i low res adc attached tablet keys driver > + * > + * Copyright (C) 2014 Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License as published by > + * the Free Software Foundation; either version 2 of the License, or > + * (at your option) any later version. > + * > + * This program is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + * GNU General Public License for more details. > + */ > + > +/* > + * Allwinnner sunxi SoCs have a lradc which is specifically designed to have > + * various (tablet) keys (ie home, back, search, etc). attached to it using > + * a resistor network. This driver is for the keys on such boards. > + * > + * There are 2 channels, currently this driver only supports channel 0 since > + * there are no boards known to use channel 1. > + */ > + > +#include <linux/err.h> > +#include <linux/init.h> > +#include <linux/input.h> > +#include <linux/interrupt.h> > +#include <linux/io.h> > +#include <linux/module.h> > +#include <linux/of_platform.h> > +#include <linux/platform_device.h> > +#include <linux/regulator/consumer.h> > +#include <linux/slab.h> > + > +#define LRADC_CTRL 0x00 > +#define LRADC_INTC 0x04 > +#define LRADC_INTS 0x08 > +#define LRADC_DATA0 0x0c > +#define LRADC_DATA1 0x10 > + > +/* LRADC_CTRL bits */ > +#define FIRST_CONVERT_DLY(x) ((x) << 24) /* 8 bits */ > +#define CHAN_SELECT(x) ((x) << 22) /* 2 bits */ > +#define CONTINUE_TIME_SEL(x) ((x) << 16) /* 4 bits */ > +#define KEY_MODE_SEL(x) ((x) << 12) /* 2 bits */ > +#define LEVELA_B_CNT(x) ((x) << 8) /* 4 bits */ > +#define HOLD_EN(x) ((x) << 6) > +#define LEVELB_VOL(x) ((x) << 4) /* 2 bits */ > +#define SAMPLE_RATE(x) ((x) << 2) /* 2 bits */ > +#define ENABLE(x) ((x) << 0) > + > +/* LRADC_INTC and LRADC_INTS bits */ > +#define CHAN1_KEYUP_IRQ BIT(12) > +#define CHAN1_ALRDY_HOLD_IRQ BIT(11) > +#define CHAN1_HOLD_IRQ BIT(10) > +#define CHAN1_KEYDOWN_IRQ BIT(9) > +#define CHAN1_DATA_IRQ BIT(8) > +#define CHAN0_KEYUP_IRQ BIT(4) > +#define CHAN0_ALRDY_HOLD_IRQ BIT(3) > +#define CHAN0_HOLD_IRQ BIT(2) > +#define CHAN0_KEYDOWN_IRQ BIT(1) > +#define CHAN0_DATA_IRQ BIT(0) > + > +struct sun4i_lradc_keymap { > + u32 voltage; > + u32 keycode; > +}; > + > +struct sun4i_lradc_data { > + struct device *dev; > + struct input_dev *input; > + void __iomem *base; > + struct regulator *vref_supply; > + struct sun4i_lradc_keymap *chan0_map; > + u32 chan0_map_count; > + u32 chan0_keycode; > + u32 vref; > +}; > + > +static irqreturn_t sun4i_lradc_irq(int irq, void *dev_id) > +{ > + struct sun4i_lradc_data *lradc = dev_id; > + u32 i, ints, val, voltage, diff, keycode = 0, closest = 0xffffffff; > + > + ints = readl(lradc->base + LRADC_INTS); > + > + /* > + * lradc supports only one keypress at a time, release does not give > + * any info as to which key was released, so we cache the keycode. > + */ > + if ((ints & CHAN0_KEYDOWN_IRQ) && lradc->chan0_keycode == 0) { > + val = readl(lradc->base + LRADC_DATA0) & 0x3f; > + voltage = val * lradc->vref / 63; > + > + for (i = 0; i < lradc->chan0_map_count; i++) { > + diff = abs(lradc->chan0_map[i].voltage - voltage); > + if (diff < closest) { > + closest = diff; > + keycode = lradc->chan0_map[i].keycode; > + } > + } > + > + lradc->chan0_keycode = keycode; > + input_report_key(lradc->input, lradc->chan0_keycode, 1); > + } > + > + if (ints & CHAN0_KEYUP_IRQ) { > + input_report_key(lradc->input, lradc->chan0_keycode, 0); > + lradc->chan0_keycode = 0; > + } > + > + input_sync(lradc->input); > + > + writel(ints, lradc->base + LRADC_INTS); > + > + return IRQ_HANDLED; > +} > + > +static int sun4i_lradc_open(struct input_dev *dev) > +{ > + struct sun4i_lradc_data *lradc = input_get_drvdata(dev); > + int ret; > + > + ret = regulator_enable(lradc->vref_supply); > + if (ret) > + return ret; > + > + /* lradc Vref internally is divided by 2/3 */ > + lradc->vref = regulator_get_voltage(lradc->vref_supply) * 2 / 3; > + > + /* > + * Set sample time to 4 ms / 250 Hz. Wait 2 * 4 ms for key to > + * stabilize on press, wait (1 + 1) * 4 ms for key release > + */ > + writel(FIRST_CONVERT_DLY(2) | LEVELA_B_CNT(1) | HOLD_EN(1) | > + SAMPLE_RATE(0) | ENABLE(1), lradc->base + LRADC_CTRL); > + > + writel(CHAN0_KEYUP_IRQ | CHAN0_KEYDOWN_IRQ, lradc->base + LRADC_INTC); > + > + return 0; > +} > + > +static void sun4i_lradc_close(struct input_dev *dev) > +{ > + struct sun4i_lradc_data *lradc = input_get_drvdata(dev); > + > + /* Disable lradc, leave other settings unchanged */ > + writel(FIRST_CONVERT_DLY(2) | LEVELA_B_CNT(1) | HOLD_EN(1) | > + SAMPLE_RATE(2), lradc->base + LRADC_CTRL); > + writel(0, lradc->base + LRADC_INTC); > + > + regulator_disable(lradc->vref_supply); > +} > + > +static int sun4i_lradc_probe(struct platform_device *pdev) > +{ > + struct sun4i_lradc_data *lradc; > + struct device *dev = &pdev->dev; > + struct device_node *pp, *np = dev->of_node; > + u32 channel; > + int i, ret; > + > + lradc = devm_kzalloc(dev, sizeof(struct sun4i_lradc_data), GFP_KERNEL); > + if (!lradc) > + return -ENOMEM; > + > + lradc->chan0_map_count = of_get_child_count(np); > + lradc->chan0_map = devm_kmalloc(dev, lradc->chan0_map_count * > + sizeof(struct sun4i_lradc_keymap), GFP_KERNEL); > + if (!lradc->chan0_map) > + return -ENOMEM; > + > + i = 0; > + for_each_child_of_node(np, pp) { > + struct sun4i_lradc_keymap *map = &lradc->chan0_map[i]; > + > + ret = of_property_read_u32(pp, "channel", &channel); > + if (ret || channel != 0) { > + dev_err(dev, "%s: Inval channel prop\n", pp->name); > + return -EINVAL; > + } > + > + ret = of_property_read_u32(pp, "voltage", &map->voltage); > + if (ret) { > + dev_err(dev, "%s: Inval voltage prop\n", pp->name); > + return -EINVAL; > + } > + > + ret = of_property_read_u32(pp, "linux,code", &map->keycode); > + if (ret) { > + dev_err(dev, "%s: Inval linux,code prop\n", pp->name); > + return -EINVAL; > + } > + > + i++; > + } > + > + lradc->vref_supply = devm_regulator_get(dev, "vref"); > + if (IS_ERR(lradc->vref_supply)) > + return PTR_ERR(lradc->vref_supply); > + > + lradc->dev = dev; > + lradc->input = devm_input_allocate_device(dev); > + if (!lradc->input) > + return -ENOMEM; > + > + lradc->input->name = pdev->name; > + lradc->input->phys = "sun4i_lradc/input0"; > + lradc->input->open = sun4i_lradc_open; > + lradc->input->close = sun4i_lradc_close; > + lradc->input->id.bustype = BUS_HOST; > + lradc->input->id.vendor = 0x0001; > + lradc->input->id.product = 0x0001; > + lradc->input->id.version = 0x0100; > + lradc->input->evbit[0] = BIT(EV_SYN) | BIT(EV_KEY); > + for (i = 0; i < lradc->chan0_map_count; i++) > + set_bit(lradc->chan0_map[i].keycode, lradc->input->keybit); > + input_set_drvdata(lradc->input, lradc); > + > + lradc->base = devm_ioremap_resource(dev, > + platform_get_resource(pdev, IORESOURCE_MEM, 0)); > + if (IS_ERR(lradc->base)) > + return PTR_ERR(lradc->base); > + > + ret = devm_request_irq(dev, platform_get_irq(pdev, 0), sun4i_lradc_irq, > + 0, "sun4i-lradc-keys", lradc); > + if (ret) > + return ret; > + > + ret = input_register_device(lradc->input); > + if (ret) > + return ret; > + > + platform_set_drvdata(pdev, lradc); > + return 0; > +} > + > +static const struct of_device_id sun4i_lradc_of_match[] = { > + { .compatible = "allwinner,sun4i-lradc-keys", }, > + { /* sentinel */ } > +}; > +MODULE_DEVICE_TABLE(of, sun4i_lradc_of_match); > + > +static struct platform_driver sun4i_lradc_driver = { > + .driver = { > + .owner = THIS_MODULE, You can drop the owner field, it's already filled by module_platform_driver. > + .name = "sun4i-lradc-keys", > + .of_match_table = of_match_ptr(sun4i_lradc_of_match), > + }, > + .probe = sun4i_lradc_probe, > +}; > + > +module_platform_driver(sun4i_lradc_driver); > + > +MODULE_DESCRIPTION("Allwinner sun4i low res adc attached tablet keys driver"); > +MODULE_AUTHOR("Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>"); > +MODULE_LICENSE("GPL"); > -- > 2.1.0 > Looking good otherwise, thanks! Maxime -- Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 819 bytes --] ^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH v2 1/4] input: Add new sun4i-lradc-keys driver @ 2014-10-21 17:04 ` Maxime Ripard 0 siblings, 0 replies; 28+ messages in thread From: Maxime Ripard @ 2014-10-21 17:04 UTC (permalink / raw) To: linux-arm-kernel 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 <hdegoede@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 0000000..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 at 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 = <®_vcc3v0>; > + button at 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 at 39 { > + label = "Volume Down"; > + linux,code = <KEY_VOLUMEDOWN>; > + channel = <0>; > + voltage = <392644>; > + }; > + button at 60 { > + label = "Menu"; > + linux,code = <KEY_MENU>; > + channel = <0>; > + voltage = <601151>; > + }; > + button at 80 { > + label = "Enter"; > + linux,code = <KEY_ENTER>; > + channel = <0>; > + voltage = <795090>; > + }; > + button at 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 <hdegoede@redhat.com> > +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 <kda@linux-powerpc.org> > L: netdev at 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 > + module will be called sun4i-lradc-keys. > + > config KEYBOARD_DAVINCI > tristate "TI DaVinci Key Scan" > depends on ARCH_DAVINCI_DM365 > diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile > index 0a33456..a35269a 100644 > --- a/drivers/input/keyboard/Makefile > +++ b/drivers/input/keyboard/Makefile > @@ -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 > diff --git a/drivers/input/keyboard/sun4i-lradc-keys.c b/drivers/input/keyboard/sun4i-lradc-keys.c > new file mode 100644 > index 0000000..63a1aff > --- /dev/null > +++ b/drivers/input/keyboard/sun4i-lradc-keys.c > @@ -0,0 +1,259 @@ > +/* > + * Allwinner sun4i low res adc attached tablet keys driver > + * > + * Copyright (C) 2014 Hans de Goede <hdegoede@redhat.com> > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License as published by > + * the Free Software Foundation; either version 2 of the License, or > + * (at your option) any later version. > + * > + * This program is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + * GNU General Public License for more details. > + */ > + > +/* > + * Allwinnner sunxi SoCs have a lradc which is specifically designed to have > + * various (tablet) keys (ie home, back, search, etc). attached to it using > + * a resistor network. This driver is for the keys on such boards. > + * > + * There are 2 channels, currently this driver only supports channel 0 since > + * there are no boards known to use channel 1. > + */ > + > +#include <linux/err.h> > +#include <linux/init.h> > +#include <linux/input.h> > +#include <linux/interrupt.h> > +#include <linux/io.h> > +#include <linux/module.h> > +#include <linux/of_platform.h> > +#include <linux/platform_device.h> > +#include <linux/regulator/consumer.h> > +#include <linux/slab.h> > + > +#define LRADC_CTRL 0x00 > +#define LRADC_INTC 0x04 > +#define LRADC_INTS 0x08 > +#define LRADC_DATA0 0x0c > +#define LRADC_DATA1 0x10 > + > +/* LRADC_CTRL bits */ > +#define FIRST_CONVERT_DLY(x) ((x) << 24) /* 8 bits */ > +#define CHAN_SELECT(x) ((x) << 22) /* 2 bits */ > +#define CONTINUE_TIME_SEL(x) ((x) << 16) /* 4 bits */ > +#define KEY_MODE_SEL(x) ((x) << 12) /* 2 bits */ > +#define LEVELA_B_CNT(x) ((x) << 8) /* 4 bits */ > +#define HOLD_EN(x) ((x) << 6) > +#define LEVELB_VOL(x) ((x) << 4) /* 2 bits */ > +#define SAMPLE_RATE(x) ((x) << 2) /* 2 bits */ > +#define ENABLE(x) ((x) << 0) > + > +/* LRADC_INTC and LRADC_INTS bits */ > +#define CHAN1_KEYUP_IRQ BIT(12) > +#define CHAN1_ALRDY_HOLD_IRQ BIT(11) > +#define CHAN1_HOLD_IRQ BIT(10) > +#define CHAN1_KEYDOWN_IRQ BIT(9) > +#define CHAN1_DATA_IRQ BIT(8) > +#define CHAN0_KEYUP_IRQ BIT(4) > +#define CHAN0_ALRDY_HOLD_IRQ BIT(3) > +#define CHAN0_HOLD_IRQ BIT(2) > +#define CHAN0_KEYDOWN_IRQ BIT(1) > +#define CHAN0_DATA_IRQ BIT(0) > + > +struct sun4i_lradc_keymap { > + u32 voltage; > + u32 keycode; > +}; > + > +struct sun4i_lradc_data { > + struct device *dev; > + struct input_dev *input; > + void __iomem *base; > + struct regulator *vref_supply; > + struct sun4i_lradc_keymap *chan0_map; > + u32 chan0_map_count; > + u32 chan0_keycode; > + u32 vref; > +}; > + > +static irqreturn_t sun4i_lradc_irq(int irq, void *dev_id) > +{ > + struct sun4i_lradc_data *lradc = dev_id; > + u32 i, ints, val, voltage, diff, keycode = 0, closest = 0xffffffff; > + > + ints = readl(lradc->base + LRADC_INTS); > + > + /* > + * lradc supports only one keypress at a time, release does not give > + * any info as to which key was released, so we cache the keycode. > + */ > + if ((ints & CHAN0_KEYDOWN_IRQ) && lradc->chan0_keycode == 0) { > + val = readl(lradc->base + LRADC_DATA0) & 0x3f; > + voltage = val * lradc->vref / 63; > + > + for (i = 0; i < lradc->chan0_map_count; i++) { > + diff = abs(lradc->chan0_map[i].voltage - voltage); > + if (diff < closest) { > + closest = diff; > + keycode = lradc->chan0_map[i].keycode; > + } > + } > + > + lradc->chan0_keycode = keycode; > + input_report_key(lradc->input, lradc->chan0_keycode, 1); > + } > + > + if (ints & CHAN0_KEYUP_IRQ) { > + input_report_key(lradc->input, lradc->chan0_keycode, 0); > + lradc->chan0_keycode = 0; > + } > + > + input_sync(lradc->input); > + > + writel(ints, lradc->base + LRADC_INTS); > + > + return IRQ_HANDLED; > +} > + > +static int sun4i_lradc_open(struct input_dev *dev) > +{ > + struct sun4i_lradc_data *lradc = input_get_drvdata(dev); > + int ret; > + > + ret = regulator_enable(lradc->vref_supply); > + if (ret) > + return ret; > + > + /* lradc Vref internally is divided by 2/3 */ > + lradc->vref = regulator_get_voltage(lradc->vref_supply) * 2 / 3; > + > + /* > + * Set sample time to 4 ms / 250 Hz. Wait 2 * 4 ms for key to > + * stabilize on press, wait (1 + 1) * 4 ms for key release > + */ > + writel(FIRST_CONVERT_DLY(2) | LEVELA_B_CNT(1) | HOLD_EN(1) | > + SAMPLE_RATE(0) | ENABLE(1), lradc->base + LRADC_CTRL); > + > + writel(CHAN0_KEYUP_IRQ | CHAN0_KEYDOWN_IRQ, lradc->base + LRADC_INTC); > + > + return 0; > +} > + > +static void sun4i_lradc_close(struct input_dev *dev) > +{ > + struct sun4i_lradc_data *lradc = input_get_drvdata(dev); > + > + /* Disable lradc, leave other settings unchanged */ > + writel(FIRST_CONVERT_DLY(2) | LEVELA_B_CNT(1) | HOLD_EN(1) | > + SAMPLE_RATE(2), lradc->base + LRADC_CTRL); > + writel(0, lradc->base + LRADC_INTC); > + > + regulator_disable(lradc->vref_supply); > +} > + > +static int sun4i_lradc_probe(struct platform_device *pdev) > +{ > + struct sun4i_lradc_data *lradc; > + struct device *dev = &pdev->dev; > + struct device_node *pp, *np = dev->of_node; > + u32 channel; > + int i, ret; > + > + lradc = devm_kzalloc(dev, sizeof(struct sun4i_lradc_data), GFP_KERNEL); > + if (!lradc) > + return -ENOMEM; > + > + lradc->chan0_map_count = of_get_child_count(np); > + lradc->chan0_map = devm_kmalloc(dev, lradc->chan0_map_count * > + sizeof(struct sun4i_lradc_keymap), GFP_KERNEL); > + if (!lradc->chan0_map) > + return -ENOMEM; > + > + i = 0; > + for_each_child_of_node(np, pp) { > + struct sun4i_lradc_keymap *map = &lradc->chan0_map[i]; > + > + ret = of_property_read_u32(pp, "channel", &channel); > + if (ret || channel != 0) { > + dev_err(dev, "%s: Inval channel prop\n", pp->name); > + return -EINVAL; > + } > + > + ret = of_property_read_u32(pp, "voltage", &map->voltage); > + if (ret) { > + dev_err(dev, "%s: Inval voltage prop\n", pp->name); > + return -EINVAL; > + } > + > + ret = of_property_read_u32(pp, "linux,code", &map->keycode); > + if (ret) { > + dev_err(dev, "%s: Inval linux,code prop\n", pp->name); > + return -EINVAL; > + } > + > + i++; > + } > + > + lradc->vref_supply = devm_regulator_get(dev, "vref"); > + if (IS_ERR(lradc->vref_supply)) > + return PTR_ERR(lradc->vref_supply); > + > + lradc->dev = dev; > + lradc->input = devm_input_allocate_device(dev); > + if (!lradc->input) > + return -ENOMEM; > + > + lradc->input->name = pdev->name; > + lradc->input->phys = "sun4i_lradc/input0"; > + lradc->input->open = sun4i_lradc_open; > + lradc->input->close = sun4i_lradc_close; > + lradc->input->id.bustype = BUS_HOST; > + lradc->input->id.vendor = 0x0001; > + lradc->input->id.product = 0x0001; > + lradc->input->id.version = 0x0100; > + lradc->input->evbit[0] = BIT(EV_SYN) | BIT(EV_KEY); > + for (i = 0; i < lradc->chan0_map_count; i++) > + set_bit(lradc->chan0_map[i].keycode, lradc->input->keybit); > + input_set_drvdata(lradc->input, lradc); > + > + lradc->base = devm_ioremap_resource(dev, > + platform_get_resource(pdev, IORESOURCE_MEM, 0)); > + if (IS_ERR(lradc->base)) > + return PTR_ERR(lradc->base); > + > + ret = devm_request_irq(dev, platform_get_irq(pdev, 0), sun4i_lradc_irq, > + 0, "sun4i-lradc-keys", lradc); > + if (ret) > + return ret; > + > + ret = input_register_device(lradc->input); > + if (ret) > + return ret; > + > + platform_set_drvdata(pdev, lradc); > + return 0; > +} > + > +static const struct of_device_id sun4i_lradc_of_match[] = { > + { .compatible = "allwinner,sun4i-lradc-keys", }, > + { /* sentinel */ } > +}; > +MODULE_DEVICE_TABLE(of, sun4i_lradc_of_match); > + > +static struct platform_driver sun4i_lradc_driver = { > + .driver = { > + .owner = THIS_MODULE, You can drop the owner field, it's already filled by module_platform_driver. > + .name = "sun4i-lradc-keys", > + .of_match_table = of_match_ptr(sun4i_lradc_of_match), > + }, > + .probe = sun4i_lradc_probe, > +}; > + > +module_platform_driver(sun4i_lradc_driver); > + > +MODULE_DESCRIPTION("Allwinner sun4i low res adc attached tablet keys driver"); > +MODULE_AUTHOR("Hans de Goede <hdegoede@redhat.com>"); > +MODULE_LICENSE("GPL"); > -- > 2.1.0 > Looking good otherwise, thanks! Maxime -- 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/20141021/0ecd40d3/attachment-0001.sig> ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v2 1/4] input: Add new sun4i-lradc-keys driver 2014-10-21 17:04 ` Maxime Ripard @ 2014-10-22 10:45 ` Hans de Goede -1 siblings, 0 replies; 28+ messages in thread From: Hans de Goede @ 2014-10-22 10:45 UTC (permalink / raw) To: Maxime Ripard Cc: Dmitry Torokhov, linux-input-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw 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 <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> >> -- >> 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 0000000..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 = <®_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 <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> >> +L: linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.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 <kda-u1c8ncikuMvVAZt0uhVF+Ni2O/JbrIOy@public.gmane.org> >> L: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.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 >> + module will be called sun4i-lradc-keys. >> + >> config KEYBOARD_DAVINCI >> tristate "TI DaVinci Key Scan" >> depends on ARCH_DAVINCI_DM365 >> diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile >> index 0a33456..a35269a 100644 >> --- a/drivers/input/keyboard/Makefile >> +++ b/drivers/input/keyboard/Makefile >> @@ -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 >> diff --git a/drivers/input/keyboard/sun4i-lradc-keys.c b/drivers/input/keyboard/sun4i-lradc-keys.c >> new file mode 100644 >> index 0000000..63a1aff >> --- /dev/null >> +++ b/drivers/input/keyboard/sun4i-lradc-keys.c >> @@ -0,0 +1,259 @@ >> +/* >> + * Allwinner sun4i low res adc attached tablet keys driver >> + * >> + * Copyright (C) 2014 Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> >> + * >> + * This program is free software; you can redistribute it and/or modify >> + * it under the terms of the GNU General Public License as published by >> + * the Free Software Foundation; either version 2 of the License, or >> + * (at your option) any later version. >> + * >> + * This program is distributed in the hope that it will be useful, >> + * but WITHOUT ANY WARRANTY; without even the implied warranty of >> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >> + * GNU General Public License for more details. >> + */ >> + >> +/* >> + * Allwinnner sunxi SoCs have a lradc which is specifically designed to have >> + * various (tablet) keys (ie home, back, search, etc). attached to it using >> + * a resistor network. This driver is for the keys on such boards. >> + * >> + * There are 2 channels, currently this driver only supports channel 0 since >> + * there are no boards known to use channel 1. >> + */ >> + >> +#include <linux/err.h> >> +#include <linux/init.h> >> +#include <linux/input.h> >> +#include <linux/interrupt.h> >> +#include <linux/io.h> >> +#include <linux/module.h> >> +#include <linux/of_platform.h> >> +#include <linux/platform_device.h> >> +#include <linux/regulator/consumer.h> >> +#include <linux/slab.h> >> + >> +#define LRADC_CTRL 0x00 >> +#define LRADC_INTC 0x04 >> +#define LRADC_INTS 0x08 >> +#define LRADC_DATA0 0x0c >> +#define LRADC_DATA1 0x10 >> + >> +/* LRADC_CTRL bits */ >> +#define FIRST_CONVERT_DLY(x) ((x) << 24) /* 8 bits */ >> +#define CHAN_SELECT(x) ((x) << 22) /* 2 bits */ >> +#define CONTINUE_TIME_SEL(x) ((x) << 16) /* 4 bits */ >> +#define KEY_MODE_SEL(x) ((x) << 12) /* 2 bits */ >> +#define LEVELA_B_CNT(x) ((x) << 8) /* 4 bits */ >> +#define HOLD_EN(x) ((x) << 6) >> +#define LEVELB_VOL(x) ((x) << 4) /* 2 bits */ >> +#define SAMPLE_RATE(x) ((x) << 2) /* 2 bits */ >> +#define ENABLE(x) ((x) << 0) >> + >> +/* LRADC_INTC and LRADC_INTS bits */ >> +#define CHAN1_KEYUP_IRQ BIT(12) >> +#define CHAN1_ALRDY_HOLD_IRQ BIT(11) >> +#define CHAN1_HOLD_IRQ BIT(10) >> +#define CHAN1_KEYDOWN_IRQ BIT(9) >> +#define CHAN1_DATA_IRQ BIT(8) >> +#define CHAN0_KEYUP_IRQ BIT(4) >> +#define CHAN0_ALRDY_HOLD_IRQ BIT(3) >> +#define CHAN0_HOLD_IRQ BIT(2) >> +#define CHAN0_KEYDOWN_IRQ BIT(1) >> +#define CHAN0_DATA_IRQ BIT(0) >> + >> +struct sun4i_lradc_keymap { >> + u32 voltage; >> + u32 keycode; >> +}; >> + >> +struct sun4i_lradc_data { >> + struct device *dev; >> + struct input_dev *input; >> + void __iomem *base; >> + struct regulator *vref_supply; >> + struct sun4i_lradc_keymap *chan0_map; >> + u32 chan0_map_count; >> + u32 chan0_keycode; >> + u32 vref; >> +}; >> + >> +static irqreturn_t sun4i_lradc_irq(int irq, void *dev_id) >> +{ >> + struct sun4i_lradc_data *lradc = dev_id; >> + u32 i, ints, val, voltage, diff, keycode = 0, closest = 0xffffffff; >> + >> + ints = readl(lradc->base + LRADC_INTS); >> + >> + /* >> + * lradc supports only one keypress at a time, release does not give >> + * any info as to which key was released, so we cache the keycode. >> + */ >> + if ((ints & CHAN0_KEYDOWN_IRQ) && lradc->chan0_keycode == 0) { >> + val = readl(lradc->base + LRADC_DATA0) & 0x3f; >> + voltage = val * lradc->vref / 63; >> + >> + for (i = 0; i < lradc->chan0_map_count; i++) { >> + diff = abs(lradc->chan0_map[i].voltage - voltage); >> + if (diff < closest) { >> + closest = diff; >> + keycode = lradc->chan0_map[i].keycode; >> + } >> + } >> + >> + lradc->chan0_keycode = keycode; >> + input_report_key(lradc->input, lradc->chan0_keycode, 1); >> + } >> + >> + if (ints & CHAN0_KEYUP_IRQ) { >> + input_report_key(lradc->input, lradc->chan0_keycode, 0); >> + lradc->chan0_keycode = 0; >> + } >> + >> + input_sync(lradc->input); >> + >> + writel(ints, lradc->base + LRADC_INTS); >> + >> + return IRQ_HANDLED; >> +} >> + >> +static int sun4i_lradc_open(struct input_dev *dev) >> +{ >> + struct sun4i_lradc_data *lradc = input_get_drvdata(dev); >> + int ret; >> + >> + ret = regulator_enable(lradc->vref_supply); >> + if (ret) >> + return ret; >> + >> + /* lradc Vref internally is divided by 2/3 */ >> + lradc->vref = regulator_get_voltage(lradc->vref_supply) * 2 / 3; >> + >> + /* >> + * Set sample time to 4 ms / 250 Hz. Wait 2 * 4 ms for key to >> + * stabilize on press, wait (1 + 1) * 4 ms for key release >> + */ >> + writel(FIRST_CONVERT_DLY(2) | LEVELA_B_CNT(1) | HOLD_EN(1) | >> + SAMPLE_RATE(0) | ENABLE(1), lradc->base + LRADC_CTRL); >> + >> + writel(CHAN0_KEYUP_IRQ | CHAN0_KEYDOWN_IRQ, lradc->base + LRADC_INTC); >> + >> + return 0; >> +} >> + >> +static void sun4i_lradc_close(struct input_dev *dev) >> +{ >> + struct sun4i_lradc_data *lradc = input_get_drvdata(dev); >> + >> + /* Disable lradc, leave other settings unchanged */ >> + writel(FIRST_CONVERT_DLY(2) | LEVELA_B_CNT(1) | HOLD_EN(1) | >> + SAMPLE_RATE(2), lradc->base + LRADC_CTRL); >> + writel(0, lradc->base + LRADC_INTC); >> + >> + regulator_disable(lradc->vref_supply); >> +} >> + >> +static int sun4i_lradc_probe(struct platform_device *pdev) >> +{ >> + struct sun4i_lradc_data *lradc; >> + struct device *dev = &pdev->dev; >> + struct device_node *pp, *np = dev->of_node; >> + u32 channel; >> + int i, ret; >> + >> + lradc = devm_kzalloc(dev, sizeof(struct sun4i_lradc_data), GFP_KERNEL); >> + if (!lradc) >> + return -ENOMEM; >> + >> + lradc->chan0_map_count = of_get_child_count(np); >> + lradc->chan0_map = devm_kmalloc(dev, lradc->chan0_map_count * >> + sizeof(struct sun4i_lradc_keymap), GFP_KERNEL); >> + if (!lradc->chan0_map) >> + return -ENOMEM; >> + >> + i = 0; >> + for_each_child_of_node(np, pp) { >> + struct sun4i_lradc_keymap *map = &lradc->chan0_map[i]; >> + >> + ret = of_property_read_u32(pp, "channel", &channel); >> + if (ret || channel != 0) { >> + dev_err(dev, "%s: Inval channel prop\n", pp->name); >> + return -EINVAL; >> + } >> + >> + ret = of_property_read_u32(pp, "voltage", &map->voltage); >> + if (ret) { >> + dev_err(dev, "%s: Inval voltage prop\n", pp->name); >> + return -EINVAL; >> + } >> + >> + ret = of_property_read_u32(pp, "linux,code", &map->keycode); >> + if (ret) { >> + dev_err(dev, "%s: Inval linux,code prop\n", pp->name); >> + return -EINVAL; >> + } >> + >> + i++; >> + } >> + >> + lradc->vref_supply = devm_regulator_get(dev, "vref"); >> + if (IS_ERR(lradc->vref_supply)) >> + return PTR_ERR(lradc->vref_supply); >> + >> + lradc->dev = dev; >> + lradc->input = devm_input_allocate_device(dev); >> + if (!lradc->input) >> + return -ENOMEM; >> + >> + lradc->input->name = pdev->name; >> + lradc->input->phys = "sun4i_lradc/input0"; >> + lradc->input->open = sun4i_lradc_open; >> + lradc->input->close = sun4i_lradc_close; >> + lradc->input->id.bustype = BUS_HOST; >> + lradc->input->id.vendor = 0x0001; >> + lradc->input->id.product = 0x0001; >> + lradc->input->id.version = 0x0100; >> + lradc->input->evbit[0] = BIT(EV_SYN) | BIT(EV_KEY); >> + for (i = 0; i < lradc->chan0_map_count; i++) >> + set_bit(lradc->chan0_map[i].keycode, lradc->input->keybit); >> + input_set_drvdata(lradc->input, lradc); >> + >> + lradc->base = devm_ioremap_resource(dev, >> + platform_get_resource(pdev, IORESOURCE_MEM, 0)); >> + if (IS_ERR(lradc->base)) >> + return PTR_ERR(lradc->base); >> + >> + ret = devm_request_irq(dev, platform_get_irq(pdev, 0), sun4i_lradc_irq, >> + 0, "sun4i-lradc-keys", lradc); >> + if (ret) >> + return ret; >> + >> + ret = input_register_device(lradc->input); >> + if (ret) >> + return ret; >> + >> + platform_set_drvdata(pdev, lradc); >> + return 0; >> +} >> + >> +static const struct of_device_id sun4i_lradc_of_match[] = { >> + { .compatible = "allwinner,sun4i-lradc-keys", }, >> + { /* sentinel */ } >> +}; >> +MODULE_DEVICE_TABLE(of, sun4i_lradc_of_match); >> + >> +static struct platform_driver sun4i_lradc_driver = { >> + .driver = { >> + .owner = THIS_MODULE, > > You can drop the owner field, it's already filled by > module_platform_driver. Will fix for the next version. > >> + .name = "sun4i-lradc-keys", >> + .of_match_table = of_match_ptr(sun4i_lradc_of_match), >> + }, >> + .probe = sun4i_lradc_probe, >> +}; >> + >> +module_platform_driver(sun4i_lradc_driver); >> + >> +MODULE_DESCRIPTION("Allwinner sun4i low res adc attached tablet keys driver"); >> +MODULE_AUTHOR("Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>"); >> +MODULE_LICENSE("GPL"); >> -- >> 2.1.0 >> > > Looking good otherwise, thanks! Thanks for the review. 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/d/optout. ^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH v2 1/4] input: Add new sun4i-lradc-keys driver @ 2014-10-22 10:45 ` Hans de Goede 0 siblings, 0 replies; 28+ messages in thread From: Hans de Goede @ 2014-10-22 10:45 UTC (permalink / raw) To: linux-arm-kernel 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 <hdegoede@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 0000000..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 at 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 = <®_vcc3v0>; >> + button at 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 at 39 { >> + label = "Volume Down"; >> + linux,code = <KEY_VOLUMEDOWN>; >> + channel = <0>; >> + voltage = <392644>; >> + }; >> + button at 60 { >> + label = "Menu"; >> + linux,code = <KEY_MENU>; >> + channel = <0>; >> + voltage = <601151>; >> + }; >> + button at 80 { >> + label = "Enter"; >> + linux,code = <KEY_ENTER>; >> + channel = <0>; >> + voltage = <795090>; >> + }; >> + button at 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 <hdegoede@redhat.com> >> +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 <kda@linux-powerpc.org> >> L: netdev at 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 >> + module will be called sun4i-lradc-keys. >> + >> config KEYBOARD_DAVINCI >> tristate "TI DaVinci Key Scan" >> depends on ARCH_DAVINCI_DM365 >> diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile >> index 0a33456..a35269a 100644 >> --- a/drivers/input/keyboard/Makefile >> +++ b/drivers/input/keyboard/Makefile >> @@ -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 >> diff --git a/drivers/input/keyboard/sun4i-lradc-keys.c b/drivers/input/keyboard/sun4i-lradc-keys.c >> new file mode 100644 >> index 0000000..63a1aff >> --- /dev/null >> +++ b/drivers/input/keyboard/sun4i-lradc-keys.c >> @@ -0,0 +1,259 @@ >> +/* >> + * Allwinner sun4i low res adc attached tablet keys driver >> + * >> + * Copyright (C) 2014 Hans de Goede <hdegoede@redhat.com> >> + * >> + * This program is free software; you can redistribute it and/or modify >> + * it under the terms of the GNU General Public License as published by >> + * the Free Software Foundation; either version 2 of the License, or >> + * (at your option) any later version. >> + * >> + * This program is distributed in the hope that it will be useful, >> + * but WITHOUT ANY WARRANTY; without even the implied warranty of >> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >> + * GNU General Public License for more details. >> + */ >> + >> +/* >> + * Allwinnner sunxi SoCs have a lradc which is specifically designed to have >> + * various (tablet) keys (ie home, back, search, etc). attached to it using >> + * a resistor network. This driver is for the keys on such boards. >> + * >> + * There are 2 channels, currently this driver only supports channel 0 since >> + * there are no boards known to use channel 1. >> + */ >> + >> +#include <linux/err.h> >> +#include <linux/init.h> >> +#include <linux/input.h> >> +#include <linux/interrupt.h> >> +#include <linux/io.h> >> +#include <linux/module.h> >> +#include <linux/of_platform.h> >> +#include <linux/platform_device.h> >> +#include <linux/regulator/consumer.h> >> +#include <linux/slab.h> >> + >> +#define LRADC_CTRL 0x00 >> +#define LRADC_INTC 0x04 >> +#define LRADC_INTS 0x08 >> +#define LRADC_DATA0 0x0c >> +#define LRADC_DATA1 0x10 >> + >> +/* LRADC_CTRL bits */ >> +#define FIRST_CONVERT_DLY(x) ((x) << 24) /* 8 bits */ >> +#define CHAN_SELECT(x) ((x) << 22) /* 2 bits */ >> +#define CONTINUE_TIME_SEL(x) ((x) << 16) /* 4 bits */ >> +#define KEY_MODE_SEL(x) ((x) << 12) /* 2 bits */ >> +#define LEVELA_B_CNT(x) ((x) << 8) /* 4 bits */ >> +#define HOLD_EN(x) ((x) << 6) >> +#define LEVELB_VOL(x) ((x) << 4) /* 2 bits */ >> +#define SAMPLE_RATE(x) ((x) << 2) /* 2 bits */ >> +#define ENABLE(x) ((x) << 0) >> + >> +/* LRADC_INTC and LRADC_INTS bits */ >> +#define CHAN1_KEYUP_IRQ BIT(12) >> +#define CHAN1_ALRDY_HOLD_IRQ BIT(11) >> +#define CHAN1_HOLD_IRQ BIT(10) >> +#define CHAN1_KEYDOWN_IRQ BIT(9) >> +#define CHAN1_DATA_IRQ BIT(8) >> +#define CHAN0_KEYUP_IRQ BIT(4) >> +#define CHAN0_ALRDY_HOLD_IRQ BIT(3) >> +#define CHAN0_HOLD_IRQ BIT(2) >> +#define CHAN0_KEYDOWN_IRQ BIT(1) >> +#define CHAN0_DATA_IRQ BIT(0) >> + >> +struct sun4i_lradc_keymap { >> + u32 voltage; >> + u32 keycode; >> +}; >> + >> +struct sun4i_lradc_data { >> + struct device *dev; >> + struct input_dev *input; >> + void __iomem *base; >> + struct regulator *vref_supply; >> + struct sun4i_lradc_keymap *chan0_map; >> + u32 chan0_map_count; >> + u32 chan0_keycode; >> + u32 vref; >> +}; >> + >> +static irqreturn_t sun4i_lradc_irq(int irq, void *dev_id) >> +{ >> + struct sun4i_lradc_data *lradc = dev_id; >> + u32 i, ints, val, voltage, diff, keycode = 0, closest = 0xffffffff; >> + >> + ints = readl(lradc->base + LRADC_INTS); >> + >> + /* >> + * lradc supports only one keypress at a time, release does not give >> + * any info as to which key was released, so we cache the keycode. >> + */ >> + if ((ints & CHAN0_KEYDOWN_IRQ) && lradc->chan0_keycode == 0) { >> + val = readl(lradc->base + LRADC_DATA0) & 0x3f; >> + voltage = val * lradc->vref / 63; >> + >> + for (i = 0; i < lradc->chan0_map_count; i++) { >> + diff = abs(lradc->chan0_map[i].voltage - voltage); >> + if (diff < closest) { >> + closest = diff; >> + keycode = lradc->chan0_map[i].keycode; >> + } >> + } >> + >> + lradc->chan0_keycode = keycode; >> + input_report_key(lradc->input, lradc->chan0_keycode, 1); >> + } >> + >> + if (ints & CHAN0_KEYUP_IRQ) { >> + input_report_key(lradc->input, lradc->chan0_keycode, 0); >> + lradc->chan0_keycode = 0; >> + } >> + >> + input_sync(lradc->input); >> + >> + writel(ints, lradc->base + LRADC_INTS); >> + >> + return IRQ_HANDLED; >> +} >> + >> +static int sun4i_lradc_open(struct input_dev *dev) >> +{ >> + struct sun4i_lradc_data *lradc = input_get_drvdata(dev); >> + int ret; >> + >> + ret = regulator_enable(lradc->vref_supply); >> + if (ret) >> + return ret; >> + >> + /* lradc Vref internally is divided by 2/3 */ >> + lradc->vref = regulator_get_voltage(lradc->vref_supply) * 2 / 3; >> + >> + /* >> + * Set sample time to 4 ms / 250 Hz. Wait 2 * 4 ms for key to >> + * stabilize on press, wait (1 + 1) * 4 ms for key release >> + */ >> + writel(FIRST_CONVERT_DLY(2) | LEVELA_B_CNT(1) | HOLD_EN(1) | >> + SAMPLE_RATE(0) | ENABLE(1), lradc->base + LRADC_CTRL); >> + >> + writel(CHAN0_KEYUP_IRQ | CHAN0_KEYDOWN_IRQ, lradc->base + LRADC_INTC); >> + >> + return 0; >> +} >> + >> +static void sun4i_lradc_close(struct input_dev *dev) >> +{ >> + struct sun4i_lradc_data *lradc = input_get_drvdata(dev); >> + >> + /* Disable lradc, leave other settings unchanged */ >> + writel(FIRST_CONVERT_DLY(2) | LEVELA_B_CNT(1) | HOLD_EN(1) | >> + SAMPLE_RATE(2), lradc->base + LRADC_CTRL); >> + writel(0, lradc->base + LRADC_INTC); >> + >> + regulator_disable(lradc->vref_supply); >> +} >> + >> +static int sun4i_lradc_probe(struct platform_device *pdev) >> +{ >> + struct sun4i_lradc_data *lradc; >> + struct device *dev = &pdev->dev; >> + struct device_node *pp, *np = dev->of_node; >> + u32 channel; >> + int i, ret; >> + >> + lradc = devm_kzalloc(dev, sizeof(struct sun4i_lradc_data), GFP_KERNEL); >> + if (!lradc) >> + return -ENOMEM; >> + >> + lradc->chan0_map_count = of_get_child_count(np); >> + lradc->chan0_map = devm_kmalloc(dev, lradc->chan0_map_count * >> + sizeof(struct sun4i_lradc_keymap), GFP_KERNEL); >> + if (!lradc->chan0_map) >> + return -ENOMEM; >> + >> + i = 0; >> + for_each_child_of_node(np, pp) { >> + struct sun4i_lradc_keymap *map = &lradc->chan0_map[i]; >> + >> + ret = of_property_read_u32(pp, "channel", &channel); >> + if (ret || channel != 0) { >> + dev_err(dev, "%s: Inval channel prop\n", pp->name); >> + return -EINVAL; >> + } >> + >> + ret = of_property_read_u32(pp, "voltage", &map->voltage); >> + if (ret) { >> + dev_err(dev, "%s: Inval voltage prop\n", pp->name); >> + return -EINVAL; >> + } >> + >> + ret = of_property_read_u32(pp, "linux,code", &map->keycode); >> + if (ret) { >> + dev_err(dev, "%s: Inval linux,code prop\n", pp->name); >> + return -EINVAL; >> + } >> + >> + i++; >> + } >> + >> + lradc->vref_supply = devm_regulator_get(dev, "vref"); >> + if (IS_ERR(lradc->vref_supply)) >> + return PTR_ERR(lradc->vref_supply); >> + >> + lradc->dev = dev; >> + lradc->input = devm_input_allocate_device(dev); >> + if (!lradc->input) >> + return -ENOMEM; >> + >> + lradc->input->name = pdev->name; >> + lradc->input->phys = "sun4i_lradc/input0"; >> + lradc->input->open = sun4i_lradc_open; >> + lradc->input->close = sun4i_lradc_close; >> + lradc->input->id.bustype = BUS_HOST; >> + lradc->input->id.vendor = 0x0001; >> + lradc->input->id.product = 0x0001; >> + lradc->input->id.version = 0x0100; >> + lradc->input->evbit[0] = BIT(EV_SYN) | BIT(EV_KEY); >> + for (i = 0; i < lradc->chan0_map_count; i++) >> + set_bit(lradc->chan0_map[i].keycode, lradc->input->keybit); >> + input_set_drvdata(lradc->input, lradc); >> + >> + lradc->base = devm_ioremap_resource(dev, >> + platform_get_resource(pdev, IORESOURCE_MEM, 0)); >> + if (IS_ERR(lradc->base)) >> + return PTR_ERR(lradc->base); >> + >> + ret = devm_request_irq(dev, platform_get_irq(pdev, 0), sun4i_lradc_irq, >> + 0, "sun4i-lradc-keys", lradc); >> + if (ret) >> + return ret; >> + >> + ret = input_register_device(lradc->input); >> + if (ret) >> + return ret; >> + >> + platform_set_drvdata(pdev, lradc); >> + return 0; >> +} >> + >> +static const struct of_device_id sun4i_lradc_of_match[] = { >> + { .compatible = "allwinner,sun4i-lradc-keys", }, >> + { /* sentinel */ } >> +}; >> +MODULE_DEVICE_TABLE(of, sun4i_lradc_of_match); >> + >> +static struct platform_driver sun4i_lradc_driver = { >> + .driver = { >> + .owner = THIS_MODULE, > > You can drop the owner field, it's already filled by > module_platform_driver. Will fix for the next version. > >> + .name = "sun4i-lradc-keys", >> + .of_match_table = of_match_ptr(sun4i_lradc_of_match), >> + }, >> + .probe = sun4i_lradc_probe, >> +}; >> + >> +module_platform_driver(sun4i_lradc_driver); >> + >> +MODULE_DESCRIPTION("Allwinner sun4i low res adc attached tablet keys driver"); >> +MODULE_AUTHOR("Hans de Goede <hdegoede@redhat.com>"); >> +MODULE_LICENSE("GPL"); >> -- >> 2.1.0 >> > > Looking good otherwise, thanks! Thanks for the review. Regards, Hans ^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH v2 2/4] ARM: dts: sun4i: Add lradc node 2014-10-21 8:24 ` Hans de Goede @ 2014-10-21 8:24 ` Hans de Goede -1 siblings, 0 replies; 28+ messages in thread From: Hans de Goede @ 2014-10-21 8:24 UTC (permalink / raw) To: Dmitry Torokhov Cc: Maxime Ripard, linux-input-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> --- arch/arm/boot/dts/sun4i-a10.dtsi | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/arm/boot/dts/sun4i-a10.dtsi b/arch/arm/boot/dts/sun4i-a10.dtsi index 380f914..49f2200 100644 --- a/arch/arm/boot/dts/sun4i-a10.dtsi +++ b/arch/arm/boot/dts/sun4i-a10.dtsi @@ -669,6 +669,13 @@ status = "disabled"; }; + lradc: lradc@01c22800 { + compatible = "allwinner,sun4i-lradc-keys"; + reg = <0x01c22800 0x100>; + interrupts = <31>; + status = "disabled"; + }; + sid: eeprom@01c23800 { compatible = "allwinner,sun4i-a10-sid"; reg = <0x01c23800 0x10>; -- 2.1.0 ^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH v2 2/4] ARM: dts: sun4i: Add lradc node @ 2014-10-21 8:24 ` Hans de Goede 0 siblings, 0 replies; 28+ messages in thread From: Hans de Goede @ 2014-10-21 8:24 UTC (permalink / raw) To: linux-arm-kernel Signed-off-by: Hans de Goede <hdegoede@redhat.com> --- arch/arm/boot/dts/sun4i-a10.dtsi | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/arm/boot/dts/sun4i-a10.dtsi b/arch/arm/boot/dts/sun4i-a10.dtsi index 380f914..49f2200 100644 --- a/arch/arm/boot/dts/sun4i-a10.dtsi +++ b/arch/arm/boot/dts/sun4i-a10.dtsi @@ -669,6 +669,13 @@ status = "disabled"; }; + lradc: lradc at 01c22800 { + compatible = "allwinner,sun4i-lradc-keys"; + reg = <0x01c22800 0x100>; + interrupts = <31>; + status = "disabled"; + }; + sid: eeprom at 01c23800 { compatible = "allwinner,sun4i-a10-sid"; reg = <0x01c23800 0x10>; -- 2.1.0 ^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH v2 3/4] ARM: dts: sun5i: Add lradc node 2014-10-21 8:24 ` Hans de Goede @ 2014-10-21 8:24 ` Hans de Goede -1 siblings, 0 replies; 28+ messages in thread From: Hans de Goede @ 2014-10-21 8:24 UTC (permalink / raw) To: Dmitry Torokhov Cc: Maxime Ripard, linux-input-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> --- arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts | 36 ++++++++++++++++++++++++ arch/arm/boot/dts/sun5i-a10s.dtsi | 7 +++++ arch/arm/boot/dts/sun5i-a13-olinuxino.dts | 36 ++++++++++++++++++++++++ arch/arm/boot/dts/sun5i-a13.dtsi | 7 +++++ 4 files changed, 86 insertions(+) diff --git a/arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts b/arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts index ea9519d..84df85e 100644 --- a/arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts +++ b/arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts @@ -14,6 +14,7 @@ /dts-v1/; /include/ "sun5i-a10s.dtsi" /include/ "sunxi-common-regulators.dtsi" +#include <dt-bindings/input/input.h> / { model = "Olimex A10s-Olinuxino Micro"; @@ -98,6 +99,41 @@ }; }; + lradc: lradc@01c22800 { + vref-supply = <®_vcc3v0>; + status = "okay"; + button@19 { + label = "Volume Up"; + linux,code = <KEY_VOLUMEUP>; + channel = <0>; + voltage = <191274>; + }; + 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>; + }; + }; + uart0: serial@01c28000 { pinctrl-names = "default"; pinctrl-0 = <&uart0_pins_a>; diff --git a/arch/arm/boot/dts/sun5i-a10s.dtsi b/arch/arm/boot/dts/sun5i-a10s.dtsi index 531272c..a73cec4 100644 --- a/arch/arm/boot/dts/sun5i-a10s.dtsi +++ b/arch/arm/boot/dts/sun5i-a10s.dtsi @@ -520,6 +520,13 @@ reg = <0x01c20c90 0x10>; }; + lradc: lradc@01c22800 { + compatible = "allwinner,sun4i-lradc-keys"; + reg = <0x01c22800 0x100>; + interrupts = <31>; + status = "disabled"; + }; + sid: eeprom@01c23800 { compatible = "allwinner,sun4i-a10-sid"; reg = <0x01c23800 0x10>; diff --git a/arch/arm/boot/dts/sun5i-a13-olinuxino.dts b/arch/arm/boot/dts/sun5i-a13-olinuxino.dts index 429994e..11ecb36 100644 --- a/arch/arm/boot/dts/sun5i-a13-olinuxino.dts +++ b/arch/arm/boot/dts/sun5i-a13-olinuxino.dts @@ -14,6 +14,7 @@ /dts-v1/; /include/ "sun5i-a13.dtsi" /include/ "sunxi-common-regulators.dtsi" +#include <dt-bindings/input/input.h> / { model = "Olimex A13-Olinuxino"; @@ -66,6 +67,41 @@ }; }; + lradc: lradc@01c22800 { + vref-supply = <®_vcc3v0>; + status = "okay"; + button@19 { + label = "Volume Up"; + linux,code = <KEY_VOLUMEUP>; + channel = <0>; + voltage = <191274>; + }; + 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>; + }; + }; + uart1: serial@01c28400 { pinctrl-names = "default"; pinctrl-0 = <&uart1_pins_b>; diff --git a/arch/arm/boot/dts/sun5i-a13.dtsi b/arch/arm/boot/dts/sun5i-a13.dtsi index b131068..528d0d6 100644 --- a/arch/arm/boot/dts/sun5i-a13.dtsi +++ b/arch/arm/boot/dts/sun5i-a13.dtsi @@ -468,6 +468,13 @@ reg = <0x01c20c90 0x10>; }; + lradc: lradc@01c22800 { + compatible = "allwinner,sun4i-lradc-keys"; + reg = <0x01c22800 0x100>; + interrupts = <31>; + status = "disabled"; + }; + sid: eeprom@01c23800 { compatible = "allwinner,sun4i-a10-sid"; reg = <0x01c23800 0x10>; -- 2.1.0 ^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH v2 3/4] ARM: dts: sun5i: Add lradc node @ 2014-10-21 8:24 ` Hans de Goede 0 siblings, 0 replies; 28+ messages in thread From: Hans de Goede @ 2014-10-21 8:24 UTC (permalink / raw) To: linux-arm-kernel Signed-off-by: Hans de Goede <hdegoede@redhat.com> --- arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts | 36 ++++++++++++++++++++++++ arch/arm/boot/dts/sun5i-a10s.dtsi | 7 +++++ arch/arm/boot/dts/sun5i-a13-olinuxino.dts | 36 ++++++++++++++++++++++++ arch/arm/boot/dts/sun5i-a13.dtsi | 7 +++++ 4 files changed, 86 insertions(+) diff --git a/arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts b/arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts index ea9519d..84df85e 100644 --- a/arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts +++ b/arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts @@ -14,6 +14,7 @@ /dts-v1/; /include/ "sun5i-a10s.dtsi" /include/ "sunxi-common-regulators.dtsi" +#include <dt-bindings/input/input.h> / { model = "Olimex A10s-Olinuxino Micro"; @@ -98,6 +99,41 @@ }; }; + lradc: lradc at 01c22800 { + vref-supply = <®_vcc3v0>; + status = "okay"; + button at 19 { + label = "Volume Up"; + linux,code = <KEY_VOLUMEUP>; + channel = <0>; + voltage = <191274>; + }; + button at 39 { + label = "Volume Down"; + linux,code = <KEY_VOLUMEDOWN>; + channel = <0>; + voltage = <392644>; + }; + button at 60 { + label = "Menu"; + linux,code = <KEY_MENU>; + channel = <0>; + voltage = <601151>; + }; + button at 80 { + label = "Enter"; + linux,code = <KEY_ENTER>; + channel = <0>; + voltage = <795090>; + }; + button at 98 { + label = "Home"; + linux,code = <KEY_HOME>; + channel = <0>; + voltage = <987387>; + }; + }; + uart0: serial at 01c28000 { pinctrl-names = "default"; pinctrl-0 = <&uart0_pins_a>; diff --git a/arch/arm/boot/dts/sun5i-a10s.dtsi b/arch/arm/boot/dts/sun5i-a10s.dtsi index 531272c..a73cec4 100644 --- a/arch/arm/boot/dts/sun5i-a10s.dtsi +++ b/arch/arm/boot/dts/sun5i-a10s.dtsi @@ -520,6 +520,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-a10-sid"; reg = <0x01c23800 0x10>; diff --git a/arch/arm/boot/dts/sun5i-a13-olinuxino.dts b/arch/arm/boot/dts/sun5i-a13-olinuxino.dts index 429994e..11ecb36 100644 --- a/arch/arm/boot/dts/sun5i-a13-olinuxino.dts +++ b/arch/arm/boot/dts/sun5i-a13-olinuxino.dts @@ -14,6 +14,7 @@ /dts-v1/; /include/ "sun5i-a13.dtsi" /include/ "sunxi-common-regulators.dtsi" +#include <dt-bindings/input/input.h> / { model = "Olimex A13-Olinuxino"; @@ -66,6 +67,41 @@ }; }; + lradc: lradc at 01c22800 { + vref-supply = <®_vcc3v0>; + status = "okay"; + button at 19 { + label = "Volume Up"; + linux,code = <KEY_VOLUMEUP>; + channel = <0>; + voltage = <191274>; + }; + button at 39 { + label = "Volume Down"; + linux,code = <KEY_VOLUMEDOWN>; + channel = <0>; + voltage = <392644>; + }; + button at 60 { + label = "Menu"; + linux,code = <KEY_MENU>; + channel = <0>; + voltage = <601151>; + }; + button at 80 { + label = "Enter"; + linux,code = <KEY_ENTER>; + channel = <0>; + voltage = <795090>; + }; + button at 98 { + label = "Home"; + linux,code = <KEY_HOME>; + channel = <0>; + voltage = <987387>; + }; + }; + uart1: serial at 01c28400 { pinctrl-names = "default"; pinctrl-0 = <&uart1_pins_b>; diff --git a/arch/arm/boot/dts/sun5i-a13.dtsi b/arch/arm/boot/dts/sun5i-a13.dtsi index b131068..528d0d6 100644 --- a/arch/arm/boot/dts/sun5i-a13.dtsi +++ b/arch/arm/boot/dts/sun5i-a13.dtsi @@ -468,6 +468,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-a10-sid"; reg = <0x01c23800 0x10>; -- 2.1.0 ^ permalink raw reply related [flat|nested] 28+ messages in thread
[parent not found: <1413879890-7254-4-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>]
* Re: [PATCH v2 3/4] ARM: dts: sun5i: Add lradc node 2014-10-21 8:24 ` Hans de Goede @ 2014-10-21 16:21 ` Dmitry Torokhov -1 siblings, 0 replies; 28+ messages in thread From: Dmitry Torokhov @ 2014-10-21 16:21 UTC (permalink / raw) To: Hans de Goede Cc: Maxime Ripard, linux-input-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw Hi Hans, On Tue, Oct 21, 2014 at 10:24:49AM +0200, Hans de Goede wrote: > + button@98 { > + label = "Home"; > + linux,code = <KEY_HOME>; I do not think you really want KEY_HOME (go to the beginning of the line) here, KEY_HOMEPAGE or similar would suit better. > + channel = <0>; > + voltage = <987387>; > + }; > + }; Thanks. -- Dmitry ^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH v2 3/4] ARM: dts: sun5i: Add lradc node @ 2014-10-21 16:21 ` Dmitry Torokhov 0 siblings, 0 replies; 28+ messages in thread From: Dmitry Torokhov @ 2014-10-21 16:21 UTC (permalink / raw) To: linux-arm-kernel Hi Hans, On Tue, Oct 21, 2014 at 10:24:49AM +0200, Hans de Goede wrote: > + button at 98 { > + label = "Home"; > + linux,code = <KEY_HOME>; I do not think you really want KEY_HOME (go to the beginning of the line) here, KEY_HOMEPAGE or similar would suit better. > + channel = <0>; > + voltage = <987387>; > + }; > + }; Thanks. -- Dmitry ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v2 3/4] ARM: dts: sun5i: Add lradc node 2014-10-21 16:21 ` Dmitry Torokhov @ 2014-10-21 20:29 ` Hans de Goede -1 siblings, 0 replies; 28+ messages in thread From: Hans de Goede @ 2014-10-21 20:29 UTC (permalink / raw) To: Dmitry Torokhov Cc: Maxime Ripard, linux-input-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw Hi, On 10/21/2014 06:21 PM, Dmitry Torokhov wrote: > Hi Hans, > > On Tue, Oct 21, 2014 at 10:24:49AM +0200, Hans de Goede wrote: >> + button@98 { >> + label = "Home"; >> + linux,code = <KEY_HOME>; > > I do not think you really want KEY_HOME (go to the beginning of the > line) here, KEY_HOMEPAGE or similar would suit better. I can understand where you're coming from, but KEY_HOME is what these keys typically send under android, and what android expects them to send... Not sure if that is a good argument to keep it as KEY_HOME though. Please let me know which way you want this key to be mapped, and I'll update it for the next version. Regards, Hans ^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH v2 3/4] ARM: dts: sun5i: Add lradc node @ 2014-10-21 20:29 ` Hans de Goede 0 siblings, 0 replies; 28+ messages in thread From: Hans de Goede @ 2014-10-21 20:29 UTC (permalink / raw) To: linux-arm-kernel Hi, On 10/21/2014 06:21 PM, Dmitry Torokhov wrote: > Hi Hans, > > On Tue, Oct 21, 2014 at 10:24:49AM +0200, Hans de Goede wrote: >> + button at 98 { >> + label = "Home"; >> + linux,code = <KEY_HOME>; > > I do not think you really want KEY_HOME (go to the beginning of the > line) here, KEY_HOMEPAGE or similar would suit better. I can understand where you're coming from, but KEY_HOME is what these keys typically send under android, and what android expects them to send... Not sure if that is a good argument to keep it as KEY_HOME though. Please let me know which way you want this key to be mapped, and I'll update it for the next version. Regards, Hans ^ permalink raw reply [flat|nested] 28+ messages in thread
[parent not found: <5446C23F.3040604-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>]
* Re: Re: [PATCH v2 3/4] ARM: dts: sun5i: Add lradc node 2014-10-21 20:29 ` Hans de Goede @ 2014-10-22 10:42 ` Hans de Goede -1 siblings, 0 replies; 28+ messages in thread From: Hans de Goede @ 2014-10-22 10:42 UTC (permalink / raw) To: Dmitry Torokhov Cc: Maxime Ripard, linux-input-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw Hi, On 10/21/2014 10:29 PM, Hans de Goede wrote: > Hi, > > On 10/21/2014 06:21 PM, Dmitry Torokhov wrote: >> Hi Hans, >> >> On Tue, Oct 21, 2014 at 10:24:49AM +0200, Hans de Goede wrote: >>> + button@98 { >>> + label = "Home"; >>> + linux,code = <KEY_HOME>; >> >> I do not think you really want KEY_HOME (go to the beginning of the >> line) here, KEY_HOMEPAGE or similar would suit better. > > I can understand where you're coming from, but KEY_HOME is what these > keys typically send under android, and what android expects them to > send... > > Not sure if that is a good argument to keep it as KEY_HOME though. > > Please let me know which way you want this key to be mapped, and > I'll update it for the next version. Sleeping a night on this I fully agree that what android is doing / expecting here is just plain wrong, so I'll change this to KEY_HOMEPAGE when I respin the set. Regards, Hans ^ permalink raw reply [flat|nested] 28+ messages in thread
* [linux-sunxi] Re: [PATCH v2 3/4] ARM: dts: sun5i: Add lradc node @ 2014-10-22 10:42 ` Hans de Goede 0 siblings, 0 replies; 28+ messages in thread From: Hans de Goede @ 2014-10-22 10:42 UTC (permalink / raw) To: linux-arm-kernel Hi, On 10/21/2014 10:29 PM, Hans de Goede wrote: > Hi, > > On 10/21/2014 06:21 PM, Dmitry Torokhov wrote: >> Hi Hans, >> >> On Tue, Oct 21, 2014 at 10:24:49AM +0200, Hans de Goede wrote: >>> + button at 98 { >>> + label = "Home"; >>> + linux,code = <KEY_HOME>; >> >> I do not think you really want KEY_HOME (go to the beginning of the >> line) here, KEY_HOMEPAGE or similar would suit better. > > I can understand where you're coming from, but KEY_HOME is what these > keys typically send under android, and what android expects them to > send... > > Not sure if that is a good argument to keep it as KEY_HOME though. > > Please let me know which way you want this key to be mapped, and > I'll update it for the next version. Sleeping a night on this I fully agree that what android is doing / expecting here is just plain wrong, so I'll change this to KEY_HOMEPAGE when I respin the set. Regards, Hans ^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH v2 4/4] ARM: dts: sun7i: Add lradc node 2014-10-21 8:24 ` Hans de Goede @ 2014-10-21 8:24 ` Hans de Goede -1 siblings, 0 replies; 28+ messages in thread From: Hans de Goede @ 2014-10-21 8:24 UTC (permalink / raw) To: Dmitry Torokhov Cc: Maxime Ripard, linux-input-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> --- arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts | 48 +++++++++++++++++++++++++ arch/arm/boot/dts/sun7i-a20.dtsi | 7 ++++ 2 files changed, 55 insertions(+) diff --git a/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts b/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts index 9d669cdf..85e7194 100644 --- a/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts +++ b/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts @@ -14,6 +14,7 @@ /dts-v1/; /include/ "sun7i-a20.dtsi" /include/ "sunxi-common-regulators.dtsi" +#include <dt-bindings/input/input.h> / { model = "Olimex A20-Olinuxino Micro"; @@ -100,6 +101,53 @@ }; }; + lradc: lradc@01c22800 { + vref-supply = <®_vcc3v0>; + status = "okay"; + button@19 { + label = "Volume Up"; + linux,code = <KEY_VOLUMEUP>; + channel = <0>; + voltage = <191274>; + }; + 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_SEARCH>; + channel = <0>; + voltage = <795090>; + }; + button@98 { + label = "Home"; + linux,code = <KEY_HOME>; + channel = <0>; + voltage = <987387>; + }; + button@118 { + label = "Home"; + linux,code = <KEY_ESC>; + channel = <0>; + voltage = <1184678>; + }; + button@139 { + label = "Home"; + linux,code = <KEY_ENTER>; + channel = <0>; + voltage = <1398804>; + }; + }; + uart0: serial@01c28000 { pinctrl-names = "default"; pinctrl-0 = <&uart0_pins_a>; diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi b/arch/arm/boot/dts/sun7i-a20.dtsi index f0a75c6..219cd57 100644 --- a/arch/arm/boot/dts/sun7i-a20.dtsi +++ b/arch/arm/boot/dts/sun7i-a20.dtsi @@ -911,6 +911,13 @@ status = "disabled"; }; + lradc: lradc@01c22800 { + compatible = "allwinner,sun4i-lradc-keys"; + reg = <0x01c22800 0x100>; + interrupts = <0 31 4>; + status = "disabled"; + }; + sid: eeprom@01c23800 { compatible = "allwinner,sun7i-a20-sid"; reg = <0x01c23800 0x200>; -- 2.1.0 ^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH v2 4/4] ARM: dts: sun7i: Add lradc node @ 2014-10-21 8:24 ` Hans de Goede 0 siblings, 0 replies; 28+ messages in thread From: Hans de Goede @ 2014-10-21 8:24 UTC (permalink / raw) To: linux-arm-kernel Signed-off-by: Hans de Goede <hdegoede@redhat.com> --- arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts | 48 +++++++++++++++++++++++++ arch/arm/boot/dts/sun7i-a20.dtsi | 7 ++++ 2 files changed, 55 insertions(+) diff --git a/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts b/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts index 9d669cdf..85e7194 100644 --- a/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts +++ b/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts @@ -14,6 +14,7 @@ /dts-v1/; /include/ "sun7i-a20.dtsi" /include/ "sunxi-common-regulators.dtsi" +#include <dt-bindings/input/input.h> / { model = "Olimex A20-Olinuxino Micro"; @@ -100,6 +101,53 @@ }; }; + lradc: lradc at 01c22800 { + vref-supply = <®_vcc3v0>; + status = "okay"; + button at 19 { + label = "Volume Up"; + linux,code = <KEY_VOLUMEUP>; + channel = <0>; + voltage = <191274>; + }; + button at 39 { + label = "Volume Down"; + linux,code = <KEY_VOLUMEDOWN>; + channel = <0>; + voltage = <392644>; + }; + button at 60 { + label = "Menu"; + linux,code = <KEY_MENU>; + channel = <0>; + voltage = <601151>; + }; + button at 80 { + label = "Enter"; + linux,code = <KEY_SEARCH>; + channel = <0>; + voltage = <795090>; + }; + button at 98 { + label = "Home"; + linux,code = <KEY_HOME>; + channel = <0>; + voltage = <987387>; + }; + button at 118 { + label = "Home"; + linux,code = <KEY_ESC>; + channel = <0>; + voltage = <1184678>; + }; + button at 139 { + label = "Home"; + linux,code = <KEY_ENTER>; + channel = <0>; + voltage = <1398804>; + }; + }; + uart0: serial at 01c28000 { pinctrl-names = "default"; pinctrl-0 = <&uart0_pins_a>; diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi b/arch/arm/boot/dts/sun7i-a20.dtsi index f0a75c6..219cd57 100644 --- a/arch/arm/boot/dts/sun7i-a20.dtsi +++ b/arch/arm/boot/dts/sun7i-a20.dtsi @@ -911,6 +911,13 @@ status = "disabled"; }; + 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>; -- 2.1.0 ^ permalink raw reply related [flat|nested] 28+ messages in thread
[parent not found: <1413879890-7254-5-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>]
* Re: [PATCH v2 4/4] ARM: dts: sun7i: Add lradc node 2014-10-21 8:24 ` Hans de Goede @ 2014-10-22 8:38 ` Maxime Ripard -1 siblings, 0 replies; 28+ messages in thread From: Maxime Ripard @ 2014-10-22 8:38 UTC (permalink / raw) To: Hans de Goede Cc: Dmitry Torokhov, linux-input-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw [-- Attachment #1: Type: text/plain, Size: 1120 bytes --] Hi Hans, On Tue, Oct 21, 2014 at 10:24:50AM +0200, Hans de Goede wrote: > Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> > --- > arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts | 48 +++++++++++++++++++++++++ > arch/arm/boot/dts/sun7i-a20.dtsi | 7 ++++ > 2 files changed, 55 insertions(+) > > diff --git a/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts b/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts > index 9d669cdf..85e7194 100644 > --- a/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts > +++ b/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts > @@ -14,6 +14,7 @@ > /dts-v1/; > /include/ "sun7i-a20.dtsi" > /include/ "sunxi-common-regulators.dtsi" > +#include <dt-bindings/input/input.h> I'm just wondering... Weren't we supposed to switch all includes to the preprocessor syntax in such a case? Maybe to handle the case were the DTSIs would have to use some preprocessors macros that wouldn't be expanded in this case? -- Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 819 bytes --] ^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH v2 4/4] ARM: dts: sun7i: Add lradc node @ 2014-10-22 8:38 ` Maxime Ripard 0 siblings, 0 replies; 28+ messages in thread From: Maxime Ripard @ 2014-10-22 8:38 UTC (permalink / raw) To: linux-arm-kernel Hi Hans, On Tue, Oct 21, 2014 at 10:24:50AM +0200, Hans de Goede wrote: > Signed-off-by: Hans de Goede <hdegoede@redhat.com> > --- > arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts | 48 +++++++++++++++++++++++++ > arch/arm/boot/dts/sun7i-a20.dtsi | 7 ++++ > 2 files changed, 55 insertions(+) > > diff --git a/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts b/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts > index 9d669cdf..85e7194 100644 > --- a/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts > +++ b/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts > @@ -14,6 +14,7 @@ > /dts-v1/; > /include/ "sun7i-a20.dtsi" > /include/ "sunxi-common-regulators.dtsi" > +#include <dt-bindings/input/input.h> I'm just wondering... Weren't we supposed to switch all includes to the preprocessor syntax in such a case? Maybe to handle the case were the DTSIs would have to use some preprocessors macros that wouldn't be expanded in this case? -- 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/de46738a/attachment.sig> ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Re: [PATCH v2 4/4] ARM: dts: sun7i: Add lradc node 2014-10-22 8:38 ` Maxime Ripard @ 2014-10-22 8:46 ` Hans de Goede -1 siblings, 0 replies; 28+ messages in thread From: Hans de Goede @ 2014-10-22 8:46 UTC (permalink / raw) To: Maxime Ripard Cc: Dmitry Torokhov, linux-input-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw Hi, On 10/22/2014 10:38 AM, Maxime Ripard wrote: > Hi Hans, > > On Tue, Oct 21, 2014 at 10:24:50AM +0200, Hans de Goede wrote: >> Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> >> --- >> arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts | 48 +++++++++++++++++++++++++ >> arch/arm/boot/dts/sun7i-a20.dtsi | 7 ++++ >> 2 files changed, 55 insertions(+) >> >> diff --git a/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts b/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts >> index 9d669cdf..85e7194 100644 >> --- a/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts >> +++ b/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts >> @@ -14,6 +14,7 @@ >> /dts-v1/; >> /include/ "sun7i-a20.dtsi" >> /include/ "sunxi-common-regulators.dtsi" >> +#include <dt-bindings/input/input.h> > > I'm just wondering... Weren't we supposed to switch all includes to > the preprocessor syntax in such a case? I've just checked other in tree users of dt-bindings/input/input.h and you seem to be right, I will fix this for the next version. Regards, Hans ^ permalink raw reply [flat|nested] 28+ messages in thread
* [linux-sunxi] Re: [PATCH v2 4/4] ARM: dts: sun7i: Add lradc node @ 2014-10-22 8:46 ` Hans de Goede 0 siblings, 0 replies; 28+ messages in thread From: Hans de Goede @ 2014-10-22 8:46 UTC (permalink / raw) To: linux-arm-kernel Hi, On 10/22/2014 10:38 AM, Maxime Ripard wrote: > Hi Hans, > > On Tue, Oct 21, 2014 at 10:24:50AM +0200, Hans de Goede wrote: >> Signed-off-by: Hans de Goede <hdegoede@redhat.com> >> --- >> arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts | 48 +++++++++++++++++++++++++ >> arch/arm/boot/dts/sun7i-a20.dtsi | 7 ++++ >> 2 files changed, 55 insertions(+) >> >> diff --git a/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts b/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts >> index 9d669cdf..85e7194 100644 >> --- a/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts >> +++ b/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts >> @@ -14,6 +14,7 @@ >> /dts-v1/; >> /include/ "sun7i-a20.dtsi" >> /include/ "sunxi-common-regulators.dtsi" >> +#include <dt-bindings/input/input.h> > > I'm just wondering... Weren't we supposed to switch all includes to > the preprocessor syntax in such a case? I've just checked other in tree users of dt-bindings/input/input.h and you seem to be right, I will fix this for the next version. Regards, Hans ^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH v2 0/4] input: Add new sun4i-lradc-keys driver @ 2014-01-02 9:58 ` Hans de Goede 0 siblings, 0 replies; 28+ messages in thread From: Hans de Goede @ 2014-01-02 9:58 UTC (permalink / raw) To: Dmitry Torokhov Cc: linux-input-u79uwXL29TY76Z2rM5mHXA, Maxime Ripard, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw 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 ^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH v2 0/4] input: Add new sun4i-lradc-keys driver @ 2014-01-02 9:58 ` Hans de Goede 0 siblings, 0 replies; 28+ messages in thread From: Hans de Goede @ 2014-01-02 9:58 UTC (permalink / raw) To: linux-arm-kernel 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 ^ permalink raw reply [flat|nested] 28+ messages in thread
[parent not found: <1388656707-16181-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>]
* Re: [PATCH v2 0/4] input: Add new sun4i-lradc-keys driver [not found] ` <1388656707-16181-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> @ 2014-09-01 13:47 ` Chen-Yu Tsai [not found] ` <CAGb2v66VZqpHyghs5xn=RdDUVU=2PxFw5BJ-R5Xpsk-nfoDM0Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 28+ messages in thread From: Chen-Yu Tsai @ 2014-09-01 13:47 UTC (permalink / raw) To: Hans De Goede Cc: Dmitry Torokhov, linux-input-u79uwXL29TY76Z2rM5mHXA, Maxime Ripard, linux-arm-kernel, linux-sunxi 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 On Thu, Jan 2, 2014 at 5:58 PM, Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote: > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit https://groups.google.com/groups/opt_out. ^ permalink raw reply [flat|nested] 28+ messages in thread
[parent not found: <CAGb2v66VZqpHyghs5xn=RdDUVU=2PxFw5BJ-R5Xpsk-nfoDM0Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: [PATCH v2 0/4] input: Add new sun4i-lradc-keys driver [not found] ` <CAGb2v66VZqpHyghs5xn=RdDUVU=2PxFw5BJ-R5Xpsk-nfoDM0Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2014-09-01 13:53 ` Hans de Goede 0 siblings, 0 replies; 28+ messages in thread From: Hans de Goede @ 2014-09-01 13:53 UTC (permalink / raw) To: Chen-Yu Tsai Cc: Dmitry Torokhov, linux-input-u79uwXL29TY76Z2rM5mHXA, Maxime Ripard, linux-arm-kernel, linux-sunxi Hi, On 09/01/2014 03:47 PM, Chen-Yu Tsai wrote: > 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 ^ permalink raw reply [flat|nested] 28+ messages in thread
end of thread, other threads:[~2014-10-22 10:45 UTC | newest] Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2014-10-21 8:24 [PATCH v2 0/4] input: Add new sun4i-lradc-keys driver Hans de Goede 2014-10-21 8:24 ` Hans de Goede [not found] ` <1413879890-7254-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> 2014-10-21 8:24 ` [PATCH v2 1/4] " Hans de Goede 2014-10-21 8:24 ` Hans de Goede [not found] ` <1413879890-7254-2-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> 2014-10-21 17:04 ` Maxime Ripard 2014-10-21 17:04 ` Maxime Ripard 2014-10-22 10:45 ` Hans de Goede 2014-10-22 10:45 ` Hans de Goede 2014-10-21 8:24 ` [PATCH v2 2/4] ARM: dts: sun4i: Add lradc node Hans de Goede 2014-10-21 8:24 ` Hans de Goede 2014-10-21 8:24 ` [PATCH v2 3/4] ARM: dts: sun5i: " Hans de Goede 2014-10-21 8:24 ` Hans de Goede [not found] ` <1413879890-7254-4-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> 2014-10-21 16:21 ` Dmitry Torokhov 2014-10-21 16:21 ` Dmitry Torokhov 2014-10-21 20:29 ` Hans de Goede 2014-10-21 20:29 ` Hans de Goede [not found] ` <5446C23F.3040604-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> 2014-10-22 10:42 ` Hans de Goede 2014-10-22 10:42 ` [linux-sunxi] " Hans de Goede 2014-10-21 8:24 ` [PATCH v2 4/4] ARM: dts: sun7i: " Hans de Goede 2014-10-21 8:24 ` Hans de Goede [not found] ` <1413879890-7254-5-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> 2014-10-22 8:38 ` Maxime Ripard 2014-10-22 8:38 ` Maxime Ripard 2014-10-22 8:46 ` Hans de Goede 2014-10-22 8:46 ` [linux-sunxi] " Hans de Goede -- strict thread matches above, loose matches on Subject: below -- 2014-01-02 9:58 [PATCH v2 0/4] input: Add new sun4i-lradc-keys driver Hans de Goede 2014-01-02 9:58 ` Hans de Goede [not found] ` <1388656707-16181-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> 2014-09-01 13:47 ` Chen-Yu Tsai [not found] ` <CAGb2v66VZqpHyghs5xn=RdDUVU=2PxFw5BJ-R5Xpsk-nfoDM0Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2014-09-01 13:53 ` Hans de Goede
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.