From: Yingjoe Chen <yingjoe.chen@mediatek.com>
To: Daniel Kurtz <djkurtz@chromium.org>
Cc: maoguang meng <maoguang.meng@mediatek.com>,
Linus Walleij <linus.walleij@linaro.org>,
Matthias Brugger <matthias.bgg@gmail.com>,
Hongzhou Yang <hongzhou.yang@mediatek.com>,
linux-gpio@vger.kernel.org,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
linux-mediatek@lists.infradead.org,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v4] pinctrl: mediatek: Implement wake handler and suspend resume
Date: Mon, 17 Aug 2015 21:25:53 +0800 [thread overview]
Message-ID: <1439817953.3414.4.camel@mtksdaap41> (raw)
In-Reply-To: <CAGS+omCQN65pCP7mYFCj8sDOihLNc15GgELw1u7fTXuq=KBXnw@mail.gmail.com>
On Mon, 2015-08-17 at 17:09 +0800, Daniel Kurtz wrote:
> On Mon, Aug 17, 2015 at 3:52 PM, Yingjoe Chen <yingjoe.chen@mediatek.com> wrote:
> > On Fri, 2015-08-14 at 16:38 +0800, maoguang.meng@mediatek.com wrote:
> >> From: Maoguang Meng <maoguang.meng@mediatek.com>
> >>
> >> This patch implement irq_set_wake to get who is wakeup source and
> >> setup on suspend resume.
> >>
> >> Signed-off-by: Maoguang Meng <maoguang.meng@mediatek.com>
> >>
> >> ---
> >> changes since v3:
> >> -add a comment in mtk_eint_chip_read_mask.
> >> -delete ALIGN when allocate eint_offsets.ports.
> >> -fix unrelated change.
> >>
> >> changes since v2:
> >> -modify irq_wake to handle irq wakeup source.
> >> -allocate two buffers separately.
> >> -fix some codestyle.
> >>
> >> Changes since v1:
> >> -implement irq_wake handler.
> >> ---
> >>
> >> drivers/pinctrl/mediatek/pinctrl-mt8173.c | 1 +
> >> drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 91 ++++++++++++++++++++++++++-
> >> drivers/pinctrl/mediatek/pinctrl-mtk-common.h | 4 ++
> >> 3 files changed, 95 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/pinctrl/mediatek/pinctrl-mt8173.c b/drivers/pinctrl/mediatek/pinctrl-mt8173.c
> >> index d0c811d..ad27184 100644
> >> --- a/drivers/pinctrl/mediatek/pinctrl-mt8173.c
> >> +++ b/drivers/pinctrl/mediatek/pinctrl-mt8173.c
> >> @@ -385,6 +385,7 @@ static struct platform_driver mtk_pinctrl_driver = {
> >> .driver = {
> >> .name = "mediatek-mt8173-pinctrl",
> >> .of_match_table = mt8173_pctrl_match,
> >> + .pm = &mtk_eint_pm_ops,
> >> },
> >> };
> >>
> >> diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> >> index ad1ea16..fe34ce9 100644
> >> --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> >> +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> >> @@ -33,6 +33,7 @@
> >> #include <linux/mfd/syscon.h>
> >> #include <linux/delay.h>
> >> #include <linux/interrupt.h>
> >> +#include <linux/pm.h>
> >> #include <dt-bindings/pinctrl/mt65xx.h>
> >>
> >> #include "../core.h"
> >> @@ -1062,6 +1063,77 @@ static int mtk_eint_set_type(struct irq_data *d,
> >> return 0;
> >> }
> >>
> >> +static int mtk_eint_irq_set_wake(struct irq_data *d, unsigned int on)
> >> +{
> >> + struct mtk_pinctrl *pctl = irq_data_get_irq_chip_data(d);
> >> + int shift = d->hwirq & 0x1f;
> >> + int reg = d->hwirq >> 5;
> >> +
> >> + if (on)
> >> + pctl->wake_mask[reg] |= BIT(shift);
> >> + else
> >> + pctl->wake_mask[reg] &= ~BIT(shift);
> >> +
> >> + return 0;
> >> +}
> >
> > Hi Maoguang,
> >
> > You changed from set_bit/clear_bit to this, but didn't add any locking.
> > Since this is basic read/modify/write, is it OK to do it without
> > locking?
>
> I believe calling .irq_set_wake() concurrently with itself is
> protected by irq_get_desc_buslock():
>
> int irq_set_irq_wake(unsigned int irq, unsigned int on)
> {
> unsigned long flags;
> struct irq_desc *desc = irq_get_desc_buslock(irq, &flags,
> IRQ_GET_DESC_CHECK_GLOBAL);
> int ret = 0;
> ...
> ret = set_irq_wake_real(irq, on);
> ...
> irq_put_desc_busunlock(desc, flags);
> return ret;
> }
Hi Dan,
You are right, irq_get_desc_buslock will acquire desc lock even when
irq_chip didn't provide irq_bus_lock callback. So this should be OK.
Sorry for the noise.
For this patch:
Acked-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
Joe.C
next prev parent reply other threads:[~2015-08-17 13:25 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-14 8:38 [PATCH v4] pinctrl: mediatek: Implement wake handler and suspend resume maoguang.meng
2015-08-14 9:57 ` Daniel Kurtz
2015-08-17 7:52 ` Yingjoe Chen
2015-08-17 9:09 ` Daniel Kurtz
2015-08-17 13:25 ` Yingjoe Chen [this message]
2015-08-17 21:45 ` Hongzhou Yang
2015-08-24 16:27 ` Sudeep Holla
2015-09-02 6:02 ` Daniel Kurtz
[not found] ` <CAGS+omBnoitju07KQ1Y7JHTbce6+DO4WqWHTaKz5D+T157zEJA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-09-06 10:39 ` maoguang meng
2015-09-08 9:28 ` Sudeep Holla
2015-09-08 16:50 ` Sudeep Holla
2015-09-11 11:22 ` Chung-Yih Wang (王崇懿)
2015-09-11 12:43 ` Sudeep Holla
2015-09-12 9:50 ` maoguang meng
2015-09-14 11:16 ` Sudeep Holla
2015-09-15 2:43 ` Daniel Kurtz
2015-09-15 2:52 ` Dmitry Torokhov
2015-09-15 17:48 ` Sudeep Holla
2015-08-26 12:41 ` 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=1439817953.3414.4.camel@mtksdaap41 \
--to=yingjoe.chen@mediatek.com \
--cc=djkurtz@chromium.org \
--cc=hongzhou.yang@mediatek.com \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=maoguang.meng@mediatek.com \
--cc=matthias.bgg@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).