From: Viresh Kumar <viresh.kumar@st.com>
To: Rabin Vincent <rabin@rab.in>
Cc: Linus WALLEIJ <linus.walleij@stericsson.com>,
Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com>,
"sameo@linux.intel.com" <sameo@linux.intel.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Armando VISCONTI <armando.visconti@st.com>,
Shiraz HASHIM <shiraz.hashim@st.com>,
Vipin KUMAR <vipin.kumar@st.com>,
Rajeev KUMAR <rajeev-dlh.kumar@st.com>,
Deepak SIKRI <deepak.sikri@st.com>,
Vipul Kumar SAMAR <vipulkumar.samar@st.com>,
Amit VIRDI <Amit.VIRDI@st.com>,
Pratyush ANAND <pratyush.anand@st.com>,
Bhupesh SHARMA <bhupesh.sharma@st.com>,
"viresh.linux@gmail.com" <viresh.linux@gmail.com>,
Bhavna YADAV <bhavna.yadav@st.com>,
Vincenzo FRASCINO <Vincenzo.FRASCINO@st.com>,
Mirko GARDI <mirko.gardi@st.com>,
"grant.likely@secretlab.ca" <grant.likely@secretlab.ca>
Subject: Re: [PATCH V2 5/5] gpio/gpio-stmpe: ADD support for stmpe variant 801
Date: Mon, 21 Nov 2011 09:50:05 +0530 [thread overview]
Message-ID: <4EC9D175.2070008@st.com> (raw)
In-Reply-To: <CAH+eYFCLauXusdDs75qm2rGB5Y0==bhTbxPJD+gyaaZQVbvsVw@mail.gmail.com>
On 11/18/2011 5:29 PM, Rabin Vincent wrote:
> On Thu, Nov 17, 2011 at 11:02, Viresh Kumar <viresh.kumar@st.com> wrote:
>> diff --git a/drivers/gpio/gpio-stmpe.c b/drivers/gpio/gpio-stmpe.c
>> index 4c980b5..000b019 100644
>> --- a/drivers/gpio/gpio-stmpe.c
>> +++ b/drivers/gpio/gpio-stmpe.c
>> @@ -65,7 +65,15 @@ static void stmpe_gpio_set(struct gpio_chip *chip, unsigned offset, int val)
>> + if (!val && (stmpe->regs[STMPE_IDX_GPSR_LSB] ==
>> + stmpe->regs[STMPE_IDX_GPCR_LSB]))
>> + stmpe_set_bits(stmpe, reg, mask, ~mask);
>> + else
>> + stmpe_set_bits(stmpe, reg, mask, mask);
>> }
>
> This code,
>
> (1) for 801, when clearing one GPIO, sets all the others.
I assumed stmpe_set_bits will only affect bits which are 1
in mask and i was wrong. :(
> (2) for other devices, adds an an unnecessary read (within stmpe_set_bits()),
> which wasn't there before.
>
Correct.
> Please rework to something like:
>
> if (stmpe->regs[...)
> stmpe_set_bits(stmpe, reg, mask, val ? mask : 0);
> else
> stmpe_reg_write(stmpe, reg, mask);
>
Sure.
>>
>> static int stmpe_gpio_direction_output(struct gpio_chip *chip,
>> @@ -125,10 +133,19 @@ static struct gpio_chip template_chip = {
>> static int stmpe_gpio_irq_set_type(struct irq_data *d, unsigned int type)
>> {
>> struct stmpe_gpio *stmpe_gpio = irq_data_get_irq_chip_data(d);
>> + struct stmpe *stmpe = stmpe_gpio->stmpe;
>> int offset = d->irq - stmpe_gpio->irq_base;
>> int regoffset = offset / 8;
>> int mask = 1 << (offset % 8);
>>
>> + /* STMPE801 doesn't have RE and FE registers */
>> + if (stmpe->partnum == STMPE801) {
>> + if (type == IRQ_TYPE_LEVEL_LOW || type == IRQ_TYPE_LEVEL_HIGH)
>> + return 0;
>
> This looks wrong. From the datasheet I see that it supports edges only,
> so perhaps you meant to say IRQ_TYPE_EDGE_* above.
>
I meant to say IRQ_TYPE_LEVEL* only, but i was wrong. I didn't read the manual
correctly. :(
> In that case please reorganize this to add the return 0 after the
> existing check which excludes levels (below).
>
Sure
--
viresh
next prev parent reply other threads:[~2011-11-21 4:20 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-17 5:32 [PATCH V2 0/5] stmpe: mfd & gpio updates Viresh Kumar
2011-11-17 5:32 ` [PATCH V2 1/5] mfd/stmpe: separate out controller and interface specific code Viresh Kumar
2011-11-17 5:32 ` [PATCH V2 2/5] mfd/stmpe: Add support for SPI interface Viresh Kumar
2011-11-17 5:32 ` [PATCH V2 3/5] mfd/stmpe: Add support for stmpe variant 610 Viresh Kumar
2011-11-17 9:12 ` Linus Walleij
2011-11-17 5:32 ` [PATCH V2 4/5] mfd/stmpe: ADD support for stmpe variant 801 Viresh Kumar
2011-11-17 5:32 ` [PATCH V2 5/5] gpio/gpio-stmpe: " Viresh Kumar
2011-11-18 11:59 ` Rabin Vincent
2011-11-21 4:20 ` Viresh Kumar [this message]
2011-11-21 14:51 ` Mark Brown
2011-11-22 3:48 ` Viresh Kumar
2011-12-12 14:20 ` Samuel Ortiz
2011-12-13 3:34 ` Viresh Kumar
2011-12-13 20:38 ` Samuel Ortiz
2011-12-14 3:59 ` Viresh Kumar
2011-11-21 4:32 ` [PATCH 5/5 V3] " Viresh Kumar
2011-12-19 17:53 ` [PATVCH V3 Resend 5/5] " Samuel Ortiz
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=4EC9D175.2070008@st.com \
--to=viresh.kumar@st.com \
--cc=Amit.VIRDI@st.com \
--cc=Vincenzo.FRASCINO@st.com \
--cc=armando.visconti@st.com \
--cc=bhavna.yadav@st.com \
--cc=bhupesh.sharma@st.com \
--cc=deepak.sikri@st.com \
--cc=grant.likely@secretlab.ca \
--cc=linus.walleij@stericsson.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mirko.gardi@st.com \
--cc=pratyush.anand@st.com \
--cc=rabin@rab.in \
--cc=rajeev-dlh.kumar@st.com \
--cc=sameo@linux.intel.com \
--cc=shiraz.hashim@st.com \
--cc=srinidhi.kasagar@stericsson.com \
--cc=vipin.kumar@st.com \
--cc=vipulkumar.samar@st.com \
--cc=viresh.linux@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).