Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 296606
b: refs/heads/master
c: b845186
h: refs/heads/master
v: v3
  • Loading branch information
Roland Stigge authored and Olof Johansson committed Feb 9, 2012
1 parent 9c75f8e commit d65b56e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 31 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: 0cf0d815ba0d09281c5671b82a83c4220a606dc4
refs/heads/master: b84518625183e87c6930b11db0592be786181128
41 changes: 11 additions & 30 deletions trunk/arch/arm/mach-lpc32xx/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,10 @@
#include "clock.h"
#include "common.h"

static DEFINE_SPINLOCK(global_clkregs_lock);

static struct clk clk_armpll;
static struct clk clk_usbpll;
static DEFINE_MUTEX(clkm_lock);

/*
* Post divider values for PLLs based on selected register value
Expand Down Expand Up @@ -891,16 +892,6 @@ static struct clk clk_lcd = {
.enable_mask = LPC32XX_CLKPWR_LCDCTRL_CLK_EN,
};

static inline void clk_lock(void)
{
mutex_lock(&clkm_lock);
}

static inline void clk_unlock(void)
{
mutex_unlock(&clkm_lock);
}

static void local_clk_disable(struct clk *clk)
{
/* Don't attempt to disable clock if it has no users */
Expand Down Expand Up @@ -945,10 +936,11 @@ static int local_clk_enable(struct clk *clk)
int clk_enable(struct clk *clk)
{
int ret;
unsigned long flags;

clk_lock();
spin_lock_irqsave(&global_clkregs_lock, flags);
ret = local_clk_enable(clk);
clk_unlock();
spin_unlock_irqrestore(&global_clkregs_lock, flags);

return ret;
}
Expand All @@ -959,9 +951,11 @@ EXPORT_SYMBOL(clk_enable);
*/
void clk_disable(struct clk *clk)
{
clk_lock();
unsigned long flags;

spin_lock_irqsave(&global_clkregs_lock, flags);
local_clk_disable(clk);
clk_unlock();
spin_unlock_irqrestore(&global_clkregs_lock, flags);
}
EXPORT_SYMBOL(clk_disable);

Expand All @@ -970,13 +964,7 @@ EXPORT_SYMBOL(clk_disable);
*/
unsigned long clk_get_rate(struct clk *clk)
{
unsigned long rate;

clk_lock();
rate = clk->get_rate(clk);
clk_unlock();

return rate;
return clk->get_rate(clk);
}
EXPORT_SYMBOL(clk_get_rate);

Expand All @@ -992,11 +980,8 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
* the actual rate set as part of the peripheral dividers
* instead of high level clock control
*/
if (clk->set_rate) {
clk_lock();
if (clk->set_rate)
ret = clk->set_rate(clk, rate);
clk_unlock();
}

return ret;
}
Expand All @@ -1007,15 +992,11 @@ EXPORT_SYMBOL(clk_set_rate);
*/
long clk_round_rate(struct clk *clk, unsigned long rate)
{
clk_lock();

if (clk->round_rate)
rate = clk->round_rate(clk, rate);
else
rate = clk->get_rate(clk);

clk_unlock();

return rate;
}
EXPORT_SYMBOL(clk_round_rate);
Expand Down

0 comments on commit d65b56e

Please sign in to comment.