Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 295650
b: refs/heads/master
c: 72f83af
h: refs/heads/master
v: v3
  • Loading branch information
Tarun Kanti DebBarma committed Feb 6, 2012
1 parent d32c40a commit c13317e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2dc983c565e03f6f6f96c5fe7449b65d86af4dee
refs/heads/master: 72f83af99838bb663f85b65386db5b875748f379
29 changes: 19 additions & 10 deletions trunk/drivers/gpio/gpio-omap.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ struct gpio_bank {
struct clk *dbck;
u32 mod_usage;
u32 dbck_enable_mask;
bool dbck_enabled;
struct device *dev;
bool is_mpuio;
bool dbck_flag;
Expand Down Expand Up @@ -158,6 +159,22 @@ static inline void _gpio_rmw(void __iomem *base, u32 reg, u32 mask, bool set)
__raw_writel(l, base + reg);
}

static inline void _gpio_dbck_enable(struct gpio_bank *bank)
{
if (bank->dbck_enable_mask && !bank->dbck_enabled) {
clk_enable(bank->dbck);
bank->dbck_enabled = true;
}
}

static inline void _gpio_dbck_disable(struct gpio_bank *bank)
{
if (bank->dbck_enable_mask && bank->dbck_enabled) {
clk_disable(bank->dbck);
bank->dbck_enabled = false;
}
}

/**
* _set_gpio_debounce - low level gpio debounce time
* @bank: the gpio bank we're acting upon
Expand Down Expand Up @@ -1178,6 +1195,7 @@ static int omap_gpio_runtime_suspend(struct device *dev)
bank->get_context_loss_count(bank->dev);

omap_gpio_save_context(bank);
_gpio_dbck_disable(bank);
spin_unlock_irqrestore(&bank->lock, flags);

return 0;
Expand All @@ -1192,6 +1210,7 @@ static int omap_gpio_runtime_resume(struct device *dev)
unsigned long flags;

spin_lock_irqsave(&bank->lock, flags);
_gpio_dbck_enable(bank);
if (!bank->enabled_non_wakeup_gpios || !bank->workaround_enabled) {
spin_unlock_irqrestore(&bank->lock, flags);
return 0;
Expand Down Expand Up @@ -1274,16 +1293,11 @@ void omap2_gpio_prepare_for_idle(int pwr_mode)
struct gpio_bank *bank;

list_for_each_entry(bank, &omap_gpio_list, node) {
int j;

if (!bank->mod_usage || !bank->loses_context)
continue;

bank->power_mode = pwr_mode;

for (j = 0; j < hweight_long(bank->dbck_enable_mask); j++)
clk_disable(bank->dbck);

pm_runtime_put_sync_suspend(bank->dev);
}
}
Expand All @@ -1293,14 +1307,9 @@ void omap2_gpio_resume_after_idle(void)
struct gpio_bank *bank;

list_for_each_entry(bank, &omap_gpio_list, node) {
int j;

if (!bank->mod_usage || !bank->loses_context)
continue;

for (j = 0; j < hweight_long(bank->dbck_enable_mask); j++)
clk_enable(bank->dbck);

pm_runtime_get_sync(bank->dev);
}
}
Expand Down

0 comments on commit c13317e

Please sign in to comment.