From: lars@metafoo.de (Lars-Peter Clausen)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/3 V2] iio: mxs: Implement support for touchscreen
Date: Thu, 10 Jan 2013 19:19:34 +0100 [thread overview]
Message-ID: <50EF0636.6090903@metafoo.de> (raw)
In-Reply-To: <20130110174630.GB2797@core.coreip.homeip.net>
On 01/10/2013 06:46 PM, Dmitry Torokhov wrote:
> On Thu, Jan 10, 2013 at 10:48:37AM +0100, Marek Vasut wrote:
>> Dear Dmitry Torokhov,
>>
>> [...]
>>>>> + enum mxs_lradc_ts use_touchscreen;
>>>>> + unsigned int stop_touchscreen:1;
>>>>> + unsigned int use_touchbutton:1;
>>>
>>> Can we make them bools instead of bit fields?
>>
>> Sure.
>> [...]
>>
>>>>> +static void mxs_lradc_ts_close(struct input_dev *dev)
>>>>> +{
>>>>> + struct mxs_lradc *lradc = input_get_drvdata(dev);
>>>>> +
>>>>> + /* Indicate the touchscreen is stopping. */
>>>>> + lradc->stop_touchscreen = 1;
>>>>> +
>>>>> + /* Disable touchscreen touch-detect IRQ. */
>>>>> + writel(LRADC_CTRL1_TOUCH_DETECT_IRQ_EN,
>>>>> + lradc->base + LRADC_CTRL1 + STMP_OFFSET_REG_CLR);
>>>>> +
>>>>> + /* Power-down touchscreen touch-detect circuitry. */
>>>>> + writel(LRADC_CTRL0_TOUCH_DETECT_ENABLE,
>>>>> + lradc->base + LRADC_CTRL0 + STMP_OFFSET_REG_CLR);
>>>
>>> These 2 writes are racing with writes in mxs_lradc_ts_work(). I think
>>> you need to:
>>>
>>> lradc->stop_touchscreen = true;
>>> mb();
>>
>> Nice catch, do we need the memory barrier here though, is it not enough to
>> reorder the cancel_work_sync() just before the register writes?
>
> You really need to make sure that setting lradc->stop_touchscreen =
> true; is not reordered, because otherwise you may cancel the work,
> interrupt happens and reschedules it, and then you set up the flag.
Does it really matter? If it is rescheduled you get one event more reported
after the device has been closed, but input core should ignore it anyway, or
doesn't it?
Btw. why not use threaded interrupts instead of irq + workqueue combo?
- Lars
next prev parent reply other threads:[~2013-01-10 18:19 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-14 1:46 [PATCH 1/3 V2] iio: mxs: Remove unused struct mxs_lradc_chan Marek Vasut
2012-12-14 1:46 ` [PATCH 2/3 V2] iio: mxs: Implement support for touchscreen Marek Vasut
2012-12-14 1:58 ` Fabio Estevam
2012-12-14 2:04 ` Marek Vasut
2012-12-19 17:01 ` Marek Vasut
2012-12-27 12:16 ` Jonathan Cameron
2013-01-08 19:28 ` Marek Vasut
2013-01-09 20:01 ` Jonathan Cameron
2013-01-09 20:17 ` Marek Vasut
2013-01-09 21:38 ` Jonathan Cameron
2013-01-09 21:54 ` Marek Vasut
2013-01-10 0:57 ` Dmitry Torokhov
2013-01-10 9:48 ` Marek Vasut
2013-01-10 17:46 ` Dmitry Torokhov
2013-01-10 18:19 ` Lars-Peter Clausen [this message]
2013-01-10 18:44 ` Dmitry Torokhov
2012-12-27 11:31 ` Jonathan Cameron
2012-12-27 18:19 ` Marek Vasut
2012-12-14 1:46 ` [PATCH 3/3] iio: mxs: Enable touchscreen on m28evk Marek Vasut
2012-12-27 11:25 ` [PATCH 1/3 V2] iio: mxs: Remove unused struct mxs_lradc_chan Jonathan Cameron
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=50EF0636.6090903@metafoo.de \
--to=lars@metafoo.de \
--cc=linux-arm-kernel@lists.infradead.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).