From: Andrew Morton <akpm@linux-foundation.org>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>
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>,
Mike Arthur <mike.arthur@wolfsonmicro.com>,
Dmitry Baryshkov <dbaryshkov@gmail.com>,
Stanley Cai <stanley.cai@intel.com>,
Rodolfo Giometti <giometti@enneenne.com>,
Russell King <rmk@arm.linux.org.uk>,
Marc Kleine-Budde <mkl@pengutronix.de>,
Pete MacKay <linux01@architechnical.net>,
Ian Molton <spyro@f2s.com>, Vince Sanders <vince@kyllikki.org>,
Andrew Zabolotny <zap@homelink.ru>
Subject: Re: [PATCH 2/6] Add chip driver for WM9705 touchscreen
Date: Wed, 27 Feb 2008 23:09:32 -0800 [thread overview]
Message-ID: <20080227230932.3e7f699c.akpm@linux-foundation.org> (raw)
In-Reply-To: <12040332181161-git-send-email-broonie@opensource.wolfsonmicro.com>
On Tue, 26 Feb 2008 13:40:14 +0000 Mark Brown <broonie@opensource.wolfsonmicro.com> wrote:
> +/*
> + * Set current used for pressure measurement.
> + *
> + * Set pil = 2 to use 400uA
> + * pil = 1 to use 200uA and
> + * pil = 0 to disable pressure measurement.
> + *
> + * This is used to increase the range of values returned by the adc
> + * when measureing touchpanel pressure.
> + */
> +static int pil;
> +module_param(pil, int, 0);
> +MODULE_PARM_DESC(pil, "Set current used for pressure measurement.");
> +
> +/*
> + * Set threshold for pressure measurement.
> + *
> + * Pen down pressure below threshold is ignored.
> + */
> +static int pressure = DEFAULT_PRESSURE & 0xfff;
> +module_param(pressure, int, 0);
> +MODULE_PARM_DESC(pressure, "Set threshold for pressure measurement.");
> +
> +/*
> + * Set adc sample delay.
> + *
> + * For accurate touchpanel measurements, some settling time may be
> + * required between the switch matrix applying a voltage across the
> + * touchpanel plate and the ADC sampling the signal.
> + *
> + * This delay can be set by setting delay = n, where n is the array
> + * position of the delay in the array delay_table below.
> + * Long delays > 1ms are supported for completeness, but are not
> + * recommended.
> + */
> +static int delay = 4;
> +module_param(delay, int, 0);
> +MODULE_PARM_DESC(delay, "Set adc sample delay.");
> +
> +/*
> + * Pen detect comparator threshold.
> + *
> + * 0 to Vmid in 15 steps, 0 = use zero power comparator with Vmid threshold
> + * i.e. 1 = Vmid/15 threshold
> + * 15 = Vmid/1 threshold
> + *
> + * Adjust this value if you are having problems with pen detect not
> + * detecting any down events.
> + */
> +static int pdd = 8;
> +module_param(pdd, int, 0);
> +MODULE_PARM_DESC(pdd, "Set pen detect comparator threshold");
I guess that's all the documentation we get ;) It won't kill us - we've done
worse..
It would be rather nice if the kerneldoc system could extract the above
comments and put them in a module-parameters-documentation section, but I
don't think it can do that.
> ...
>
> +/*
> + * Read a sample from the WM9705 adc in polling mode.
> + */
> +static int wm9705_poll_sample(struct wm97xx *wm, int adcsel, int *sample)
> +{
> + int timeout = 5 * delay;
> +
> + if (!wm->pen_probably_down) {
> + u16 data = wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER_RD);
> + if (!(data & WM97XX_PEN_DOWN))
> + return RC_PENUP;
> + wm->pen_probably_down = 1;
> + }
> +
> + /* set up digitiser */
> + if (adcsel & 0x8000)
> + adcsel = ((adcsel & 0x7fff) + 3) << 12;
> +
> + if (wm->mach_ops && wm->mach_ops->pre_sample)
> + wm->mach_ops->pre_sample(adcsel);
> + wm97xx_reg_write(wm, AC97_WM97XX_DIGITISER1,
> + adcsel | WM97XX_POLL | WM97XX_DELAY(delay));
> +
> + /* wait 3 AC97 time slots + delay for conversion */
> + poll_delay(delay);
> +
> + /* wait for POLL to go low */
> + while ((wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER1) & WM97XX_POLL)
> + && timeout) {
> + udelay(AC97_LINK_FRAME);
> + timeout--;
> + }
> +
> + if (timeout <= 0) {
timeout cannot be negative here.
> + /* If PDEN is set, we can get a timeout when pen goes up */
> + if (is_pden(wm))
> + wm->pen_probably_down = 0;
> + else
> + dev_dbg(wm->dev, "adc sample timeout");
> + return RC_PENUP;
> + }
> +
> + *sample = wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER_RD);
> + if (wm->mach_ops && wm->mach_ops->post_sample)
> + wm->mach_ops->post_sample(adcsel);
> +
> + /* check we have correct sample */
> + if ((*sample & WM97XX_ADCSEL_MASK) != adcsel) {
> + dev_dbg(wm->dev, "adc wrong sample, read %x got %x", adcsel,
> + *sample & WM97XX_ADCSEL_MASK);
> + return RC_PENUP;
> + }
> +
> + if (!(*sample & WM97XX_PEN_DOWN)) {
> + wm->pen_probably_down = 0;
> + return RC_PENUP;
> + }
> +
> + return RC_VALID;
> +}
> +
next prev parent reply other threads:[~2008-02-28 7:09 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <c815fe5525d01cea7be830ca51af962d3aec360d.1204032930.git.broonie@opensource.wolfsonmicro.com>
2008-02-26 13:40 ` [PATCH 1/6] Core driver for WM97xx touchscreens Mark Brown
2008-02-26 13:40 ` Mark Brown
2008-02-28 7:09 ` Andrew Morton
2008-02-28 15:30 ` Mark Brown
[not found] ` <ca8e67a96dfec6847d7f0af41344898c7ad9a863.1204032930.git.broonie@opensource.wolfsonmicro.com>
2008-02-26 13:40 ` [PATCH 2/6] Add chip driver for WM9705 touchscreen Mark Brown
2008-02-26 13:40 ` Mark Brown
2008-02-28 7:09 ` Andrew Morton [this message]
2008-02-28 11:46 ` Mark Brown
[not found] ` <d45dbc09dbd92475ebf37863b5411ecc59d115a6.1204032930.git.broonie@opensource.wolfsonmicro.com>
2008-02-26 13:40 ` [PATCH 3/6] Add chip driver for WM9712 touchscreen Mark Brown
2008-02-26 13:40 ` Mark Brown
2008-02-28 7:09 ` Andrew Morton
2008-02-28 13:07 ` Mark Brown
[not found] ` <39788ba97da064bd4e4157a5532322f9188210a0.1204032930.git.broonie@opensource.wolfsonmicro.com>
2008-02-26 13:40 ` [PATCH 4/6] Add chip driver for WM9713 touchscreen Mark Brown
2008-02-26 13:40 ` Mark Brown
[not found] ` <56b1664f568caeb9c766066d2b7065ea24449632.1204032930.git.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-26 13:40 ` Mark Brown
2008-02-28 7:09 ` Andrew Morton
2008-02-29 16:18 ` Mark Brown
[not found] ` <9a8a30282d61d8a8b178196ae9bee4a123f459a2.1204032930.git.broonie@opensource.wolfsonmicro.com>
2008-02-26 13:40 ` [PATCH 6/6] Build system and MAINTAINERS entry for WM97xx touchscreen drivers Mark Brown
2008-02-26 13:40 ` Mark Brown
2008-04-01 10:28 Mark Brown
2008-04-01 10:36 ` [PATCH 1/6] Core driver for WM97xx touchscreens Mark Brown
2008-04-01 10:36 ` [PATCH 2/6] Add chip driver for WM9705 touchscreen 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-20 9:42 ` [PATCH 2/6] Add chip driver for WM9705 touchscreen 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-03-04 14:04 ` [PATCH 2/6] Add chip driver for WM9705 touchscreen 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-29 16:52 ` [PATCH 2/6] Add chip driver for WM9705 touchscreen 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-13 14:13 ` [PATCH 2/6] Add chip driver for WM9705 touchscreen 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 10:21 ` [PATCH 2/6] Add chip driver for WM9705 touchscreen 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-01-26 17:28 ` [PATCH 2/6] Add chip driver for WM9705 touchscreen 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-21 15:24 ` [PATCH 2/6] Add chip driver for WM9705 touchscreen Mark Brown
2008-01-10 11:51 [PATCH 1/6] Core driver for WM97xx touchscreens Mark Brown
2008-01-10 11:51 ` [PATCH 2/6] Add chip driver for WM9705 touchscreen 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=20080227230932.3e7f699c.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=broonie@opensource.wolfsonmicro.com \
--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=mike.arthur@wolfsonmicro.com \
--cc=mkl@pengutronix.de \
--cc=rmk@arm.linux.org.uk \
--cc=spyro@f2s.com \
--cc=stanley.cai@intel.com \
--cc=vince@kyllikki.org \
--cc=zap@homelink.ru \
/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).