* [PATCH v2] omap: i2c: Add calls for pinctrl state select
@ 2015-04-22 9:07 pascal.huerst-Re5JQEeQqe8AvxtiuMwx3w
2015-04-23 0:32 ` Nishanth Menon
0 siblings, 1 reply; 5+ messages in thread
From: pascal.huerst-Re5JQEeQqe8AvxtiuMwx3w @ 2015-04-22 9:07 UTC (permalink / raw)
To: wsa-z923LK4zBo2bacvFa/9K2g
Cc: tony-4v6yS6AI5VpBDgjK7y7TUQ, linux-omap-u79uwXL29TY76Z2rM5mHXA,
linux-i2c-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.
Signed-off-by: Pascal Huerst <pascal.huerst-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
drivers/i2c/busses/i2c-omap.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 0e89419..8261941 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -38,6 +38,7 @@
#include <linux/slab.h>
#include <linux/i2c-omap.h>
#include <linux/pm_runtime.h>
+#include <linux/pinctrl/consumer.h>
/* I2C controller revisions */
#define OMAP_I2C_OMAP1_REV_2 0x20
@@ -1423,6 +1424,8 @@ static int omap_i2c_runtime_suspend(struct device *dev)
omap_i2c_read_reg(_dev, OMAP_I2C_STAT_REG);
}
+ pinctrl_pm_select_sleep_state(dev);
+
return 0;
}
@@ -1431,6 +1434,8 @@ static int omap_i2c_runtime_resume(struct device *dev)
struct platform_device *pdev = to_platform_device(dev);
struct omap_i2c_dev *_dev = platform_get_drvdata(pdev);
+ pinctrl_pm_select_default_state(dev);
+
if (!_dev->regs)
return 0;
--
2.1.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] omap: i2c: Add calls for pinctrl state select
2015-04-22 9:07 [PATCH v2] omap: i2c: Add calls for pinctrl state select pascal.huerst-Re5JQEeQqe8AvxtiuMwx3w
@ 2015-04-23 0:32 ` Nishanth Menon
[not found] ` <55383D9A.4020302-l0cyMroinI0@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Nishanth Menon @ 2015-04-23 0:32 UTC (permalink / raw)
To: pascal.huerst, wsa; +Cc: tony, linux-omap, linux-i2c, Sekhar Nori
few nitpicks:
i2c: omap: in $subject instead of omap: i2c:
I usually would do:
git log --no-merges --oneline drivers/i2c/busses/i2c-omap.c
and look for common usage.
On 04/22/2015 04:07 AM, pascal.huerst@gmail.com wrote:
> From: Pascal Huerst <pascal.huerst@gmail.com>
>
> This adds calls to pinctrl subsystem in order to switch pin states
> on suspend/resume if you provide a "sleep" state in DT.
>
> Signed-off-by: Pascal Huerst <pascal.huerst@gmail.com>
> ---
> drivers/i2c/busses/i2c-omap.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
> index 0e89419..8261941 100644
> --- a/drivers/i2c/busses/i2c-omap.c
> +++ b/drivers/i2c/busses/i2c-omap.c
> @@ -38,6 +38,7 @@
> #include <linux/slab.h>
> #include <linux/i2c-omap.h>
> #include <linux/pm_runtime.h>
> +#include <linux/pinctrl/consumer.h>
>
> /* I2C controller revisions */
> #define OMAP_I2C_OMAP1_REV_2 0x20
> @@ -1423,6 +1424,8 @@ static int omap_i2c_runtime_suspend(struct device *dev)
> omap_i2c_read_reg(_dev, OMAP_I2C_STAT_REG);
> }
>
> + pinctrl_pm_select_sleep_state(dev);
> +
> return 0;
> }
>
> @@ -1431,6 +1434,8 @@ static int omap_i2c_runtime_resume(struct device *dev)
> struct platform_device *pdev = to_platform_device(dev);
> struct omap_i2c_dev *_dev = platform_get_drvdata(pdev);
>
> + pinctrl_pm_select_default_state(dev);
> +
> if (!_dev->regs)
> return 0;
>
> --
> 2.1.0
>
Build tested with omap2plus_defconfig on linus master (27cf3a16b253)
and next-20150422
While I do understand that the sleep state and default states are
optional - might be nice to state it in commit message (as a result of
which we dont do error checks).
Would you think adding relevant documentation in
Documentation/devicetree/bindings/i2c/i2c-omap.txt might be good as
well? I mean, folks should know looking at dt documentation that this
bus driver does indeed support this option..
--
Regards,
Nishanth Menon
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] omap: i2c: Add calls for pinctrl state select
[not found] ` <55383D9A.4020302-l0cyMroinI0@public.gmane.org>
@ 2015-04-28 11:05 ` Pascal Huerst
2015-04-28 13:11 ` Nishanth Menon
2015-04-28 13:11 ` Nishanth Menon
0 siblings, 2 replies; 5+ messages in thread
From: Pascal Huerst @ 2015-04-28 11:05 UTC (permalink / raw)
To: Nishanth Menon, wsa-z923LK4zBo2bacvFa/9K2g
Cc: tony-4v6yS6AI5VpBDgjK7y7TUQ, linux-omap-u79uwXL29TY76Z2rM5mHXA,
linux-i2c-u79uwXL29TY76Z2rM5mHXA, Sekhar Nori
On 23.04.2015 02:32, Nishanth Menon wrote:
> few nitpicks:
> i2c: omap: in $subject instead of omap: i2c:
> I usually would do:
> git log --no-merges --oneline drivers/i2c/busses/i2c-omap.c
> and look for common usage.
Aargh, thanks for pointing that out, I'll fix that.
> On 04/22/2015 04:07 AM, pascal.huerst-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:
>> 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.
>>
>> Signed-off-by: Pascal Huerst <pascal.huerst-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>> ---
>> drivers/i2c/busses/i2c-omap.c | 5 +++++
>> 1 file changed, 5 insertions(+)
>>
>> diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
>> index 0e89419..8261941 100644
>> --- a/drivers/i2c/busses/i2c-omap.c
>> +++ b/drivers/i2c/busses/i2c-omap.c
>> @@ -38,6 +38,7 @@
>> #include <linux/slab.h>
>> #include <linux/i2c-omap.h>
>> #include <linux/pm_runtime.h>
>> +#include <linux/pinctrl/consumer.h>
>>
>> /* I2C controller revisions */
>> #define OMAP_I2C_OMAP1_REV_2 0x20
>> @@ -1423,6 +1424,8 @@ static int omap_i2c_runtime_suspend(struct device *dev)
>> omap_i2c_read_reg(_dev, OMAP_I2C_STAT_REG);
>> }
>>
>> + pinctrl_pm_select_sleep_state(dev);
>> +
>> return 0;
>> }
>>
>> @@ -1431,6 +1434,8 @@ static int omap_i2c_runtime_resume(struct device *dev)
>> struct platform_device *pdev = to_platform_device(dev);
>> struct omap_i2c_dev *_dev = platform_get_drvdata(pdev);
>>
>> + pinctrl_pm_select_default_state(dev);
>> +
>> if (!_dev->regs)
>> return 0;
>>
>> --
>> 2.1.0
>>
> Build tested with omap2plus_defconfig on linus master (27cf3a16b253)
> and next-20150422
> While I do understand that the sleep state and default states are
> optional - might be nice to state it in commit message (as a result of
> which we dont do error checks).
Thanks for testing. I'll fix the commit message and send in v3.
> Would you think adding relevant documentation in
> Documentation/devicetree/bindings/i2c/i2c-omap.txt might be good as
> well? I mean, folks should know looking at dt documentation that this
> bus driver does indeed support this option..
I'm not sure about that. Actually this is all handled by the pinctrl
subsystem, so I would guess that documentation belongs there, since in:
Documentation/devicetree/bindings/i2c/i2c-at91.txt
Documentation/devicetree/bindings/i2c/i2c-nomadik.txt
is no documentation about that as well. But there is documentation in:
Documentation/pinctrl.txt
right? Otherwise, I would say we should add documentation for all
devices, so it is consistent.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] omap: i2c: Add calls for pinctrl state select
2015-04-28 11:05 ` Pascal Huerst
@ 2015-04-28 13:11 ` Nishanth Menon
2015-04-28 13:11 ` Nishanth Menon
1 sibling, 0 replies; 5+ messages in thread
From: Nishanth Menon @ 2015-04-28 13:11 UTC (permalink / raw)
To: Pascal Huerst, Nishanth Menon, wsa
Cc: tony, linux-omap, linux-i2c, Sekhar Nori
On 04/28/2015 06:05 AM, Pascal Huerst wrote:
[...]
> On 23.04.2015 02:32, Nishanth Menon wrote:
[...]
>> Would you think adding relevant documentation in
>> Documentation/devicetree/bindings/i2c/i2c-omap.txt might be good as
>> well? I mean, folks should know looking at dt documentation that this
>> bus driver does indeed support this option..
>
> I'm not sure about that. Actually this is all handled by the pinctrl
> subsystem, so I would guess that documentation belongs there, since in:
>
> Documentation/devicetree/bindings/i2c/i2c-at91.txt
> Documentation/devicetree/bindings/i2c/i2c-nomadik.txt
>
> is no documentation about that as well. But there is documentation in:
>
> Documentation/pinctrl.txt
>
> right? Otherwise, I would say we should add documentation for all
> devices, so it is consistent.
that is probably good since drivers may or maynot support support the
sleep configuration.
--
Regards,
Nishanth Menon
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] omap: i2c: Add calls for pinctrl state select
2015-04-28 11:05 ` Pascal Huerst
2015-04-28 13:11 ` Nishanth Menon
@ 2015-04-28 13:11 ` Nishanth Menon
1 sibling, 0 replies; 5+ messages in thread
From: Nishanth Menon @ 2015-04-28 13:11 UTC (permalink / raw)
To: Pascal Huerst, Nishanth Menon, wsa
Cc: tony, linux-omap, linux-i2c, Sekhar Nori
On 04/28/2015 06:05 AM, Pascal Huerst wrote:
[...]
> On 23.04.2015 02:32, Nishanth Menon wrote:
[...]
>> Would you think adding relevant documentation in
>> Documentation/devicetree/bindings/i2c/i2c-omap.txt might be good as
>> well? I mean, folks should know looking at dt documentation that this
>> bus driver does indeed support this option..
>
> I'm not sure about that. Actually this is all handled by the pinctrl
> subsystem, so I would guess that documentation belongs there, since in:
>
> Documentation/devicetree/bindings/i2c/i2c-at91.txt
> Documentation/devicetree/bindings/i2c/i2c-nomadik.txt
>
> is no documentation about that as well. But there is documentation in:
>
> Documentation/pinctrl.txt
>
> right? Otherwise, I would say we should add documentation for all
> devices, so it is consistent.
that is probably good since drivers may or maynot support the sleep
configuration.
--
Regards,
Nishanth Menon
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-04-28 13:11 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-22 9:07 [PATCH v2] omap: i2c: Add calls for pinctrl state select pascal.huerst-Re5JQEeQqe8AvxtiuMwx3w
2015-04-23 0:32 ` Nishanth Menon
[not found] ` <55383D9A.4020302-l0cyMroinI0@public.gmane.org>
2015-04-28 11:05 ` Pascal Huerst
2015-04-28 13:11 ` Nishanth Menon
2015-04-28 13:11 ` Nishanth Menon
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).