diff options
author | Michał Mirosław <mirq-linux@rere.qmqm.pl> | 2017-06-14 15:04:14 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2017-06-15 13:23:27 -0400 |
commit | a9bc67de0c5713a8675bfe33bfe9cb36c7934589 (patch) | |
tree | 922947f6857be1a917f556fd06e77e46d1b20ced | |
parent | fe953904f3463609a9a671f68148d8532f2a5d9f (diff) |
regulator: tps65910: wire up sleep control configuration
This enables configuring the PMIC's sleep mode via device-tree.
A pointer indirection to sleep mode data is removed, as it simplifies
the implementation slightly. In current kernel tree, platform data
structure is not used outside MFD cell drivers.
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | Documentation/devicetree/bindings/mfd/tps65910.txt | 4 | ||||
-rw-r--r-- | drivers/mfd/tps65910.c | 22 | ||||
-rw-r--r-- | include/linux/mfd/tps65910.h | 2 |
3 files changed, 20 insertions, 8 deletions
diff --git a/Documentation/devicetree/bindings/mfd/tps65910.txt b/Documentation/devicetree/bindings/mfd/tps65910.txt index 38833e63a59f..8af1202b381d 100644 --- a/Documentation/devicetree/bindings/mfd/tps65910.txt +++ b/Documentation/devicetree/bindings/mfd/tps65910.txt | |||
@@ -61,6 +61,10 @@ Optional properties: | |||
61 | There should be 9 entries here, one for each gpio. | 61 | There should be 9 entries here, one for each gpio. |
62 | - ti,system-power-controller: Telling whether or not this pmic is controlling | 62 | - ti,system-power-controller: Telling whether or not this pmic is controlling |
63 | the system power. | 63 | the system power. |
64 | - ti,sleep-enable: Enable SLEEP state. | ||
65 | - ti,sleep-keep-therm: Keep thermal monitoring on in sleep state. | ||
66 | - ti,sleep-keep-ck32k: Keep the 32KHz clock output on in sleep state. | ||
67 | - ti,sleep-keep-hsclk: Keep high speed internal clock on in sleep state. | ||
64 | 68 | ||
65 | Regulator Optional properties: | 69 | Regulator Optional properties: |
66 | - ti,regulator-ext-sleep-control: enable external sleep | 70 | - ti,regulator-ext-sleep-control: enable external sleep |
diff --git a/drivers/mfd/tps65910.c b/drivers/mfd/tps65910.c index 11cab1582f2f..8263605f6d2f 100644 --- a/drivers/mfd/tps65910.c +++ b/drivers/mfd/tps65910.c | |||
@@ -328,11 +328,7 @@ static int tps65910_sleepinit(struct tps65910 *tps65910, | |||
328 | goto err_sleep_init; | 328 | goto err_sleep_init; |
329 | } | 329 | } |
330 | 330 | ||
331 | /* Return if there is no sleep keepon data. */ | 331 | if (pmic_pdata->slp_keepon.therm_keepon) { |
332 | if (!pmic_pdata->slp_keepon) | ||
333 | return 0; | ||
334 | |||
335 | if (pmic_pdata->slp_keepon->therm_keepon) { | ||
336 | ret = tps65910_reg_set_bits(tps65910, | 332 | ret = tps65910_reg_set_bits(tps65910, |
337 | TPS65910_SLEEP_KEEP_RES_ON, | 333 | TPS65910_SLEEP_KEEP_RES_ON, |
338 | SLEEP_KEEP_RES_ON_THERM_KEEPON_MASK); | 334 | SLEEP_KEEP_RES_ON_THERM_KEEPON_MASK); |
@@ -342,7 +338,7 @@ static int tps65910_sleepinit(struct tps65910 *tps65910, | |||
342 | } | 338 | } |
343 | } | 339 | } |
344 | 340 | ||
345 | if (pmic_pdata->slp_keepon->clkout32k_keepon) { | 341 | if (pmic_pdata->slp_keepon.clkout32k_keepon) { |
346 | ret = tps65910_reg_set_bits(tps65910, | 342 | ret = tps65910_reg_set_bits(tps65910, |
347 | TPS65910_SLEEP_KEEP_RES_ON, | 343 | TPS65910_SLEEP_KEEP_RES_ON, |
348 | SLEEP_KEEP_RES_ON_CLKOUT32K_KEEPON_MASK); | 344 | SLEEP_KEEP_RES_ON_CLKOUT32K_KEEPON_MASK); |
@@ -352,7 +348,7 @@ static int tps65910_sleepinit(struct tps65910 *tps65910, | |||
352 | } | 348 | } |
353 | } | 349 | } |
354 | 350 | ||
355 | if (pmic_pdata->slp_keepon->i2chs_keepon) { | 351 | if (pmic_pdata->slp_keepon.i2chs_keepon) { |
356 | ret = tps65910_reg_set_bits(tps65910, | 352 | ret = tps65910_reg_set_bits(tps65910, |
357 | TPS65910_SLEEP_KEEP_RES_ON, | 353 | TPS65910_SLEEP_KEEP_RES_ON, |
358 | SLEEP_KEEP_RES_ON_I2CHS_KEEPON_MASK); | 354 | SLEEP_KEEP_RES_ON_I2CHS_KEEPON_MASK); |
@@ -415,6 +411,18 @@ static struct tps65910_board *tps65910_parse_dt(struct i2c_client *client, | |||
415 | prop = of_property_read_bool(np, "ti,en-ck32k-xtal"); | 411 | prop = of_property_read_bool(np, "ti,en-ck32k-xtal"); |
416 | board_info->en_ck32k_xtal = prop; | 412 | board_info->en_ck32k_xtal = prop; |
417 | 413 | ||
414 | prop = of_property_read_bool(np, "ti,sleep-enable"); | ||
415 | board_info->en_dev_slp = prop; | ||
416 | |||
417 | prop = of_property_read_bool(np, "ti,sleep-keep-therm"); | ||
418 | board_info->slp_keepon.therm_keepon = prop; | ||
419 | |||
420 | prop = of_property_read_bool(np, "ti,sleep-keep-ck32k"); | ||
421 | board_info->slp_keepon.clkout32k_keepon = prop; | ||
422 | |||
423 | prop = of_property_read_bool(np, "ti,sleep-keep-hsclk"); | ||
424 | board_info->slp_keepon.i2chs_keepon = prop; | ||
425 | |||
418 | board_info->irq = client->irq; | 426 | board_info->irq = client->irq; |
419 | board_info->irq_base = -1; | 427 | board_info->irq_base = -1; |
420 | board_info->pm_off = of_property_read_bool(np, | 428 | board_info->pm_off = of_property_read_bool(np, |
diff --git a/include/linux/mfd/tps65910.h b/include/linux/mfd/tps65910.h index ffb21e79204d..deffdcd0236f 100644 --- a/include/linux/mfd/tps65910.h +++ b/include/linux/mfd/tps65910.h | |||
@@ -879,7 +879,7 @@ struct tps65910_board { | |||
879 | bool en_ck32k_xtal; | 879 | bool en_ck32k_xtal; |
880 | bool en_dev_slp; | 880 | bool en_dev_slp; |
881 | bool pm_off; | 881 | bool pm_off; |
882 | struct tps65910_sleep_keepon_data *slp_keepon; | 882 | struct tps65910_sleep_keepon_data slp_keepon; |
883 | bool en_gpio_sleep[TPS6591X_MAX_NUM_GPIO]; | 883 | bool en_gpio_sleep[TPS6591X_MAX_NUM_GPIO]; |
884 | unsigned long regulator_ext_sleep_control[TPS65910_NUM_REGS]; | 884 | unsigned long regulator_ext_sleep_control[TPS65910_NUM_REGS]; |
885 | struct regulator_init_data *tps65910_pmic_init_data[TPS65910_NUM_REGS]; | 885 | struct regulator_init_data *tps65910_pmic_init_data[TPS65910_NUM_REGS]; |