linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Input: atmel_mxt_ts - add generic platform data for Chromebooks
@ 2015-11-24 18:58 Dmitry Torokhov
  2015-11-24 19:18 ` Javier Martinez Canillas
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitry Torokhov @ 2015-11-24 18:58 UTC (permalink / raw)
  To: linux-input
  Cc: Nick Dyer, Javier Martinez Canillas, Yufeng Shen, Benson Leung,
	linux-kernel

Apparently people are installing generic Linux distributions not only on
Pixels but also on other Chromebooks. Unfortunately on all of them Atmel
parts assigned names ATML0000 and ATML0001, and do not carry any other
configuration data. So let's create generic instance of platform data that
should cover most of them (we assume that they will not be using T100
objects, since with those Google mapped BTN_LEFT onto a different GPIO, so
slightly different keymap would be needed, but I think we used parts with
T100 on ARM devices where we thankfully have DTS and can describe the
devices better).

Tested-by: Rich K <rgkirch@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/touchscreen/atmel_mxt_ts.c | 33 ++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index c562205..159120b 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -2487,6 +2487,31 @@ static struct mxt_acpi_platform_data samus_platform_data[] = {
 	{ }
 };
 
+static unsigned int chromebook_tp_buttons[] = {
+	KEY_RESERVED,
+	KEY_RESERVED,
+	KEY_RESERVED,
+	KEY_RESERVED,
+	KEY_RESERVED,
+	BTN_LEFT
+};
+
+static struct mxt_acpi_platform_data chromebook_platform_data[] = {
+	{
+		/* Touchpad */
+		.hid	= "ATML0000",
+		.pdata	= {
+			.t19_num_keys	= ARRAY_SIZE(chromebook_tp_buttons),
+			.t19_keymap	= chromebook_tp_buttons,
+		},
+	},
+	{
+		/* Touchscreen */
+		.hid	= "ATML0001",
+	},
+	{ }
+};
+
 static const struct dmi_system_id mxt_dmi_table[] = {
 	{
 		/* 2015 Google Pixel */
@@ -2497,6 +2522,14 @@ static const struct dmi_system_id mxt_dmi_table[] = {
 		},
 		.driver_data = samus_platform_data,
 	},
+	{
+		/* Other Google Chromebooks */
+		.ident = "Chromebook",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "GOOGLE"),
+		},
+		.driver_data = chromebook_platform_data,
+	},
 	{ }
 };
 
-- 
2.6.0.rc2.230.g3dd15c0


-- 
Dmitry

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] Input: atmel_mxt_ts - add generic platform data for Chromebooks
  2015-11-24 18:58 [PATCH] Input: atmel_mxt_ts - add generic platform data for Chromebooks Dmitry Torokhov
@ 2015-11-24 19:18 ` Javier Martinez Canillas
  2015-12-01 21:21   ` Dmitry Torokhov
  0 siblings, 1 reply; 4+ messages in thread
From: Javier Martinez Canillas @ 2015-11-24 19:18 UTC (permalink / raw)
  To: Dmitry Torokhov, linux-input
  Cc: Nick Dyer, Yufeng Shen, Benson Leung, linux-kernel

Hello Dmitry,

On 11/24/2015 03:58 PM, Dmitry Torokhov wrote:
> Apparently people are installing generic Linux distributions not only on
> Pixels but also on other Chromebooks. Unfortunately on all of them Atmel
> parts assigned names ATML0000 and ATML0001, and do not carry any other
> configuration data. So let's create generic instance of platform data that
> should cover most of them (we assume that they will not be using T100
> objects, since with those Google mapped BTN_LEFT onto a different GPIO, so
> slightly different keymap would be needed, but I think we used parts with
> T100 on ARM devices where we thankfully have DTS and can describe the
> devices better).
> 

That is correct, an example of an ARM based Chromebook that has an Atmel chip
with a T100 object is the Exynos5800 Peach Pi Chromebook and as you correctly
said, the buttons to GPIO mapping is described in the DTS, i.e:

	/* Atmel mXT540S */
	trackpad@4b {
		compatible = "atmel,maxtouch";
		reg = <0x4b>;
		interrupt-parent = <&gpx1>;
		interrupts = <1 IRQ_TYPE_EDGE_FALLING>;
		wakeup-source;
		pinctrl-names = "default";
		pinctrl-0 = <&trackpad_irq>;
		linux,gpio-keymap = <KEY_RESERVED
				     KEY_RESERVED
				     KEY_RESERVED	/* GPIO 0 */
				     KEY_RESERVED	/* GPIO 1 */
				     BTN_LEFT		/* GPIO 2 */
				     KEY_RESERVED>;	/* GPIO 3 */
	};

> Tested-by: Rich K <rgkirch@gmail.com>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
>  drivers/input/touchscreen/atmel_mxt_ts.c | 33 ++++++++++++++++++++++++++++++++
>  1 file changed, 33 insertions(+)
> 
> diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
> index c562205..159120b 100644
> --- a/drivers/input/touchscreen/atmel_mxt_ts.c
> +++ b/drivers/input/touchscreen/atmel_mxt_ts.c
> @@ -2487,6 +2487,31 @@ static struct mxt_acpi_platform_data samus_platform_data[] = {
>  	{ }
>  };
>  
> +static unsigned int chromebook_tp_buttons[] = {

Maybe naming it chromebook_t19_buttons instead to make it clear that the
mapping is specific to the T19 object or at least document that assumption?

Although is mentioned in the commit message so I don't have a strong
preference and the patch looks good to me:

Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Input: atmel_mxt_ts - add generic platform data for Chromebooks
  2015-11-24 19:18 ` Javier Martinez Canillas
