1 /* SPDX-License-Identifier: BSD-3-Clause or GPL-2.0-only */
6 /* I2C device address for TPS65090 PMU */
7 #define TPS65090_I2C_ADDR 0x48
9 /* TPS65090 FET control registers */
21 /* Status register fields */
22 TPS65090_ST1_OTC
= 1 << 0,
23 TPS65090_ST1_OCC
= 1 << 1,
24 TPS65090_ST1_STATE_SHIFT
= 4,
25 TPS65090_ST1_STATE_MASK
= 0xf << TPS65090_ST1_STATE_SHIFT
,
30 FET_ERR_COMMS
= -1, /* FET comms error */
31 FET_ERR_NOT_READY
= -2, /* FET is not yet ready - retry */
37 * @param bus I2C bus number the TPS65090 is on
38 * @param fet_id FET ID, value between 1 and 7
39 * return 0 on success, non-0 on failure
41 int tps65090_fet_enable(unsigned int bus
, enum fet_id fet_id
);
46 * @param bus I2C bus number the TPS65090 is on
47 * @param fet_id FET ID, value between 1 and 7
48 * @return 0 on success, non-0 on failure
50 int tps65090_fet_disable(unsigned int bus
, enum fet_id fet_id
);
55 * @param bus I2C bus number the TPS65090 is on
56 * @param fet_id FET ID, value between 1 and 7
57 * @return 1 enabled, 0 disabled, negative value on failure
59 int tps65090_fet_is_enabled(unsigned int bus
, enum fet_id fet_id
);
62 * Enable / disable the battery charger
64 * @param bus I2C bus number the TPS65090 is on
65 * @param enable 0 to disable charging, non-zero to enable
67 int tps65090_set_charge_enable(unsigned int bus
, int enable
);
70 * Check whether we have enabled battery charging
72 * @param bus I2C bus number the TPS65090 is on
73 * @return 1 if enabled, 0 if disabled
75 int tps65090_is_charging(unsigned int bus
);
78 * Return the value of the status register
80 * @param bus I2C bus number the TPS65090 is on
81 * @return status register value, or -1 on error
83 int tps65090_get_status(unsigned int bus
);
85 #endif /* __TPS65090_H_ */