Linux Input/HID development
 help / color / mirror / Atom feed
* Support for touch controller ILI2511: Integrate into ili210x or new driver ?
From: Stefan Roese @ 2018-02-02 16:03 UTC (permalink / raw)
  To: linux-input; +Cc: Dmitry Torokhov, Henrik Rydberg, Olivier Sobrie

Hi,

I'm currently working on supporting the Ilitek ILI2511 touch controller
in mainline. The 2 choices I have are:

a) Try to integrate the ILI2511 support into the existing ili210x
    driver

or

b) Create a new driver for ILI2511 which might be suitable for other /
    future Ilitek controller

Looking at alternative a), ili210x seems to be pretty unused and in not
real good shape (only supporting platform-data, not using devm_ calls,
not using threaded interrupts etc...). I could enhance this driver but
my main concern here is, that I have no chance to test this driver on
the currently supported chips.

Alternative b) sounds more promising to me. Especially since ILI2511
supports touch protocol v3.x (Ilitek naming), which is quite different
from the currently supported protocol.

What's your recommendation here? Is it okay to go with adding a new
driver, perhaps named something like ili2xxx?

Thanks,
Stefan

^ permalink raw reply

* Re: Trackpoint not found when loading psmouse before rmi_smbus
From: Damjan Georgievski @ 2018-02-02  9:37 UTC (permalink / raw)
  To: linux-input@vger.kernel.org
In-Reply-To: <CAKdAkRT4ktdJwFTQCDRA2GWir4hXuE34kfii6mvXauh1pK-X3g@mail.gmail.com>

On 1 February 2018 at 23:54, Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote:
> Hi Damjan,
>
> On Tue, Jan 30, 2018 at 4:46 AM, Damjan Georgievski <gdamjan@gmail.com> wrote:
>> This is tested on X1 Carbon (gen 5)
>> pnp id: LEN0072
>> kernel 4.15.0
>>
>> Since by default psmouse complains about
>> "synaptics: Your touchpad (PNP: LEN0072 PNP0f13) says it can support a
>> different bus....",
>> I've patched the kernel to add the pnp id to smbus_pnp_ids in
>> drivers/input/mouse/synaptics.c [1],
>> and the trackpad seems to work at least a  bit smoother (it could be
>> placebo though).
>>
>> But, with the default setup, and rmi_smbus and psmouse are both
>> compiled as modules, the trackpoint device never appears in dmesg.
>> I can make it appear if I put rmi_smbus in /etc/modules-load.d/ so it
>> loads before psmouse, or if I unload psmouse and load it again.
>>
>> I can even reproduce it by unloading both rmi_smbus and psmouse, and
>> then only loading psmouse
>> (psmouse seems to load rmi_smbus and switch the trackpad to it but the
>> trackpoint is lost)
>
> Please try with these patches:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git/commit/?h=next&id=a1ab69021a584d952e6548a44b93760547b1b6b5
> https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git/commit/?h=next&id=6abe534f0776d2437c8302f58d8eb5abd483e926
> https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git/commit/?h=next&id=9f87b9fc369f7719ccdac5077855c5c03b625571


Thanks Dmitry,
applied the patches[1] on 4.15.0 and it works fine now.
maybe it's time to add the pnp id to smbus_pnp_ids now [2]?

[   10.279278] psmouse serio1: synaptics: queried max coordinates: x
[..5676], y [..4760]
[   10.311351] psmouse serio1: synaptics: queried min coordinates: x
[1266..], y [1094..]
[   10.311359] psmouse serio1: synaptics: Trying to set up SMBus access
[   10.339907] rmi4_smbus 6-002c: registering SMbus-connected sensor
[   10.405488] rmi4_f01 rmi4-00.fn01: found RMI device, manufacturer:
Synaptics, product: TM3289-002, fw id: 2492434
[   10.422386] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[   10.422389] Bluetooth: BNEP filters: protocol multicast
[   10.422396] Bluetooth: BNEP socket layer initialized
[   10.469583] input: Synaptics TM3289-002 as /devices/rmi4-00/input/input18
[   10.475688] serio: RMI4 PS/2 pass-through port at rmi4-00.fn03
[   10.477518] mousedev: PS/2 mouse device common for all mice
[   10.581975] psmouse serio2: trackpoint: ALPS TrackPoint firmware:
0x01, buttons: 3/3
[   10.619066] input: TPPS/2 ALPS TrackPoint as
/devices/rmi4-00/rmi4-00.fn03/serio2/input/input19

[1]
for reference the branch I built:
https://github.com/gdamjan/linux/commits/linux-4.15.x-thinkpad

[2]
synaptics: X1 Carbon (5th gen) supports rmi4_smbus
https://github.com/gdamjan/linux/commit/fa6b3c893bea6d017b575438a4b367f2a7fc7717

-- 
damjan

^ permalink raw reply

* Re: Trackpoint not found when loading psmouse before rmi_smbus
From: Dmitry Torokhov @ 2018-02-01 22:54 UTC (permalink / raw)
  To: Damjan Georgievski; +Cc: linux-input@vger.kernel.org
In-Reply-To: <CAEk1YH68KecWAyeKTu_paL3CLtxLuw1hrH7Z4B_FqiWQML666Q@mail.gmail.com>

Hi Damjan,

On Tue, Jan 30, 2018 at 4:46 AM, Damjan Georgievski <gdamjan@gmail.com> wrote:
> This is tested on X1 Carbon (gen 5)
> pnp id: LEN0072
> kernel 4.15.0
>
> Since by default psmouse complains about
> "synaptics: Your touchpad (PNP: LEN0072 PNP0f13) says it can support a
> different bus....",
> I've patched the kernel to add the pnp id to smbus_pnp_ids in
> drivers/input/mouse/synaptics.c [1],
> and the trackpad seems to work at least a  bit smoother (it could be
> placebo though).
>
> But, with the default setup, and rmi_smbus and psmouse are both
> compiled as modules, the trackpoint device never appears in dmesg.
> I can make it appear if I put rmi_smbus in /etc/modules-load.d/ so it
> loads before psmouse, or if I unload psmouse and load it again.
>
> I can even reproduce it by unloading both rmi_smbus and psmouse, and
> then only loading psmouse
> (psmouse seems to load rmi_smbus and switch the trackpad to it but the
> trackpoint is lost)

Please try with these patches:

https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git/commit/?h=next&id=a1ab69021a584d952e6548a44b93760547b1b6b5
https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git/commit/?h=next&id=6abe534f0776d2437c8302f58d8eb5abd483e926
https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git/commit/?h=next&id=9f87b9fc369f7719ccdac5077855c5c03b625571

Thanks.

-- 
Dmitry

^ permalink raw reply

* RE: Dell docking station & Dell Embedded Controller & PS/2 devices
From: Mario.Limonciello @ 2018-02-01 21:23 UTC (permalink / raw)
  To: dmitry.torokhov; +Cc: pali.rohar, linux-input, linux-kernel
In-Reply-To: <CAKdAkRS_TjTi-VxGg59+aw8wQZxrx8YBAF+m9MdknYNdKGyrvQ@mail.gmail.com>

