* [PATCH 2/2] arm: dts: am335x sk: add touchscreen support
From: Felipe Balbi @ 2013-10-21 20:13 UTC (permalink / raw)
To: dmitry.torokhov
Cc: rob.herring, pawel.moll, mark.rutland, swarren, ijc+devicetree,
rob, bcousson, Tony Lindgren, Sebastian Andrzej Siewior,
devicetree, Linux OMAP Mailing List, linux-input, Felipe Balbi
In-Reply-To: <1382386404-6659-1-git-send-email-balbi@ti.com>
Add missing nodes for the touchscreen available
on AM335x EVM SK.
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
arch/arm/boot/dts/am335x-evmsk.dts | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/arch/arm/boot/dts/am335x-evmsk.dts b/arch/arm/boot/dts/am335x-evmsk.dts
index 4f339fa..d7c2c0c 100644
--- a/arch/arm/boot/dts/am335x-evmsk.dts
+++ b/arch/arm/boot/dts/am335x-evmsk.dts
@@ -419,3 +419,13 @@
phy_id = <&davinci_mdio>, <1>;
phy-mode = "rgmii-txid";
};
+
+&tscadc {
+ status = "okay";
+ tsc {
+ ti,wires = <4>;
+ ti,x-plate-resistance = <200>;
+ ti,coordinate-readouts = <5>;
+ ti,wire-config = <0x00 0x11 0x22 0x33>;
+ };
+};
--
1.8.4.GIT
^ permalink raw reply related
* [PATCH 0/2] arm: am335x: am335x evm sk: add touchscreen DT node
From: Felipe Balbi @ 2013-10-21 20:13 UTC (permalink / raw)
To: dmitry.torokhov
Cc: rob.herring, pawel.moll, mark.rutland, swarren, ijc+devicetree,
rob, bcousson, Tony Lindgren, Sebastian Andrzej Siewior,
devicetree, Linux OMAP Mailing List, linux-input, Felipe Balbi
Hi,
the following patches fix a typo on TSC/ADC DT binding while
maintaining backwards compatibility and add support for the
touchscreen available on am335x-evm-sk.
Patches have been tested with am335x-evm-sk with a couple patches
(already floating around the mailing lists) to get that board
booting in mainline.
cheers
Felipe Balbi (2):
input: touchscreen: fix spelling mistake in TSC/ADC DT binding
arm: dts: am335x sk: add touchscreen support
.../devicetree/bindings/input/touchscreen/ti-tsc-adc.txt | 2 +-
arch/arm/boot/dts/am335x-evm.dts | 2 +-
arch/arm/boot/dts/am335x-evmsk.dts | 10 ++++++++++
drivers/input/touchscreen/ti_am335x_tsc.c | 9 ++++++++-
4 files changed, 20 insertions(+), 3 deletions(-)
--
1.8.4.GIT
^ permalink raw reply
* [PATCH 1/2] input: touchscreen: fix spelling mistake in TSC/ADC DT binding
From: Felipe Balbi @ 2013-10-21 20:13 UTC (permalink / raw)
To: dmitry.torokhov
Cc: rob.herring, pawel.moll, mark.rutland, swarren, ijc+devicetree,
rob, bcousson, Tony Lindgren, Sebastian Andrzej Siewior,
devicetree, Linux OMAP Mailing List, linux-input, Felipe Balbi
In-Reply-To: <1382386404-6659-1-git-send-email-balbi@ti.com>
There was a spelling mistake on TSC/ADC binding where
"coordinate" was spelled as "coordiante".
We can't simply fix the error due to DT being an ABI,
the approach taken was to first use correct spelling
and if that fails, fallback to miss-spelled version.
It's unfortunate that has creeped into the tree.
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
.../devicetree/bindings/input/touchscreen/ti-tsc-adc.txt | 2 +-
arch/arm/boot/dts/am335x-evm.dts | 2 +-
drivers/input/touchscreen/ti_am335x_tsc.c | 9 ++++++++-
3 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt b/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt
index 491c97b..878549b 100644
--- a/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt
+++ b/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt
@@ -6,7 +6,7 @@ Required properties:
ti,wires: Wires refer to application modes i.e. 4/5/8 wire touchscreen
support on the platform.
ti,x-plate-resistance: X plate resistance
- ti,coordiante-readouts: The sequencer supports a total of 16
+ ti,coordinate-readouts: The sequencer supports a total of 16
programmable steps each step is used to
read a single coordinate. A single
readout is enough but multiple reads can
diff --git a/arch/arm/boot/dts/am335x-evm.dts b/arch/arm/boot/dts/am335x-evm.dts
index e8ec875..c5b73bc 100644
--- a/arch/arm/boot/dts/am335x-evm.dts
+++ b/arch/arm/boot/dts/am335x-evm.dts
@@ -509,7 +509,7 @@
tsc {
ti,wires = <4>;
ti,x-plate-resistance = <200>;
- ti,coordiante-readouts = <5>;
+ ti,coordinate-readouts = <5>;
ti,wire-config = <0x00 0x11 0x22 0x33>;
};
diff --git a/drivers/input/touchscreen/ti_am335x_tsc.c b/drivers/input/touchscreen/ti_am335x_tsc.c
index e1c5300..b61df9d 100644
--- a/drivers/input/touchscreen/ti_am335x_tsc.c
+++ b/drivers/input/touchscreen/ti_am335x_tsc.c
@@ -348,9 +348,16 @@ static int titsc_parse_dt(struct platform_device *pdev,
if (err < 0)
return err;
- err = of_property_read_u32(node, "ti,coordiante-readouts",
+ /*
+ * try with new binding first. If it fails, still try with
+ * bogus, miss-spelled version.
+ */
+ err = of_property_read_u32(node, "ti,coordinate-readouts",
&ts_dev->coordinate_readouts);
if (err < 0)
+ err = of_property_read_u32(node, "ti,coordiante-readouts",
+ &ts_dev->coordinate_readouts);
+ if (err < 0)
return err;
return of_property_read_u32_array(node, "ti,wire-config",
--
1.8.4.GIT
^ permalink raw reply related
* [PATCH] HID: Added Holtek USB ID 04d9:a072 LEETGION Hellion Gaming Mouse
From: Anders F. U. Kiær @ 2013-10-21 21:42 UTC (permalink / raw)
To: jkosina; +Cc: linux-input, linux-kernel, Anders F. U. Kiær
Added id, bindings and comments for Holtek USB ID 04d9:a072
LEETGION Hellion Gaming mouse to use the same corrections of the report
descriptor as Holtek 04d9:a067. As the mouse exceed HID_MAX_USAGES at the
same offsets in the reported descriptor.
Tested on the hardware.
Signed-off-by: Anders F. U. Kiær <ablacksheep@gmail.com>
---
drivers/hid/Kconfig | 1 +
drivers/hid/hid-core.c | 1 +
drivers/hid/hid-holtek-mouse.c | 4 ++++
drivers/hid/hid-ids.h | 3 ++-
4 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index c91d547..d68292a 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -242,6 +242,7 @@ config HID_HOLTEK
- Tracer Sniper TRM-503 / NOVA Gaming Slider X200 /
Zalman ZM-GM1
- SHARKOON DarkGlider Gaming mouse
+ - LEETGION Hellion Gaming Mouse
config HOLTEK_FF
bool "Holtek On Line Grip force feedback support"
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 5a8c011..6ab7133 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1715,6 +1715,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_KEYBOARD) },
{ HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A04A) },
{ HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A067) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A072) },
{ HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A081) },
{ HID_USB_DEVICE(USB_VENDOR_ID_HUION, USB_DEVICE_ID_HUION_580) },
{ HID_USB_DEVICE(USB_VENDOR_ID_JESS2, USB_DEVICE_ID_JESS2_COLOR_RUMBLE_PAD) },
diff --git a/drivers/hid/hid-holtek-mouse.c b/drivers/hid/hid-holtek-mouse.c
index e696566..0caa676 100644
--- a/drivers/hid/hid-holtek-mouse.c
+++ b/drivers/hid/hid-holtek-mouse.c
@@ -28,6 +28,7 @@
* - USB ID 04d9:a04a, sold as Tracer Sniper TRM-503, NOVA Gaming Slider X200
* and Zalman ZM-GM1
* - USB ID 04d9:a081, sold as SHARKOON DarkGlider Gaming mouse
+ * - USB ID 04d9:a072, sold as LEETGION Hellion Gaming Mouse
*/
static __u8 *holtek_mouse_report_fixup(struct hid_device *hdev, __u8 *rdesc,
@@ -40,6 +41,7 @@ static __u8 *holtek_mouse_report_fixup(struct hid_device *hdev, __u8 *rdesc,
* 0x2fff, so they don't exceed HID_MAX_USAGES */
switch (hdev->product) {
case USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A067:
+ case USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A072:
if (*rsize >= 122 && rdesc[115] == 0xff && rdesc[116] == 0x7f
&& rdesc[120] == 0xff && rdesc[121] == 0x7f) {
hid_info(hdev, "Fixing up report descriptor\n");
@@ -66,6 +68,8 @@ static const struct hid_device_id holtek_mouse_devices[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT,
USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A04A) },
{ HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT,
+ USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A072) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT,
USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A081) },
{ }
};
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 9cbc7ab..8ebaef95 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -448,8 +448,9 @@
#define USB_VENDOR_ID_HOLTEK_ALT 0x04d9
#define USB_DEVICE_ID_HOLTEK_ALT_KEYBOARD 0xa055
-#define USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A067 0xa067
#define USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A04A 0xa04a
+#define USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A067 0xa067
+#define USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A072 0xa072
#define USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A081 0xa081
#define USB_VENDOR_ID_IMATION 0x0718
--
1.8.1.2
--
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 related
* Re: [PATCH v2] add sur40 driver for Samsung SUR40 (aka MS Surface 2.0/Pixelsense)
From: Florian Echtler @ 2013-10-22 6:08 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input, benjamin.tissoires, rydberg, dh.herrmann
In-Reply-To: <20131021162006.GB4575@core.coreip.homeip.net>
[-- Attachment #1: Type: text/plain, Size: 2153 bytes --]
Hello Dmitry,
thanks for your quick feedback, a few questions below:
On 21.10.2013 18:20, Dmitry Torokhov wrote:
> On Sun, Oct 20, 2013 at 06:49:11PM +0200, Florian Echtler wrote:
>> +/* read 512 bytes from endpoint 0x86 -> get header + blobs */
>> +struct sur40_header {
>> +
>> + uint16_t type; /* always 0x0001 */
>> + uint16_t count; /* count of blobs (if 0: continue prev. packet) */
>> +
>> + uint32_t packet_id;
>> +
>> + uint32_t timestamp; /* milliseconds (inc. by 16 or 17 each frame) */
>> + uint32_t unknown; /* "epoch?" always 02/03 00 00 00 */
>
> Proper internal kernel types are u8, u16, u32. For user-facing APIs
> __u8, __u16, and __u32 should be used. Also, since this is data coming
> directly off the wire, you should be using __le16, __le32, etc, and then
> do __leXX_to_cpu() conversion before using it in calculations.
OK, I'll switch to u32 throughout (also for the float, I'll explain in a
commment). However, I haven't found a single other touchscreen driver
which uses __le32, even though they all probably process raw wire data -
can you suggest an example?
>> +/* debug helper macro */
>> +#define get_dev(x) (&(x->usbdev->dev))
> Just stick that dev in sur40_state and then use sur40->dev throughout.
OK.
>> + struct sur40_header *header = &(sur40->bulk_in_buffer->header);
> No need to have parenthesis around & operator.
>> + struct sur40_blob *inblob = &(sur40->bulk_in_buffer->blobs[0]);
> Same here.
Intention seems clearer to me with parentheses, but if this doesn't
conform to coding style, I'll fix it.
>> + if (!sur40->bulk_in_buffer) {
>> + dev_err(&interface->dev, "Unable to allocate input buffer.");
>> + sur40_delete(sur40);
> Would prefer standard kernel error unwinding style (gotos to proper
> unwinding point).
Something like this example from ucb1400_ts?
error = input_register_device(ucb->ts_idev);
if (error)
goto err_free_irq;
return 0;
err_free_irq:
free_irq(ucb->irq, ucb);
err_free_devs:
input_free_device(ucb->ts_idev);
err:
return error;
Best regards, Florian
--
SENT FROM MY DEC VT50 TERMINAL
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply
* Re: [PATCH 01/02] input: serio: use DEVICE_ATTR_RO()
From: Greg Kroah-Hartman @ 2013-10-22 6:12 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input
In-Reply-To: <20131021162531.GC4575@core.coreip.homeip.net>
On Mon, Oct 21, 2013 at 09:25:32AM -0700, Dmitry Torokhov wrote:
> Hi Greg,
>
> On Mon, Oct 07, 2013 at 06:08:23PM -0700, Greg Kroah-Hartman wrote:
> > From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> >
> > Convert the serio sysfs fiels to use the DEVICE_ATTR_RO() macros to make
> > it easier to audit the correct sysfs file permission usage.
>
> Sorry for the delay. Frankly I am not a fan of DEVICE_ATTR macros as it
> forces particular naming of the attribute structures and methods and
> forces us to lose the module prefix in names. I prefer all functions and
> file-scope variables have module prefix because in the absence of
> language-supported namespaces this is the one thing that insulates
> drivers from changes in shared headers.
No sysfs read/write functions should ever be exported out of the local
file "scope", so why is this an issue? I have run into it being a
problem for some files, where people have device/bus/class sysfs files
all in the same .c file, but that usage is very limited.
I'm trying to eventually convert the whole kernel to use the
DEVICE_ATTR_??() macros to make it so that we can audit the sysfs file
permissions easier, by making them impossible to get wrong. We have had
problems in the past where device files had incorrect permissions and
unprivilidged users could do things they shouldn't have. Using these
macros _should_ prevent almost all of that from even being possible.
Now odds are, I'll never be able to remove DEVICE_ATTR() from the tree,
as there are some strange files that use crazy permissions and we have
to live with that, but for all of the "simple" files, like are done
here, I'd really like to use them, especially as it provides a
kernel-wide uniformity to the naming of attribute function calls, which
is a huge benifit as well.
Note, I did apply this patch to my tree already, and it's queued up for
3.13-rc1. If you really object to it, I'll revert it, and fix up the
02/02 patch in this series to not need it, but I'd really like you to
reconsider your objection.
thanks,
greg k-h
^ permalink raw reply
* Re: [PATCH 1/2] input: touchscreen: fix spelling mistake in TSC/ADC DT binding
From: Sebastian Andrzej Siewior @ 2013-10-22 8:42 UTC (permalink / raw)
To: Felipe Balbi
Cc: dmitry.torokhov, rob.herring, pawel.moll, mark.rutland, swarren,
ijc+devicetree, rob, bcousson, Tony Lindgren, devicetree,
Linux OMAP Mailing List, linux-input
In-Reply-To: <1382386404-6659-2-git-send-email-balbi@ti.com>
On 10/21/2013 10:13 PM, Felipe Balbi wrote:
> diff --git a/drivers/input/touchscreen/ti_am335x_tsc.c b/drivers/input/touchscreen/ti_am335x_tsc.c
> index e1c5300..b61df9d 100644
> --- a/drivers/input/touchscreen/ti_am335x_tsc.c
> +++ b/drivers/input/touchscreen/ti_am335x_tsc.c
> @@ -348,9 +348,16 @@ static int titsc_parse_dt(struct platform_device *pdev,
> if (err < 0)
> return err;
>
> - err = of_property_read_u32(node, "ti,coordiante-readouts",
> + /*
> + * try with new binding first. If it fails, still try with
> + * bogus, miss-spelled version.
> + */
> + err = of_property_read_u32(node, "ti,coordinate-readouts",
> &ts_dev->coordinate_readouts);
> if (err < 0)
> + err = of_property_read_u32(node, "ti,coordiante-readouts",
> + &ts_dev->coordinate_readouts);
> + if (err < 0)
> return err;
Thanks, very good. Do we keep this fallback for ever or just for a year
or two?
>
> return of_property_read_u32_array(node, "ti,wire-config",
Sebastian
^ permalink raw reply
* Re: [PATCH] typo fixes (coordiante -> coordinate) in am335x
From: Lee Jones @ 2013-10-22 9:05 UTC (permalink / raw)
To: Jan Lübbe, Dmitry Torokhov
Cc: Tony Lindgren, Samuel Ortiz, Zubair Lutfullah, linux-doc,
linux-kernel, linux-omap, linux-arm-kernel, linux-input
In-Reply-To: <1382198544.22609.8.camel@polaris.local>
On Sat, 19 Oct 2013, Jan Lübbe wrote:
> On Wed, 2013-08-21 at 00:58 -0700, Tony Lindgren wrote:
> > * Zubair Lutfullah <zubair.lutfullah@gmail.com> [130715 08:33]:
> > > Did a grep for coordiante and replaced them all
> > > with coordinate.
> > >
> > > This applies to the mfd-next tree.
> >
> > This should be safe to apply via the MFD tree as a non-critical
> > fix assuming the bootloaders are not yet using this:
> >
> > Acked-by: Tony Lindgren <tony@atomide.com>
>
> It seems this didn't get applied. It fixes the touchscreen on a
> BeagleBone black with the 7" LCD and we should avoid having people use
> the wrong binding.
>
> Samuel or Lee: Could you take this patch?
This is the first time this patch has been sent to me.
I need Dmitry's input (no pun intended) on how he's like to deal with
this. At a bare minimum I'd like his Ack.
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
^ permalink raw reply
* Re: [PATCHv4][ 1/4] Input: tsc2007: Add device tree support.
From: Lothar Waßmann @ 2013-10-22 9:49 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Denis Carikli, linux-input, Sascha Hauer, linux-arm-kernel,
Eric Bénard, Rob Herring, Pawel Moll, Mark Rutland,
Stephen Warren, Ian Campbell, devicetree
In-Reply-To: <20131021155927.GB4255@core.coreip.homeip.net>
Hi,
> On Mon, Oct 21, 2013 at 03:54:24PM +0200, Denis Carikli wrote:
> >
> > + if (ts->of)
> > + return tsc2007_get_pendown_state_dt(ts);
> > +
> > if (!ts->get_pendown_state)
> > return true;
>
> Instead of special casing "if (ts->of)" all over the place why don't you
> set up the device structure as:
>
> if (<configuring_tsc2007_form_dt>)
> ts->get_pendown_state = tsc2007_get_pendown_state_dt;
>
> and be done with it?
>
I also thought about that, but the existing function does not have any
parameters, while the DT version of get_pendown_state() requires to get
the GPIO passed to it somehow.
Lothar Waßmann
--
___________________________________________________________
Ka-Ro electronics GmbH | Pascalstraße 22 | D - 52076 Aachen
Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10
Geschäftsführer: Matthias Kaussen
Handelsregistereintrag: Amtsgericht Aachen, HRB 4996
www.karo-electronics.de | info@karo-electronics.de
___________________________________________________________
--
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: WPC8769L (WEC1020) support in winbond-cir?
From: Juan Jesús García de Soria Lucena @ 2013-10-22 10:57 UTC (permalink / raw)
To: Tom Gundersen
Cc: David Härdeman, Sean Young, linux-input@vger.kernel.org,
linux-media@vger.kernel.org
In-Reply-To: <CAG-2HqVh1hzC0rzft9gD+4zmJpnpH9OKj64vyO4teCrX5wuT+g@mail.gmail.com>
I tried to find the hacked code, but it's not there anymore.
I have the docs, through, and a rough idea of what would have to be
done in order to support WEC1020 in winbond-cir.
I cannot tell when I will be able to put time into this, though :-(
Best regards,
Juan.
2013/10/17 Tom Gundersen <teg@jklm.no>:
>
>
> On Wednesday, October 16, 2013, Juan Jesús García de Soria Lucena
> <skandalfo@gmail.com> wrote:
>> Hi there,
>>
>> 2013/10/15 David Härdeman <david@hardeman.nu>
>>>
>>> IIRC, Juan had a hacked-up version of the winbond-cir driver working on
>>> his hardware back in March (the hardware seems similar enough, basically
>>> the WEC1022 adds some additional Wake-On-IR functionality...I seem to
>>> recall).
>>
>> I did indeed look at this at the time. I still have the hardware, should
>> have the hardware docs somewhere, and can look at where I left that hacked
>> code at the time...
>> I really would have liked to merge in the support for it into winbond-cir,
>> but real life took over.
>>>
>>> But I think Juan is the one to talk to. I don't have the WEC1020
>>> hardware and I don't have his experience of adding support for it...
>>
>> As I said, I still have the hardware around. I might get some time around
>> this weekend to look at it and come back with at least an idea of what is
>> left to be done.
>
> Thanks for taking a look.
>
> Cheers,
>
> Tom
--
:wq
--
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 1/2] input: touchscreen: fix spelling mistake in TSC/ADC DT binding
From: Felipe Balbi @ 2013-10-22 12:02 UTC (permalink / raw)
To: Sebastian Andrzej Siewior
Cc: Felipe Balbi, dmitry.torokhov, rob.herring, pawel.moll,
mark.rutland, swarren, ijc+devicetree, rob, bcousson,
Tony Lindgren, devicetree, Linux OMAP Mailing List, linux-input
In-Reply-To: <52663A58.9070706@linutronix.de>
[-- Attachment #1: Type: text/plain, Size: 1191 bytes --]
Hi,
On Tue, Oct 22, 2013 at 10:42:00AM +0200, Sebastian Andrzej Siewior wrote:
> On 10/21/2013 10:13 PM, Felipe Balbi wrote:
> > diff --git a/drivers/input/touchscreen/ti_am335x_tsc.c b/drivers/input/touchscreen/ti_am335x_tsc.c
> > index e1c5300..b61df9d 100644
> > --- a/drivers/input/touchscreen/ti_am335x_tsc.c
> > +++ b/drivers/input/touchscreen/ti_am335x_tsc.c
> > @@ -348,9 +348,16 @@ static int titsc_parse_dt(struct platform_device *pdev,
> > if (err < 0)
> > return err;
> >
> > - err = of_property_read_u32(node, "ti,coordiante-readouts",
> > + /*
> > + * try with new binding first. If it fails, still try with
> > + * bogus, miss-spelled version.
> > + */
> > + err = of_property_read_u32(node, "ti,coordinate-readouts",
> > &ts_dev->coordinate_readouts);
> > if (err < 0)
> > + err = of_property_read_u32(node, "ti,coordiante-readouts",
> > + &ts_dev->coordinate_readouts);
> > + if (err < 0)
> > return err;
>
> Thanks, very good. Do we keep this fallback for ever or just for a year
> or two?
That's for DT maintainers to decide but considering DT is an ABI, I
guess we need to keep for 30 years or so :-p
--
balbi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply
* [PATCHv2 0/3] Add Nokia N900 DT support
From: Sebastian Reichel @ 2013-10-22 12:47 UTC (permalink / raw)
To: Sebastian Reichel, linux-input
Cc: 'Benoît Cousson', Tony Lindgren, Rob Herring,
Pawel Moll, Mark Rutland, Stephen Warren, Ian Campbell,
Rob Landley, Russell King, Dmitry Torokhov, Grant Likely,
devicetree, linux-doc, linux-kernel, linux-arm-kernel, linux-omap,
Sebastian Reichel
Add device tree support for the Nokia N900 keyboard.
Changes since v1:
* create "DTS: ARM: TWL4030: Add keypad node" patch, which
was part of "Input: twl4030-keypad - add device tree support"
before.
* use "IS_ENABLED(CONFIG_OF)" to check if DT is enabled
Currently non-DT boot crashes for me very early, so I was not able
to check this patch using non-DT boot.
-- Sebastian
Sebastian Reichel (3):
Input: twl4030-keypad - add device tree support
DTS: ARM: TWL4030: Add keypad node
ARM: dts: N900: TWL4030 Keypad Matrix definition
.../devicetree/bindings/input/twl4030-keypad.txt | 31 ++++++++
arch/arm/boot/dts/omap3-n900.dts | 55 +++++++++++++
arch/arm/boot/dts/twl4030.dtsi | 7 ++
drivers/input/keyboard/twl4030_keypad.c | 91 ++++++++++++++++++----
4 files changed, 167 insertions(+), 17 deletions(-)
create mode 100644 Documentation/devicetree/bindings/input/twl4030-keypad.txt
--
1.8.4.rc3
^ permalink raw reply
* [PATCHv2 1/3] Input: twl4030-keypad - add device tree support
From: Sebastian Reichel @ 2013-10-22 12:47 UTC (permalink / raw)
To: Sebastian Reichel, linux-input
Cc: 'Benoît Cousson', Tony Lindgren, Rob Herring,
Pawel Moll, Mark Rutland, Stephen Warren, Ian Campbell,
Rob Landley, Russell King, Dmitry Torokhov, Grant Likely,
devicetree, linux-doc, linux-kernel, linux-arm-kernel, linux-omap,
Sebastian Reichel
In-Reply-To: <1382446042-27099-1-git-send-email-sre@debian.org>
Add device tree support for twl4030 keypad driver and update the
Documentation with twl4030 keypad device tree binding information.
Tested on Nokia N900.
Signed-off-by: Sebastian Reichel <sre@debian.org>
---
.../devicetree/bindings/input/twl4030-keypad.txt | 31 ++++++++
drivers/input/keyboard/twl4030_keypad.c | 91 ++++++++++++++++++----
2 files changed, 105 insertions(+), 17 deletions(-)
create mode 100644 Documentation/devicetree/bindings/input/twl4030-keypad.txt
diff --git a/Documentation/devicetree/bindings/input/twl4030-keypad.txt b/Documentation/devicetree/bindings/input/twl4030-keypad.txt
new file mode 100644
index 0000000..2b4bd7a
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/twl4030-keypad.txt
@@ -0,0 +1,31 @@
+* TWL4030's Keypad Controller device tree bindings
+
+TWL4030's Keypad controller is used to interface a SoC with a matrix-type
+keypad device. The keypad controller supports multiple row and column lines.
+A key can be placed at each intersection of a unique row and a unique column.
+The keypad controller can sense a key-press and key-release and report the
+event using a interrupt to the cpu.
+
+This binding is based on the matrix-keymap binding with the following
+changes:
+
+ * keypad,num-rows and keypad,num-columns are required.
+
+Required SoC Specific Properties:
+- compatible: should be one of the following
+ - "ti,twl4030-keypad": For controllers compatible with twl4030 keypad
+ controller.
+- interrupt: should be one of the following
+ - <1>: For controllers compatible with twl4030 keypad controller.
+
+Optional Properties specific to linux:
+- linux,keypad-no-autorepeat: do no enable autorepeat feature.
+
+Example:
+ twl_keypad: keypad {
+ compatible = "ti,twl4030-keypad";
+ interrupts = <1>;
+ keypad,num-rows = <8>;
+ keypad,num-columns = <8>;
+ linux,keypad-no-autorepeat;
+ };
diff --git a/drivers/input/keyboard/twl4030_keypad.c b/drivers/input/keyboard/twl4030_keypad.c
index d2d178c..034c312 100644
--- a/drivers/input/keyboard/twl4030_keypad.c
+++ b/drivers/input/keyboard/twl4030_keypad.c
@@ -33,6 +33,7 @@
#include <linux/platform_device.h>
#include <linux/i2c/twl.h>
#include <linux/slab.h>
+#include <linux/of.h>
/*
* The TWL4030 family chips include a keypad controller that supports
@@ -60,6 +61,7 @@
struct twl4030_keypad {
unsigned short keymap[TWL4030_KEYMAP_SIZE];
u16 kp_state[TWL4030_MAX_ROWS];
+ bool no_autorepeat;
unsigned n_rows;
unsigned n_cols;
unsigned irq;
@@ -324,6 +326,31 @@ static int twl4030_kp_program(struct twl4030_keypad *kp)
return 0;
}
+#if IS_ENABLED(CONFIG_OF)
+static int twl4030_keypad_parse_dt(struct device *dev,
+ struct twl4030_keypad *keypad_data)
+{
+ struct device_node *np = dev->of_node;
+ int err;
+
+ err = matrix_keypad_parse_of_params(dev, &keypad_data->n_rows,
+ &keypad_data->n_cols);
+ if (err)
+ return err;
+
+ if (of_get_property(np, "linux,input-no-autorepeat", NULL))
+ keypad_data->no_autorepeat = true;
+
+ return 0;
+}
+#else
+static inline int twl4030_keypad_parse_dt(struct device *dev,
+ struct twl4030_keypad *keypad_data)
+{
+ return -ENOSYS;
+}
+#endif
+
/*
* Registers keypad device with input subsystem
* and configures TWL4030 keypad registers
@@ -331,20 +358,12 @@ static int twl4030_kp_program(struct twl4030_keypad *kp)
static int twl4030_kp_probe(struct platform_device *pdev)
{
struct twl4030_keypad_data *pdata = pdev->dev.platform_data;
- const struct matrix_keymap_data *keymap_data;
+ const struct matrix_keymap_data *keymap_data = NULL;
struct twl4030_keypad *kp;
struct input_dev *input;
u8 reg;
int error;
- if (!pdata || !pdata->rows || !pdata->cols || !pdata->keymap_data ||
- pdata->rows > TWL4030_MAX_ROWS || pdata->cols > TWL4030_MAX_COLS) {
- dev_err(&pdev->dev, "Invalid platform_data\n");
- return -EINVAL;
- }
-
- keymap_data = pdata->keymap_data;
-
kp = kzalloc(sizeof(*kp), GFP_KERNEL);
input = input_allocate_device();
if (!kp || !input) {
@@ -352,13 +371,9 @@ static int twl4030_kp_probe(struct platform_device *pdev)
goto err1;
}
- /* Get the debug Device */
- kp->dbg_dev = &pdev->dev;
- kp->input = input;
-
- kp->n_rows = pdata->rows;
- kp->n_cols = pdata->cols;
- kp->irq = platform_get_irq(pdev, 0);
+ /* get the debug device */
+ kp->dbg_dev = &pdev->dev;
+ kp->input = input;
/* setup input device */
input->name = "TWL4030 Keypad";
@@ -370,6 +385,36 @@ static int twl4030_kp_probe(struct platform_device *pdev)
input->id.product = 0x0001;
input->id.version = 0x0003;
+ if (pdata) {
+ if (!pdata->rows || !pdata->cols || !pdata->keymap_data) {
+ dev_err(&pdev->dev, "Missing platform_data\n");
+ error = -EINVAL;
+ goto err1;
+ }
+
+ kp->n_rows = pdata->rows;
+ kp->n_cols = pdata->cols;
+ kp->no_autorepeat = !pdata->rep;
+ keymap_data = pdata->keymap_data;
+ } else {
+ error = twl4030_keypad_parse_dt(&pdev->dev, kp);
+ if (error)
+ goto err1;
+ }
+
+ if (kp->n_rows > TWL4030_MAX_ROWS || kp->n_cols > TWL4030_MAX_COLS) {
+ dev_err(&pdev->dev, "Invalid rows/cols amount specified in platform/devicetree data\n");
+ error = -EINVAL;
+ goto err1;
+ }
+
+ kp->irq = platform_get_irq(pdev, 0);
+ if (!kp->irq) {
+ dev_err(&pdev->dev, "no keyboard irq assigned\n");
+ error = -EINVAL;
+ goto err1;
+ }
+
error = matrix_keypad_build_keymap(keymap_data, NULL,
TWL4030_MAX_ROWS,
1 << TWL4030_ROW_SHIFT,
@@ -381,7 +426,7 @@ static int twl4030_kp_probe(struct platform_device *pdev)
input_set_capability(input, EV_MSC, MSC_SCAN);
/* Enable auto repeat feature of Linux input subsystem */
- if (pdata->rep)
+ if (!kp->no_autorepeat)
__set_bit(EV_REP, input->evbit);
error = input_register_device(input);
@@ -443,6 +488,17 @@ static int twl4030_kp_remove(struct platform_device *pdev)
return 0;
}
+#if IS_ENABLED(CONFIG_OF)
+static const struct of_device_id twl4030_keypad_dt_match_table[] = {
+ { .compatible = "ti,twl4030-keypad" },
+ {},
+};
+MODULE_DEVICE_TABLE(of, twl4030_keypad_dt_match_table);
+#define twl4030_keypad_dt_match of_match_ptr(twl4030_keypad_dt_match_table)
+#else
+#define twl4030_keypad_dt_match NULL
+#endif
+
/*
* NOTE: twl4030 are multi-function devices connected via I2C.
* So this device is a child of an I2C parent, thus it needs to
@@ -455,6 +511,7 @@ static struct platform_driver twl4030_kp_driver = {
.driver = {
.name = "twl4030_keypad",
.owner = THIS_MODULE,
+ .of_match_table = twl4030_keypad_dt_match,
},
};
module_platform_driver(twl4030_kp_driver);
--
1.8.4.rc3
^ permalink raw reply related
* [PATCHv2 2/3] DTS: ARM: TWL4030: Add keypad node
From: Sebastian Reichel @ 2013-10-22 12:47 UTC (permalink / raw)
To: Sebastian Reichel, linux-input
Cc: 'Benoît Cousson', Tony Lindgren, Rob Herring,
Pawel Moll, Mark Rutland, Stephen Warren, Ian Campbell,
Rob Landley, Russell King, Dmitry Torokhov, Grant Likely,
devicetree, linux-doc, linux-kernel, linux-arm-kernel, linux-omap,
Sebastian Reichel
In-Reply-To: <1382446042-27099-1-git-send-email-sre@debian.org>
Add keypad node to twl4030, so that board DTS
files can just add the keymap.
Signed-off-by: Sebastian Reichel <sre@debian.org>
---
arch/arm/boot/dts/twl4030.dtsi | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/arch/arm/boot/dts/twl4030.dtsi b/arch/arm/boot/dts/twl4030.dtsi
index ae6a17a..773c94c 100644
--- a/arch/arm/boot/dts/twl4030.dtsi
+++ b/arch/arm/boot/dts/twl4030.dtsi
@@ -97,4 +97,11 @@
compatible = "ti,twl4030-pwmled";
#pwm-cells = <2>;
};
+
+ twl_keypad: keypad {
+ compatible = "ti,twl4030-keypad";
+ interrupts = <1>;
+ keypad,num-rows = <8>;
+ keypad,num-columns = <8>;
+ };
};
--
1.8.4.rc3
^ permalink raw reply related
* [PATCHv2 3/3] ARM: dts: N900: TWL4030 Keypad Matrix definition
From: Sebastian Reichel @ 2013-10-22 12:47 UTC (permalink / raw)
To: Sebastian Reichel, linux-input
Cc: 'Benoît Cousson', Tony Lindgren, Rob Herring,
Pawel Moll, Mark Rutland, Stephen Warren, Ian Campbell,
Rob Landley, Russell King, Dmitry Torokhov, Grant Likely,
devicetree, linux-doc, linux-kernel, linux-arm-kernel, linux-omap,
Sebastian Reichel
In-Reply-To: <1382446042-27099-1-git-send-email-sre@debian.org>
Add Keyboard Matrix information to N900's DTS file.
This patch maps the keys exactly as the original
board code.
Signed-off-by: Sebastian Reichel <sre@debian.org>
---
arch/arm/boot/dts/omap3-n900.dts | 55 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 55 insertions(+)
diff --git a/arch/arm/boot/dts/omap3-n900.dts b/arch/arm/boot/dts/omap3-n900.dts
index c2b92e8..30ac779 100644
--- a/arch/arm/boot/dts/omap3-n900.dts
+++ b/arch/arm/boot/dts/omap3-n900.dts
@@ -109,6 +109,61 @@
#include "twl4030.dtsi"
#include "twl4030_omap3.dtsi"
+&twl_keypad {
+ linux,keymap = < 0x00000010 /* KEY_Q */
+ 0x00010018 /* KEY_O */
+ 0x00020019 /* KEY_P */
+ 0x00030033 /* KEY_COMMA */
+ 0x0004000e /* KEY_BACKSPACE */
+ 0x0006001e /* KEY_A */
+ 0x0007001f /* KEY_S */
+
+ 0x01000011 /* KEY_W */
+ 0x01010020 /* KEY_D */
+ 0x01020021 /* KEY_F */
+ 0x01030022 /* KEY_G */
+ 0x01040023 /* KEY_H */
+ 0x01050024 /* KEY_J */
+ 0x01060025 /* KEY_K */
+ 0x01070026 /* KEY_L */
+
+ 0x02000012 /* KEY_E */
+ 0x02010034 /* KEY_DOT */
+ 0x02020067 /* KEY_UP */
+ 0x0203001c /* KEY_ENTER */
+ 0x0205002c /* KEY_Z */
+ 0x0206002d /* KEY_X */
+ 0x0207002e /* KEY_C */
+ 0x02080043 /* KEY_F9 */
+
+ 0x03000013 /* KEY_R */
+ 0x0301002f /* KEY_V */
+ 0x03020030 /* KEY_B */
+ 0x03030031 /* KEY_N */
+ 0x03040032 /* KEY_M */
+ 0x03050039 /* KEY_SPACE */
+ 0x03060039 /* KEY_SPACE */
+ 0x03070069 /* KEY_LEFT */
+
+ 0x04000014 /* KEY_T */
+ 0x0401006c /* KEY_DOWN */
+ 0x0402006a /* KEY_RIGHT */
+ 0x0404001d /* KEY_LEFTCTRL */
+ 0x04050064 /* KEY_RIGHTALT */
+ 0x0406002a /* KEY_LEFTSHIFT */
+ 0x04080044 /* KEY_F10 */
+
+ 0x05000015 /* KEY_Y */
+ 0x05080057 /* KEY_F11 */
+
+ 0x06000016 /* KEY_U */
+
+ 0x07000017 /* KEY_I */
+ 0x07010041 /* KEY_F7 */
+ 0x07020042 /* KEY_F8 */
+ >;
+};
+
&twl_gpio {
ti,pullups = <0x0>;
ti,pulldowns = <0x03ff3f>; /* BIT(0..5) | BIT(8..17) */
--
1.8.4.rc3
^ permalink raw reply related
* [PATCH 2/4] Input: twl4030-pwrbutton: use dev_err for errors
From: Sebastian Reichel @ 2013-10-22 12:55 UTC (permalink / raw)
To: Sebastian Reichel, linux-input
Cc: 'Benoît Cousson', Tony Lindgren, Rob Herring,
Pawel Moll, Mark Rutland, Stephen Warren, Ian Campbell,
Rob Landley, Russell King, Dmitry Torokhov, Grant Likely,
devicetree, linux-doc, linux-kernel, linux-arm-kernel, linux-omap,
Sebastian Reichel
In-Reply-To: <1382446504-27837-1-git-send-email-sre@debian.org>
Use dev_err() to output errors instead of dev_dbg().
Signed-off-by: Sebastian Reichel <sre@debian.org>
---
drivers/input/misc/twl4030-pwrbutton.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/input/misc/twl4030-pwrbutton.c b/drivers/input/misc/twl4030-pwrbutton.c
index e450947..4e7a810 100644
--- a/drivers/input/misc/twl4030-pwrbutton.c
+++ b/drivers/input/misc/twl4030-pwrbutton.c
@@ -60,7 +60,7 @@ static int twl4030_pwrbutton_probe(struct platform_device *pdev)
pwr = input_allocate_device();
if (!pwr) {
- dev_dbg(&pdev->dev, "Can't allocate power button\n");
+ dev_err(&pdev->dev, "Can't allocate power button\n");
return -ENOMEM;
}
@@ -74,13 +74,13 @@ static int twl4030_pwrbutton_probe(struct platform_device *pdev)
IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
"twl4030_pwrbutton", pwr);
if (err < 0) {
- dev_dbg(&pdev->dev, "Can't get IRQ for pwrbutton: %d\n", err);
+ dev_err(&pdev->dev, "Can't get IRQ for pwrbutton: %d\n", err);
goto free_input_dev;
}
err = input_register_device(pwr);
if (err) {
- dev_dbg(&pdev->dev, "Can't register power button: %d\n", err);
+ dev_err(&pdev->dev, "Can't register power button: %d\n", err);
goto free_irq;
}
--
1.8.4.rc3
^ permalink raw reply related
* [PATCH 3/4] Input: twl4030-pwrbutton: simplify driver using devm_*
From: Sebastian Reichel @ 2013-10-22 12:55 UTC (permalink / raw)
To: Sebastian Reichel, linux-input
Cc: Mark Rutland, devicetree, Dmitry Torokhov, Russell King,
Rob Landley, Pawel Moll, Stephen Warren, Tony Lindgren,
Sebastian Reichel, Ian Campbell, linux-doc, linux-kernel,
Rob Herring, 'Benoît Cousson', Grant Likely,
linux-omap, linux-arm-kernel
In-Reply-To: <1382446504-27837-1-git-send-email-sre@debian.org>
Use managed irq resource to simplify the driver.
Signed-off-by: Sebastian Reichel <sre@debian.org>
---
drivers/input/misc/twl4030-pwrbutton.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/input/misc/twl4030-pwrbutton.c b/drivers/input/misc/twl4030-pwrbutton.c
index 4e7a810..4ab9243 100644
--- a/drivers/input/misc/twl4030-pwrbutton.c
+++ b/drivers/input/misc/twl4030-pwrbutton.c
@@ -70,7 +70,7 @@ static int twl4030_pwrbutton_probe(struct platform_device *pdev)
pwr->phys = "twl4030_pwrbutton/input0";
pwr->dev.parent = &pdev->dev;
- err = request_threaded_irq(irq, NULL, powerbutton_irq,
+ err = devm_request_threaded_irq(&pwr->dev, irq, NULL, powerbutton_irq,
IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
"twl4030_pwrbutton", pwr);
if (err < 0) {
@@ -81,15 +81,13 @@ static int twl4030_pwrbutton_probe(struct platform_device *pdev)
err = input_register_device(pwr);
if (err) {
dev_err(&pdev->dev, "Can't register power button: %d\n", err);
- goto free_irq;
+ goto free_input_dev;
}
platform_set_drvdata(pdev, pwr);
return 0;
-free_irq:
- free_irq(irq, pwr);
free_input_dev:
input_free_device(pwr);
return err;
@@ -98,9 +96,7 @@ free_input_dev:
static int __exit twl4030_pwrbutton_remove(struct platform_device *pdev)
{
struct input_dev *pwr = platform_get_drvdata(pdev);
- int irq = platform_get_irq(pdev, 0);
- free_irq(irq, pwr);
input_unregister_device(pwr);
return 0;
--
1.8.4.rc3
^ permalink raw reply related
* [PATCH 4/4] ARM: dts: twl4030: Add power button support
From: Sebastian Reichel @ 2013-10-22 12:55 UTC (permalink / raw)
To: Sebastian Reichel, linux-input
Cc: Mark Rutland, devicetree, Dmitry Torokhov, Russell King,
Rob Landley, Pawel Moll, Stephen Warren, Tony Lindgren,
Sebastian Reichel, Ian Campbell, linux-doc, linux-kernel,
Rob Herring, 'Benoît Cousson', Grant Likely,
linux-omap, linux-arm-kernel
In-Reply-To: <1382446504-27837-1-git-send-email-sre@debian.org>
Enable support for the power button.
Signed-off-by: Sebastian Reichel <sre@debian.org>
---
arch/arm/boot/dts/twl4030.dtsi | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/arm/boot/dts/twl4030.dtsi b/arch/arm/boot/dts/twl4030.dtsi
index 773c94c..19e3cd0 100644
--- a/arch/arm/boot/dts/twl4030.dtsi
+++ b/arch/arm/boot/dts/twl4030.dtsi
@@ -104,4 +104,9 @@
keypad,num-rows = <8>;
keypad,num-columns = <8>;
};
+
+ twl_pwrbutton: pwrbutton {
+ compatible = "ti,twl4030-pwrbutton";
+ interrupts = <8>;
+ };
};
--
1.8.4.rc3
^ permalink raw reply related
* [PATCH 0/4] Add N900 powerbutton DT support
From: Sebastian Reichel @ 2013-10-22 12:55 UTC (permalink / raw)
To: Sebastian Reichel, linux-input
Cc: 'Benoît Cousson', Tony Lindgren, Rob Herring,
Pawel Moll, Mark Rutland, Stephen Warren, Ian Campbell,
Rob Landley, Russell King, Dmitry Torokhov, Grant Likely,
devicetree, linux-doc, linux-kernel, linux-arm-kernel, linux-omap,
Sebastian Reichel
This patchset adds support for the Nokia N900
powerbutton.
Currently non-DT boot crashes for me very early,
so I was not able to check this patch using non-DT
boot.
It would be nice if somebody can check if the first
patch works using non-DT boot. It should be enough
to test it with any omap3 board using the twl4030
power button.
Sebastian Reichel (4):
Input: twl4030-pwrbutton - add device tree support
Input: twl4030-pwrbutton: use dev_err for errors
Input: twl4030-pwrbutton: simplify driver using devm_*
ARM: dts: twl4030: Add power button support
arch/arm/boot/dts/twl4030.dtsi | 5 +++++
drivers/input/misc/twl4030-pwrbutton.c | 33 ++++++++++++++++++++-------------
2 files changed, 25 insertions(+), 13 deletions(-)
--
1.8.4.rc3
^ permalink raw reply
* [PATCH 1/4] Input: twl4030-pwrbutton - add device tree support
From: Sebastian Reichel @ 2013-10-22 12:55 UTC (permalink / raw)
To: Sebastian Reichel, linux-input
Cc: 'Benoît Cousson', Tony Lindgren, Rob Herring,
Pawel Moll, Mark Rutland, Stephen Warren, Ian Campbell,
Rob Landley, Russell King, Dmitry Torokhov, Grant Likely,
devicetree, linux-doc, linux-kernel, linux-arm-kernel, linux-omap,
Sebastian Reichel
In-Reply-To: <1382446504-27837-1-git-send-email-sre@debian.org>
Add device tree support for twl4030 power button driver.
Signed-off-by: Sebastian Reichel <sre@debian.org>
---
drivers/input/misc/twl4030-pwrbutton.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/drivers/input/misc/twl4030-pwrbutton.c b/drivers/input/misc/twl4030-pwrbutton.c
index b9a05fd..e450947 100644
--- a/drivers/input/misc/twl4030-pwrbutton.c
+++ b/drivers/input/misc/twl4030-pwrbutton.c
@@ -52,7 +52,7 @@ static irqreturn_t powerbutton_irq(int irq, void *_pwr)
return IRQ_HANDLED;
}
-static int __init twl4030_pwrbutton_probe(struct platform_device *pdev)
+static int twl4030_pwrbutton_probe(struct platform_device *pdev)
{
struct input_dev *pwr;
int irq = platform_get_irq(pdev, 0);
@@ -106,16 +106,27 @@ static int __exit twl4030_pwrbutton_remove(struct platform_device *pdev)
return 0;
}
+#if IS_ENABLED(CONFIG_OF)
+static const struct of_device_id twl4030_pwrbutton_dt_match_table[] = {
+ { .compatible = "ti,twl4030-pwrbutton" },
+ {},
+};
+MODULE_DEVICE_TABLE(of, twl4030_pwrbutton_dt_match_table);
+#define twl4030_pwrbutton_dt_match of_match_ptr(twl4030_pwrbutton_dt_match_table)
+#else
+#define twl4030_pwrbutton_dt_match NULL
+#endif
+
static struct platform_driver twl4030_pwrbutton_driver = {
+ .probe = twl4030_pwrbutton_probe,
.remove = __exit_p(twl4030_pwrbutton_remove),
.driver = {
.name = "twl4030_pwrbutton",
.owner = THIS_MODULE,
+ .of_match_table = twl4030_pwrbutton_dt_match,
},
};
-
-module_platform_driver_probe(twl4030_pwrbutton_driver,
- twl4030_pwrbutton_probe);
+module_platform_driver(twl4030_pwrbutton_driver);
MODULE_ALIAS("platform:twl4030_pwrbutton");
MODULE_DESCRIPTION("Triton2 Power Button");
--
1.8.4.rc3
^ permalink raw reply related
* Re: [PATCH 1/4] Input: twl4030-pwrbutton - add device tree support
From: Felipe Balbi @ 2013-10-22 13:50 UTC (permalink / raw)
To: Sebastian Reichel
Cc: Sebastian Reichel, linux-input, 'Benoît Cousson',
Tony Lindgren, Rob Herring, Pawel Moll, Mark Rutland,
Stephen Warren, Ian Campbell, Rob Landley, Russell King,
Dmitry Torokhov, Grant Likely, devicetree, linux-doc,
linux-kernel, linux-arm-kernel, linux-omap
In-Reply-To: <1382446504-27837-2-git-send-email-sre@debian.org>
[-- Attachment #1: Type: text/plain, Size: 1485 bytes --]
Hi,
On Tue, Oct 22, 2013 at 02:55:01PM +0200, Sebastian Reichel wrote:
> Add device tree support for twl4030 power button driver.
>
> Signed-off-by: Sebastian Reichel <sre@debian.org>
> ---
> drivers/input/misc/twl4030-pwrbutton.c | 19 +++++++++++++++----
> 1 file changed, 15 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/input/misc/twl4030-pwrbutton.c b/drivers/input/misc/twl4030-pwrbutton.c
> index b9a05fd..e450947 100644
> --- a/drivers/input/misc/twl4030-pwrbutton.c
> +++ b/drivers/input/misc/twl4030-pwrbutton.c
> @@ -52,7 +52,7 @@ static irqreturn_t powerbutton_irq(int irq, void *_pwr)
> return IRQ_HANDLED;
> }
>
> -static int __init twl4030_pwrbutton_probe(struct platform_device *pdev)
> +static int twl4030_pwrbutton_probe(struct platform_device *pdev)
> {
> struct input_dev *pwr;
> int irq = platform_get_irq(pdev, 0);
> @@ -106,16 +106,27 @@ static int __exit twl4030_pwrbutton_remove(struct platform_device *pdev)
> return 0;
> }
>
> +#if IS_ENABLED(CONFIG_OF)
> +static const struct of_device_id twl4030_pwrbutton_dt_match_table[] = {
> + { .compatible = "ti,twl4030-pwrbutton" },
> + {},
> +};
> +MODULE_DEVICE_TABLE(of, twl4030_pwrbutton_dt_match_table);
> +#define twl4030_pwrbutton_dt_match of_match_ptr(twl4030_pwrbutton_dt_match_table)
> +#else
> +#define twl4030_pwrbutton_dt_match NULL
> +#endif
you don't ned this trickery.. just always device the match table.
--
balbi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply
* Re: [PATCH v2] add sur40 driver for Samsung SUR40 (aka MS Surface 2.0/Pixelsense)
From: David Herrmann @ 2013-10-22 15:22 UTC (permalink / raw)
To: Florian Echtler
Cc: Dmitry Torokhov, open list:HID CORE LAYER, Benjamin Tissoires,
Henrik Rydberg
In-Reply-To: <5266164C.3060509@butterbrot.org>
Hi
On Tue, Oct 22, 2013 at 8:08 AM, Florian Echtler <floe@butterbrot.org> wrote:
> Hello Dmitry,
>
> thanks for your quick feedback, a few questions below:
>
> On 21.10.2013 18:20, Dmitry Torokhov wrote:
>> On Sun, Oct 20, 2013 at 06:49:11PM +0200, Florian Echtler wrote:
>>> +/* read 512 bytes from endpoint 0x86 -> get header + blobs */
>>> +struct sur40_header {
>>> +
>>> + uint16_t type; /* always 0x0001 */
>>> + uint16_t count; /* count of blobs (if 0: continue prev. packet) */
>>> +
>>> + uint32_t packet_id;
>>> +
>>> + uint32_t timestamp; /* milliseconds (inc. by 16 or 17 each frame) */
>>> + uint32_t unknown; /* "epoch?" always 02/03 00 00 00 */
>>
>> Proper internal kernel types are u8, u16, u32. For user-facing APIs
>> __u8, __u16, and __u32 should be used. Also, since this is data coming
>> directly off the wire, you should be using __le16, __le32, etc, and then
>> do __leXX_to_cpu() conversion before using it in calculations.
> OK, I'll switch to u32 throughout (also for the float, I'll explain in a
> commment). However, I haven't found a single other touchscreen driver
> which uses __le32, even though they all probably process raw wire data -
> can you suggest an example?
These are probably all broken or the hardware guarantees
cpu-byte-order. Anyway, what you should do is use __le16/32 for your
types which represent data from the device. Then call le16_to_cpu() on
these values to convert it to host byte-order. Something like this:
struct sur40_raw_header {
__le16 type;
__le32 unused;
__le8 count;
} __packed;
struct sur40_header {
u16 type;
u8 count;
};
static void parse_data(const struct sur40_raw_header *h)
{
struct sur40_header d;
d.type = __le16_to_cpu(h->type);
d.count = h->count;
do_something(&d);
}
>>> +/* debug helper macro */
>>> +#define get_dev(x) (&(x->usbdev->dev))
>> Just stick that dev in sur40_state and then use sur40->dev throughout.
> OK.
>
>>> + struct sur40_header *header = &(sur40->bulk_in_buffer->header);
>> No need to have parenthesis around & operator.
>>> + struct sur40_blob *inblob = &(sur40->bulk_in_buffer->blobs[0]);
>> Same here.
> Intention seems clearer to me with parentheses, but if this doesn't
> conform to coding style, I'll fix it.
We never use parentheses for that. You will get used to it ;)
>>> + if (!sur40->bulk_in_buffer) {
>>> + dev_err(&interface->dev, "Unable to allocate input buffer.");
>>> + sur40_delete(sur40);
>> Would prefer standard kernel error unwinding style (gotos to proper
>> unwinding point).
> Something like this example from ucb1400_ts?
>
> error = input_register_device(ucb->ts_idev);
> if (error)
> goto err_free_irq;
>
> return 0;
>
> err_free_irq:
> free_irq(ucb->irq, ucb);
> err_free_devs:
> input_free_device(ucb->ts_idev);
> err:
> return error;
Yepp, exactly.
David
^ permalink raw reply
* Re: [PATCH v2] add sur40 driver for Samsung SUR40 (aka MS Surface 2.0/Pixelsense)
From: Dmitry Torokhov @ 2013-10-22 15:46 UTC (permalink / raw)
To: Florian Echtler; +Cc: linux-input, benjamin.tissoires, rydberg, dh.herrmann
In-Reply-To: <5266164C.3060509@butterbrot.org>
On Tue, Oct 22, 2013 at 08:08:12AM +0200, Florian Echtler wrote:
> Hello Dmitry,
>
> thanks for your quick feedback, a few questions below:
>
> On 21.10.2013 18:20, Dmitry Torokhov wrote:
> > On Sun, Oct 20, 2013 at 06:49:11PM +0200, Florian Echtler wrote:
> >> +/* read 512 bytes from endpoint 0x86 -> get header + blobs */
> >> +struct sur40_header {
> >> +
> >> + uint16_t type; /* always 0x0001 */
> >> + uint16_t count; /* count of blobs (if 0: continue prev. packet) */
> >> +
> >> + uint32_t packet_id;
> >> +
> >> + uint32_t timestamp; /* milliseconds (inc. by 16 or 17 each frame) */
> >> + uint32_t unknown; /* "epoch?" always 02/03 00 00 00 */
> >
> > Proper internal kernel types are u8, u16, u32. For user-facing APIs
> > __u8, __u16, and __u32 should be used. Also, since this is data coming
> > directly off the wire, you should be using __le16, __le32, etc, and then
> > do __leXX_to_cpu() conversion before using it in calculations.
> OK, I'll switch to u32 throughout (also for the float, I'll explain in a
> commment). However, I haven't found a single other touchscreen driver
> which uses __le32, even though they all probably process raw wire data -
> can you suggest an example?
Not necessarily le32, but:
[dtor@dtor-d630 work]$ grep -ri to_cpu drivers/input/touchscreen/
drivers/input/touchscreen/atmel_mxt_ts.c:
le16_to_cpus(&object->start_address);
drivers/input/touchscreen/atmel_mxt_ts.c: le16_to_cpus(range.x);
drivers/input/touchscreen/atmel_mxt_ts.c: le16_to_cpus(range.y);
drivers/input/touchscreen/cyttsp_core.c: input_report_abs(input, ABS_MT_POSITION_X, be16_to_cpu(tch->x));
drivers/input/touchscreen/cyttsp_core.c: input_report_abs(input, ABS_MT_POSITION_Y, be16_to_cpu(tch->y));
drivers/input/touchscreen/ads7846.c: status = be16_to_cpu(req->sample);
drivers/input/touchscreen/ads7846.c: status = be16_to_cpu(*((u16 *)&req->sample[1]));
drivers/input/touchscreen/ads7846.c: return be16_to_cpup((__be16 *)&(((char*)t->rx_buf)[1])) >> 3;
drivers/input/touchscreen/ads7846.c: return be16_to_cpup((__be16 *)t->rx_buf) >> 3;
drivers/input/touchscreen/usbtouchscreen.c: unsigned int data_len = be16_to_cpu(packet->data_len);
drivers/input/touchscreen/usbtouchscreen.c: unsigned int x_len = be16_to_cpu(packet->x_len);
drivers/input/touchscreen/usbtouchscreen.c: unsigned int y_len = be16_to_cpu(packet->y_len);
drivers/input/touchscreen/usbtouchscreen.c: le16_to_cpu(udev->descriptor.idVendor),
drivers/input/touchscreen/usbtouchscreen.c: le16_to_cpu(udev->descriptor.idProduct));
drivers/input/touchscreen/wacom_i2c.c: x = le16_to_cpup((__le16 *)&data[4]);
drivers/input/touchscreen/wacom_i2c.c: y = le16_to_cpup((__le16 *)&data[6]);
drivers/input/touchscreen/wacom_i2c.c: pressure = le16_to_cpup((__le16 *)&data[8]);
>
> >> +/* debug helper macro */
> >> +#define get_dev(x) (&(x->usbdev->dev))
> > Just stick that dev in sur40_state and then use sur40->dev throughout.
> OK.
>
> >> + struct sur40_header *header = &(sur40->bulk_in_buffer->header);
> > No need to have parenthesis around & operator.
> >> + struct sur40_blob *inblob = &(sur40->bulk_in_buffer->blobs[0]);
> > Same here.
> Intention seems clearer to me with parentheses, but if this doesn't
> conform to coding style, I'll fix it.
>
> >> + if (!sur40->bulk_in_buffer) {
> >> + dev_err(&interface->dev, "Unable to allocate input buffer.");
> >> + sur40_delete(sur40);
> > Would prefer standard kernel error unwinding style (gotos to proper
> > unwinding point).
> Something like this example from ucb1400_ts?
>
> error = input_register_device(ucb->ts_idev);
> if (error)
> goto err_free_irq;
>
> return 0;
>
> err_free_irq:
> free_irq(ucb->irq, ucb);
> err_free_devs:
> input_free_device(ucb->ts_idev);
> err:
> return error;
>
Yes, please.
--
Dmitry
^ permalink raw reply
* Re: [PATCH v2] add sur40 driver for Samsung SUR40 (aka MS Surface 2.0/Pixelsense)
From: Dmitry Torokhov @ 2013-10-22 15:47 UTC (permalink / raw)
To: David Herrmann
Cc: Florian Echtler, open list:HID CORE LAYER, Benjamin Tissoires,
Henrik Rydberg
In-Reply-To: <CANq1E4R88OooYjFz0d46uJZgvD=a_qzVVxV74wQzWfaUB7WBEg@mail.gmail.com>
On Tue, Oct 22, 2013 at 05:22:08PM +0200, David Herrmann wrote:
> Hi
>
> On Tue, Oct 22, 2013 at 8:08 AM, Florian Echtler <floe@butterbrot.org> wrote:
> > Hello Dmitry,
> >
> > thanks for your quick feedback, a few questions below:
> >
> > On 21.10.2013 18:20, Dmitry Torokhov wrote:
> >> On Sun, Oct 20, 2013 at 06:49:11PM +0200, Florian Echtler wrote:
> >>> +/* read 512 bytes from endpoint 0x86 -> get header + blobs */
> >>> +struct sur40_header {
> >>> +
> >>> + uint16_t type; /* always 0x0001 */
> >>> + uint16_t count; /* count of blobs (if 0: continue prev. packet) */
> >>> +
> >>> + uint32_t packet_id;
> >>> +
> >>> + uint32_t timestamp; /* milliseconds (inc. by 16 or 17 each frame) */
> >>> + uint32_t unknown; /* "epoch?" always 02/03 00 00 00 */
> >>
> >> Proper internal kernel types are u8, u16, u32. For user-facing APIs
> >> __u8, __u16, and __u32 should be used. Also, since this is data coming
> >> directly off the wire, you should be using __le16, __le32, etc, and then
> >> do __leXX_to_cpu() conversion before using it in calculations.
> > OK, I'll switch to u32 throughout (also for the float, I'll explain in a
> > commment). However, I haven't found a single other touchscreen driver
> > which uses __le32, even though they all probably process raw wire data -
> > can you suggest an example?
>
> These are probably all broken or the hardware guarantees
> cpu-byte-order. Anyway, what you should do is use __le16/32 for your
> types which represent data from the device. Then call le16_to_cpu() on
> these values to convert it to host byte-order. Something like this:
>
> struct sur40_raw_header {
> __le16 type;
> __le32 unused;
> __le8 count;
Not the last one please ;)
Thanks.
--
Dmitry
^ permalink raw reply
* Re: [PATCH 01/02] input: serio: use DEVICE_ATTR_RO()
From: Dmitry Torokhov @ 2013-10-22 15:51 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-input
In-Reply-To: <20131022061219.GA15412@kroah.com>
On Tue, Oct 22, 2013 at 07:12:19AM +0100, Greg Kroah-Hartman wrote:
> On Mon, Oct 21, 2013 at 09:25:32AM -0700, Dmitry Torokhov wrote:
> > Hi Greg,
> >
> > On Mon, Oct 07, 2013 at 06:08:23PM -0700, Greg Kroah-Hartman wrote:
> > > From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > >
> > > Convert the serio sysfs fiels to use the DEVICE_ATTR_RO() macros to make
> > > it easier to audit the correct sysfs file permission usage.
> >
> > Sorry for the delay. Frankly I am not a fan of DEVICE_ATTR macros as it
> > forces particular naming of the attribute structures and methods and
> > forces us to lose the module prefix in names. I prefer all functions and
> > file-scope variables have module prefix because in the absence of
> > language-supported namespaces this is the one thing that insulates
> > drivers from changes in shared headers.
>
> No sysfs read/write functions should ever be exported out of the local
> file "scope", so why is this an issue? I have run into it being a
> problem for some files, where people have device/bus/class sysfs files
> all in the same .c file, but that usage is very limited.
It is not about exporting read/write functions, it is about newly
defined data from common headers stomping on the local module
definitions.
>
> I'm trying to eventually convert the whole kernel to use the
> DEVICE_ATTR_??() macros to make it so that we can audit the sysfs file
> permissions easier, by making them impossible to get wrong. We have had
> problems in the past where device files had incorrect permissions and
> unprivilidged users could do things they shouldn't have. Using these
> macros _should_ prevent almost all of that from even being possible.
Sounds more like task for sparse to ensure we have sane permission bits.
>
> Now odds are, I'll never be able to remove DEVICE_ATTR() from the tree,
> as there are some strange files that use crazy permissions and we have
> to live with that, but for all of the "simple" files, like are done
> here, I'd really like to use them, especially as it provides a
> kernel-wide uniformity to the naming of attribute function calls, which
> is a huge benifit as well.
>
> Note, I did apply this patch to my tree already, and it's queued up for
> 3.13-rc1. If you really object to it, I'll revert it, and fix up the
> 02/02 patch in this series to not need it, but I'd really like you to
> reconsider your objection.
Nah, that is fine.
Thanks.
--
Dmitry
^ 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