linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] pinctrl: mediatek: mt8183: Add support for wake sources
@ 2019-05-08  7:33 Nicolas Boichat
  2019-05-08  7:33 ` [PATCH v2 1/2] pinctrl: mediatek: Add pm_ops to pinctrl-paris Nicolas Boichat
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Nicolas Boichat @ 2019-05-08  7:33 UTC (permalink / raw)
  To: linux-mediatek
  Cc: Chuanjia Liu, Linus Walleij, Sean Wang, linux-kernel, evgreen,
	swboyd, linux-gpio, Matthias Brugger, linux-arm-kernel

This adds support for wake sources in pinctrl-mtk-common-v2, and
pinctrl-mt8183. Without this patch, all interrupts that are left
enabled on suspend act as wake sources (and wake sources without
interrupt enabled do not).

Changes since v1:
 - Move changes from mtk-common-v2 to mtk-pinctrl-paris, as
   recommended by Sean, to keep better separation between eint
   and pinctrl-common features.

Nicolas Boichat (2):
  pinctrl: mediatek: Add pm_ops to pinctrl-paris
  pinctrl: mediatek: mt8183: Add mtk_pinctrl_paris_pm_ops

 drivers/pinctrl/mediatek/pinctrl-mt8183.c |  1 +
 drivers/pinctrl/mediatek/pinctrl-paris.c  | 19 +++++++++++++++++++
 drivers/pinctrl/mediatek/pinctrl-paris.h  |  2 ++
 3 files changed, 22 insertions(+)

-- 
2.21.0.1020.gf2820cf01a-goog


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2 1/2] pinctrl: mediatek: Add pm_ops to pinctrl-paris
  2019-05-08  7:33 [PATCH v2 0/2] pinctrl: mediatek: mt8183: Add support for wake sources Nicolas Boichat
@ 2019-05-08  7:33 ` Nicolas Boichat
  2019-05-08  7:33 ` [PATCH v2 2/2] pinctrl: mediatek: mt8183: Add pm_ops Nicolas Boichat
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Nicolas Boichat @ 2019-05-08  7:33 UTC (permalink / raw)
  To: linux-mediatek
  Cc: Chuanjia Liu, Linus Walleij, Sean Wang, linux-kernel, evgreen,
	swboyd, linux-gpio, Matthias Brugger, linux-arm-kernel

pinctrl variants that include pinctrl-paris.h (and not
pinctrl-mtk-common.h) also need to use pm_ops to setup
wake mask properly, so copy over the pm_ops from common
to paris variant.

It is not easy to merge the 2 copies (or move
mtk_eint_suspend/resume to mtk-eint.c), as we need to
dereference pctrl->eint, and struct mtk_pinctrl *pctl has a
different structure definition for v1 and v2 (which is
what paris variant uses).

Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
---
 drivers/pinctrl/mediatek/pinctrl-paris.c | 19 +++++++++++++++++++
 drivers/pinctrl/mediatek/pinctrl-paris.h |  2 ++
 2 files changed, 21 insertions(+)

diff --git a/drivers/pinctrl/mediatek/pinctrl-paris.c b/drivers/pinctrl/mediatek/pinctrl-paris.c
index d3b34e9a7507ec6..923264d0e9ef2c5 100644
--- a/drivers/pinctrl/mediatek/pinctrl-paris.c
+++ b/drivers/pinctrl/mediatek/pinctrl-paris.c
@@ -926,3 +926,22 @@ int mtk_paris_pinctrl_probe(struct platform_device *pdev,
 
 	return 0;
 }
+
+static int mtk_paris_pinctrl_suspend(struct device *device)
+{
+	struct mtk_pinctrl *pctl = dev_get_drvdata(device);
+
+	return mtk_eint_do_suspend(pctl->eint);
+}
+
+static int mtk_paris_pinctrl_resume(struct device *device)
+{
+	struct mtk_pinctrl *pctl = dev_get_drvdata(device);
+
+	return mtk_eint_do_resume(pctl->eint);
+}
+
+const struct dev_pm_ops mtk_paris_pinctrl_pm_ops = {
+	.suspend_noirq = mtk_paris_pinctrl_suspend,
+	.resume_noirq = mtk_paris_pinctrl_resume,
+};
diff --git a/drivers/pinctrl/mediatek/pinctrl-paris.h b/drivers/pinctrl/mediatek/pinctrl-paris.h
index 37146caa667d8c8..3d43771074e6de0 100644
--- a/drivers/pinctrl/mediatek/pinctrl-paris.h
+++ b/drivers/pinctrl/mediatek/pinctrl-paris.h
@@ -60,4 +60,6 @@
 int mtk_paris_pinctrl_probe(struct platform_device *pdev,
 			    const struct mtk_pin_soc *soc);
 
+extern const struct dev_pm_ops mtk_paris_pinctrl_pm_ops;
+
 #endif /* __PINCTRL_PARIS_H */
-- 
2.21.0.1020.gf2820cf01a-goog


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 2/2] pinctrl: mediatek: mt8183: Add pm_ops
  2019-05-08  7:33 [PATCH v2 0/2] pinctrl: mediatek: mt8183: Add support for wake sources Nicolas Boichat
  2019-05-08  7:33 ` [PATCH v2 1/2] pinctrl: mediatek: Add pm_ops to pinctrl-paris Nicolas Boichat
