Linux Input/HID development
 help / color / mirror / Atom feed
* 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 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: 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 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: [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] 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 v3] add sur40 driver for Samsung SUR40 (aka MS Surface 2.0/Pixelsense)
From: Henrik Rydberg @ 2013-11-11 10:27 UTC (permalink / raw)
  To: Florian Echtler, Dmitry Torokhov
  Cc: linux-input, benjamin.tissoires, dh.herrmann
In-Reply-To: <5280AC87.4020905@butterbrot.org>

 >> 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?

No need to resubmit, a confirmation will do nicely. Thanks!

Henrik


^ permalink raw reply

* Re: [PATCH 2/2] Input: usbtouchscreen: ignore eGalax/D-Wav/EETI HIDs
From: Forest Bond @ 2013-11-11 13:06 UTC (permalink / raw)
  To: Jiri Kosina
  Cc: Dmitry Torokhov, linux-input, Sebastian Dalfuß, Daniel Ritz,
	Max Weninger, Christian Engelmayer
In-Reply-To: <alpine.LNX.2.00.1311111121290.7751@pobox.suse.cz>

[-- Attachment #1: Type: text/plain, Size: 761 bytes --]

Hi,

On Mon, Nov 11, 2013 at 11:21:42AM +0100, Jiri Kosina wrote:
> 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.

Thanks for your help, Dmitry and Jiri.

-Forest

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply

* Re: [PATCHv3 1/2] Input: twl4030-keypad - add device tree support
From: Pavel Machek @ 2013-11-11 22:19 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Sebastian Reichel, Dmitry Torokhov, Dmitry Torokhov, linux-input,
	Rob Herring, Pawel Moll, Mark Rutland, Stephen Warren,
	Ian Campbell, Rob Landley, Grant Likely, devicetree, linux-doc,
	linux-kernel
In-Reply-To: <1383948866-32672-2-git-send-email-sre@debian.org>

Hi!

> +	if (of_get_property(np, "linux,input-no-autorepeat", NULL))
> +		keypad_data->no_autorepeat = true;

>From 2/2:

+Optional Properties specific to linux:
+- linux,keypad-no-autorepeat: do not enable autorepeat feature.

I'm confused now.

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply

* Re: [PATCH v2 2/2] Input: wacom - add support for three new Intuos devices
From: Peter Hutterer @ 2013-11-12  0:56 UTC (permalink / raw)
  To: Chris Bagwell
  Cc: Ping Cheng, linux-input@vger.kernel.org, Dmitry Torokhov,
	Ping Cheng
In-Reply-To: <CAGzDe_a_VF7697u66LsWoV+C6+VLRzQJ8FWnct9SGK6DQurULQ@mail.gmail.com>

On Thu, Nov 07, 2013 at 08:25:40PM -0600, Chris Bagwell wrote:
> On Thu, Oct 10, 2013 at 4:17 PM, Ping Cheng <pinglinux@gmail.com> wrote:
> > This series of models added a hardware switch to turn touch
> > data on/off. To report the state of the switch, SW_TOUCH
> > is added in include/uapi/linux/input.h.
> 
> So I guess the big point is this patch can't go in until a SW_TOUCH
> goes in first.
> 
> Since the 1/2 or this 2/2 series has already gone in, would you mind
> breaking this
> remaining patch up into the basic support for new Intuos (without the
> SW_TOUCH) and
> then a separate patch to add SW_TOUCH support on top of that?  Then
> the basic support can go in ASAP.
> 
> I only have comments on this patch related to the SW_TOUCH part... things like:
> 
>  * should the SW_TOUCH be reported against the wireless interface or
> the touch interface... userland apps may have an opinion on which is
> best.

against the touch device. from userspace, seeing that something is a touch
device but SW_TOUCH is off is a lot easier to deal with than having a
separate device report SW_TOUCH and we'll have to find the matching
userspace device this applies to.
(unless I'm misreading something here)

>  * the part with updating SW_TOUCH from unrelated interfaces could use
> a review by someone like Dmitry for possible issues.
>  * It would be better if you didn't add that EV_SW for HW that will
> not report the SW_TOUCH.

definitely agree here.

I still don't think that changing the INTUOS naming convention to use
underscores is a good idea given that in a year's time no-one will care that
some intuos used to be bamboos but we'll be stuck with the mismatched naming
scheme for a while.

Acked-by: Peter Hutterer <peter.hutterer@who-t.net> otherwise though

Cheers,
   Peter

> If you break the patch into 2, you can add my line for the basic
> support without SW_TOUCH:
> 
> Reviewed-by: Chris Bagwell <chris@cnpbagwell.com>
> 
> Chris
> 
> >
> > The driver is also updated to process wireless devices that do
> > not support touch interface.
> >
> > Tested-by: Jason Gerecke <killertofu@gmail.com>
> > Signed-off-by: Ping Cheng <pingc@wacom.com>
> > ---
> > v2: Change SW_TOUCH_ENABLED to SW_TOUCH and clear BTN_TOUCH bit
> > for button only interfaces as suggested by Peter Hutterer.
> > ---
> >  drivers/input/tablet/wacom_sys.c | 16 +++++++-
> >  drivers/input/tablet/wacom_wac.c | 87 ++++++++++++++++++++++++++++++++--------
> >  drivers/input/tablet/wacom_wac.h |  7 ++++
> >  include/uapi/linux/input.h       |  1 +
> >  4 files changed, 93 insertions(+), 18 deletions(-)
> >
> > diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
> > index 7bdb5e9..efd9729 100644
> > --- a/drivers/input/tablet/wacom_sys.c
> > +++ b/drivers/input/tablet/wacom_sys.c
> > @@ -1190,12 +1190,15 @@ static void wacom_wireless_work(struct work_struct *work)
> >                 wacom_wac1->features.device_type = BTN_TOOL_PEN;
> >                 snprintf(wacom_wac1->name, WACOM_NAME_MAX, "%s (WL) Pen",
> >                          wacom_wac1->features.name);
> > +               wacom_wac1->shared->touch_max = wacom_wac1->features.touch_max;
> > +               wacom_wac1->shared->type = wacom_wac1->features.type;
> >                 error = wacom_register_input(wacom1);
> >                 if (error)
> >                         goto fail;
> >
> >                 /* Touch interface */
> > -               if (wacom_wac1->features.touch_max) {
> > +               if (wacom_wac1->features.touch_max ||
> > +                   wacom_wac1->features.type == INTUOS_HT) {
> >                         wacom_wac2->features =
> >                                 *((struct wacom_features *)id->driver_info);
> >                         wacom_wac2->features.pktlen = WACOM_PKGLEN_BBTOUCH3;
> > @@ -1210,6 +1213,10 @@ static void wacom_wireless_work(struct work_struct *work)
> >                         error = wacom_register_input(wacom2);
> >                         if (error)
> >                                 goto fail;
> > +
> > +                       if (wacom_wac1->features.type == INTUOS_HT &&
> > +                           wacom_wac1->features.touch_max)
> > +                               wacom_wac->shared->touch_input = wacom_wac2->input;
> >                 }
> >
> >                 error = wacom_initialize_battery(wacom);
> > @@ -1318,7 +1325,7 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
> >          * HID descriptor. If this is the touch interface (wMaxPacketSize
> >          * of WACOM_PKGLEN_BBTOUCH3), override the table values.
> >          */
> > -       if (features->type >= INTUOS5S && features->type <= INTUOSPL) {
> > +       if (features->type >= INTUOS5S && features->type <= INTUOS_HT) {
> >                 if (endpoint->wMaxPacketSize == WACOM_PKGLEN_BBTOUCH3) {
> >                         features->device_type = BTN_TOOL_FINGER;
> >                         features->pktlen = WACOM_PKGLEN_BBTOUCH3;
> > @@ -1390,6 +1397,11 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
> >                 }
> >         }
> >
> > +       if (wacom_wac->features.type == INTUOS_HT && wacom_wac->features.touch_max) {
> > +               if (wacom_wac->features.device_type == BTN_TOOL_FINGER)
> > +                       wacom_wac->shared->touch_input = wacom_wac->input;
> > +       }
> > +
> >         return 0;
> >
> >   fail5: wacom_destroy_leds(wacom);
> > diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
> > index 9c8eded..4cbea85 100644
> > --- a/drivers/input/tablet/wacom_wac.c
> > +++ b/drivers/input/tablet/wacom_wac.c
> > @@ -1176,10 +1176,17 @@ static void wacom_bpt3_touch_msg(struct wacom_wac *wacom, unsigned char *data)
> >  static void wacom_bpt3_button_msg(struct wacom_wac *wacom, unsigned char *data)
> >  {
> >         struct input_dev *input = wacom->input;
> > +       struct wacom_features *features = &wacom->features;
> >
> > -       input_report_key(input, BTN_LEFT, (data[1] & 0x08) != 0);
> > +       if (features->type == INTUOS_HT) {
> > +               input_report_key(input, BTN_LEFT, (data[1] & 0x02) != 0);
> > +               input_report_key(input, BTN_BACK, (data[1] & 0x08) != 0);
> > +       } else {
> > +
> > +               input_report_key(input, BTN_BACK, (data[1] & 0x02) != 0);
> > +               input_report_key(input, BTN_LEFT, (data[1] & 0x08) != 0);
> > +       }
> >         input_report_key(input, BTN_FORWARD, (data[1] & 0x04) != 0);
> > -       input_report_key(input, BTN_BACK, (data[1] & 0x02) != 0);
> >         input_report_key(input, BTN_RIGHT, (data[1] & 0x01) != 0);
> >  }
> >
> > @@ -1213,13 +1220,23 @@ static int wacom_bpt3_touch(struct wacom_wac *wacom)
> >
> >  static int wacom_bpt_pen(struct wacom_wac *wacom)
> >  {
> > +       struct wacom_features *features = &wacom->features;
> >         struct input_dev *input = wacom->input;
> >         unsigned char *data = wacom->data;
> >         int prox = 0, x = 0, y = 0, p = 0, d = 0, pen = 0, btn1 = 0, btn2 = 0;
> >
> > -       if (data[0] != 0x02)
> > +       if (data[0] != WACOM_REPORT_PENABLED && data[0] != WACOM_REPORT_USB_MODE)
> >             return 0;
> >
> > +       if (data[0] == WACOM_REPORT_USB_MODE) {
> > +               if ((features->type == INTUOS_HT) && features->touch_max) {
> > +                       input_report_switch(wacom->shared->touch_input,
> > +                                           SW_TOUCH, data[8] & 0x40);
> > +                       input_sync(wacom->shared->touch_input);
> > +               }
> > +               return 0;
> > +       }
> > +
> >         prox = (data[1] & 0x20) == 0x20;
> >
> >         /*
> > @@ -1297,13 +1314,20 @@ static int wacom_wireless_irq(struct wacom_wac *wacom, size_t len)
> >         unsigned char *data = wacom->data;
> >         int connected;
> >
> > -       if (len != WACOM_PKGLEN_WIRELESS || data[0] != 0x80)
> > +       if (len != WACOM_PKGLEN_WIRELESS || data[0] != WACOM_REPORT_WL_MODE)
> >                 return 0;
> >
> >         connected = data[1] & 0x01;
> >         if (connected) {
> >                 int pid, battery;
> >
> > +               if ((wacom->shared->type == INTUOS_HT) &&
> > +                               wacom->shared->touch_max) {
> > +                       input_report_switch(wacom->shared->touch_input,
> > +                                       SW_TOUCH, data[5] & 0x40);
> > +                       input_sync(wacom->shared->touch_input);
> > +               }
> > +
> >                 pid = get_unaligned_be16(&data[6]);
> >                 battery = data[5] & 0x3f;
> >                 if (wacom->pid != pid) {
> > @@ -1391,6 +1415,7 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len)
> >                 break;
> >
> >         case BAMBOO_PT:
> > +       case INTUOS_HT:
> >                 sync = wacom_bpt_irq(wacom_wac, len);
> >                 break;
> >
> > @@ -1459,7 +1484,7 @@ void wacom_setup_device_quirks(struct wacom_features *features)
> >
> >         /* these device have multiple inputs */
> >         if (features->type >= WIRELESS ||
> > -           (features->type >= INTUOS5S && features->type <= INTUOSPL) ||
> > +           (features->type >= INTUOS5S && features->type <= INTUOS_HT) ||
> >             (features->oVid && features->oPid))
> >                 features->quirks |= WACOM_QUIRK_MULTI_INPUT;
> >
> > @@ -1531,7 +1556,8 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
> >         struct wacom_features *features = &wacom_wac->features;
> >         int i;
> >
> > -       input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
> > +       input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS) |
> > +                              BIT_MASK(EV_SW);
> >
> >         __set_bit(BTN_TOUCH, input_dev->keybit);
> >         __set_bit(ABS_MISC, input_dev->absbit);
> > @@ -1771,33 +1797,48 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
> >                 __set_bit(INPUT_PROP_POINTER, input_dev->propbit);
> >                 break;
> >
> > +       case INTUOS_HT:
> > +               if (features->touch_max &&
> > +                   (features->device_type == BTN_TOOL_FINGER))
> > +                       __set_bit(SW_TOUCH, input_dev->swbit);
> > +               /* fall through */
> > +
> >         case BAMBOO_PT:
> >                 __clear_bit(ABS_MISC, input_dev->absbit);
> >
> > -               __set_bit(INPUT_PROP_POINTER, input_dev->propbit);
> > -
> >                 if (features->device_type == BTN_TOOL_FINGER) {
> > -                       unsigned int flags = INPUT_MT_POINTER;
> >
> >                         __set_bit(BTN_LEFT, input_dev->keybit);
> >                         __set_bit(BTN_FORWARD, input_dev->keybit);
> >                         __set_bit(BTN_BACK, input_dev->keybit);
> >                         __set_bit(BTN_RIGHT, input_dev->keybit);
> >
> > -                       if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) {
> > -                               input_set_abs_params(input_dev,
> > +                       if (features->touch_max) {
> > +                               /* touch interface */
> > +                               unsigned int flags = INPUT_MT_POINTER;
> > +
> > +                               __set_bit(INPUT_PROP_POINTER, input_dev->propbit);
> > +                               if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) {
> > +                                       input_set_abs_params(input_dev,
> >                                                      ABS_MT_TOUCH_MAJOR,
> >                                                      0, features->x_max, 0, 0);
> > -                               input_set_abs_params(input_dev,
> > +                                       input_set_abs_params(input_dev,
> >                                                      ABS_MT_TOUCH_MINOR,
> >                                                      0, features->y_max, 0, 0);
> > +                               } else {
> > +                                       __set_bit(BTN_TOOL_FINGER, input_dev->keybit);
> > +                                       __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit);
> > +                                       flags = 0;
> > +                               }
> > +                               input_mt_init_slots(input_dev, features->touch_max, flags);
> >                         } else {
> > -                               __set_bit(BTN_TOOL_FINGER, input_dev->keybit);
> > -                               __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit);
> > -                               flags = 0;
> > +                               /* buttons/keys only interface */
> > +                               __clear_bit(ABS_X, input_dev->absbit);
> > +                               __clear_bit(ABS_Y, input_dev->absbit);
> > +                               __clear_bit(BTN_TOUCH, input_dev->keybit);
> >                         }
> > -                       input_mt_init_slots(input_dev, features->touch_max, flags);
> >                 } else if (features->device_type == BTN_TOOL_PEN) {
> > +                       __set_bit(INPUT_PROP_POINTER, input_dev->propbit);
> >                         __set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
> >                         __set_bit(BTN_TOOL_PEN, input_dev->keybit);
> >                         __set_bit(BTN_STYLUS, input_dev->keybit);
> > @@ -2194,6 +2235,17 @@ static const struct wacom_features wacom_features_0x300 =
> >  static const struct wacom_features wacom_features_0x301 =
> >         { "Wacom Bamboo One M",    WACOM_PKGLEN_BBPEN,    21648, 13530, 1023,
> >           31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
> > +static const struct wacom_features wacom_features_0x302 =
> > +       { "Wacom Intuos PT S",     WACOM_PKGLEN_BBPEN,    15200,  9500, 1023,
> > +         31, INTUOS_HT, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
> > +         .touch_max = 16 };
> > +static const struct wacom_features wacom_features_0x303 =
> > +       { "Wacom Intuos PT M",     WACOM_PKGLEN_BBPEN,    21600, 13500, 1023,
> > +         31, INTUOS_HT, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
> > +         .touch_max = 16 };
> > +static const struct wacom_features wacom_features_0x30E =
> > +       { "Wacom Intuos S",        WACOM_PKGLEN_BBPEN,    15200,  9500, 1023,
> > +         31, INTUOS_HT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
> >  static const struct wacom_features wacom_features_0x6004 =
> >         { "ISD-V4",               WACOM_PKGLEN_GRAPHIRE,  12800,  8000,  255,
> >           0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
> > @@ -2329,6 +2381,9 @@ const struct usb_device_id wacom_ids[] = {
> >         { USB_DEVICE_WACOM(0x10D) },
> >         { USB_DEVICE_WACOM(0x300) },
> >         { USB_DEVICE_WACOM(0x301) },
> > +       { USB_DEVICE_WACOM(0x302) },
> > +       { USB_DEVICE_DETAILED(0x303, USB_CLASS_HID, 0, 0) },
> > +       { USB_DEVICE_DETAILED(0x30E, USB_CLASS_HID, 0, 0) },
> >         { USB_DEVICE_WACOM(0x304) },
> >         { USB_DEVICE_DETAILED(0x314, USB_CLASS_HID, 0, 0) },
> >         { USB_DEVICE_DETAILED(0x315, USB_CLASS_HID, 0, 0) },
> > diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h
> > index fd23a37..ba9e335 100644
> > --- a/drivers/input/tablet/wacom_wac.h
> > +++ b/drivers/input/tablet/wacom_wac.h
> > @@ -54,6 +54,8 @@
> >  #define WACOM_REPORT_TPCST             16
> >  #define WACOM_REPORT_TPC1FGE           18
> >  #define WACOM_REPORT_24HDT             1
> > +#define WACOM_REPORT_WL_MODE           128
> > +#define WACOM_REPORT_USB_MODE          192
> >
> >  /* device quirks */
> >  #define WACOM_QUIRK_MULTI_INPUT                0x0001
> > @@ -81,6 +83,7 @@ enum {
> >         INTUOSPS,
> >         INTUOSPM,
> >         INTUOSPL,
> > +       INTUOS_HT,
> >         WACOM_21UX2,
> >         WACOM_22HD,
> >         DTK,
> > @@ -129,6 +132,10 @@ struct wacom_features {
> >  struct wacom_shared {
> >         bool stylus_in_proximity;
> >         bool touch_down;
> > +       /* for wireless device to access USB interfaces */
> > +       unsigned touch_max;
> > +       int type;
> > +       struct input_dev *touch_input;
> >  };
> >
> >  struct wacom_wac {
> > diff --git a/include/uapi/linux/input.h b/include/uapi/linux/input.h
> > index d08abf9..70e53e8 100644
> > --- a/include/uapi/linux/input.h
> > +++ b/include/uapi/linux/input.h
> > @@ -855,6 +855,7 @@ struct input_keymap_entry {
> >  #define SW_FRONT_PROXIMITY     0x0b  /* set = front proximity sensor active */
> >  #define SW_ROTATE_LOCK         0x0c  /* set = rotate locked/disabled */
> >  #define SW_LINEIN_INSERT       0x0d  /* set = inserted */
> > +#define SW_TOUCH               0x0e  /* set = touch switch turned on (touch events off) */
> >  #define SW_MAX                 0x0f
> >  #define SW_CNT                 (SW_MAX+1)
> >
> > --
> > 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

* Re: [PATCH v2 2/2] Input: wacom - add support for three new Intuos devices
From: Chris Bagwell @ 2013-11-12  2:50 UTC (permalink / raw)
  To: Ping Cheng; +Cc: linux-input@vger.kernel.org, Dmitry Torokhov, Peter Hutterer
In-Reply-To: <CAF8JNh+Vh3FswdDYPffi603iJmnnSgQDtfiJVfP=mqCqTW8dXQ@mail.gmail.com>

On Fri, Nov 8, 2013 at 1:13 PM, Ping Cheng <pinglinux@gmail.com> wrote:
> On Thu, Nov 7, 2013 at 6:25 PM, Chris Bagwell <chris@cnpbagwell.com> wrote:
>> On Thu, Oct 10, 2013 at 4:17 PM, Ping Cheng <pinglinux@gmail.com> wrote:
>>> This series of models added a hardware switch to turn touch
>>> data on/off. To report the state of the switch, SW_TOUCH
>>> is added in include/uapi/linux/input.h.
>>
>> So I guess the big point is this patch can't go in until a SW_TOUCH
>> goes in first.
>>
>> Since the 1/2 or this 2/2 series has already gone in, would you mind
>> breaking this
>> remaining patch up into the basic support for new Intuos (without the
>> SW_TOUCH) and
>> then a separate patch to add SW_TOUCH support on top of that?  Then
>> the basic support can go in ASAP.
>
> Chris, thank you for pushing the process forward.
>
> SW_TOUCH is truly part of the basic support for the new series. The
> main new feature of this series is touch switch. If we do not report
> its status in the same patch, it means we are not reporting a complete
> set of data.
>
>> I only have comments on this patch related to the SW_TOUCH part... things like:
>>
>>  * should the SW_TOUCH be reported against the wireless interface or
>> the touch interface... userland apps may have an opinion on which is
>> best.
>
> We can not report SW_TOUCH status from touch interface since once
> touch is turned off (by end users), no events can go on touch
> interface. Plus, we do not know when a user may switch touch on.
> That's why SW_TOUCH are regularly updated and reported through
> wireless interface for wireless connection.

I think I made wrong assumption of HW.  Does HW stop sending touch
events when switch is toggled or is switch an indication to ignore
touch events in either driver or userland?

I was thinking it was for later case.  When userland has to ignore, it
is not easy to know switch value on /dev/input/foo really means what
to do related to events on /dev/input/bar.  So thats were my thoughts
were about moving it to input that needs to be disabled.  In former
case, it just status so not so important to decide which input to
report over.

>
>>  * the part with updating SW_TOUCH from unrelated interfaces could use
>
> It is not unrelated interface. It is how it works.
>
>> a review by someone like Dmitry for possible issues.

I meant any issues with parsing data in context of /dev/input/foo but
doing an input_sync(/dev/input/bar) in that same context.  Probably no
issue but I don't know kernel internals to be sure.

>>  * It would be better if you didn't add that EV_SW for HW that will
>> not report the SW_TOUCH.
>
> I can consider that in the next version.
>
>> If you break the patch into 2, you can add my line for the basic
>
> I'd like to know your opinion about my comments before updating the
> patch. IMO, using two patches to process one set of raw data
> complicates the support.

Assuming SW_TOUCH for this device is only for status reporting, I
don't have much opinion.  If it because a request to disable touch
events in userland then I think it should move to device its related
to.

Chris

>
> Ping
>
>> support without SW_TOUCH:
>>
>> Reviewed-by: Chris Bagwell <chris@cnpbagwell.com>
>>
>> Chris
>>
>>>
>>> The driver is also updated to process wireless devices that do
>>> not support touch interface.
>>>
>>> Tested-by: Jason Gerecke <killertofu@gmail.com>
>>> Signed-off-by: Ping Cheng <pingc@wacom.com>
>>> ---
>>> v2: Change SW_TOUCH_ENABLED to SW_TOUCH and clear BTN_TOUCH bit
>>> for button only interfaces as suggested by Peter Hutterer.
>>> ---
>>>  drivers/input/tablet/wacom_sys.c | 16 +++++++-
>>>  drivers/input/tablet/wacom_wac.c | 87 ++++++++++++++++++++++++++++++++--------
>>>  drivers/input/tablet/wacom_wac.h |  7 ++++
>>>  include/uapi/linux/input.h       |  1 +
>>>  4 files changed, 93 insertions(+), 18 deletions(-)
>>>
>>> diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
>>> index 7bdb5e9..efd9729 100644
>>> --- a/drivers/input/tablet/wacom_sys.c
>>> +++ b/drivers/input/tablet/wacom_sys.c
>>> @@ -1190,12 +1190,15 @@ static void wacom_wireless_work(struct work_struct *work)
>>>                 wacom_wac1->features.device_type = BTN_TOOL_PEN;
>>>                 snprintf(wacom_wac1->name, WACOM_NAME_MAX, "%s (WL) Pen",
>>>                          wacom_wac1->features.name);
>>> +               wacom_wac1->shared->touch_max = wacom_wac1->features.touch_max;
>>> +               wacom_wac1->shared->type = wacom_wac1->features.type;
>>>                 error = wacom_register_input(wacom1);
>>>                 if (error)
>>>                         goto fail;
>>>
>>>                 /* Touch interface */
>>> -               if (wacom_wac1->features.touch_max) {
>>> +               if (wacom_wac1->features.touch_max ||
>>> +                   wacom_wac1->features.type == INTUOS_HT) {
>>>                         wacom_wac2->features =
>>>                                 *((struct wacom_features *)id->driver_info);
>>>                         wacom_wac2->features.pktlen = WACOM_PKGLEN_BBTOUCH3;
>>> @@ -1210,6 +1213,10 @@ static void wacom_wireless_work(struct work_struct *work)
>>>                         error = wacom_register_input(wacom2);
>>>                         if (error)
>>>                                 goto fail;
>>> +
>>> +                       if (wacom_wac1->features.type == INTUOS_HT &&
>>> +                           wacom_wac1->features.touch_max)
>>> +                               wacom_wac->shared->touch_input = wacom_wac2->input;
>>>                 }
>>>
>>>                 error = wacom_initialize_battery(wacom);
>>> @@ -1318,7 +1325,7 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
>>>          * HID descriptor. If this is the touch interface (wMaxPacketSize
>>>          * of WACOM_PKGLEN_BBTOUCH3), override the table values.
>>>          */
>>> -       if (features->type >= INTUOS5S && features->type <= INTUOSPL) {
>>> +       if (features->type >= INTUOS5S && features->type <= INTUOS_HT) {
>>>                 if (endpoint->wMaxPacketSize == WACOM_PKGLEN_BBTOUCH3) {
>>>                         features->device_type = BTN_TOOL_FINGER;
>>>                         features->pktlen = WACOM_PKGLEN_BBTOUCH3;
>>> @@ -1390,6 +1397,11 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
>>>                 }
>>>         }
>>>
>>> +       if (wacom_wac->features.type == INTUOS_HT && wacom_wac->features.touch_max) {
>>> +               if (wacom_wac->features.device_type == BTN_TOOL_FINGER)
>>> +                       wacom_wac->shared->touch_input = wacom_wac->input;
>>> +       }
>>> +
>>>         return 0;
>>>
>>>   fail5: wacom_destroy_leds(wacom);
>>> diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
>>> index 9c8eded..4cbea85 100644
>>> --- a/drivers/input/tablet/wacom_wac.c
>>> +++ b/drivers/input/tablet/wacom_wac.c
>>> @@ -1176,10 +1176,17 @@ static void wacom_bpt3_touch_msg(struct wacom_wac *wacom, unsigned char *data)
>>>  static void wacom_bpt3_button_msg(struct wacom_wac *wacom, unsigned char *data)
>>>  {
>>>         struct input_dev *input = wacom->input;
>>> +       struct wacom_features *features = &wacom->features;
>>>
>>> -       input_report_key(input, BTN_LEFT, (data[1] & 0x08) != 0);
>>> +       if (features->type == INTUOS_HT) {
>>> +               input_report_key(input, BTN_LEFT, (data[1] & 0x02) != 0);
>>> +               input_report_key(input, BTN_BACK, (data[1] & 0x08) != 0);
>>> +       } else {
>>> +
>>> +               input_report_key(input, BTN_BACK, (data[1] & 0x02) != 0);
>>> +               input_report_key(input, BTN_LEFT, (data[1] & 0x08) != 0);
>>> +       }
>>>         input_report_key(input, BTN_FORWARD, (data[1] & 0x04) != 0);
>>> -       input_report_key(input, BTN_BACK, (data[1] & 0x02) != 0);
>>>         input_report_key(input, BTN_RIGHT, (data[1] & 0x01) != 0);
>>>  }
>>>
>>> @@ -1213,13 +1220,23 @@ static int wacom_bpt3_touch(struct wacom_wac *wacom)
>>>
>>>  static int wacom_bpt_pen(struct wacom_wac *wacom)
>>>  {
>>> +       struct wacom_features *features = &wacom->features;
>>>         struct input_dev *input = wacom->input;
>>>         unsigned char *data = wacom->data;
>>>         int prox = 0, x = 0, y = 0, p = 0, d = 0, pen = 0, btn1 = 0, btn2 = 0;
>>>
>>> -       if (data[0] != 0x02)
>>> +       if (data[0] != WACOM_REPORT_PENABLED && data[0] != WACOM_REPORT_USB_MODE)
>>>             return 0;
>>>
>>> +       if (data[0] == WACOM_REPORT_USB_MODE) {
>>> +               if ((features->type == INTUOS_HT) && features->touch_max) {
>>> +                       input_report_switch(wacom->shared->touch_input,
>>> +                                           SW_TOUCH, data[8] & 0x40);
>>> +                       input_sync(wacom->shared->touch_input);
>>> +               }
>>> +               return 0;
>>> +       }
>>> +
>>>         prox = (data[1] & 0x20) == 0x20;
>>>
>>>         /*
>>> @@ -1297,13 +1314,20 @@ static int wacom_wireless_irq(struct wacom_wac *wacom, size_t len)
>>>         unsigned char *data = wacom->data;
>>>         int connected;
>>>
>>> -       if (len != WACOM_PKGLEN_WIRELESS || data[0] != 0x80)
>>> +       if (len != WACOM_PKGLEN_WIRELESS || data[0] != WACOM_REPORT_WL_MODE)
>>>                 return 0;
>>>
>>>         connected = data[1] & 0x01;
>>>         if (connected) {
>>>                 int pid, battery;
>>>
>>> +               if ((wacom->shared->type == INTUOS_HT) &&
>>> +                               wacom->shared->touch_max) {
>>> +                       input_report_switch(wacom->shared->touch_input,
>>> +                                       SW_TOUCH, data[5] & 0x40);
>>> +                       input_sync(wacom->shared->touch_input);
>>> +               }
>>> +
>>>                 pid = get_unaligned_be16(&data[6]);
>>>                 battery = data[5] & 0x3f;
>>>                 if (wacom->pid != pid) {
>>> @@ -1391,6 +1415,7 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len)
>>>                 break;
>>>
>>>         case BAMBOO_PT:
>>> +       case INTUOS_HT:
>>>                 sync = wacom_bpt_irq(wacom_wac, len);
>>>                 break;
>>>
>>> @@ -1459,7 +1484,7 @@ void wacom_setup_device_quirks(struct wacom_features *features)
>>>
>>>         /* these device have multiple inputs */
>>>         if (features->type >= WIRELESS ||
>>> -           (features->type >= INTUOS5S && features->type <= INTUOSPL) ||
>>> +           (features->type >= INTUOS5S && features->type <= INTUOS_HT) ||
>>>             (features->oVid && features->oPid))
>>>                 features->quirks |= WACOM_QUIRK_MULTI_INPUT;
>>>
>>> @@ -1531,7 +1556,8 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
>>>         struct wacom_features *features = &wacom_wac->features;
>>>         int i;
>>>
>>> -       input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
>>> +       input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS) |
>>> +                              BIT_MASK(EV_SW);
>>>
>>>         __set_bit(BTN_TOUCH, input_dev->keybit);
>>>         __set_bit(ABS_MISC, input_dev->absbit);
>>> @@ -1771,33 +1797,48 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
>>>                 __set_bit(INPUT_PROP_POINTER, input_dev->propbit);
>>>                 break;
>>>
>>> +       case INTUOS_HT:
>>> +               if (features->touch_max &&
>>> +                   (features->device_type == BTN_TOOL_FINGER))
>>> +                       __set_bit(SW_TOUCH, input_dev->swbit);
>>> +               /* fall through */
>>> +
>>>         case BAMBOO_PT:
>>>                 __clear_bit(ABS_MISC, input_dev->absbit);
>>>
>>> -               __set_bit(INPUT_PROP_POINTER, input_dev->propbit);
>>> -
>>>                 if (features->device_type == BTN_TOOL_FINGER) {
>>> -                       unsigned int flags = INPUT_MT_POINTER;
>>>
>>>                         __set_bit(BTN_LEFT, input_dev->keybit);
>>>                         __set_bit(BTN_FORWARD, input_dev->keybit);
>>>                         __set_bit(BTN_BACK, input_dev->keybit);
>>>                         __set_bit(BTN_RIGHT, input_dev->keybit);
>>>
>>> -                       if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) {
>>> -                               input_set_abs_params(input_dev,
>>> +                       if (features->touch_max) {
>>> +                               /* touch interface */
>>> +                               unsigned int flags = INPUT_MT_POINTER;
>>> +
>>> +                               __set_bit(INPUT_PROP_POINTER, input_dev->propbit);
>>> +                               if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) {
>>> +                                       input_set_abs_params(input_dev,
>>>                                                      ABS_MT_TOUCH_MAJOR,
>>>                                                      0, features->x_max, 0, 0);
>>> -                               input_set_abs_params(input_dev,
>>> +                                       input_set_abs_params(input_dev,
>>>                                                      ABS_MT_TOUCH_MINOR,
>>>                                                      0, features->y_max, 0, 0);
>>> +                               } else {
>>> +                                       __set_bit(BTN_TOOL_FINGER, input_dev->keybit);
>>> +                                       __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit);
>>> +                                       flags = 0;
>>> +                               }
>>> +                               input_mt_init_slots(input_dev, features->touch_max, flags);
>>>                         } else {
>>> -                               __set_bit(BTN_TOOL_FINGER, input_dev->keybit);
>>> -                               __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit);
>>> -                               flags = 0;
>>> +                               /* buttons/keys only interface */
>>> +                               __clear_bit(ABS_X, input_dev->absbit);
>>> +                               __clear_bit(ABS_Y, input_dev->absbit);
>>> +                               __clear_bit(BTN_TOUCH, input_dev->keybit);
>>>                         }
>>> -                       input_mt_init_slots(input_dev, features->touch_max, flags);
>>>                 } else if (features->device_type == BTN_TOOL_PEN) {
>>> +                       __set_bit(INPUT_PROP_POINTER, input_dev->propbit);
>>>                         __set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
>>>                         __set_bit(BTN_TOOL_PEN, input_dev->keybit);
>>>                         __set_bit(BTN_STYLUS, input_dev->keybit);
>>> @@ -2194,6 +2235,17 @@ static const struct wacom_features wacom_features_0x300 =
>>>  static const struct wacom_features wacom_features_0x301 =
>>>         { "Wacom Bamboo One M",    WACOM_PKGLEN_BBPEN,    21648, 13530, 1023,
>>>           31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
>>> +static const struct wacom_features wacom_features_0x302 =
>>> +       { "Wacom Intuos PT S",     WACOM_PKGLEN_BBPEN,    15200,  9500, 1023,
>>> +         31, INTUOS_HT, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
>>> +         .touch_max = 16 };
>>> +static const struct wacom_features wacom_features_0x303 =
>>> +       { "Wacom Intuos PT M",     WACOM_PKGLEN_BBPEN,    21600, 13500, 1023,
>>> +         31, INTUOS_HT, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
>>> +         .touch_max = 16 };
>>> +static const struct wacom_features wacom_features_0x30E =
>>> +       { "Wacom Intuos S",        WACOM_PKGLEN_BBPEN,    15200,  9500, 1023,
>>> +         31, INTUOS_HT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
>>>  static const struct wacom_features wacom_features_0x6004 =
>>>         { "ISD-V4",               WACOM_PKGLEN_GRAPHIRE,  12800,  8000,  255,
>>>           0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
>>> @@ -2329,6 +2381,9 @@ const struct usb_device_id wacom_ids[] = {
>>>         { USB_DEVICE_WACOM(0x10D) },
>>>         { USB_DEVICE_WACOM(0x300) },
>>>         { USB_DEVICE_WACOM(0x301) },
>>> +       { USB_DEVICE_WACOM(0x302) },
>>> +       { USB_DEVICE_DETAILED(0x303, USB_CLASS_HID, 0, 0) },
>>> +       { USB_DEVICE_DETAILED(0x30E, USB_CLASS_HID, 0, 0) },
>>>         { USB_DEVICE_WACOM(0x304) },
>>>         { USB_DEVICE_DETAILED(0x314, USB_CLASS_HID, 0, 0) },
>>>         { USB_DEVICE_DETAILED(0x315, USB_CLASS_HID, 0, 0) },
>>> diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h
>>> index fd23a37..ba9e335 100644
>>> --- a/drivers/input/tablet/wacom_wac.h
>>> +++ b/drivers/input/tablet/wacom_wac.h
>>> @@ -54,6 +54,8 @@
>>>  #define WACOM_REPORT_TPCST             16
>>>  #define WACOM_REPORT_TPC1FGE           18
>>>  #define WACOM_REPORT_24HDT             1
>>> +#define WACOM_REPORT_WL_MODE           128
>>> +#define WACOM_REPORT_USB_MODE          192
>>>
>>>  /* device quirks */
>>>  #define WACOM_QUIRK_MULTI_INPUT                0x0001
>>> @@ -81,6 +83,7 @@ enum {
>>>         INTUOSPS,
>>>         INTUOSPM,
>>>         INTUOSPL,
>>> +       INTUOS_HT,
>>>         WACOM_21UX2,
>>>         WACOM_22HD,
>>>         DTK,
>>> @@ -129,6 +132,10 @@ struct wacom_features {
>>>  struct wacom_shared {
>>>         bool stylus_in_proximity;
>>>         bool touch_down;
>>> +       /* for wireless device to access USB interfaces */
>>> +       unsigned touch_max;
>>> +       int type;
>>> +       struct input_dev *touch_input;
>>>  };
>>>
>>>  struct wacom_wac {
>>> diff --git a/include/uapi/linux/input.h b/include/uapi/linux/input.h
>>> index d08abf9..70e53e8 100644
>>> --- a/include/uapi/linux/input.h
>>> +++ b/include/uapi/linux/input.h
>>> @@ -855,6 +855,7 @@ struct input_keymap_entry {
>>>  #define SW_FRONT_PROXIMITY     0x0b  /* set = front proximity sensor active */
>>>  #define SW_ROTATE_LOCK         0x0c  /* set = rotate locked/disabled */
>>>  #define SW_LINEIN_INSERT       0x0d  /* set = inserted */
>>> +#define SW_TOUCH               0x0e  /* set = touch switch turned on (touch events off) */
>>>  #define SW_MAX                 0x0f
>>>  #define SW_CNT                 (SW_MAX+1)
>>>
>>> --
>>> 1.8.1.2
>>>

^ permalink raw reply

* Re: [PATCHv3 1/2] Input: twl4030-keypad - add device tree support
From: Sebastian Reichel @ 2013-11-12  3:25 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Dmitry Torokhov, Dmitry Torokhov, linux-input, Rob Herring,
	Pawel Moll, Mark Rutland, Stephen Warren, Ian Campbell,
	Rob Landley, Grant Likely, devicetree, linux-doc, linux-kernel
In-Reply-To: <20131111221941.GB23331@amd.pavel.ucw.cz>

[-- Attachment #1: Type: text/plain, Size: 1515 bytes --]

Hi,

On Mon, Nov 11, 2013 at 11:19:41PM +0100, Pavel Machek wrote:
> > +	if (of_get_property(np, "linux,input-no-autorepeat", NULL))
> > +		keypad_data->no_autorepeat = true;
> 
> From 2/2:
> 
> +Optional Properties specific to linux:
> +- linux,keypad-no-autorepeat: do not enable autorepeat feature.
> 
> I'm confused now.

good catch! That happens when one tries to mimic other drivers :/

I just checked all DT input drivers for autorepeat keyword:

DRIVER              CODE                        DOCUMENTATION
twl4030-keypad      linux,input-no-autorepeat   linux,keypad-no-autorepeat
omap4-keypad        linux,input-no-autorepeat   linux,keypad-no-autorepeat
samsung-keypad      linux,input-no-autorepeat   linux,keypad-no-autorepeat
stmpe-keypad        st,no-autorepeat            st,no-autorepeat
spear-keyboard      autorepeat                  autorepeat
tca8418-keypad      keypad,autorepeat           --- not documented ---
gpio-matrix-keypad  linux,no-autorepeat         linux,no-autorepeat
gpio-keys-polled    autorepeat                  autorepeat
gpio-keys           autorepeat                  --- no documentation ---

Any suggestions how to continue fixing this mess? I guess first of
all the documentation of omap4-keypad, samsung-keypad and of course
the new twl4030-keypad driver should be fixed.

Next it would be nice to choose one standard property name for this
and use it for twl4030-keypad. I suggest to use "linux,input-no-autorepeat".

-- Sebastian

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply

* [PATCH] Input: Add new driver for GPIO beeper
From: Alexander Shiyan @ 2013-11-12 10:07 UTC (permalink / raw)
  To: linux-input-u79uwXL29TY76Z2rM5mHXA
  Cc: Dmitry Torokhov, devicetree-u79uwXL29TY76Z2rM5mHXA, Rob Herring,
	Pawel Moll, Mark Rutland, Stephen Warren, Ian Campbell,
	Alexander Shiyan

This patch adds a new driver for the beeper controlled via GPIO pin.
The driver does not depend on the architecture and is positioned as
a replacement for the specific drivers that are used for this function.

Signed-off-by: Alexander Shiyan <shc_work-JGs/UdohzUI@public.gmane.org>
---
 .../devicetree/bindings/input/gpio-beeper.txt      |  15 +++
 drivers/input/misc/Kconfig                         |   9 ++
 drivers/input/misc/Makefile                        |   1 +
 drivers/input/misc/gpio-beeper.c                   | 129 +++++++++++++++++++++
 4 files changed, 154 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/gpio-beeper.txt
 create mode 100644 drivers/input/misc/gpio-beeper.c

diff --git a/Documentation/devicetree/bindings/input/gpio-beeper.txt b/Documentation/devicetree/bindings/input/gpio-beeper.txt
new file mode 100644
index 0000000..8081605
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/gpio-beeper.txt
@@ -0,0 +1,15 @@
+* GPIO beeper device tree bindings
+
+Registers a beeper connected to GPIO pin.
+
+Required properties:
+- compatible:	should be "gpio-beeper".
+- gpios:	From common gpio binding; gpio connection to beeper enable pin.
+
+Example:
+
+beeper: input@0 {
+	compatible = "gpio-beeper";
+	reg = <0>;
+	gpios = <&gpio3 23 0>;
+};
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index 5f4967d..4ffc397 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -222,6 +222,15 @@ config INPUT_GP2A
 	  To compile this driver as a module, choose M here: the
 	  module will be called gp2ap002a00f.
 
+config INPUT_GPIO_BEEPER
+	tristate "Generic GPIO Beeper support"
+	depends on OF_GPIO
+	help
+	  Say Y here if you have a beeper connected to a GPIO pin.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called gpio-beeper.
+
 config INPUT_GPIO_TILT_POLLED
 	tristate "Polled GPIO tilt switch"
 	depends on GPIOLIB
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
index 0ebfb6d..cda71fc 100644
--- a/drivers/input/misc/Makefile
+++ b/drivers/input/misc/Makefile
@@ -27,6 +27,7 @@ obj-$(CONFIG_INPUT_DA9052_ONKEY)	+= da9052_onkey.o
 obj-$(CONFIG_INPUT_DA9055_ONKEY)	+= da9055_onkey.o
 obj-$(CONFIG_INPUT_DM355EVM)		+= dm355evm_keys.o
 obj-$(CONFIG_INPUT_GP2A)		+= gp2ap002a00f.o
+obj-$(CONFIG_INPUT_GPIO_BEEPER)		+= gpio-beeper.o
 obj-$(CONFIG_INPUT_GPIO_TILT_POLLED)	+= gpio_tilt_polled.o
 obj-$(CONFIG_HP_SDC_RTC)		+= hp_sdc_rtc.o
 obj-$(CONFIG_INPUT_IMS_PCU)		+= ims-pcu.o
diff --git a/drivers/input/misc/gpio-beeper.c b/drivers/input/misc/gpio-beeper.c
new file mode 100644
index 0000000..832c838
--- /dev/null
+++ b/drivers/input/misc/gpio-beeper.c
@@ -0,0 +1,129 @@
+/*
+ *  Generic GPIO beeper driver
+ *
+ *  Copyright (C) 2013 Alexander Shiyan <shc_work-JGs/UdohzUI@public.gmane.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include <linux/input.h>
+#include <linux/module.h>
+#include <linux/of_gpio.h>
+#include <linux/workqueue.h>
+#include <linux/platform_device.h>
+
+#define BEEPER_MODNAME		"gpio-beeper"
+
+struct gpio_beeper {
+	struct work_struct	work;
+	int			gpio;
+	bool			active_low;
+	bool			beeping;
+};
+
+static void gpio_beeper_toggle(struct gpio_beeper *beep, bool on)
+{
+	gpio_set_value_cansleep(beep->gpio, on ^ beep->active_low);
+}
+
+static void gpio_beeper_work(struct work_struct *work)
+{
+	struct gpio_beeper *beep = container_of(work, struct gpio_beeper, work);
+
+	gpio_beeper_toggle(beep, beep->beeping);
+}
+
+static int gpio_beeper_event(struct input_dev *dev, unsigned int type,
+			     unsigned int code, int value)
+{
+	struct gpio_beeper *beep = input_get_drvdata(dev);
+
+	if (type != EV_SND || code != SND_BELL)
+		return -ENOTSUPP;
+
+	if (value < 0)
+		return -EINVAL;
+
+	beep->beeping = value;
+	/* Schedule work to actually turn the beeper on or off */
+	schedule_work(&beep->work);
+
+	return 0;
+}
+
+static void gpio_beeper_close(struct input_dev *input)
+{
+	struct gpio_beeper *beep = input_get_drvdata(input);
+
+	cancel_work_sync(&beep->work);
+	gpio_beeper_toggle(beep, false);
+}
+
+static int gpio_beeper_probe(struct platform_device *pdev)
+{
+	struct gpio_beeper *beep;
+	enum of_gpio_flags flags;
+	struct input_dev *input;
+	unsigned long gflags;
+	int err;
+
+	beep = devm_kzalloc(&pdev->dev, sizeof(*beep), GFP_KERNEL);
+	if (!beep)
+		return -ENOMEM;
+
+	beep->gpio = of_get_named_gpio_flags(pdev->dev.of_node, "gpios",
+					     0, &flags);
+	if (!gpio_is_valid(beep->gpio))
+		return -EINVAL;
+
+	input = devm_input_allocate_device(&pdev->dev);
+	if (!input)
+		return -ENOMEM;
+
+	INIT_WORK(&beep->work, gpio_beeper_work);
+
+	input->name		= pdev->name;
+	input->phys		= BEEPER_MODNAME "/input0";
+	input->id.bustype	= BUS_HOST;
+	input->id.vendor	= 0x0001;
+	input->id.product	= 0x0001;
+	input->id.version	= 0x0100;
+	input->close		= gpio_beeper_close;
+	input->event		= gpio_beeper_event;
+
+	input_set_capability(input, EV_SND, SND_BELL);
+
+	beep->active_low = flags & OF_GPIO_ACTIVE_LOW;
+	gflags = beep->active_low ? GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW;
+
+	err = devm_gpio_request_one(&pdev->dev, beep->gpio, gflags, pdev->name);
+	if (err)
+		return err;
+
+	input_set_drvdata(input, beep);
+
+	return input_register_device(input);
+}
+
+static struct of_device_id gpio_beeper_of_match[] = {
+	{ .compatible = BEEPER_MODNAME, },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, gpio_beeper_of_match);
+
+static struct platform_driver gpio_beeper_platform_driver = {
+	.driver	= {
+		.name		= BEEPER_MODNAME,
+		.owner		= THIS_MODULE,
+		.of_match_table	= gpio_beeper_of_match,
+	},
+	.probe	= gpio_beeper_probe,
+};
+module_platform_driver(gpio_beeper_platform_driver);
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Alexander Shiyan <shc_work-JGs/UdohzUI@public.gmane.org>");
+MODULE_DESCRIPTION("Generic GPIO beeper driver");
-- 
1.8.1.5

--
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 related

* Re: [PATCH] Input: Add new driver for GPIO beeper
From: Mark Rutland @ 2013-11-12 10:15 UTC (permalink / raw)
  To: Alexander Shiyan
  Cc: linux-input@vger.kernel.org, Dmitry Torokhov,
	devicetree@vger.kernel.org, rob.herring@calxeda.com, Pawel Moll,
	Stephen Warren, Ian Campbell
In-Reply-To: <1384250833-4600-1-git-send-email-shc_work@mail.ru>

On Tue, Nov 12, 2013 at 10:07:13AM +0000, Alexander Shiyan wrote:
> This patch adds a new driver for the beeper controlled via GPIO pin.
> The driver does not depend on the architecture and is positioned as
> a replacement for the specific drivers that are used for this function.
> 
> Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
> ---
>  .../devicetree/bindings/input/gpio-beeper.txt      |  15 +++
>  drivers/input/misc/Kconfig                         |   9 ++
>  drivers/input/misc/Makefile                        |   1 +
>  drivers/input/misc/gpio-beeper.c                   | 129 +++++++++++++++++++++
>  4 files changed, 154 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/input/gpio-beeper.txt
>  create mode 100644 drivers/input/misc/gpio-beeper.c
> 
> diff --git a/Documentation/devicetree/bindings/input/gpio-beeper.txt b/Documentation/devicetree/bindings/input/gpio-beeper.txt
> new file mode 100644
> index 0000000..8081605
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/input/gpio-beeper.txt
> @@ -0,0 +1,15 @@
> +* GPIO beeper device tree bindings
> +
> +Registers a beeper connected to GPIO pin.
> +
> +Required properties:
> +- compatible:	should be "gpio-beeper".
> +- gpios:	From common gpio binding; gpio connection to beeper enable pin.
> +
> +Example:
> +
> +beeper: input@0 {
> +	compatible = "gpio-beeper";
> +	reg = <0>;
> +	gpios = <&gpio3 23 0>;
> +};

What are the reg / unit-address for?

Also, a beeper doesn't strike me as an input device, regardless of how
the kernel sees it internally. I'd expect the node to just be named
"beeper" or something along those lines.

Otherwise I believe this looks sane.

Mark.

^ permalink raw reply

* Re: [PATCH] Input: Add new driver for GPIO beeper
From: Alexander Shiyan @ 2013-11-12 10:47 UTC (permalink / raw)
  To: Mark Rutland
  Cc: linux-input@vger.kernel.org, Dmitry Torokhov,
	devicetree@vger.kernel.org, rob.herring@calxeda.com, Pawel Moll,
	Stephen Warren, Ian Campbell
In-Reply-To: <20131112101544.GD2976@e106331-lin.cambridge.arm.com>

Hello.

> On Tue, Nov 12, 2013 at 10:07:13AM +0000, Alexander Shiyan wrote:
> > This patch adds a new driver for the beeper controlled via GPIO pin.
> > The driver does not depend on the architecture and is positioned as
> > a replacement for the specific drivers that are used for this function.
> > 
> > Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
...
> > diff --git a/Documentation/devicetree/bindings/input/gpio-beeper.txt b/Documentation/devicetree/bindings/input/gpio-beeper.txt
...
> > +Example:
> > +
> > +beeper: input@0 {
> > +	compatible = "gpio-beeper";
> > +	reg = <0>;
> > +	gpios = <&gpio3 23 0>;
> > +};
> 
> What are the reg / unit-address for?

Just an example from "simple-bus" container.

---

^ permalink raw reply

* Re: [PATCH] Input: Add new driver for GPIO beeper
From: Mark Rutland @ 2013-11-12 10:59 UTC (permalink / raw)
  To: Alexander Shiyan
  Cc: linux-input@vger.kernel.org, Dmitry Torokhov,
	devicetree@vger.kernel.org, rob.herring@calxeda.com, Pawel Moll,
	Stephen Warren, Ian Campbell
In-Reply-To: <1384253277.731839001@f27.i.mail.ru>

On Tue, Nov 12, 2013 at 10:47:57AM +0000, Alexander Shiyan wrote:
> Hello.
> 
> > On Tue, Nov 12, 2013 at 10:07:13AM +0000, Alexander Shiyan wrote:
> > > This patch adds a new driver for the beeper controlled via GPIO pin.
> > > The driver does not depend on the architecture and is positioned as
> > > a replacement for the specific drivers that are used for this function.
> > > 
> > > Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
> ...
> > > diff --git a/Documentation/devicetree/bindings/input/gpio-beeper.txt b/Documentation/devicetree/bindings/input/gpio-beeper.txt
> ...
> > > +Example:
> > > +
> > > +beeper: input@0 {
> > > +	compatible = "gpio-beeper";
> > > +	reg = <0>;
> > > +	gpios = <&gpio3 23 0>;
> > > +};
> > 
> > What are the reg / unit-address for?
> 
> Just an example from "simple-bus" container.

If they have no meaning, they should go. They're unnecessary and make
things more confusing.

I'd expect the example to be:

beeper: beeper {
	compatible = "gpio-beeper";
	gpios - <&gpio3 23 0>;
};

And if we have multiple beepers, something like:

beeper0: beeper0 { ... };
beeper1: beeper1 { ... };

Thanks,
Mark.

^ permalink raw reply

* [PATCH RESEND 3/3] input: gpio_keys{_polled}: Replace enable/disable callbacks with regulator API
From: Alexander Shiyan @ 2013-11-12 10:38 UTC (permalink / raw)
  To: linux-input; +Cc: Dmitry Torokhov, Alexander Shiyan
In-Reply-To: <1384252705-18553-1-git-send-email-shc_work@mail.ru>

Typical use to enable/disable is a power switch, so replace these
callbacks to the regulator API. This will allow using devices,
which depends on the regulator, from devicetree.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 .../devicetree/bindings/input/gpio-keys-polled.txt       |  1 +
 drivers/input/keyboard/gpio_keys.c                       | 16 ++++++++++------
 drivers/input/keyboard/gpio_keys_polled.c                | 16 ++++++++++------
 include/linux/gpio_keys.h                                |  2 --
 4 files changed, 21 insertions(+), 14 deletions(-)

diff --git a/Documentation/devicetree/bindings/input/gpio-keys-polled.txt b/Documentation/devicetree/bindings/input/gpio-keys-polled.txt
index 313abef..a210963 100644
--- a/Documentation/devicetree/bindings/input/gpio-keys-polled.txt
+++ b/Documentation/devicetree/bindings/input/gpio-keys-polled.txt
@@ -7,6 +7,7 @@ Required properties:
 Optional properties:
 	- autorepeat: Boolean, Enable auto repeat feature of Linux input
 	  subsystem.
+	- vcc-supply: The regulator to drive the GPIOs.
 
 Each button (key) is represented as a sub-node of "gpio-keys-polled":
 Subnode properties:
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index 50c2746..659c426 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -30,6 +30,7 @@
 #include <linux/of_platform.h>
 #include <linux/of_gpio.h>
 #include <linux/spinlock.h>
+#include <linux/regulator/consumer.h>
 
 struct gpio_button_data {
 	const struct gpio_keys_button *button;
@@ -48,6 +49,7 @@ struct gpio_keys_drvdata {
 	struct input_dev *input;
 	struct mutex disable_lock;
 	struct gpio_button_data data[0];
+	struct regulator *regulator;
 };
 
 /*
@@ -528,11 +530,10 @@ static void gpio_keys_report_state(struct gpio_keys_drvdata *ddata)
 static int gpio_keys_open(struct input_dev *input)
 {
 	struct gpio_keys_drvdata *ddata = input_get_drvdata(input);
-	const struct gpio_keys_platform_data *pdata = ddata->pdata;
 	int error;
 
-	if (pdata->enable) {
-		error = pdata->enable(input->dev.parent);
+	if (!IS_ERR(ddata->regulator)) {
+		error = regulator_enable(ddata->regulator);
 		if (error)
 			return error;
 	}
@@ -546,10 +547,9 @@ static int gpio_keys_open(struct input_dev *input)
 static void gpio_keys_close(struct input_dev *input)
 {
 	struct gpio_keys_drvdata *ddata = input_get_drvdata(input);
-	const struct gpio_keys_platform_data *pdata = ddata->pdata;
 
-	if (pdata->disable)
-		pdata->disable(input->dev.parent);
+	if (!IS_ERR(ddata->regulator))
+		regulator_disable(ddata->regulator);
 }
 
 /*
@@ -683,6 +683,10 @@ static int gpio_keys_probe(struct platform_device *pdev)
 		return -ENOMEM;
 	}
 
+	ddata->regulator = devm_regulator_get(&pdev->dev, "vcc");
+	if (PTR_ERR(ddata->regulator) == -EPROBE_DEFER)
+		return -EPROBE_DEFER;
+
 	ddata->pdata = pdata;
 	ddata->input = input;
 	mutex_init(&ddata->disable_lock);
diff --git a/drivers/input/keyboard/gpio_keys_polled.c b/drivers/input/keyboard/gpio_keys_polled.c
index 0dce49d..955a59d 100644
--- a/drivers/input/keyboard/gpio_keys_polled.c
+++ b/drivers/input/keyboard/gpio_keys_polled.c
@@ -28,6 +28,7 @@
 #include <linux/of.h>
 #include <linux/of_platform.h>
 #include <linux/of_gpio.h>
+#include <linux/regulator/consumer.h>
 
 #define DRV_NAME	"gpio-keys-polled"
 
@@ -43,6 +44,7 @@ struct gpio_keys_polled_dev {
 	struct device *dev;
 	const struct gpio_keys_platform_data *pdata;
 	struct gpio_keys_button_data data[0];
+	struct regulator *regulator;
 };
 
 static void gpio_keys_polled_check_state(struct input_dev *input,
@@ -88,19 +90,17 @@ static void gpio_keys_polled_poll(struct input_polled_dev *dev)
 static void gpio_keys_polled_open(struct input_polled_dev *dev)
 {
 	struct gpio_keys_polled_dev *bdev = dev->private;
-	const struct gpio_keys_platform_data *pdata = bdev->pdata;
 
-	if (pdata->enable)
-		pdata->enable(bdev->dev);
+	if (!IS_ERR(bdev->regulator))
+		WARN_ON(regulator_enable(bdev->regulator));
 }
 
 static void gpio_keys_polled_close(struct input_polled_dev *dev)
 {
 	struct gpio_keys_polled_dev *bdev = dev->private;
-	const struct gpio_keys_platform_data *pdata = bdev->pdata;
 
-	if (pdata->disable)
-		pdata->disable(bdev->dev);
+	if (!IS_ERR(bdev->regulator))
+		regulator_disable(bdev->regulator);
 }
 
 #ifdef CONFIG_OF
@@ -227,6 +227,10 @@ static int gpio_keys_polled_probe(struct platform_device *pdev)
 		return -ENOMEM;
 	}
 
+	bdev->regulator = devm_regulator_get(&pdev->dev, "vcc");
+	if (PTR_ERR(bdev->regulator) == -EPROBE_DEFER)
+		return -EPROBE_DEFER;
+
 	poll_dev = input_allocate_polled_device();
 	if (!poll_dev) {
 		dev_err(dev, "no memory for polled device\n");
diff --git a/include/linux/gpio_keys.h b/include/linux/gpio_keys.h
index a7e977f..05d3bf8 100644
--- a/include/linux/gpio_keys.h
+++ b/include/linux/gpio_keys.h
@@ -23,8 +23,6 @@ struct gpio_keys_platform_data {
 	unsigned int poll_interval;	/* polling interval in msecs -
 					   for polling driver only */
 	unsigned int rep:1;		/* enable input subsystem auto repeat */
-	int (*enable)(struct device *dev);
-	void (*disable)(struct device *dev);
 	const char *name;		/* input device name */
 };
 
-- 
1.8.1.5


^ permalink raw reply related

* [PATCH RESEND 2/3] input: gpio_keys: Convert to devm-* API
From: Alexander Shiyan @ 2013-11-12 10:38 UTC (permalink / raw)
  To: linux-input; +Cc: Dmitry Torokhov, Alexander Shiyan
In-Reply-To: <1384252705-18553-1-git-send-email-shc_work@mail.ru>

Replace existing resource handling in the driver with managed
device resource, this ensures more consistent error values and
simplifies error paths.
kzalloc -> devm_kzalloc
gpio_request_one -> devm_gpio_request_one

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 drivers/input/keyboard/gpio_keys.c | 96 +++++++++++---------------------------
 1 file changed, 28 insertions(+), 68 deletions(-)

diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index 2db1324..50c2746 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -433,7 +433,7 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
 	struct device *dev = &pdev->dev;
 	irq_handler_t isr;
 	unsigned long irqflags;
-	int irq, error;
+	int error;
 
 	bdata->input = input;
 	bdata->button = button;
@@ -441,7 +441,8 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
 
 	if (gpio_is_valid(button->gpio)) {
 
-		error = gpio_request_one(button->gpio, GPIOF_IN, desc);
+		error = devm_gpio_request_one(&pdev->dev, button->gpio,
+					      GPIOF_IN, desc);
 		if (error < 0) {
 			dev_err(dev, "Failed to request GPIO %d, error %d\n",
 				button->gpio, error);
@@ -457,15 +458,13 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
 						button->debounce_interval;
 		}
 
-		irq = gpio_to_irq(button->gpio);
-		if (irq < 0) {
-			error = irq;
+		bdata->irq = gpio_to_irq(button->gpio);
+		if (bdata->irq < 0) {
 			dev_err(dev,
 				"Unable to get irq number for GPIO %d, error %d\n",
-				button->gpio, error);
-			goto fail;
+				button->gpio, bdata->irq);
+			return bdata->irq;
 		}
-		bdata->irq = irq;
 
 		INIT_WORK(&bdata->work, gpio_keys_gpio_work_func);
 		setup_timer(&bdata->timer,
@@ -507,16 +506,10 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
 	if (error < 0) {
 		dev_err(dev, "Unable to claim irq %d; error %d\n",
 			bdata->irq, error);
-		goto fail;
+		return error;
 	}
 
 	return 0;
-
-fail:
-	if (gpio_is_valid(button->gpio))
-		gpio_free(button->gpio);
-
-	return error;
 }
 
 static void gpio_keys_report_state(struct gpio_keys_drvdata *ddata)
@@ -573,28 +566,20 @@ gpio_keys_get_devtree_pdata(struct device *dev)
 	struct device_node *node, *pp;
 	struct gpio_keys_platform_data *pdata;
 	struct gpio_keys_button *button;
-	int error;
-	int nbuttons;
-	int i;
+	int i, nbuttons;
 
 	node = dev->of_node;
-	if (!node) {
-		error = -ENODEV;
-		goto err_out;
-	}
+	if (!node)
+		return ERR_PTR(-ENODEV);
 
 	nbuttons = of_get_child_count(node);
-	if (nbuttons == 0) {
-		error = -ENODEV;
-		goto err_out;
-	}
+	if (nbuttons == 0)
+		return ERR_PTR(-ENODEV);
 
-	pdata = kzalloc(sizeof(*pdata) + nbuttons * (sizeof *button),
-			GFP_KERNEL);
-	if (!pdata) {
-		error = -ENOMEM;
-		goto err_out;
-	}
+	pdata = devm_kzalloc(dev, sizeof(*pdata) + nbuttons * (sizeof *button),
+			     GFP_KERNEL);
+	if (!pdata)
+		return ERR_PTR(-ENOMEM);
 
 	pdata->buttons = (struct gpio_keys_button *)(pdata + 1);
 	pdata->nbuttons = nbuttons;
@@ -614,12 +599,11 @@ gpio_keys_get_devtree_pdata(struct device *dev)
 
 		gpio = of_get_gpio_flags(pp, 0, &flags);
 		if (gpio < 0) {
-			error = gpio;
-			if (error != -EPROBE_DEFER)
+			if (gpio != -EPROBE_DEFER)
 				dev_err(dev,
 					"Failed to get gpio flags, error: %d\n",
-					error);
-			goto err_free_pdata;
+					gpio);
+			return ERR_PTR(gpio);
 		}
 
 		button = &pdata->buttons[i++];
@@ -630,8 +614,7 @@ gpio_keys_get_devtree_pdata(struct device *dev)
 		if (of_property_read_u32(pp, "linux,code", &button->code)) {
 			dev_err(dev, "Button without keycode: 0x%x\n",
 				button->gpio);
-			error = -EINVAL;
-			goto err_free_pdata;
+			return ERR_PTR(-EINVAL);
 		}
 
 		button->desc = of_get_property(pp, "label", NULL);
@@ -646,17 +629,10 @@ gpio_keys_get_devtree_pdata(struct device *dev)
 			button->debounce_interval = 5;
 	}
 
-	if (pdata->nbuttons == 0) {
-		error = -EINVAL;
-		goto err_free_pdata;
-	}
+	if (!pdata->nbuttons)
+		return ERR_PTR(-EINVAL);
 
 	return pdata;
-
-err_free_pdata:
-	kfree(pdata);
-err_out:
-	return ERR_PTR(error);
 }
 
 static struct of_device_id gpio_keys_of_match[] = {
@@ -681,8 +657,6 @@ static void gpio_remove_key(struct gpio_button_data *bdata)
 	if (bdata->timer_debounce)
 		del_timer_sync(&bdata->timer);
 	cancel_work_sync(&bdata->work);
-	if (gpio_is_valid(bdata->button->gpio))
-		gpio_free(bdata->button->gpio);
 }
 
 static int gpio_keys_probe(struct platform_device *pdev)
@@ -700,14 +674,13 @@ static int gpio_keys_probe(struct platform_device *pdev)
 			return PTR_ERR(pdata);
 	}
 
-	ddata = kzalloc(sizeof(struct gpio_keys_drvdata) +
-			pdata->nbuttons * sizeof(struct gpio_button_data),
-			GFP_KERNEL);
-	input = input_allocate_device();
+	ddata = devm_kzalloc(&pdev->dev, sizeof(struct gpio_keys_drvdata) +
+			     pdata->nbuttons * sizeof(struct gpio_button_data),
+			     GFP_KERNEL);
+	input = devm_input_allocate_device(&pdev->dev);
 	if (!ddata || !input) {
 		dev_err(dev, "failed to allocate state\n");
-		error = -ENOMEM;
-		goto fail1;
+		return -ENOMEM;
 	}
 
 	ddata->pdata = pdata;
@@ -768,13 +741,6 @@ static int gpio_keys_probe(struct platform_device *pdev)
 	while (--i >= 0)
 		gpio_remove_key(&ddata->data[i]);
 
- fail1:
-	input_free_device(input);
-	kfree(ddata);
-	/* If we have no platform data, we allocated pdata dynamically. */
-	if (!dev_get_platdata(&pdev->dev))
-		kfree(pdata);
-
 	return error;
 }
 
@@ -793,12 +759,6 @@ static int gpio_keys_remove(struct platform_device *pdev)
 
 	input_unregister_device(input);
 
-	/* If we have no platform data, we allocated pdata dynamically. */
-	if (!dev_get_platdata(&pdev->dev))
-		kfree(ddata->pdata);
-
-	kfree(ddata);
-
 	return 0;
 }
 
-- 
1.8.1.5


^ permalink raw reply related

* [PATCH RESEND 1/3] input: gpio_keys_polled: Convert to devm-* API
From: Alexander Shiyan @ 2013-11-12 10:38 UTC (permalink / raw)
  To: linux-input; +Cc: Dmitry Torokhov, Alexander Shiyan

Replace existing resource handling in the driver with managed
device resource, this ensures more consistent error values and
simplifies error paths.
kzalloc -> devm_kzalloc
gpio_request_one -> devm_gpio_request_one

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 drivers/input/keyboard/gpio_keys_polled.c | 87 ++++++++-----------------------
 1 file changed, 23 insertions(+), 64 deletions(-)

diff --git a/drivers/input/keyboard/gpio_keys_polled.c b/drivers/input/keyboard/gpio_keys_polled.c
index 4e42819..0dce49d 100644
--- a/drivers/input/keyboard/gpio_keys_polled.c
+++ b/drivers/input/keyboard/gpio_keys_polled.c
@@ -109,9 +109,7 @@ static struct gpio_keys_platform_data *gpio_keys_polled_get_devtree_pdata(struct
 	struct device_node *node, *pp;
 	struct gpio_keys_platform_data *pdata;
 	struct gpio_keys_button *button;
-	int error;
-	int nbuttons;
-	int i;
+	int i, nbuttons;
 
 	node = dev->of_node;
 	if (!node)
@@ -121,12 +119,10 @@ static struct gpio_keys_platform_data *gpio_keys_polled_get_devtree_pdata(struct
 	if (nbuttons == 0)
 		return NULL;
 
-	pdata = kzalloc(sizeof(*pdata) + nbuttons * (sizeof *button),
-			GFP_KERNEL);
-	if (!pdata) {
-		error = -ENOMEM;
-		goto err_out;
-	}
+	pdata = devm_kzalloc(dev, sizeof(*pdata) + nbuttons * (sizeof *button),
+			     GFP_KERNEL);
+	if (!pdata)
+		return ERR_PTR(-ENOMEM);
 
 	pdata->buttons = (struct gpio_keys_button *)(pdata + 1);
 	pdata->nbuttons = nbuttons;
@@ -147,12 +143,11 @@ static struct gpio_keys_platform_data *gpio_keys_polled_get_devtree_pdata(struct
 
 		gpio = of_get_gpio_flags(pp, 0, &flags);
 		if (gpio < 0) {
-			error = gpio;
-			if (error != -EPROBE_DEFER)
+			if (gpio != -EPROBE_DEFER)
 				dev_err(dev,
 					"Failed to get gpio flags, error: %d\n",
-					error);
-			goto err_free_pdata;
+					gpio);
+			return ERR_PTR(gpio);
 		}
 
 		button = &pdata->buttons[i++];
@@ -163,8 +158,7 @@ static struct gpio_keys_platform_data *gpio_keys_polled_get_devtree_pdata(struct
 		if (of_property_read_u32(pp, "linux,code", &button->code)) {
 			dev_err(dev, "Button without keycode: 0x%x\n",
 				button->gpio);
-			error = -EINVAL;
-			goto err_free_pdata;
+			return ERR_PTR(-EINVAL);
 		}
 
 		button->desc = of_get_property(pp, "label", NULL);
@@ -179,17 +173,10 @@ static struct gpio_keys_platform_data *gpio_keys_polled_get_devtree_pdata(struct
 			button->debounce_interval = 5;
 	}
 
-	if (pdata->nbuttons == 0) {
-		error = -EINVAL;
-		goto err_free_pdata;
-	}
+	if (!pdata->nbuttons)
+		return ERR_PTR(-EINVAL);
 
 	return pdata;
-
-err_free_pdata:
-	kfree(pdata);
-err_out:
-	return ERR_PTR(error);
 }
 
 static struct of_device_id gpio_keys_polled_of_match[] = {
@@ -229,24 +216,21 @@ static int gpio_keys_polled_probe(struct platform_device *pdev)
 
 	if (!pdata->poll_interval) {
 		dev_err(dev, "missing poll_interval value\n");
-		error = -EINVAL;
-		goto err_free_pdata;
+		return -EINVAL;
 	}
 
-	bdev = kzalloc(sizeof(struct gpio_keys_polled_dev) +
-		       pdata->nbuttons * sizeof(struct gpio_keys_button_data),
-		       GFP_KERNEL);
+	bdev = devm_kzalloc(&pdev->dev, sizeof(struct gpio_keys_polled_dev) +
+		pdata->nbuttons * sizeof(struct gpio_keys_button_data),
+		GFP_KERNEL);
 	if (!bdev) {
 		dev_err(dev, "no memory for private data\n");
-		error = -ENOMEM;
-		goto err_free_pdata;
+		return -ENOMEM;
 	}
 
 	poll_dev = input_allocate_polled_device();
 	if (!poll_dev) {
 		dev_err(dev, "no memory for polled device\n");
-		error = -ENOMEM;
-		goto err_free_bdev;
+		return -ENOMEM;
 	}
 
 	poll_dev->private = bdev;
@@ -279,15 +263,15 @@ static int gpio_keys_polled_probe(struct platform_device *pdev)
 		if (button->wakeup) {
 			dev_err(dev, DRV_NAME " does not support wakeup\n");
 			error = -EINVAL;
-			goto err_free_gpio;
+			goto err_out;
 		}
 
-		error = gpio_request_one(gpio, GPIOF_IN,
-					 button->desc ?: DRV_NAME);
+		error = devm_gpio_request_one(&pdev->dev, gpio, GPIOF_IN,
+					      button->desc ? : DRV_NAME);
 		if (error) {
 			dev_err(dev, "unable to claim gpio %u, err=%d\n",
 				gpio, error);
-			goto err_free_gpio;
+			goto err_out;
 		}
 
 		bdata->can_sleep = gpio_cansleep(gpio);
@@ -307,7 +291,7 @@ static int gpio_keys_polled_probe(struct platform_device *pdev)
 	if (error) {
 		dev_err(dev, "unable to register polled device, err=%d\n",
 			error);
-		goto err_free_gpio;
+		goto err_out;
 	}
 
 	/* report initial state of the buttons */
@@ -317,45 +301,20 @@ static int gpio_keys_polled_probe(struct platform_device *pdev)
 
 	return 0;
 
-err_free_gpio:
-	while (--i >= 0)
-		gpio_free(pdata->buttons[i].gpio);
-
+err_out:
 	input_free_polled_device(poll_dev);
 
-err_free_bdev:
-	kfree(bdev);
-
-err_free_pdata:
-	/* If we have no platform_data, we allocated pdata dynamically.  */
-	if (!dev_get_platdata(&pdev->dev))
-		kfree(pdata);
-
 	return error;
 }
 
 static int gpio_keys_polled_remove(struct platform_device *pdev)
 {
 	struct gpio_keys_polled_dev *bdev = platform_get_drvdata(pdev);
-	const struct gpio_keys_platform_data *pdata = bdev->pdata;
-	int i;
 
 	input_unregister_polled_device(bdev->poll_dev);
 
-	for (i = 0; i < pdata->nbuttons; i++)
-		gpio_free(pdata->buttons[i].gpio);
-
 	input_free_polled_device(bdev->poll_dev);
 
-	/*
-	 * If we had no platform_data, we allocated pdata dynamically and
-	 * must free it here.
-	 */
-	if (!dev_get_platdata(&pdev->dev))
-		kfree(pdata);
-
-	kfree(bdev);
-
 	return 0;
 }
 
-- 
1.8.1.5


^ permalink raw reply related

* Re: [PATCH v3] add sur40 driver for Samsung SUR40 (aka MS Surface 2.0/Pixelsense)
From: Florian Echtler @ 2013-11-12 13:35 UTC (permalink / raw)
  To: Henrik Rydberg, Dmitry Torokhov
  Cc: linux-input, benjamin.tissoires, dh.herrmann
In-Reply-To: <5280B0FE.5080203@euromail.se>

[-- Attachment #1: Type: text/plain, Size: 542 bytes --]

On 11.11.2013 11:27, Henrik Rydberg wrote:
>  >> 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?
> No need to resubmit, a confirmation will do nicely. Thanks!
> Henrik

I've tested Dmitry's additional patch, confirmed to work. Just for the
record:

Tested-by: Florian Echtler <floe@butterbrot.org>

BR, Florian
-- 
SENT FROM MY DEC VT50 TERMINAL


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply

* [PATCH 4/5 v3] input: tc3589x-keypad: support probing from device tree
From: Linus Walleij @ 2013-11-12 15:31 UTC (permalink / raw)
  To: devicetree, Dmitry Torokhov, linux-input
  Cc: linux-kernel, linux-arm-kernel, Mark Rutland, Linus Walleij

Implement device tree probing for the tc3589x keypad driver.
This is modeled on the STMPE keypad driver and tested on the
Ux500 TVK1281618 UIB.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
ChangeLog v2->v3:
- Use two local u32 variables to avoid weirdness in u8 casting
  of the resulting values to the pointers.
ChangeLog v1->v2:
- Fix rows/columns binding to read two u32's insead of two
  u8 /bits/ as noted by Mark Rutland.
---
 drivers/input/keyboard/tc3589x-keypad.c | 66 ++++++++++++++++++++++++++++++++-
 1 file changed, 64 insertions(+), 2 deletions(-)

diff --git a/drivers/input/keyboard/tc3589x-keypad.c b/drivers/input/keyboard/tc3589x-keypad.c
index 208de7cbb7fa..7f36e7addb86 100644
--- a/drivers/input/keyboard/tc3589x-keypad.c
+++ b/drivers/input/keyboard/tc3589x-keypad.c
@@ -297,6 +297,65 @@ static void tc3589x_keypad_close(struct input_dev *input)
 	tc3589x_keypad_disable(keypad);
 }
 
+#ifdef CONFIG_OF
+static const struct tc3589x_keypad_platform_data *
+tc3589x_keypad_of_probe(struct device *dev)
+{
+	struct device_node *np = dev->of_node;
+	struct tc3589x_keypad_platform_data *plat;
+	u32 cols, rows;
+	u32 debounce_ms;
+	int proplen;
+
+	if (!np)
+		return ERR_PTR(-ENODEV);
+
+	plat = devm_kzalloc(dev, sizeof(*plat), GFP_KERNEL);
+	if (!plat)
+		return ERR_PTR(-ENOMEM);
+
+	of_property_read_u32(np, "keypad,num-columns", &cols);
+	of_property_read_u32(np, "keypad,num-rows", &rows);
+	plat->kcol = (u8) cols;
+	plat->krow = (u8) rows;
+	if (!plat->krow || !plat->kcol ||
+	     plat->krow > TC_KPD_ROWS || plat->kcol > TC_KPD_COLUMNS) {
+		dev_err(dev,
+			"keypad columns/rows not properly specified (%ux%u)\n",
+			plat->kcol, plat->krow);
+		return ERR_PTR(-EINVAL);
+	}
+
+	if (!of_get_property(np, "linux,keymap", &proplen)) {
+		dev_err(dev, "property linux,keymap not found\n");
+		return ERR_PTR(-ENOENT);
+	}
+
+	plat->no_autorepeat = of_property_read_bool(np, "linux,no-autorepeat");
+	plat->enable_wakeup = of_property_read_bool(np, "linux,wakeup");
+
+	/* The custom delay format is ms/16 */
+	of_property_read_u32(np, "debounce-delay-ms", &debounce_ms);
+	if (debounce_ms)
+		plat->debounce_period = debounce_ms * 16;
+	else
+		plat->debounce_period = TC_KPD_DEBOUNCE_PERIOD;
+
+	plat->settle_time = TC_KPD_SETTLE_TIME;
+	/* FIXME: should be property of the IRQ resource? */
+	plat->irqtype = IRQF_TRIGGER_FALLING;
+
+	return plat;
+}
+#else
+static inline const struct tc3589x_keypad_platform_data *
+tc3589x_keypad_of_probe(struct device *dev)
+{
+	return ERR_PTR(-ENODEV);
+}
+#endif
+
+
 static int tc3589x_keypad_probe(struct platform_device *pdev)
 {
 	struct tc3589x *tc3589x = dev_get_drvdata(pdev->dev.parent);
@@ -307,8 +366,11 @@ static int tc3589x_keypad_probe(struct platform_device *pdev)
 
 	plat = tc3589x->pdata->keypad;
 	if (!plat) {
-		dev_err(&pdev->dev, "invalid keypad platform data\n");
-		return -EINVAL;
+		plat = tc3589x_keypad_of_probe(&pdev->dev);
+		if (IS_ERR(plat)) {
+			dev_err(&pdev->dev, "invalid keypad platform data\n");
+			return PTR_ERR(plat);
+		}
 	}
 
 	irq = platform_get_irq(pdev, 0);
-- 
1.8.3.1


^ permalink raw reply related

* [PATCH] input: ti_am33x_tsc: make the documentation for the ti,wire-config parameter clear
From: Sebastian Andrzej Siewior @ 2013-11-12 16:22 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: linux-input, Felipe Balbi, Grant Likely, Rob Herring, devicetree,
	Sebastian Andrzej Siewior

The document says "first four bits" and means the upper nibble. Most
people would probably agree that the first four bits are bits 0…3 and
that is the lower nibble.
This patch updates the documentation so it is clear what is meant.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 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..0fcd430 100644
--- a/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt
+++ b/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt
@@ -17,8 +17,8 @@
 				remaining 4 can be used by the ADC.
 	ti,wire-config: Different boards could have a different order for
 			connecting wires on touchscreen. We need to provide an
-			8 bit number where in the 1st four bits represent the
-			analog lines and the next 4 bits represent positive/
+			8 bit number where the upper nibble represent the
+			analog lines and the lower nibble represent positive/
 			negative terminal on that input line. Notations to
 			represent the input lines and terminals resoectively
 			is as follows:
-- 
1.8.4.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] input: ti_am33x_tsc: make the documentation for the ti,wire-config parameter clear
From: Kumar Gala @ 2013-11-12 16:24 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: Dmitry Torokhov, linux-input, Felipe Balbi, Grant Likely,
	Rob Herring, devicetree
In-Reply-To: <1384273323-15329-1-git-send-email-bigeasy@linutronix.de>


On Nov 12, 2013, at 10:22 AM, Sebastian Andrzej Siewior <bigeasy@linutronix.de> wrote:

> The document says "first four bits" and means the upper nibble. Most
> people would probably agree that the first four bits are bits 0…3 and
> that is the lower nibble.
> This patch updates the documentation so it is clear what is meant.
> 
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
> Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt | 4 ++--
> 1 file changed, 2 insertions(+), 2 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..0fcd430 100644
> --- a/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt
> +++ b/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt
> @@ -17,8 +17,8 @@
> 				remaining 4 can be used by the ADC.
> 	ti,wire-config: Different boards could have a different order for
> 			connecting wires on touchscreen. We need to provide an
> -			8 bit number where in the 1st four bits represent the
> -			analog lines and the next 4 bits represent positive/
> +			8 bit number where the upper nibble represent the
> +			analog lines and the lower nibble represent positive/
> 			negative terminal on that input line. Notations to
> 			represent the input lines and terminals resoectively
> 			is as follows:

Is it possible to give an example because that might help with the confusion.

- k

> -- 
> 1.8.4.2
> 
> --
> To unsubscribe from this list: send the line "unsubscribe devicetree" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
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: ti_am33x_tsc: make the documentation for the ti,wire-config parameter clear
From: Andrey Moiseev @ 2013-11-12 16:35 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: Dmitry Torokhov, linux-input-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1384273323-15329-1-git-send-email-bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>

Maybe "most/least significant" is more clear. Everyone got used to
little-endian, anyway.

On Tue, Nov 12, 2013 at 8:22 PM, Sebastian Andrzej Siewior
<bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org> wrote:
> The document says "first four bits" and means the upper nibble. Most
> people would probably agree that the first four bits are bits 0…3 and
> that is the lower nibble.
> This patch updates the documentation so it is clear what is meant.
>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
> ---
>  Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt | 4 ++--
>  1 file changed, 2 insertions(+), 2 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..0fcd430 100644
> --- a/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt
> +++ b/Documentation/devicetree/bindings/input/touchscreen/ti-tsc-adc.txt
> @@ -17,8 +17,8 @@
>                                 remaining 4 can be used by the ADC.
>         ti,wire-config: Different boards could have a different order for
>                         connecting wires on touchscreen. We need to provide an
> -                       8 bit number where in the 1st four bits represent the
> -                       analog lines and the next 4 bits represent positive/
> +                       8 bit number where the upper nibble represent the
> +                       analog lines and the lower nibble represent positive/
>                         negative terminal on that input line. Notations to
>                         represent the input lines and terminals resoectively
>                         is as follows:
> --
> 1.8.4.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-input" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
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

* Fwd: [PATCH v2 2/2] Input: wacom - add support for three new Intuos devices
From: Ping Cheng @ 2013-11-12 17:29 UTC (permalink / raw)
  To: linux-input
In-Reply-To: <CAF8JNhJb8oT9ZKD+QL1sYpJWGC9=JMMogxnK5cToWD9KK9MVdg@mail.gmail.com>

On Monday, November 11, 2013, Chris Bagwell wrote:
>
> On Fri, Nov 8, 2013 at 1:13 PM, Ping Cheng <pinglinux@gmail.com> wrote:
> > On Thu, Nov 7, 2013 at 6:25 PM, Chris Bagwell <chris@cnpbagwell.com> wrote:
> >> On Thu, Oct 10, 2013 at 4:17 PM, Ping Cheng <pinglinux@gmail.com> wrote:
> >>> This series of models added a hardware switch to turn touch
> >>> data on/off. To report the state of the switch, SW_TOUCH
> >>> is added in include/uapi/linux/input.h.
> >>
> >> So I guess the big point is this patch can't go in until a SW_TOUCH
> >> goes in first.
> >>
> >> Since the 1/2 or this 2/2 series has already gone in, would you mind
> >> breaking this
> >> remaining patch up into the basic support for new Intuos (without the
> >> SW_TOUCH) and
> >> then a separate patch to add SW_TOUCH support on top of that?  Then
> >> the basic support can go in ASAP.
> >
> > Chris, thank you for pushing the process forward.
> >
> > SW_TOUCH is truly part of the basic support for the new series. The
> > main new feature of this series is touch switch. If we do not report
> > its status in the same patch, it means we are not reporting a complete
> > set of data.
> >
> >> I only have comments on this patch related to the SW_TOUCH part... things like:
> >>
> >>  * should the SW_TOUCH be reported against the wireless interface or
> >> the touch interface... userland apps may have an opinion on which is
> >> best.
> >
> > We can not report SW_TOUCH status from touch interface since once
> > touch is turned off (by end users), no events can go on touch
> > interface. Plus, we do not know when a user may switch touch on.
> > That's why SW_TOUCH are regularly updated and reported through
> > wireless interface for wireless connection.
>
> I think I made wrong assumption of HW.  Does HW stop sending touch
> events when switch is toggled or is switch an indication to ignore
> touch events in either driver or userland?

Yes, tablet stops sending touch events when user turns touch off by
the hardware. It's a hardware switch, as stated in commit comments,
which is controlled by end users. Drivers can not do much about it
except reporting its status.

> I was thinking it was for later case.  When userland has to ignore, it
> is not easy to know switch value on /dev/input/foo really means what
> to do related to events on /dev/input/bar.  So thats were my thoughts
> were about moving it to input that needs to be disabled.  In former
> case, it just status so not so important to decide which input to
> report over.

It is the former case.

> >>  * the part with updating SW_TOUCH from unrelated interfaces could use
> >
> > It is not unrelated interface. It is how it works.
> >
> >> a review by someone like Dmitry for possible issues.
>
> I meant any issues with parsing data in context of /dev/input/foo but
> doing an input_sync(/dev/input/bar) in that same context.  Probably no
> issue but I don't know kernel internals to be sure.

Anyway, I'll split the patch for you. Thank you for reviewing it.

Ping

> >>  * It would be better if you didn't add that EV_SW for HW that will
> >> not report the SW_TOUCH.
> >
> > I can consider that in the next version.
> >
> >> If you break the patch into 2, you can add my line for the basic
> >
> > I'd like to know your opinion about my comments before updating the
> > patch. IMO, using two patches to process one set of raw data
> > complicates the support.
>
> Assuming SW_TOUCH for this device is only for status reporting, I
> don't have much opinion.  If it because a request to disable touch
> events in userland then I think it should move to device its related
> to.
>
> Chris
>
> >
> > Ping
> >
> >> support without SW_TOUCH:
> >>
> >> Reviewed-by: Chris Bagwell <chris@cnpbagwell.com>
> >>
> >> Chris
> >>
> >>>
> >>> The driver is also updated to process wireless devices that do
> >>> not support touch interface.
> >>>
> >>> Tested-by: Jason Gerecke <killertofu@gmail.com>
> >>> Signed-off-by: Ping Cheng <pingc@wacom.com>
> >>> ---
> >>> v2: Change SW_TOUCH_ENABLED to SW_TOUCH and clear BTN_TOUCH bit
> >>> for button only interfaces as suggested by Peter Hutterer.
> >>> ---
> >>>  drivers/input/tablet/wacom_sys.c | 16 +++++++-
> >>>  drivers/input/tablet/wacom_wac.c | 87 ++++++++++++++++++++++++++++++++--------
> >>>  drivers/input/tablet/wacom_wac.h |  7 ++++
> >>>  include/uapi/linux/input.h       |  1 +
> >>>  4 files changed, 93 insertions(+), 18 deletions(-)
> >>>
> >>> diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
> >>> index 7bdb5e9..efd9729 100644
> >>> --- a/drivers/input/tablet/wacom_sys.c
> >>> +++ b/drivers/input/tablet/wacom_sys.c
> >>> @@ -1190,12 +1190,15 @@ static void wacom_wireless_work(struct work_struct *work)
> >>>                 wacom_wac1->features.device_type = BTN_TOOL_PEN;
> >>>                 snprintf(wacom_wac1->name, WACOM_NAME_MAX, "%s (WL) Pen",
> >>>                          wacom_wac1->features.name);
> >>> +               wacom_wac1->shared->touch_max = wacom_wac1->features.touch_max;
> >>> +               wacom_wac1->shared->type = wacom_wac1->features.type;
> >>>                 error = wacom_register_input(wacom1);
> >>>                 if (error)
> >>>                         goto fail;
> >>>
> >>>                 /* Touch interface */
> >>> -               if (wacom_wac1->features.touch_max) {
> >>> +               if (wacom_wac1->features.touch_max ||
> >>> +                   wacom_wac1->features.type == INTUOS_HT) {
> >>>                         wacom_wac2->features =
> >>>                                 *((struct wacom_features *)id->driver_info);
> >>>                         wacom_wac2->features.pktlen = WACOM_PKGLEN_BBTOUCH3;
> >>> @@ -1210,6 +1213,10 @@ static void wacom_wireless_work(struct work_struct *work)
> >>>                         error = wacom_register_input(wacom2);
> >>>                         if (error)
> >>>                                 goto fail;
> >>> +
> >>> +                       if (wacom_wac1->features.type == INTUOS_HT &&
> >>> +                           wacom_wac1->features.touch_max)
> >>> +                               wacom_wac->shared->touch_input = wacom_wac2->input;
> >>>                 }
> >>>
> >>>                 error = wacom_initialize_battery(wacom);
> >>> @@ -1318,7 +1325,7 @@ static int wac

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox