Linux Input/HID development
 help / color / mirror / Atom feed
* [PATCH 0/6] mfd: da9063: remove platform_data
From: Wolfram Sang @ 2019-03-18 15:47 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-renesas-soc, Lee Jones, Mark Brown, Support Opensource,
	Wolfram Sang, linux-input

When working with this driver while debugging something else, I noticed that
there are no in-kernel users of platform_data anymore. Removing the support
simplifies the code and gets rid of quite some lines. The biggest refactoring
went to the regulator driver which could maybe benefit from more
refactorization. However, there is no in-kernel user of that driver, so no
testing. I left it at this stage. I think the changes are still at a level
where review and build-testing will give enough confidence.

Besides the regulator thing, it was tested on a Renesas Lager board (R-Car H2).
No regressions encountered. buildbot was happy, too.

The patches are based on v5.1-rc1. I'd vote for all of them going through the
MFD tree. Looking forward to comments!

   Wolfram


Wolfram Sang (6):
  regulator: da9063: remove platform_data support
  input: da9063_onkey: remove platform_data support
  mfd: da9063: remove platform_data support
  regulator: da9063: move definitions out of a header into the driver
  mfd: da9063: remove leftover platform_data definitions
  regulator: da9063: platform_data is gone, depend on OF

 drivers/input/misc/da9063_onkey.c    |  11 +---
 drivers/mfd/da9063-core.c            |  20 +-----
 drivers/mfd/da9063-i2c.c             |   1 -
 drivers/mfd/da9063-irq.c             |   1 -
 drivers/regulator/Kconfig            |   2 +-
 drivers/regulator/da9063-regulator.c |  61 +++++++++++++------
 include/linux/mfd/da9063/pdata.h     | 114 -----------------------------------
 7 files changed, 49 insertions(+), 161 deletions(-)
 delete mode 100644 include/linux/mfd/da9063/pdata.h

-- 
2.11.0

^ permalink raw reply

* Re: [PATCH] HID: Increase maximum report size allowed by hid_field_extract()
From: Jiri Kosina @ 2019-03-18 13:48 UTC (permalink / raw)
  To: Kai-Heng Feng; +Cc: benjamin.tissoires, linux-input, linux-kernel
In-Reply-To: <20190308051117.21899-1-kai.heng.feng@canonical.com>

On Fri, 8 Mar 2019, Kai-Heng Feng wrote:

> Commit 71f6fa90a353 ("HID: increase maximum global item tag report size
> to 256") increases the max report size from 128 to 256.
> 
> We also need to update the report size in hid_field_extract() otherwise
> it complains and truncates now valid report size:
> [ 406.165461] hid-sensor-hub 001F:8086:22D8.0002: hid_field_extract() called with n (192) > 32! (kworker/5:1)
> 
> BugLink: https://bugs.launchpad.net/bugs/1818547
> Fixes: 71f6fa90a353 ("HID: increase maximum global item tag report size to 256")
> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>

Applied, thanks.

-- 
Jiri Kosina
SUSE Labs

^ permalink raw reply

* Re: [PATCH] HID: steam: fix deadlock with input devices.
From: Jiri Kosina @ 2019-03-18 13:44 UTC (permalink / raw)
  To: Rodrigo Rivas Costa
  Cc: Benjamin Tissoires, Pierre-Loup A. Griffais, lkml, linux-input,
	Simon Gene Gottlieb
In-Reply-To: <20190315190910.4602-1-rodrigorivascosta@gmail.com>

On Fri, 15 Mar 2019, Rodrigo Rivas Costa wrote:

> When using this driver with the wireless dongle and some usermode
> program that monitors every input device (acpid, for example), while
> another usermode client opens and closes the low-level device
> repeadedly, the system eventually deadlocks.
> 
> The reason is that steam_input_register_device() must not be called with
> the mutex held, because the input subsystem has its own synchronization
> that clashes with this one: it is possible that steam_input_open() is
> called before input_register_device() returns, and since
> steam_input_open() needs to lock the mutex, it deadlocks.
> 
> However we must hold the mutex when calling any function that sends
> commands to the controller. If not, random commands end up falling fail.
> 
> Reported-by: Simon Gene Gottlieb <simon@gottliebtfreitag.de>
> Signed-off-by: Rodrigo Rivas Costa <rodrigorivascosta@gmail.com>
> Tested-by: Simon Gene Gottlieb <simon@gottliebtfreitag.de>

Applied to for-5.1/upstream-fixes, thanks.

-- 
Jiri Kosina
SUSE Labs

^ permalink raw reply

* Re: [PATCH v6 0/4] input: touchscreen: Add goodix GT5553 CTP support
From: Jagan Teki @ 2019-03-17 18:32 UTC (permalink / raw)
  To: Dmitry Torokhov, Bastien Nocera, Rob Herring
  Cc: Henrik Rydberg, linux-input, linux-kernel, devicetree,
	Mark Rutland, linux-amarula, Michael Trimarchi
In-Reply-To: <CAMty3ZAmPzXvM+xS3+ULorGuQ-rKfMRNi-HvQdr7hjaFYfMZrg@mail.gmail.com>

Hi Dmitry,

On Mon, Mar 11, 2019 at 7:08 PM Jagan Teki <jagan@amarulasolutions.com> wrote:
>
> On Wed, Mar 6, 2019 at 10:47 PM Jagan Teki <jagan@amarulasolutions.com> wrote:
> >
> > Hi Dmitry,
> >
> > On Tue, Feb 26, 2019 at 11:43 AM Jagan Teki <jagan@amarulasolutions.com> wrote:
> > >
> > > Hi Dmitry,
> > >
> > > On Tue, Feb 19, 2019 at 3:46 PM Jagan Teki <jagan@amarulasolutions.com> wrote:
> > > >
> > > > This is v6 patchset for supporting goodix GT5553 CTP. Here is the
> > > > previous version[1]
> > > >
> > > > Changes for v5:
> > > > - document bindings for required regulators, which are need during
> > > >   power-on sequence
> > > > - enable, disable required regulators as described in power-on sequence
> > > >   using normal regulator calls
> > > > - update the proper commi messages
> > > > Changes for v4:
> > > > - document AVDD22, DVDD12, VDDIO as optional properties
> > > > - use regulator bulk calls, for get, enable and disable functionalities
> > > > Changes for v4:
> > > > - devm_add_action_or_reset for disabling regulator
> > > > Changes for v3:
> > > > - add cover-letter
> > > > - s/ADVV28/AVDD28 on commit head
> > > > - fix few typo
> > > > Changes for v2:
> > > > - Rename vcc-supply with AVDD28-supply
> > > > - disable regulator in remove
> > > > - fix to setup regulator in probe code
> > > > - add chipdata
> > > > - drop example node in dt-bindings
> > > >
> > > > [1] https://patchwork.kernel.org/cover/10816901/
> > > >
> > > > Jagan Teki (4):
> > > >   dt-bindings: input: touchscreen: goodix: Document regulator properties
> > > >   Input: goodix - Add regulators suppot
> > > >   dt-bindings: input: touchscreen: goodix: Add GT5663 compatible
> > > >   Input: goodix - Add GT5663 CTP support
> > > >
> > > >  .../bindings/input/touchscreen/goodix.txt     |  3 +
> > > >  drivers/input/touchscreen/goodix.c            | 60 +++++++++++++++++++
> > > >  2 files changed, 63 insertions(+)
> > >
> > > Let me know if you have any further comments on regulator patch, fyi
> > > Rob reviewed it already.
> >
> > Would you comment on this? few dts changes are pending for this to support.
>
> Gentle remainder.

It's been several weeks, any further comments?

^ permalink raw reply

* [PATCH] HID: steam: fix deadlock with input devices.
From: Rodrigo Rivas Costa @ 2019-03-15 19:09 UTC (permalink / raw)
  To: Benjamin Tissoires, Jiri Kosina, Pierre-Loup A. Griffais, lkml,
	linux-input, Simon Gene Gottlieb
  Cc: Rodrigo Rivas Costa

When using this driver with the wireless dongle and some usermode
program that monitors every input device (acpid, for example), while
another usermode client opens and closes the low-level device
repeadedly, the system eventually deadlocks.

The reason is that steam_input_register_device() must not be called with
the mutex held, because the input subsystem has its own synchronization
that clashes with this one: it is possible that steam_input_open() is
called before input_register_device() returns, and since
steam_input_open() needs to lock the mutex, it deadlocks.

However we must hold the mutex when calling any function that sends
commands to the controller. If not, random commands end up falling fail.

Reported-by: Simon Gene Gottlieb <simon@gottliebtfreitag.de>
Signed-off-by: Rodrigo Rivas Costa <rodrigorivascosta@gmail.com>
Tested-by: Simon Gene Gottlieb <simon@gottliebtfreitag.de>
---
 drivers/hid/hid-steam.c | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git a/drivers/hid/hid-steam.c b/drivers/hid/hid-steam.c
index 8141cadfca0e..8dae0f9b819e 100644
--- a/drivers/hid/hid-steam.c
+++ b/drivers/hid/hid-steam.c
@@ -499,6 +499,7 @@ static void steam_battery_unregister(struct steam_device *steam)
 static int steam_register(struct steam_device *steam)
 {
 	int ret;
+	bool client_opened;
 
 	/*
 	 * This function can be called several times in a row with the
@@ -511,9 +512,11 @@ static int steam_register(struct steam_device *steam)
 		 * Unlikely, but getting the serial could fail, and it is not so
 		 * important, so make up a serial number and go on.
 		 */
+		mutex_lock(&steam->mutex);
 		if (steam_get_serial(steam) < 0)
 			strlcpy(steam->serial_no, "XXXXXXXXXX",
 					sizeof(steam->serial_no));
+		mutex_unlock(&steam->mutex);
 
 		hid_info(steam->hdev, "Steam Controller '%s' connected",
 				steam->serial_no);
@@ -528,13 +531,15 @@ static int steam_register(struct steam_device *steam)
 	}
 
 	mutex_lock(&steam->mutex);
-	if (!steam->client_opened) {
+	client_opened = steam->client_opened;
+	if (!client_opened)
 		steam_set_lizard_mode(steam, lizard_mode);
+	mutex_unlock(&steam->mutex);
+
+	if (!client_opened)
 		ret = steam_input_register(steam);
-	} else {
+	else
 		ret = 0;
-	}
-	mutex_unlock(&steam->mutex);
 
 	return ret;
 }
