diff options
-rw-r--r-- | Documentation/devicetree/bindings/mfd/twl6040.txt | 2 | ||||
-rw-r--r-- | drivers/mfd/twl6040.c | 10 | ||||
-rw-r--r-- | include/linux/mfd/twl6040.h | 2 |
3 files changed, 14 insertions, 0 deletions
diff --git a/Documentation/devicetree/bindings/mfd/twl6040.txt b/Documentation/devicetree/bindings/mfd/twl6040.txt index 0f5dd709d752..a41157b5d930 100644 --- a/Documentation/devicetree/bindings/mfd/twl6040.txt +++ b/Documentation/devicetree/bindings/mfd/twl6040.txt | |||
@@ -19,6 +19,8 @@ Required properties: | |||
19 | 19 | ||
20 | Optional properties, nodes: | 20 | Optional properties, nodes: |
21 | - enable-active-high: To power on the twl6040 during boot. | 21 | - enable-active-high: To power on the twl6040 during boot. |
22 | - clocks: phandle to the clk32k clock provider | ||
23 | - clock-names: Must be "clk32k" | ||
22 | 24 | ||
23 | Vibra functionality | 25 | Vibra functionality |
24 | Required properties: | 26 | Required properties: |
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) | |||
291 | if (twl6040->power_count++) | 291 | if (twl6040->power_count++) |
292 | goto out; | 292 | goto out; |
293 | 293 | ||
294 | clk_prepare_enable(twl6040->clk32k); | ||
295 | |||
294 | /* Allow writes to the chip */ | 296 | /* Allow writes to the chip */ |
295 | regcache_cache_only(twl6040->regmap, false); | 297 | regcache_cache_only(twl6040->regmap, false); |
296 | 298 | ||
@@ -346,6 +348,8 @@ int twl6040_power(struct twl6040 *twl6040, int on) | |||
346 | 348 | ||
347 | twl6040->sysclk = 0; | 349 | twl6040->sysclk = 0; |
348 | twl6040->mclk = 0; | 350 | twl6040->mclk = 0; |
351 | |||
352 | clk_disable_unprepare(twl6040->clk32k); | ||
349 | } | 353 | } |
350 | 354 | ||
351 | out: | 355 | out: |
@@ -644,6 +648,12 @@ static int twl6040_probe(struct i2c_client *client, | |||
644 | 648 | ||
645 | i2c_set_clientdata(client, twl6040); | 649 | i2c_set_clientdata(client, twl6040); |
646 | 650 | ||
651 | twl6040->clk32k = devm_clk_get(&client->dev, "clk32k"); | ||
652 | if (IS_ERR(twl6040->clk32k)) { | ||
653 | dev_info(&client->dev, "clk32k is not handled\n"); | ||
654 | twl6040->clk32k = NULL; | ||
655 | } | ||
656 | |||
647 | twl6040->supplies[0].supply = "vio"; | 657 | twl6040->supplies[0].supply = "vio"; |
648 | twl6040->supplies[1].supply = "v2v1"; | 658 | twl6040->supplies[1].supply = "v2v1"; |
649 | ret = devm_regulator_bulk_get(&client->dev, TWL6040_NUM_SUPPLIES, | 659 | ret = devm_regulator_bulk_get(&client->dev, TWL6040_NUM_SUPPLIES, |
diff --git a/include/linux/mfd/twl6040.h b/include/linux/mfd/twl6040.h index a69d16b30c18..8f9fc3d26e6d 100644 --- a/include/linux/mfd/twl6040.h +++ b/include/linux/mfd/twl6040.h | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/interrupt.h> | 28 | #include <linux/interrupt.h> |
29 | #include <linux/mfd/core.h> | 29 | #include <linux/mfd/core.h> |
30 | #include <linux/regulator/consumer.h> | 30 | #include <linux/regulator/consumer.h> |
31 | #include <linux/clk.h> | ||
31 | 32 | ||
32 | #define TWL6040_REG_ASICID 0x01 | 33 | #define TWL6040_REG_ASICID 0x01 |
33 | #define TWL6040_REG_ASICREV 0x02 | 34 | #define TWL6040_REG_ASICREV 0x02 |
@@ -223,6 +224,7 @@ struct twl6040 { | |||
223 | struct regmap *regmap; | 224 | struct regmap *regmap; |
224 | struct regmap_irq_chip_data *irq_data; | 225 | struct regmap_irq_chip_data *irq_data; |
225 | struct regulator_bulk_data supplies[2]; /* supplies for vio, v2v1 */ | 226 | struct regulator_bulk_data supplies[2]; /* supplies for vio, v2v1 */ |
227 | struct clk *clk32k; | ||
226 | struct mutex mutex; | 228 | struct mutex mutex; |
227 | struct mutex irq_mutex; | 229 | struct mutex irq_mutex; |
228 | struct mfd_cell cells[TWL6040_CELLS]; | 230 | struct mfd_cell cells[TWL6040_CELLS]; |