soc/intel/alderlake: Add ADL-P 4+4 with 28W TDP
[coreboot.git] / src / drivers / ti / tps65090 / tps65090.h
blobf1ca727ebae52d6cbcb00b6443cd7570ff4b096a
1 /* SPDX-License-Identifier: BSD-3-Clause or GPL-2.0-only */
3 #ifndef __TPS65090_H_
4 #define __TPS65090_H_
6 /* I2C device address for TPS65090 PMU */
7 #define TPS65090_I2C_ADDR 0x48
9 /* TPS65090 FET control registers */
10 enum fet_id {
11 FET1_CTRL = 0x0f,
12 FET2_CTRL,
13 FET3_CTRL,
14 FET4_CTRL,
15 FET5_CTRL,
16 FET6_CTRL,
17 FET7_CTRL,
20 enum {
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,
28 /* FET errors */
29 enum {
30 FET_ERR_COMMS = -1, /* FET comms error */
31 FET_ERR_NOT_READY = -2, /* FET is not yet ready - retry */
34 /**
35 * Enable FET
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);
43 /**
44 * Disable FET
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);
52 /**
53 * Is FET enabled?
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);
61 /**
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);
69 /**
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);
77 /**
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_ */