linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Pavel Machek <pavel@ucw.cz>
Cc: Michael Welling <mwelling@ieee.org>,
	kernel list <linux-kernel@vger.kernel.org>,
	linux-input@vger.kernel.org, pali.rohar@gmail.com,
	sre@kernel.org, ivo.g.dimitrov.75@gmail.com,
	patrikbachan@gmail.com, serge@hallyn.com,
	Aaro Koskinen <aaro.koskinen@iki.fi>
Subject: Re: [PATCH] Input: tsc200x - Report proper input_dev name
Date: Wed, 20 Jul 2016 09:45:03 -0700	[thread overview]
Message-ID: <20160720164503.GB25655@dtor-ws> (raw)
In-Reply-To: <20160720065405.GD3792@amd>

On Wed, Jul 20, 2016 at 08:54:05AM +0200, Pavel Machek wrote:
> On Wed 2016-07-20 01:50:24, Michael Welling wrote:
> > On Wed, Jul 20, 2016 at 08:31:06AM +0200, Pavel Machek wrote:
> > > Hi!
> > > 
> > > > Passes input_id struct to the the common probe function for the tsc200x drivers
> > > > instead of just the bustype.
> > > > 
> > > > This allows for the use of the product variable to set the input_dev->name
> > > > variable according to the type of touchscreen used.
> > > > 
> > > > Signed-off-by: Michael Welling <mwelling@ieee.org>
> > > > ---
> > > >  drivers/input/touchscreen/tsc2004.c      | 7 ++++++-
> > > >  drivers/input/touchscreen/tsc2005.c      | 7 ++++++-
> > > >  drivers/input/touchscreen/tsc200x-core.c | 7 ++++---
> > > >  drivers/input/touchscreen/tsc200x-core.h | 2 +-
> > > >  4 files changed, 17 insertions(+), 6 deletions(-)
> > > > 
> > > > diff --git a/drivers/input/touchscreen/tsc2004.c b/drivers/input/touchscreen/tsc2004.c
> > > > index 7295c19..6fe55d5 100644
> > > > --- a/drivers/input/touchscreen/tsc2004.c
> > > > +++ b/drivers/input/touchscreen/tsc2004.c
> > > > @@ -22,6 +22,11 @@
> > > >  #include <linux/regmap.h>
> > > >  #include "tsc200x-core.h"
> > > >  
> > > > +static const struct input_id tsc2004_input_id = {
> > > > +	.bustype = BUS_I2C,
> > > > +	.product = 2004,
> > > > +};
> > > > +
> > > >  static int tsc2004_cmd(struct device *dev, u8 cmd)
> > > >  {
> > > >  	u8 tx = TSC200X_CMD | TSC200X_CMD_12BIT | cmd;
> > > > @@ -42,7 +47,7 @@ static int tsc2004_probe(struct i2c_client *i2c,
> > > >  			 const struct i2c_device_id *id)
> > > >  
> > > >  {
> > > > -	return tsc200x_probe(&i2c->dev, i2c->irq, BUS_I2C,
> > > > +	return tsc200x_probe(&i2c->dev, i2c->irq, &tsc2004_input_id,
> > > >  			     devm_regmap_init_i2c(i2c, &tsc200x_regmap_config),
> > > >  			     tsc2004_cmd);
> > > >  }
> > > > diff --git a/drivers/input/touchscreen/tsc2005.c b/drivers/input/touchscreen/tsc2005.c
> > > > index b9f593d..f2c5f0e 100644
> > > > --- a/drivers/input/touchscreen/tsc2005.c
> > > > +++ b/drivers/input/touchscreen/tsc2005.c
> > > > @@ -24,6 +24,11 @@
> > > >  #include <linux/regmap.h>
> > > >  #include "tsc200x-core.h"
> > > >  
> > > > +static const struct input_id tsc2005_input_id = {
> > > > +	.bustype = BUS_SPI,
> > > > +	.product = 2005,
> > > > +};
> > > > +
> > > >  static int tsc2005_cmd(struct device *dev, u8 cmd)
> > > >  {
> > > >  	u8 tx = TSC200X_CMD | TSC200X_CMD_12BIT | cmd;
> > > > @@ -62,7 +67,7 @@ static int tsc2005_probe(struct spi_device *spi)
> > > >  	if (error)
> > > >  		return error;
> > > >  
> > > > -	return tsc200x_probe(&spi->dev, spi->irq, BUS_SPI,
> > > > +	return tsc200x_probe(&spi->dev, spi->irq, &tsc2005_input_id,
> > > >  			     devm_regmap_init_spi(spi, &tsc200x_regmap_config),
> > > >  			     tsc2005_cmd);
> > > >  }
> > > > diff --git a/drivers/input/touchscreen/tsc200x-core.c b/drivers/input/touchscreen/tsc200x-core.c
> > > > index 26e81d1b..5e625c4 100644
> > > > --- a/drivers/input/touchscreen/tsc200x-core.c
> > > > +++ b/drivers/input/touchscreen/tsc200x-core.c
> > > > @@ -450,7 +450,7 @@ static void tsc200x_close(struct input_dev *input)
> > > >  	mutex_unlock(&ts->mutex);
> > > >  }
> > > >  
> > > > -int tsc200x_probe(struct device *dev, int irq, __u16 bustype,
> > > > +int tsc200x_probe(struct device *dev, int irq, const struct input_id *tsc_id,
> > > >  		  struct regmap *regmap,
> > > >  		  int (*tsc200x_cmd)(struct device *dev, u8 cmd))
> > > >  {
> > > > @@ -547,9 +547,10 @@ int tsc200x_probe(struct device *dev, int irq, __u16 bustype,
> > > >  	snprintf(ts->phys, sizeof(ts->phys),
> > > >  		 "%s/input-ts", dev_name(dev));
> > > >  
> > > > -	input_dev->name = "TSC200X touchscreen";
> > > > +	input_dev->name = devm_kasprintf(dev, GFP_KERNEL, "TSC%04d touchscreen",
> > > > +					tsc_id->product);
> > > 
> > > What about:
> > > 
> > >      if (tsc_id->product == 2005)
> > >           input_dev->name = "TSC2005 touchscreen";
> > >      else
> > >           input_dev->name = "TSC200X touchscreen";
> > > 
> > > We do want to use 'TSC2005' name for TSC2005, because compatibility,
> > > but you should keep TSC200X.... because compatibility. You don't want
> > > to break people's setups by going from TSC200X to TSC2004.
> > 
> > By same logic we shouldn't change from TSC200X back to TSC2005 because of
> > people's possibly new setup in the last 9 months.
> 
> That's your, broken logic.
> 
> TSC200X->TSC2005 needs to be fixed, because people seen the TSC2005
> for past few years.

People might have also seen  TSC2005->TSC200X for the last few months.
They could be dependent on this now and start complaining once we
revert.

I am sorely tempted to leave the name as is. Just adjust your script to
check the name. Something like

TSC_MODEL=`sed -ne 's/^N: Name="TSC\([0-9]\+\) .*/\1/p' /proc/bus/input/devices`
xinput ... "TSC${TSC_MODEL} Touchscreen"

Or fetch the current name from sysfs.

Thanks.

-- 
Dmitry

  parent reply	other threads:[~2016-07-20 16:45 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-17 17:52 v4.1 to v4.7: regression in tsc2005 driver Pavel Machek
2016-07-17 18:24 ` Michael Welling
2016-07-17 18:42   ` Pavel Machek
2016-07-17 18:51     ` Michael Welling
2016-07-17 20:03       ` Pavel Machek
2016-07-17 22:56         ` Michael Welling
2016-07-19 23:51           ` Dmitry Torokhov
2016-07-20  0:39             ` Michael Welling
2016-07-20  0:53               ` Dmitry Torokhov
2016-07-20  1:34                 ` Michael Welling
2016-07-20  1:44                   ` Dmitry Torokhov
2016-07-20  2:09                     ` Michael Welling
2016-07-20  3:49                     ` [PATCH] Input: tsc200x - Report proper input_dev name Michael Welling
2016-07-20  6:31                       ` Pavel Machek
2016-07-20  6:50                         ` Michael Welling
2016-07-20  6:54                           ` Pavel Machek
2016-07-20  7:06                             ` Michael Welling
2016-07-20  7:48                               ` Pavel Machek
2016-07-20 16:45                             ` Dmitry Torokhov [this message]
2016-07-20 16:56                               ` Pali Rohár
2016-07-20 17:04                                 ` Dmitry Torokhov
2016-07-20 17:14                                   ` Dmitry Torokhov
2016-07-20 20:25                                     ` Pavel Machek
2016-07-20 20:37                                     ` Pali Rohár
2016-07-20 16:33                 ` v4.1 to v4.7: regression in tsc2005 driver Pali Rohár
2016-07-20  1:26               ` Aaro Koskinen
2016-07-20  2:18                 ` Michael Welling
2016-07-20  6:25             ` Pavel Machek
2016-07-20 16:23               ` Dmitry Torokhov
2016-07-20 20:22                 ` Pavel Machek
2016-07-20 21:47                 ` Peter Hutterer
2016-07-20 22:20                   ` Dmitry Torokhov
2016-07-20 22:55                     ` Peter Hutterer
2016-07-21  6:32                   ` Pavel Machek
2016-07-21  6:42                     ` Peter Hutterer
2016-07-21  8:54                       ` Pavel Machek
2016-07-21  9:04                         ` Pali Rohár
2016-07-22  0:12                           ` Peter Hutterer
2016-07-25 14:59                             ` Pali Rohár
2016-07-31 21:28                               ` Peter Hutterer
2016-07-22  0:10                         ` Peter Hutterer
2016-07-22  0:57                           ` Dmitry Torokhov
2016-07-25 14:56                     ` Pali Rohár
2016-07-28 19:33                       ` Pavel Machek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160720164503.GB25655@dtor-ws \
    --to=dmitry.torokhov@gmail.com \
    --cc=aaro.koskinen@iki.fi \
    --cc=ivo.g.dimitrov.75@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mwelling@ieee.org \
    --cc=pali.rohar@gmail.com \
    --cc=patrikbachan@gmail.com \
    --cc=pavel@ucw.cz \
    --cc=serge@hallyn.com \
    --cc=sre@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).