> -----Original Message-----
> From: Dmitry Torokhov [mailto:dmitry.torokhov@gmail.com]
> Sent: Thursday, February 1, 2018 3:14 PM
> To: Limonciello, Mario <Mario_Limonciello@Dell.com>
> Cc: Pali Rohár <pali.rohar@gmail.com>; linux-input@vger.kernel.org; lkml <linux-
> kernel@vger.kernel.org>
> Subject: Re: Dell docking station & Dell Embedded Controller & PS/2 devices
> 
> On Thu, Feb 1, 2018 at 11:35 AM,  <Mario.Limonciello@dell.com> wrote:
> >
> >
> >> -----Original Message-----
> >> From: Dmitry Torokhov [mailto:dmitry.torokhov@gmail.com]
> >> Sent: Thursday, February 1, 2018 1:30 PM
> >> To: Pali Rohár <pali.rohar@gmail.com>
> >> Cc: Limonciello, Mario <Mario_Limonciello@Dell.com>; linux-
> >> input@vger.kernel.org; linux-kernel@vger.kernel.org
> >> Subject: Re: Dell docking station & Dell Embedded Controller & PS/2 devices
> >>
> >> Hi Pali,
> >>
> >> On Wed, Jan 24, 2018 at 11:41:21AM +0100, Pali Rohár wrote:
> >> > Hi Dmitry!
> >> >
> >> > I'm observing a problem with internal touchpad (handled by psmouse.ko)
> >> > on Dell laptops connected to Dell E docking station. When I connect
> >> > external PS/2 keyboard to docking station then internal laptop touchpad
> >> > switch from multitouch absolute mode to relative bare PS/2 mode.
> >> >
> >> > And because ALPS driver in psmouse.ko is capable to process interleaved
> >> > bare 3-byte PS/2 packets with 6-byte ALPS packets (which handles
> >> > trackstick data on some ALPS models), ALPS driver does not show any
> >> > message about this "downgrade" from multitouch to bare mode. And
> >> > continue working in bare mode.
> >> >
> >> > When I rmmod psmouse and modprobe it again, then touchpad switch back to
> >> > multitouch mode.
> >> >
> >> > Mario told me that Dell Embedded Controller, which handle internal
> >> > keyboard, internal touchpad and external PS/2 keyboard, automatically
> >> > send RESET command to *all* those devices when external PS/2 keyboard is
> >> > connected. Therefore this is reason why touchpad downgrade to to bare
> >> > mode. And according to Mario, host system should issue vendor specific
> >> > PS/2 commands to re-initialize all PS/2 devices when this situation
> >> > happen. Mario also told me that Windows is doing this action.
> >>
> >> Yeah, I remember fun with Inspiron 8100 - when you dock it it woudl
> >> silently switch Synaptics touchpad into standard mode and it would not
> >> come back as Synaptics until you disconnect. And there was no
> >> notification to the kernel as far as I could tell.
> >>
> >> It could be that we need to monitor dock events and then kick reconnect
> >> of serio port, either from userspace via udev (I think that would be
> >> preferred), or in kernel.
> >>
> >> >
> >> > Every time when I connect external PS/2 keyboard to dock I see this
> >> > message in dmesg:
> >> >
> >> > Spurious ACK... Some program might be trying to access hardware directly.
> >> >
> >> > I see it also every time when I dock laptop into docking station (to
> >> > which is keyboard already connected). And it happens also when I connect
> >> > external PS/2 mouse to dock.
> >> >
> >> > Dmitry, how to handle this situation to re-initialize psmouse.ko when
> >> > external PS/2 device is connected to Dell E docking station? According
> >> > to Mario, this is how Dell Embedded Controller is designed and suppose
> >> > how OS should work with it.
> >> >
> >> > Manually rmmoding and modprobing for every docking/undocking laptop is
> >> > not ideal solution.
> >> >
> >> > Could it be possible to use that Spurious ATKBD_RET_ACK from atkbd.c be
> >> > handled on Dell systems (probably via DMI) as an event to reset and
> >> > reinitialize all PS/2 devices?
> >>
> >> So we need to figure out what exactly we are getting from the docking
> >> station in this case. We do try to handle the new device 0xaa 0x00
> >> announcements:
> >
> > Docking station itself won't have sent any events.  The PS2 ports in it
> > are electrically wired to the external PS2 pins in the docking adapter on
> > the system.
> >
> > System EC is what will be sending any PS2 events.
> 
> OK, it does not matter from the input layer POW, if they are PS/2
> events they should be coming from i8042.
> 
> >
> >>
> >>       /* Check if this is a new device announcement (0xAA 0x00) */
> >>       if (unlikely(psmouse->packet[0] == PSMOUSE_RET_BAT && psmouse-
> >> >pktcnt <= 2)) {
> >>               if (psmouse->pktcnt == 1) {
> >>                       psmouse->last = jiffies;
> >>                       goto out;
> >>               }
> >>
> >>               if (psmouse->packet[1] == PSMOUSE_RET_ID ||
> >>                   (psmouse->protocol->type == PSMOUSE_HGPK &&
> >>                    psmouse->packet[1] == PSMOUSE_RET_BAT)) {
> >>                       __psmouse_set_state(psmouse, PSMOUSE_IGNORE);
> >>                       serio_reconnect(serio);
> >>                       goto out;
> >>               }
> >>
> >> ...
> >>
> >> I am not sure where the "spurious ACK comes from". Can you enable i8042
> >> debug before trying to dock and capture the data stream from the mouse?
> >>
> >
> > The system EC has reset PS2 devices (but AFAIK kernel won't have seen this
> > communication).
> 
> So what kind of communication does EC send when docking? It sounds it
> is completely out of band from PS/2 connection.

Yes it's out of band from PS/2 connection OS sees.  However as Pali has 
mentioned this issue will happen even if already docked but you plug in
PS/2 keyboard.

It will probably be clearer to you what OS has seen from this when Pali
shares the captured data stream.

^ permalink raw reply

* Re: Dell docking station & Dell Embedded Controller & PS/2 devices
From: Dmitry Torokhov @ 2018-02-01 21:14 UTC (permalink / raw)
  To: Mario Limonciello; +Cc: Pali Rohár, linux-input@vger.kernel.org, lkml
In-Reply-To: <bb5156667d084d77841f7078d373a265@ausx13mpc120.AMER.DELL.COM>

On Thu, Feb 1, 2018 at 11:35 AM,  <Mario.Limonciello@dell.com> wrote:
>
>
>> -----Original Message-----
>> From: Dmitry Torokhov [mailto:dmitry.torokhov@gmail.com]
>> Sent: Thursday, February 1, 2018 1:30 PM
>> To: Pali Rohár <pali.rohar@gmail.com>
>> Cc: Limonciello, Mario <Mario_Limonciello@Dell.com>; linux-
>> input@vger.kernel.org; linux-kernel@vger.kernel.org
>> Subject: Re: Dell docking station & Dell Embedded Controller & PS/2 devices
>>
>> Hi Pali,
>>
>> On Wed, Jan 24, 2018 at 11:41:21AM +0100, Pali Rohár wrote:
>> > Hi Dmitry!
>> >
>> > I'm observing a problem with internal touchpad (handled by psmouse.ko)
>> > on Dell laptops connected to Dell E docking station. When I connect
>> > external PS/2 keyboard to docking station then internal laptop touchpad
>> > switch from multitouch absolute mode to relative bare PS/2 mode.
>> >
>> > And because ALPS driver in psmouse.ko is capable to process interleaved
>> > bare 3-byte PS/2 packets with 6-byte ALPS packets (which handles
>> > trackstick data on some ALPS models), ALPS driver does not show any
>> > message about this "downgrade" from multitouch to bare mode. And
>> > continue working in bare mode.
>> >
>> > When I rmmod psmouse and modprobe it again, then touchpad switch back to
>> > multitouch mode.
>> >
>> > Mario told me that Dell Embedded Controller, which handle internal
>> > keyboard, internal touchpad and external PS/2 keyboard, automatically
>> > send RESET command to *all* those devices when external PS/2 keyboard is
>> > connected. Therefore this is reason why touchpad downgrade to to bare
>> > mode. And according to Mario, host system should issue vendor specific
>> > PS/2 commands to re-initialize all PS/2 devices when this situation
>> > happen. Mario also told me that Windows is doing this action.
>>
>> Yeah, I remember fun with Inspiron 8100 - when you dock it it woudl
>> silently switch Synaptics touchpad into standard mode and it would not
>> come back as Synaptics until you disconnect. And there was no
>> notification to the kernel as far as I could tell.
>>
>> It could be that we need to monitor dock events and then kick reconnect
>> of serio port, either from userspace via udev (I think that would be
>> preferred), or in kernel.
>>
>> >
>> > Every time when I connect external PS/2 keyboard to dock I see this
>> > message in dmesg:
>> >
>> > Spurious ACK... Some program might be trying to access hardware directly.
>> >
>> > I see it also every time when I dock laptop into docking station (to
>> > which is keyboard already connected). And it happens also when I connect
>> > external PS/2 mouse to dock.
>> >
>> > Dmitry, how to handle this situation to re-initialize psmouse.ko when
>> > external PS/2 device is connected to Dell E docking station? According
>> > to Mario, this is how Dell Embedded Controller is designed and suppose
>> > how OS should work with it.
>> >
>> > Manually rmmoding and modprobing for every docking/undocking laptop is
>> > not ideal solution.
>> >
>> > Could it be possible to use that Spurious ATKBD_RET_ACK from atkbd.c be
>> > handled on Dell systems (probably via DMI) as an event to reset and
>> > reinitialize all PS/2 devices?
>>
>> So we need to figure out what exactly we are getting from the docking
>> station in this case. We do try to handle the new device 0xaa 0x00
>> announcements:
>
> Docking station itself won't have sent any events.  The PS2 ports in it
> are electrically wired to the external PS2 pins in the docking adapter on
> the system.
>
> System EC is what will be sending any PS2 events.

OK, it does not matter from the input layer POW, if they are PS/2
events they should be coming from i8042.

>
>>
>>       /* Check if this is a new device announcement (0xAA 0x00) */
>>       if (unlikely(psmouse->packet[0] == PSMOUSE_RET_BAT && psmouse-
>> >pktcnt <= 2)) {
>>               if (psmouse->pktcnt == 1) {
>>                       psmouse->last = jiffies;
>>                       goto out;
>>               }
>>
>>               if (psmouse->packet[1] == PSMOUSE_RET_ID ||
>>                   (psmouse->protocol->type == PSMOUSE_HGPK &&
>>                    psmouse->packet[1] == PSMOUSE_RET_BAT)) {
>>                       __psmouse_set_state(psmouse, PSMOUSE_IGNORE);
>>                       serio_reconnect(serio);
>>                       goto out;
>>               }
>>
>> ...
>>
>> I am not sure where the "spurious ACK comes from". Can you enable i8042
>> debug before trying to dock and capture the data stream from the mouse?
>>
>
> The system EC has reset PS2 devices (but AFAIK kernel won't have seen this
> communication).

So what kind of communication does EC send when docking? It sounds it
is completely out of band from PS/2 connection.

Thanks.

-- 
Dmitry

^ permalink raw reply

* Good Morning !
From: Anny @ 2018-02-01 20:23 UTC (permalink / raw)




Good Morning , 



I have a project i would like to bring to you and i want you to help me discuss it. please let me know if you will be available for this project. 



Thanks 




^ permalink raw reply

* RE: Dell docking station & Dell Embedded Controller & PS/2 devices
From: Mario.Limonciello @ 2018-02-01 19:35 UTC (permalink / raw)
  To: dmitry.torokhov, pali.rohar; +Cc: linux-input, linux-kernel
In-Reply-To: <20180201192945.wrsqjq7f5ejhqj6m@dtor-ws>



> -----Original Message-----
> From: Dmitry Torokhov [mailto:dmitry.torokhov@gmail.com]
> Sent: Thursday, February 1, 2018 1:30 PM
> To: Pali Rohár <pali.rohar@gmail.com>
> Cc: Limonciello, Mario <Mario_Limonciello@Dell.com>; linux-
> input@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: Re: Dell docking station & Dell Embedded Controller & PS/2 devices
> 
> Hi Pali,
> 
> On Wed, Jan 24, 2018 at 11:41:21AM +0100, Pali Rohár wrote:
> > Hi Dmitry!
> >
> > I'm observing a problem with internal touchpad (handled by psmouse.ko)
> > on Dell laptops connected to Dell E docking station. When I connect
> > external PS/2 keyboard to docking station then internal laptop touchpad
> > switch from multitouch absolute mode to relative bare PS/2 mode.
> >
> > And because ALPS driver in psmouse.ko is capable to process interleaved
> > bare 3-byte PS/2 packets with 6-byte ALPS packets (which handles
> > trackstick data on some ALPS models), ALPS driver does not show any
> > message about this "downgrade" from multitouch to bare mode. And
> > continue working in bare mode.
> >
> > When I rmmod psmouse and modprobe it again, then touchpad switch back to
> > multitouch mode.
> >
> > Mario told me that Dell Embedded Controller, which handle internal
> > keyboard, internal touchpad and external PS/2 keyboard, automatically
> > send RESET command to *all* those devices when external PS/2 keyboard is
> > connected. Therefore this is reason why touchpad downgrade to to bare
> > mode. And according to Mario, host system should issue vendor specific
> > PS/2 commands to re-initialize all PS/2 devices when this situation
> > happen. Mario also told me that Windows is doing this action.
> 
> Yeah, I remember fun with Inspiron 8100 - when you dock it it woudl
> silently switch Synaptics touchpad into standard mode and it would not
> come back as Synaptics until you disconnect. And there was no
> notification to the kernel as far as I could tell.
> 
> It could be that we need to monitor dock events and then kick reconnect
> of serio port, either from userspace via udev (I think that would be
> preferred), or in kernel.
> 
> >
> > Every time when I connect external PS/2 keyboard to dock I see this
> > message in dmesg:
> >
> > Spurious ACK... Some program might be trying to access hardware directly.
> >
> > I see it also every time when I dock laptop into docking station (to
> > which is keyboard already connected). And it happens also when I connect
> > external PS/2 mouse to dock.
> >
> > Dmitry, how to handle this situation to re-initialize psmouse.ko when
> > external PS/2 device is connected to Dell E docking station? According
> > to Mario, this is how Dell Embedded Controller is designed and suppose
> > how OS should work with it.
> >
> > Manually rmmoding and modprobing for every docking/undocking laptop is
> > not ideal solution.
> >
> > Could it be possible to use that Spurious ATKBD_RET_ACK from atkbd.c be
> > handled on Dell systems (probably via DMI) as an event to reset and
> > reinitialize all PS/2 devices?
> 
> So we need to figure out what exactly we are getting from the docking
> station in this case. We do try to handle the new device 0xaa 0x00
> announcements:

Docking station itself won't have sent any events.  The PS2 ports in it
are electrically wired to the external PS2 pins in the docking adapter on
the system.

System EC is what will be sending any PS2 events.

> 
> 	/* Check if this is a new device announcement (0xAA 0x00) */
> 	if (unlikely(psmouse->packet[0] == PSMOUSE_RET_BAT && psmouse-
> >pktcnt <= 2)) {
> 		if (psmouse->pktcnt == 1) {
> 			psmouse->last = jiffies;
> 			goto out;
> 		}
> 
> 		if (psmouse->packet[1] == PSMOUSE_RET_ID ||
> 		    (psmouse->protocol->type == PSMOUSE_HGPK &&
> 		     psmouse->packet[1] == PSMOUSE_RET_BAT)) {
> 			__psmouse_set_state(psmouse, PSMOUSE_IGNORE);
> 			serio_reconnect(serio);
> 			goto out;
> 		}
> 
> ...
> 
> I am not sure where the "spurious ACK comes from". Can you enable i8042
> debug before trying to dock and capture the data stream from the mouse?
> 

The system EC has reset PS2 devices (but AFAIK kernel won't have seen this
communication).

^ permalink raw reply

* Re: Dell docking station & Dell Embedded Controller & PS/2 devices
From: Dmitry Torokhov @ 2018-02-01 19:29 UTC (permalink / raw)
  To: Pali Rohár; +Cc: Mario.Limonciello, linux-input, linux-kernel
In-Reply-To: <20180124104121.7g3zfay5smc5v2tc@pali>

Hi Pali,

On Wed, Jan 24, 2018 at 11:41:21AM +0100, Pali Rohár wrote:
> Hi Dmitry!
> 
> I'm observing a problem with internal touchpad (handled by psmouse.ko)
> on Dell laptops connected to Dell E docking station. When I connect
> external PS/2 keyboard to docking station then internal laptop touchpad
> switch from multitouch absolute mode to relative bare PS/2 mode.
> 
> And because ALPS driver in psmouse.ko is capable to process interleaved
> bare 3-byte PS/2 packets with 6-byte ALPS packets (which handles
> trackstick data on some ALPS models), ALPS driver does not show any
> message about this "downgrade" from multitouch to bare mode. And
> continue working in bare mode.
> 
> When I rmmod psmouse and modprobe it again, then touchpad switch back to
> multitouch mode.
> 
> Mario told me that Dell Embedded Controller, which handle internal
> keyboard, internal touchpad and external PS/2 keyboard, automatically
> send RESET command to *all* those devices when external PS/2 keyboard is
> connected. Therefore this is reason why touchpad downgrade to to bare
> mode. And according to Mario, host system should issue vendor specific
> PS/2 commands to re-initialize all PS/2 devices when this situation
> happen. Mario also told me that Windows is doing this action.

Yeah, I remember fun with Inspiron 8100 - when you dock it it woudl
silently switch Synaptics touchpad into standard mode and it would not
come back as Synaptics until you disconnect. And there was no
notification to the kernel as far as I could tell.

It could be that we need to monitor dock events and then kick reconnect
of serio port, either from userspace via udev (I think that would be
preferred), or in kernel.

> 
> Every time when I connect external PS/2 keyboard to dock I see this
> message in dmesg:
> 
> Spurious ACK... Some program might be trying to access hardware directly.
> 
> I see it also every time when I dock laptop into docking station (to
> which is keyboard already connected). And it happens also when I connect
> external PS/2 mouse to dock.
> 
> Dmitry, how to handle this situation to re-initialize psmouse.ko when
> external PS/2 device is connected to Dell E docking station? According
> to Mario, this is how Dell Embedded Controller is designed and suppose
> how OS should work with it.
> 
> Manually rmmoding and modprobing for every docking/undocking laptop is
> not ideal solution.
> 
> Could it be possible to use that Spurious ATKBD_RET_ACK from atkbd.c be
> handled on Dell systems (probably via DMI) as an event to reset and
> reinitialize all PS/2 devices?

So we need to figure out what exactly we are getting from the docking
station in this case. We do try to handle the new device 0xaa 0x00
announcements:

	/* Check if this is a new device announcement (0xAA 0x00) */
	if (unlikely(psmouse->packet[0] == PSMOUSE_RET_BAT && psmouse->pktcnt <= 2)) {
		if (psmouse->pktcnt == 1) {
			psmouse->last = jiffies;
			goto out;
		}

		if (psmouse->packet[1] == PSMOUSE_RET_ID ||
		    (psmouse->protocol->type == PSMOUSE_HGPK &&
		     psmouse->packet[1] == PSMOUSE_RET_BAT)) {
			__psmouse_set_state(psmouse, PSMOUSE_IGNORE);
			serio_reconnect(serio);
			goto out;
		}

...

I am not sure where the "spurious ACK comes from". Can you enable i8042
debug before trying to dock and capture the data stream from the mouse?

Thanks.

-- 
Dmitry

^ permalink raw reply

* [PATCH] HID: sony: Add touchpad support for NSG-MR5U and NSG-MR7U remotes
From: Todd Kelner @ 2018-02-01 18:09 UTC (permalink / raw)
  To: Jiri Kosina, Benjamin Tissoires; +Cc: linux-input

Sony's NSG-MR5U and NSG-MR7U remote controls have a full keyboard and a
touchpad.  The keyboard is already supported by the existing Linux
kernel and drivers but the touchpad is not recognized.  This patch adds
the coded needed to bring full functionality to the touchpad.

Note that these remotes use the vendor code for SMK even though they are
Sony branded.

Known limitations
- The built-in accelerometers are not supported by these changes
- When the Drag (Fn) key is used as a mouse button, the button is
  automatically released when the key begins repeating.  There are two
  workarounds for this 1) Use the button behind the touchpad instead of
  the Drag (Fn) key or 2) Disable the key repeat functionality or
  increase the key repeat delay.

Signed-off-by: Todd Kelner <tsopdump@gmail.com>
---
 drivers/hid/hid-core.c |   2 +
 drivers/hid/hid-ids.h  |   2 +
 drivers/hid/hid-sony.c | 118 +++++++++++++++++++++++++++++++++++++++++++++++--
 3 files changed, 119 insertions(+), 3 deletions(-)

diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 0c3f608131cf..4b6be344466b 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -2301,6 +2301,8 @@ static const struct hid_device_id hid_have_special_driver[] = {
 #if IS_ENABLED(CONFIG_HID_SONY)
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_PS3) },
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SMK, USB_DEVICE_ID_SMK_PS3_BDREMOTE) },
+	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SMK, USB_DEVICE_ID_SMK_NSG_MR5U_REMOTE) },
+	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SMK, USB_DEVICE_ID_SMK_NSG_MR7U_REMOTE) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_BUZZ_CONTROLLER) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_WIRELESS_BUZZ_CONTROLLER) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_MOTION_CONTROLLER) },
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 5da3d6256d25..793d80bdd301 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -954,6 +954,8 @@
 
 #define USB_VENDOR_ID_SMK		0x0609
 #define USB_DEVICE_ID_SMK_PS3_BDREMOTE	0x0306
+#define USB_DEVICE_ID_SMK_NSG_MR5U_REMOTE	0x0368
+#define USB_DEVICE_ID_SMK_NSG_MR7U_REMOTE	0x0369
 
 #define USB_VENDOR_ID_SONY			0x054c
 #define USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE	0x024b
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index b9dc3ac4d4aa..8504f4fae6af 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -9,6 +9,7 @@
  *  Copyright (c) 2006-2013 Jiri Kosina
  *  Copyright (c) 2013 Colin Leitner <colin.leitner@gmail.com>
  *  Copyright (c) 2014-2016 Frank Praznik <frank.praznik@gmail.com>
+ *  Copyright (c) 2018 Todd Kelner
  */
 
 /*
@@ -55,6 +56,8 @@
 #define NAVIGATION_CONTROLLER_BT  BIT(11)
 #define SINO_LITE_CONTROLLER      BIT(12)
 #define FUTUREMAX_DANCE_MAT       BIT(13)
+#define NSG_MR5U_REMOTE_BT        BIT(14)
+#define NSG_MR7U_REMOTE_BT        BIT(15)
 
 #define SIXAXIS_CONTROLLER (SIXAXIS_CONTROLLER_USB | SIXAXIS_CONTROLLER_BT)
 #define MOTION_CONTROLLER (MOTION_CONTROLLER_USB | MOTION_CONTROLLER_BT)
@@ -72,8 +75,11 @@
 				MOTION_CONTROLLER)
 #define SONY_BT_DEVICE (SIXAXIS_CONTROLLER_BT | DUALSHOCK4_CONTROLLER_BT |\
 			MOTION_CONTROLLER_BT | NAVIGATION_CONTROLLER_BT)
+#define NSG_MRXU_REMOTE (NSG_MR5U_REMOTE_BT | NSG_MR7U_REMOTE_BT)
 
 #define MAX_LEDS 4
+#define NSG_MRXU_MAX_X 1667
+#define NSG_MRXU_MAX_Y 1868
 
 
 /* PS/3 Motion controller */
@@ -1072,6 +1078,75 @@ static void dualshock4_parse_report(struct sony_sc *sc, u8 *rd, int size)
 	}
 }
 
