* [PATCH RFC] I2C : OMAP : make omap_i2c_unidle/idle functions depend on CONFIG_PM_RUNTIME
@ 2012-01-11 8:30 Shubhrajyoti D
2012-01-11 22:16 ` Kevin Hilman
0 siblings, 1 reply; 4+ messages in thread
From: Shubhrajyoti D @ 2012-01-11 8:30 UTC (permalink / raw)
To: linux-i2c-u79uwXL29TY76Z2rM5mHXA
Cc: linux-omap-u79uwXL29TY76Z2rM5mHXA, khilman-l0cyMroinI0,
ben-linux-elnMNo+KYs3YtjvyW6yDsg, Shubhrajyoti D
The functions omap_i2c_unidle/idle are called from omap_i2c_runtime_resume
and omap_i2c_runtime_suspend which is compiled for CONFIG_PM_RUNTIME.
Make the omap_i2c_unidle/idle also depend on CONFIG_PM_RUNTIME flag.
This fixes the below warn when CONFIG_PM_RUNTIME is not defined
CC arch/arm/mach-omap2/board-ti8168evm.o
drivers/i2c/busses/i2c-omap.c:272: warning: 'omap_i2c_unidle' defined but not used
drivers/i2c/busses/i2c-omap.c:293: warning: 'omap_i2c_idle' defined but not used
CC net/ipv4/ip_forward.o
Signed-off-by: Shubhrajyoti D <shubhrajyoti-l0cyMroinI0@public.gmane.org>
---
applies to Kevin's for_3.3/i2c/misc branch
drivers/i2c/busses/i2c-omap.c | 82 ++++++++++++++++++++--------------------
1 files changed, 41 insertions(+), 41 deletions(-)
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index f713eac..ad564ac 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -269,47 +269,6 @@ static inline u16 omap_i2c_read_reg(struct omap_i2c_dev *i2c_dev, int reg)
(i2c_dev->regs[reg] << i2c_dev->reg_shift));
}
-static void omap_i2c_unidle(struct omap_i2c_dev *dev)
-{
- if (dev->flags & OMAP_I2C_FLAG_RESET_REGS_POSTIDLE) {
- omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0);
- omap_i2c_write_reg(dev, OMAP_I2C_PSC_REG, dev->pscstate);
- omap_i2c_write_reg(dev, OMAP_I2C_SCLL_REG, dev->scllstate);
- omap_i2c_write_reg(dev, OMAP_I2C_SCLH_REG, dev->sclhstate);
- omap_i2c_write_reg(dev, OMAP_I2C_BUF_REG, dev->bufstate);
- omap_i2c_write_reg(dev, OMAP_I2C_SYSC_REG, dev->syscstate);
- omap_i2c_write_reg(dev, OMAP_I2C_WE_REG, dev->westate);
- omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, OMAP_I2C_CON_EN);
- }
-
- /*
- * Don't write to this register if the IE state is 0 as it can
- * cause deadlock.
- */
- if (dev->iestate)
- omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, dev->iestate);
-}
-
-static void omap_i2c_idle(struct omap_i2c_dev *dev)
-{
- u16 iv;
-
- dev->iestate = omap_i2c_read_reg(dev, OMAP_I2C_IE_REG);
- if (dev->dtrev == OMAP_I2C_IP_VERSION_2)
- omap_i2c_write_reg(dev, OMAP_I2C_IP_V2_IRQENABLE_CLR, 1);
- else
- omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, 0);
-
- if (dev->rev < OMAP_I2C_OMAP1_REV_2) {
- iv = omap_i2c_read_reg(dev, OMAP_I2C_IV_REG); /* Read clears */
- } else {
- omap_i2c_write_reg(dev, OMAP_I2C_STAT_REG, dev->iestate);
-
- /* Flush posted write */
- omap_i2c_read_reg(dev, OMAP_I2C_STAT_REG);
- }
-}
-
static int omap_i2c_init(struct omap_i2c_dev *dev)
{
u16 psc = 0, scll = 0, sclh = 0, buf = 0;
@@ -1159,6 +1118,47 @@ omap_i2c_remove(struct platform_device *pdev)
}
#ifdef CONFIG_PM_RUNTIME
+static void omap_i2c_unidle(struct omap_i2c_dev *dev)
+{
+ if (dev->flags & OMAP_I2C_FLAG_RESET_REGS_POSTIDLE) {
+ omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0);
+ omap_i2c_write_reg(dev, OMAP_I2C_PSC_REG, dev->pscstate);
+ omap_i2c_write_reg(dev, OMAP_I2C_SCLL_REG, dev->scllstate);
+ omap_i2c_write_reg(dev, OMAP_I2C_SCLH_REG, dev->sclhstate);
+ omap_i2c_write_reg(dev, OMAP_I2C_BUF_REG, dev->bufstate);
+ omap_i2c_write_reg(dev, OMAP_I2C_SYSC_REG, dev->syscstate);
+ omap_i2c_write_reg(dev, OMAP_I2C_WE_REG, dev->westate);
+ omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, OMAP_I2C_CON_EN);
+ }
+
+ /*
+ * Don't write to this register if the IE state is 0 as it can
+ * cause deadlock.
+ */
+ if (dev->iestate)
+ omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, dev->iestate);
+}
+
+static void omap_i2c_idle(struct omap_i2c_dev *dev)
+{
+ u16 iv;
+
+ dev->iestate = omap_i2c_read_reg(dev, OMAP_I2C_IE_REG);
+ if (dev->dtrev == OMAP_I2C_IP_VERSION_2)
+ omap_i2c_write_reg(dev, OMAP_I2C_IP_V2_IRQENABLE_CLR, 1);
+ else
+ omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, 0);
+
+ if (dev->rev < OMAP_I2C_OMAP1_REV_2) {
+ iv = omap_i2c_read_reg(dev, OMAP_I2C_IV_REG); /* Read clears */
+ } else {
+ omap_i2c_write_reg(dev, OMAP_I2C_STAT_REG, dev->iestate);
+
+ /* Flush posted write */
+ omap_i2c_read_reg(dev, OMAP_I2C_STAT_REG);
+ }
+}
+
static int omap_i2c_runtime_suspend(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
--
1.7.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH RFC] I2C : OMAP : make omap_i2c_unidle/idle functions depend on CONFIG_PM_RUNTIME
2012-01-11 8:30 [PATCH RFC] I2C : OMAP : make omap_i2c_unidle/idle functions depend on CONFIG_PM_RUNTIME Shubhrajyoti D
@ 2012-01-11 22:16 ` Kevin Hilman
[not found] ` <877h0x3mxh.fsf-l0cyMroinI0@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Kevin Hilman @ 2012-01-11 22:16 UTC (permalink / raw)
To: Shubhrajyoti D; +Cc: linux-i2c, linux-omap, ben-linux
Shubhrajyoti D <shubhrajyoti@ti.com> writes:
> The functions omap_i2c_unidle/idle are called from omap_i2c_runtime_resume
> and omap_i2c_runtime_suspend which is compiled for CONFIG_PM_RUNTIME.
> Make the omap_i2c_unidle/idle also depend on CONFIG_PM_RUNTIME flag.
I probably should've done this when I initially cleaned up the
callbacks, but since you're doing it...
rather than move the functions within the file, just remove the
functions and move the code into the runtime callbacks.
Kevin
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH RFC] I2C : OMAP : make omap_i2c_unidle/idle functions depend on CONFIG_PM_RUNTIME
[not found] ` <877h0x3mxh.fsf-l0cyMroinI0@public.gmane.org>
@ 2012-01-12 6:59 ` Shubhrajyoti
[not found] ` <4F0E84B9.8050805-l0cyMroinI0@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Shubhrajyoti @ 2012-01-12 6:59 UTC (permalink / raw)
To: Kevin Hilman
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA,
linux-omap-u79uwXL29TY76Z2rM5mHXA,
ben-linux-elnMNo+KYs3YtjvyW6yDsg
On Thursday 12 January 2012 03:46 AM, Kevin Hilman wrote:
> Shubhrajyoti D <shubhrajyoti-l0cyMroinI0@public.gmane.org> writes:
>
>> The functions omap_i2c_unidle/idle are called from omap_i2c_runtime_resume
>> and omap_i2c_runtime_suspend which is compiled for CONFIG_PM_RUNTIME.
>> Make the omap_i2c_unidle/idle also depend on CONFIG_PM_RUNTIME flag.
> I probably should've done this when I initially cleaned up the
> callbacks, but since you're doing it...
>
> rather than move the functions within the file, just remove the
> functions and move the code into the runtime callbacks.
That may break the modularity of the code since the
omap_i2c_unidle is responsible for restore. I would have preferred to keep it separate.
Do you think I could rename omap_i2c_unidle to
omap_i2c_restore instead ?
However don't feel strongly about it either dif you still feel that it should be moved into runtime
callbacks directly I am ok.
>
> Kevin
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH RFC] I2C : OMAP : make omap_i2c_unidle/idle functions depend on CONFIG_PM_RUNTIME
[not found] ` <4F0E84B9.8050805-l0cyMroinI0@public.gmane.org>
@ 2012-01-19 19:08 ` Kevin Hilman
0 siblings, 0 replies; 4+ messages in thread
From: Kevin Hilman @ 2012-01-19 19:08 UTC (permalink / raw)
To: Shubhrajyoti
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA,
linux-omap-u79uwXL29TY76Z2rM5mHXA,
ben-linux-elnMNo+KYs3YtjvyW6yDsg
Shubhrajyoti <shubhrajyoti-l0cyMroinI0@public.gmane.org> writes:
> On Thursday 12 January 2012 03:46 AM, Kevin Hilman wrote:
>> Shubhrajyoti D <shubhrajyoti-l0cyMroinI0@public.gmane.org> writes:
>>
>>> The functions omap_i2c_unidle/idle are called from omap_i2c_runtime_resume
>>> and omap_i2c_runtime_suspend which is compiled for CONFIG_PM_RUNTIME.
>>> Make the omap_i2c_unidle/idle also depend on CONFIG_PM_RUNTIME flag.
>> I probably should've done this when I initially cleaned up the
>> callbacks, but since you're doing it...
>>
>> rather than move the functions within the file, just remove the
>> functions and move the code into the runtime callbacks.
> That may break the modularity of the code since the
>
> omap_i2c_unidle is responsible for restore. I would have preferred to keep it separate.
> Do you think I could rename omap_i2c_unidle to
> omap_i2c_restore instead ?
that doesn't help: It does restore and (re)enable interrupts.
> However don't feel strongly about it either dif you still feel that it should be moved into runtime
> callbacks directly I am ok.
Yes, just move it into the runtime callbacks as it's the only place they
are used.
Kevin
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-01-19 19:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-11 8:30 [PATCH RFC] I2C : OMAP : make omap_i2c_unidle/idle functions depend on CONFIG_PM_RUNTIME Shubhrajyoti D
2012-01-11 22:16 ` Kevin Hilman
[not found] ` <877h0x3mxh.fsf-l0cyMroinI0@public.gmane.org>
2012-01-12 6:59 ` Shubhrajyoti
[not found] ` <4F0E84B9.8050805-l0cyMroinI0@public.gmane.org>
2012-01-19 19:08 ` Kevin Hilman
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).