From: srinivas.kandagatla@st.com (srinivas kandagatla)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v1 3/5] pinctrl: st: Add software edge trigger interrupt support.
Date: Wed, 15 Jan 2014 14:44:22 +0000 [thread overview]
Message-ID: <52D69EC6.8010705@st.com> (raw)
In-Reply-To: <CACRpkdbFGOm2xm5H+of_NuJ6DVmBDcEODZbDxVU8nGC-RU64Tw@mail.gmail.com>
Thankyou for reviewing the patch.
On 15/01/14 14:27, Linus Walleij wrote:
> On Tue, Jan 14, 2014 at 3:52 PM, <srinivas.kandagatla@st.com> wrote:
>
>> From: Srinivas Kandagatla <srinivas.kandagatla@st.com>
>>
>> ST pin controller does not have hardware support for detecting edge
>> triggered interrupts, It only has level triggering support.
>> This patch attempts to fake up edge triggers from hw level trigger
>> support in software. With this facility now the gpios can be easily used
>> for keypads, otherwise it would be difficult for drivers like keypads to
>> work with level trigger interrupts.
>>
>> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com>
>
> Clever! Mostly I like the patch as it is but:
>
>> for_each_set_bit(n, &port_active, BITS_PER_LONG) {
>> + /* check if we are detecting fake edges ... */
>> + pin_edge_cfg = ST_IRQ_EDGE_CONF(bank_edge_mask, n);
>> +
>> + if (pin_edge_cfg) {
>> + /* edge detection. */
>> + val = st_gpio_get(&bank->gpio_chip, n);
>> + if (val)
>> + writel(BIT(n), bank->base + REG_PIO_SET_PCOMP);
>> + else
>> + writel(BIT(n), bank->base + REG_PIO_CLR_PCOMP);
>> +
>> + if (pin_edge_cfg != ST_IRQ_EDGE_BOTH &&
>> + !((pin_edge_cfg & ST_IRQ_EDGE_FALLING) ^ val))
>> + continue;
>> + }
>> +
>
> Please insert comments here to explain what you are actually doing
> because I sure as hell do not understand this code without comments
> describing the trick used.
I agree, I will document this logic in next version.
Thanks,
srini
>
> Yours,
> Linus Walleij
>
>
WARNING: multiple messages have this Message-ID (diff)
From: srinivas kandagatla <srinivas.kandagatla@st.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>,
Mark Rutland <mark.rutland@arm.com>,
Ian Campbell <ijc+devicetree@hellion.org.uk>,
Kumar Gala <galak@codeaurora.org>, Rob Landley <rob@landley.net>,
Russell King <linux@arm.linux.org.uk>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v1 3/5] pinctrl: st: Add software edge trigger interrupt support.
Date: Wed, 15 Jan 2014 14:44:22 +0000 [thread overview]
Message-ID: <52D69EC6.8010705@st.com> (raw)
In-Reply-To: <CACRpkdbFGOm2xm5H+of_NuJ6DVmBDcEODZbDxVU8nGC-RU64Tw@mail.gmail.com>
Thankyou for reviewing the patch.
On 15/01/14 14:27, Linus Walleij wrote:
> On Tue, Jan 14, 2014 at 3:52 PM, <srinivas.kandagatla@st.com> wrote:
>
>> From: Srinivas Kandagatla <srinivas.kandagatla@st.com>
>>
>> ST pin controller does not have hardware support for detecting edge
>> triggered interrupts, It only has level triggering support.
>> This patch attempts to fake up edge triggers from hw level trigger
>> support in software. With this facility now the gpios can be easily used
>> for keypads, otherwise it would be difficult for drivers like keypads to
>> work with level trigger interrupts.
>>
>> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com>
>
> Clever! Mostly I like the patch as it is but:
>
>> for_each_set_bit(n, &port_active, BITS_PER_LONG) {
>> + /* check if we are detecting fake edges ... */
>> + pin_edge_cfg = ST_IRQ_EDGE_CONF(bank_edge_mask, n);
>> +
>> + if (pin_edge_cfg) {
>> + /* edge detection. */
>> + val = st_gpio_get(&bank->gpio_chip, n);
>> + if (val)
>> + writel(BIT(n), bank->base + REG_PIO_SET_PCOMP);
>> + else
>> + writel(BIT(n), bank->base + REG_PIO_CLR_PCOMP);
>> +
>> + if (pin_edge_cfg != ST_IRQ_EDGE_BOTH &&
>> + !((pin_edge_cfg & ST_IRQ_EDGE_FALLING) ^ val))
>> + continue;
>> + }
>> +
>
> Please insert comments here to explain what you are actually doing
> because I sure as hell do not understand this code without comments
> describing the trick used.
I agree, I will document this logic in next version.
Thanks,
srini
>
> Yours,
> Linus Walleij
>
>
next prev parent reply other threads:[~2014-01-15 14:44 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-14 14:51 [PATCH v1 0/5] pinctrl: st: Add interrupt controller support srinivas.kandagatla at st.com
2014-01-14 14:51 ` srinivas.kandagatla
2014-01-14 14:51 ` srinivas.kandagatla-qxv4g6HH51o
2014-01-14 14:52 ` [PATCH v1 1/5] pinctrl: st: Fix a typo in probe srinivas.kandagatla at st.com
2014-01-14 14:52 ` srinivas.kandagatla
2014-01-14 14:52 ` srinivas.kandagatla
2014-01-15 10:08 ` Linus Walleij
2014-01-15 10:08 ` Linus Walleij
2014-01-14 14:52 ` [PATCH v1 2/5] pinctrl: st: Add Interrupt support srinivas.kandagatla at st.com
2014-01-14 14:52 ` srinivas.kandagatla
2014-01-14 14:52 ` srinivas.kandagatla
[not found] ` <1389711134-21049-1-git-send-email-srinivas.kandagatla-qxv4g6HH51o@public.gmane.org>
2014-01-15 14:15 ` Linus Walleij
2014-01-15 14:15 ` Linus Walleij
2014-01-15 14:15 ` Linus Walleij
2014-01-15 16:21 ` srinivas kandagatla
2014-01-15 16:21 ` srinivas kandagatla
2014-01-15 16:21 ` srinivas kandagatla
2014-01-14 14:52 ` [PATCH v1 3/5] pinctrl: st: Add software edge trigger interrupt support srinivas.kandagatla at st.com
2014-01-14 14:52 ` srinivas.kandagatla
2014-01-14 14:52 ` srinivas.kandagatla
2014-01-15 14:27 ` Linus Walleij
2014-01-15 14:27 ` Linus Walleij
2014-01-15 14:44 ` srinivas kandagatla [this message]
2014-01-15 14:44 ` srinivas kandagatla
2014-01-14 14:52 ` [PATCH v1 4/5] ARM:STi: STiH416: Add interrupt support for pin controller srinivas.kandagatla at st.com
2014-01-14 14:52 ` srinivas.kandagatla
2014-01-14 14:52 ` srinivas.kandagatla
2014-01-14 14:52 ` [PATCH v1 5/5] ARM:STi: STiH415: " srinivas.kandagatla at st.com
2014-01-14 14:52 ` srinivas.kandagatla
2014-01-14 14:52 ` srinivas.kandagatla
2014-01-16 15:35 ` [PATCH v2 0/4] pinctrl: st: Add interrupt controller support srinivas.kandagatla at st.com
2014-01-16 15:35 ` srinivas.kandagatla
2014-01-16 15:35 ` srinivas.kandagatla
2014-01-16 15:36 ` [PATCH v2 1/4] pinctrl: st: Add Interrupt support srinivas.kandagatla at st.com
2014-01-16 15:36 ` srinivas.kandagatla
2014-01-16 15:36 ` srinivas.kandagatla-qxv4g6HH51o
2014-01-23 7:22 ` Linus Walleij
2014-01-23 7:22 ` Linus Walleij
2014-01-23 12:54 ` srinivas kandagatla
2014-01-23 12:54 ` srinivas kandagatla
2014-01-16 15:37 ` [PATCH v2 2/4] pinctrl: st: Add software edge trigger interrupt support srinivas.kandagatla at st.com
2014-01-16 15:37 ` srinivas.kandagatla
2014-01-16 15:37 ` srinivas.kandagatla
2014-01-23 7:29 ` Linus Walleij
2014-01-23 7:29 ` Linus Walleij
2014-01-23 7:29 ` Linus Walleij
2014-01-24 8:28 ` Lee Jones
2014-01-24 8:28 ` Lee Jones
2014-01-27 9:43 ` Linus Walleij
2014-01-27 9:43 ` Linus Walleij
2014-01-16 15:37 ` [PATCH v2 3/4] ARM:STi: STiH416: Add interrupt support for pin controller srinivas.kandagatla at st.com
2014-01-16 15:37 ` srinivas.kandagatla
2014-01-16 15:37 ` srinivas.kandagatla
2014-01-23 7:30 ` Linus Walleij
2014-01-23 7:30 ` Linus Walleij
2014-01-23 12:56 ` srinivas kandagatla
2014-01-23 12:56 ` srinivas kandagatla
2014-01-16 15:37 ` [PATCH v2 4/4] ARM:STi: STiH415: " srinivas.kandagatla at st.com
2014-01-16 15:37 ` srinivas.kandagatla
2014-01-16 15:37 ` srinivas.kandagatla
2014-01-23 7:33 ` Linus Walleij
2014-01-23 7:33 ` Linus Walleij
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=52D69EC6.8010705@st.com \
--to=srinivas.kandagatla@st.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.