+static void nsg_mrxu_parse_report(struct sony_sc *sc, u8 *rd, int size)
+{
+	int n, offset;
+	u8 active;
+
+	/*
+	 * The NSG-MRxU multi-touch trackpad data starts at offset 1 and
+	 *   the touch-related data starts at offset 2.
+	 * For the first byte, bit 0 is set when touchpad button is pressed.
+	 * Bit 3 is set when a touch is active and the drag (Fn) key is pressed.
+	 * This drag key is mapped to BTN_LEFT.
+	 * Bit 4 is set when only the first touch point is active.
+	 * Bit 6 is set when only the second touch point is active.
+	 * Bits 5 and 7 are set when both touch points are active.
+	 * The next 3 bytes are two 12 bit X/Y coordinates for the first touch.
+	 * The following byte, offset 5, has the touch width and length.
+	 *   Bits 0-4=X (width), bits 5-7=Y (length).
+	 * A signed relative X coordinate is at offset 6.
+	 * The bytes at offset 7-9 are the second touch X/Y coordinates.
+	 * Offset 10 has the second touch width and length.
+	 * Offset 11 has the relative Y coordinate.
+	 */
+	offset = 1;
+
+	input_report_key(sc->touchpad, BTN_LEFT, rd[offset] & 0x0F);
+	active = (rd[offset] >> 4);
+
+	offset++;
+
+	for (n = 0; n < 2; n++) {
+		u16 x, y;
+		u8 contactx, contacty;
+		unsigned int rel_axis;
+
+		x = rd[offset] | ((rd[offset+1] & 0x0F) << 8);
+		y = ((rd[offset+1] & 0xF0) >> 4) | (rd[offset+2] << 4);
+
+		input_mt_slot(sc->touchpad, n);
+		input_mt_report_slot_state(sc->touchpad, MT_TOOL_FINGER, active & 0x03);
+
+		if (active & 0x03) {
+			contactx = rd[offset+3] & 0x0F;
+			contacty = rd[offset+3] >> 4;
+			input_report_abs(sc->touchpad, ABS_MT_TOUCH_MAJOR,
+				max(contactx, contacty));
+			input_report_abs(sc->touchpad, ABS_MT_TOUCH_MINOR,
+				max(contactx, contacty));
+			input_report_abs(sc->touchpad, ABS_MT_ORIENTATION,
+				(bool) (contactx > contacty));
+			input_report_abs(sc->touchpad, ABS_MT_POSITION_X, x);
+			input_report_abs(sc->touchpad, ABS_MT_POSITION_Y,
+				NSG_MRXU_MAX_Y - y);
+			if (n == 0)
+				rel_axis = REL_X;
+			else
+				rel_axis = REL_Y;
+
+			input_report_rel(sc->touchpad, rel_axis, rd[offset+4]);
+		}
+
+		offset += 5;
+		active >>= 2;
+	}
+
+	input_mt_sync_frame(sc->touchpad);
+
+	input_sync(sc->touchpad);
+}
+
 static int sony_raw_event(struct hid_device *hdev, struct hid_report *report,
 		u8 *rd, int size)
 {
@@ -1180,6 +1255,10 @@ static int sony_raw_event(struct hid_device *hdev, struct hid_report *report,
 		}
 
 		dualshock4_parse_report(sc, rd, size);
+
+	} else if ((sc->quirks & NSG_MRXU_REMOTE) && rd[0] == 0x02) {
+		nsg_mrxu_parse_report(sc, rd, size);
+		return 1;
 	}
 
 	if (sc->defer_initialization) {
@@ -1268,9 +1347,11 @@ static int sony_register_touchpad(struct sony_sc *sc, int touch_count,
 	snprintf(name, name_sz, "%s" DS4_TOUCHPAD_SUFFIX, sc->hdev->name);
 	sc->touchpad->name = name;
 
-	ret = input_mt_init_slots(sc->touchpad, touch_count, INPUT_MT_POINTER);
-	if (ret < 0)
-		goto err;
+	if (!(sc->quirks & NSG_MRXU_REMOTE)) {
+		ret = input_mt_init_slots(sc->touchpad, touch_count, INPUT_MT_POINTER);
+		if (ret < 0)
+			goto err;
+	}
 
 	/* We map the button underneath the touchpad to BTN_LEFT. */
 	__set_bit(EV_KEY, sc->touchpad->evbit);
@@ -1280,6 +1361,17 @@ static int sony_register_touchpad(struct sony_sc *sc, int touch_count,
 	input_set_abs_params(sc->touchpad, ABS_MT_POSITION_X, 0, w, 0, 0);
 	input_set_abs_params(sc->touchpad, ABS_MT_POSITION_Y, 0, h, 0, 0);
 
+	if (sc->quirks & NSG_MRXU_REMOTE) {
+		__set_bit(EV_REL, sc->touchpad->evbit);
+		input_set_abs_params(sc->touchpad, ABS_MT_TOUCH_MAJOR, 0, 15, 0, 0);
+		input_set_abs_params(sc->touchpad, ABS_MT_TOUCH_MINOR, 0, 15, 0, 0);
+		input_set_abs_params(sc->touchpad, ABS_MT_ORIENTATION, 0, 1, 0, 0);
+
+		ret = input_mt_init_slots(sc->touchpad, touch_count, INPUT_MT_POINTER);
+		if (ret < 0)
+			goto err;
+	}
+
 	ret = input_register_device(sc->touchpad);
 	if (ret < 0)
 		goto err;
@@ -2654,6 +2746,20 @@ static int sony_input_configured(struct hid_device *hdev,
 		}
 
 		sony_init_output_report(sc, dualshock4_send_output_report);
+	} else if (sc->quirks & NSG_MRXU_REMOTE) {
+		/*
+		 * The NSG-MRxU touchpad supports 2 touches and has a
+		 * resolution of 1667x1868
+		 */
+		ret = sony_register_touchpad(sc, 2,
+			NSG_MRXU_MAX_X, NSG_MRXU_MAX_Y);
+		if (ret) {
+			hid_err(sc->hdev,
+			"Unable to initialize multi-touch slots: %d\n",
+			ret);
+			goto err_stop;
+		}
+
 	} else if (sc->quirks & MOTION_CONTROLLER) {
 		sony_init_output_report(sc, motion_send_output_report);
 	} else {
@@ -2892,6 +2998,12 @@ static const struct hid_device_id sony_devices[] = {
 	/* Nyko Core Controller for PS3 */
 	{ HID_USB_DEVICE(USB_VENDOR_ID_SINO_LITE, USB_DEVICE_ID_SINO_LITE_CONTROLLER),
 		.driver_data = SIXAXIS_CONTROLLER_USB | SINO_LITE_CONTROLLER },
+	/* SMK-Link NSG-MR5U Remote Control */
+	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SMK, USB_DEVICE_ID_SMK_NSG_MR5U_REMOTE),
+		.driver_data = NSG_MR5U_REMOTE_BT },
+	/* SMK-Link NSG-MR7U Remote Control */
+	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SMK, USB_DEVICE_ID_SMK_NSG_MR7U_REMOTE),
+		.driver_data = NSG_MR7U_REMOTE_BT },
 	{ }
 };
 MODULE_DEVICE_TABLE(hid, sony_devices);
-- 
2.14.1


^ permalink raw reply related

* [git pull] Input updates for v4.16-rc0
From: Dmitry Torokhov @ 2018-02-01 18:07 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-kernel, linux-input

Hi Linus,

Please pull from:

	git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git for-linus

to receive updates for the input subsystem. You will get:

- evdev interface has been adjusted to extend the life of timestamps on
  32 bit systems to the year of 2108

- Synaptics RMI4 driver's PS/2 guest handling ha beed updated to improve
  chances of detecting trackpoints on the pass-through port

- mms114 touchcsreen controller driver has been updated to support
  generic device properties and work with mms152 cntrollers

- Goodix driver now supports generic touchscreen properties

- couple of drivers for AVR32 architecture are gone as the architecture
  support has been removed from the kernel

- gpio-tilt driver has been removed as there are no mainline users and
  the driver itself is using legacy APIs and relies on platform data

- MODULE_LINECSE/MODULE_VERSION cleanups

Changelog:
---------

Andi Shyti (6):
      Input: stmfts,s6sy671 - add SPDX identifier
      Input: ad7877 - use managed resource allocations
      Input: stmfts - set IRQ_NOAUTOEN to the irq flag
      Input: mms114 - replace mdelay with msleep
      Input: mms114 - use BIT() macro instead of explicit shifting
      Input: mms114 - fix typo in definition

Andy Shevchenko (1):
      Input: docs - use PROPERTY_ENTRY_U32() directly

Arnd Bergmann (1):
      Input: hp_sdc - convert to ktime_get()

Colin Ian King (1):
      Input: cyapa - remove redundant assignment to 'pwr_cmd'

Corentin Labbe (2):
      Input: remove at32psif
      Input: remove atmel-wm97xx touchscreen driver

Deepa Dinamani (2):
      Input: uinput - use monotonic times for timestamps
      Input: extend usable life of event timestamps to 2106 on 32 bit systems

Dmitry Torokhov (7):
      Input: psmouse - fix Synaptics detection when protocol is disabled
      Input: synaptics-rmi4 - do not delete interrupt memory too early
      Input: synaptics-rmi4 - unmask F03 interrupts when port is opened
      Input: synaptics-rmi4 - log when we create a guest serio port
      Input: edt-ft5x06 - fix error handling for factory mode on non-M06
      Input: mms114 - do not clobber interrupt trigger
      Input: mms114 - mark as direct input device

Greg Kroah-Hartman (7):
      Input: remove unneeded DRIVER_LICENSE #defines
      Input: synaptics_rmi4 - remove unneeded MODULE_VERSION() usage
      Input: pmic8xxx-keypad - remove unneeded MODULE_VERSION() usage
      Input: elan_i2c - remove unneeded MODULE_VERSION() usage
      Input: remove unneeded MODULE_VERSION() usage in touchscreen drivers
      Input: remove unneeded MODULE_VERSION() usage in misc input drivers
      Input: remove remaining unneeded MODULE_VERSION() usage

Hans de Goede (2):
      Input: silead - add support for capactive home button found on some x86 tablets
      Input: goodix - disable IRQs while suspended

Jean-François Têtu (1):
      Input: fix small typos in force feedback documentation

Jeffrey Lin (1):
      Input: raydium_i2c_ts - include hardware version in firmware name

Julia Lawall (1):
      Input: inline macros for MODULE_LICENSE, etc

Linus Walleij (1):
      Input: gpio_tilt - delete driver

Marcin Niestroj (1):
      Input: goodix - use generic touchscreen_properties

Marcus Folkesson (1):
      Input: da9052_tsi - remove unused mutex

Markus Elfring (2):
      Input: auo-pixcir-ts - remove custom log for a failed memory allocation
      Input: auo-pixcir-ts - delete an unnecessary return statement

Peter Hutterer (1):
      Input: synaptics - reset the ABS_X/Y fuzz after initializing MT axes

Pravin Shedge (1):
      Input: synaptic_rmi4 - remove duplicate include in F34

Rasmus Villemoes (1):
      Input: cyapa - remove duplicated macro definitions

Simon Shields (2):
      Input: mms114 - drop platform data and use generic APIs
      Input: mms114 - add support for mms152

WEN Pingbo (2):
      Input: hil_mlc - convert timeval to time64_t
      Input: hil_mlc - convert timeval to jiffies

Zhuohua Li (1):
      Input: tps65218-pwrbutton - fix a spelling mistake in Kconfig