@ 2019-05-08  7:33 ` Nicolas Boichat
  2019-05-16 11:55 ` [PATCH v2 0/2] pinctrl: mediatek: mt8183: Add support for wake sources Linus Walleij
  2019-06-01 17:41 ` Linus Walleij
  3 siblings, 0 replies; 7+ messages in thread
From: Nicolas Boichat @ 2019-05-08  7:33 UTC (permalink / raw)
  To: linux-mediatek
  Cc: Chuanjia Liu, Linus Walleij, Sean Wang, linux-kernel, evgreen,
	swboyd, linux-gpio, Matthias Brugger, linux-arm-kernel

Setting this up will configure wake from suspend properly,
and wake only for the interrupts that are setup in wake_mask,
not all interrupts.

Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
---
 drivers/pinctrl/mediatek/pinctrl-mt8183.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/pinctrl/mediatek/pinctrl-mt8183.c b/drivers/pinctrl/mediatek/pinctrl-mt8183.c
index 2c7409ed16fae9c..9a74d5025be648d 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mt8183.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mt8183.c
@@ -583,6 +583,7 @@ static struct platform_driver mt8183_pinctrl_driver = {
 	.driver = {
 		.name = "mt8183-pinctrl",
 		.of_match_table = mt8183_pinctrl_of_match,
+		.pm = &mtk_paris_pinctrl_pm_ops,
 	},
 	.probe = mt8183_pinctrl_probe,
 };
-- 
2.21.0.1020.gf2820cf01a-goog


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 0/2] pinctrl: mediatek: mt8183: Add support for wake sources
  2019-05-08  7:33 [PATCH v2 0/2] pinctrl: mediatek: mt8183: Add support for wake sources Nicolas Boichat
  2019-05-08  7:33 ` [PATCH v2 1/2] pinctrl: mediatek: Add pm_ops to pinctrl-paris Nicolas Boichat
  2019-05-08  7:33 ` [PATCH v2 2/2] pinctrl: mediatek: mt8183: Add pm_ops Nicolas Boichat
@ 2019-05-16 11:55 ` Linus Walleij
  2019-05-16 12:47   ` Nicolas Boichat
  2019-05-21 10:13   ` Sean Wang
  2019-06-01 17:41 ` Linus Walleij
  3 siblings, 2 replies; 7+ messages in thread
From: Linus Walleij @ 2019-05-16 11:55 UTC (permalink / raw)
  To: Nicolas Boichat
  Cc: Chuanjia Liu, Sean Wang, linux-kernel, Evan Green, Stephen Boyd,
	open list:GPIO SUBSYSTEM,
	moderated list:ARM/Mediatek SoC support, Matthias Brugger,
	Linux ARM

On Wed, May 8, 2019 at 9:33 AM Nicolas Boichat <drinkcat@chromium.org> wrote:

> This adds support for wake sources in pinctrl-mtk-common-v2, and
> pinctrl-mt8183. Without this patch, all interrupts that are left
> enabled on suspend act as wake sources (and wake sources without
> interrupt enabled do not).
>
> Changes since v1:
>  - Move changes from mtk-common-v2 to mtk-pinctrl-paris, as
>    recommended by Sean, to keep better separation between eint
>    and pinctrl-common features.
>
> Nicolas Boichat (2):
>   pinctrl: mediatek: Add pm_ops to pinctrl-paris
>   pinctrl: mediatek: mt8183: Add mtk_pinctrl_paris_pm_ops

All seems to look fair to me, but I need some official ACK from
Sean on these.

I see there is some discussion on a related patch set which
also has two patches so I am a but confused how mature the
two patch sets are? Are they at all related?

Yours,
Linus Walleij

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 0/2] pinctrl: mediatek: mt8183: Add support for wake sources
  2019-05-16 11:55 ` [PATCH v2 0/2] pinctrl: mediatek: mt8183: Add support for wake sources Linus Walleij
