LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Dmitry Torokhov <dtor@mail.ru>,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	Liam Girdwood <liam.girdwood@wolfsonmicro.com>,
	Graeme Gregory <gg@opensource.wolfsonmicro.com>,
	Dmitry Baryshkov <dbaryshkov@gmail.com>,
	Rodolfo Giometti <giometti@enneenne.com>,
	Russell King <rmk@arm.linux.org.uk>,
	Pete MacKay <linux01@architechnical.net>,
	Marc Kleine-Budde <mkl@pengutronix.de>,
	Ian Molton <spyro@f2s.com>, Vincent Sanders <vince@kyllikki.org>,
	Andrew Zabolotny <zap@homelink.ru>
Subject: Re: [PATCH 1/6] Core driver for WM97xx touchscreens
Date: Thu, 28 Feb 2008 15:30:49 +0000	[thread overview]
Message-ID: <20080228153048.GB17356@rakim.wolfsonmicro.main> (raw)
In-Reply-To: <20080227230928.993d424e.akpm@linux-foundation.org>

On Wed, Feb 27, 2008 at 11:09:28PM -0800, Andrew Morton wrote:

> Nice looking drivers.

Thanks.

> On Tue, 26 Feb 2008 13:40:13 +0000 Mark Brown <broonie@opensource.wolfsonmicro.com> wrote:

> > +	queue_delayed_work(wm->ts_workq, &wm->ts_reader, 0);

> This is equvaltnet to queue_work().

> Why queue the work instead of just callng it synchronously right here?

No good reason any more, I think.  I'll take a closer look and either
change it to an immediate call or document what's going on.

> > +static irqreturn_t wm97xx_pen_interrupt(int irq, void *dev_id)
> > +{
> > +	struct wm97xx *wm = dev_id;
> > +	wm->mach_ops->irq_enable(wm, 0);
> > +	queue_work(wm->ts_workq, &wm->pen_event_work);
> > +	return IRQ_HANDLED;
> > +}

> We can lose events, can't we?  We only have one work to queue, and if it is
> already queued, the queue_work() here is a no-op.

> otoh there's no payload so there's actually no data to lose.

Indeed - only scheduling the work a single time is exactly the behaviour
that's desired here.

> Still, this stands out a bit and perhaps a comment which describes the
> overall interrupt handling design would help here.

I agree, I'll add something.

> > +	if (wm->pen_is_down || !wm->pen_irq)
> > +		queue_delayed_work(wm->ts_workq, &wm->ts_reader,
> > +				   wm->ts_reader_interval);
> > +}

> again, if this work is already scheduled, your queue_delayed_work() here is
> a no-op.  Will things all work correctly?

Yes, the worst that would happen would be that we'd read one less sample
which might cause a glitch in input but we're reading sufficiently often
to make that not an issue.

> A bit of whitecpace inconsistency there.

Fixed, thanks.

> > +	 * failed to acquire it then we need to poll.
> > +	 */
> > +	if (wm->pen_irq == 0)
> > +		queue_delayed_work(wm->ts_workq, &wm->ts_reader,
> > +				   wm->ts_reader_interval);
> > +
> > +	return 0;
> > +}

> So...  this driver continuously polls the hardware at 100HZ?  If so,
> powertop users will come after you with pitchforks.

It'll only do that while the pen is down.  It'd be possible to turn that
down but that needs to be traded off against responsiveness.

If the user has provided an accelerated touch driver then while the pen
is up we won't poll the device at all, relying on an interrupt to wake
the driver up when the pen goes down.  We strongly recommend doing this
for power sensitive applications but it requires board-specific code.

If no acclerated touch driver is provided then we don't have much option
other than polling but the driver will gradually back off to 10Hz.  This
is still far from ideal but not quite so bad.  Reducing it any more than
that would make the pen down event unresponsive.

