Skip to content

Commit 9cba6a7

Browse files
mwallelag-linaro
authored andcommitted
misc: tps6594-pfsm: Add TI TPS652G1 PMIC PFSM
The TPS652G1 is a stripped down TPS65224, but the PFSM is the same. Thus, handle it the same way as the TPS65224 in the driver. Signed-off-by: Michael Walle <[email protected]> Acked-by: Arnd Bergmann <[email protected]> # drivers/misc/ Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Lee Jones <[email protected]>
1 parent 626bb0a commit 9cba6a7

File tree

1 file changed

+21
-10
lines changed

1 file changed

+21
-10
lines changed

drivers/misc/tps6594-pfsm.c

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
// SPDX-License-Identifier: GPL-2.0
22
/*
3-
* PFSM (Pre-configurable Finite State Machine) driver for TI TPS65224/TPS6594/TPS6593/LP8764 PMICs
3+
* PFSM (Pre-configurable Finite State Machine) driver for the following
4+
* PMICs:
5+
* - LP8764
6+
* - TPS65224
7+
* - TPS652G1
8+
* - TPS6594
9+
* - TPS6593
410
*
511
* Copyright (C) 2023 BayLibre Incorporated - https://www.baylibre.com/
612
*/
@@ -141,7 +147,7 @@ static long tps6594_pfsm_ioctl(struct file *f, unsigned int cmd, unsigned long a
141147
switch (cmd) {
142148
case PMIC_GOTO_STANDBY:
143149
/* Disable LP mode on TPS6594 Family PMIC */
144-
if (pfsm->chip_id != TPS65224) {
150+
if (pfsm->chip_id != TPS65224 && pfsm->chip_id != TPS652G1) {
145151
ret = regmap_clear_bits(pfsm->regmap, TPS6594_REG_RTC_CTRL_2,
146152
TPS6594_BIT_LP_STANDBY_SEL);
147153

@@ -154,8 +160,8 @@ static long tps6594_pfsm_ioctl(struct file *f, unsigned int cmd, unsigned long a
154160
TPS6594_BIT_TRIGGER_I2C(0), TPS6594_BIT_TRIGGER_I2C(0));
155161
break;
156162
case PMIC_GOTO_LP_STANDBY:
157-
/* TPS65224 does not support LP STANDBY */
158-
if (pfsm->chip_id == TPS65224)
163+
/* TPS65224/TPS652G1 does not support LP STANDBY */
164+
if (pfsm->chip_id == TPS65224 || pfsm->chip_id == TPS652G1)
159165
return ret;
160166

161167
/* Enable LP mode */
@@ -179,8 +185,8 @@ static long tps6594_pfsm_ioctl(struct file *f, unsigned int cmd, unsigned long a
179185
TPS6594_BIT_NSLEEP1B | TPS6594_BIT_NSLEEP2B);
180186
break;
181187
case PMIC_SET_MCU_ONLY_STATE:
182-
/* TPS65224 does not support MCU_ONLY_STATE */
183-
if (pfsm->chip_id == TPS65224)
188+
/* TPS65224/TPS652G1 does not support MCU_ONLY_STATE */
189+
if (pfsm->chip_id == TPS65224 || pfsm->chip_id == TPS652G1)
184190
return ret;
185191

186192
if (copy_from_user(&state_opt, argp, sizeof(state_opt)))
@@ -206,7 +212,7 @@ static long tps6594_pfsm_ioctl(struct file *f, unsigned int cmd, unsigned long a
206212
return -EFAULT;
207213

208214
/* Configure wake-up destination */
209-
if (pfsm->chip_id == TPS65224) {
215+
if (pfsm->chip_id == TPS65224 || pfsm->chip_id == TPS652G1) {
210216
regmap_reg = TPS65224_REG_STARTUP_CTRL;
211217
mask = TPS65224_MASK_STARTUP_DEST;
212218
} else {
@@ -230,9 +236,14 @@ static long tps6594_pfsm_ioctl(struct file *f, unsigned int cmd, unsigned long a
230236
return ret;
231237

232238
/* Modify NSLEEP1-2 bits */
233-
ret = regmap_clear_bits(pfsm->regmap, TPS6594_REG_FSM_NSLEEP_TRIGGERS,
234-
pfsm->chip_id == TPS65224 ?
235-
TPS6594_BIT_NSLEEP1B : TPS6594_BIT_NSLEEP2B);
239+
if (pfsm->chip_id == TPS65224 || pfsm->chip_id == TPS652G1)
240+
ret = regmap_clear_bits(pfsm->regmap,
241+
TPS6594_REG_FSM_NSLEEP_TRIGGERS,
242+
TPS6594_BIT_NSLEEP1B);
243+
else
244+
ret = regmap_clear_bits(pfsm->regmap,
245+
TPS6594_REG_FSM_NSLEEP_TRIGGERS,
246+
TPS6594_BIT_NSLEEP2B);
236247
break;
237248
}
238249

0 commit comments

Comments
 (0)