aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/arizona-core.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2013-03-19 09:47:47 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2013-04-08 09:20:59 -0400
commit247fa1920deeb1064e36c0a34410f4d63503b3d4 (patch)
treefa104f7fcc95dbeaf8e012af5347f56994573096 /drivers/mfd/arizona-core.c
parent7adafc5d97c0e23f1eac1cf1ee98d514026e7915 (diff)
mfd: arizona: Fully support the use of MCLK1 as the 32kHz clock source
MCLK1 is not in the AoD power domain so if it is used as the 32kHz clock source we need to hold a runtime PM reference to keep the device from going into low power mode. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd/arizona-core.c')
-rw-r--r--drivers/mfd/arizona-core.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/drivers/mfd/arizona-core.c b/drivers/mfd/arizona-core.c
index dd679e8601da..c2c969391291 100644
--- a/drivers/mfd/arizona-core.c
+++ b/drivers/mfd/arizona-core.c
@@ -39,11 +39,21 @@ int arizona_clk32k_enable(struct arizona *arizona)
39 39
40 arizona->clk32k_ref++; 40 arizona->clk32k_ref++;
41 41
42 if (arizona->clk32k_ref == 1) 42 if (arizona->clk32k_ref == 1) {
43 switch (arizona->pdata.clk32k_src) {
44 case ARIZONA_32KZ_MCLK1:
45 ret = pm_runtime_get_sync(arizona->dev);
46 if (ret != 0)
47 goto out;
48 break;
49 }
50
43 ret = regmap_update_bits(arizona->regmap, ARIZONA_CLOCK_32K_1, 51 ret = regmap_update_bits(arizona->regmap, ARIZONA_CLOCK_32K_1,
44 ARIZONA_CLK_32K_ENA, 52 ARIZONA_CLK_32K_ENA,
45 ARIZONA_CLK_32K_ENA); 53 ARIZONA_CLK_32K_ENA);
54 }
46 55
56out:
47 if (ret != 0) 57 if (ret != 0)
48 arizona->clk32k_ref--; 58 arizona->clk32k_ref--;
49 59
@@ -63,10 +73,17 @@ int arizona_clk32k_disable(struct arizona *arizona)
63 73
64 arizona->clk32k_ref--; 74 arizona->clk32k_ref--;
65 75
66 if (arizona->clk32k_ref == 0) 76 if (arizona->clk32k_ref == 0) {
67 regmap_update_bits(arizona->regmap, ARIZONA_CLOCK_32K_1, 77 regmap_update_bits(arizona->regmap, ARIZONA_CLOCK_32K_1,
68 ARIZONA_CLK_32K_ENA, 0); 78 ARIZONA_CLK_32K_ENA, 0);
69 79
80 switch (arizona->pdata.clk32k_src) {
81 case ARIZONA_32KZ_MCLK1:
82 pm_runtime_put_sync(arizona->dev);
83 break;
84 }
85 }
86
70 mutex_unlock(&arizona->clk_lock); 87 mutex_unlock(&arizona->clk_lock);
71 88
72 return ret; 89 return ret;