@@ -630,14 +635,21 @@ static void steam_client_ll_close(struct hid_device *hdev)
 {
 	struct steam_device *steam = hdev->driver_data;
 
+	unsigned long flags;
+	bool connected;
+
+	spin_lock_irqsave(&steam->lock, flags);
+	connected = steam->connected;
+	spin_unlock_irqrestore(&steam->lock, flags);
+
 	mutex_lock(&steam->mutex);
 	steam->client_opened = false;
+	if (connected)
+		steam_set_lizard_mode(steam, lizard_mode);
 	mutex_unlock(&steam->mutex);
 
-	if (steam->connected) {
-		steam_set_lizard_mode(steam, lizard_mode);
+	if (connected)
 		steam_input_register(steam);
-	}
 }
 
 static int steam_client_ll_raw_request(struct hid_device *hdev,
-- 
2.21.0

^ permalink raw reply related

* Re: [PATCH] platform/x86: touchscreen_dmi: Add info for Myria MY8307 2-in-1
From: Andy Shevchenko @ 2019-03-15 18:43 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Gabriel Lazar, Darren Hart, Andy Shevchenko, linux-input,
	Platform Driver, Linux Kernel Mailing List
In-Reply-To: <12a67eb2-18ff-dd9f-4c48-4d01a01a2aa7@redhat.com>

On Fri, Mar 15, 2019 at 7:47 PM Hans de Goede <hdegoede@redhat.com> wrote:
>
> Hi,
>
> On 3/15/19 2:31 PM, Gabriel Lazar wrote:
> > Add touchscreen platform data for the Myrya MY8307 2-in-1 laptop.
> >
> > Signed-off-by: Gabriel Lazar <gabriel.lazar@com.utcluj.ro>
>
> Patch looks good to me:
>
> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
>

OK, thanks for explanation.
I'll take it after merge window will be closed.

> Regards,
>
> Hans
>
>
>
> > ---
> >   drivers/platform/x86/touchscreen_dmi.c | 25 +++++++++++++++++++++++++
> >   1 file changed, 25 insertions(+)
> >
> > diff --git a/drivers/platform/x86/touchscreen_dmi.c b/drivers/platform/x86/touchscreen_dmi.c
> > index 2d56ff7c8230..3319f0cbb558 100644
> > --- a/drivers/platform/x86/touchscreen_dmi.c
> > +++ b/drivers/platform/x86/touchscreen_dmi.c
> > @@ -265,6 +265,23 @@ static const struct ts_dmi_data jumper_ezpad_mini3_data = {
> >       .properties     = jumper_ezpad_mini3_props,
> >   };
> >
> > +static const struct property_entry myria_my8307_props[] = {
> > +     PROPERTY_ENTRY_U32("touchscreen-size-x", 1720),
> > +     PROPERTY_ENTRY_U32("touchscreen-size-y", 1140),
> > +     PROPERTY_ENTRY_BOOL("touchscreen-inverted-x"),
> > +     PROPERTY_ENTRY_BOOL("touchscreen-inverted-y"),
> > +     PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
> > +     PROPERTY_ENTRY_STRING("firmware-name", "gsl1680-myria-my8307.fw"),
> > +     PROPERTY_ENTRY_U32("silead,max-fingers", 10),
> > +     PROPERTY_ENTRY_BOOL("silead,home-button"),
> > +     { }
> > +};
> > +
> > +static const struct ts_dmi_data myria_my8307_data = {
> > +     .acpi_name      = "MSSL1680:00",
> > +     .properties     = myria_my8307_props,
> > +};
> > +
> >   static const struct property_entry onda_obook_20_plus_props[] = {
> >       PROPERTY_ENTRY_U32("touchscreen-size-x", 1728),
> >       PROPERTY_ENTRY_U32("touchscreen-size-y", 1148),
> > @@ -690,6 +707,14 @@ static const struct dmi_system_id touchscreen_dmi_table[] = {
> >                       DMI_MATCH(DMI_PRODUCT_NAME, "FlexBook edge11 - M-FBE11"),
> >               },
> >       },
> > +     {
> > +             /* Myria MY8307 */
> > +             .driver_data = (void *)&myria_my8307_data,
> > +             .matches = {
> > +                     DMI_MATCH(DMI_SYS_VENDOR, "Complet Electro Serv"),
> > +                     DMI_MATCH(DMI_PRODUCT_NAME, "MY8307"),
> > +             },
> > +     },
> >       {
> >               /* Onda oBook 20 Plus */
> >               .driver_data = (void *)&onda_obook_20_plus_data,
> >



-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply

* Re: [PATCH] platform/x86: touchscreen_dmi: Add info for Myria MY8307 2-in-1
From: Hans de Goede @ 2019-03-15 17:47 UTC (permalink / raw)
  To: Gabriel Lazar
  Cc: Darren Hart, Andy Shevchenko, linux-input, platform-driver-x86,
	linux-kernel
In-Reply-To: <20190315133113.21215-1-gabriel.lazar@com.utcluj.ro>

Hi,

On 3/15/19 2:31 PM, Gabriel Lazar wrote:
> Add touchscreen platform data for the Myrya MY8307 2-in-1 laptop.
> 
> Signed-off-by: Gabriel Lazar <gabriel.lazar@com.utcluj.ro>

Patch looks good to me:

Reviewed-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans



> ---
>   drivers/platform/x86/touchscreen_dmi.c | 25 +++++++++++++++++++++++++
>   1 file changed, 25 insertions(+)
> 
> diff --git a/drivers/platform/x86/touchscreen_dmi.c b/drivers/platform/x86/touchscreen_dmi.c
> index 2d56ff7c8230..3319f0cbb558 100644
> --- a/drivers/platform/x86/touchscreen_dmi.c
> +++ b/drivers/platform/x86/touchscreen_dmi.c
> @@ -265,6 +265,23 @@ static const struct ts_dmi_data jumper_ezpad_mini3_data = {
>   	.properties	= jumper_ezpad_mini3_props,
>   };
>   
> +static const struct property_entry myria_my8307_props[] = {
> +	PROPERTY_ENTRY_U32("touchscreen-size-x", 1720),
> +	PROPERTY_ENTRY_U32("touchscreen-size-y", 1140),
> +	PROPERTY_ENTRY_BOOL("touchscreen-inverted-x"),
> +	PROPERTY_ENTRY_BOOL("touchscreen-inverted-y"),
> +	PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
> +	PROPERTY_ENTRY_STRING("firmware-name", "gsl1680-myria-my8307.fw"),
> +	PROPERTY_ENTRY_U32("silead,max-fingers", 10),
> +	PROPERTY_ENTRY_BOOL("silead,home-button"),
> +	{ }
> +};
> +
> +static const struct ts_dmi_data myria_my8307_data = {
> +	.acpi_name	= "MSSL1680:00",
> +	.properties	= myria_my8307_props,
> +};
> +
>   static const struct property_entry onda_obook_20_plus_props[] = {
>   	PROPERTY_ENTRY_U32("touchscreen-size-x", 1728),
>   	PROPERTY_ENTRY_U32("touchscreen-size-y", 1148),
> @@ -690,6 +707,14 @@ static const struct dmi_system_id touchscreen_dmi_table[] = {
>   			DMI_MATCH(DMI_PRODUCT_NAME, "FlexBook edge11 - M-FBE11"),
>   		},
>   	},
> +	{
> +		/* Myria MY8307 */
> +		.driver_data = (void *)&myria_my8307_data,
> +		.matches = {
> +			DMI_MATCH(DMI_SYS_VENDOR, "Complet Electro Serv"),
> +			DMI_MATCH(DMI_PRODUCT_NAME, "MY8307"),
> +		},
> +	},
>   	{
>   		/* Onda oBook 20 Plus */
>   		.driver_data = (void *)&onda_obook_20_plus_data,
> 

^ permalink raw reply

* Re: [PATCH] platform/x86: touchscreen_dmi: Add info for Myria MY8307 2-in-1
From: Hans de Goede @ 2019-03-15 17:39 UTC (permalink / raw)
  To: Andy Shevchenko, Gabriel Lazar
  Cc: Darren Hart, Andy Shevchenko, linux-input, Platform Driver,
	Linux Kernel Mailing List
In-Reply-To: <CAHp75VeQ=6zD5tVV_gVE4S3CDWaYgQ0Lpqq57bxjQjqJYerUAQ@mail.gmail.com>

Hi,

On 3/15/19 6:33 PM, Andy Shevchenko wrote:
> On Fri, Mar 15, 2019 at 3:31 PM Gabriel Lazar
> <gabriel.lazar@com.utcluj.ro> wrote:
>>
>> Add touchscreen platform data for the Myrya MY8307 2-in-1 laptop.
> 
> You sent one patch twice or two patches?
> Please, clarify this by sending v2 with correct subject line(s) and
> amount of patches.

Gabriel send the same patch twice, the first version came from
his yahoo email address, which vger bounced (but the direct addressed
people received), so he send a second copy from his other email address.

Regards,

Hans




> 
>>
>> Signed-off-by: Gabriel Lazar <gabriel.lazar@com.utcluj.ro>
>> ---
>>   drivers/platform/x86/touchscreen_dmi.c | 25 +++++++++++++++++++++++++
>>   1 file changed, 25 insertions(+)
>>
>> diff --git a/drivers/platform/x86/touchscreen_dmi.c b/drivers/platform/x86/touchscreen_dmi.c
>> index 2d56ff7c8230..3319f0cbb558 100644
>> --- a/drivers/platform/x86/touchscreen_dmi.c
>> +++ b/drivers/platform/x86/touchscreen_dmi.c
>> @@ -265,6 +265,23 @@ static const struct ts_dmi_data jumper_ezpad_mini3_data = {
>>          .properties     = jumper_ezpad_mini3_props,
>>   };
>>
>> +static const struct property_entry myria_my8307_props[] = {
>> +       PROPERTY_ENTRY_U32("touchscreen-size-x", 1720),
>> +       PROPERTY_ENTRY_U32("touchscreen-size-y", 1140),
>> +       PROPERTY_ENTRY_BOOL("touchscreen-inverted-x"),
>> +       PROPERTY_ENTRY_BOOL("touchscreen-inverted-y"),
>> +       PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
>> +       PROPERTY_ENTRY_STRING("firmware-name", "gsl1680-myria-my8307.fw"),
>> +       PROPERTY_ENTRY_U32("silead,max-fingers", 10),
>> +       PROPERTY_ENTRY_BOOL("silead,home-button"),
>> +       { }
>> +};
>> +
>> +static const struct ts_dmi_data myria_my8307_data = {
>> +       .acpi_name      = "MSSL1680:00",
>> +       .properties     = myria_my8307_props,
>> +};
>> +
>>   static const struct property_entry onda_obook_20_plus_props[] = {
>>          PROPERTY_ENTRY_U32("touchscreen-size-x", 1728),
>>          PROPERTY_ENTRY_U32("touchscreen-size-y", 1148),
>> @@ -690,6 +707,14 @@ static const struct dmi_system_id touchscreen_dmi_table[] = {
>>                          DMI_MATCH(DMI_PRODUCT_NAME, "FlexBook edge11 - M-FBE11"),
>>                  },
>>          },
>> +       {
>> +               /* Myria MY8307 */
>> +               .driver_data = (void *)&myria_my8307_data,
>> +               .matches = {
>> +                       DMI_MATCH(DMI_SYS_VENDOR, "Complet Electro Serv"),
>> +                       DMI_MATCH(DMI_PRODUCT_NAME, "MY8307"),
>> +               },
>> +       },
>>          {
>>                  /* Onda oBook 20 Plus */
>>                  .driver_data = (void *)&onda_obook_20_plus_data,
>> --
>> 2.21.0
>>
> 
> 

^ permalink raw reply

* Re: [PATCH] platform/x86: touchscreen_dmi: Add info for Myria MY8307 2-in-1
From: Andy Shevchenko @ 2019-03-15 17:33 UTC (permalink / raw)
  To: Gabriel Lazar
  Cc: Hans de Goede, Darren Hart, Andy Shevchenko, linux-input,
	Platform Driver, Linux Kernel Mailing List
In-Reply-To: <20190315133113.21215-1-gabriel.lazar@com.utcluj.ro>

On Fri, Mar 15, 2019 at 3:31 PM Gabriel Lazar
<gabriel.lazar@com.utcluj.ro> wrote:
>
> Add touchscreen platform data for the Myrya MY8307 2-in-1 laptop.

You sent one patch twice or two patches?
Please, clarify this by sending v2 with correct subject line(s) and
amount of patches.

>
> Signed-off-by: Gabriel Lazar <gabriel.lazar@com.utcluj.ro>
> ---
>  drivers/platform/x86/touchscreen_dmi.c | 25 +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
>
> diff --git a/drivers/platform/x86/touchscreen_dmi.c b/drivers/platform/x86/touchscreen_dmi.c
> index 2d56ff7c8230..3319f0cbb558 100644
> --- a/drivers/platform/x86/touchscreen_dmi.c
> +++ b/drivers/platform/x86/touchscreen_dmi.c
> @@ -265,6 +265,23 @@ static const struct ts_dmi_data jumper_ezpad_mini3_data = {
>         .properties     = jumper_ezpad_mini3_props,
>  };
>
> +static const struct property_entry myria_my8307_props[] = {
> +       PROPERTY_ENTRY_U32("touchscreen-size-x", 1720),
> +       PROPERTY_ENTRY_U32("touchscreen-size-y", 1140),
> +       PROPERTY_ENTRY_BOOL("touchscreen-inverted-x"),
> +       PROPERTY_ENTRY_BOOL("touchscreen-inverted-y"),
> +       PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
> +       PROPERTY_ENTRY_STRING("firmware-name", "gsl1680-myria-my8307.fw"),
> +       PROPERTY_ENTRY_U32("silead,max-fingers", 10),
> +       PROPERTY_ENTRY_BOOL("silead,home-button"),
> +       { }
> +};
> +
> +static const struct ts_dmi_data myria_my8307_data = {
> +       .acpi_name      = "MSSL1680:00",
> +       .properties     = myria_my8307_props,
> +};
> +
>  static const struct property_entry onda_obook_20_plus_props[] = {
>         PROPERTY_ENTRY_U32("touchscreen-size-x", 1728),
>         PROPERTY_ENTRY_U32("touchscreen-size-y", 1148),
> @@ -690,6 +707,14 @@ static const struct dmi_system_id touchscreen_dmi_table[] = {
>                         DMI_MATCH(DMI_PRODUCT_NAME, "FlexBook edge11 - M-FBE11"),
>                 },
>         },
> +       {
> +               /* Myria MY8307 */
> +               .driver_data = (void *)&myria_my8307_data,
> +               .matches = {
> +                       DMI_MATCH(DMI_SYS_VENDOR, "Complet Electro Serv"),
> +                       DMI_MATCH(DMI_PRODUCT_NAME, "MY8307"),
> +               },
> +       },
>         {
>                 /* Onda oBook 20 Plus */
>                 .driver_data = (void *)&onda_obook_20_plus_data,
> --
> 2.21.0
>


-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply

* [PATCH] platform/x86: touchscreen_dmi: Add info for Myria MY8307 2-in-1
From: Gabriel Lazar @ 2019-03-15 13:31 UTC (permalink / raw)
  Cc: Gabriel Lazar, Hans de Goede, Darren Hart, Andy Shevchenko,
	linux-input, platform-driver-x86, linux-kernel

Add touchscreen platform data for the Myrya MY8307 2-in-1 laptop.

Signed-off-by: Gabriel Lazar <gabriel.lazar@com.utcluj.ro>
---
 drivers/platform/x86/touchscreen_dmi.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/drivers/platform/x86/touchscreen_dmi.c b/drivers/platform/x86/touchscreen_dmi.c
index 2d56ff7c8230..3319f0cbb558 100644
--- a/drivers/platform/x86/touchscreen_dmi.c
+++ b/drivers/platform/x86/touchscreen_dmi.c
@@ -265,6 +265,23 @@ static const struct ts_dmi_data jumper_ezpad_mini3_data = {
 	.properties	= jumper_ezpad_mini3_props,
 };
 
+static const struct property_entry myria_my8307_props[] = {
+	PROPERTY_ENTRY_U32("touchscreen-size-x", 1720),
+	PROPERTY_ENTRY_U32("touchscreen-size-y", 1140),
+	PROPERTY_ENTRY_BOOL("touchscreen-inverted-x"),
+	PROPERTY_ENTRY_BOOL("touchscreen-inverted-y"),
+	PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
+	PROPERTY_ENTRY_STRING("firmware-name", "gsl1680-myria-my8307.fw"),
+	PROPERTY_ENTRY_U32("silead,max-fingers", 10),
+	PROPERTY_ENTRY_BOOL("silead,home-button"),
+	{ }
+};
+
+static const struct ts_dmi_data myria_my8307_data = {
+	.acpi_name	= "MSSL1680:00",
+	.properties	= myria_my8307_props,
+};
+
 static const struct property_entry onda_obook_20_plus_props[] = {
 	PROPERTY_ENTRY_U32("touchscreen-size-x", 1728),
 	PROPERTY_ENTRY_U32("touchscreen-size-y", 1148),
@@ -690,6 +707,14 @@ static const struct dmi_system_id touchscreen_dmi_table[] = {
 			DMI_MATCH(DMI_PRODUCT_NAME, "FlexBook edge11 - M-FBE11"),
 		},
 	},
+	{
+		/* Myria MY8307 */
+		.driver_data = (void *)&myria_my8307_data,
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "Complet Electro Serv"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "MY8307"),
+		},
+	},
 	{
 		/* Onda oBook 20 Plus */
 		.driver_data = (void *)&onda_obook_20_plus_data,
-- 
2.21.0

^ permalink raw reply related

* [Xen-devel][PATCH] Input: xen-kbdfront - signal the backend that we disconnect
From: Oleksandr Andrushchenko @ 2019-03-15  9:23 UTC (permalink / raw)
  To: xen-devel, linux-input, linux-kernel, dmitry.torokhov, jgross,
	boris.ostrovsky
  Cc: andr2000, Volodymyr_Babchuk, Oleksandr Andrushchenko

From: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

While disconnecting from the backend we clean up shared resources
(event channel, ring buffer), but never let the backend know about
that. This may lead to inconsistent backend state and/or shared
resources use.
Fix this by explicitly letting the backend know that frontend has
destroyed shared resources by changing its Xen bus state accordingly.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
---
 drivers/input/misc/xen-kbdfront.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/input/misc/xen-kbdfront.c b/drivers/input/misc/xen-kbdfront.c
index 24bc5c5d876f..ecb6e719e0e2 100644
--- a/drivers/input/misc/xen-kbdfront.c
+++ b/drivers/input/misc/xen-kbdfront.c
@@ -488,6 +488,8 @@ static int xenkbd_connect_backend(struct xenbus_device *dev,
 
 static void xenkbd_disconnect_backend(struct xenkbd_info *info)
 {
+	xenbus_switch_state(info->xbdev, XenbusStateClosing);
+
 	if (info->irq >= 0)
 		unbind_from_irqhandler(info->irq, info);
 	info->irq = -1;
-- 
2.21.0

^ permalink raw reply related

* Re: [regression, bisected] Keyboard not responding after resuming from suspend/hibernate
From: Peter Zijlstra @ 2019-03-14 19:54 UTC (permalink / raw)
  To: Numan Demirdöğen
  Cc: Pavel Machek, jason.low2, Waiman.Long, paulmck, tglx,
	dmitry.torokhov, mingo, linux-kernel, linux-input
In-Reply-To: <20181218102302.2b029612@korsan.localdomain>

On Tue, Dec 18, 2018 at 10:23:02AM +0300, Numan Demirdöğen wrote:
> I found that passing the options i8042.reset=1 i8042.dumbkbd=1 i8042.direct=1
> results in the keyboard functioning after resume. However, there is a
> long delay before the keyboard or mouse will respond to input on the
> lock screen.[1]

So the thing is, the mutex works, there's nothing wrong or broken about
it (or we'd have known, the kernel would crash and burn). The hand-off
stuff fixed at least one known starvation case as well.

What it does do, is change timing behaviour. But that is something that
is not guaranteed anyway.

This all smells like there's some timing dependent behaviour (aka. race
condition) in the suspend/keyboard interaction _somewhere_.

Now, I know absolutely nothing about either suspend or keyboard stuff,
so I really can't help there. The best idea is to add trace_printk()
throughout the keyboard suspend/resume code and see if there's a clue to
be had there (using remote access to dump the trace buffer after resume,
because of lack of keyboard).

Obviously that takes someone who knows how that should work ...

^ permalink raw reply

* [PATCH v3] hid: logitech: check the return value of create_singlethread_workqueue
From: Kangjie Lu @ 2019-03-14  5:24 UTC (permalink / raw)
  To: kjlu; +Cc: pakki001, Jiri Kosina, Benjamin Tissoires, linux-input,
	linux-kernel
In-Reply-To: <20190312100233.106098c8@lwn.net>

create_singlethread_workqueue may fail and return NULL. The fix
checks if it is NULL to avoid NULL pointer dereference.
Also, the fix moves the call of create_singlethread_workqueue
earlier to avoid resource-release issues.

--
V3: do not introduce memory leaks.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
 drivers/hid/hid-logitech-hidpp.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c
index 15ed6177a7a3..0a243247b231 100644
--- a/drivers/hid/hid-logitech-hidpp.c
+++ b/drivers/hid/hid-logitech-hidpp.c
@@ -2111,6 +2111,13 @@ static int hidpp_ff_init(struct hidpp_device *hidpp, u8 feature_index)
 		kfree(data);
 		return -ENOMEM;
 	}
+	data->wq = create_singlethread_workqueue("hidpp-ff-sendqueue");
+	if (!data->wq) {
+		kfree(data->effect_ids);
+		kfree(data);
+		return -ENOMEM;
+	}
+
 	data->hidpp = hidpp;
 	data->feature_index = feature_index;
 	data->version = version;
@@ -2155,7 +2162,6 @@ static int hidpp_ff_init(struct hidpp_device *hidpp, u8 feature_index)
 	/* ignore boost value at response.fap.params[2] */
 
 	/* init the hardware command queue */
-	data->wq = create_singlethread_workqueue("hidpp-ff-sendqueue");
 	atomic_set(&data->workqueue_size, 0);
 
 	/* initialize with zero autocenter to get wheel in usable state */
-- 
2.17.1

^ permalink raw reply related

* must hold the driver_input_lock in hid_debug_rdesc_show
From: He, Bo @ 2019-03-14  2:28 UTC (permalink / raw)
  To: jikos@kernel.org, benjamin.tissoires@redhat.com,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
  Cc: Zhang, Jun, Zhang, Yanmin

we see the below kernel panic logs when run suspend resume test with
usb mouse and usb keyboard connected.

the scenario is the userspace call the hid_debug_rdesc_show to dump
the input device while the device is removed. the patch
hold the driver_input_lock to avoid the race.

[ 5381.757295] selinux: SELinux:  Could not stat
/sys/devices/pci0000:00/0000:00:15.0/usb1/1-2/1-2:1.0/0003:03F0:0325.0320/input/input960/input960::scrolllock:
No such file or directory.
[ 5382.636498] BUG: unable to handle kernel paging request at 0000000783316040
[ 5382.651950] CPU: 1 PID: 1512 Comm: getevent Tainted: G     U     O 4.19.20-quilt-2e5dc0ac-00029-gc455a447dd55 #1
[ 5382.663797] RIP: 0010:hid_dump_device+0x9b/0x160
[ 5382.758853] Call Trace:
[ 5382.761581]  hid_debug_rdesc_show+0x72/0x1d0
[ 5382.766343]  seq_read+0xe0/0x410
[ 5382.769941]  full_proxy_read+0x5f/0x90
[ 5382.774121]  __vfs_read+0x3a/0x170
[ 5382.788392]  vfs_read+0xa0/0x150
[ 5382.791984]  ksys_read+0x58/0xc0
[ 5382.801404]  __x64_sys_read+0x1a/0x20
[ 5382.805483]  do_syscall_64+0x55/0x110
[ 5382.809559]  entry_SYSCALL_64_after_hwframe+0x49/0xbe

Signed-off-by: he, bo <bo.he@intel.com>
Signed-off-by: "Zhang, Jun" <jun.zhang@intel.com>
---
 drivers/hid/hid-debug.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/hid/hid-debug.c b/drivers/hid/hid-debug.c
index ebc9ffde41e9..a353a011fbdf 100644
--- a/drivers/hid/hid-debug.c
+++ b/drivers/hid/hid-debug.c
@@ -1060,10 +1060,15 @@ static int hid_debug_rdesc_show(struct seq_file *f, void *p)
 	seq_printf(f, "\n\n");
 
 	/* dump parsed data and input mappings */
+	if (down_interruptible(&hdev->driver_input_lock))
+		return 0;
+
 	hid_dump_device(hdev, f);
 	seq_printf(f, "\n");
 	hid_dump_input_mapping(hdev, f);
 
+	up(&hdev->driver_input_lock);
+
 	return 0;
 }
 
-- 
2.20.1

^ permalink raw reply related

* [PATCH] Input: elan_i2c - Add many hardware ID for lenovo laptop
From: KT Liao @ 2019-03-13 12:17 UTC (permalink / raw)
  To: linux-kernel, linux-input, dmitry.torokhov; +Cc: kt.liao

There are many Lenovo laptop which need elan_i2c support.
Elan collects the list ands add to add to elan_acpi_id[]

Signed-off-by: KT Liao <kt.liao@emc.com.tw>
---
 drivers/input/mouse/elan_i2c_core.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c
index a94b649..f9525d6 100644
--- a/drivers/input/mouse/elan_i2c_core.c
+++ b/drivers/input/mouse/elan_i2c_core.c
@@ -1337,21 +1337,48 @@ static const struct acpi_device_id elan_acpi_id[] = {
 	{ "ELAN0000", 0 },
 	{ "ELAN0100", 0 },
 	{ "ELAN0600", 0 },
+	{ "ELAN0601", 0 },
 	{ "ELAN0602", 0 },
+	{ "ELAN0603", 0 },
+	{ "ELAN0604", 0 },
 	{ "ELAN0605", 0 },
+	{ "ELAN0606", 0 },
+	{ "ELAN0607", 0 },
 	{ "ELAN0608", 0 },
 	{ "ELAN0609", 0 },
 	{ "ELAN060B", 0 },
 	{ "ELAN060C", 0 },
+	{ "ELAN060F", 0 },
+	{ "ELAN0610", 0 },
 	{ "ELAN0611", 0 },
 	{ "ELAN0612", 0 },
+	{ "ELAN0615", 0 },
+	{ "ELAN0616", 0 },
+	{ "ELAN0617", 0 },
 	{ "ELAN0618", 0 },
+	{ "ELAN0619", 0 },
+	{ "ELAN061A", 0 },
+	{ "ELAN061B", 0 },
 	{ "ELAN061C", 0 },
 	{ "ELAN061D", 0 },
 	{ "ELAN061E", 0 },
+	{ "ELAN061F", 0 },
 	{ "ELAN0620", 0 },
 	{ "ELAN0621", 0 },
 	{ "ELAN0622", 0 },
+	{ "ELAN0623", 0 },
+	{ "ELAN0624", 0 },
+	{ "ELAN0625", 0 },
+	{ "ELAN0626", 0 },
+	{ "ELAN0627", 0 },
+	{ "ELAN0628", 0 },
+	{ "ELAN0629", 0 },
+	{ "ELAN062A", 0 },
+	{ "ELAN062B", 0 },
+	{ "ELAN062C", 0 },
+	{ "ELAN062D", 0 },
+	{ "ELAN0631", 0 },
+	{ "ELAN0632", 0 },
 	{ "ELAN1000", 0 },
 	{ }
 };
-- 
2.7.4

^ permalink raw reply related

* [PATCH] Input: ili2117a - Add support for Ilitek ILI2117A based touchscreens
From: Adam Ford @ 2019-03-12 19:01 UTC (permalink / raw)
  To: linux-input
  Cc: adam.ford, Adam Ford, Dmitry Torokhov, Henrik Rydberg,
	linux-kernel

This driver supports the ILI2117A touch controller.  This is
different than the ILI210x and it uses different register and
algorithm so it's a separate driver rather than integrating with
the other.

Signed-off-by: Adam Ford <aford173@gmail.com>

diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
index 6c16aaeb4191..ff7cd369514e 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -416,6 +416,18 @@ config TOUCHSCREEN_ILI210X
 	  To compile this driver as a module, choose M here: the
 	  module will be called ili210x.
 
+config TOUCHSCREEN_ILI2117A
+	tristate "Ilitek ILI2117A Multi-Touch Controller"
+	depends on I2C
+	help
+	  Say Y here if you have a ILI2117A based touchscreen
+	  controller.
+
+	  If unsure, say N.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called ili2117a.
+
 config TOUCHSCREEN_IPROC
 	tristate "IPROC touch panel driver support"
 	depends on ARCH_BCM_IPROC || COMPILE_TEST
diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile
index fcc7605fba8d..0290d503bed1 100644
--- a/drivers/input/touchscreen/Makefile
+++ b/drivers/input/touchscreen/Makefile
@@ -46,6 +46,7 @@ obj-$(CONFIG_TOUCHSCREEN_FUJITSU)	+= fujitsu_ts.o
 obj-$(CONFIG_TOUCHSCREEN_GOODIX)	+= goodix.o
 obj-$(CONFIG_TOUCHSCREEN_HIDEEP)	+= hideep.o
 obj-$(CONFIG_TOUCHSCREEN_ILI210X)	+= ili210x.o
+obj-$(CONFIG_TOUCHSCREEN_ILI2117A)      += ili2117a.o
 obj-$(CONFIG_TOUCHSCREEN_IMX6UL_TSC)	+= imx6ul_tsc.o
 obj-$(CONFIG_TOUCHSCREEN_INEXIO)	+= inexio.o
 obj-$(CONFIG_TOUCHSCREEN_IPROC)		+= bcm_iproc_tsc.o
diff --git a/drivers/input/touchscreen/ili2117a.c b/drivers/input/touchscreen/ili2117a.c
new file mode 100644
index 000000000000..c47874ee89f4
--- /dev/null
+++ b/drivers/input/touchscreen/ili2117a.c
@@ -0,0 +1,308 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#include <linux/module.h>
+#include <linux/i2c.h>
+#include <linux/interrupt.h>
+#include <linux/slab.h>
+#include <linux/input.h>
+#include <linux/input/mt.h>
+#include <linux/delay.h>
+#include <linux/workqueue.h>
+
+#define MAX_TOUCHES		10
+#define DEFAULT_POLL_PERIOD	20
+#define MAX_X			((1 << 12) - 1)
+#define MAX_Y			((1 << 12) - 1)
+
+/* Touchscreen commands */
+#define TOUCH_INFO	0x00
+
+struct finger {
+	u8 xy;
+	u8 x;
+	u8 y;
+	u8 c_sum;
+} __packed;
+
+struct touchdata {
+	u8 packet_id;
+	struct finger finger[MAX_TOUCHES];
+	u8 key;
+	u8 checksum;
+} __packed;
+
+
+struct ili2117a {
+	struct i2c_client *client;
+	struct input_dev *input;
+	bool (*get_pendown_state)(void);
+	unsigned int poll_period;
+	struct delayed_work dwork;
+	int max_touch;
+};
+
+static int ili2117a_read_reg(struct i2c_client *client, u8 reg, void *buf,
+			    size_t len)
+{
+	struct i2c_msg msg[2] = {
+		{
+			.addr	= client->addr,
+			.flags	= 0,
+			.len	= 1,
+			.buf	= &reg,
+		},
+		{
+			.addr	= client->addr,
+			.flags	= I2C_M_RD,
+			.len	= len,
+			.buf	= buf,
+		}
+	};
+
+	if (i2c_transfer(client->adapter, msg, 2) != 2) {
+		dev_err(&client->dev, "i2c transfer failed\n");
+		return -EIO;
+	}
+
+	return 0;
+}
+
+static bool ili2117a_report_events(struct input_dev *input,
+				  const struct touchdata *touchdata,
+				  int max_touch)
+{
+	int i;
+	bool touch;
+	bool pen_down = 0;
+	u16 x = 0xfff;
+	u16 y = 0xfff;
+	const struct finger *finger;
+
+	for (i = 0; i < max_touch; i++) {
+		touch = 0;
+		input_mt_slot(input, i);
+		finger = &touchdata->finger[i];
+
+		x = finger->x | (((finger->xy & 0xf0) >> 4) << 8);
+		y = finger->y | ((finger->xy & 0x0f) << 8);
+
+		/* This driver returns 0xfff if there is no touch */
+		if (x != 0xfff && y != 0xfff) {
+			touch = 1;
+			pen_down = 1;
+		}
+
+		input_mt_report_slot_state(input, MT_TOOL_FINGER, touch);
+
+		if (touch) {
+			input_report_abs(input, ABS_MT_POSITION_X, x);
+			input_report_abs(input, ABS_MT_POSITION_Y, y);
+		}
+	}
+
+	input_mt_report_pointer_emulation(input, false);
+	input_sync(input);
+	return pen_down;
+}
+
+static void ili2117a_work(struct work_struct *work)
+{
+	struct ili2117a *priv = container_of(work, struct ili2117a,
+					    dwork.work);
+	struct i2c_client *client = priv->client;
+	struct touchdata touchdata;
+	int error;
+	bool status;
+
+	error = ili2117a_read_reg(client, TOUCH_INFO,
+				  (uint8_t *) &touchdata, sizeof(touchdata));
+
+	if (error) {
+		dev_err(&client->dev,
+			"Unable to get touchdata, err = %d\n", error);
+		return;
+	}
+
+	status = ili2117a_report_events(priv->input, &touchdata,
+					priv->max_touch);
+
+	if (status) {
+		schedule_delayed_work(&priv->dwork,
+				      msecs_to_jiffies(priv->poll_period));
+	}
+}
+
+static irqreturn_t ili2117a_irq(int irq, void *irq_data)
+{
+	struct ili2117a *priv = irq_data;
+
+	schedule_delayed_work(&priv->dwork, 0);
+
+	return IRQ_HANDLED;
+}
+
+static struct attribute *ili2117a_attributes[] = {
+	NULL,
+};
+
+static const struct attribute_group ili2117a_attr_group = {
+	.attrs = ili2117a_attributes,
+};
+
+static int ili2117a_i2c_probe(struct i2c_client *client,
+				       const struct i2c_device_id *id)
+{
+	struct device *dev = &client->dev;
+	struct ili2117a *priv;
+	struct input_dev *input;
+	int error;
+	int poll_period;
+	int max_touch;
+
+	if (client->irq <= 0) {
+		dev_err(dev, "No IRQ!\n");
+		return -EINVAL;
+	}
+
+	priv = kzalloc(sizeof(*priv), GFP_KERNEL);
+	input = input_allocate_device();
+	if (!priv || !input) {
+		error = -ENOMEM;
+		goto err_free_mem;
+	}
+
+	priv->client = client;
+	priv->input = input;
+
+	error = device_property_read_u32(dev, "ili2117a,poll-period",
+					 &poll_period);
+	priv->poll_period = error ? DEFAULT_POLL_PERIOD : poll_period;
+
+	error = device_property_read_u32(dev, "ili2117a,max-touch",
+					 &max_touch);
+	if (max_touch > MAX_TOUCHES)
+		max_touch = MAX_TOUCHES;
+	priv->max_touch = error ? MAX_TOUCHES : max_touch;
+
+	INIT_DELAYED_WORK(&priv->dwork, ili2117a_work);
+
+	/* Setup input device */
+	input->name = "ili2117a Touchscreen";
+	input->id.bustype = BUS_I2C;
+	input->dev.parent = dev;
+
+	__set_bit(EV_SYN, input->evbit);
+	__set_bit(EV_KEY, input->evbit);
+	__set_bit(EV_ABS, input->evbit);
+	__set_bit(BTN_TOUCH, input->keybit);
+
+	/* Single touch */
+	input_set_abs_params(input, ABS_X, 0, MAX_X, 0, 0);
+	input_set_abs_params(input, ABS_Y, 0, MAX_Y, 0, 0);
+
+	/* Multi touch */
+	input_mt_init_slots(input, priv->max_touch, 0);
+	input_set_abs_params(input, ABS_MT_POSITION_X, 0, MAX_X, 0, 0);
+	input_set_abs_params(input, ABS_MT_POSITION_Y, 0, MAX_Y, 0, 0);
+
+	i2c_set_clientdata(client, priv);
+
+	error = devm_request_threaded_irq(dev, client->irq, NULL,
+					  ili2117a_irq,
+					  IRQF_TRIGGER_RISING | IRQF_ONESHOT,
+					  client->name, priv);
+
+	if (error) {
+		dev_err(dev, "Failed to request irq, err: %d\n", error);
+		goto err_free_mem;
+	}
+
+	error = sysfs_create_group(&dev->kobj, &ili2117a_attr_group);
+	if (error) {
+		dev_err(dev, "Unable to create sysfs attributes, err: %d\n",
+			error);
+		goto err_free_irq;
+	}
+
+	error = input_register_device(priv->input);
+	if (error) {
+		dev_err(dev, "Cannot register input device, err: %d\n", error);
+		goto err_remove_sysfs;
+	}
+
+	device_init_wakeup(dev, 1);
+	return 0;
+
+err_remove_sysfs:
+	sysfs_remove_group(&dev->kobj, &ili2117a_attr_group);
+err_free_irq:
+	free_irq(client->irq, priv);
+err_free_mem:
+	input_free_device(input);
+	kfree(priv);
+	return error;
+}
+
+static int ili2117a_i2c_remove(struct i2c_client *client)
+{
+	struct ili2117a *priv = i2c_get_clientdata(client);
+
+	sysfs_remove_group(&client->dev.kobj, &ili2117a_attr_group);
+	free_irq(priv->client->irq, priv);
+	cancel_delayed_work_sync(&priv->dwork);
+	input_unregister_device(priv->input);
+	kfree(priv);
+
+	return 0;
+}
+
+static int __maybe_unused ili2117a_i2c_suspend(struct device *dev)
+{
+	struct i2c_client *client = to_i2c_client(dev);
+
+	if (device_may_wakeup(&client->dev))
+		enable_irq_wake(client->irq);
+
+	return 0;
+}
+
+static int __maybe_unused ili2117a_i2c_resume(struct device *dev)
+{
+	struct i2c_client *client = to_i2c_client(dev);
+
+	if (device_may_wakeup(&client->dev))
+		disable_irq_wake(client->irq);
+
+	return 0;
+}
+
+static SIMPLE_DEV_PM_OPS(ili2117a_i2c_pm,
+			 ili2117a_i2c_suspend, ili2117a_i2c_resume);
+
+static const struct of_device_id ili_match_table[] = {
+	{ .compatible = "ilitek,ili2117a" },
+	{ },
+};
+
+static const struct i2c_device_id ili2117a_i2c_id[] = {
+	{ "ili2117a", 0 },
+	{ }
+};
+MODULE_DEVICE_TABLE(i2c, ili2117a_i2c_id);
+
+static struct i2c_driver ili2117a_ts_driver = {
+	.driver = {
+		.name = "ili2117a_i2c",
+		.pm = &ili2117a_i2c_pm,
+		.of_match_table = of_match_ptr(ili_match_table),
+	},
+	.id_table = ili2117a_i2c_id,
+	.probe = ili2117a_i2c_probe,
+	.remove = ili2117a_i2c_remove,
+};
+
+module_i2c_driver(ili2117a_ts_driver);
+
+MODULE_AUTHOR("Adam Ford <adam.ford@logicpd.com>");
+MODULE_DESCRIPTION("ili2117a I2C Touchscreen Driver");
+MODULE_LICENSE("GPL");
-- 
2.17.1

^ permalink raw reply related

* Re: [PATCH v2] hid: logitech: check the return value of create_singlethread_workqueue
From: Jonathan Corbet @ 2019-03-12 16:02 UTC (permalink / raw)
  To: Kangjie Lu
  Cc: pakki001, Jiri Kosina, Benjamin Tissoires, linux-input,
	linux-kernel
In-Reply-To: <20190312061628.13869-1-kjlu@umn.edu>

On Tue, 12 Mar 2019 01:16:28 -0500
Kangjie Lu <kjlu@umn.edu> wrote:

> create_singlethread_workqueue may fail and return NULL. The fix
> checks if it is NULL to avoid NULL pointer dereference.
> Also, the fix moves the call of create_singlethread_workqueue
> earlier to avoid resource-release issues.
> 
> Signed-off-by: Kangjie Lu <kjlu@umn.edu>

So I don't know this code at all, but...

>  drivers/hid/hid-logitech-hidpp.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c
> index 15ed6177a7a3..1b7c336cae6d 100644
> --- a/drivers/hid/hid-logitech-hidpp.c
> +++ b/drivers/hid/hid-logitech-hidpp.c
> @@ -2106,6 +2106,12 @@ static int hidpp_ff_init(struct hidpp_device *hidpp, u8 feature_index)
>  	data = kzalloc(sizeof(*data), GFP_KERNEL);
>  	if (!data)
>  		return -ENOMEM;
> +
> +	/* init the hardware command queue */
> +	data->wq = create_singlethread_workqueue("hidpp-ff-sendqueue");
> +	if (!data->wq)
> +		return -ENOMEM;

It's clear just from the diff that this return will leak 'data'.  You also
break the error handling just below:

>  	data->effect_ids = kcalloc(num_slots, sizeof(int), GFP_KERNEL);
>  	if (!data->effect_ids) {
>  		kfree(data);

It's also worth asking: how are you testing these error path changes?

Thanks,

jon

^ permalink raw reply

* [PATCH] HID: core: move Usage Page concatenation to hid_parser_main()
From: Nicolas Saenz Julienne @ 2019-03-12  9:36 UTC (permalink / raw)
  To: Jiri Kosina, Benjamin Tissoires
  Cc: oneukum, Terry.Junge, Nicolas Saenz Julienne, linux-input,
	linux-kernel

As seen on some USB wireless keyboards manufactured by Primax, the HID
parser was using some assumptions that are not always true. In this case
it's s the fact that, inside the scope of a main item, an Usage Page
will always precede an Usage.

The spec is not pretty clear as 6.2.2.7 states "Any usage that follows
is interpreted as a Usage ID and concatenated with the Usage Page".
While 6.2.2.8 states "When the parser encounters a main item it
concatenates the last declared Usage Page with a Usage to form a
complete usage value." Being somewhat contradictory it was decided to
match Window's implementation, which follows 6.2.2.8.

In summary, the patch moves the Usage Page concatenation from the local
item parsing function to the main item parsing function.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
---

Note: A PR in hid-tools shoud show up anytime soon

 drivers/hid/hid-core.c | 30 ++++++++++++++++++------------
 include/linux/hid.h    |  1 +
 2 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 9993b692598f..158468ef23a6 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -218,13 +218,14 @@ static unsigned hid_lookup_collection(struct hid_parser *parser, unsigned type)
  * Add a usage to the temporary parser table.
  */
 
-static int hid_add_usage(struct hid_parser *parser, unsigned usage)
+static int hid_add_usage(struct hid_parser *parser, unsigned usage, __u8 size)
 {
 	if (parser->local.usage_index >= HID_MAX_USAGES) {
 		hid_err(parser->device, "usage index exceeded\n");
 		return -1;
 	}
 	parser->local.usage[parser->local.usage_index] = usage;
+	parser->local.usage_size[parser->local.usage_index] = size;
 	parser->local.collection_index[parser->local.usage_index] =
 		parser->collection_stack_ptr ?
 		parser->collection_stack[parser->collection_stack_ptr - 1] : 0;
@@ -486,10 +487,7 @@ static int hid_parser_local(struct hid_parser *parser, struct hid_item *item)
 			return 0;
 		}
 
-		if (item->size <= 2)
-			data = (parser->global.usage_page << 16) + data;
-
-		return hid_add_usage(parser, data);
+		return hid_add_usage(parser, data, item->size);
 
 	case HID_LOCAL_ITEM_TAG_USAGE_MINIMUM:
 
@@ -498,9 +496,6 @@ static int hid_parser_local(struct hid_parser *parser, struct hid_item *item)
 			return 0;
 		}
 
-		if (item->size <= 2)
-			data = (parser->global.usage_page << 16) + data;
-
 		parser->local.usage_minimum = data;
 		return 0;
 
@@ -511,9 +506,6 @@ static int hid_parser_local(struct hid_parser *parser, struct hid_item *item)
 			return 0;
 		}
 
-		if (item->size <= 2)
-			data = (parser->global.usage_page << 16) + data;
-
 		count = data - parser->local.usage_minimum;
 		if (count + parser->local.usage_index >= HID_MAX_USAGES) {
 			/*
@@ -533,7 +525,7 @@ static int hid_parser_local(struct hid_parser *parser, struct hid_item *item)
 		}
 
 		for (n = parser->local.usage_minimum; n <= data; n++)
-			if (hid_add_usage(parser, n)) {
+			if (hid_add_usage(parser, n, item->size)) {
 				dbg_hid("hid_add_usage failed\n");
 				return -1;
 			}
@@ -553,8 +545,22 @@ static int hid_parser_local(struct hid_parser *parser, struct hid_item *item)
 
 static int hid_parser_main(struct hid_parser *parser, struct hid_item *item)
 {
+	unsigned int usages;
 	__u32 data;
 	int ret;
+	int i;
+
+	usages = max_t(unsigned, parser->local.usage_index,
+				 parser->global.report_count);
+
+	/*
+	 * As per specification, 6.2.2.8:
+	 * "When the parser encounters a main item it concatenates the last
+	 * declared Usage Page with a Usage to form a complete usage value."
+	 */
+	for (i = 0; i < usages; i++)
+		if (parser->local.usage_size[i] <= 2)
+			parser->local.usage[i] += parser->global.usage_page << 16;
 
 	data = item_udata(item);
 
diff --git a/include/linux/hid.h b/include/linux/hid.h
index f9707d1dcb58..d1fb4b678873 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -417,6 +417,7 @@ struct hid_global {
 
 struct hid_local {
 	unsigned usage[HID_MAX_USAGES]; /* usage array */
+	__u8 usage_size[HID_MAX_USAGES]; /* usage size array */
 	unsigned collection_index[HID_MAX_USAGES]; /* collection index array */
 	unsigned usage_index;
 	unsigned usage_minimum;
-- 
2.21.0

^ permalink raw reply related

* [PATCH v2] hid: logitech: check the return value of create_singlethread_workqueue
From: Kangjie Lu @ 2019-03-12  6:16 UTC (permalink / raw)
  To: kjlu; +Cc: pakki001, Jiri Kosina, Benjamin Tissoires, linux-input,
	linux-kernel
In-Reply-To: <CAO-hwJLwvZvhPPKU7r74xtKsp_P5VBZ2964iQhgBR5zF-ZM7wg@mail.gmail.com>

create_singlethread_workqueue may fail and return NULL. The fix
checks if it is NULL to avoid NULL pointer dereference.
Also, the fix moves the call of create_singlethread_workqueue
earlier to avoid resource-release issues.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
 drivers/hid/hid-logitech-hidpp.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c
index 15ed6177a7a3..1b7c336cae6d 100644
--- a/drivers/hid/hid-logitech-hidpp.c
+++ b/drivers/hid/hid-logitech-hidpp.c
@@ -2106,6 +2106,12 @@ static int hidpp_ff_init(struct hidpp_device *hidpp, u8 feature_index)
 	data = kzalloc(sizeof(*data), GFP_KERNEL);
 	if (!data)
 		return -ENOMEM;
+
+	/* init the hardware command queue */
+	data->wq = create_singlethread_workqueue("hidpp-ff-sendqueue");
+	if (!data->wq)
+		return -ENOMEM;
+
 	data->effect_ids = kcalloc(num_slots, sizeof(int), GFP_KERNEL);
 	if (!data->effect_ids) {
 		kfree(data);
@@ -2154,8 +2160,6 @@ static int hidpp_ff_init(struct hidpp_device *hidpp, u8 feature_index)
 	data->gain = error ? 0xffff : get_unaligned_be16(&response.fap.params[0]);
 	/* ignore boost value at response.fap.params[2] */
 
-	/* init the hardware command queue */
-	data->wq = create_singlethread_workqueue("hidpp-ff-sendqueue");
 	atomic_set(&data->workqueue_size, 0);
 
 	/* initialize with zero autocenter to get wheel in usable state */
-- 
2.17.1

^ permalink raw reply related

* [PATCH AUTOSEL 3.18 6/6] Input: st-keyscan - fix potential zalloc NULL dereference
From: Sasha Levin @ 2019-03-11 19:59 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Gabriel Fernandez, Dmitry Torokhov, Sasha Levin, linux-input
In-Reply-To: <20190311195951.139741-1-sashal@kernel.org>

From: Gabriel Fernandez <gabriel.fernandez@st.com>

[ Upstream commit 2439d37e1bf8a34d437573c086572abe0f3f1b15 ]

This patch fixes the following static checker warning:

drivers/input/keyboard/st-keyscan.c:156 keyscan_probe()
error: potential zalloc NULL dereference: 'keypad_data->input_dev'

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Gabriel Fernandez <gabriel.fernandez@st.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/input/keyboard/st-keyscan.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/input/keyboard/st-keyscan.c b/drivers/input/keyboard/st-keyscan.c
index de7be4f03d91..ebf9f643d910 100644
--- a/drivers/input/keyboard/st-keyscan.c
+++ b/drivers/input/keyboard/st-keyscan.c
@@ -153,6 +153,8 @@ static int keyscan_probe(struct platform_device *pdev)
 
 	input_dev->id.bustype = BUS_HOST;
 
+	keypad_data->input_dev = input_dev;
+
 	error = keypad_matrix_key_parse_dt(keypad_data);
 	if (error)
 		return error;
@@ -168,8 +170,6 @@ static int keyscan_probe(struct platform_device *pdev)
 
 	input_set_drvdata(input_dev, keypad_data);
 
-	keypad_data->input_dev = input_dev;
-
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	keypad_data->base = devm_ioremap_resource(&pdev->dev, res);
 	if (IS_ERR(keypad_data->base))
-- 
2.19.1

^ permalink raw reply related

* [PATCH AUTOSEL 3.18 2/6] Input: matrix_keypad - use flush_delayed_work()
From: Sasha Levin @ 2019-03-11 19:59 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Dmitry Torokhov, Sasha Levin, linux-input
In-Reply-To: <20190311195951.139741-1-sashal@kernel.org>

From: Dmitry Torokhov <dmitry.torokhov@gmail.com>

[ Upstream commit a342083abe576db43594a32d458a61fa81f7cb32 ]

We should be using flush_delayed_work() instead of flush_work() in
matrix_keypad_stop() to ensure that we are not missing work that is
scheduled but not yet put in the workqueue (i.e. its delay timer has not
expired yet).

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/input/keyboard/matrix_keypad.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/keyboard/matrix_keypad.c b/drivers/input/keyboard/matrix_keypad.c
index 176bdd140769..a1b9753e0616 100644
--- a/drivers/input/keyboard/matrix_keypad.c
+++ b/drivers/input/keyboard/matrix_keypad.c
@@ -220,7 +220,7 @@ static void matrix_keypad_stop(struct input_dev *dev)
 	keypad->stopped = true;
 	spin_unlock_irq(&keypad->lock);
 
-	flush_work(&keypad->work.work);
+	flush_delayed_work(&keypad->work);
 	/*
 	 * matrix_keypad_scan() will leave IRQs enabled;
 	 * we should disable them now.
-- 
2.19.1

^ permalink raw reply related

* [PATCH AUTOSEL 4.4 8/8] Input: st-keyscan - fix potential zalloc NULL dereference
From: Sasha Levin @ 2019-03-11 19:59 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Gabriel Fernandez, Dmitry Torokhov, Sasha Levin, linux-input
In-Reply-To: <20190311195938.139603-1-sashal@kernel.org>

From: Gabriel Fernandez <gabriel.fernandez@st.com>

[ Upstream commit 2439d37e1bf8a34d437573c086572abe0f3f1b15 ]

This patch fixes the following static checker warning:

drivers/input/keyboard/st-keyscan.c:156 keyscan_probe()
error: potential zalloc NULL dereference: 'keypad_data->input_dev'

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Gabriel Fernandez <gabriel.fernandez@st.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/input/keyboard/st-keyscan.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/input/keyboard/st-keyscan.c b/drivers/input/keyboard/st-keyscan.c
index de7be4f03d91..ebf9f643d910 100644
--- a/drivers/input/keyboard/st-keyscan.c
+++ b/drivers/input/keyboard/st-keyscan.c
@@ -153,6 +153,8 @@ static int keyscan_probe(struct platform_device *pdev)
 
 	input_dev->id.bustype = BUS_HOST;
 
+	keypad_data->input_dev = input_dev;
+
 	error = keypad_matrix_key_parse_dt(keypad_data);
 	if (error)
 		return error;
@@ -168,8 +170,6 @@ static int keyscan_probe(struct platform_device *pdev)
 
 	input_set_drvdata(input_dev, keypad_data);
 
-	keypad_data->input_dev = input_dev;
-
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	keypad_data->base = devm_ioremap_resource(&pdev->dev, res);
 	if (IS_ERR(keypad_data->base))
-- 
2.19.1

^ permalink raw reply related

* [PATCH AUTOSEL 4.4 5/8] Input: matrix_keypad - use flush_delayed_work()
From: Sasha Levin @ 2019-03-11 19:59 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Dmitry Torokhov, Sasha Levin, linux-input
In-Reply-To: <20190311195938.139603-1-sashal@kernel.org>

From: Dmitry Torokhov <dmitry.torokhov@gmail.com>

[ Upstream commit a342083abe576db43594a32d458a61fa81f7cb32 ]

We should be using flush_delayed_work() instead of flush_work() in
matrix_keypad_stop() to ensure that we are not missing work that is
scheduled but not yet put in the workqueue (i.e. its delay timer has not
expired yet).

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/input/keyboard/matrix_keypad.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/keyboard/matrix_keypad.c b/drivers/input/keyboard/matrix_keypad.c
index c64d87442a62..2e12e31f45c5 100644
--- a/drivers/input/keyboard/matrix_keypad.c
+++ b/drivers/input/keyboard/matrix_keypad.c
@@ -220,7 +220,7 @@ static void matrix_keypad_stop(struct input_dev *dev)
 	keypad->stopped = true;
 	spin_unlock_irq(&keypad->lock);
 
-	flush_work(&keypad->work.work);
+	flush_delayed_work(&keypad->work);
 	/*
 	 * matrix_keypad_scan() will leave IRQs enabled;
 	 * we should disable them now.
-- 
2.19.1

^ permalink raw reply related

* [PATCH AUTOSEL 4.9 12/12] Input: st-keyscan - fix potential zalloc NULL dereference
From: Sasha Levin @ 2019-03-11 19:59 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Gabriel Fernandez, Dmitry Torokhov, Sasha Levin, linux-input
In-Reply-To: <20190311195912.139410-1-sashal@kernel.org>

From: Gabriel Fernandez <gabriel.fernandez@st.com>

[ Upstream commit 2439d37e1bf8a34d437573c086572abe0f3f1b15 ]

This patch fixes the following static checker warning:

drivers/input/keyboard/st-keyscan.c:156 keyscan_probe()
error: potential zalloc NULL dereference: 'keypad_data->input_dev'

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Gabriel Fernandez <gabriel.fernandez@st.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/input/keyboard/st-keyscan.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/input/keyboard/st-keyscan.c b/drivers/input/keyboard/st-keyscan.c
index de7be4f03d91..ebf9f643d910 100644
--- a/drivers/input/keyboard/st-keyscan.c
+++ b/drivers/input/keyboard/st-keyscan.c
@@ -153,6 +153,8 @@ static int keyscan_probe(struct platform_device *pdev)
 
 	input_dev->id.bustype = BUS_HOST;
 
+	keypad_data->input_dev = input_dev;
+
 	error = keypad_matrix_key_parse_dt(keypad_data);
 	if (error)
 		return error;
@@ -168,8 +170,6 @@ static int keyscan_probe(struct platform_device *pdev)
 
 	input_set_drvdata(input_dev, keypad_data);
 
-	keypad_data->input_dev = input_dev;
-
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	keypad_data->base = devm_ioremap_resource(&pdev->dev, res);
 	if (IS_ERR(keypad_data->base))
-- 
2.19.1

^ permalink raw reply related

* [PATCH AUTOSEL 4.9 06/12] Input: matrix_keypad - use flush_delayed_work()
From: Sasha Levin @ 2019-03-11 19:59 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Dmitry Torokhov, Sasha Levin, linux-input
In-Reply-To: <20190311195912.139410-1-sashal@kernel.org>

From: Dmitry Torokhov <dmitry.torokhov@gmail.com>

[ Upstream commit a342083abe576db43594a32d458a61fa81f7cb32 ]

We should be using flush_delayed_work() instead of flush_work() in
matrix_keypad_stop() to ensure that we are not missing work that is
scheduled but not yet put in the workqueue (i.e. its delay timer has not
expired yet).

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/input/keyboard/matrix_keypad.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/keyboard/matrix_keypad.c b/drivers/input/keyboard/matrix_keypad.c
index c64d87442a62..2e12e31f45c5 100644
--- a/drivers/input/keyboard/matrix_keypad.c
+++ b/drivers/input/keyboard/matrix_keypad.c
@@ -220,7 +220,7 @@ static void matrix_keypad_stop(struct input_dev *dev)
 	keypad->stopped = true;
 	spin_unlock_irq(&keypad->lock);
 
-	flush_work(&keypad->work.work);
+	flush_delayed_work(&keypad->work);
 	/*
 	 * matrix_keypad_scan() will leave IRQs enabled;
 	 * we should disable them now.
-- 
2.19.1

^ permalink raw reply related


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