* Re: [PATCH v2 3/4] ARM: dts: sun5i: Add lradc node
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
In-Reply-To: <20141021162159.GC8609@dtor-ws>
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
* Re: [PATCH] hid: Add mapping for special keys on compaq ku 0133 keyboard
From: Hans de Goede @ 2014-10-21 20:45 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input
In-Reply-To: <20140812233530.GA9498@core.coreip.homeip.net>
Hi,
On 08/13/2014 01:35 AM, Dmitry Torokhov wrote:
> On Wed, Aug 13, 2014 at 01:14:50AM +0200, Hans de Goede wrote:
>> The compaq ku 0133 keyboard has 8 special keys at the top:
>> http://lackof.org/taggart/hacking/keyboard/cpqwireless.jpg
>>
>> 3 of these use standard HID usage codes from the consumer page, the 5
>> others use part of the reserved 0x07 - 0x1f range.
>>
>> This commit adds mapping for this keyboard for these reserved codes, making
>> the other 5 keys work.
>
> Can't we just load the proper keymap through udev without writing yet another
> kernel driver?
A valid question, and I agree that in this case where no special handling is
necessary, that would be better. So I've just tried this, but this does not
work, because hid-input.c chooses to ignore unknown usage codes in the
consumer page, rather then map them to KEY_UNKNOWN, making it impossible
to remap them through udev/hwdb later.
I've written a patch to fix this + a hwdb patch, which seems like a better
way to deal with this then my original patch introducing a compaq usb hid kernel
driver esp. for this.
Regards,
Hans
^ permalink raw reply
* [PATCH] hid-input: Map unknown consumer page codes to KEY_UNKNOWN
From: Hans de Goede @ 2014-10-21 21:00 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input, Hans de Goede
Currently unknown consumer page codes are ignored, which means that they
cannot later be mapped from userspace using udev / hwdb. Map them to
KEY_UNKNOWN, so that userspace can remap them for keyboards which
make up their own consumer page codes.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/hid/hid-input.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index 2619f7f..e25c003 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -856,7 +856,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
case 0x28b: map_key_clear(KEY_FORWARDMAIL); break;
case 0x28c: map_key_clear(KEY_SEND); break;
- default: goto ignore;
+ default: map_key(KEY_UNKNOWN);
}
break;
--
2.1.0
^ permalink raw reply related
* Re: [PATCH] hid-input: Map unknown consumer page codes to KEY_UNKNOWN
From: Hans de Goede @ 2014-10-21 21:07 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input
In-Reply-To: <1413925206-3458-1-git-send-email-hdegoede@redhat.com>
Hoi,
On 10/21/2014 11:00 PM, Hans de Goede wrote:
> Currently unknown consumer page codes are ignored, which means that they
> cannot later be mapped from userspace using udev / hwdb. Map them to
> KEY_UNKNOWN, so that userspace can remap them for keyboards which
> make up their own consumer page codes.
>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
> drivers/hid/hid-input.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
> index 2619f7f..e25c003 100644
> --- a/drivers/hid/hid-input.c
> +++ b/drivers/hid/hid-input.c
> @@ -856,7 +856,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
> case 0x28b: map_key_clear(KEY_FORWARDMAIL); break;
> case 0x28c: map_key_clear(KEY_SEND); break;
>
> - default: goto ignore;
> + default: map_key(KEY_UNKNOWN);
Erm, this needs to be map_key_clear, please ignore. I'll send a v2 with this fixed.
Regards,
Hans
^ permalink raw reply
* [PATCH v2] hid-input: Map unknown consumer page codes to KEY_UNKNOWN
From: Hans de Goede @ 2014-10-21 21:11 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input, Hans de Goede
Currently unknown consumer page codes are ignored, which means that they
cannot later be mapped from userspace using udev / hwdb. Map them to
KEY_UNKNOWN, so that userspace can remap them for keyboards which
make up their own consumer page codes.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
--
Changes in v2: Use key_map_clear rather then key_map
---
drivers/hid/hid-input.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index 2619f7f..a6e33d3 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -856,7 +856,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
case 0x28b: map_key_clear(KEY_FORWARDMAIL); break;
case 0x28c: map_key_clear(KEY_SEND); break;
- default: goto ignore;
+ default: map_key_clear(KEY_UNKNOWN);
}
break;
--
2.1.0
^ permalink raw reply related
* Re: [PATCH v2] hid-input: Map unknown consumer page codes to KEY_UNKNOWN
From: Dmitry Torokhov @ 2014-10-21 21:55 UTC (permalink / raw)
To: Hans de Goede; +Cc: linux-input
In-Reply-To: <1413925860-3441-1-git-send-email-hdegoede@redhat.com>
On Tue, Oct 21, 2014 at 11:11:00PM +0200, Hans de Goede wrote:
> Currently unknown consumer page codes are ignored, which means that they
> cannot later be mapped from userspace using udev / hwdb. Map them to
> KEY_UNKNOWN, so that userspace can remap them for keyboards which
> make up their own consumer page codes.
>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
I think this makes sense. Thanks Hans.
>
> --
> Changes in v2: Use key_map_clear rather then key_map
> ---
> drivers/hid/hid-input.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
> index 2619f7f..a6e33d3 100644
> --- a/drivers/hid/hid-input.c
> +++ b/drivers/hid/hid-input.c
> @@ -856,7 +856,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
> case 0x28b: map_key_clear(KEY_FORWARDMAIL); break;
> case 0x28c: map_key_clear(KEY_SEND); break;
>
> - default: goto ignore;
> + default: map_key_clear(KEY_UNKNOWN);
> }
> break;
>
> --
> 2.1.0
>
--
Dmitry
^ permalink raw reply
* Re: Problems with Wacom Intuos PT M (CTH680) on FreeBSD
From: Dmitry Torokhov @ 2014-10-21 22:33 UTC (permalink / raw)
To: Denis Akiyakov; +Cc: linux-input
In-Reply-To: <54424770.9090600@gmail.com>
Hi Denis,
On Sat, Oct 18, 2014 at 05:56:48PM +0700, Denis Akiyakov wrote:
> Hello,
>
> I'm using FreeBSD 10.1 and FreeBSD use webcamd witch contain linux
> wacom driver to provide wacom tablets support. More info here:
> http://www.selasky.org/hans_petter/video4bsd/ or
> http://www.freshports.org/multimedia/webcamd/
>
> I've got latest version of webcamd and Wacom device CTH680, but
> device isn't working correct.
Have you tried the device with Linux instead of FreeBSD? If it works in
Linux that means that the port of linux drivers to BSD is to blame and
you need to contact its authors, otherwise we need to adjust wacom
driver in kernel for this device.
Thanks.
--
Dmitry
^ permalink raw reply
* Re: [PATCH v7 0/6] mfd: AXP20x: Add support for AXP202 and AXP209
From: Bruno Prémont @ 2014-10-22 6:28 UTC (permalink / raw)
To: Carlo Caione, maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8
Cc: lee.jones-QSEj5FYQhm4dnm+yROfE0A,
boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
hdegoede-H+wXaHxf7aLQT0dZR+AlfA,
dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
linux-input-u79uwXL29TY76Z2rM5mHXA,
linux-doc-u79uwXL29TY76Z2rM5mHXA,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw
In-Reply-To: <1404066237-20234-1-git-send-email-carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
On Sun, 29 Jun 2014 20:23:51 +0200 Carlo Caione wrote:
> During the merging of v6 several patches were left out. This v7 comprises
> all the patches that are still pending.
Any progress on this or reason why these are stuck?
> //--
>
> AXP209 and AXP202 are the PMUs (Power Management Unit) used by A10, A13
> and A20 SoCs and developed by X-Powers, a sister company of Allwinner.
> AXP20x comprises an adaptive USB-Compatible PWM charger, 2 BUCK DC-DC
> converters, 5 LDOs, multiple 12-bit ADCs of voltage, current and temperature
> as well as 4 configurable GPIOs.
>
> This set of patches introduces the core driver and support for two different
> subsystems:
> - Regulators
> - PEK (Power Enable Key)
>
> Changes since v1:
>
> - Added a new standalone patch for defconfig
>
> - MFD core:
> * Removed axp,system-power-controller property
>
> - Bindings documentation:
> * Corrected description for dcdc-workmode property
> * Removed unused axp20x-pek compatible
>
> - Input misc PEK driver:
> * Fixed seconds in lower case
>
> - Regulators subsystem:
> * Fixed axp20x_set_suspend_voltage()
> * Switched to using multi-bit control for regulators
> * When "regulators" node is not found driver doesn't quit
> * Driver is now using devm_regulator_register()
> * Added module_platform_driver() instead of subsys_initcall()
>
> - DT:
> * Added new DTSI for AXP209
> * Added support for cubietruck and olinuxino-micro
>
> Changes since v2:
>
> - Added a new patch for multi_v7_defconfig to enable MFD core
> and subsystems
>
> - DT:
> * Dropped axp,system-power-controller property from DTS
> * Moved compatible and interrupt-related properties from the
> DTSI file to the DTS board files
>
> - Regulators subsystem:
> * Deleted useless struct axp20x_regulators
> * Added a warning when out of specs values are used for the
> dcdc frequency
>
> - MFD core:
> * Fixed coding style
> * Removed IDs from device table for i2c
>
> - Bindings documentation:
> * Several corrections and fixes
>
> Changes since v3:
>
> - Removed x-powers-axp209.dtsi file
> - Rewritten bindings document
>
> - MFD core:
> * Fixed casting
> * Better comments / documentation
>
> - Input misc PEK driver:
> * Timings are now expressed in ms and the sysfs appies the
> closest possible value
> * No more useless pretty-printing
> * Removed devm_request_threaded_irq in favour of
> devm_request_any_context_irq
> * Moved from input attributes to platform device attributes
>
> - Regulators subsystem:
> * Removed suspend mode (axp20x_set_suspend_voltage)
> * Added regulators input supply
>
> - DT:
> * DTs doesn't include anymore the dtsi
> * Added input supplies for regulators
>
> Changes since v4:
>
> - Removed regulator patches already applied / acked by Mark Brown
>
> - Input misc PEK driver:
> * Don't print anymore the "us" unit
> * Added cleanup for attributes when unbindind the device
> * Fixed error code returned when device_create_file() fails
>
> - DT:
> * Enable all the regulators on at boot-time
> * Removed min and max microvolts for all the regulators but DCDC2
> * Moved the axp_ipsout regulator outside the MFD node
>
> - MFD core:
> * The supply regulators are now specified in the MFD driver using
> regulator_bulk_register_supply_alias() and the .parent_supplies
> in the MFD cell
>
> Changes since v5:
> - Added ACKs
> - Fixed compilation warning (reported by Hans De Goede)
> - Vendor-prefixes are now sorted
> - Removed DT patch
>
>
> Carlo Caione (6):
> mfd: AXP20x: Add bindings documentation
> dt-bindings: add vendor-prefix for X-Powers
> input: misc: Add driver for AXP20x Power Enable Key
> input: misc: Add ABI docs for AXP20x PEK
> ARM: sunxi: Add AXP20x support in defconfig
> ARM: sunxi: Add AXP20x support multi_v7_defconfig
>
> .../ABI/testing/sysfs-driver-input-axp-pek | 11 +
> Documentation/devicetree/bindings/mfd/axp20x.txt | 93 +++++++
> .../devicetree/bindings/vendor-prefixes.txt | 1 +
> arch/arm/configs/multi_v7_defconfig | 3 +
> arch/arm/configs/sunxi_defconfig | 3 +
> drivers/input/misc/Kconfig | 11 +
> drivers/input/misc/Makefile | 1 +
> drivers/input/misc/axp20x-pek.c | 281 +++++++++++++++++++++
> 8 files changed, 404 insertions(+)
> create mode 100644 Documentation/ABI/testing/sysfs-driver-input-axp-pek
> create mode 100644 Documentation/devicetree/bindings/mfd/axp20x.txt
> create mode 100644 drivers/input/misc/axp20x-pek.c
>
^ permalink raw reply
* Re: [PATCH v7 0/6] mfd: AXP20x: Add support for AXP202 and AXP209
From: Maxime Ripard @ 2014-10-22 7:59 UTC (permalink / raw)
To: Bruno Prémont
Cc: Carlo Caione, lee.jones-QSEj5FYQhm4dnm+yROfE0A,
boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
hdegoede-H+wXaHxf7aLQT0dZR+AlfA,
dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
linux-input-u79uwXL29TY76Z2rM5mHXA,
linux-doc-u79uwXL29TY76Z2rM5mHXA,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw
In-Reply-To: <20141022082842.58578191-I2t2yFIzmohO7ya8xxV06g@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 576 bytes --]
On Wed, Oct 22, 2014 at 08:28:42AM +0200, Bruno Prémont wrote:
> On Sun, 29 Jun 2014 20:23:51 +0200 Carlo Caione wrote:
> > During the merging of v6 several patches were left out. This v7 comprises
> > all the patches that are still pending.
>
> Any progress on this or reason why these are stuck?
No one bothered resubmitting it.
If you have some time to work on this, it would be great if you could
pick up the work, if not, I'll do it.
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
* Re: [PATCH v2 4/4] ARM: dts: sun7i: Add lradc node
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
In-Reply-To: <1413879890-7254-5-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
[-- 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
* Re: Re: [PATCH v2 4/4] ARM: dts: sun7i: Add lradc node
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
In-Reply-To: <20141022083802.GE7893@lukather>
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
* Re: Re: [PATCH v7 0/6] mfd: AXP20x: Add support for AXP202 and AXP209
From: Carlo Caione @ 2014-10-22 10:22 UTC (permalink / raw)
To: Bruno Prémont
Cc: linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
lee.jones-QSEj5FYQhm4dnm+yROfE0A,
boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
hdegoede-H+wXaHxf7aLQT0dZR+AlfA,
dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
linux-input-u79uwXL29TY76Z2rM5mHXA,
linux-doc-u79uwXL29TY76Z2rM5mHXA,
maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8
In-Reply-To: <20141022075929.GD7893@lukather>
On Wed, Oct 22, 2014 at 09:59:29AM +0200, Maxime Ripard wrote:
> On Wed, Oct 22, 2014 at 08:28:42AM +0200, Bruno Prémont wrote:
> > On Sun, 29 Jun 2014 20:23:51 +0200 Carlo Caione wrote:
> > > During the merging of v6 several patches were left out. This v7 comprises
> > > all the patches that are still pending.
> >
> > Any progress on this or reason why these are stuck?
>
> No one bothered resubmitting it.
>
> If you have some time to work on this, it would be great if you could
> pick up the work, if not, I'll do it.
Wow, I totally forgot about those patches. Sorry for that.
If you are willing to work on the patches go ahead, otherwise
I'll find a bit of time myself.
--
Carlo Caione
--
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
* Re: Re: [PATCH v2 3/4] ARM: dts: sun5i: Add lradc node
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
In-Reply-To: <5446C23F.3040604-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
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
* Re: [PATCH v2 1/4] input: Add new sun4i-lradc-keys driver
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
In-Reply-To: <20141021170411.GB21108@lukather>
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
* [PATCH v3 0/4] input: Add new sun4i-lradc-keys driver
From: Hans de Goede @ 2014-10-22 11:11 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Maxime Ripard, linux-input-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw
Hi All,
Here is v3 of my patchset for the lradc attached tablet keys found one some
Allwinner boards.
Changes since v2:
-s/KEY_HOME/KEY_HOMEPAGE/
-s/sun4i-lradc-keys/sun4i-a10-lradc-keys/
-Use mV as address for the key subnodes in devicetree
-dts formatting fixes according to Maxime's review
-Do not set .owner field, as module_platform_driver already does that
Changes since previous postings a long time ago:
-device tree description now has one subnode per key just like gpio-keys
I hope this version is to everyones liking and can be merged soon :) The intend
is for the actual driver to go upstream through Dmitry's tree, where as the
3 dts patches should go upstream through Maxime's tree.
Thanks & Regards,
Hans
^ permalink raw reply
* [PATCH v3 1/4] input: Add new sun4i-lradc-keys driver
From: Hans de Goede @ 2014-10-22 11:11 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Maxime Ripard, linux-input-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede
In-Reply-To: <1413976265-12805-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
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 | 62 +++++
MAINTAINERS | 7 +
drivers/input/keyboard/Kconfig | 10 +
drivers/input/keyboard/Makefile | 1 +
drivers/input/keyboard/sun4i-lradc-keys.c | 258 +++++++++++++++++++++
5 files changed, 338 insertions(+)
create mode 100644 Documentation/devicetree/bindings/input/sun4i-lradc-keys.txt
create mode 100644 drivers/input/keyboard/sun4i-lradc-keys.c
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..b9c32f6
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/sun4i-lradc-keys.txt
@@ -0,0 +1,62 @@
+Allwinner sun4i low res adc attached tablet keys
+------------------------------------------------
+
+Required properties:
+ - compatible: "allwinner,sun4i-a10-lradc-keys"
+ - reg: mmio address range of the chip
+ - interrupts: interrupt to which the chip is connected
+ - vref-supply: powersupply for the lradc reference voltage
+
+Each key is represented as a sub-node of "allwinner,sun4i-a10-lradc-keys":
+
+Required subnode-properties:
+ - label: Descriptive name of the key.
+ - linux,code: Keycode to emit.
+ - channel: Channel this key is attached to, mut be 0 or 1.
+ - voltage: Voltage in µV at lradc input when this key is pressed.
+
+Example:
+
+#include <dt-bindings/input/input.h>
+
+ lradc: lradc@01c22800 {
+ compatible = "allwinner,sun4i-a10-lradc-keys";
+ reg = <0x01c22800 0x100>;
+ interrupts = <31>;
+ vref-supply = <®_vcc3v0>;
+
+ button@191 {
+ label = "Volume Up";
+ linux,code = <KEY_VOLUMEUP>;
+ channel = <0>;
+ voltage = <191274>;
+ };
+
+ button@392 {
+ label = "Volume Down";
+ linux,code = <KEY_VOLUMEDOWN>;
+ channel = <0>;
+ voltage = <392644>;
+ };
+
+ button@601 {
+ label = "Menu";
+ linux,code = <KEY_MENU>;
+ channel = <0>;
+ voltage = <601151>;
+ };
+
+ button@795 {
+ label = "Enter";
+ linux,code = <KEY_ENTER>;
+ channel = <0>;
+ voltage = <795090>;
+ };
+
+ button@987 {
+ label = "Home";
+ linux,code = <KEY_HOMEPAGE>;
+ 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..f11f002
--- /dev/null
+++ b/drivers/input/keyboard/sun4i-lradc-keys.c
@@ -0,0 +1,258 @@
+/*
+ * 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-a10-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-a10-lradc-keys", },
+ { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, sun4i_lradc_of_match);
+
+static struct platform_driver sun4i_lradc_driver = {
+ .driver = {
+ .name = "sun4i-a10-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
* [PATCH v3 2/4] ARM: dts: sun4i: Add lradc node
From: Hans de Goede @ 2014-10-22 11:11 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Maxime Ripard, linux-input-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede
In-Reply-To: <1413976265-12805-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
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..1ef7d57 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-a10-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
* [PATCH v3 3/4] ARM: dts: sun5i: Add lradc node
From: Hans de Goede @ 2014-10-22 11:11 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Maxime Ripard, linux-input-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede
In-Reply-To: <1413976265-12805-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts | 45 ++++++++++++++++++++++--
arch/arm/boot/dts/sun5i-a10s.dtsi | 7 ++++
arch/arm/boot/dts/sun5i-a13-olinuxino.dts | 45 ++++++++++++++++++++++--
arch/arm/boot/dts/sun5i-a13.dtsi | 7 ++++
4 files changed, 100 insertions(+), 4 deletions(-)
diff --git a/arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts b/arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts
index ea9519d..0b82d20 100644
--- a/arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts
+++ b/arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts
@@ -12,8 +12,9 @@
*/
/dts-v1/;
-/include/ "sun5i-a10s.dtsi"
-/include/ "sunxi-common-regulators.dtsi"
+#include "sun5i-a10s.dtsi"
+#include "sunxi-common-regulators.dtsi"
+#include <dt-bindings/input/input.h>
/ {
model = "Olimex A10s-Olinuxino Micro";
@@ -98,6 +99,46 @@
};
};
+ lradc: lradc@01c22800 {
+ vref-supply = <®_vcc3v0>;
+ status = "okay";
+
+ button@191 {
+ label = "Volume Up";
+ linux,code = <KEY_VOLUMEUP>;
+ channel = <0>;
+ voltage = <191274>;
+ };
+
+ button@392 {
+ label = "Volume Down";
+ linux,code = <KEY_VOLUMEDOWN>;
+ channel = <0>;
+ voltage = <392644>;
+ };
+
+ button@601 {
+ label = "Menu";
+ linux,code = <KEY_MENU>;
+ channel = <0>;
+ voltage = <601151>;
+ };
+
+ button@795 {
+ label = "Enter";
+ linux,code = <KEY_ENTER>;
+ channel = <0>;
+ voltage = <795090>;
+ };
+
+ button@987 {
+ label = "Home";
+ linux,code = <KEY_HOMEPAGE>;
+ 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..7c6c883 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-a10-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..b4ec8eb 100644
--- a/arch/arm/boot/dts/sun5i-a13-olinuxino.dts
+++ b/arch/arm/boot/dts/sun5i-a13-olinuxino.dts
@@ -12,8 +12,9 @@
*/
/dts-v1/;
-/include/ "sun5i-a13.dtsi"
-/include/ "sunxi-common-regulators.dtsi"
+#include "sun5i-a13.dtsi"
+#include "sunxi-common-regulators.dtsi"
+#include <dt-bindings/input/input.h>
/ {
model = "Olimex A13-Olinuxino";
@@ -66,6 +67,46 @@
};
};
+ lradc: lradc@01c22800 {
+ vref-supply = <®_vcc3v0>;
+ status = "okay";
+
+ button@191 {
+ label = "Volume Up";
+ linux,code = <KEY_VOLUMEUP>;
+ channel = <0>;
+ voltage = <191274>;
+ };
+
+ button@392 {
+ label = "Volume Down";
+ linux,code = <KEY_VOLUMEDOWN>;
+ channel = <0>;
+ voltage = <392644>;
+ };
+
+ button@601 {
+ label = "Menu";
+ linux,code = <KEY_MENU>;
+ channel = <0>;
+ voltage = <601151>;
+ };
+
+ button@795 {
+ label = "Enter";
+ linux,code = <KEY_ENTER>;
+ channel = <0>;
+ voltage = <795090>;
+ };
+
+ button@987 {
+ label = "Home";
+ linux,code = <KEY_HOMEPAGE>;
+ 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..aa0482c 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-a10-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
* [PATCH v3 4/4] ARM: dts: sun7i: Add lradc node
From: Hans de Goede @ 2014-10-22 11:11 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Maxime Ripard, linux-input-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Hans de Goede
In-Reply-To: <1413976265-12805-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts | 59 ++++++++++++++++++++++++-
arch/arm/boot/dts/sun7i-a20.dtsi | 7 +++
2 files changed, 64 insertions(+), 2 deletions(-)
diff --git a/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts b/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts
index 9d669cdf..c00badd 100644
--- a/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts
+++ b/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts
@@ -12,8 +12,9 @@
*/
/dts-v1/;
-/include/ "sun7i-a20.dtsi"
-/include/ "sunxi-common-regulators.dtsi"
+#include "sun7i-a20.dtsi"
+#include "sunxi-common-regulators.dtsi"
+#include <dt-bindings/input/input.h>
/ {
model = "Olimex A20-Olinuxino Micro";
@@ -100,6 +101,60 @@
};
};
+ lradc: lradc@01c22800 {
+ vref-supply = <®_vcc3v0>;
+ status = "okay";
+
+ button@191 {
+ label = "Volume Up";
+ linux,code = <KEY_VOLUMEUP>;
+ channel = <0>;
+ voltage = <191274>;
+ };
+
+ button@392 {
+ label = "Volume Down";
+ linux,code = <KEY_VOLUMEDOWN>;
+ channel = <0>;
+ voltage = <392644>;
+ };
+
+ button@601 {
+ label = "Menu";
+ linux,code = <KEY_MENU>;
+ channel = <0>;
+ voltage = <601151>;
+ };
+
+ button@795 {
+ label = "Search";
+ linux,code = <KEY_SEARCH>;
+ channel = <0>;
+ voltage = <795090>;
+ };
+
+ button@987 {
+ label = "Home";
+ linux,code = <KEY_HOMEPAGE>;
+ channel = <0>;
+ voltage = <987387>;
+ };
+
+ button@1184 {
+ label = "Esc";
+ linux,code = <KEY_ESC>;
+ channel = <0>;
+ voltage = <1184678>;
+ };
+
+ button@1398 {
+ label = "Enter";
+ 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..9174423 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-a10-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
* Re: Touch processing on host CPU
From: One Thousand Gnomes @ 2014-10-22 13:20 UTC (permalink / raw)
To: Nick Dyer
Cc: Dmitry Torokhov, Jonathan Cameron, Greg KH,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
In-Reply-To: <54468E0D.2010200@itdev.co.uk>
> This sounds promising. The only sticking point I can see is that a touch
> frontend has many more channels (possibly thousands), which would seem to
> impose a lot of overhead when put into the IIO framework. I will certainly
> take a closer look at it.
If that is the case then it may not be the right match - but it might
also be a good argument for fixing the IIO layer so it isn't ?
Alan
^ permalink raw reply
* Re: [PATCH v3 1/4] input: Add new sun4i-lradc-keys driver
From: Maxime Ripard @ 2014-10-22 16:01 UTC (permalink / raw)
To: Hans de Goede
Cc: Dmitry Torokhov, linux-input-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw
In-Reply-To: <1413976265-12805-2-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 847 bytes --]
Hi Hans,
On Wed, Oct 22, 2014 at 01:11:02PM +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>
Acked-by: Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
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
* Re: Touch processing on host CPU
From: Andrew de los Reyes @ 2014-10-22 21:15 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Nick Dyer, Greg KH, Jonathan Cameron, linux-input@vger.kernel.org,
linux-kernel@vger.kernel.org
In-Reply-To: <20141017171756.GA22238@dtor-ws>
On Fri, Oct 17, 2014 at 10:17 AM, Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
> Hi Nick,
>
> On Fri, Oct 17, 2014 at 11:42:10AM +0100, Nick Dyer wrote:
>> Hi-
>>
>> I'm trying to find out which subsystem maintainer I should be talking to -
>> apologies if I'm addressing the wrong people.
>>
>> There is a model for doing touch processing where the touch controller
>> becomes a much simpler device which sends out raw acquisitions (over SPI
>> at up to 1Mbps + protocol overheads). All touch processing is then done in
>> user space by the host CPU. An example of this is NVIDIA DirectTouch - see:
>> http://blogs.nvidia.com/blog/2012/02/24/industry-adopts-nvidia-directtouch/
>>
>> In the spirit of "upstream first", I'm trying to figure out how to get a
>> driver accepted. Obviously it's not an input device in the normal sense. Is
>> it acceptable just to send the raw touch data out via a char device? Is
>> there another subsystem which is a good match (eg IIO)? Does the protocol
>> (there is ancillary/control data as well) need to be documented?
>
> I'd really think *long* and *hard* about this. Even if you will have the
> touch process open source you have 2 options: route it back into the
> kernel through uinput, thus adding latency (which might be OK, need to
> measure and decide), or go back about 10 years where we had
> device-specific drivers in XFree86 and re-create them again, and also do
> the same for Wayland, Chrome, Android, etc.
>
> If you will have touch processing in a binary blob, you'll also be going
> to ages "Works with Ubuntu 12.04 on x86_32!" (and nothing else), or
> "Android 5.1.2 on Tegra Blah (build 78912KT)" (and nothing else).
I think we have some interest on the Chrome OS team. We've often had
issues on touch devices with centroiding problems like split/merge,
and have thought it might be nice to have lower level access to be
able to actually solve these problems, rather than just complain to
the touch vendor. Historically, however, raw touch heatmaps have not
been available, making this idea unfeasible. Maybe this is starting to
change with the push from Nvidia!
I would agree with Dmitry that we would want a consistent unified
interface that could work with different touch vendors. I am assuming
that Nick's model is roughly 60-120 frames/sec, where each frame is
NxMx16bits. Pixels would generally be ~4mm on a side for touch sensors
today, but they may get significantly smaller if stylus becomes
popular. Nick, is that roughly what you have in mind? Also, touch
sensors generally have a baseline image that is subtracted from each
recorded raw image to form the delta image (ie, raw - baseline =
delta). Nick, do you envision sending raw or delta up to userspace? I
would assume delta, b/c I think the touch controller will need to
compute delta internally to see if there's a touch. It would be quite
wasteful to invoke the kernel/userspace on an image with no touches.
That said, there may be some situations (ie, factory validation) where
getting raw images is preferred.
Also, what about self-cap scan? I know some controllers will do
self-cap when there's just one finger. I'm guessing the data for such
a frame would be (N+M)x16bits.
In order to support X, Wayland, Android, etc, I would assume that
parsed frames would be injected back into the kernel in a format
similar (identical?) to MT-B. As far as the availability of an
open-source user-space driver to convert heat-map into MT-B, maybe I'm
overly optimistic, but I would guess we could start with something
simple like center-of-mass, and the community will help make it more
robust.
Sorry I have more questions than suggestions. Hopefully Nick can shed
more light on what type of interface he would like.
-andrew
>
> Thanks.
>
> --
> Dmitry
> --
> To unsubscribe from this list: send the line "unsubscribe linux-input" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* RE: [PATCH v8 00/13] input: cyapa: intruction of cyapa patches
From: Dudley Du @ 2014-10-23 1:25 UTC (permalink / raw)
To: 'dmitry.torokhov@gmail.com',
'rydberg@euromail.se'
Cc: 'bleung@google.com', 'patrikf@google.com',
'linux-input@vger.kernel.org',
'linux-kernel@vger.kernel.org', David Solda
Hi Dmitry,
It has been long time after the v8 patches submitted, with your busy time, could you help take a little time to update the status of the schedule or reviews?
Any information will halp a lot.
Thanks,
Dudley
> -----Original Message-----
> From: Dudley Du
> Sent: 2014?10?20? 9:16
> To: 'Dudley Du'; dmitry.torokhov@gmail.com; rydberg@euromail.se
> Cc: bleung@google.com; patrikf@google.com; linux-input@vger.kernel.org;
> linux-kernel@vger.kernel.org
> Subject: RE: [PATCH 00/13] input: cyapa: intruction of cyapa patches
>
> Hi Dmitry,
>
> Is there any update on the v8 patchs for input cyapa trackpad drivers?
>
> Thanks,
> Dudley
>
> > -----Original Message-----
> > From: Dudley Du [mailto:dudley.dulixin@gmail.com]
> > Sent: 2014?10?15? 15:19
> > To: dmitry.torokhov@gmail.com; rydberg@euromail.se
> > Cc: Dudley Du; bleung@google.com; patrikf@google.com;
> > linux-input@vger.kernel.org; linux-kernel@vger.kernel.org
> > Subject: [PATCH 00/13] input: cyapa: intruction of cyapa patches
> >
> > Based on Dmitry's comments, I made v8 patches of cyapa trackpad device
> > with below updates compared with v7 patches:
> > 1) [PATCH v8 01/13] - Remove the async thread for device detect in
> > proble routine, now the device detect process is completly done within
> > the device proble routine.
> > 2) [PATCH v8 01/13] - Split the irq cmd hander function to separated
> > function cyapa_default_irq_cmd_handler() and set it to interface
> > cyapa_default_ops.irq_cmd_handler.
> > 3) [PATCH v8 06/13] - Add cyapa->gen check in cyapa_gen3_irq_cmd_handler()
> > to avoid miss-enter when device protocol is still in detecting.
> >
> >
> > V7 patches have below updates compared with v6 patches:
> > 1) [PATCH v7 01/13] - Split the irq cmd hander function to separated
> > function cyapa_default_irq_cmd_handler() and set it to interface
> > cyapa_default_ops.irq_cmd_handler.
> > 2) [PATCH v7 06/13] - Add cyapa->gen check in cyapa_gen3_irq_cmd_handler()
> > to avoid miss-enter when device protocol is still in detecting.
> >
> >
> > V6 patches have below updates compared with v5 patches:
> > 1) Remove patch 14 of the lid filtering from the cyapa driver.
> >
> > V5 patches have below updates compared with v4 patches:
> > 1) Uses get_device()/put_device() instead of kobject_get()/kobject_put();
> > 2) Fix memories freed before debugfs entries issue;
> > 3) Make cyapa_debugs_root valid in driver module level
> > in module_init()/moudle_exit() ;
> > 4) Fix i2c_transfer() may return partial transfer issues.
> > 5) Add cyapa->removed flag to avoid detecting thread may still running
> > when driver module is removed.
> > 6) Fix the meanings of some comments and return error code not clear issue.
> >
> > This patch set is aimed to re-architecture the cyapa driver to support
> > old gen3 trackpad device and new gen5 trackpad device in one
> > cyapa driver for easily productions support based on
> > customers' requirements, and add sysfs functions and interfaces
> > supported that required by users and customers.
> > Because the earlier gen3 and the latest gen5 trackpad devies using
> > two different chipsets, and have different protocol and interfaces.
> > If supported these two trackpad devices in two different drivers, then
> > it will be difficult to manage productions and later firmware updates.
> > it will cause customer don't know which one to use and update
> > because these two trackpad devices have been used and integrated
> > in same one productions at a time, so must to support these two trackpad
> > devices in same on driver.
> >
> > The new architecture is made of:
> > cyapa.c - the core of the architecture, supply interfaces and
> > functions to system and read trackpad devices.
> > cyapa.h - header file including macros and data structure definitions.
> > cyapa_gen3.c - functions support for gen3 trackpad devices,
> > cyapa_gen5.c - functions support for gen5 trackpad devices.
> >
> > Beside this introduction patch, it has 14 patches listed as below.
> > For these patches each one is patched based on previous one.
> >
> > patch 1/13: re-architecture cyapa driver with core functions,
> > and applying the device detecting function in async thread to speed
> > up system boot time.
> >
> > patch 2/13: add cyapa driver power management interfaces support.
> >
> > patch 3/13: add cyapa driver runtime power management interfaces support.
> >
> > patch 4/13: add cyapa key function interfaces in sysfs system.
> > Including read firmware version, get production ID, read baseline,
> > re-calibrate trackpad baselines and do trackpad firmware update.
> >
> > patch 5/13: add read firmware image and read raw trackpad device'
> > sensors' raw data interface in debugfs system.
> >
> > patch 6/13: add gen3 trackpad device basic functions support.
> >
> > patch 7/13: add gen3 trackpad device firmware update function support.
> >
> > patch 8/13: add gen3 trackpad device report baseline and do force
> > re-calibrate functions support.
> >
> > patch 9/13: add gen3 trackpad device read firmware image function support.
> >
> > patch 10/13: add gen5 trackpad device basic functions support.
> >
> > patch 11/13: add gen5 trackpad device firmware update function support.
> >
> > patch 12/13: add gen5 trackpad device report baseline and do force
> > re-calibrate functions support.
> >
> > patch 13/13: add gen5 trackpad device read firmware image and report
> > sensors' raw data values functions support.
> >
> > This message and any attachments may contain Cypress (or its subsidiaries)
> > confidential information. If it has been received in error, please advise the sender
> > and immediately delete this message.
This message and any attachments may contain Cypress (or its subsidiaries) confidential information. If it has been received in error, please advise the sender and immediately delete this message.
^ permalink raw reply
* Re: Problems with Wacom Intuos PT M (CTH680) on FreeBSD
From: Denis Akiyakov @ 2014-10-23 4:54 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: linux-input, Hans Petter Selasky,
nox@jelal.kn-bremen.de >> Juergen Lock
In-Reply-To: <20141021223311.GG8609@dtor-ws>
On 22.10.2014 05:33, Dmitry Torokhov wrote:
> Hi Denis,
>
> On Sat, Oct 18, 2014 at 05:56:48PM +0700, Denis Akiyakov wrote:
>> Hello,
>>
>> I'm using FreeBSD 10.1 and FreeBSD use webcamd witch contain linux
>> wacom driver to provide wacom tablets support. More info here:
>> http://www.selasky.org/hans_petter/video4bsd/ or
>> http://www.freshports.org/multimedia/webcamd/
>>
>> I've got latest version of webcamd and Wacom device CTH680, but
>> device isn't working correct.
> Have you tried the device with Linux instead of FreeBSD? If it works in
> Linux that means that the port of linux drivers to BSD is to blame and
> you need to contact its authors, otherwise we need to adjust wacom
> driver in kernel for this device.
>
> Thanks.
>
Hello, Dmitry.
I've tried tablet in Ubuntu 14.04.1. All functions that work in Windows
7 (in Krita) work under Ubuntu's Krita.
Thank you for your attention.
^ permalink raw reply
* Re: Problems with Wacom Intuos PT M (CTH680) on FreeBSD
From: Hans Petter Selasky @ 2014-10-23 5:54 UTC (permalink / raw)
To: Denis Akiyakov, Dmitry Torokhov
Cc: linux-input, nox@jelal.kn-bremen.de >> Juergen Lock
In-Reply-To: <544889FD.5030004@gmail.com>
On 10/23/14 06:54, Denis Akiyakov wrote:
> On 22.10.2014 05:33, Dmitry Torokhov wrote:
>> Hi Denis,
>>
>> On Sat, Oct 18, 2014 at 05:56:48PM +0700, Denis Akiyakov wrote:
>>> Hello,
>>>
>>> I'm using FreeBSD 10.1 and FreeBSD use webcamd witch contain linux
>>> wacom driver to provide wacom tablets support. More info here:
>>> http://www.selasky.org/hans_petter/video4bsd/ or
>>> http://www.freshports.org/multimedia/webcamd/
>>>
>>> I've got latest version of webcamd and Wacom device CTH680, but
>>> device isn't working correct.
>> Have you tried the device with Linux instead of FreeBSD? If it works in
>> Linux that means that the port of linux drivers to BSD is to blame and
>> you need to contact its authors, otherwise we need to adjust wacom
>> driver in kernel for this device.
>>
>> Thanks.
>>
> Hello, Dmitry.
>
> I've tried tablet in Ubuntu 14.04.1. All functions that work in Windows
> 7 (in Krita) work under Ubuntu's Krita.
>
> Thank you for your attention.
>
Hi,
The problem appears to be that webcamd launches two instances for each
interface, so the shared data is not the same like with Linux. Actually
the shared data is NULL.
I think however it would be clever that the Linux Wacom code would check
"wacom->shared->touch_input" for NULL before using it, because it is not
always set. This can be an easy way to crash the kernel when plugging a
USB devices.
drivers/hid/wacom_wac.c:1395
and some more places.
--HPS
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox