summaryrefslogtreecommitdiffstats
path: root/drivers/mfd/twl6040.c
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@ti.com>2014-04-03 13:54:41 +0300
committerLee Jones <lee.jones@linaro.org>2014-06-03 08:11:20 +0100
commit68bab8662f49b9e158f1d32f11becd4e48c04079 (patch)
tree7d10c7dd0ca07d390f00982b10079ffdab069975 /drivers/mfd/twl6040.c
parent11e38e11afcdd598d0978746924a001e3e7cb723 (diff)
downloadlinux-68bab8662f49b9e158f1d32f11becd4e48c04079.tar.bz2
mfd: twl6040: Optional clk32k clock handling
In certain boards the source for the clk32k clock can be gated. In these boards the clk32k clock can be provided to the driver and it is going to be enabled/disabled when it is needed. If the clk32k clock is not provided the driver will assume that it is always running. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'drivers/mfd/twl6040.c')
-rw-r--r--drivers/mfd/twl6040.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/mfd/twl6040.c b/drivers/mfd/twl6040.c
index cb37bb8f8e41..574774d7f826 100644
--- a/drivers/mfd/twl6040.c
+++ b/drivers/mfd/twl6040.c
@@ -291,6 +291,8 @@ int twl6040_power(struct twl6040 *twl6040, int on)
if (twl6040->power_count++)
goto out;
+ clk_prepare_enable(twl6040->clk32k);
+
/* Allow writes to the chip */
regcache_cache_only(twl6040->regmap, false);
@@ -346,6 +348,8 @@ int twl6040_power(struct twl6040 *twl6040, int on)
twl6040->sysclk = 0;
twl6040->mclk = 0;
+
+ clk_disable_unprepare(twl6040->clk32k);
}
out:
@@ -644,6 +648,12 @@ static int twl6040_probe(struct i2c_client *client,
i2c_set_clientdata(client, twl6040);
+ twl6040->clk32k = devm_clk_get(&client->dev, "clk32k");
+ if (IS_ERR(twl6040->clk32k)) {
+ dev_info(&client->dev, "clk32k is not handled\n");
+ twl6040->clk32k = NULL;
+ }
+
twl6040->supplies[0].supply = "vio";
twl6040->supplies[1].supply = "v2v1";
ret = devm_regulator_bulk_get(&client->dev, TWL6040_NUM_SUPPLIES,