> > +#ifdef CONFIG_TOUCHSCREEN_WM9713
> > +	case 0x13:
> > +		wm->codec = &wm9713_codec;
> > +		break;
> > +#endif

> That's a wee bit combersome.  Really a "core" should not know about its
> specific clients.  A better and more typical design would have the clients
> registering themselves with the core via some registration interface.

Yes, that would be nicer.  Unfortunately the driver isn't actually fully
factored out like that yet - there are still a couple of places in the
core code with device-specific checks.  We could improve it further but
it's probably more trouble than it's worth until more substantial work
such as adding new chips is required.

> > +	/* set up touch configuration */
> > +	wm->input_dev->name = "wm97xx touchscreen";

> spaces in names are OK here?  They can make proc files basically
> unparseable.

Yes, it's fine.  This ends up in /proc/bus/input/devices as:

   N: Name="wm97xx touchscreen"

which is parsable and a quick survey of drivers/input/touchscreen
suggests that spaces are even the common case for touchscreen drivers.

> The kernel->userspace interface looks fairly complex.  Is it documented
> anywhere?

I'm not aware of anything specific to touchscreens beyond the source to
existing applications and drivers but IME it's fairly straightforward
within the input framework.

> > +#else
> > +#define wm97xx_resume		NULL
> > +#endif

> It's strange to see a .resume but no .suspend.

Yes.  The actual chip shutdown is handled by AC97 though we really
should quiesce the poll if it is running when we suspend - I'll add
something for that.

> > +/*
> > + * WM97xx AC97 Touchscreen registers
> > + */

> ac97 stuff?  But I saw no appropriate dependencies for this in the Kconfig
> patch?

Yes, they're AC97 parts.  There's this in Kconfig ATM:

+config TOUCHSCREEN_WM97XX
+       tristate "Support for WM97xx AC97 touchscreen controllers"
+       depends on AC97_BUS

I'm not sure what else would be useful?

> > +/*
> > + * Codec GPIO wake
> > + */
> > +enum wm97xx_gpio_wake {
> > +    WM97XX_GPIO_WAKE,
> > +    WM97XX_GPIO_NOWAKE
> > +};

> Are these gpio's really gp?  If so, should this driver be using the
> drivers/gpio/ infrastructure?

Well, they're multi-function pins so they can do GPIO plus specific
functionality for the device but yes they could do that.  They are
rarely used as fully GP pins since the SoC based systems where these
codecs are most frequently deployed usually have an abundance of GPIO
pins on the SoC itself which don't require going over the AC97 bus to
manipulate.

Aside from the disruption to existing users the main problem with doing
that is that it would require that platform data be passed into the
driver to specify the base for the GPIOs (this would be useful for all
the other configuration too).  I can't see a suitably nice way to do
that at the minute, unfortunately.  Without such a method I'd really
rather avoid using gpiolib since it doesn't feel like a sufficient win.