Diffstat:
--------

 .../bindings/input/touchscreen/mms114.txt          |  35 +-
 .../bindings/input/touchscreen/silead_gsl1680.txt  |   2 +
 Documentation/gpio/drivers-on-gpio.txt             |   5 -
 Documentation/input/devices/gpio-tilt.rst          | 103 -----
 Documentation/input/devices/rotary-encoder.rst     |   6 +-
 Documentation/input/ff.rst                         |   6 +-
 drivers/input/evdev.c                              |  20 +-
 drivers/input/input-compat.c                       |   8 +-
 drivers/input/input-compat.h                       |   3 +-
 drivers/input/input-polldev.c                      |   1 -
 drivers/input/joystick/xpad.c                      |   7 +-
 drivers/input/keyboard/pmic8xxx-keypad.c           |   1 -
 drivers/input/misc/Kconfig                         |  16 +-
 drivers/input/misc/Makefile                        |   1 -
 drivers/input/misc/apanel.c                        |   2 -
 drivers/input/misc/ati_remote2.c                   |   2 -
 drivers/input/misc/gpio_tilt_polled.c              | 210 ----------
 drivers/input/misc/keyspan_remote.c                |  11 +-
 drivers/input/misc/uinput.c                        |   6 +-
 drivers/input/misc/yealink.c                       |   6 +-
 drivers/input/mouse/cyapa.c                        |   2 +-
 drivers/input/mouse/cyapa_gen3.c                   |  43 --
 drivers/input/mouse/elan_i2c_core.c                |   2 -
 drivers/input/mouse/psmouse-base.c                 |  34 +-
 drivers/input/mouse/synaptics.c                    |  10 +
 drivers/input/rmi4/rmi_bus.c                       |   1 -
 drivers/input/rmi4/rmi_driver.c                    |  14 +-
 drivers/input/rmi4/rmi_driver.h                    |   2 -
 drivers/input/rmi4/rmi_f03.c                       |  73 +++-
 drivers/input/rmi4/rmi_f34.c                       |   1 -
 drivers/input/rmi4/rmi_i2c.c                       |   1 -
 drivers/input/rmi4/rmi_spi.c                       |   1 -
 drivers/input/serio/Kconfig                        |  10 -
 drivers/input/serio/Makefile                       |   1 -
 drivers/input/serio/at32psif.c                     | 357 -----------------
 drivers/input/serio/hil_mlc.c                      |  26 +-
 drivers/input/serio/hp_sdc.c                       |  17 +-
 drivers/input/serio/hp_sdc_mlc.c                   |   5 +-
 drivers/input/sparse-keymap.c                      |   1 -
 drivers/input/tablet/acecad.c                      |  14 +-
 drivers/input/tablet/aiptek.c                      |  11 +-
 drivers/input/tablet/hanwang.c                     |  10 +-
 drivers/input/tablet/kbtab.c                       |  17 +-
 drivers/input/touchscreen/Kconfig                  |  15 -
 drivers/input/touchscreen/Makefile                 |   1 -
 drivers/input/touchscreen/ad7877.c                 |  67 ++--
 drivers/input/touchscreen/atmel-wm97xx.c           | 436 ---------------------
 drivers/input/touchscreen/auo-pixcir-ts.c          |   6 +-
 drivers/input/touchscreen/colibri-vf50-ts.c        |   2 -
 drivers/input/touchscreen/da9052_tsi.c             |   1 -
 drivers/input/touchscreen/edt-ft5x06.c             |  14 +-
 drivers/input/touchscreen/elants_i2c.c             |   2 -
 drivers/input/touchscreen/goodix.c                 | 149 +++----
 drivers/input/touchscreen/melfas_mip4.c            |   1 -
 drivers/input/touchscreen/mms114.c                 | 240 +++++++-----
 drivers/input/touchscreen/raydium_i2c_ts.c         |  14 +-
 drivers/input/touchscreen/silead.c                 |  46 ++-
 drivers/input/touchscreen/stmfts.c                 |  11 +-
 drivers/input/touchscreen/usbtouchscreen.c         |   9 +-
 drivers/input/touchscreen/wdt87xx_i2c.c            |   2 -
 include/linux/hil_mlc.h                            |   6 +-
 include/linux/hp_sdc.h                             |   2 +-
 include/linux/input/gpio_tilt.h                    |  74 ----
 include/linux/platform_data/mms114.h               |  24 --
 include/uapi/linux/input.h                         |  11 +
 65 files changed, 491 insertions(+), 1746 deletions(-)
 delete mode 100644 Documentation/input/devices/gpio-tilt.rst
 delete mode 100644 drivers/input/misc/gpio_tilt_polled.c
 delete mode 100644 drivers/input/serio/at32psif.c
 delete mode 100644 drivers/input/touchscreen/atmel-wm97xx.c
 delete mode 100644 include/linux/input/gpio_tilt.h
 delete mode 100644 include/linux/platform_data/mms114.h

Thanks.


-- 
Dmitry

^ permalink raw reply

* Respond for details
From: Mr. Allen @ 2018-02-01 16:39 UTC (permalink / raw)




Dear sir/ madam


Do you need a loan to pay off bills ? To pay off your mortgage quickly ? To set up a new business or to Re- finance your existing business ? I can help you secure a private loan at 3% interest rate please respond for more details



Thanks


Allen



^ permalink raw reply

* Re: [PATCH] Input: adp5520-keys: Delete an error message for a failed memory allocation in adp5520_keys_probe()
From: Michael Hennerich @ 2018-02-01 16:27 UTC (permalink / raw)
  To: SF Markus Elfring, linux-input, Dmitry Torokhov; +Cc: LKML, kernel-janitors
In-Reply-To: <9d0729d2-59ab-f116-aa12-0457ebde0041@users.sourceforge.net>

On 27.01.2018 15:20, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sat, 27 Jan 2018 15:15:52 +0100
> 
> Omit an extra message for a memory allocation failure in this function.
> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>

Acked-by: Michael Hennerich <michael.hennerich@analog.com>

> ---
>   drivers/input/keyboard/adp5520-keys.c | 4 +---
>   1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/input/keyboard/adp5520-keys.c b/drivers/input/keyboard/adp5520-keys.c
> index f0b9b37bde58..72e01cb77881 100644
> --- a/drivers/input/keyboard/adp5520-keys.c
> +++ b/drivers/input/keyboard/adp5520-keys.c
> @@ -91,10 +91,8 @@ static int adp5520_keys_probe(struct platform_device *pdev)
>   		return -EINVAL;
>   
>   	dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL);
> -	if (!dev) {
> -		dev_err(&pdev->dev, "failed to alloc memory\n");
> +	if (!dev)
>   		return -ENOMEM;
> -	}
>   
>   	input = devm_input_allocate_device(&pdev->dev);
>   	if (!input)
> 

^ permalink raw reply

* [PATCH 1/2] Input: mms114 - add SPDX identifier
From: Andi Shyti @ 2018-02-01  8:23 UTC (permalink / raw)
  To: Dmitry Torokhov, Marcus Folkesson
  Cc: Sangwon Jee, linux-input, linux-kernel, Andi Shyti, Andi Shyti
In-Reply-To: <20180201082320.24031-1-andi.shyti@samsung.com>

Replace the original license statement with the SPDX identifier.
Add also one line of description as recommended by the COPYING
file.

Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
---
 drivers/input/touchscreen/mms114.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/input/touchscreen/mms114.c b/drivers/input/touchscreen/mms114.c
index db4f6bb502e3..be7926555432 100644
--- a/drivers/input/touchscreen/mms114.c
+++ b/drivers/input/touchscreen/mms114.c
@@ -1,11 +1,8 @@
-/*
- * Copyright (C) 2012 Samsung Electronics Co.Ltd
- * Author: Joonyoung Shim <jy0922.shim@samsung.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
+// SPDX-License-Identifier: GPL-2.0
+// Melfas MMS114/MMS152 touchscreen device driver
+//
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+// Author: Joonyoung Shim <jy0922.shim@samsung.com>
 
 #include <linux/module.h>
 #include <linux/delay.h>
-- 
2.15.1


^ permalink raw reply related

* [PATCH 2/2] Input: mms114 - fix license module information
From: Andi Shyti @ 2018-02-01  8:23 UTC (permalink / raw)
  To: Dmitry Torokhov, Marcus Folkesson
  Cc: Sangwon Jee, linux-input, linux-kernel, Andi Shyti, Andi Shyti
In-Reply-To: <20180201082320.24031-1-andi.shyti@samsung.com>

The driver has been released with GNU Public License v2 as stated
in the header, but the module license information has been tagged
as "GPL" (GNU Public License v2 or later).

Fix the module license information so that it matches the one in
the header as "GPL v2".

Fixes: 07b8481d4aff ("Input: add MELFAS mms114 touchscreen driver")
Reported-by: Marcus Folkesson <marcus.folkesson@gmail.com>
Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
---
 drivers/input/touchscreen/mms114.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/touchscreen/mms114.c b/drivers/input/touchscreen/mms114.c
index be7926555432..a5ab774da4cc 100644
--- a/drivers/input/touchscreen/mms114.c
+++ b/drivers/input/touchscreen/mms114.c
@@ -621,4 +621,4 @@ module_i2c_driver(mms114_driver);
 /* Module information */
 MODULE_AUTHOR("Joonyoung Shim <jy0922.shim@samsung.com>");
 MODULE_DESCRIPTION("MELFAS mms114 Touchscreen driver");
-MODULE_LICENSE("GPL");
+MODULE_LICENSE("GPL v2");
-- 
2.15.1

^ permalink raw reply related

* [PATCH 0/2] Licensing fixes and updates for the mms114 driver
From: Andi Shyti @ 2018-02-01  8:23 UTC (permalink / raw)
  To: Dmitry Torokhov, Marcus Folkesson
  Cc: Sangwon Jee, linux-input, linux-kernel, Andi Shyti, Andi Shyti
In-Reply-To: <CGME20180201082338epcas1p43bf7d96c63fdc5bf905528e45d227d8b@epcas1p4.samsung.com>

Hi Dmitry,

I will send this two as a new patchset. The first one is the
messed SPDX patch that you reverted, the second one is about the
license incohorency that Marcus has pointed out.

Andi

Andi Shyti (2):
  Input: mms114 - add SPDX identifier
  Input: mms114 - fix license module information

 drivers/input/touchscreen/mms114.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

-- 
2.15.1

^ permalink raw reply

* Re: [PATCH 7/8] Input: mms114 - add SPDX identifier
From: Andi Shyti @ 2018-02-01  0:50 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Marcus Folkesson, Simon Shields, linux-input, linux-kernel,
	Andi Shyti, jeesw
