From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Michael Welling <mwelling@ieee.org>
Cc: Tony Lindgren <tony@atomide.com>, Pavel Machek <pavel@ucw.cz>,
Felipe Balbi <balbi@ti.com>, Sebastian Reichel <sre@kernel.org>,
Roger Quadros <rogerq@ti.com>,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-input@vger.kernel.org
Subject: Re: [PATCH v3] Input: tsc2005 - Add support for tsc2004
Date: Thu, 29 Oct 2015 19:35:24 -0700 [thread overview]
Message-ID: <20151030023524.GA27354@localhost> (raw)
In-Reply-To: <20151030020845.GA6599@qwerty.qwertyembedded>
On Thu, Oct 29, 2015 at 09:08:45PM -0500, Michael Welling wrote:
> Dmitry,
>
> On Thu, Oct 29, 2015 at 06:45:22PM -0700, Dmitry Torokhov wrote:
> > Hi Michael,
> >
> > On Wed, Oct 28, 2015 at 07:12:34PM -0500, Michael Welling wrote:
> > > Adds support for the i2c based tsc2004.
> > >
> > > Due to the overlapping functionality of the tsc2004 and tsc2005
> > > the common code was moved to a core driver (tsc200x-core).
> > >
> > > Signed-off-by: Michael Welling <mwelling@ieee.org>
> >
> > In addition to what has been discussed in the other email:
> >
> > > ---
> > > v3: Splits the tsc2004 and tsc2005 into separate drivers with
> > > with common routines in tsc200x-core.
> > > v2: Fixes Kconfig based on report for 0-day build bot.
> > > .../bindings/input/touchscreen/tsc2004.txt | 38 +
> >
> > Can we please combine tsc2004.txt and tsc2005.txt?
>
> Sure.
>
> >
> > >
> > > +config TOUCHSCREEN_TSC200X
> > > + tristate
> >
> > Let's call it TOUCHSCREEN_TSC200X_CORE.
>
> Okay.
>
> >
> > > --- /dev/null
> > > +++ b/drivers/input/touchscreen/tsc2004.c
> > > @@ -0,0 +1,73 @@
> > > +/*
> > > + * TSC2004 touchscreen driver
> > > + *
> > > + * Copyright (C) 2015 EMAC Inc.
> > > + * Copyright (C) 2015 QWERTY Embedded Design
> > > + *
> > > + * This program is free software; you can redistribute it and/or modify
> > > + * it under the terms of the GNU General Public License as published by
> > > + * the Free Software Foundation; either version 2 of the License, or
> > > + * (at your option) any later version.
> > > + *
> > > + * This program is distributed in the hope that it will be useful,
> > > + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> > > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> > > + * GNU General Public License for more details.
> > > + *
> >
> > Please drop this empty line in the comment.
> >
>
> No problem.
>
> > > + */
> > > +
> > > +#include <linux/module.h>
> > > +#include <linux/input.h>
> > > +#include <linux/pm.h>
> > > +#include <linux/of.h>
> > > +#include <linux/i2c.h>
> > > +#include <linux/regmap.h>
> > > +#include "tsc200x-core.h"
> > > +
> > > +static int tsc2004_probe(struct i2c_client *i2c,
> > > + const struct i2c_device_id *id)
> > > +
> > > +{
> > > + return tsc200x_probe(&i2c->dev, i2c->irq, BUS_I2C,
> > > + devm_regmap_init_i2c(i2c,
> > > + &tsc2005_regmap_config));
> > > +}
> > > +
> > > +static int tsc2004_remove(struct i2c_client *i2c)
> > > +{
> > > + return tsc200x_remove(&i2c->dev);
> > > +}
> > > +
> > > +static const struct i2c_device_id tsc2004_idtable[] = {
> > > + { "tsc2004", 0 },
> > > + { }
> > > +};
> > > +
> > > +MODULE_DEVICE_TABLE(i2c, tsc2004_idtable);
> > > +
> > > +#ifdef CONFIG_OF
> > > +static const struct of_device_id tsc2004_of_match[] = {
> > > + { .compatible = "ti,tsc2004" },
> > > + { /* sentinel */ }
> > > +};
> > > +MODULE_DEVICE_TABLE(of, tsc2004_of_match);
> > > +#endif
> > > +
> > > +static SIMPLE_DEV_PM_OPS(tsc2004_pm_ops, tsc200x_suspend, tsc200x_resume);
> >
> > Hmm, maybe you should export tsc200x_pm_ops instead of individual
> > functions.
> >
> > > +
> > > +int __maybe_unused tsc200x_suspend(struct device *dev)
> > > +{
> > > + struct tsc2005 *ts = dev_get_drvdata(dev);
> > > +
> > > + mutex_lock(&ts->mutex);
> > > +
> > > + if (!ts->suspended && ts->opened)
> > > + __tsc2005_disable(ts);
> > > +
> > > + ts->suspended = true;
> > > +
> > > + mutex_unlock(&ts->mutex);
> > > +
> > > + return 0;
> > > +}
> > > +EXPORT_SYMBOL_GPL(tsc200x_suspend);
> >
> > __maybe_unused does not make sense here - the symbol is exported and
> > therefore is always used. If you export the pm_ops stucture then you can
> > keep functions as __maybe_unused.
> >
> > BTW, can you generate the patch with -M to let git do the rename
> > detection - it will be easier to see what changed in the core.
>
> Okay.
>
> Here is somthing that I just saw. The tsc2005_cmd function uses a pointer to
> struct tsc2005 as a paramter. So the struct needs to moved into the
> tsc200x-core.h. Should all of the defines be moved there too?
You do not actually need tsc2005 structure in the command function, you
only need the command itself and the generic device structure and then you can
get back to either i2c_client or spi device from it.
>
> Also the old platform data is in a SPI specific include directory.
> Do we want to move this?
If you do not mind whipping up an additional patch - sure.
>
> Also should I change all of the names of the core functions, variables, structs,
> and defines to tsc200x for consistency including the driver struct/defines/etc?
That would be nice, but I'd like it split into different patches if
possible:
1. Split off spi/tsc2005 from the core.
2. Rename core functions to tsc200x.
3. Add tsc2004/i2c module.
Thanks!
--
Dmitry
prev parent reply other threads:[~2015-10-30 2:35 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-29 0:12 [PATCH v3] Input: tsc2005 - Add support for tsc2004 Michael Welling
2015-10-29 7:25 ` kbuild test robot
2015-10-29 14:22 ` Michael Welling
2015-10-29 21:46 ` Arnd Bergmann
2015-10-29 21:53 ` Michael Welling
2015-10-29 22:23 ` Dmitry Torokhov
2015-10-30 0:39 ` Mark Brown
2015-10-30 1:01 ` Michael Welling
[not found] ` <20151030010151.GA4196-hEWAmvUofr51knWWc6b7UDvvZPQxeRhI@public.gmane.org>
2015-10-30 10:40 ` Arnd Bergmann
2015-10-30 1:45 ` Dmitry Torokhov
2015-10-30 2:08 ` Michael Welling
2015-10-30 2:35 ` Dmitry Torokhov [this message]
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=20151030023524.GA27354@localhost \
--to=dmitry.torokhov@gmail.com \
--cc=balbi@ti.com \
--cc=devicetree@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mwelling@ieee.org \
--cc=pavel@ucw.cz \
--cc=rogerq@ti.com \
--cc=sre@kernel.org \
--cc=tony@atomide.com \
/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).