From: Sebastian Reichel <sre@kernel.org>
To: Phil Reid <preid@electromag.com.au>
Cc: linus.walleij@linaro.org, robh+dt@kernel.org,
mark.rutland@arm.com, linux-gpio@vger.kernel.org,
devicetree@vger.kernel.org
Subject: Re: [PATCH v3 1/5] pinctrl: mcp23s08: remove hard coded irq polarity in irq_setup
Date: Tue, 21 Nov 2017 14:17:00 +0100 [thread overview]
Message-ID: <20171121131700.facbc4plejmkqavl@earth> (raw)
In-Reply-To: <1511252491-79952-2-git-send-email-preid@electromag.com.au>
[-- Attachment #1: Type: text/plain, Size: 2932 bytes --]
Hi,
On Tue, Nov 21, 2017 at 04:21:27PM +0800, Phil Reid wrote:
> The polarity of the irq should be defined in the configuration
> for the irq. eg The device tree bind already allows for either
> active high / low interrupt configuration.
>
> Signed-off-by: Phil Reid <preid@electromag.com.au>
> ---
I think the patch is right, but the long patch description is not.
I would expect something like this:
This changes the driver, so that the "microchip,irq-active-high"
property only configures the mcp23017 interrupt output, but not
the host interrupt input. The host interrupt should be configured
using the standard interrupt flags.
-- Sebastian
> drivers/pinctrl/pinctrl-mcp23s08.c | 14 ++++----------
> 1 file changed, 4 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/pinctrl/pinctrl-mcp23s08.c b/drivers/pinctrl/pinctrl-mcp23s08.c
> index 0aef30e..cc1f9f6 100644
> --- a/drivers/pinctrl/pinctrl-mcp23s08.c
> +++ b/drivers/pinctrl/pinctrl-mcp23s08.c
> @@ -56,7 +56,6 @@
>
> struct mcp23s08 {
> u8 addr;
> - bool irq_active_high;
> bool reg_shift;
>
> u16 irq_rise;
> @@ -627,11 +626,6 @@ static int mcp23s08_irq_setup(struct mcp23s08 *mcp)
> int err;
> unsigned long irqflags = IRQF_ONESHOT | IRQF_SHARED;
>
> - if (mcp->irq_active_high)
> - irqflags |= IRQF_TRIGGER_HIGH;
> - else
> - irqflags |= IRQF_TRIGGER_LOW;
> -
> err = devm_request_threaded_irq(chip->parent, mcp->irq, NULL,
> mcp23s08_irq,
> irqflags, dev_name(chip->parent), mcp);
> @@ -777,12 +771,12 @@ static int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev,
> {
> int status, ret;
> bool mirror = false;
> + bool irq_active_high = false;
>
> mutex_init(&mcp->lock);
>
> mcp->dev = dev;
> mcp->addr = addr;
> - mcp->irq_active_high = false;
>
> mcp->chip.direction_input = mcp23s08_direction_input;
> mcp->chip.get = mcp23s08_get;
> @@ -868,7 +862,7 @@ static int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev,
> mcp->irq_controller =
> device_property_read_bool(dev, "interrupt-controller");
> if (mcp->irq && mcp->irq_controller) {
> - mcp->irq_active_high =
> + irq_active_high =
> device_property_read_bool(dev,
> "microchip,irq-active-high");
>
> @@ -876,11 +870,11 @@ static int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev,
> }
>
> if ((status & IOCON_SEQOP) || !(status & IOCON_HAEN) || mirror ||
> - mcp->irq_active_high) {
> + irq_active_high) {
> /* mcp23s17 has IOCON twice, make sure they are in sync */
> status &= ~(IOCON_SEQOP | (IOCON_SEQOP << 8));
> status |= IOCON_HAEN | (IOCON_HAEN << 8);
> - if (mcp->irq_active_high)
> + if (irq_active_high)
> status |= IOCON_INTPOL | (IOCON_INTPOL << 8);
> else
> status &= ~(IOCON_INTPOL | (IOCON_INTPOL << 8));
> --
> 1.8.3.1
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2017-11-21 13:17 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-21 8:21 [PATCH v3 0/5] pinctrl: mcp32s08: add open drain config for irq Phil Reid
2017-11-21 8:21 ` [PATCH v3 2/5] dt-bindings: pinctrl: mcp23s08: add documentation for drive-open-drain Phil Reid
2017-11-21 12:56 ` Sebastian Reichel
[not found] ` <1511252491-79952-3-git-send-email-preid-qgqNFa1JUf/o2iN0hyhwsIdd74u8MsAO@public.gmane.org>
2017-11-21 18:37 ` Rob Herring
[not found] ` <1511252491-79952-1-git-send-email-preid-qgqNFa1JUf/o2iN0hyhwsIdd74u8MsAO@public.gmane.org>
2017-11-21 8:21 ` [PATCH v3 1/5] pinctrl: mcp23s08: remove hard coded irq polarity in irq_setup Phil Reid
2017-11-21 13:17 ` Sebastian Reichel [this message]
2017-11-21 8:21 ` [PATCH v3 3/5] pinctrl: mcp23s08: add open drain configuration for irq output Phil Reid
2017-11-21 12:57 ` Sebastian Reichel
2017-11-21 8:21 ` [PATCH v3 4/5] pinctrl: mcp23s08: configure irq polarity using irq data Phil Reid
2017-11-21 13:34 ` Sebastian Reichel
2017-11-21 14:46 ` Phil Reid
[not found] ` <c191a9d6-3ebb-e95b-7342-aa18598ddf2b-qgqNFa1JUf/o2iN0hyhwsIdd74u8MsAO@public.gmane.org>
2017-11-21 15:21 ` Sebastian Reichel
2017-11-21 15:38 ` Phil Reid
2017-11-21 16:04 ` Alexander Stein
2017-11-21 16:30 ` Sebastian Reichel
2017-11-30 14:21 ` Linus Walleij
2017-11-30 15:50 ` Marc Zyngier
2017-12-01 8:38 ` Linus Walleij
2017-11-30 14:17 ` Linus Walleij
2017-11-21 8:21 ` [PATCH v3 5/5] dt-bindings: pinctrl: deprecate 'microchip,irq-active-high' property Phil Reid
2017-11-21 18:37 ` Rob Herring
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=20171121131700.facbc4plejmkqavl@earth \
--to=sre@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=preid@electromag.com.au \
--cc=robh+dt@kernel.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).