In-Reply-To: <20180131225307.i5meawlhkwwje4qb@dtor-ws>

Hi Dmitry,

> > > > > - * Copyright (C) 2012 Samsung Electronics Co.Ltd
> > > > > - * Author: Joonyoung Shim <jy0922.shim@samsung.com>
> > > > > - *
> > > > > - * This program is free software; you can redistribute it and/or modify
> > > > > - * it under the terms of the GNU General Public License version 2 as
> > > > > - * published by the Free Software Foundation.
> > > > > - */
> > > > > +// SPDX-License-Identifier: GPL-2.0
> > > > > +// Samsung S6SY761 Touchscreen device driver
> > > 
> > > I'm very sorry, but my distrcation will kill me one day.
> > > 
> > > Is it possible to revert this patch or do you want me to send a
> > > fix?
> > 
> 
> OK, I dropped the patch, please resend the correct version.

Thanks, will do!

Andi

^ permalink raw reply

* Re: [PATCH 7/8] Input: mms114 - add SPDX identifier
From: Andi Shyti @ 2018-02-01  0:49 UTC (permalink / raw)
  To: Marcus Folkesson
  Cc: Dmitry Torokhov, Simon Shields, linux-input, linux-kernel,
	Andi Shyti, jeesw
In-Reply-To: <20180131073138.GA1499@gmail.com>

Hi Marcus,

> > > > - * Copyright (C) 2012 Samsung Electronics Co.Ltd
> > > > - * Author: Joonyoung Shim <jy0922.shim@samsung.com>
> > > > - *
> > > > - * This program is free software; you can redistribute it and/or modify
> > > > - * it under the terms of the GNU General Public License version 2 as
> > > > - * published by the Free Software Foundation.
> > > > - */
> > > > +// SPDX-License-Identifier: GPL-2.0
> > > > +// Samsung S6SY761 Touchscreen device driver
> > 
> > I'm very sorry, but my distrcation will kill me one day.
> 
> More coffee or sleep - your choice ;-)

I see that beer is not working, indeed :)

> > Is it possible to revert this patch or do you want me to send a
> > fix?
> 
> When you are on it;
> 
> Change
> MODULE_LICENSE("GPL");
> 
> to 
> MODULE_LICENSE("GPL v2");
> To match the former license text and SPDX-identifier.
> 
> See include/linux/module.h:
>  *	"GPL"				[GNU Public License v2 or later]
>  *	"GPL v2"			[GNU Public License v2]

I haven't noticed that. I will fix it in a separate patch.

Thanks,
Andi

^ permalink raw reply

* Re: [PATCH 7/8] Input: mms114 - add SPDX identifier
From: Dmitry Torokhov @ 2018-01-31 22:53 UTC (permalink / raw)
  To: Marcus Folkesson
  Cc: Andi Shyti, Simon Shields, linux-input, linux-kernel, Andi Shyti,
	jeesw
In-Reply-To: <20180131073138.GA1499@gmail.com>

On Wed, Jan 31, 2018 at 08:31:38AM +0100, Marcus Folkesson wrote:
> Hi Andy,
> 
> On Wed, Jan 31, 2018 at 03:07:26PM +0900, Andi Shyti wrote:
> > Hi Dmitry,
> > 
> > > > -/*
> > > > - * Copyright (C) 2012 Samsung Electronics Co.Ltd
> > > > - * Author: Joonyoung Shim <jy0922.shim@samsung.com>
> > > > - *
> > > > - * This program is free software; you can redistribute it and/or modify
> > > > - * it under the terms of the GNU General Public License version 2 as
> > > > - * published by the Free Software Foundation.
> > > > - */
> > > > +// SPDX-License-Identifier: GPL-2.0
> > > > +// Samsung S6SY761 Touchscreen device driver
> > 
> > I'm very sorry, but my distrcation will kill me one day.
> 
> More coffee or sleep - your choice ;-)
> 
> > 
> > Is it possible to revert this patch or do you want me to send a
> > fix?
> 
> When you are on it;
> 
> Change
> MODULE_LICENSE("GPL");
> 
> to 
> MODULE_LICENSE("GPL v2");
> To match the former license text and SPDX-identifier.
> 
> See include/linux/module.h:
>  *	"GPL"				[GNU Public License v2 or later]
>  *	"GPL v2"			[GNU Public License v2]

OK, I dropped the patch, please resend the correct version.

Thanks.

-- 
Dmitry

^ permalink raw reply

* [PATCH] hid-sensor-accel-3d: Delete an error message for a failed memory allocation in hid_accel_3d_probe()
From: SF Markus Elfring @ 2018-01-31 21:26 UTC (permalink / raw)
  To: linux-iio, linux-input, Hartmut Knaack, Jiri Kosina,
	Jonathan Cameron, Lars-Peter Clausen, Peter Meerwald-Stadler,
	Srinivas Pandruvada
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 31 Jan 2018 22:20:56 +0100

Omit an extra message for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/iio/accel/hid-sensor-accel-3d.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/accel/hid-sensor-accel-3d.c b/drivers/iio/accel/hid-sensor-accel-3d.c
index c066a3bdbff7..3d0acde40285 100644
--- a/drivers/iio/accel/hid-sensor-accel-3d.c
+++ b/drivers/iio/accel/hid-sensor-accel-3d.c
@@ -383,11 +383,9 @@ static int hid_accel_3d_probe(struct platform_device *pdev)
 		return ret;
 	}
 	indio_dev->channels = kmemdup(channel_spec, channel_size, GFP_KERNEL);
-
-	if (!indio_dev->channels) {
-		dev_err(&pdev->dev, "failed to duplicate channels\n");
+	if (!indio_dev->channels)
 		return -ENOMEM;
-	}
+
 	ret = accel_3d_parse_report(pdev, hsdev,
 				(struct iio_chan_spec *)indio_dev->channels,
 				hsdev->usage, accel_state);
-- 
2.16.1


^ permalink raw reply related

* [PATCH] hid-sensor-gyro-3d: Delete an error message for a failed memory allocation in hid_gyro_3d_probe()
From: SF Markus Elfring @ 2018-01-31 20:43 UTC (permalink / raw)
  To: linux-iio-u79uwXL29TY76Z2rM5mHXA,
	linux-input-u79uwXL29TY76Z2rM5mHXA, Hartmut Knaack, Jiri Kosina,
	Jonathan Cameron, Lars-Peter Clausen, Peter Meerwald-Stadler,
	Srinivas Pandruvada
  Cc: LKML, kernel-janitors-u79uwXL29TY76Z2rM5mHXA

From: Markus Elfring <elfring-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
Date: Wed, 31 Jan 2018 21:36:53 +0100

Omit an extra message for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
---
 drivers/iio/gyro/hid-sensor-gyro-3d.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/iio/gyro/hid-sensor-gyro-3d.c b/drivers/iio/gyro/hid-sensor-gyro-3d.c
index f59995a90387..93465816c5c7 100644
--- a/drivers/iio/gyro/hid-sensor-gyro-3d.c
+++ b/drivers/iio/gyro/hid-sensor-gyro-3d.c
@@ -317,10 +317,8 @@ static int hid_gyro_3d_probe(struct platform_device *pdev)
 
 	indio_dev->channels = kmemdup(gyro_3d_channels,
 				      sizeof(gyro_3d_channels), GFP_KERNEL);
