Skip to content

Commit a9bc67d

Browse files
osctobebroonie
authored andcommitted
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 <[email protected]> Signed-off-by: Mark Brown <[email protected]>
1 parent fe95390 commit a9bc67d

File tree

3 files changed

+20
-8
lines changed

3 files changed

+20
-8
lines changed

Documentation/devicetree/bindings/mfd/tps65910.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ Optional properties:
6161
There should be 9 entries here, one for each gpio.
6262
- ti,system-power-controller: Telling whether or not this pmic is controlling
6363
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.
6468

6569
Regulator Optional properties:
6670
- ti,regulator-ext-sleep-control: enable external sleep

drivers/mfd/tps65910.c

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -328,11 +328,7 @@ static int tps65910_sleepinit(struct tps65910 *tps65910,
328328
goto err_sleep_init;
329329
}
330330

331-
/* Return if there is no sleep keepon data. */
332-
if (!pmic_pdata->slp_keepon)
333-
return 0;
334-
335-
if (pmic_pdata->slp_keepon->therm_keepon) {
331+
if (pmic_pdata->slp_keepon.therm_keepon) {
336332
ret = tps65910_reg_set_bits(tps65910,
337333
TPS65910_SLEEP_KEEP_RES_ON,
338334
SLEEP_KEEP_RES_ON_THERM_KEEPON_MASK);
@@ -342,7 +338,7 @@ static int tps65910_sleepinit(struct tps65910 *tps65910,
342338
}
343339
}
344340

345-
if (pmic_pdata->slp_keepon->clkout32k_keepon) {
341+
if (pmic_pdata->slp_keepon.clkout32k_keepon) {
346342
ret = tps65910_reg_set_bits(tps65910,
347343
TPS65910_SLEEP_KEEP_RES_ON,
348344
SLEEP_KEEP_RES_ON_CLKOUT32K_KEEPON_MASK);
@@ -352,7 +348,7 @@ static int tps65910_sleepinit(struct tps65910 *tps65910,
352348
}
353349
}
354350

355-
if (pmic_pdata->slp_keepon->i2chs_keepon) {
351+
if (pmic_pdata->slp_keepon.i2chs_keepon) {
356352
ret = tps65910_reg_set_bits(tps65910,
357353
TPS65910_SLEEP_KEEP_RES_ON,
358354
SLEEP_KEEP_RES_ON_I2CHS_KEEPON_MASK);
@@ -415,6 +411,18 @@ static struct tps65910_board *tps65910_parse_dt(struct i2c_client *client,
415411
prop = of_property_read_bool(np, "ti,en-ck32k-xtal");
416412
board_info->en_ck32k_xtal = prop;
417413

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+
418426
board_info->irq = client->irq;
419427
board_info->irq_base = -1;
420428
board_info->pm_off = of_property_read_bool(np,

include/linux/mfd/tps65910.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,7 @@ struct tps65910_board {
879879
bool en_ck32k_xtal;
880880
bool en_dev_slp;
881881
bool pm_off;
882-
struct tps65910_sleep_keepon_data *slp_keepon;
882+
struct tps65910_sleep_keepon_data slp_keepon;
883883
bool en_gpio_sleep[TPS6591X_MAX_NUM_GPIO];
884884
unsigned long regulator_ext_sleep_control[TPS65910_NUM_REGS];
885885
struct regulator_init_data *tps65910_pmic_init_data[TPS65910_NUM_REGS];

0 commit comments

Comments
 (0)