summaryrefslogtreecommitdiff
path: root/arch/arm/mach-davinci/cdce949.c
diff options
context:
space:
mode:
authorSekhar Nori <nsekhar@ti.com>2010-01-12 16:25:35 +0300
committerKevin Hilman <khilman@deeprootsystems.com>2010-02-05 00:30:08 +0300
commit3b43cd6f2dcbf871b8cabe16ae4ac8c036c959ac (patch)
tree064252da18333283fc12e088f37b94fc6c74e24e /arch/arm/mach-davinci/cdce949.c
parent00642f6616a0d1893ab1dcfec4d833210f310e95 (diff)
downloadlinux-3b43cd6f2dcbf871b8cabe16ae4ac8c036c959ac.tar.xz
davinci: clock: let clk->set_rate function sleep
When supporting I2C/SPI based on-board PLLs like CDCE949, it is essential that clk->set_rate be able to sleep. Currently, this is not possible because clk->set_rate is called from within spin-lock in clk_set_rate This patch brings clk->set_rate outside of the spin-lock and lets the individual set_rate implementations achieve serialization through appropiate means. Signed-off-by: Sekhar Nori <nsekhar@ti.com> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Diffstat (limited to 'arch/arm/mach-davinci/cdce949.c')
-rw-r--r--arch/arm/mach-davinci/cdce949.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/arch/arm/mach-davinci/cdce949.c b/arch/arm/mach-davinci/cdce949.c
index 6af3289e0527..aec375690543 100644
--- a/arch/arm/mach-davinci/cdce949.c
+++ b/arch/arm/mach-davinci/cdce949.c
@@ -23,6 +23,7 @@
#include "clock.h"
static struct i2c_client *cdce_i2c_client;
+static DEFINE_MUTEX(cdce_mutex);
/* CDCE register descriptor */
struct cdce_reg {
@@ -231,16 +232,19 @@ int cdce_set_rate(struct clk *clk, unsigned long rate)
if (!regs)
return -EINVAL;
+ mutex_lock(&cdce_mutex);
for (i = 0; regs[i].addr; i++) {
ret = i2c_smbus_write_byte_data(cdce_i2c_client,
regs[i].addr | 0x80, regs[i].val);
if (ret)
- return ret;
+ break;
}
+ mutex_unlock(&cdce_mutex);
- clk->rate = rate;
+ if (!ret)
+ clk->rate = rate;
- return 0;
+ return ret;
}
static int cdce_probe(struct i2c_client *client,