@ 2019-05-16 12:47   ` Nicolas Boichat
  2019-05-21 10:13   ` Sean Wang
  1 sibling, 0 replies; 7+ messages in thread
From: Nicolas Boichat @ 2019-05-16 12:47 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Chuanjia Liu, Sean Wang, linux-kernel, Evan Green, Stephen Boyd,
	open list:GPIO SUBSYSTEM,
	moderated list:ARM/Mediatek SoC support, Matthias Brugger,
	Linux ARM

On Thu, May 16, 2019 at 7:55 PM Linus Walleij <linus.walleij@linaro.org> wrote:
>
> On Wed, May 8, 2019 at 9:33 AM Nicolas Boichat <drinkcat@chromium.org> wrote:
>
> > This adds support for wake sources in pinctrl-mtk-common-v2, and
> > pinctrl-mt8183. Without this patch, all interrupts that are left
> > enabled on suspend act as wake sources (and wake sources without
> > interrupt enabled do not).
> >
> > Changes since v1:
> >  - Move changes from mtk-common-v2 to mtk-pinctrl-paris, as
> >    recommended by Sean, to keep better separation between eint
> >    and pinctrl-common features.
> >
> > Nicolas Boichat (2):
> >   pinctrl: mediatek: Add pm_ops to pinctrl-paris
> >   pinctrl: mediatek: mt8183: Add mtk_pinctrl_paris_pm_ops
>
> All seems to look fair to me, but I need some official ACK from
> Sean on these.
>
> I see there is some discussion on a related patch set which
> also has two patches so I am a but confused how mature the
> two patch sets are? Are they at all related?

They are somewhat related, but I don't think this depends on the other series.

This series adds support for wake on mt8183, and makes it similar to,
say, mt8173.

The other patch series fixes issues that affect all mtk pinctrl
variants (i.e. I think mt8173 pinctrl on current mainline has similar
issues). It's not impossible that the answer to the other series is
that we need to refactor code, but in that case, if we merge this
first, we'd just have to clean up one more pinctrl variant.

Thanks,

> Yours,
> Linus Walleij

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 0/2] pinctrl: mediatek: mt8183: Add support for wake sources
  2019-05-16 11:55 ` [PATCH v2 0/2] pinctrl: mediatek: mt8183: Add support for wake sources Linus Walleij
  2019-05-16 12:47   ` Nicolas Boichat