Thanks for the review.

  reply	other threads:[~2008-02-28 15:31 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <12040332183316-git-send-email-broonie@opensource.wolfsonmicro.com>
2008-02-26 13:40 ` Mark Brown
     [not found]   ` <12040332182008-git-send-email-broonie@opensource.wolfsonmicro.com>
2008-02-26 13:40     ` [PATCH 4/6] Add chip driver for WM9713 touchscreen Mark Brown
     [not found]   ` <12040332182098-git-send-email-broonie@opensource.wolfsonmicro.com>
2008-02-26 13:40     ` [PATCH 6/6] Build system and MAINTAINERS entry for WM97xx touchscreen drivers Mark Brown
     [not found]   ` <12040332181161-git-send-email-broonie@opensource.wolfsonmicro.com>
2008-02-26 13:40     ` [PATCH 2/6] Add chip driver for WM9705 touchscreen Mark Brown
2008-02-28  7:09     ` Andrew Morton
2008-02-28 11:46       ` Mark Brown
     [not found]   ` <12040332181394-git-send-email-broonie@opensource.wolfsonmicro.com>
2008-02-26 13:40     ` [PATCH 3/6] Add chip driver for WM9712 touchscreen Mark Brown
2008-02-28  7:09     ` Andrew Morton
2008-02-28 13:07       ` Mark Brown
     [not found]   ` <12040332181746-git-send-email-broonie@opensource.wolfsonmicro.com>
2008-02-26 13:40     ` [PATCH 5/6] Driver for WM97xx touchscreens in streaming mode on Mainstone Mark Brown
2008-02-28  7:09     ` Andrew Morton
2008-02-29 16:18       ` Mark Brown
2008-02-28  7:09 ` [PATCH 1/6] Core driver for WM97xx touchscreens Andrew Morton
2008-02-28 15:30   ` Mark Brown [this message]
2008-04-01 10:28 WM97xx touchscreen drivers Mark Brown
2008-04-01 10:36 ` [PATCH 1/6] Core driver for WM97xx touchscreens Mark Brown
  -- strict thread matches above, loose matches on Subject: below --
2008-03-20  9:39 WM97xx touchscreen drivers Mark Brown
2008-03-20  9:42 ` [PATCH 1/6] Core driver for WM97xx touchscreens Mark Brown
2008-03-04 14:02 WM97xx touchscreen drivers Mark Brown
2008-03-04 14:04 ` [PATCH 1/6] Core driver for WM97xx touchscreens Mark Brown
2008-02-29 16:50 WM97xx touchscreen drivers Mark Brown
2008-02-29 16:52 ` [PATCH 1/6] Core driver for WM97xx touchscreens Mark Brown
2008-02-13 14:06 [UPDATED v7] WM97xx touchscreen drivers Mark Brown
2008-02-13 14:13 ` [PATCH 1/6] Core driver for WM97xx touchscreens Mark Brown
2008-02-14 15:10   ` Dmitry
2008-02-14 15:55     ` Mark Brown
2008-02-12 10:17 [UPDATED v6] WM97xx touchscreen drivers Mark Brown
2008-02-12 10:21 ` [PATCH 1/6] Core driver for WM97xx touchscreens Mark Brown
2008-02-12 22:58   ` Dmitry Baryshkov
2008-02-13 11:19     ` Mark Brown
2008-02-13 11:32       ` Dmitry
2008-02-13  4:28   ` Pete MacKay
2008-02-13 10:11     ` Mark Brown
2008-01-26 15:18 [UPDATED v4] WM97xx touchscreen drivers Mark Brown
2008-01-26 17:28 ` [PATCH 1/6] Core driver for WM97xx touchscreens Mark Brown
2008-02-07 22:07   ` Dmitry Torokhov
2008-02-08 11:27     ` Mark Brown
2008-01-21 15:24 [UPDATED v3] WM97xx touchscreen drivers Mark Brown
2008-01-21 15:24 ` [PATCH 1/6] Core driver for WM97xx touchscreens Mark Brown
2008-01-26  9:58   ` Dmitry Baryshkov
2008-01-26 10:18     ` Dmitry Baryshkov
2008-01-26 11:47       ` Mark Brown
2008-01-26 12:05         ` Dmitry
2008-01-10 11:51 Mark Brown

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=20080228153048.GB17356@rakim.wolfsonmicro.main \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=akpm@linux-foundation.org \
    --cc=dbaryshkov@gmail.com \
    --cc=dtor@mail.ru \
    --cc=gg@opensource.wolfsonmicro.com \
    --cc=giometti@enneenne.com \
    --cc=liam.girdwood@wolfsonmicro.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux01@architechnical.net \
    --cc=mkl@pengutronix.de \
    --cc=rmk@arm.linux.org.uk \
    --cc=spyro@f2s.com \
    --cc=vince@kyllikki.org \
    --cc=zap@homelink.ru \
    --subject='Re: [PATCH 1/6] Core driver for WM97xx touchscreens' \
    /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

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).