@ 2015-12-01 21:21   ` Dmitry Torokhov
  2015-12-01 21:25     ` Javier Martinez Canillas
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitry Torokhov @ 2015-12-01 21:21 UTC (permalink / raw)
  To: Javier Martinez Canillas
  Cc: linux-input, Nick Dyer, Yufeng Shen, Benson Leung, linux-kernel

Hi Javier,

On Tue, Nov 24, 2015 at 04:18:05PM -0300, Javier Martinez Canillas wrote:
> Hello Dmitry,
> 
> On 11/24/2015 03:58 PM, Dmitry Torokhov wrote:
> > Apparently people are installing generic Linux distributions not only on
> > Pixels but also on other Chromebooks. Unfortunately on all of them Atmel
> > parts assigned names ATML0000 and ATML0001, and do not carry any other
> > configuration data. So let's create generic instance of platform data that
> > should cover most of them (we assume that they will not be using T100
> > objects, since with those Google mapped BTN_LEFT onto a different GPIO, so
> > slightly different keymap would be needed, but I think we used parts with
> > T100 on ARM devices where we thankfully have DTS and can describe the
> > devices better).
> > 
> 
> That is correct, an example of an ARM based Chromebook that has an Atmel chip
> with a T100 object is the Exynos5800 Peach Pi Chromebook and as you correctly
> said, the buttons to GPIO mapping is described in the DTS, i.e:
> 
> 	/* Atmel mXT540S */
> 	trackpad@4b {
> 		compatible = "atmel,maxtouch";
> 		reg = <0x4b>;
> 		interrupt-parent = <&gpx1>;
> 		interrupts = <1 IRQ_TYPE_EDGE_FALLING>;
> 		wakeup-source;
> 		pinctrl-names = "default";
> 		pinctrl-0 = <&trackpad_irq>;
> 		linux,gpio-keymap = <KEY_RESERVED
> 				     KEY_RESERVED
> 				     KEY_RESERVED	/* GPIO 0 */
> 				     KEY_RESERVED	/* GPIO 1 */
> 				     BTN_LEFT		/* GPIO 2 */
> 				     KEY_RESERVED>;	/* GPIO 3 */
> 	};
> 
> > Tested-by: Rich K <rgkirch@gmail.com>
> > Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> > ---
> >  drivers/input/touchscreen/atmel_mxt_ts.c | 33 ++++++++++++++++++++++++++++++++
> >  1 file changed, 33 insertions(+)
> > 
> > diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
> > index c562205..159120b 100644
> > --- a/drivers/input/touchscreen/atmel_mxt_ts.c
> > +++ b/drivers/input/touchscreen/atmel_mxt_ts.c
> > @@ -2487,6 +2487,31 @@ static struct mxt_acpi_platform_data samus_platform_data[] = {
> >  	{ }
> >  };
> >  
> > +static unsigned int chromebook_tp_buttons[] = {
> 
> Maybe naming it chromebook_t19_buttons instead to make it clear that the
> mapping is specific to the T19 object or at least document that assumption?

The idea was to document that the mapping is applied to the touchpad
and not any other Atmel device that might have T19 object in it, similar
to samus_touchpad_buttons[] array.

> 
> Although is mentioned in the commit message so I don't have a strong
> preference and the patch looks good to me:
> 
> Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>

Thank you for the review.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Input: atmel_mxt_ts - add generic platform data for Chromebooks
  2015-12-01 21:21   ` Dmitry Torokhov
@ 2015-12-01 21:25     ` Javier Martinez Canillas
  0 siblings, 0 replies; 4+ messages in thread
From: Javier Martinez Canillas @ 2015-12-01 21:25 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: linux-input, Nick Dyer, Yufeng Shen, Benson Leung, linux-kernel

Hello Dmitry,

On 12/01/2015 06:21 PM, Dmitry Torokhov wrote:

[snip]

>>>  
>>> +static unsigned int chromebook_tp_buttons[] = {
>>
>> Maybe naming it chromebook_t19_buttons instead to make it clear that the
>> mapping is specific to the T19 object or at least document that assumption?
> 
> The idea was to document that the mapping is applied to the touchpad
> and not any other Atmel device that might have T19 object in it, similar
> to samus_touchpad_buttons[] array.
>

You are right, the naming makes sense then indeed.

Thanks a lot for the explanation.
 
>>
>> Although is mentioned in the commit message so I don't have a strong
>> preference and the patch looks good to me:
>>
>> Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>
> 
> Thank you for the review.
> 

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-12-01 21:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-24 18:58 [PATCH] Input: atmel_mxt_ts - add generic platform data for Chromebooks Dmitry Torokhov
2015-11-24 19:18 ` Javier Martinez Canillas
2015-12-01 21:21   ` Dmitry Torokhov
2015-12-01 21:25     ` Javier Martinez Canillas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).