* Re: [PATCH] HID: sony: Add force feedback support for Dualshock3 USB
From: Jiri Kosina @ 2013-11-11 10:26 UTC (permalink / raw)
To: Sven Eckelmann; +Cc: linux-input, Colin Leitner
In-Reply-To: <1384021557-24106-1-git-send-email-sven@narfation.org>
On Sat, 9 Nov 2013, Sven Eckelmann wrote:
> Sony Dualshock 3 controllers have two motors which can be used to provide
> simple force feedback rumble effects. The right motor is can be used to create
> a weak rumble effect but does not allow to set the force. The left motor is
> used to create a strong rumble effect with adjustable intensity.
>
> The state of both motors can be changed using HID_OUTPUT_REPORT packets and
> have no timing information. FF memless is used to keep track of the timing and
> the sony driver just generates the necessary URBs.
>
> Signed-off-by: Sven Eckelmann <sven@narfation.org>
Applied, thanks.
--
Jiri Kosina
SUSE Labs
^ permalink raw reply
* Re: [PATCH 2/2] Input: usbtouchscreen: ignore eGalax/D-Wav/EETI HIDs
From: Jiri Kosina @ 2013-11-11 10:21 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Forest Bond, linux-input, Sebastian Dalfuß, Daniel Ritz,
Max Weninger, Christian Engelmayer
In-Reply-To: <20131108174937.GB17307@core.coreip.homeip.net>
On Fri, 8 Nov 2013, Dmitry Torokhov wrote:
> > > From: Forest Bond <forest.bond@rapidrollout.com>
> > >
> > > The HID driver now handles these devices, regardless of what protocol
> > > the device claims it supports.
> > >
> > > Signed-off-by: Forest Bond <forest.bond@rapidrollout.com>
> >
> > Dmitry,
> >
> > could you please Ack this, so that it can be applied together with 1/2?
> > Thanks!
>
> Jiri,
>
> Sorry for the delay. Yes, please merge through your tree.
>
> Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Thanks, I have applied both patches now.
--
Jiri Kosina
SUSE Labs
^ permalink raw reply
* Re: [PATCH v3] add sur40 driver for Samsung SUR40 (aka MS Surface 2.0/Pixelsense)
From: Florian Echtler @ 2013-11-11 10:08 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input, benjamin.tissoires, rydberg, dh.herrmann
In-Reply-To: <20131111073105.GA7645@core.coreip.homeip.net>
[-- Attachment #1: Type: text/plain, Size: 969 bytes --]
Hello Dmitry,
On 11.11.2013 08:31, Dmitry Torokhov wrote:
> Hi Florian,
>
> On Wed, Nov 06, 2013 at 03:26:51PM +0100, Florian Echtler wrote:
>> +
>> + /* max value unknown, but major/minor axis
>> + * can never be larger than screen */
>> + input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR,
>> + 0, SENSOR_RES_X, 0, 0);
>> + input_set_abs_params(input_dev, ABS_MT_TOUCH_MINOR,
>> + 0, SENSOR_RES_Y, 0, 0);
>
> If the range is unknown do we really want to specify min/max?
Geometrically speaking, these _are_ the min/max values. I can't say for
sure if the device has a cutoff threshold somewhere, but in terms of
geometric interpretation, I'd say this is correct.
> Also, does the patch below mess up or device or it still works?
I'll test this tomorrow (no access to SUR40 today). If everything works,
should I resubmit my patch with yours included or just tell you that
it's fine?
BR, Florian
--
SENT FROM MY DEC VT50 TERMINAL
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply
* Re: My "enable bluetooth" hotkey increase brightness instead
From: Gianfranco Costamagna @ 2013-11-11 8:48 UTC (permalink / raw)
To: David Herrmann; +Cc: linux-input@vger.kernel.org
In-Reply-To: <CANq1E4TfTMSkpVmhCojRpRPLHNPhARn1YPr5ME97AWo738NZcg@mail.gmail.com>
Hi
> Il Lunedì 11 Novembre 2013 8:50, David Herrmann <dh.herrmann@gmail.com> ha scritto:
> > Hi
>
> On Thu, Nov 7, 2013 at 11:15 PM, Gianfranco Costamagna
> <costamagnagianfranco@yahoo.it> wrote:
>>
>> ----- Messaggio originale -----
>>
>>> Da: David Herrmann <dh.herrmann@gmail.com>
>>> A: Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
>>> Cc: "linux-input@vger.kernel.org"
> <linux-input@vger.kernel.org>
>>> Inviato: Giovedì 7 Novembre 2013 15:44
>>> Oggetto: Re: My "enable bluetooth" hotkey increase brightness
> instead
>>>
>>> Hi
>>
>> Hi David
>>
>>>
>>> On Tue, Oct 29, 2013 at 9:52 AM, Gianfranco Costamagna
>>> <costamagnagianfranco@yahoo.it> wrote:
>>>> Hi linux-input developers, I write here since suggested on my
> launchpad
>>> bug.
>>>>
>>>> The problem is really simple, I have an acer aspire 6930G and when
> I press
>>> "enable bluetooth" on my keyboard I get the brightness of my
> screen
>>> increased.
>>>> I reported on launchpad my configuration [1], and also opened a
> bug here
>>> [2].
>>>>
>>>> the problem seems to be in the kernel so far, but I honestly
> don't know
>>> where to better report it and how to debug/check it.
>>>>
>>>> I tested also kernel 3.12rc6 without any better outcome.
>>>>
>>>> Can anybody please help me out with this problem?
>>>>
>>>> Many thanks!
>>>
>>> Please use "evtest" to see which events are generated for
> your keys:
>>> http://cgit.freedesktop.org/evtest/
>>> You need to run it on your keyboard-event chardev, something like:
>>> /dev/input/eventX (just try each until you find your keyboard).
>>>
>>> Please append the information you get and press the key which is
>>> incorrectly mapped.
>>
>> Wonderful hint! Now when I press the bluetooth key I see two different
> event fired from the keyboard
>> ^Clocutus@Unimatrix02-Saucy:~ $ sudo evtest
>> No device specified, trying to scan all of /dev/input/event*
>> Available devices:
>> /dev/input/event0: Lid Switch
>> /dev/input/event1: Power Button
>> /dev/input/event2: Sleep Button
>> /dev/input/event3: Power Button
>> /dev/input/event4: AT Translated Set 2 keyboard
>> /dev/input/event5: Video Bus
>> /dev/input/event6: HDA Intel HDMI/DP,pcm=3 Phantom
>> /dev/input/event7: HDA Intel Headphone
>> /dev/input/event8: HDA Intel Line
>> /dev/input/event9: HDA Intel Mic
>> /dev/input/event10: SynPS/2 Synaptics TouchPad
>> /dev/input/event11: Acer Crystal Eye webcam
>> Select the device event number [0-12]: 4
>> Input driver version is 1.0.1
>> Input device ID: bus 0x11 vendor 0x1 product 0x1 version 0xab41
>> Input device name: "AT Translated Set 2 keyboard"
>> Supported events:
>> Event type 0 (EV_SYN)
>> Event type 1 (EV_KEY)
>> Event code 1 (KEY_ESC)
>> Event code 2 (KEY_1)
>> Event code 3 (KEY_2)
>> Event code 4 (KEY_3)
>> Event code 5 (KEY_4)
>> Event code 6 (KEY_5)
>> Event code 7 (KEY_6)
>> Event code 8 (KEY_7)
>> Event code 9 (KEY_8)
>> Event code 10 (KEY_9)
>> Event code 11 (KEY_0)
>> Event code 12 (KEY_MINUS)
>> Event code 13 (KEY_EQUAL)
>> Event code 14 (KEY_BACKSPACE)
>> Event code 15 (KEY_TAB)
>> Event code 16 (KEY_Q)
>> Event code 17 (KEY_W)
>> Event code 18 (KEY_E)
>> Event code 19 (KEY_R)
>> Event code 20 (KEY_T)
>> Event code 21 (KEY_Y)
>> Event code 22 (KEY_U)
>> Event code 23 (KEY_I)
>> Event code 24 (KEY_O)
>> Event code 25 (KEY_P)
>> Event code 26 (KEY_LEFTBRACE)
>> Event code 27 (KEY_RIGHTBRACE)
>> Event code 28 (KEY_ENTER)
>> Event code 29 (KEY_LEFTCTRL)
>> Event code 30 (KEY_A)
>> Event code 31 (KEY_S)
>> Event code 32 (KEY_D)
>> Event code 33 (KEY_F)
>> Event code 34 (KEY_G)
>> Event code 35 (KEY_H)
>> Event code 36 (KEY_J)
>> Event code 37 (KEY_K)
>> Event code 38 (KEY_L)
>> Event code 39 (KEY_SEMICOLON)
>> Event code 40 (KEY_APOSTROPHE)
>> Event code 41 (KEY_GRAVE)
>> Event code 42 (KEY_LEFTSHIFT)
>> Event code 43 (KEY_BACKSLASH)
>> Event code 44 (KEY_Z)
>> Event code 45 (KEY_X)
>> Event code 46 (KEY_C)
>> Event code 47 (KEY_V)
>> Event code 48 (KEY_B)
>> Event code 49 (KEY_N)
>> Event code 50 (KEY_M)
>> Event code 51 (KEY_COMMA)
>> Event code 52 (KEY_DOT)
>> Event code 53 (KEY_SLASH)
>> Event code 54 (KEY_RIGHTSHIFT)
>> Event code 55 (KEY_KPASTERISK)
>> Event code 56 (KEY_LEFTALT)
>> Event code 57 (KEY_SPACE)
>> Event code 58 (KEY_CAPSLOCK)
>> Event code 59 (KEY_F1)
>> Event code 60 (KEY_F2)
>> Event code 61 (KEY_F3)
>> Event code 62 (KEY_F4)
>> Event code 63 (KEY_F5)
>> Event code 64 (KEY_F6)
>> Event code 65 (KEY_F7)
>> Event code 66 (KEY_F8)
>> Event code 67 (KEY_F9)
>> Event code 68 (KEY_F10)
>> Event code 69 (KEY_NUMLOCK)
>> Event code 70 (KEY_SCROLLLOCK)
>> Event code 71 (KEY_KP7)
>> Event code 72 (KEY_KP8)
>> Event code 73 (KEY_KP9)
>> Event code 74 (KEY_KPMINUS)
>> Event code 75 (KEY_KP4)
>> Event code 76 (KEY_KP5)
>> Event code 77 (KEY_KP6)
>> Event code 78 (KEY_KPPLUS)
>> Event code 79 (KEY_KP1)
>> Event code 80 (KEY_KP2)
>> Event code 81 (KEY_KP3)
>> Event code 82 (KEY_KP0)
>> Event code 83 (KEY_KPDOT)
>> Event code 85 (KEY_ZENKAKUHANKAKU)
>> Event code 86 (KEY_102ND)
>> Event code 87 (KEY_F11)
>> Event code 88 (KEY_F12)
>> Event code 89 (KEY_RO)
>> Event code 90 (KEY_KATAKANA)
>> Event code 91 (KEY_HIRAGANA)
>> Event code 92 (KEY_HENKAN)
>> Event code 93 (KEY_KATAKANAHIRAGANA)
>> Event code 94 (KEY_MUHENKAN)
>> Event code 95 (KEY_KPJPCOMMA)
>> Event code 96 (KEY_KPENTER)
>> Event code 97 (KEY_RIGHTCTRL)
>> Event code 98 (KEY_KPSLASH)
>> Event code 99 (KEY_SYSRQ)
>> Event code 100 (KEY_RIGHTALT)
>> Event code 102 (KEY_HOME)
>> Event code 103 (KEY_UP)
>> Event code 104 (KEY_PAGEUP)
>> Event code 105 (KEY_LEFT)
>> Event code 106 (KEY_RIGHT)
>> Event code 107 (KEY_END)
>> Event code 108 (KEY_DOWN)
>> Event code 109 (KEY_PAGEDOWN)
>> Event code 110 (KEY_INSERT)
>> Event code 111 (KEY_DELETE)
>> Event code 112 (KEY_MACRO)
>> Event code 113 (KEY_MUTE)
>> Event code 114 (KEY_VOLUMEDOWN)
>> Event code 115 (KEY_VOLUMEUP)
>> Event code 116 (KEY_POWER)
>> Event code 117 (KEY_KPEQUAL)
>> Event code 119 (KEY_PAUSE)
>> Event code 121 (KEY_KPCOMMA)
>> Event code 122 (KEY_HANGUEL)
>> Event code 123 (KEY_HANJA)
>> Event code 124 (KEY_YEN)
>> Event code 125 (KEY_LEFTMETA)
>> Event code 126 (KEY_RIGHTMETA)
>> Event code 127 (KEY_COMPOSE)
>> Event code 128 (KEY_STOP)
>> Event code 138 (KEY_HELP)
>> Event code 140 (KEY_CALC)
>> Event code 141 (KEY_SETUP)
>> Event code 142 (KEY_SLEEP)
>> Event code 143 (KEY_WAKEUP)
>> Event code 148 (KEY_PROG1)
>> Event code 149 (KEY_PROG2)
>> Event code 155 (KEY_MAIL)
>> Event code 156 (KEY_BOOKMARKS)
>> Event code 157 (KEY_COMPUTER)
>> Event code 158 (KEY_BACK)
>> Event code 159 (KEY_FORWARD)
>> Event code 163 (KEY_NEXTSONG)
>> Event code 164 (KEY_PLAYPAUSE)
>> Event code 165 (KEY_PREVIOUSSONG)
>> Event code 166 (KEY_STOPCD)
>> Event code 172 (KEY_HOMEPAGE)
>> Event code 173 (KEY_REFRESH)
>> Event code 183 (KEY_F13)
>> Event code 184 (KEY_F14)
>> Event code 185 (KEY_F15)
>> Event code 192 (KEY_F22)
>> Event code 193 (KEY_F23)
>> Event code 217 (KEY_SEARCH)
>> Event code 224 (KEY_BRIGHTNESSDOWN)
>> Event code 225 (KEY_BRIGHTNESSUP)
>> Event code 226 (KEY_MEDIA)
>> Event code 227 (KEY_SWITCHVIDEOMODE)
>> Event code 236 (KEY_BATTERY)
>> Event code 237 (KEY_BLUETOOTH)
>> Event code 238 (KEY_WLAN)
>> Event code 425 (KEY_PRESENTATION)
>> Event code 434 (KEY_DOLLAR)
>> Event code 435 (KEY_EURO)
>> Event code 464 (KEY_FN)
>> Event type 4 (EV_MSC)
>> Event code 4 (MSC_SCAN)
>> Event type 17 (EV_LED)
>> Event code 0 (LED_NUML)
>> Event code 1 (LED_CAPSL)
>> Event code 2 (LED_SCROLLL)
>> Properties:
>> Property type 20 (EV_REP)
>> Property code 0 (REP_DELAY)
>> Value 250
>> Property code 1 (REP_PERIOD)
>> Value 33
>> Testing ... (interrupt to exit)
>> Event: time 1383862330.411016, type 4 (EV_MSC), code 4 (MSC_SCAN), value 1c
>> Event: time 1383862330.411016, type 1 (EV_KEY), code 28 (KEY_ENTER), value
> 0
>> Event: time 1383862330.411016, -------------- SYN_REPORT ------------
>> Event: time 1383862331.588429, type 4 (EV_MSC), code 4 (MSC_SCAN), value d9
>> Event: time 1383862331.588429, type 1 (EV_KEY), code 225
> (KEY_BRIGHTNESSUP), value 1
>> Event: time 1383862331.588429, -------------- SYN_REPORT ------------
>> Event: time 1383862331.810012, type 4 (EV_MSC), code 4 (MSC_SCAN), value d9
>> Event: time 1383862331.810012, type 1 (EV_KEY), code 225
> (KEY_BRIGHTNESSUP), value 0
>> Event: time 1383862331.810012, -------------- SYN_REPORT ------------
>> Event: time 1383862332.498971, type 4 (EV_MSC), code 4 (MSC_SCAN), value d4
>> Event: time 1383862332.498971, type 1 (EV_KEY), code 237 (KEY_BLUETOOTH),
> value 1
>> Event: time 1383862332.498971, -------------- SYN_REPORT ------------
>> Event: time 1383862332.720524, type 4 (EV_MSC), code 4 (MSC_SCAN), value d4
>> Event: time 1383862332.720524, type 1 (EV_KEY), code 237 (KEY_BLUETOOTH),
> value 0
>> Event: time 1383862332.720524, -------------- SYN_REPORT ------------
>> Event: time 1383862333.631341, type 4 (EV_MSC), code 4 (MSC_SCAN), value d9
>> Event: time 1383862333.631341, type 1 (EV_KEY), code 225
> (KEY_BRIGHTNESSUP), value 1
>> Event: time 1383862333.631341, -------------- SYN_REPORT ------------
>> Event: time 1383862333.832775, type 4 (EV_MSC), code 4 (MSC_SCAN), value d9
>> Event: time 1383862333.832775, type 1 (EV_KEY), code 225
> (KEY_BRIGHTNESSUP), value 0
>> Event: time 1383862333.832775, -------------- SYN_REPORT ------------
>> Event: time 1383862334.682950, type 4 (EV_MSC), code 4 (MSC_SCAN), value d4
>> Event: time 1383862334.682950, type 1 (EV_KEY), code 237 (KEY_BLUETOOTH),
> value 1
>> Event: time 1383862334.682950, -------------- SYN_REPORT ------------
>> Event: time 1383862334.844099, type 4 (EV_MSC), code 4 (MSC_SCAN), value d4
>> Event: time 1383862334.844099, type 1 (EV_KEY), code 237 (KEY_BLUETOOTH),
> value 0
>> Event: time 1383862334.844099, -------------- SYN_REPORT ------------
>> Event: time 1383862338.144505, type 4 (EV_MSC), code 4 (MSC_SCAN), value d9
>> Event: time 1383862338.144505, type 1 (EV_KEY), code 225
> (KEY_BRIGHTNESSUP), value 1
>> Event: time 1383862338.144505, -------------- SYN_REPORT ------------
>> Event: time 1383862338.386205, type 4 (EV_MSC), code 4 (MSC_SCAN), value d9
>> Event: time 1383862338.386205, type 1 (EV_KEY), code 225
> (KEY_BRIGHTNESSUP), value 0
>> Event: time 1383862338.386205, -------------- SYN_REPORT ------------
>> Event: time 1383862339.167990, type 4 (EV_MSC), code 4 (MSC_SCAN), value 1d
>> Event: time 1383862339.167990, type 1 (EV_KEY), code 29 (KEY_LEFTCTRL),
> value 1
>> Event: time 1383862339.167990, -------------- SYN_REPORT ------------
>> Event: time 1383862339.319043, type 4 (EV_MSC), code 4 (MSC_SCAN), value 2e
>> Event: time 1383862339.319043, type 1 (EV_KEY), code 46 (KEY_C), value 1
>> Event: time 1383862339.319043, -------------- SYN_REPORT ------------
>
> Ok, it's not really clear to me which keys you actually pressed.
> Judging from the timing-information, your Bluetooth key causes
> brightness-up and your brightness-up key causes KEY_BLUETOOTH? Is that
>
> correct?
>
No, I just pressed the "bluetooth" key on my keyboard.
Nothink more, I pressed different times the same key, never touched the brightness one.
What I see is that this key triggers two different interrupts?
They key (if this matters) is the second one on the top right of the keyboard
http://img2.annuncicdn.it/62/b0/62b0ff5df1d8b0c6c8929db0d0298c05_orig.jpg
Thanks for your help so far
Gianfranco
> Thanks
> David
>
--
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 0/2] arm: am335x: am335x evm sk: add touchscreen DT node
From: Dmitry Torokhov @ 2013-11-11 7:59 UTC (permalink / raw)
To: Felipe Balbi
Cc: rob.herring-bsGFqQB8/DxBDgjK7y7TUQ, pawel.moll-5wv7dgnIgG8,
mark.rutland-5wv7dgnIgG8, swarren-3lzwWm7+Weoh9ZMKESR00Q,
ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg, rob-VoJi6FS/r0vR7s880joybQ,
bcousson-rdvid1DuHRBWk0Htik3J/w, Tony Lindgren,
Sebastian Andrzej Siewior, devicetree-u79uwXL29TY76Z2rM5mHXA,
Linux OMAP Mailing List, linux-input-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1382386404-6659-1-git-send-email-balbi-l0cyMroinI0@public.gmane.org>
On Mon, Oct 21, 2013 at 03:13:22PM -0500, Felipe Balbi wrote:
> 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
Applied, thank you.
>
> 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
>
--
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: My "enable bluetooth" hotkey increase brightness instead
From: David Herrmann @ 2013-11-11 7:50 UTC (permalink / raw)
To: Gianfranco Costamagna; +Cc: linux-input@vger.kernel.org
In-Reply-To: <1383862514.1365.YahooMailNeo@web171806.mail.ir2.yahoo.com>
Hi
On Thu, Nov 7, 2013 at 11:15 PM, Gianfranco Costamagna
<costamagnagianfranco@yahoo.it> wrote:
>
> ----- Messaggio originale -----
>
>> Da: David Herrmann <dh.herrmann@gmail.com>
>> A: Gianfranco Costamagna <costamagnagianfranco@yahoo.it>
>> Cc: "linux-input@vger.kernel.org" <linux-input@vger.kernel.org>
>> Inviato: Giovedì 7 Novembre 2013 15:44
>> Oggetto: Re: My "enable bluetooth" hotkey increase brightness instead
>>
>> Hi
>
> Hi David
>
>>
>> On Tue, Oct 29, 2013 at 9:52 AM, Gianfranco Costamagna
>> <costamagnagianfranco@yahoo.it> wrote:
>>> Hi linux-input developers, I write here since suggested on my launchpad
>> bug.
>>>
>>> The problem is really simple, I have an acer aspire 6930G and when I press
>> "enable bluetooth" on my keyboard I get the brightness of my screen
>> increased.
>>> I reported on launchpad my configuration [1], and also opened a bug here
>> [2].
>>>
>>> the problem seems to be in the kernel so far, but I honestly don't know
>> where to better report it and how to debug/check it.
>>>
>>> I tested also kernel 3.12rc6 without any better outcome.
>>>
>>> Can anybody please help me out with this problem?
>>>
>>> Many thanks!
>>
>> Please use "evtest" to see which events are generated for your keys:
>> http://cgit.freedesktop.org/evtest/
>> You need to run it on your keyboard-event chardev, something like:
>> /dev/input/eventX (just try each until you find your keyboard).
>>
>> Please append the information you get and press the key which is
>> incorrectly mapped.
>
> Wonderful hint! Now when I press the bluetooth key I see two different event fired from the keyboard
> ^Clocutus@Unimatrix02-Saucy:~ $ sudo evtest
> No device specified, trying to scan all of /dev/input/event*
> Available devices:
> /dev/input/event0: Lid Switch
> /dev/input/event1: Power Button
> /dev/input/event2: Sleep Button
> /dev/input/event3: Power Button
> /dev/input/event4: AT Translated Set 2 keyboard
> /dev/input/event5: Video Bus
> /dev/input/event6: HDA Intel HDMI/DP,pcm=3 Phantom
> /dev/input/event7: HDA Intel Headphone
> /dev/input/event8: HDA Intel Line
> /dev/input/event9: HDA Intel Mic
> /dev/input/event10: SynPS/2 Synaptics TouchPad
> /dev/input/event11: Acer Crystal Eye webcam
> Select the device event number [0-12]: 4
> Input driver version is 1.0.1
> Input device ID: bus 0x11 vendor 0x1 product 0x1 version 0xab41
> Input device name: "AT Translated Set 2 keyboard"
> Supported events:
> Event type 0 (EV_SYN)
> Event type 1 (EV_KEY)
> Event code 1 (KEY_ESC)
> Event code 2 (KEY_1)
> Event code 3 (KEY_2)
> Event code 4 (KEY_3)
> Event code 5 (KEY_4)
> Event code 6 (KEY_5)
> Event code 7 (KEY_6)
> Event code 8 (KEY_7)
> Event code 9 (KEY_8)
> Event code 10 (KEY_9)
> Event code 11 (KEY_0)
> Event code 12 (KEY_MINUS)
> Event code 13 (KEY_EQUAL)
> Event code 14 (KEY_BACKSPACE)
> Event code 15 (KEY_TAB)
> Event code 16 (KEY_Q)
> Event code 17 (KEY_W)
> Event code 18 (KEY_E)
> Event code 19 (KEY_R)
> Event code 20 (KEY_T)
> Event code 21 (KEY_Y)
> Event code 22 (KEY_U)
> Event code 23 (KEY_I)
> Event code 24 (KEY_O)
> Event code 25 (KEY_P)
> Event code 26 (KEY_LEFTBRACE)
> Event code 27 (KEY_RIGHTBRACE)
> Event code 28 (KEY_ENTER)
> Event code 29 (KEY_LEFTCTRL)
> Event code 30 (KEY_A)
> Event code 31 (KEY_S)
> Event code 32 (KEY_D)
> Event code 33 (KEY_F)
> Event code 34 (KEY_G)
> Event code 35 (KEY_H)
> Event code 36 (KEY_J)
> Event code 37 (KEY_K)
> Event code 38 (KEY_L)
> Event code 39 (KEY_SEMICOLON)
> Event code 40 (KEY_APOSTROPHE)
> Event code 41 (KEY_GRAVE)
> Event code 42 (KEY_LEFTSHIFT)
> Event code 43 (KEY_BACKSLASH)
> Event code 44 (KEY_Z)
> Event code 45 (KEY_X)
> Event code 46 (KEY_C)
> Event code 47 (KEY_V)
> Event code 48 (KEY_B)
> Event code 49 (KEY_N)
> Event code 50 (KEY_M)
> Event code 51 (KEY_COMMA)
> Event code 52 (KEY_DOT)
> Event code 53 (KEY_SLASH)
> Event code 54 (KEY_RIGHTSHIFT)
> Event code 55 (KEY_KPASTERISK)
> Event code 56 (KEY_LEFTALT)
> Event code 57 (KEY_SPACE)
> Event code 58 (KEY_CAPSLOCK)
> Event code 59 (KEY_F1)
> Event code 60 (KEY_F2)
> Event code 61 (KEY_F3)
> Event code 62 (KEY_F4)
> Event code 63 (KEY_F5)
> Event code 64 (KEY_F6)
> Event code 65 (KEY_F7)
> Event code 66 (KEY_F8)
> Event code 67 (KEY_F9)
> Event code 68 (KEY_F10)
> Event code 69 (KEY_NUMLOCK)
> Event code 70 (KEY_SCROLLLOCK)
> Event code 71 (KEY_KP7)
> Event code 72 (KEY_KP8)
> Event code 73 (KEY_KP9)
> Event code 74 (KEY_KPMINUS)
> Event code 75 (KEY_KP4)
> Event code 76 (KEY_KP5)
> Event code 77 (KEY_KP6)
> Event code 78 (KEY_KPPLUS)
> Event code 79 (KEY_KP1)
> Event code 80 (KEY_KP2)
> Event code 81 (KEY_KP3)
> Event code 82 (KEY_KP0)
> Event code 83 (KEY_KPDOT)
> Event code 85 (KEY_ZENKAKUHANKAKU)
> Event code 86 (KEY_102ND)
> Event code 87 (KEY_F11)
> Event code 88 (KEY_F12)
> Event code 89 (KEY_RO)
> Event code 90 (KEY_KATAKANA)
> Event code 91 (KEY_HIRAGANA)
> Event code 92 (KEY_HENKAN)
> Event code 93 (KEY_KATAKANAHIRAGANA)
> Event code 94 (KEY_MUHENKAN)
> Event code 95 (KEY_KPJPCOMMA)
> Event code 96 (KEY_KPENTER)
> Event code 97 (KEY_RIGHTCTRL)
> Event code 98 (KEY_KPSLASH)
> Event code 99 (KEY_SYSRQ)
> Event code 100 (KEY_RIGHTALT)
> Event code 102 (KEY_HOME)
> Event code 103 (KEY_UP)
> Event code 104 (KEY_PAGEUP)
> Event code 105 (KEY_LEFT)
> Event code 106 (KEY_RIGHT)
> Event code 107 (KEY_END)
> Event code 108 (KEY_DOWN)
> Event code 109 (KEY_PAGEDOWN)
> Event code 110 (KEY_INSERT)
> Event code 111 (KEY_DELETE)
> Event code 112 (KEY_MACRO)
> Event code 113 (KEY_MUTE)
> Event code 114 (KEY_VOLUMEDOWN)
> Event code 115 (KEY_VOLUMEUP)
> Event code 116 (KEY_POWER)
> Event code 117 (KEY_KPEQUAL)
> Event code 119 (KEY_PAUSE)
> Event code 121 (KEY_KPCOMMA)
> Event code 122 (KEY_HANGUEL)
> Event code 123 (KEY_HANJA)
> Event code 124 (KEY_YEN)
> Event code 125 (KEY_LEFTMETA)
> Event code 126 (KEY_RIGHTMETA)
> Event code 127 (KEY_COMPOSE)
> Event code 128 (KEY_STOP)
> Event code 138 (KEY_HELP)
> Event code 140 (KEY_CALC)
> Event code 141 (KEY_SETUP)
> Event code 142 (KEY_SLEEP)
> Event code 143 (KEY_WAKEUP)
> Event code 148 (KEY_PROG1)
> Event code 149 (KEY_PROG2)
> Event code 155 (KEY_MAIL)
> Event code 156 (KEY_BOOKMARKS)
> Event code 157 (KEY_COMPUTER)
> Event code 158 (KEY_BACK)
> Event code 159 (KEY_FORWARD)
> Event code 163 (KEY_NEXTSONG)
> Event code 164 (KEY_PLAYPAUSE)
> Event code 165 (KEY_PREVIOUSSONG)
> Event code 166 (KEY_STOPCD)
> Event code 172 (KEY_HOMEPAGE)
> Event code 173 (KEY_REFRESH)
> Event code 183 (KEY_F13)
> Event code 184 (KEY_F14)
> Event code 185 (KEY_F15)
> Event code 192 (KEY_F22)
> Event code 193 (KEY_F23)
> Event code 217 (KEY_SEARCH)
> Event code 224 (KEY_BRIGHTNESSDOWN)
> Event code 225 (KEY_BRIGHTNESSUP)
> Event code 226 (KEY_MEDIA)
> Event code 227 (KEY_SWITCHVIDEOMODE)
> Event code 236 (KEY_BATTERY)
> Event code 237 (KEY_BLUETOOTH)
> Event code 238 (KEY_WLAN)
> Event code 425 (KEY_PRESENTATION)
> Event code 434 (KEY_DOLLAR)
> Event code 435 (KEY_EURO)
> Event code 464 (KEY_FN)
> Event type 4 (EV_MSC)
> Event code 4 (MSC_SCAN)
> Event type 17 (EV_LED)
> Event code 0 (LED_NUML)
> Event code 1 (LED_CAPSL)
> Event code 2 (LED_SCROLLL)
> Properties:
> Property type 20 (EV_REP)
> Property code 0 (REP_DELAY)
> Value 250
> Property code 1 (REP_PERIOD)
> Value 33
> Testing ... (interrupt to exit)
> Event: time 1383862330.411016, type 4 (EV_MSC), code 4 (MSC_SCAN), value 1c
> Event: time 1383862330.411016, type 1 (EV_KEY), code 28 (KEY_ENTER), value 0
> Event: time 1383862330.411016, -------------- SYN_REPORT ------------
> Event: time 1383862331.588429, type 4 (EV_MSC), code 4 (MSC_SCAN), value d9
> Event: time 1383862331.588429, type 1 (EV_KEY), code 225 (KEY_BRIGHTNESSUP), value 1
> Event: time 1383862331.588429, -------------- SYN_REPORT ------------
> Event: time 1383862331.810012, type 4 (EV_MSC), code 4 (MSC_SCAN), value d9
> Event: time 1383862331.810012, type 1 (EV_KEY), code 225 (KEY_BRIGHTNESSUP), value 0
> Event: time 1383862331.810012, -------------- SYN_REPORT ------------
> Event: time 1383862332.498971, type 4 (EV_MSC), code 4 (MSC_SCAN), value d4
> Event: time 1383862332.498971, type 1 (EV_KEY), code 237 (KEY_BLUETOOTH), value 1
> Event: time 1383862332.498971, -------------- SYN_REPORT ------------
> Event: time 1383862332.720524, type 4 (EV_MSC), code 4 (MSC_SCAN), value d4
> Event: time 1383862332.720524, type 1 (EV_KEY), code 237 (KEY_BLUETOOTH), value 0
> Event: time 1383862332.720524, -------------- SYN_REPORT ------------
> Event: time 1383862333.631341, type 4 (EV_MSC), code 4 (MSC_SCAN), value d9
> Event: time 1383862333.631341, type 1 (EV_KEY), code 225 (KEY_BRIGHTNESSUP), value 1
> Event: time 1383862333.631341, -------------- SYN_REPORT ------------
> Event: time 1383862333.832775, type 4 (EV_MSC), code 4 (MSC_SCAN), value d9
> Event: time 1383862333.832775, type 1 (EV_KEY), code 225 (KEY_BRIGHTNESSUP), value 0
> Event: time 1383862333.832775, -------------- SYN_REPORT ------------
> Event: time 1383862334.682950, type 4 (EV_MSC), code 4 (MSC_SCAN), value d4
> Event: time 1383862334.682950, type 1 (EV_KEY), code 237 (KEY_BLUETOOTH), value 1
> Event: time 1383862334.682950, -------------- SYN_REPORT ------------
> Event: time 1383862334.844099, type 4 (EV_MSC), code 4 (MSC_SCAN), value d4
> Event: time 1383862334.844099, type 1 (EV_KEY), code 237 (KEY_BLUETOOTH), value 0
> Event: time 1383862334.844099, -------------- SYN_REPORT ------------
> Event: time 1383862338.144505, type 4 (EV_MSC), code 4 (MSC_SCAN), value d9
> Event: time 1383862338.144505, type 1 (EV_KEY), code 225 (KEY_BRIGHTNESSUP), value 1
> Event: time 1383862338.144505, -------------- SYN_REPORT ------------
> Event: time 1383862338.386205, type 4 (EV_MSC), code 4 (MSC_SCAN), value d9
> Event: time 1383862338.386205, type 1 (EV_KEY), code 225 (KEY_BRIGHTNESSUP), value 0
> Event: time 1383862338.386205, -------------- SYN_REPORT ------------
> Event: time 1383862339.167990, type 4 (EV_MSC), code 4 (MSC_SCAN), value 1d
> Event: time 1383862339.167990, type 1 (EV_KEY), code 29 (KEY_LEFTCTRL), value 1
> Event: time 1383862339.167990, -------------- SYN_REPORT ------------
> Event: time 1383862339.319043, type 4 (EV_MSC), code 4 (MSC_SCAN), value 2e
> Event: time 1383862339.319043, type 1 (EV_KEY), code 46 (KEY_C), value 1
> Event: time 1383862339.319043, -------------- SYN_REPORT ------------
Ok, it's not really clear to me which keys you actually pressed.
Judging from the timing-information, your Bluetooth key causes
brightness-up and your brightness-up key causes KEY_BLUETOOTH? Is that
correct?
Thanks
David
--
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] Input: replace IS_ERR and PTR_ERR with PTR_ERR_OR_ZERO
From: Dmitry Torokhov @ 2013-11-11 7:42 UTC (permalink / raw)
To: Duan Jiong
Cc: kernel, linux, a.zummo, airlied, linux-kernel, rtc-linux,
dri-devel, linux-tegra, linux-input
In-Reply-To: <1383724472-15475-1-git-send-email-duanj.fnst@cn.fujitsu.com>
On Wed, Nov 06, 2013 at 03:54:32PM +0800, Duan Jiong wrote:
> This patch fixes coccinelle error regarding usage of IS_ERR and
> PTR_ERR instead of PTR_ERR_OR_ZERO.
>
> Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
Applied, thank you.
> ---
> drivers/input/touchscreen/cyttsp4_spi.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/input/touchscreen/cyttsp4_spi.c b/drivers/input/touchscreen/cyttsp4_spi.c
> index a71e114..b19434c 100644
> --- a/drivers/input/touchscreen/cyttsp4_spi.c
> +++ b/drivers/input/touchscreen/cyttsp4_spi.c
> @@ -171,10 +171,7 @@ static int cyttsp4_spi_probe(struct spi_device *spi)
> ts = cyttsp4_probe(&cyttsp_spi_bus_ops, &spi->dev, spi->irq,
> CY_SPI_DATA_BUF_SIZE);
>
> - if (IS_ERR(ts))
> - return PTR_ERR(ts);
> -
> - return 0;
> + return PTR_ERR_OR_ZERO(ts);
> }
>
> static int cyttsp4_spi_remove(struct spi_device *spi)
> --
> 1.8.3.1
>
--
Dmitry
^ permalink raw reply
* Re: [PATCH] Input: mma8450 - add missing i2c_set_clientdata() in mma8450_probe()
From: Dmitry Torokhov @ 2013-11-11 7:37 UTC (permalink / raw)
To: Wei Yongjun
Cc: grant.likely, rob.herring, wfp5p, broonie, javier,
sebastien.royen, yongjun_wei, linux-input
In-Reply-To: <CAPgLHd-02-tPeJghvYq+ZB9_MxdRKQ7Kvdqf2YdB=0wg9MoXow@mail.gmail.com>
On Mon, Nov 11, 2013 at 02:24:20PM +0800, Wei Yongjun wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>
> Add missing i2c_set_clientdata() in mma8450_probe(), otherwise
> calling i2c_get_clientdata() in mma8450_remove() returns NULL.
>
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Applied, thank you.
> ---
> drivers/input/misc/mma8450.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/input/misc/mma8450.c b/drivers/input/misc/mma8450.c
> index f330969..92c43a1 100644
> --- a/drivers/input/misc/mma8450.c
> +++ b/drivers/input/misc/mma8450.c
> @@ -204,6 +204,8 @@ static int mma8450_probe(struct i2c_client *c,
> goto err_free_mem;
> }
>
> + i2c_set_clientdata(c, m);
> +
> return 0;
>
> err_free_mem:
>
--
Dmitry
^ permalink raw reply
* Re: [PATCH] Input: mpu3050 - add missing i2c_set_clientdata() in mpu3050_probe()
From: Dmitry Torokhov @ 2013-11-11 7:34 UTC (permalink / raw)
To: Wei Yongjun
Cc: grant.likely, rob.herring, wfp5p, broonie, javier, rmk+kernel,
yongjun_wei, linux-input
In-Reply-To: <CAPgLHd-ujkwTBn=hUH6SxfhHpYHyGqvrkcyuRTFkXmWtqE2Zjg@mail.gmail.com>
On Mon, Nov 11, 2013 at 02:18:54PM +0800, Wei Yongjun wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>
> Add missing i2c_set_clientdata() in mpu3050_probe(), otherwise
> calling i2c_get_clientdata() in mpu3050_remove() returns NULL.
>
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Applied, thank you.
> ---
> drivers/input/misc/mpu3050.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/input/misc/mpu3050.c b/drivers/input/misc/mpu3050.c
> index dce0d95..6983ffb 100644
> --- a/drivers/input/misc/mpu3050.c
> +++ b/drivers/input/misc/mpu3050.c
> @@ -383,6 +383,7 @@ static int mpu3050_probe(struct i2c_client *client,
>
> pm_runtime_enable(&client->dev);
> pm_runtime_set_autosuspend_delay(&client->dev, MPU3050_AUTO_DELAY);
> + i2c_set_clientdata(client, sensor);
>
> return 0;
>
>
--
Dmitry
^ permalink raw reply
* Re: [patch] Input: tnetv107x-keypad - make irqs signed for error handling
From: Dmitry Torokhov @ 2013-11-11 7:31 UTC (permalink / raw)
To: Dan Carpenter
Cc: Bill Pemberton, Mark Brown, Javier Martinez Canillas,
Russell King, Sachin Kamat, linux-input, kernel-janitors
In-Reply-To: <20131107075240.GK21844@elgon.mountain>
On Thu, Nov 07, 2013 at 10:52:40AM +0300, Dan Carpenter wrote:
> There is a bug in keypad_probe() where we do:
>
> kp->irq_press = platform_get_irq_byname(pdev, "press");
> kp->irq_release = platform_get_irq_byname(pdev, "release");
> if (kp->irq_press < 0 || kp->irq_release < 0) {
>
> The problem is that these irq variables are unsigned so the error
> handling doesn't work. I've changed them to signed values.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Applied, thank you.
--
Dmitry
^ permalink raw reply
* Re: [PATCH v3] add sur40 driver for Samsung SUR40 (aka MS Surface 2.0/Pixelsense)
From: Dmitry Torokhov @ 2013-11-11 7:31 UTC (permalink / raw)
To: Florian Echtler; +Cc: linux-input, benjamin.tissoires, rydberg, dh.herrmann
In-Reply-To: <1383748012-28880-1-git-send-email-floe@butterbrot.org>
Hi Florian,
On Wed, Nov 06, 2013 at 03:26:51PM +0100, Florian Echtler wrote:
> +
> + /* max value unknown, but major/minor axis
> + * can never be larger than screen */
> + input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR,
> + 0, SENSOR_RES_X, 0, 0);
> + input_set_abs_params(input_dev, ABS_MT_TOUCH_MINOR,
> + 0, SENSOR_RES_Y, 0, 0);
If the range is unknown do we really want to specify min/max?
Also, does the patch below mess up or device or it still works?
Thanks.
--
Dmitry
Input: sur40 - misc changes
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
drivers/input/touchscreen/sur40.c | 227 ++++++++++++++++++-------------------
1 file changed, 113 insertions(+), 114 deletions(-)
diff --git a/drivers/input/touchscreen/sur40.c b/drivers/input/touchscreen/sur40.c
index 48787fd..cfd1b7e 100644
--- a/drivers/input/touchscreen/sur40.c
+++ b/drivers/input/touchscreen/sur40.c
@@ -1,22 +1,22 @@
/*
- Surface2.0/SUR40/PixelSense input driver
-
- 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.
-
- Copyright (c) 2013 by Florian 'floe' Echtler <floe@butterbrot.org>
-
- Derived from the USB Skeleton driver 1.1,
- Copyright (c) 2003 Greg Kroah-Hartman (greg@kroah.com)
-
- and from the Apple USB BCM5974 multitouch driver,
- Copyright (c) 2008 Henrik Rydberg (rydberg@euromail.se)
-
- and from the generic hid-multitouch driver,
- Copyright (c) 2010-2012 Stephane Chatty <chatty@enac.fr>
-*/
+ * Surface2.0/SUR40/PixelSense input driver
+ *
+ * Copyright (c) 2013 by Florian 'floe' Echtler <floe@butterbrot.org>
+ *
+ * Derived from the USB Skeleton driver 1.1,
+ * Copyright (c) 2003 Greg Kroah-Hartman (greg@kroah.com)
+ *
+ * and from the Apple USB BCM5974 multitouch driver,
+ * Copyright (c) 2008 Henrik Rydberg (rydberg@euromail.se)
+ *
+ * and from the generic hid-multitouch driver,
+ * Copyright (c) 2010-2012 Stephane Chatty <chatty@enac.fr>
+ *
+ * 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.
+ */
#include <linux/kernel.h>
#include <linux/errno.h>
@@ -49,8 +49,8 @@ struct sur40_blob {
__le16 blob_id;
- __u8 action; /* 0x02 = enter/exit, 0x03 = update (?) */
- __u8 unknown; /* always 0x01 or 0x02 (no idea what this is?) */
+ u8 action; /* 0x02 = enter/exit, 0x03 = update (?) */
+ u8 unknown; /* always 0x01 or 0x02 (no idea what this is?) */
__le16 bb_pos_x; /* upper left corner of bounding box */
__le16 bb_pos_y;
@@ -72,7 +72,7 @@ struct sur40_blob {
__le32 area; /* size in pixels/pressure (?) */
- __u8 padding[32];
+ u8 padding[32];
} __packed;
@@ -105,12 +105,6 @@ struct sur40_data {
/* maximum number of contacts FIXME: this is a guess? */
#define MAX_CONTACTS 64
-/* device ID table */
-static const struct usb_device_id sur40_table[] = {
- {USB_DEVICE(ID_MICROSOFT, ID_SUR40)}, /* Samsung SUR40 */
- {} /* terminating null entry */
-};
-
/* control commands */
#define SUR40_GET_VERSION 0xb0 /* 12 bytes string */
#define SUR40_UNKNOWN1 0xb3 /* 5 bytes */
@@ -127,32 +121,34 @@ static const struct usb_device_id sur40_table[] = {
* incident and instructions on how to fix the corrupted EEPROM are available
* at https://floe.butterbrot.org/matrix/hacking/surface/brick.html
*/
-#define sur40_command(dev, command, index, buffer, size) \
- usb_control_msg(dev->usbdev, usb_rcvctrlpipe(dev->usbdev, 0), \
- command, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, 0x00, \
- index, buffer, size, 1000)
-
-MODULE_DEVICE_TABLE(usb, sur40_table);
-/* structure to hold all of our device specific stuff */
struct sur40_state {
- struct usb_device *usbdev; /* save the usb device pointer */
- struct device *dev; /* save the generic device pointer */
- struct input_polled_dev *input; /* struct for polled input device */
+ struct usb_device *usbdev;
+ struct device *dev;
+ struct input_polled_dev *input;
- struct sur40_data *bulk_in_buffer; /* the buffer to receive data */
- size_t bulk_in_size; /* the maximum bulk packet size */
- __u8 bulk_in_epaddr; /* address of the bulk in endpoint */
+ struct sur40_data *bulk_in_buffer;
+ size_t bulk_in_size;
+ u8 bulk_in_epaddr;
- char phys[64]; /* buffer for phys name */
+ char phys[64];
};
-/* initialization routine, called from sur40_open */
+static int sur40_command(struct sur40_state *dev,
+ u8 command, u16 index, void *buffer, u16 size)
+{
+ return usb_control_msg(dev->usbdev, usb_rcvctrlpipe(dev->usbdev, 0),
+ command,
+ USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN,
+ 0x00, index, buffer, size, 1000);
+}
+
+/* Initialization routine, called from sur40_open */
static int sur40_init(struct sur40_state *dev)
{
int result;
- __u8 buffer[24];
+ u8 buffer[24];
/* stupidly replay the original MS driver init sequence */
result = sur40_command(dev, SUR40_GET_VERSION, 0x00, buffer, 12);
@@ -177,37 +173,44 @@ static int sur40_init(struct sur40_state *dev)
result = sur40_command(dev, SUR40_GET_VERSION, 0x03, buffer, 12);
- /* discard the result buffer - no known data inside except
- some version strings, maybe extract these sometime.. */
+ /*
+ * Discard the result buffer - no known data inside except
+ * some version strings, maybe extract these sometime...
+ */
return result;
}
/*
- * callback routines from input_polled_dev
-*/
+ * Callback routines from input_polled_dev
+ */
-/* enable the device, polling will now start */
-void sur40_open(struct input_polled_dev *polldev)
+/* Enable the device, polling will now start. */
+static void sur40_open(struct input_polled_dev *polldev)
{
struct sur40_state *sur40 = polldev->private;
+
dev_dbg(sur40->dev, "open\n");
sur40_init(sur40);
}
-/* disable device, polling has stopped */
-void sur40_close(struct input_polled_dev *polldev)
+/* Disable device, polling has stopped. */
+static void sur40_close(struct input_polled_dev *polldev)
{
- /* no known way to stop the device, except to stop polling */
struct sur40_state *sur40 = polldev->private;
+
dev_dbg(sur40->dev, "close\n");
+ /*
+ * There is no known way to stop the device, so we simply
+ * stop polling.
+ */
}
/*
- * this function is called when a whole contact has been processed,
- * so that it can assign it to a slot and store the data there
+ * This function is called when a whole contact has been processed,
+ * so that it can assign it to a slot and store the data there.
*/
-static void report_blob(struct sur40_blob *blob, struct input_dev *input)
+static void sur40_report_blob(struct sur40_blob *blob, struct input_dev *input)
{
int wide, major, minor;
@@ -230,33 +233,33 @@ static void report_blob(struct sur40_blob *blob, struct input_dev *input)
major = max(bb_size_x, bb_size_y);
minor = min(bb_size_x, bb_size_y);
- input_event(input, EV_ABS, ABS_MT_POSITION_X, pos_x);
- input_event(input, EV_ABS, ABS_MT_POSITION_Y, pos_y);
- input_event(input, EV_ABS, ABS_MT_TOOL_X, ctr_x);
- input_event(input, EV_ABS, ABS_MT_TOOL_Y, ctr_y);
+ input_report_abs(input, ABS_MT_POSITION_X, pos_x);
+ input_report_abs(input, ABS_MT_POSITION_Y, pos_y);
+ input_report_abs(input, ABS_MT_TOOL_X, ctr_x);
+ input_report_abs(input, ABS_MT_TOOL_Y, ctr_y);
/* TODO: use a better orientation measure */
- input_event(input, EV_ABS, ABS_MT_ORIENTATION, wide);
- input_event(input, EV_ABS, ABS_MT_TOUCH_MAJOR, major);
- input_event(input, EV_ABS, ABS_MT_TOUCH_MINOR, minor);
+ input_report_abs(input, ABS_MT_ORIENTATION, wide);
+ input_report_abs(input, ABS_MT_TOUCH_MAJOR, major);
+ input_report_abs(input, ABS_MT_TOUCH_MINOR, minor);
}
/* core function: poll for new input data */
-void sur40_poll(struct input_polled_dev *polldev)
+static void sur40_poll(struct input_polled_dev *polldev)
{
struct sur40_state *sur40 = polldev->private;
struct input_dev *input = polldev->input;
int result, bulk_read, need_blobs, packet_blobs, i;
- uint32_t packet_id;
+ u32 packet_id;
struct sur40_header *header = &sur40->bulk_in_buffer->header;
struct sur40_blob *inblob = &sur40->bulk_in_buffer->blobs[0];
- need_blobs = -1;
-
dev_dbg(sur40->dev, "poll\n");
+ need_blobs = -1;
+
do {
/* perform a blocking bulk read to get data from the device */
@@ -286,9 +289,11 @@ void sur40_poll(struct input_polled_dev *polldev)
packet_id = header->packet_id;
}
- /* sanity check. when video data is also being retrieved, the
+ /*
+ * Sanity check. when video data is also being retrieved, the
* packet ID will usually increase in the middle of a series
- * instead of at the end. */
+ * instead of at the end.
+ */
if (packet_id != header->packet_id)
dev_warn(sur40->dev, "packet ID mismatch\n");
@@ -302,7 +307,7 @@ void sur40_poll(struct input_polled_dev *polldev)
for (i = 0; i < packet_blobs; i++) {
need_blobs--;
dev_dbg(sur40->dev, "processing blob\n");
- report_blob(&(inblob[i]), input);
+ sur40_report_blob(&(inblob[i]), input);
}
} while (need_blobs > 0);
@@ -311,98 +316,86 @@ void sur40_poll(struct input_polled_dev *polldev)
input_sync(input);
}
-/*
- * housekeeping routines
-*/
-
-/* initialize input device parameters */
+/* Initialize input device parameters. */
static void sur40_input_setup(struct input_dev *input_dev)
{
- set_bit(EV_KEY, input_dev->evbit);
- set_bit(EV_SYN, input_dev->evbit);
- set_bit(EV_ABS, input_dev->evbit);
+ __set_bit(EV_KEY, input_dev->evbit);
+ __set_bit(EV_ABS, input_dev->evbit);
input_set_abs_params(input_dev, ABS_MT_POSITION_X,
- 0, SENSOR_RES_X, 0, 0);
+ 0, SENSOR_RES_X, 0, 0);
input_set_abs_params(input_dev, ABS_MT_POSITION_Y,
- 0, SENSOR_RES_Y, 0, 0);
+ 0, SENSOR_RES_Y, 0, 0);
input_set_abs_params(input_dev, ABS_MT_TOOL_X,
- 0, SENSOR_RES_X, 0, 0);
+ 0, SENSOR_RES_X, 0, 0);
input_set_abs_params(input_dev, ABS_MT_TOOL_Y,
- 0, SENSOR_RES_Y, 0, 0);
+ 0, SENSOR_RES_Y, 0, 0);
/* max value unknown, but major/minor axis
* can never be larger than screen */
input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR,
- 0, SENSOR_RES_X, 0, 0);
+ 0, SENSOR_RES_X, 0, 0);
input_set_abs_params(input_dev, ABS_MT_TOUCH_MINOR,
- 0, SENSOR_RES_Y, 0, 0);
+ 0, SENSOR_RES_Y, 0, 0);
input_set_abs_params(input_dev, ABS_MT_ORIENTATION, 0, 1, 0, 0);
input_mt_init_slots(input_dev, MAX_CONTACTS,
- INPUT_MT_DIRECT | INPUT_MT_DROP_UNUSED);
+ INPUT_MT_DIRECT | INPUT_MT_DROP_UNUSED);
}
-/* clean up all allocated buffers/structs */
-static inline void sur40_delete(struct sur40_state *sur40)
-{
- input_free_polled_device(sur40->input);
- kfree(sur40->bulk_in_buffer);
- kfree(sur40);
-}
-
-/* check candidate USB interface */
+/* Check candidate USB interface. */
static int sur40_probe(struct usb_interface *interface,
- const struct usb_device_id *id)
+ const struct usb_device_id *id)
{
struct usb_device *usbdev = interface_to_usbdev(interface);
struct sur40_state *sur40;
struct usb_host_interface *iface_desc;
struct usb_endpoint_descriptor *endpoint;
struct input_polled_dev *poll_dev;
- int result;
+ int error;
- /* check if we really have the right interface */
+ /* Check if we really have the right interface. */
iface_desc = &interface->altsetting[0];
if (iface_desc->desc.bInterfaceClass != 0xFF)
return -ENODEV;
- /* use endpoint #4 (0x86) */
+ /* Use endpoint #4 (0x86). */
endpoint = &iface_desc->endpoint[4].desc;
if (endpoint->bEndpointAddress != TOUCH_ENDPOINT)
return -ENODEV;
- /* allocate memory for our device state and initialize it */
+ /* Allocate memory for our device state and initialize it. */
sur40 = kzalloc(sizeof(struct sur40_state), GFP_KERNEL);
if (!sur40)
return -ENOMEM;
poll_dev = input_allocate_polled_device();
if (!poll_dev) {
- result = -ENOMEM;
+ error = -ENOMEM;
goto err_free_dev;
}
- /* setup polled input device control struct */
+ /* Set up polled input device control structure */
poll_dev->private = sur40;
poll_dev->poll_interval = POLL_INTERVAL;
poll_dev->open = sur40_open;
poll_dev->poll = sur40_poll;
poll_dev->close = sur40_close;
- /* setup regular input device struct */
+ /* Set up regular input device structure */
sur40_input_setup(poll_dev->input);
poll_dev->input->name = "Samsung SUR40";
- usb_to_input_id(usbdev, &(poll_dev->input->id));
+ usb_to_input_id(usbdev, &poll_dev->input->id);
usb_make_path(usbdev, sur40->phys, sizeof(sur40->phys));
strlcat(sur40->phys, "/input0", sizeof(sur40->phys));
poll_dev->input->phys = sur40->phys;
+ poll_dev->input->dev.parent = &interface->dev;
sur40->usbdev = usbdev;
- sur40->dev = &usbdev->dev;
+ sur40->dev = &interface->dev;
sur40->input = poll_dev;
/* use the bulk-in endpoint tested above */
@@ -411,12 +404,12 @@ static int sur40_probe(struct usb_interface *interface,
sur40->bulk_in_buffer = kmalloc(sur40->bulk_in_size, GFP_KERNEL);
if (!sur40->bulk_in_buffer) {
dev_err(&interface->dev, "Unable to allocate input buffer.");
- result = -ENOMEM;
+ error = -ENOMEM;
goto err_free_polldev;
}
- result = input_register_polled_device(poll_dev);
- if (result) {
+ error = input_register_polled_device(poll_dev);
+ if (error) {
dev_err(&interface->dev,
"Unable to register polled input device.");
goto err_free_buffer;
@@ -424,7 +417,7 @@ static int sur40_probe(struct usb_interface *interface,
/* we can register the device now, as it is ready */
usb_set_intfdata(interface, sur40);
- dev_dbg(&interface->dev, "%s now attached\n", DRIVER_DESC);
+ dev_dbg(&interface->dev, "%s is now attached\n", DRIVER_DESC);
return 0;
@@ -435,24 +428,30 @@ err_free_polldev:
err_free_dev:
kfree(sur40);
- return result;
+ return error;
}
-/* unregister device & clean up */
+/* Unregister device & clean up. */
static void sur40_disconnect(struct usb_interface *interface)
{
struct sur40_state *sur40 = usb_get_intfdata(interface);
input_unregister_polled_device(sur40->input);
+ input_free_polled_device(sur40->input);
+ kfree(sur40->bulk_in_buffer);
+ kfree(sur40);
usb_set_intfdata(interface, NULL);
-
- sur40_delete(sur40);
-
- dev_dbg(&interface->dev, "%s now disconnected\n", DRIVER_DESC);
+ dev_dbg(&interface->dev, "%s is now disconnected\n", DRIVER_DESC);
}
-/* usb specific object needed to register this driver with the usb subsystem */
+static const struct usb_device_id sur40_table[] = {
+ { USB_DEVICE(ID_MICROSOFT, ID_SUR40) }, /* Samsung SUR40 */
+ { } /* terminating null entry */
+};
+MODULE_DEVICE_TABLE(usb, sur40_table);
+
+/* USB-specific object needed to register this driver with the USB subsystem. */
static struct usb_driver sur40_driver = {
.name = DRIVER_SHORT,
.probe = sur40_probe,
^ permalink raw reply related
* Re: [PATCH v3] add sur40 driver for Samsung SUR40 (aka MS Surface 2.0/Pixelsense)
From: David Herrmann @ 2013-11-11 6:56 UTC (permalink / raw)
To: Florian Echtler
Cc: open list:HID CORE LAYER, Benjamin Tissoires, Henrik Rydberg,
Dmitry Torokhov
In-Reply-To: <1383748012-28880-1-git-send-email-floe@butterbrot.org>
Hi Florian
On Wed, Nov 6, 2013 at 3:26 PM, Florian Echtler <floe@butterbrot.org> wrote:
> From: "Florian Echtler" <floe@butterbrot.org>
>
> This patch adds support for the built-in multitouch sensor in the Samsung
> SUR40 touchscreen device, also known as Microsoft Surface 2.0 or Microsoft
> Pixelsense. Support for raw video output from the sensor as well as the
> accelerometer will be added in a later patch.
>
> Signed-off-by: Florian Echtler <floe@butterbrot.org>
> ---
> drivers/input/touchscreen/Kconfig | 10 +
> drivers/input/touchscreen/Makefile | 1 +
> drivers/input/touchscreen/sur40.c | 467 ++++++++++++++++++++++++++++++++++++
> 3 files changed, 478 insertions(+)
> create mode 100644 drivers/input/touchscreen/sur40.c
>
> diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
> index 515cfe7..99aaf10 100644
> --- a/drivers/input/touchscreen/Kconfig
> +++ b/drivers/input/touchscreen/Kconfig
> @@ -876,6 +876,16 @@ config TOUCHSCREEN_STMPE
> To compile this driver as a module, choose M here: the
> module will be called stmpe-ts.
>
> +config TOUCHSCREEN_SUR40
> + tristate "Samsung SUR40 (Surface 2.0/PixelSense) touchscreen"
> + depends on USB
> + help
> + Say Y here if you want support for the Samsung SUR40 touchscreen
> + (also known as Microsoft Surface 2.0 or Microsoft PixelSense).
> +
> + To compile this driver as a module, choose M here: the
> + module will be called sur40.
> +
> config TOUCHSCREEN_TPS6507X
> tristate "TPS6507x based touchscreens"
> depends on I2C
> diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile
> index 6bfbeab..b63a25d 100644
> --- a/drivers/input/touchscreen/Makefile
> +++ b/drivers/input/touchscreen/Makefile
> @@ -51,6 +51,7 @@ obj-$(CONFIG_TOUCHSCREEN_PIXCIR) += pixcir_i2c_ts.o
> obj-$(CONFIG_TOUCHSCREEN_S3C2410) += s3c2410_ts.o
> obj-$(CONFIG_TOUCHSCREEN_ST1232) += st1232.o
> obj-$(CONFIG_TOUCHSCREEN_STMPE) += stmpe-ts.o
> +obj-$(CONFIG_TOUCHSCREEN_SUR40) += sur40.o
> obj-$(CONFIG_TOUCHSCREEN_TI_AM335X_TSC) += ti_am335x_tsc.o
> obj-$(CONFIG_TOUCHSCREEN_TNETV107X) += tnetv107x-ts.o
> obj-$(CONFIG_TOUCHSCREEN_TOUCHIT213) += touchit213.o
> diff --git a/drivers/input/touchscreen/sur40.c b/drivers/input/touchscreen/sur40.c
> new file mode 100644
> index 0000000..48787fd
> --- /dev/null
> +++ b/drivers/input/touchscreen/sur40.c
> @@ -0,0 +1,467 @@
> +/*
> + Surface2.0/SUR40/PixelSense input driver
> +
> + 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.
> +
> + Copyright (c) 2013 by Florian 'floe' Echtler <floe@butterbrot.org>
> +
> + Derived from the USB Skeleton driver 1.1,
> + Copyright (c) 2003 Greg Kroah-Hartman (greg@kroah.com)
> +
> + and from the Apple USB BCM5974 multitouch driver,
> + Copyright (c) 2008 Henrik Rydberg (rydberg@euromail.se)
> +
> + and from the generic hid-multitouch driver,
> + Copyright (c) 2010-2012 Stephane Chatty <chatty@enac.fr>
> +*/
> +
> +#include <linux/kernel.h>
> +#include <linux/errno.h>
> +#include <linux/delay.h>
> +#include <linux/init.h>
> +#include <linux/slab.h>
> +#include <linux/module.h>
> +#include <linux/completion.h>
> +#include <linux/uaccess.h>
> +#include <linux/usb.h>
> +#include <linux/printk.h>
> +#include <linux/input-polldev.h>
> +#include <linux/input/mt.h>
> +#include <linux/usb/input.h>
> +
> +/* read 512 bytes from endpoint 0x86 -> get header + blobs */
> +struct sur40_header {
> +
> + __le16 type; /* always 0x0001 */
> + __le16 count; /* count of blobs (if 0: continue prev. packet) */
> +
> + __le32 packet_id; /* unique ID for all packets in one frame */
> +
> + __le32 timestamp; /* milliseconds (inc. by 16 or 17 each frame) */
> + __le32 unknown; /* "epoch?" always 02/03 00 00 00 */
> +
> +} __packed;
> +
> +struct sur40_blob {
> +
> + __le16 blob_id;
> +
> + __u8 action; /* 0x02 = enter/exit, 0x03 = update (?) */
> + __u8 unknown; /* always 0x01 or 0x02 (no idea what this is?) */
> +
> + __le16 bb_pos_x; /* upper left corner of bounding box */
> + __le16 bb_pos_y;
> +
> + __le16 bb_size_x; /* size of bounding box */
> + __le16 bb_size_y;
> +
> + __le16 pos_x; /* finger tip position */
> + __le16 pos_y;
> +
> + __le16 ctr_x; /* centroid position */
> + __le16 ctr_y;
> +
> + __le16 axis_x; /* somehow related to major/minor axis, mostly: */
> + __le16 axis_y; /* axis_x == bb_size_y && axis_y == bb_size_x */
> +
> + __le32 angle; /* orientation in radians relative to x axis -
> + actually an IEEE754 float, don't use in kernel */
> +
> + __le32 area; /* size in pixels/pressure (?) */
> +
> + __u8 padding[32];
> +
> +} __packed;
> +
> +/* combined header/blob data */
> +struct sur40_data {
> + struct sur40_header header;
> + struct sur40_blob blobs[];
> +} __packed;
> +
> +
> +/* version information */
> +#define DRIVER_SHORT "sur40"
> +#define DRIVER_AUTHOR "Florian 'floe' Echtler <floe@butterbrot.org>"
> +#define DRIVER_DESC "Surface2.0/SUR40/PixelSense input driver"
> +
> +/* vendor and device IDs */
> +#define ID_MICROSOFT 0x045e
> +#define ID_SUR40 0x0775
> +
> +/* sensor resolution */
> +#define SENSOR_RES_X 1920
> +#define SENSOR_RES_Y 1080
> +
> +/* touch data endpoint */
> +#define TOUCH_ENDPOINT 0x86
> +
> +/* polling interval (ms) */
> +#define POLL_INTERVAL 10
> +
> +/* maximum number of contacts FIXME: this is a guess? */
> +#define MAX_CONTACTS 64
> +
> +/* device ID table */
> +static const struct usb_device_id sur40_table[] = {
> + {USB_DEVICE(ID_MICROSOFT, ID_SUR40)}, /* Samsung SUR40 */
> + {} /* terminating null entry */
> +};
> +
> +/* control commands */
> +#define SUR40_GET_VERSION 0xb0 /* 12 bytes string */
> +#define SUR40_UNKNOWN1 0xb3 /* 5 bytes */
> +#define SUR40_UNKNOWN2 0xc1 /* 24 bytes */
> +
> +#define SUR40_GET_STATE 0xc5 /* 4 bytes state (?) */
> +#define SUR40_GET_SENSORS 0xb1 /* 8 bytes sensors */
> +
> +/*
> + * Note: an earlier, non-public version of this driver used USB_RECIP_ENDPOINT
> + * here by mistake which is very likely to have corrupted the firmware EEPROM
> + * on two separate SUR40 devices. Thanks to Alan Stern who spotted this bug.
> + * Should you ever run into a similar problem, the background story to this
> + * incident and instructions on how to fix the corrupted EEPROM are available
> + * at https://floe.butterbrot.org/matrix/hacking/surface/brick.html
> +*/
> +#define sur40_command(dev, command, index, buffer, size) \
> + usb_control_msg(dev->usbdev, usb_rcvctrlpipe(dev->usbdev, 0), \
> + command, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, 0x00, \
> + index, buffer, size, 1000)
> +
> +MODULE_DEVICE_TABLE(usb, sur40_table);
> +
> +/* structure to hold all of our device specific stuff */
> +struct sur40_state {
> +
> + struct usb_device *usbdev; /* save the usb device pointer */
> + struct device *dev; /* save the generic device pointer */
> + struct input_polled_dev *input; /* struct for polled input device */
> +
> + struct sur40_data *bulk_in_buffer; /* the buffer to receive data */
> + size_t bulk_in_size; /* the maximum bulk packet size */
> + __u8 bulk_in_epaddr; /* address of the bulk in endpoint */
> +
> + char phys[64]; /* buffer for phys name */
> +};
> +
> +/* initialization routine, called from sur40_open */
> +static int sur40_init(struct sur40_state *dev)
> +{
> + int result;
> + __u8 buffer[24];
> +
> + /* stupidly replay the original MS driver init sequence */
> + result = sur40_command(dev, SUR40_GET_VERSION, 0x00, buffer, 12);
> + if (result < 0)
> + return result;
> +
> + result = sur40_command(dev, SUR40_GET_VERSION, 0x01, buffer, 12);
> + if (result < 0)
> + return result;
> +
> + result = sur40_command(dev, SUR40_GET_VERSION, 0x02, buffer, 12);
> + if (result < 0)
> + return result;
> +
> + result = sur40_command(dev, SUR40_UNKNOWN2, 0x00, buffer, 24);
> + if (result < 0)
> + return result;
> +
> + result = sur40_command(dev, SUR40_UNKNOWN1, 0x00, buffer, 5);
> + if (result < 0)
> + return result;
> +
> + result = sur40_command(dev, SUR40_GET_VERSION, 0x03, buffer, 12);
> +
> + /* discard the result buffer - no known data inside except
> + some version strings, maybe extract these sometime.. */
> +
> + return result;
> +}
> +
> +/*
> + * callback routines from input_polled_dev
> +*/
> +
> +/* enable the device, polling will now start */
> +void sur40_open(struct input_polled_dev *polldev)
> +{
> + struct sur40_state *sur40 = polldev->private;
> + dev_dbg(sur40->dev, "open\n");
> + sur40_init(sur40);
Just to be clear, sur40_open() may be called multiple times, and thus
same is true for sur40_init(). Did you test whether that works? If
not, you can drop the _open() and _close() callbacks and just call
sur40_init() in _probe(). If it works, the callbacks are definitely
better, obviously.
> +}
> +
> +/* disable device, polling has stopped */
> +void sur40_close(struct input_polled_dev *polldev)
> +{
> + /* no known way to stop the device, except to stop polling */
> + struct sur40_state *sur40 = polldev->private;
> + dev_dbg(sur40->dev, "close\n");
> +}
> +
> +/*
> + * this function is called when a whole contact has been processed,
> + * so that it can assign it to a slot and store the data there
> + */
> +static void report_blob(struct sur40_blob *blob, struct input_dev *input)
> +{
> + int wide, major, minor;
> +
> + int bb_size_x = le16_to_cpu(blob->bb_size_x);
> + int bb_size_y = le16_to_cpu(blob->bb_size_y);
> +
> + int pos_x = le16_to_cpu(blob->pos_x);
> + int pos_y = le16_to_cpu(blob->pos_y);
> +
> + int ctr_x = le16_to_cpu(blob->ctr_x);
> + int ctr_y = le16_to_cpu(blob->ctr_y);
> +
> + int slotnum = input_mt_get_slot_by_key(input, blob->blob_id);
> + if (slotnum < 0 || slotnum >= MAX_CONTACTS)
> + return;
> +
> + input_mt_slot(input, slotnum);
> + input_mt_report_slot_state(input, MT_TOOL_FINGER, 1);
> + wide = (bb_size_x > bb_size_y);
> + major = max(bb_size_x, bb_size_y);
> + minor = min(bb_size_x, bb_size_y);
> +
> + input_event(input, EV_ABS, ABS_MT_POSITION_X, pos_x);
> + input_event(input, EV_ABS, ABS_MT_POSITION_Y, pos_y);
> + input_event(input, EV_ABS, ABS_MT_TOOL_X, ctr_x);
> + input_event(input, EV_ABS, ABS_MT_TOOL_Y, ctr_y);
> +
> + /* TODO: use a better orientation measure */
> + input_event(input, EV_ABS, ABS_MT_ORIENTATION, wide);
> + input_event(input, EV_ABS, ABS_MT_TOUCH_MAJOR, major);
> + input_event(input, EV_ABS, ABS_MT_TOUCH_MINOR, minor);
> +}
> +
> +/* core function: poll for new input data */
> +void sur40_poll(struct input_polled_dev *polldev)
> +{
> +
> + struct sur40_state *sur40 = polldev->private;
> + struct input_dev *input = polldev->input;
> + int result, bulk_read, need_blobs, packet_blobs, i;
> + uint32_t packet_id;
> +
> + struct sur40_header *header = &sur40->bulk_in_buffer->header;
> + struct sur40_blob *inblob = &sur40->bulk_in_buffer->blobs[0];
> +
> + need_blobs = -1;
> +
> + dev_dbg(sur40->dev, "poll\n");
> +
> + do {
> +
> + /* perform a blocking bulk read to get data from the device */
> + result = usb_bulk_msg(sur40->usbdev,
> + usb_rcvbulkpipe(sur40->usbdev, sur40->bulk_in_epaddr),
> + sur40->bulk_in_buffer, sur40->bulk_in_size,
> + &bulk_read, 1000);
> +
> + dev_dbg(sur40->dev, "received %d bytes\n", bulk_read);
> +
> + if (result < 0) {
> + dev_err(sur40->dev, "error in usb_bulk_read\n");
> + return;
> + }
> +
> + result = bulk_read - sizeof(struct sur40_header);
> +
> + if (result % sizeof(struct sur40_blob) != 0) {
> + dev_err(sur40->dev, "transfer size mismatch\n");
> + return;
> + }
> +
> + /* first packet? */
> + if (need_blobs == -1) {
> + need_blobs = le16_to_cpu(header->count);
> + dev_dbg(sur40->dev, "need %d blobs\n", need_blobs);
> + packet_id = header->packet_id;
> + }
> +
> + /* sanity check. when video data is also being retrieved, the
> + * packet ID will usually increase in the middle of a series
> + * instead of at the end. */
> + if (packet_id != header->packet_id)
> + dev_warn(sur40->dev, "packet ID mismatch\n");
> +
> + packet_blobs = result / sizeof(struct sur40_blob);
> + dev_dbg(sur40->dev, "received %d blobs\n", packet_blobs);
> +
> + /* packets always contain at least 4 blobs, even if empty */
> + if (packet_blobs > need_blobs)
> + packet_blobs = need_blobs;
> +
> + for (i = 0; i < packet_blobs; i++) {
> + need_blobs--;
> + dev_dbg(sur40->dev, "processing blob\n");
> + report_blob(&(inblob[i]), input);
> + }
> +
> + } while (need_blobs > 0);
> +
> + input_mt_sync_frame(input);
> + input_sync(input);
> +}
> +
> +/*
> + * housekeeping routines
> +*/
> +
> +/* initialize input device parameters */
> +static void sur40_input_setup(struct input_dev *input_dev)
> +{
> + set_bit(EV_KEY, input_dev->evbit);
> + set_bit(EV_SYN, input_dev->evbit);
> + set_bit(EV_ABS, input_dev->evbit);
> +
> + input_set_abs_params(input_dev, ABS_MT_POSITION_X,
> + 0, SENSOR_RES_X, 0, 0);
> + input_set_abs_params(input_dev, ABS_MT_POSITION_Y,
> + 0, SENSOR_RES_Y, 0, 0);
> +
> + input_set_abs_params(input_dev, ABS_MT_TOOL_X,
> + 0, SENSOR_RES_X, 0, 0);
> + input_set_abs_params(input_dev, ABS_MT_TOOL_Y,
> + 0, SENSOR_RES_Y, 0, 0);
> +
> + /* max value unknown, but major/minor axis
> + * can never be larger than screen */
> + input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR,
> + 0, SENSOR_RES_X, 0, 0);
> + input_set_abs_params(input_dev, ABS_MT_TOUCH_MINOR,
> + 0, SENSOR_RES_Y, 0, 0);
> +
> + input_set_abs_params(input_dev, ABS_MT_ORIENTATION, 0, 1, 0, 0);
> +
> + input_mt_init_slots(input_dev, MAX_CONTACTS,
> + INPUT_MT_DIRECT | INPUT_MT_DROP_UNUSED);
> +}
> +
> +/* clean up all allocated buffers/structs */
> +static inline void sur40_delete(struct sur40_state *sur40)
> +{
> + input_free_polled_device(sur40->input);
> + kfree(sur40->bulk_in_buffer);
> + kfree(sur40);
> +}
> +
> +/* check candidate USB interface */
> +static int sur40_probe(struct usb_interface *interface,
> + const struct usb_device_id *id)
> +{
> + struct usb_device *usbdev = interface_to_usbdev(interface);
> + struct sur40_state *sur40;
> + struct usb_host_interface *iface_desc;
> + struct usb_endpoint_descriptor *endpoint;
> + struct input_polled_dev *poll_dev;
> + int result;
> +
> + /* check if we really have the right interface */
> + iface_desc = &interface->altsetting[0];
> + if (iface_desc->desc.bInterfaceClass != 0xFF)
> + return -ENODEV;
> +
> + /* use endpoint #4 (0x86) */
> + endpoint = &iface_desc->endpoint[4].desc;
Don't you have to test whether iface_desc->desc->bNumEndpoints is >4?
Or does usb allocate enough endpoint descriptors, anyway?
Other than that, the driver looks really good.
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Thanks
David
> + if (endpoint->bEndpointAddress != TOUCH_ENDPOINT)
> + return -ENODEV;
> +
> + /* allocate memory for our device state and initialize it */
> + sur40 = kzalloc(sizeof(struct sur40_state), GFP_KERNEL);
> + if (!sur40)
> + return -ENOMEM;
> +
> + poll_dev = input_allocate_polled_device();
> + if (!poll_dev) {
> + result = -ENOMEM;
> + goto err_free_dev;
> + }
> +
> + /* setup polled input device control struct */
> + poll_dev->private = sur40;
> + poll_dev->poll_interval = POLL_INTERVAL;
> + poll_dev->open = sur40_open;
> + poll_dev->poll = sur40_poll;
> + poll_dev->close = sur40_close;
> +
> + /* setup regular input device struct */
> + sur40_input_setup(poll_dev->input);
> +
> + poll_dev->input->name = "Samsung SUR40";
> + usb_to_input_id(usbdev, &(poll_dev->input->id));
> + usb_make_path(usbdev, sur40->phys, sizeof(sur40->phys));
> + strlcat(sur40->phys, "/input0", sizeof(sur40->phys));
> + poll_dev->input->phys = sur40->phys;
> +
> + sur40->usbdev = usbdev;
> + sur40->dev = &usbdev->dev;
> + sur40->input = poll_dev;
> +
> + /* use the bulk-in endpoint tested above */
> + sur40->bulk_in_size = usb_endpoint_maxp(endpoint);
> + sur40->bulk_in_epaddr = endpoint->bEndpointAddress;
> + sur40->bulk_in_buffer = kmalloc(sur40->bulk_in_size, GFP_KERNEL);
> + if (!sur40->bulk_in_buffer) {
> + dev_err(&interface->dev, "Unable to allocate input buffer.");
> + result = -ENOMEM;
> + goto err_free_polldev;
> + }
> +
> + result = input_register_polled_device(poll_dev);
> + if (result) {
> + dev_err(&interface->dev,
> + "Unable to register polled input device.");
> + goto err_free_buffer;
> + }
> +
> + /* we can register the device now, as it is ready */
> + usb_set_intfdata(interface, sur40);
> + dev_dbg(&interface->dev, "%s now attached\n", DRIVER_DESC);
> +
> + return 0;
> +
> +err_free_buffer:
> + kfree(sur40->bulk_in_buffer);
> +err_free_polldev:
> + input_free_polled_device(sur40->input);
> +err_free_dev:
> + kfree(sur40);
> +
> + return result;
> +}
> +
> +/* unregister device & clean up */
> +static void sur40_disconnect(struct usb_interface *interface)
> +{
> + struct sur40_state *sur40 = usb_get_intfdata(interface);
> +
> + input_unregister_polled_device(sur40->input);
> +
> + usb_set_intfdata(interface, NULL);
> +
> + sur40_delete(sur40);
> +
> + dev_dbg(&interface->dev, "%s now disconnected\n", DRIVER_DESC);
> +}
> +
> +/* usb specific object needed to register this driver with the usb subsystem */
> +static struct usb_driver sur40_driver = {
> + .name = DRIVER_SHORT,
> + .probe = sur40_probe,
> + .disconnect = sur40_disconnect,
> + .id_table = sur40_table,
> +};
> +
> +module_usb_driver(sur40_driver);
> +
> +MODULE_AUTHOR(DRIVER_AUTHOR);
> +MODULE_DESCRIPTION(DRIVER_DESC);
> +MODULE_LICENSE("GPL");
> --
> 1.7.9.5
>
^ permalink raw reply
* [PATCH] Input: mma8450 - add missing i2c_set_clientdata() in mma8450_probe()
From: Wei Yongjun @ 2013-11-11 6:24 UTC (permalink / raw)
To: dmitry.torokhov, grant.likely, rob.herring, wfp5p, broonie,
javier, sebastien.royen
Cc: yongjun_wei, linux-input
From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Add missing i2c_set_clientdata() in mma8450_probe(), otherwise
calling i2c_get_clientdata() in mma8450_remove() returns NULL.
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
drivers/input/misc/mma8450.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/input/misc/mma8450.c b/drivers/input/misc/mma8450.c
index f330969..92c43a1 100644
--- a/drivers/input/misc/mma8450.c
+++ b/drivers/input/misc/mma8450.c
@@ -204,6 +204,8 @@ static int mma8450_probe(struct i2c_client *c,
goto err_free_mem;
}
+ i2c_set_clientdata(c, m);
+
return 0;
err_free_mem:
^ permalink raw reply related
* [PATCH] Input: mpu3050 - add missing i2c_set_clientdata() in mpu3050_probe()
From: Wei Yongjun @ 2013-11-11 6:18 UTC (permalink / raw)
To: dmitry.torokhov, grant.likely, rob.herring, wfp5p, broonie,
javier, rmk+kernel
Cc: yongjun_wei, linux-input
From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Add missing i2c_set_clientdata() in mpu3050_probe(), otherwise
calling i2c_get_clientdata() in mpu3050_remove() returns NULL.
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
drivers/input/misc/mpu3050.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/input/misc/mpu3050.c b/drivers/input/misc/mpu3050.c
index dce0d95..6983ffb 100644
--- a/drivers/input/misc/mpu3050.c
+++ b/drivers/input/misc/mpu3050.c
@@ -383,6 +383,7 @@ static int mpu3050_probe(struct i2c_client *client,
pm_runtime_enable(&client->dev);
pm_runtime_set_autosuspend_delay(&client->dev, MPU3050_AUTO_DELAY);
+ i2c_set_clientdata(client, sensor);
return 0;
^ permalink raw reply related
* HID: RFC: Would HID_QUIRK_HAS_SPECIAL_DRIVER make sense?
From: Stefan Achatz @ 2013-11-10 14:32 UTC (permalink / raw)
To: linux-input
Hello,
devices that have special drivers in the kernel are added to
hid_core.c:hid_have_special_driver[] so that the hid-generic driver does
not bind the device.
Drivers not in the kernel have to rely on a mechanism of unbinding the
device from hid-generic and binding it to the right driver with an udev
rule or something.
I realized that on some modern distributions (namely Ubuntu13.10 and
Fedora19) this seems not to work anymore for my Roccat drivers. After
rebinding the device to the target driver the /dev/input/event* devices
show no output.
In Ubuntu13.10 this problem can be bypassed by adding the target module
to initrd, but not on Fedora19.
While I'm further investigating this issue it doesn't look like a basic
kernel problem, as the newer kernel versions work on older distros
flawlessly.
But I stumbled over the following idea which does not fix the problem,
but be an alternative to rebinding:
What about a HID_QUIRK_HAS_SPECIAL_DRIVER quirk that has the same
functionality as an entry in hid_have_special_driver[]?
In my eyes it looks like a suitable accommodation to the existing quirks
NOGET and IGNORE.
Mabe I'm overlooking something and a solution already exists?
Also, I would be glad to hear any hints on the rebind issue.
Thanks and have a nice day
Stefan Achatz
^ permalink raw reply
* [PATCH] HID: sony: Add force feedback support for Dualshock3 USB
From: Sven Eckelmann @ 2013-11-09 18:25 UTC (permalink / raw)
To: linux-input; +Cc: Jiri Kosina, Colin Leitner, Sven Eckelmann
Sony Dualshock 3 controllers have two motors which can be used to provide
simple force feedback rumble effects. The right motor is can be used to create
a weak rumble effect but does not allow to set the force. The left motor is
used to create a strong rumble effect with adjustable intensity.
The state of both motors can be changed using HID_OUTPUT_REPORT packets and
have no timing information. FF memless is used to keep track of the timing and
the sony driver just generates the necessary URBs.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
drivers/hid/Kconfig | 8 ++++++++
drivers/hid/hid-sony.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 60 insertions(+)
The device will not have any reports. Thus the payload is generated on the fly
as it is already done in different other places in the driver.
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index a27e531..329fbb9 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -618,6 +618,14 @@ config HID_SONY
* Sony PS3 Blue-ray Disk Remote Control (Bluetooth)
* Logitech Harmony adapter for Sony Playstation 3 (Bluetooth)
+config SONY_FF
+ bool "Sony PS2/3 accessories force feedback support"
+ depends on HID_SONY
+ select INPUT_FF_MEMLESS
+ ---help---
+ Say Y here if you have a Sony PS2/3 accessory and want to enable force
+ feedback support for it.
+
config HID_SPEEDLINK
tristate "Speedlink VAD Cezanne mouse support"
depends on HID
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index bc37a18..da551d1 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -614,6 +614,54 @@ static void buzz_remove(struct hid_device *hdev)
drv_data->extra = NULL;
}
+#ifdef CONFIG_SONY_FF
+static int sony_play_effect(struct input_dev *dev, void *data,
+ struct ff_effect *effect)
+{
+ unsigned char buf[] = {
+ 0x01,
+ 0x00, 0xff, 0x00, 0xff, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x03,
+ 0xff, 0x27, 0x10, 0x00, 0x32,
+ 0xff, 0x27, 0x10, 0x00, 0x32,
+ 0xff, 0x27, 0x10, 0x00, 0x32,
+ 0xff, 0x27, 0x10, 0x00, 0x32,
+ 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+ __u8 left;
+ __u8 right;
+ struct hid_device *hid = input_get_drvdata(dev);
+
+ if (effect->type != FF_RUMBLE)
+ return 0;
+
+ left = effect->u.rumble.strong_magnitude / 256;
+ right = effect->u.rumble.weak_magnitude ? 1 : 0;
+
+ buf[3] = right;
+ buf[5] = left;
+
+ return hid->hid_output_raw_report(hid, buf, sizeof(buf),
+ HID_OUTPUT_REPORT);
+}
+
+static int sony_init_ff(struct hid_device *hdev)
+{
+ struct hid_input *hidinput = list_entry(hdev->inputs.next,
+ struct hid_input, list);
+ struct input_dev *input_dev = hidinput->input;
+
+ input_set_capability(input_dev, EV_FF, FF_RUMBLE);
+ return input_ff_create_memless(input_dev, NULL, sony_play_effect);
+}
+
+#else
+static int sony_init_ff(struct hid_device *hdev)
+{
+ return 0;
+}
+#endif
+
static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
{
int ret;
@@ -663,6 +711,10 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
if (ret < 0)
goto err_stop;
+ ret = sony_init_ff(hdev);
+ if (ret < 0)
+ goto err_stop;
+
return 0;
err_stop:
hid_hw_stop(hdev);
--
1.8.4.2
^ permalink raw reply related
* [PATCHv3 2/2] dt: binding documentation for twl4030-keypad
From: Sebastian Reichel @ 2013-11-08 22:14 UTC (permalink / raw)
To: Sebastian Reichel, Dmitry Torokhov, Dmitry Torokhov, linux-input
Cc: Rob Herring, Pawel Moll, Mark Rutland, Stephen Warren,
Ian Campbell, Rob Landley, Grant Likely, devicetree, linux-doc,
linux-kernel, Sebastian Reichel
In-Reply-To: <1383948866-32672-1-git-send-email-sre@debian.org>
Add devicetree binding documentation for twl4030-keypad.
Signed-off-by: Sebastian Reichel <sre@debian.org>
---
.../devicetree/bindings/input/twl4030-keypad.txt | 31 ++++++++++++++++++++++
1 file changed, 31 insertions(+)
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..901d10f
--- /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 not 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;
+ };
--
1.8.4.rc3
^ permalink raw reply related
* [PATCHv3 1/2] Input: twl4030-keypad - add device tree support
From: Sebastian Reichel @ 2013-11-08 22:14 UTC (permalink / raw)
To: Sebastian Reichel, Dmitry Torokhov, Dmitry Torokhov, linux-input
Cc: Rob Herring, Pawel Moll, Mark Rutland, Stephen Warren,
Ian Campbell, Rob Landley, Grant Likely, devicetree, linux-doc,
linux-kernel, Sebastian Reichel
In-Reply-To: <1383948866-32672-1-git-send-email-sre@debian.org>
Add device tree support for twl4030 keypad driver.
Tested on Nokia N900.
Signed-off-by: Sebastian Reichel <sre@debian.org>
---
drivers/input/keyboard/twl4030_keypad.c | 91 +++++++++++++++++++++++++++------
1 file changed, 74 insertions(+), 17 deletions(-)
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
* [PATCHv3 0/2] twl4030-keypad DT binding
From: Sebastian Reichel @ 2013-11-08 22:14 UTC (permalink / raw)
To: Sebastian Reichel, Dmitry Torokhov, Dmitry Torokhov, linux-input
Cc: Rob Herring, Pawel Moll, Mark Rutland, Stephen Warren,
Ian Campbell, Rob Landley, Grant Likely, devicetree, linux-doc,
linux-kernel, Sebastian Reichel
Hi,
Add device tree support for the twl4030 keypad, which is
for example used in the Nokia N900.
Changes since v2 [0]:
* Removed patches, which add twl4030-keypad node to
omap3 and nokia n900 dts files. I will send these to
Benoit once this patchset is queued.
* Split devicetree binding documentation into its own
patch.
* Fix typo in documentation
[0] https://lkml.org/lkml/2013/10/22/141
-- Sebastian
Sebastian Reichel (2):
Input: twl4030-keypad - add device tree support
dt: binding documentation for twl4030-keypad
.../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
--
1.8.4.rc3
^ permalink raw reply
* [PATCHv7 1/4] Input: twl4030-pwrbutton: add device tree support
From: Sebastian Reichel @ 2013-11-08 22:11 UTC (permalink / raw)
To: Sebastian Reichel, Dmitry Torokhov, Dmitry Torokhov, linux-input
Cc: Rob Herring, Pawel Moll, Mark Rutland, Stephen Warren,
Ian Campbell, Rob Landley, Grant Likely, devicetree, linux-doc,
linux-kernel, Sebastian Reichel
In-Reply-To: <1383948687-32279-1-git-send-email-sre@debian.org>
Add device tree support for twl4030 power button driver.
Adding device tree support involved converting the
driver to module_platform_driver().
Signed-off-by: Sebastian Reichel <sre@debian.org>
Acked-by: Kumar Gala <galak@codeaurora.org>
Tested-by: Florian Vaussard <florian.vaussard@epfl.ch>
---
drivers/input/misc/twl4030-pwrbutton.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/drivers/input/misc/twl4030-pwrbutton.c b/drivers/input/misc/twl4030-pwrbutton.c
index b9a05fd..a3a0fe3 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,24 @@ 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);
+#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 = of_match_ptr(twl4030_pwrbutton_dt_match_table),
},
};
-
-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
* [PATCHv7 4/4] Input: twl4030-pwrbutton: simplify driver using devm_*
From: Sebastian Reichel @ 2013-11-08 22:11 UTC (permalink / raw)
To: Sebastian Reichel, Dmitry Torokhov, Dmitry Torokhov, linux-input
Cc: Rob Herring, Pawel Moll, Mark Rutland, Stephen Warren,
Ian Campbell, Rob Landley, Grant Likely, devicetree, linux-doc,
linux-kernel, Sebastian Reichel
In-Reply-To: <1383948687-32279-1-git-send-email-sre@debian.org>
Use managed irq resource to simplify the driver.
Signed-off-by: Sebastian Reichel <sre@debian.org>
Reviewed-by: Aaro Koskinen <aaro.koskinen@iki.fi>
---
drivers/input/misc/twl4030-pwrbutton.c | 26 ++++----------------------
1 file changed, 4 insertions(+), 22 deletions(-)
diff --git a/drivers/input/misc/twl4030-pwrbutton.c b/drivers/input/misc/twl4030-pwrbutton.c
index 48639ff..be1759c 100644
--- a/drivers/input/misc/twl4030-pwrbutton.c
+++ b/drivers/input/misc/twl4030-pwrbutton.c
@@ -58,7 +58,7 @@ static int twl4030_pwrbutton_probe(struct platform_device *pdev)
int irq = platform_get_irq(pdev, 0);
int err;
- pwr = input_allocate_device();
+ pwr = devm_input_allocate_device(&pdev->dev);
if (!pwr) {
dev_dbg(&pdev->dev, "Can't allocate power button\n");
return -ENOMEM;
@@ -70,40 +70,23 @@ 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) {
dev_err(&pdev->dev, "Can't get IRQ for pwrbutton: %d\n", err);
- goto free_input_dev;
+ return err;
}
err = input_register_device(pwr);
if (err) {
dev_err(&pdev->dev, "Can't register power button: %d\n", err);
- goto free_irq;
+ return err;
}
platform_set_drvdata(pdev, pwr);
return 0;
-
-free_irq:
- free_irq(irq, pwr);
-free_input_dev:
- input_free_device(pwr);
- return err;
-}
-
-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;
}
#if IS_ENABLED(CONFIG_OF)
@@ -116,7 +99,6 @@ MODULE_DEVICE_TABLE(of, twl4030_pwrbutton_dt_match_table);
static struct platform_driver twl4030_pwrbutton_driver = {
.probe = twl4030_pwrbutton_probe,
- .remove = __exit_p(twl4030_pwrbutton_remove),
.driver = {
.name = "twl4030_pwrbutton",
.owner = THIS_MODULE,
--
1.8.4.rc3
^ permalink raw reply related
* [PATCHv7 3/4] Input: twl4030-pwrbutton: use dev_err for errors
From: Sebastian Reichel @ 2013-11-08 22:11 UTC (permalink / raw)
To: Sebastian Reichel, Dmitry Torokhov, Dmitry Torokhov, linux-input
Cc: Rob Herring, Pawel Moll, Mark Rutland, Stephen Warren,
Ian Campbell, Rob Landley, Grant Likely, devicetree, linux-doc,
linux-kernel, Sebastian Reichel
In-Reply-To: <1383948687-32279-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>
Reviewed-by: Aaro Koskinen <aaro.koskinen@iki.fi>
---
drivers/input/misc/twl4030-pwrbutton.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/input/misc/twl4030-pwrbutton.c b/drivers/input/misc/twl4030-pwrbutton.c
index a3a0fe3..48639ff 100644
--- a/drivers/input/misc/twl4030-pwrbutton.c
+++ b/drivers/input/misc/twl4030-pwrbutton.c
@@ -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
* [PATCHv7 2/4] dt: binding documentation for twl4030-pwrbutton
From: Sebastian Reichel @ 2013-11-08 22:11 UTC (permalink / raw)
To: Sebastian Reichel, Dmitry Torokhov, Dmitry Torokhov, linux-input
Cc: Rob Herring, Pawel Moll, Mark Rutland, Stephen Warren,
Ian Campbell, Rob Landley, Grant Likely, devicetree, linux-doc,
linux-kernel, Sebastian Reichel
In-Reply-To: <1383948687-32279-1-git-send-email-sre@debian.org>
Add devicetree binding documentation for twl4030-pwrbutton.
Signed-off-by: Sebastian Reichel <sre@debian.org>
---
.../devicetree/bindings/input/twl4030-pwrbutton.txt | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
create mode 100644 Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt
diff --git a/Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt b/Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt
new file mode 100644
index 0000000..c864a46
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt
@@ -0,0 +1,21 @@
+Texas Instruments TWL family (twl4030) pwrbutton module
+
+This module is part of the TWL4030. For more details about the whole
+chip see Documentation/devicetree/bindings/mfd/twl-familly.txt.
+
+This module provides a simple power button event via an Interrupt.
+
+Required properties:
+- compatible: should be one of the following
+ - "ti,twl4030-pwrbutton": For controllers compatible with twl4030
+- interrupts: should be one of the following
+ - <8>: For controllers compatible with twl4030
+
+Example:
+
+&twl {
+ twl_pwrbutton: pwrbutton {
+ compatible = "ti,twl4030-pwrbutton";
+ interrupts = <8>;
+ };
+};
--
1.8.4.rc3
^ permalink raw reply related
* [PATCHv7 0/4] twl4030-pwrbutton DT binding
From: Sebastian Reichel @ 2013-11-08 22:11 UTC (permalink / raw)
To: Sebastian Reichel, Dmitry Torokhov, Dmitry Torokhov, linux-input
Cc: Rob Herring, Pawel Moll, Mark Rutland, Stephen Warren,
Ian Campbell, Rob Landley, Grant Likely, devicetree, linux-doc,
linux-kernel, Sebastian Reichel
Hi,
This is the seventh iteration of DT support for the TWL4030
power button.
Changes since v6 [0]:
* Splitted DT binding documentation into its own patch
* Updated commit message of first patch
* Added Reviewed-by: Aaro Koskinen
* Added Tested-by: Florian Vaussard
* Added Acked-by: Kumar Gala
[0] https://lkml.org/lkml/2013/10/24/269
-- Sebastian
Sebastian Reichel (4):
Input: twl4030-pwrbutton: add device tree support
dt: binding documentation for twl4030-pwrbutton
Input: twl4030-pwrbutton: use dev_err for errors
Input: twl4030-pwrbutton: simplify driver using devm_*
.../bindings/input/twl4030-pwrbutton.txt | 21 +++++++++++
drivers/input/misc/twl4030-pwrbutton.c | 44 +++++++++-------------
2 files changed, 38 insertions(+), 27 deletions(-)
create mode 100644 Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt
--
1.8.4.rc3
^ permalink raw reply
* Re: [PATCH v3] add sur40 driver for Samsung SUR40 (aka MS Surface 2.0/Pixelsense)
From: Henrik Rydberg @ 2013-11-08 21:37 UTC (permalink / raw)
To: Florian Echtler
Cc: linux-input, benjamin.tissoires, dmitry.torokhov, dh.herrmann
In-Reply-To: <1383748012-28880-1-git-send-email-floe@butterbrot.org>
Hi Florian,
> This patch adds support for the built-in multitouch sensor in the Samsung
> SUR40 touchscreen device, also known as Microsoft Surface 2.0 or Microsoft
> Pixelsense. Support for raw video output from the sensor as well as the
> accelerometer will be added in a later patch.
>
> Signed-off-by: Florian Echtler <floe@butterbrot.org>
> ---
> drivers/input/touchscreen/Kconfig | 10 +
> drivers/input/touchscreen/Makefile | 1 +
> drivers/input/touchscreen/sur40.c | 467 ++++++++++++++++++++++++++++++++++++
> 3 files changed, 478 insertions(+)
> create mode 100644 drivers/input/touchscreen/sur40.c
The driver looks pretty good now, thanks for making the changes. There
might be one or two white space problems, but those can be fixed while
applying. Dmitry, I guess you want to take this through your tree, so
Reviewed-by: Henrik Rydberg <rydberg@euromail.se>
Thanks,
Henrik
^ 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