aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/busses/i2c-omap.c
diff options
context:
space:
mode:
authorShubhrajyoti D <shubhrajyoti@ti.com>2012-05-29 06:56:13 -0400
committerWolfram Sang <w.sang@pengutronix.de>2012-07-08 06:49:13 -0400
commit3dae3efb123f8b21df57f426c9c72d6ebcd83f8d (patch)
tree416684164ce94aaa988ecca69e25261b98459365 /drivers/i2c/busses/i2c-omap.c
parentf14cf2fb8d30f9dad2e532a4e3f1ed4ca82fbc3b (diff)
I2C: OMAP: make omap_i2c_unidle/idle functions depend on CONFIG_PM_RUNTIME
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. This patch removes the omap_i2c_unidle/idle functions and folds them into the runtime callbacks. 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 Reviewed-by: Kevin Hilman <khilman@ti.com> Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Diffstat (limited to 'drivers/i2c/busses/i2c-omap.c')
-rw-r--r--drivers/i2c/busses/i2c-omap.c75
1 files changed, 32 insertions, 43 deletions
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 801df6000e9b..4f4188de3251 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)
269 (i2c_dev->regs[reg] << i2c_dev->reg_shift)); 269 (i2c_dev->regs[reg] << i2c_dev->reg_shift));
270} 270}
271 271
272static void omap_i2c_unidle(struct omap_i2c_dev *dev)
273{
274 if (dev->flags & OMAP_I2C_FLAG_RESET_REGS_POSTIDLE) {
275 omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0);
276 omap_i2c_write_reg(dev, OMAP_I2C_PSC_REG, dev->pscstate);
277 omap_i2c_write_reg(dev, OMAP_I2C_SCLL_REG, dev->scllstate);
278 omap_i2c_write_reg(dev, OMAP_I2C_SCLH_REG, dev->sclhstate);
279 omap_i2c_write_reg(dev, OMAP_I2C_BUF_REG, dev->bufstate);
280 omap_i2c_write_reg(dev, OMAP_I2C_SYSC_REG, dev->syscstate);
281 omap_i2c_write_reg(dev, OMAP_I2C_WE_REG, dev->westate);
282 omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, OMAP_I2C_CON_EN);
283 }
284
285 /*
286 * Don't write to this register if the IE state is 0 as it can
287 * cause deadlock.
288 */
289 if (dev->iestate)
290 omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, dev->iestate);
291}
292
293static void omap_i2c_idle(struct omap_i2c_dev *dev)
294{
295 u16 iv;
296
297 dev->iestate = omap_i2c_read_reg(dev, OMAP_I2C_IE_REG);
298 if (dev->dtrev == OMAP_I2C_IP_VERSION_2)
299 omap_i2c_write_reg(dev, OMAP_I2C_IP_V2_IRQENABLE_CLR, 1);
300 else
301 omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, 0);
302
303 if (dev->rev < OMAP_I2C_OMAP1_REV_2) {
304 iv = omap_i2c_read_reg(dev, OMAP_I2C_IV_REG); /* Read clears */
305 } else {
306 omap_i2c_write_reg(dev, OMAP_I2C_STAT_REG, dev->iestate);
307
308 /* Flush posted write */
309 omap_i2c_read_reg(dev, OMAP_I2C_STAT_REG);
310 }
311}
312
313static int omap_i2c_init(struct omap_i2c_dev *dev) 272static int omap_i2c_init(struct omap_i2c_dev *dev)
314{ 273{
315 u16 psc = 0, scll = 0, sclh = 0, buf = 0; 274 u16 psc = 0, scll = 0, sclh = 0, buf = 0;
@@ -1163,8 +1122,22 @@ static int omap_i2c_runtime_suspend(struct device *dev)
1163{ 1122{
1164 struct platform_device *pdev = to_platform_device(dev); 1123 struct platform_device *pdev = to_platform_device(dev);
1165 struct omap_i2c_dev *_dev = platform_get_drvdata(pdev); 1124 struct omap_i2c_dev *_dev = platform_get_drvdata(pdev);
1125 u16 iv;
1126
1127 _dev->iestate = omap_i2c_read_reg(_dev, OMAP_I2C_IE_REG);
1128 if (_dev->dtrev == OMAP_I2C_IP_VERSION_2)
1129 omap_i2c_write_reg(_dev, OMAP_I2C_IP_V2_IRQENABLE_CLR, 1);
1130 else
1131 omap_i2c_write_reg(_dev, OMAP_I2C_IE_REG, 0);
1132
1133 if (_dev->rev < OMAP_I2C_OMAP1_REV_2) {
1134 iv = omap_i2c_read_reg(_dev, OMAP_I2C_IV_REG); /* Read clears */
1135 } else {
1136 omap_i2c_write_reg(_dev, OMAP_I2C_STAT_REG, _dev->iestate);
1166 1137
1167 omap_i2c_idle(_dev); 1138 /* Flush posted write */
1139 omap_i2c_read_reg(_dev, OMAP_I2C_STAT_REG);
1140 }
1168 1141
1169 return 0; 1142 return 0;
1170} 1143}
@@ -1174,7 +1147,23 @@ static int omap_i2c_runtime_resume(struct device *dev)
1174 struct platform_device *pdev = to_platform_device(dev); 1147 struct platform_device *pdev = to_platform_device(dev);
1175 struct omap_i2c_dev *_dev = platform_get_drvdata(pdev); 1148 struct omap_i2c_dev *_dev = platform_get_drvdata(pdev);
1176 1149
1177 omap_i2c_unidle(_dev); 1150 if (_dev->flags & OMAP_I2C_FLAG_RESET_REGS_POSTIDLE) {
1151 omap_i2c_write_reg(_dev, OMAP_I2C_CON_REG, 0);
1152 omap_i2c_write_reg(_dev, OMAP_I2C_PSC_REG, _dev->pscstate);
1153 omap_i2c_write_reg(_dev, OMAP_I2C_SCLL_REG, _dev->scllstate);
1154 omap_i2c_write_reg(_dev, OMAP_I2C_SCLH_REG, _dev->sclhstate);
1155 omap_i2c_write_reg(_dev, OMAP_I2C_BUF_REG, _dev->bufstate);
1156 omap_i2c_write_reg(_dev, OMAP_I2C_SYSC_REG, _dev->syscstate);
1157 omap_i2c_write_reg(_dev, OMAP_I2C_WE_REG, _dev->westate);
1158 omap_i2c_write_reg(_dev, OMAP_I2C_CON_REG, OMAP_I2C_CON_EN);
1159 }
1160
1161 /*
1162 * Don't write to this register if the IE state is 0 as it can
1163 * cause deadlock.
1164 */
1165 if (_dev->iestate)
1166 omap_i2c_write_reg(_dev, OMAP_I2C_IE_REG, _dev->iestate);
1178 1167
1179 return 0; 1168 return 0;
1180} 1169}