@ 2019-05-21 10:13   ` Sean Wang
  1 sibling, 0 replies; 7+ messages in thread
From: Sean Wang @ 2019-05-21 10:13 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Nicolas Boichat, Chuanjia Liu, linux-kernel, Evan Green,
	Stephen Boyd, open list:GPIO SUBSYSTEM,
	moderated list:ARM/Mediatek SoC support, Matthias Brugger,
	Linux ARM

On Thu, May 16, 2019 at 4:56 AM Linus Walleij <linus.walleij@linaro.org> wrote:
>
> On Wed, May 8, 2019 at 9:33 AM Nicolas Boichat <drinkcat@chromium.org> wrote:
>
> > This adds support for wake sources in pinctrl-mtk-common-v2, and
> > pinctrl-mt8183. Without this patch, all interrupts that are left
> > enabled on suspend act as wake sources (and wake sources without
> > interrupt enabled do not).
> >
> > Changes since v1:
> >  - Move changes from mtk-common-v2 to mtk-pinctrl-paris, as
> >    recommended by Sean, to keep better separation between eint
> >    and pinctrl-common features.
> >
> > Nicolas Boichat (2):
> >   pinctrl: mediatek: Add pm_ops to pinctrl-paris
> >   pinctrl: mediatek: mt8183: Add mtk_pinctrl_paris_pm_ops
>
> All seems to look fair to me, but I need some official ACK from
> Sean on these.
>

sure, it looks good to me and thanks for Nicolas' help

Acked-by: Sean Wang <sean.wang@kernel.org>

> I see there is some discussion on a related patch set which
> also has two patches so I am a but confused how mature the
> two patch sets are? Are they at all related?
>
> Yours,
> Linus Walleij

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 0/2] pinctrl: mediatek: mt8183: Add support for wake sources
  2019-05-08  7:33 [PATCH v2 0/2] pinctrl: mediatek: mt8183: Add support for wake sources Nicolas Boichat
                   ` (2 preceding siblings ...)
  2019-05-16 11:55 ` [PATCH v2 0/2] pinctrl: mediatek: mt8183: Add support for wake sources Linus Walleij
@ 2019-06-01 17:41 ` Linus Walleij
  3 siblings, 0 replies; 7+ messages in thread
From: Linus Walleij @ 2019-06-01 17:41 UTC (permalink / raw)
  To: Nicolas Boichat
  Cc: Chuanjia Liu, Sean Wang, linux-kernel, Evan Green, Stephen Boyd,
	open list:GPIO SUBSYSTEM,
	moderated list:ARM/Mediatek SoC support, Matthias Brugger,
	Linux ARM

On Wed, May 8, 2019 at 9:33 AM Nicolas Boichat <drinkcat@chromium.org> wrote:

> This adds support for wake sources in pinctrl-mtk-common-v2, and
> pinctrl-mt8183. Without this patch, all interrupts that are left
> enabled on suspend act as wake sources (and wake sources without
> interrupt enabled do not).
>
> Changes since v1:
>  - Move changes from mtk-common-v2 to mtk-pinctrl-paris, as
>    recommended by Sean, to keep better separation between eint
>    and pinctrl-common features.

Both patches applied with Sean's ACK!

Yours,
Linus Walleij

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-06-01 17:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-08  7:33 [PATCH v2 0/2] pinctrl: mediatek: mt8183: Add support for wake sources Nicolas Boichat
2019-05-08  7:33 ` [PATCH v2 1/2] pinctrl: mediatek: Add pm_ops to pinctrl-paris Nicolas Boichat
2019-05-08  7:33 ` [PATCH v2 2/2] pinctrl: mediatek: mt8183: Add pm_ops Nicolas Boichat
2019-05-16 11:55 ` [PATCH v2 0/2] pinctrl: mediatek: mt8183: Add support for wake sources Linus Walleij
2019-05-16 12:47   ` Nicolas Boichat
2019-05-21 10:13   ` Sean Wang
2019-06-01 17:41 ` Linus Walleij

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).