[PATCH 2/3] mfd: twl6040: Handle mclk (for HPPLL) via clock API
From: Peter Ujfalusi
Date: Mon May 09 2016 - 08:24:40 EST
Support for mclk handling via clock API
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@xxxxxx>
---
drivers/mfd/twl6040.c | 27 ++++++++++++++++++++-------
include/linux/mfd/twl6040.h | 3 ++-
2 files changed, 22 insertions(+), 8 deletions(-)
diff --git a/drivers/mfd/twl6040.c b/drivers/mfd/twl6040.c
index 08a693cd38cc..32b72b65a0f0 100644
--- a/drivers/mfd/twl6040.c
+++ b/drivers/mfd/twl6040.c
@@ -291,7 +291,9 @@ int twl6040_power(struct twl6040 *twl6040, int on)
if (twl6040->power_count++)
goto out;
- clk_prepare_enable(twl6040->clk32k);
+ clk_prepare_enable(twl6040->clk32k_clk);
+ if (twl6040->pll == TWL6040_SYSCLK_SEL_HPPLL)
+ clk_prepare_enable(twl6040->mclk_clk);
/* Allow writes to the chip */
regcache_cache_only(twl6040->regmap, false);
@@ -349,7 +351,10 @@ int twl6040_power(struct twl6040 *twl6040, int on)
twl6040->sysclk = 0;
twl6040->mclk = 0;
- clk_disable_unprepare(twl6040->clk32k);
+ if (twl6040->pll == TWL6040_SYSCLK_SEL_HPPLL)
+ clk_disable_unprepare(twl6040->mclk_clk);
+
+ clk_disable_unprepare(twl6040->clk32k_clk);
}
out:
@@ -645,12 +650,20 @@ 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)) {
- if (PTR_ERR(twl6040->clk32k) == -EPROBE_DEFER)
+ twl6040->clk32k_clk = devm_clk_get(&client->dev, "clk32k_clk");
+ if (IS_ERR(twl6040->clk32k_clk)) {
+ if (PTR_ERR(twl6040->clk32k_clk) == -EPROBE_DEFER)
+ return -EPROBE_DEFER;
+ dev_info(&client->dev, "clk32k_clk is not handled\n");
+ twl6040->clk32k_clk = NULL;
+ }
+
+ twl6040->mclk_clk = devm_clk_get(&client->dev, "mclk");
+ if (IS_ERR(twl6040->mclk_clk)) {
+ if (PTR_ERR(twl6040->mclk_clk) == -EPROBE_DEFER)
return -EPROBE_DEFER;
- dev_info(&client->dev, "clk32k is not handled\n");
- twl6040->clk32k = NULL;
+ dev_info(&client->dev, "mclk is not handled\n");
+ twl6040->mclk_clk = NULL;
}
twl6040->supplies[0].supply = "vio";
diff --git a/include/linux/mfd/twl6040.h b/include/linux/mfd/twl6040.h
index 8f9fc3d26e6d..a7c50e54f3e0 100644
--- a/include/linux/mfd/twl6040.h
+++ b/include/linux/mfd/twl6040.h
@@ -224,7 +224,8 @@ struct twl6040 {
struct regmap *regmap;
struct regmap_irq_chip_data *irq_data;
struct regulator_bulk_data supplies[2]; /* supplies for vio, v2v1 */
- struct clk *clk32k;
+ struct clk *clk32k_clk;
+ struct clk *mclk_clk;
struct mutex mutex;
struct mutex irq_mutex;
struct mfd_cell cells[TWL6040_CELLS];
--
2.8.2
--------------49F46B4D2B0AD0B2C511B7EF
Content-Type: text/x-patch;
name="0003-ARM-dts-omap5-board-common-Add-phandle-for-mclk-cloc.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename*0="0003-ARM-dts-omap5-board-common-Add-phandle-for-mclk-cloc.pa";
filename*1="tch"