* [PATCH] spi: omap2-mcspi: Add calls for pinctrl state select
@ 2015-05-13 12:15 pascal.huerst-Re5JQEeQqe8AvxtiuMwx3w
[not found] ` <1431519316-30989-1-git-send-email-pascal.huerst-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 6+ messages in thread
From: pascal.huerst-Re5JQEeQqe8AvxtiuMwx3w @ 2015-05-13 12:15 UTC (permalink / raw)
To: broonie-DgEjT+Ai2ygdnm+yROfE0A
Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA, Pascal Huerst
From: Pascal Huerst <pascal.huerst-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
This adds calls to pinctrl subsystem in order to switch pin states
on suspend/resume if you provide a "sleep" state in DT.
If no "sleep" state is provided in DT, these calls turn
to NOPs, so we don't need error checking here.
Signed-off-by: Pascal Huerst <pascal.huerst-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
drivers/spi/spi-omap2-mcspi.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
index 4df8942..424f8cd 100644
--- a/drivers/spi/spi-omap2-mcspi.c
+++ b/drivers/spi/spi-omap2-mcspi.c
@@ -24,6 +24,7 @@
#include <linux/dma-mapping.h>
#include <linux/dmaengine.h>
#include <linux/omap-dma.h>
+#include <linux/pinctrl/consumer.h>
#include <linux/platform_device.h>
#include <linux/err.h>
#include <linux/clk.h>
@@ -1502,14 +1503,27 @@ static int omap2_mcspi_resume(struct device *dev)
}
pm_runtime_mark_last_busy(mcspi->dev);
pm_runtime_put_autosuspend(mcspi->dev);
+
+ pinctrl_pm_select_default_state(dev);
+
+ return 0;
+}
+
+static int omap2_mcspi_suspend(struct device *dev)
+{
+ pinctrl_pm_select_sleep_state(dev);
+
return 0;
}
+
#else
+#define omap2_mcspi_suspend NULL
#define omap2_mcspi_resume NULL
#endif
static const struct dev_pm_ops omap2_mcspi_pm_ops = {
.resume = omap2_mcspi_resume,
+ .suspend = omap2_mcspi_suspend,
.runtime_resume = omap_mcspi_runtime_resume,
};
--
2.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] spi: omap2-mcspi: Add calls for pinctrl state select
[not found] ` <1431519316-30989-1-git-send-email-pascal.huerst-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2015-05-13 18:15 ` Mark Brown
[not found] ` <20150513181536.GI2761-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
0 siblings, 1 reply; 6+ messages in thread
From: Mark Brown @ 2015-05-13 18:15 UTC (permalink / raw)
To: pascal.huerst-Re5JQEeQqe8AvxtiuMwx3w; +Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: Type: text/plain, Size: 449 bytes --]
On Wed, May 13, 2015 at 02:15:16PM +0200, pascal.huerst-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:
> This adds calls to pinctrl subsystem in order to switch pin states
> on suspend/resume if you provide a "sleep" state in DT.
> If no "sleep" state is provided in DT, these calls turn
> to NOPs, so we don't need error checking here.
We should still be checking if we succesfully changed the state when
there is a state provided shouldn't we?
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] spi: omap2-mcspi: Add calls for pinctrl state select
[not found] ` <20150513181536.GI2761-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
@ 2015-05-18 12:02 ` Pascal Huerst
[not found] ` <5559D4BC.6010606-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 6+ messages in thread
From: Pascal Huerst @ 2015-05-18 12:02 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA
On 13.05.2015 20:15, Mark Brown wrote:
> On Wed, May 13, 2015 at 02:15:16PM +0200, pascal.huerst-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:
>
>> This adds calls to pinctrl subsystem in order to switch pin states
>> on suspend/resume if you provide a "sleep" state in DT.
>
>> If no "sleep" state is provided in DT, these calls turn
>> to NOPs, so we don't need error checking here.
>
> We should still be checking if we succesfully changed the state when
> there is a state provided shouldn't we?
I agree, but if I git grep for such calls, nobody seems to check the
return values of these functions. Shall I add a check and print a
message if the call fails?
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] spi: omap2-mcspi: Add calls for pinctrl state select
[not found] ` <5559D4BC.6010606-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2015-05-19 12:12 ` Mark Brown
[not found] ` <20150519121225.GM2761-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
0 siblings, 1 reply; 6+ messages in thread
From: Mark Brown @ 2015-05-19 12:12 UTC (permalink / raw)
To: Pascal Huerst; +Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: Type: text/plain, Size: 405 bytes --]
On Mon, May 18, 2015 at 02:02:04PM +0200, Pascal Huerst wrote:
> On 13.05.2015 20:15, Mark Brown wrote:
> > We should still be checking if we succesfully changed the state when
> > there is a state provided shouldn't we?
> I agree, but if I git grep for such calls, nobody seems to check the
> return values of these functions. Shall I add a check and print a
> message if the call fails?
Yes, please.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] spi: omap2-mcspi: Add calls for pinctrl state select
[not found] ` <20150519121225.GM2761-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
@ 2015-06-09 11:16 ` Pascal Huerst
[not found] ` <5576CB11.7010905-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 6+ messages in thread
From: Pascal Huerst @ 2015-06-09 11:16 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA
Hey Mark,
On 19.05.2015 14:12, Mark Brown wrote:
> On Mon, May 18, 2015 at 02:02:04PM +0200, Pascal Huerst wrote:
>> On 13.05.2015 20:15, Mark Brown wrote:
>
>>> We should still be checking if we succesfully changed the state when
>>> there is a state provided shouldn't we?
>
>> I agree, but if I git grep for such calls, nobody seems to check the
>> return values of these functions. Shall I add a check and print a
>> message if the call fails?
>
> Yes, please.
Sorry for the late reply.
There is already a message printed on failure in the subsystem. See:
http://lxr.free-electrons.com/source/drivers/pinctrl/core.c#L1250
So I don't see the need for another message, right?
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] spi: omap2-mcspi: Add calls for pinctrl state select
[not found] ` <5576CB11.7010905-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2015-09-14 16:10 ` Mark Brown
0 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2015-09-14 16:10 UTC (permalink / raw)
To: Pascal Huerst; +Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: Type: text/plain, Size: 850 bytes --]
On Tue, Jun 09, 2015 at 01:16:33PM +0200, Pascal Huerst wrote:
> On 19.05.2015 14:12, Mark Brown wrote:
> > On Mon, May 18, 2015 at 02:02:04PM +0200, Pascal Huerst wrote:
> >> On 13.05.2015 20:15, Mark Brown wrote:
> >>> We should still be checking if we succesfully changed the state when
> >>> there is a state provided shouldn't we?
> >> I agree, but if I git grep for such calls, nobody seems to check the
> >> return values of these functions. Shall I add a check and print a
> >> message if the call fails?
> > Yes, please.
> Sorry for the late reply.
> There is already a message printed on failure in the subsystem. See:
> http://lxr.free-electrons.com/source/drivers/pinctrl/core.c#L1250
> So I don't see the need for another message, right?
I was expecting to see us pass back an error code more than just
printing an error message.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-09-14 16:10 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-13 12:15 [PATCH] spi: omap2-mcspi: Add calls for pinctrl state select pascal.huerst-Re5JQEeQqe8AvxtiuMwx3w
[not found] ` <1431519316-30989-1-git-send-email-pascal.huerst-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-05-13 18:15 ` Mark Brown
[not found] ` <20150513181536.GI2761-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2015-05-18 12:02 ` Pascal Huerst
[not found] ` <5559D4BC.6010606-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-05-19 12:12 ` Mark Brown
[not found] ` <20150519121225.GM2761-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2015-06-09 11:16 ` Pascal Huerst
[not found] ` <5576CB11.7010905-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-09-14 16:10 ` Mark Brown
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).