aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAxel Haslam <axelhaslam@ti.com>2011-09-05 14:26:52 -0700
committerTodd Poynor <toddpoynor@google.com>2011-09-06 19:48:37 -0700
commit18c2cdffc3995aaa38792e5d65a4ad4c00d700c6 (patch)
tree001205f82f4323be5acda1e981af532bbbd8a640 /drivers
parent6d80f8efdbe1e5e2bc6622aed693ea61c92edd25 (diff)
downloadkernel_samsung_tuna-18c2cdffc3995aaa38792e5d65a4ad4c00d700c6.zip
kernel_samsung_tuna-18c2cdffc3995aaa38792e5d65a4ad4c00d700c6.tar.gz
kernel_samsung_tuna-18c2cdffc3995aaa38792e5d65a4ad4c00d700c6.tar.bz2
OMAP: PM: replace omap_pm_get_dev_context_loss_count with omap_pm_was_context_lost
Drivers just need to know if thier context was lost or not. There is not much point in maintaining a count This removes omap_pm_get_dev_context_loss_count and replaces it with omap_pm_was_context_lost Adapt drivers to use the omap_pm_was_context_lost API, which returns a bool value instead of relying on the incrementing context lost counter. This makes drivers a little more snappier as they do not need to restore contexts when not needed. WARNING: this changes the api set available to drivers to use from OMAP PM layer. Change-Id: I7fd9183d3e12982bb40651df9378637073121399 Signed-off-by: Axel Haslam <axelhaslam@ti.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpio/gpio-omap.c16
-rw-r--r--drivers/misc/omap_temp_sensor.c23
-rw-r--r--drivers/mmc/host/omap_hsmmc.c35
-rw-r--r--drivers/tty/serial/omap-serial.c9
-rw-r--r--drivers/video/omap2/dss/dispc.c5
5 files changed, 21 insertions, 67 deletions
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index 110567e..b20d3164 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -27,6 +27,7 @@
#include <mach/irqs.h>
#include <mach/gpio.h>
#include <asm/mach/irq.h>
+#include <plat/omap-pm.h>
static LIST_HEAD(omap_gpio_list);
@@ -74,12 +75,9 @@ struct gpio_bank {
bool saved_context;
int stride;
u32 width;
- u32 ctx_loss_count;
u16 id;
void (*set_dataout)(struct gpio_bank *bank, int gpio, int enable);
- int (*get_context_loss_count)(struct device *dev);
-
struct omap_gpio_reg_offs *regs;
};
@@ -1139,7 +1137,6 @@ static int __devinit omap_gpio_probe(struct platform_device *pdev)
bank->non_wakeup_gpios = pdata->non_wakeup_gpios;
bank->loses_context = pdata->loses_context;
bank->regs = pdata->regs;
- bank->get_context_loss_count = pdata->get_context_loss_count;
bank->saved_context = 0;
if (bank->regs->set_dataout && bank->regs->clr_dataout)
bank->set_dataout = _set_gpio_dataout_reg;
@@ -1285,8 +1282,6 @@ static int omap_gpio_pm_runtime_suspend(struct device *dev)
__raw_writel(l2, bank->base + bank->regs->risingdetect);
save_gpio_ctx:
- if (bank->get_context_loss_count)
- bank->ctx_loss_count = bank->get_context_loss_count(bank->dev);
omap_gpio_save_context(bank);
for (j = 0; j < hweight_long(bank->dbck_enable_mask); j++)
clk_disable(bank->dbck);
@@ -1300,19 +1295,14 @@ static int omap_gpio_pm_runtime_resume(struct device *dev)
#ifdef CONFIG_ARCH_OMAP2PLUS
struct platform_device *pdev = to_platform_device(dev);
struct gpio_bank *bank = platform_get_drvdata(pdev);
- u32 ctx_lost_cnt_after;
u32 l = 0, gen, gen0, gen1;
int j;
for (j = 0; j < hweight_long(bank->dbck_enable_mask); j++)
clk_enable(bank->dbck);
- if (bank->get_context_loss_count) {
- ctx_lost_cnt_after =
- bank->get_context_loss_count(bank->dev);
- if (ctx_lost_cnt_after != bank->ctx_loss_count)
- omap_gpio_restore_context(bank);
- }
+ if (omap_pm_was_context_lost(dev))
+ omap_gpio_restore_context(bank);
if (!(bank->enabled_non_wakeup_gpios))
return 0;
diff --git a/drivers/misc/omap_temp_sensor.c b/drivers/misc/omap_temp_sensor.c
index e53ea5c..3ec381f 100644
--- a/drivers/misc/omap_temp_sensor.c
+++ b/drivers/misc/omap_temp_sensor.c
@@ -40,6 +40,7 @@
#include <linux/types.h>
#include <plat/common.h>
+#include <plat/omap-pm.h>
#include <plat/omap_device.h>
#include <plat/temperature_sensor.h>
#include <plat/omap-pm.h>
@@ -85,6 +86,7 @@ struct omap_temp_sensor {
u8 clk_on;
unsigned long clk_rate;
u32 current_temp;
+ u32 save_ctx;
};
#ifdef CONFIG_PM
@@ -464,6 +466,7 @@ static int __devinit omap_temp_sensor_probe(struct platform_device *pdev)
temp_sensor->phy_base = pdata->offset;
temp_sensor->pdev = pdev;
temp_sensor->dev = dev;
+ temp_sensor->save_ctx = 0;
pm_runtime_enable(dev);
pm_runtime_irq_safe(dev);
@@ -647,34 +650,26 @@ omap_temp_sensor_suspend NULL
omap_temp_sensor_resume NULL
#endif /* CONFIG_PM */
-
static int omap_temp_sensor_runtime_suspend(struct device *dev)
{
struct omap_temp_sensor *temp_sensor =
platform_get_drvdata(to_platform_device(dev));
omap_temp_sensor_save_ctxt(temp_sensor);
-
+ temp_sensor->save_ctx = 1;
return 0;
}
static int omap_temp_sensor_runtime_resume(struct device *dev)
{
- static int context_loss_count;
- int temp;
struct omap_temp_sensor *temp_sensor =
platform_get_drvdata(to_platform_device(dev));
-
- temp = omap_pm_get_dev_context_loss_count(dev);
-
- /* consider error return from context loss as:
- * force context restore with a WARN_ON() */
- if (WARN_ON(temp < 0) ||
- (temp != context_loss_count && context_loss_count != 0))
+ if (temp_sensor->save_ctx)
+ return 0;
+ if (omap_pm_was_context_lost(dev)) {
omap_temp_sensor_restore_ctxt(temp_sensor);
-
- context_loss_count = temp;
-
+ temp_sensor->save_ctx = 0;
+ }
return 0;
}
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 2ca145b..18fc306 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -41,6 +41,7 @@
#include <plat/board.h>
#include <plat/mmc.h>
#include <plat/cpu.h>
+#include <plat/omap-pm.h>
/* OMAP HSMMC Host Controller Registers */
#define OMAP_HSMMC_SYSCONFIG 0x0010
@@ -181,7 +182,6 @@ struct omap_hsmmc_host {
int slot_id;
int got_dbclk;
int response_busy;
- int context_loss;
int dpm_state;
int vdd;
int protect_card;
@@ -597,21 +597,11 @@ static void omap_hsmmc_disable_irq(struct omap_hsmmc_host *host)
static int omap_hsmmc_context_restore(struct omap_hsmmc_host *host)
{
struct mmc_ios *ios = &host->mmc->ios;
- struct omap_mmc_platform_data *pdata = host->pdata;
- int context_loss = 0;
u32 hctl, capa, con;
u16 dsor = 0;
unsigned long timeout;
- if (pdata->get_context_loss_count) {
- context_loss = pdata->get_context_loss_count(host->dev);
- if (context_loss < 0)
- return 1;
- }
-
- dev_dbg(mmc_dev(host->mmc), "context was %slost\n",
- context_loss == host->context_loss ? "not " : "");
- if (host->context_loss == context_loss)
+ if (!omap_pm_was_context_lost(host->dev))
return 1;
/* Wait for hardware reset */
@@ -711,8 +701,6 @@ static int omap_hsmmc_context_restore(struct omap_hsmmc_host *host)
else
OMAP_HSMMC_WRITE(host->base, CON, con & ~OD);
out:
- host->context_loss = context_loss;
-
dev_dbg(mmc_dev(host->mmc), "context is restored\n");
return 0;
}
@@ -722,15 +710,7 @@ out:
*/
static void omap_hsmmc_context_save(struct omap_hsmmc_host *host)
{
- struct omap_mmc_platform_data *pdata = host->pdata;
- int context_loss;
-
- if (pdata->get_context_loss_count) {
- context_loss = pdata->get_context_loss_count(host->dev);
- if (context_loss < 0)
- return;
- host->context_loss = context_loss;
- }
+ return;
}
#else
@@ -1946,20 +1926,15 @@ static int omap_hsmmc_regs_show(struct seq_file *s, void *data)
{
struct mmc_host *mmc = s->private;
struct omap_hsmmc_host *host = mmc_priv(mmc);
- int context_loss = 0;
- if (host->pdata->get_context_loss_count)
- context_loss = host->pdata->get_context_loss_count(host->dev);
seq_printf(s, "mmc%d:\n"
" enabled:\t%d\n"
" dpm_state:\t%d\n"
" nesting_cnt:\t%d\n"
- " ctx_loss:\t%d:%d\n"
- "\nregs:\n",
+ " ct",
mmc->index, mmc->enabled ? 1 : 0,
- host->dpm_state, mmc->nesting_cnt,
- host->context_loss, context_loss);
+ host->dpm_state, mmc->nesting_cnt);
if (host->suspended || host->dpm_state == OFF) {
seq_printf(s, "host suspended, can't read registers\n");
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index f2330bd..548cc88 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -1608,7 +1608,6 @@ static int omap_serial_runtime_suspend(struct device *dev)
if (up->rts_mux_driver_control)
omap_rts_mux_write(MUX_PULL_UP, up->port.line);
- up->context_loss_cnt = omap_pm_get_dev_context_loss_count(dev);
if (device_may_wakeup(dev))
up->enable_wakeup(up->pdev, true);
else
@@ -1623,13 +1622,7 @@ static int omap_serial_runtime_resume(struct device *dev)
struct omap_device *od;
if (up) {
- int loss_cnt = omap_pm_get_dev_context_loss_count(dev);
-
- /* We don't expect error in this function
- * Just in case its an error:
- * treat it as force-context-restore */
- if (WARN_ON(loss_cnt < 0) ||
- (up->context_loss_cnt != loss_cnt))
+ if (omap_pm_was_context_lost(dev))
omap_uart_restore_context(up);
if (up->use_dma) {
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index 6bc2f29..b3d7bc8 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -39,7 +39,7 @@
#include <plat/sram.h>
#include <plat/clock.h>
#include <mach/tiler.h>
-
+#include <plat/omap-pm.h>
#include <video/omapdss.h>
#include "dss.h"
@@ -303,6 +303,7 @@ static void dispc_save_context(void)
static void dispc_restore_context(void)
{
+ struct device *dev = &dispc.pdev->dev;
int i, o, ctx;
DSSDBG("dispc_restore_context\n");
@@ -312,7 +313,7 @@ static void dispc_restore_context(void)
ctx = dispc_get_ctx_loss_count();
- if (ctx >= 0 && ctx == dispc.ctx_loss_cnt)
+ if (!omap_pm_was_context_lost(dev))
return;
DSSDBG("ctx_loss_count: saved %d, current %d\n",