[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACRpkdbFGOm2xm5H+of_NuJ6DVmBDcEODZbDxVU8nGC-RU64Tw@mail.gmail.com>
Date: Wed, 15 Jan 2014 15:27:24 +0100
From: Linus Walleij <linus.walleij@...aro.org>
To: Srinivas KANDAGATLA <srinivas.kandagatla@...com>
Cc: Rob Herring <robh+dt@...nel.org>, Pawel Moll <pawel.moll@....com>,
Mark Rutland <mark.rutland@....com>,
Ian Campbell <ijc+devicetree@...lion.org.uk>,
Kumar Gala <galak@...eaurora.org>,
Rob Landley <rob@...dley.net>,
Russell King <linux@....linux.org.uk>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
"linux-doc@...r.kernel.org" <linux-doc@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>
Subject: Re: [PATCH v1 3/5] pinctrl: st: Add software edge trigger interrupt support.
On Tue, Jan 14, 2014 at 3:52 PM, <srinivas.kandagatla@...com> wrote:
> From: Srinivas Kandagatla <srinivas.kandagatla@...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@...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.
Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists