From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Lee Jones <lee.jones@linaro.org>
Cc: Jonathan Cameron <jic23@kernel.org>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Samuel Ortiz <sameo@linux.intel.com>,
Zubair Lutfullah <zubair.lutfullah@gmail.com>,
Felipe Balbi <balbi@ti.com>,
linux-iio@vger.kernel.org, linux-input@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 5/5] mfd: input: iio: ti_amm335x: rework TSC/ADC synchronisation
Date: Thu, 19 Dec 2013 11:36:16 +0100 [thread overview]
Message-ID: <52B2CC20.8040308@linutronix.de> (raw)
In-Reply-To: <20131219084206.GC2621@lee--X1>
On 12/19/2013 09:42 AM, Lee Jones wrote:
> Spell check this entire block.
will do.
> Smileys in commit messages are generally a bad idea.
will drop.
> Please insert '\n's between paragraphs.
Okay.
> Proof read, as some of the sentences are not comprehensible.
I am going to retry.
> /* MFD Parts */
>
>> --- a/drivers/mfd/ti_am335x_tscadc.c
>> +++ b/drivers/mfd/ti_am335x_tscadc.c
>> @@ -24,6 +24,7 @@
>
>> -static void am335x_tsc_se_update(struct ti_tscadc_dev *tsadc)
>> +void am335x_tsc_se_set(struct ti_tscadc_dev *tsadc, u32 val)
>> {
>> + unsigned long flags;
>> +
>> + spin_lock_irqsave(&tsadc->reg_lock, flags);
>> + tsadc->reg_se_cache |= val;
>> tscadc_writel(tsadc, REG_SE, tsadc->reg_se_cache);
>> + spin_unlock_irqrestore(&tsadc->reg_lock, flags);
>> }
>> +EXPORT_SYMBOL_GPL(am335x_tsc_se_set);
>>
>> -void am335x_tsc_se_set(struct ti_tscadc_dev *tsadc, u32 val)
>> +void am335x_tsc_se_tsc_set(struct ti_tscadc_dev *tsadc, u32 val)
>
> What's the difference between:
>
> am335x_tsc_se_set()
> and
> am335x_tsc_se_tsc_set()
The code is the same. I tried to avoid to call the function with the
tsc in its name from the adc part. The continuous mode is still using
this interface because its content has to remain while the TSC is
updating the register. Only the write of the ADC in single-shot-mode is
used as a "one-time-thing" and not required later.
> Why don't you have a am335x_tsc_se_tsc_set_tsc_se_tsc_set() ;)
>
> Perhaps a better function name might be in order.
the am335x_tsc is the namespace. se the register followed by the user
which is tsc or adc but I know what you mean. I will try to replace it
with _cached and _once so we get rid of the part where is twice in the
name of the function.
>
>> {
>> unsigned long flags;
>>
>> spin_lock_irqsave(&tsadc->reg_lock, flags);
>> - tsadc->reg_se_cache |= val;
>> - am335x_tsc_se_update(tsadc);
>> + tsadc->reg_se_cache = val;
>> + if (tsadc->adc_in_use || tsadc->adc_waiting) {
>> + if (tsadc->adc_waiting)
>> + wake_up(&tsadc->reg_se_wait);
>
> So if we're either in-use or waiting, the step mask is never set?
>
> But I guess that the touchscreen driver assumes it has been set.
>
> Is this okay?
Yes this is okay because the ADC driver is waiting to use it
exclusively. The ADC driver invokes am335x_tsc_se_adc_done() once it is
done so TSC's mask which is saved here will then be written to the
register.
>
>> + } else {
>> + tscadc_writel(tsadc, REG_SE, val);
>> + }
>
> I think this would be better represented as:
>
> if (tsadc->adc_waiting)
> wake_up(&tsadc->reg_se_wait);
> else if (!tsadc->adc_in_use)
> tscadc_writel(tsadc, REG_SE, val);
I think that looks fine. I will double check it and take your proposal
if nothing goes wrong.
Sebastian
next prev parent reply other threads:[~2013-12-19 10:36 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-18 16:52 am335x: IIO/ADC fixes if used together with TSC Sebastian Andrzej Siewior
2013-12-18 16:52 ` [PATCH 1/5] iio: ti_am335x_adc: adjust the closing bracket in tiadc_read_raw() Sebastian Andrzej Siewior
2013-12-19 8:49 ` Lee Jones
2013-12-18 16:52 ` [PATCH 2/5] mfd: ti_am335x_tscadc: make am335x_tsc_se_update() local Sebastian Andrzej Siewior
2013-12-19 8:53 ` Lee Jones
2013-12-18 16:52 ` [PATCH 3/5] mfd: ti_am335x_tscadc: don't read back REG_SE Sebastian Andrzej Siewior
2013-12-19 8:56 ` Lee Jones
2013-12-18 16:52 ` [PATCH 4/5] mfd: ti_am335x: drop am335x_tsc_se_update() from resume path Sebastian Andrzej Siewior
[not found] ` <1387385577-24447-5-git-send-email-bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
2013-12-19 9:00 ` Lee Jones
2013-12-18 16:52 ` [PATCH 5/5] mfd: input: iio: ti_amm335x: rework TSC/ADC synchronisation Sebastian Andrzej Siewior
[not found] ` <1387385577-24447-6-git-send-email-bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
2013-12-19 8:42 ` Lee Jones
2013-12-19 10:36 ` Sebastian Andrzej Siewior [this message]
2013-12-18 17:25 ` am335x: IIO/ADC fixes if used together with TSC Jonathan Cameron
2013-12-18 18:34 ` Sebastian Andrzej Siewior
[not found] ` <a3513779-5ede-4e33-b29d-0cc8e73f8282@email.android.com>
2013-12-19 8:48 ` Lee Jones
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=52B2CC20.8040308@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=balbi@ti.com \
--cc=dmitry.torokhov@gmail.com \
--cc=jic23@kernel.org \
--cc=lee.jones@linaro.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sameo@linux.intel.com \
--cc=zubair.lutfullah@gmail.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).