-	if (!indio_dev->channels) {
-		dev_err(&pdev->dev, "failed to duplicate channels\n");
+	if (!indio_dev->channels)
 		return -ENOMEM;
-	}
 
 	ret = gyro_3d_parse_report(pdev, hsdev,
 				   (struct iio_chan_spec *)indio_dev->channels,
-- 
2.16.1

^ permalink raw reply related

* [PATCH] iio/light: Delete an error message for a failed memory allocation in two functions
From: SF Markus Elfring @ 2018-01-31 20:21 UTC (permalink / raw)
  To: linux-iio, linux-input, Archana Patni, Hartmut Knaack,
	Jiri Kosina, Jonathan Cameron, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Srinivas Pandruvada
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 31 Jan 2018 21:12:09 +0100

Omit an extra message for a memory allocation failure in these functions.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/iio/light/hid-sensor-als.c  | 4 +---
 drivers/iio/light/hid-sensor-prox.c | 4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/iio/light/hid-sensor-als.c b/drivers/iio/light/hid-sensor-als.c
index befd693a4a31..83654156d952 100644
--- a/drivers/iio/light/hid-sensor-als.c
+++ b/drivers/iio/light/hid-sensor-als.c
@@ -299,10 +299,8 @@ static int hid_als_probe(struct platform_device *pdev)
 
 	indio_dev->channels = kmemdup(als_channels,
 				      sizeof(als_channels), GFP_KERNEL);
-	if (!indio_dev->channels) {
-		dev_err(&pdev->dev, "failed to duplicate channels\n");
+	if (!indio_dev->channels)
 		return -ENOMEM;
-	}
 
 	ret = als_parse_report(pdev, hsdev,
 			       (struct iio_chan_spec *)indio_dev->channels,
diff --git a/drivers/iio/light/hid-sensor-prox.c b/drivers/iio/light/hid-sensor-prox.c
index 45107f7537b5..f4487620e08b 100644
--- a/drivers/iio/light/hid-sensor-prox.c
+++ b/drivers/iio/light/hid-sensor-prox.c
@@ -277,10 +277,8 @@ static int hid_prox_probe(struct platform_device *pdev)
 
 	indio_dev->channels = kmemdup(prox_channels, sizeof(prox_channels),
 				      GFP_KERNEL);
-	if (!indio_dev->channels) {
-		dev_err(&pdev->dev, "failed to duplicate channels\n");
+	if (!indio_dev->channels)
 		return -ENOMEM;
-	}
 
 	ret = prox_parse_report(pdev, hsdev,
 				(struct iio_chan_spec *)indio_dev->channels,
-- 
2.16.1

^ permalink raw reply related

* Re: [PATCH 7/8] Input: mms114 - add SPDX identifier
From: Marcus Folkesson @ 2018-01-31  7:31 UTC (permalink / raw)
  To: Andi Shyti
  Cc: Dmitry Torokhov, Simon Shields, linux-input, linux-kernel,
	Andi Shyti, jeesw
In-Reply-To: <20180131060726.GB7575@gangnam.samsung>

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

Hi Andy,

On Wed, Jan 31, 2018 at 03:07:26PM +0900, Andi Shyti wrote:
> Hi Dmitry,
> 
> > > -/*
> > > - * Copyright (C) 2012 Samsung Electronics Co.Ltd
> > > - * Author: Joonyoung Shim <jy0922.shim@samsung.com>
> > > - *
> > > - * This program is free software; you can redistribute it and/or modify
> > > - * it under the terms of the GNU General Public License version 2 as
> > > - * published by the Free Software Foundation.
> > > - */
> > > +// SPDX-License-Identifier: GPL-2.0
> > > +// Samsung S6SY761 Touchscreen device driver
> 
> I'm very sorry, but my distrcation will kill me one day.

More coffee or sleep - your choice ;-)

> 
> Is it possible to revert this patch or do you want me to send a
> fix?

When you are on it;

Change
MODULE_LICENSE("GPL");

to 
MODULE_LICENSE("GPL v2");
To match the former license text and SPDX-identifier.

See include/linux/module.h:
 *	"GPL"				[GNU Public License v2 or later]
 *	"GPL v2"			[GNU Public License v2]


Thanks,

> 
> Sorry,
> Andi

Best regards
Marcus Folkesson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply

* Re: [PATCH 7/8] Input: mms114 - add SPDX identifier
From: Andi Shyti @ 2018-01-31  6:07 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Simon Shields, linux-input, linux-kernel, Andi Shyti, jeesw
In-Reply-To: <20180129194659.df7nlhwx4demk6o6@dtor-ws>

Hi Dmitry,

> > -/*
> > - * Copyright (C) 2012 Samsung Electronics Co.Ltd
> > - * Author: Joonyoung Shim <jy0922.shim@samsung.com>
> > - *
> > - * This program is free software; you can redistribute it and/or modify
> > - * it under the terms of the GNU General Public License version 2 as
> > - * published by the Free Software Foundation.
> > - */
> > +// SPDX-License-Identifier: GPL-2.0
> > +// Samsung S6SY761 Touchscreen device driver

I'm very sorry, but my distrcation will kill me one day.

Is it possible to revert this patch or do you want me to send a
fix?

Sorry,
Andi

^ permalink raw reply

* Re: [PATCH v5] input: pxrc: new driver for PhoenixRC Flight Controller Adapter
From: Marcus Folkesson @ 2018-01-30 20:32 UTC (permalink / raw)
  To: Dmitry Torokhov, Jonathan Corbet, Tomohiro Yoshidomi,
	David Herrmann, Philippe Ombredanne, Kate Stewart,
	Greg Kroah-Hartman
  Cc: linux-input, linux-doc, linux-kernel
In-Reply-To: <20180120205840.14506-1-marcus.folkesson@gmail.com>

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

Hello Dmitry,

Do you mind have a look at v5?

Thanks!


On Sat, Jan 20, 2018 at 09:58:40PM +0100, Marcus Folkesson wrote:
> This driver let you plug in your RC controller to the adapter and
> use it as input device in various RC simulators.
> 
> Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
> ---
> 
> v5:
> 	- Drop autosuspend support
> 	- Use pm_mutex instead of input_dev->mutex
> 	- Use pxrc->is_open instead of input_dev->users
> v4:
> 	- Add call to usb_mark_last_busy() in irq
> 	- Move code from pxrc_resume() to pxrc_reset_resume()
> v3:
> 	- Use RUDDER and MISC instead of TILT_X and TILT_Y
> 	- Drop kref and anchor
> 	- Rework URB handling
> 	- Add PM support
> v2:
> 	- Change module license to GPLv2 to match SPDX tag
> 
> 
>  Documentation/input/devices/pxrc.rst |  57 +++++++
>  drivers/input/joystick/Kconfig       |   9 ++
>  drivers/input/joystick/Makefile      |   1 +
>  drivers/input/joystick/pxrc.c        | 303 +++++++++++++++++++++++++++++++++++
>  4 files changed, 370 insertions(+)
>  create mode 100644 Documentation/input/devices/pxrc.rst
>  create mode 100644 drivers/input/joystick/pxrc.c
> 
> diff --git a/Documentation/input/devices/pxrc.rst b/Documentation/input/devices/pxrc.rst
> new file mode 100644
> index 000000000000..ca11f646bae8
> --- /dev/null
> +++ b/Documentation/input/devices/pxrc.rst
> @@ -0,0 +1,57 @@
> +=======================================================
> +pxrc - PhoenixRC Flight Controller Adapter
> +=======================================================
> +
> +:Author: Marcus Folkesson <marcus.folkesson@gmail.com>
> +
> +This driver let you use your own RC controller plugged into the
> +adapter that comes with PhoenixRC [1]_ or other compatible adapters.
> +
> +The adapter supports 7 analog channels and 1 digital input switch.
> +
> +Notes
> +=====
> +
> +Many RC controllers is able to configure which stick goes to which channel.
> +This is also configurable in most simulators, so a matching is not necessary.
> +
> +The driver is generating the following input event for analog channels:
> +
> ++---------+----------------+
> +| Channel |      Event     |
> ++=========+================+
> +|     1   |  ABS_X         |
> ++---------+----------------+
> +|     2   |  ABS_Y         |
> ++---------+----------------+
> +|     3   |  ABS_RX        |
> ++---------+----------------+
> +|     4   |  ABS_RY        |
> ++---------+----------------+
> +|     5   |  ABS_RUDDER    |
> ++---------+----------------+
> +|     6   |  ABS_THROTTLE  |
> ++---------+----------------+
> +|     7   |  ABS_MISC      |
> ++---------+----------------+
> +
> +The digital input switch is generated as an `BTN_A` event.
> +
> +Manual Testing
> +==============
> +
> +To test this driver's functionality you may use `input-event` which is part of
> +the `input layer utilities` suite [2]_.
> +
> +For example::
> +
> +    > modprobe pxrc
> +    > input-events <devnr>
> +
> +To print all input events from input `devnr`.
> +
> +References
> +==========
> +
> +.. [1] http://www.phoenix-sim.com/
> +.. [2] https://www.kraxel.org/cgit/input/
> diff --git a/drivers/input/joystick/Kconfig b/drivers/input/joystick/Kconfig
> index f3c2f6ea8b44..332c0cc1b2ab 100644
> --- a/drivers/input/joystick/Kconfig
> +++ b/drivers/input/joystick/Kconfig
> @@ -351,4 +351,13 @@ config JOYSTICK_PSXPAD_SPI_FF
>  
>  	  To drive rumble motor a dedicated power supply is required.
>  
> +config JOYSTICK_PXRC
> +	tristate "PhoenixRC Flight Controller Adapter"
> +	depends on USB_ARCH_HAS_HCD
> +	depends on USB
> +	help
> +	  Say Y here if you want to use the PhoenixRC Flight Controller Adapter.
> +
> +	  To compile this driver as a module, choose M here: the
> +	  module will be called pxrc.
>  endif
> diff --git a/drivers/input/joystick/Makefile b/drivers/input/joystick/Makefile
> index 67651efda2e1..dd0492ebbed7 100644
> --- a/drivers/input/joystick/Makefile
> +++ b/drivers/input/joystick/Makefile
> @@ -23,6 +23,7 @@ obj-$(CONFIG_JOYSTICK_JOYDUMP)		+= joydump.o
>  obj-$(CONFIG_JOYSTICK_MAGELLAN)		+= magellan.o
>  obj-$(CONFIG_JOYSTICK_MAPLE)		+= maplecontrol.o
>  obj-$(CONFIG_JOYSTICK_PSXPAD_SPI)	+= psxpad-spi.o
> +obj-$(CONFIG_JOYSTICK_PXRC)			+= pxrc.o
>  obj-$(CONFIG_JOYSTICK_SIDEWINDER)	+= sidewinder.o
>  obj-$(CONFIG_JOYSTICK_SPACEBALL)	+= spaceball.o
>  obj-$(CONFIG_JOYSTICK_SPACEORB)		+= spaceorb.o
> diff --git a/drivers/input/joystick/pxrc.c b/drivers/input/joystick/pxrc.c
> new file mode 100644
> index 000000000000..07a0dbd3ced2
> --- /dev/null
> +++ b/drivers/input/joystick/pxrc.c
> @@ -0,0 +1,303 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Driver for Phoenix RC Flight Controller Adapter
> + *
> + * Copyright (C) 2018 Marcus Folkesson <marcus.folkesson@gmail.com>
> + *
> + */
> +
> +#include <linux/kernel.h>
> +#include <linux/errno.h>
> +#include <linux/slab.h>
> +#include <linux/module.h>
> +#include <linux/uaccess.h>
> +#include <linux/usb.h>
> +#include <linux/usb/input.h>
> +#include <linux/mutex.h>
> +#include <linux/input.h>
> +
> +#define PXRC_VENDOR_ID	(0x1781)
> +#define PXRC_PRODUCT_ID	(0x0898)
> +
> +static const struct usb_device_id pxrc_table[] = {
> +	{ USB_DEVICE(PXRC_VENDOR_ID, PXRC_PRODUCT_ID) },
> +	{ }
> +};
> +MODULE_DEVICE_TABLE(usb, pxrc_table);
> +
> +struct pxrc {
> +	struct input_dev	*input;
> +	struct usb_device	*udev;
> +	struct usb_interface	*intf;
> +	struct urb		*urb;
> +	struct mutex		pm_mutex;
> +	bool			is_open;
> +	__u8			epaddr;
> +	char			phys[64];
> +	unsigned char           *data;
> +	size_t			bsize;
> +};
> +
> +static void pxrc_usb_irq(struct urb *urb)
> +{
> +	struct pxrc *pxrc = urb->context;
> +	int error;
> +
> +	switch (urb->status) {
> +	case 0:
> +		/* success */
> +		break;
> +	case -ETIME:
> +		/* this urb is timing out */
> +		dev_dbg(&pxrc->intf->dev,
> +			"%s - urb timed out - was the device unplugged?\n",
> +			__func__);
> +		return;
> +	case -ECONNRESET:
> +	case -ENOENT:
> +	case -ESHUTDOWN:
> +	case -EPIPE:
> +		/* this urb is terminated, clean up */
> +		dev_dbg(&pxrc->intf->dev, "%s - urb shutting down with status: %d\n",
> +			__func__, urb->status);
> +		return;
> +	default:
> +		dev_dbg(&pxrc->intf->dev, "%s - nonzero urb status received: %d\n",
> +			__func__, urb->status);
> +		goto exit;
> +	}
> +
> +	if (urb->actual_length == 8) {
> +		input_report_abs(pxrc->input, ABS_X, pxrc->data[0]);
> +		input_report_abs(pxrc->input, ABS_Y, pxrc->data[2]);
> +		input_report_abs(pxrc->input, ABS_RX, pxrc->data[3]);
> +		input_report_abs(pxrc->input, ABS_RY, pxrc->data[4]);
> +		input_report_abs(pxrc->input, ABS_RUDDER, pxrc->data[5]);
> +		input_report_abs(pxrc->input, ABS_THROTTLE, pxrc->data[6]);
> +		input_report_abs(pxrc->input, ABS_MISC, pxrc->data[7]);
> +
> +		input_report_key(pxrc->input, BTN_A, pxrc->data[1]);
> +	}
> +
> +exit:
> +	/* Resubmit to fetch new fresh URBs */
> +	error = usb_submit_urb(urb, GFP_ATOMIC);
> +	if (error && error != -EPERM)
> +		dev_err(&pxrc->intf->dev,
> +			"%s - usb_submit_urb failed with result: %d",
> +			__func__, error);
> +}
> +
> +static int pxrc_open(struct input_dev *input)
> +{
> +	struct pxrc *pxrc = input_get_drvdata(input);
> +	int retval;
> +
> +	mutex_lock(&pxrc->pm_mutex);
> +	retval = usb_submit_urb(pxrc->urb, GFP_KERNEL);
> +	if (retval) {
> +		dev_err(&pxrc->intf->dev,
> +			"%s - usb_submit_urb failed, error: %d\n",
> +			__func__, retval);
> +		retval = -EIO;
> +		goto out;
> +	}
> +
> +	pxrc->is_open = true;
> +
> +out:
> +	mutex_unlock(&pxrc->pm_mutex);
> +	return retval;
> +}
> +
> +static void pxrc_close(struct input_dev *input)
> +{
> +	struct pxrc *pxrc = input_get_drvdata(input);
> +
> +	mutex_lock(&pxrc->pm_mutex);
> +	usb_kill_urb(pxrc->urb);
> +	pxrc->is_open = false;
> +	mutex_unlock(&pxrc->pm_mutex);
> +}
> +
> +static int pxrc_usb_init(struct pxrc *pxrc)
> +{
> +	struct usb_endpoint_descriptor *epirq;
> +	unsigned int pipe;
> +	int retval;
> +
> +	/* Set up the endpoint information */
> +	/* This device only has an interrupt endpoint */
> +	retval = usb_find_common_endpoints(pxrc->intf->cur_altsetting,
> +			NULL, NULL, &epirq, NULL);
> +	if (retval) {
> +		dev_err(&pxrc->intf->dev,
> +			"Could not find endpoint\n");
> +		goto error;
> +	}
> +
> +	pxrc->bsize = usb_endpoint_maxp(epirq);
> +	pxrc->epaddr = epirq->bEndpointAddress;
> +	pxrc->data = devm_kmalloc(&pxrc->intf->dev, pxrc->bsize, GFP_KERNEL);
> +	if (!pxrc->data) {
> +		retval = -ENOMEM;
> +		goto error;
> +	}
> +
> +	usb_set_intfdata(pxrc->intf, pxrc);
> +	usb_make_path(pxrc->udev, pxrc->phys, sizeof(pxrc->phys));
> +	strlcat(pxrc->phys, "/input0", sizeof(pxrc->phys));
> +
> +	pxrc->urb = usb_alloc_urb(0, GFP_KERNEL);
> +	if (!pxrc->urb) {
> +		retval = -ENOMEM;
> +		goto error;
> +	}
> +
> +	pipe = usb_rcvintpipe(pxrc->udev, pxrc->epaddr),
> +	usb_fill_int_urb(pxrc->urb, pxrc->udev, pipe, pxrc->data, pxrc->bsize,
> +						pxrc_usb_irq, pxrc, 1);
> +
> +error:
> +	return retval;
> +
> +
> +}
> +
> +static int pxrc_input_init(struct pxrc *pxrc)
> +{
> +	pxrc->input = devm_input_allocate_device(&pxrc->intf->dev);
> +	if (pxrc->input == NULL) {
> +		dev_err(&pxrc->intf->dev, "couldn't allocate input device\n");
> +		return -ENOMEM;
> +	}
> +
> +	pxrc->input->name = "PXRC Flight Controller Adapter";
> +	pxrc->input->phys = pxrc->phys;
> +	usb_to_input_id(pxrc->udev, &pxrc->input->id);
> +
> +	pxrc->input->open = pxrc_open;
> +	pxrc->input->close = pxrc_close;
> +
> +	input_set_capability(pxrc->input, EV_KEY, BTN_A);
> +	input_set_abs_params(pxrc->input, ABS_X, 0, 255, 0, 0);
> +	input_set_abs_params(pxrc->input, ABS_Y, 0, 255, 0, 0);
> +	input_set_abs_params(pxrc->input, ABS_RX, 0, 255, 0, 0);
> +	input_set_abs_params(pxrc->input, ABS_RY, 0, 255, 0, 0);
> +	input_set_abs_params(pxrc->input, ABS_RUDDER, 0, 255, 0, 0);
> +	input_set_abs_params(pxrc->input, ABS_THROTTLE, 0, 255, 0, 0);
> +	input_set_abs_params(pxrc->input, ABS_MISC, 0, 255, 0, 0);
> +
> +	input_set_drvdata(pxrc->input, pxrc);
> +
> +	return input_register_device(pxrc->input);
> +}
> +
> +static int pxrc_probe(struct usb_interface *intf,
> +		      const struct usb_device_id *id)
> +{
> +	struct pxrc *pxrc;
> +	int retval;
> +
> +	pxrc = devm_kzalloc(&intf->dev, sizeof(*pxrc), GFP_KERNEL);
> +	if (!pxrc)
> +		return -ENOMEM;
> +
> +	mutex_init(&pxrc->pm_mutex);
> +	pxrc->udev = usb_get_dev(interface_to_usbdev(intf));
> +	pxrc->intf = intf;
> +
> +	retval = pxrc_usb_init(pxrc);
> +	if (retval)
> +		goto error;
> +
> +	retval = pxrc_input_init(pxrc);
> +	if (retval)
> +		goto err_free_urb;
> +
> +	return 0;
> +
> +err_free_urb:
> +	usb_free_urb(pxrc->urb);
> +
> +error:
> +	return retval;
> +}
> +
> +static void pxrc_disconnect(struct usb_interface *intf)
> +{
> +	struct pxrc *pxrc = usb_get_intfdata(intf);
> +
> +	usb_free_urb(pxrc->urb);
> +	usb_set_intfdata(intf, NULL);
> +}
> +
> +static int pxrc_suspend(struct usb_interface *intf, pm_message_t message)
> +{
> +	struct pxrc *pxrc = usb_get_intfdata(intf);
> +
> +	mutex_lock(&pxrc->pm_mutex);
> +	if (pxrc->is_open)
> +		usb_kill_urb(pxrc->urb);
> +	mutex_unlock(&pxrc->pm_mutex);
> +
> +	return 0;
> +}
> +
> +static int pxrc_resume(struct usb_interface *intf)
> +{
> +	struct pxrc *pxrc = usb_get_intfdata(intf);
> +	int retval = 0;
> +
> +	mutex_lock(&pxrc->pm_mutex);
> +	if (pxrc->is_open && usb_submit_urb(pxrc->urb, GFP_KERNEL) < 0)
> +		retval = -EIO;
> +
> +	mutex_unlock(&pxrc->pm_mutex);
> +	return retval;
> +}
> +
> +static int pxrc_pre_reset(struct usb_interface *intf)
> +{
> +	struct pxrc *pxrc = usb_get_intfdata(intf);
> +
> +	mutex_lock(&pxrc->pm_mutex);
> +	usb_kill_urb(pxrc->urb);
> +	return 0;
> +}
> +
> +static int pxrc_post_reset(struct usb_interface *intf)
> +{
> +	struct pxrc *pxrc = usb_get_intfdata(intf);
> +	int retval = 0;
> +
> +	if (pxrc->is_open && usb_submit_urb(pxrc->urb, GFP_KERNEL) < 0)
> +		retval = -EIO;
> +
> +	mutex_unlock(&pxrc->pm_mutex);
> +
> +	return retval;
> +}
> +
> +static int pxrc_reset_resume(struct usb_interface *intf)
> +{
> +	return pxrc_resume(intf);
> +}
> +
> +static struct usb_driver pxrc_driver = {
> +	.name =		"pxrc",
> +	.probe =	pxrc_probe,
> +	.disconnect =	pxrc_disconnect,
> +	.id_table =	pxrc_table,
> +	.suspend	= pxrc_suspend,
> +	.resume		= pxrc_resume,
> +	.pre_reset	= pxrc_pre_reset,
> +	.post_reset	= pxrc_post_reset,
> +	.reset_resume	= pxrc_reset_resume,
> +};
> +
> +module_usb_driver(pxrc_driver);
> +
> +MODULE_AUTHOR("Marcus Folkesson <marcus.folkesson@gmail.com>");
> +MODULE_DESCRIPTION("PhoenixRC Flight Controller Adapter");
> +MODULE_LICENSE("GPL v2");
> -- 
> 2.15.1
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply

* Re: i8042 AUX port [serio1] suspend takes a second on Dell XPS 13 9360 and TUXEDO Book 1406
From: Paul Menzel @ 2018-01-30 18:39 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-input, linux-kernel, it+linux-input
In-Reply-To: <20180130180736.ehucqywbz7zdl4v7@dtor-ws>

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

Dear Dmitry,


On 01/30/18 19:07, Dmitry Torokhov wrote:
> On Tue, Jan 30, 2018 at 09:52:45AM -0800, Dmitry Torokhov wrote:

>> On Tue, Jan 30, 2018 at 06:36:34PM +0100, Paul Menzel wrote:

>>> I do not know, when it started, but with Linux 4.14-rc8 and 4.15,
>>> benchmarking suspend and resume time with `sleepgraph.py` [1][2], there is a
>>> regression, that i8042 AUX port [serio1] suspend takes a second on Dell XPS
>>> 13 9360 and TUXEDO Book 1406.
>>
>> It would be really helpful to know when the regression started.
> 
> So the reason it takes longer is because the touchpad does not want to
> talk to us for some reason and we wait until commands time out:
> 
> [   94.591636] calling  serio1+ @ 2299, parent: i8042
> [   94.794292] psmouse serio1: Failed to disable mouse on isa0060/serio1
> [   95.593303] call serio1+ returned 0 after 974280 usecs
> 
> but it is not clear why it happens, I do not think we changed anything
> in that path for a while, so it might be some other change affecting
> things indirectly. I'm afraid you'll have to narrow the scope, and
> ideally bisect.

Thank you for looking into this. Just to note, that it worked with Linux 
4.14.1 from Ubuntu 17.10, so it’s probably something in 4.15. Bisecting 
will take a bit, as the FTRACE stuff broke in Linux 4.15-rc1 and was 
only fixed in 4.15-rc9. Hopefully, it’s just one commit I need to 
backport. I’ll get back to you hopefully at the end of the week.


Kind regards,

Paul


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 5174 bytes --]

^ 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