blob: 7862b31bfb9701a80147d84a829c3d74c1bda90c [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Greg Guyotte8b65b122013-08-30 16:28:42 -04002/*
3 * (C) Copyright 2011-2013
4 * Texas Instruments, <www.ti.com>
5 *
Nishanth Menona94a4072023-11-01 15:56:03 -05006 * For more details, please see the TRM at https://www.ti.com/product/tps65217a
Greg Guyotte8b65b122013-08-30 16:28:42 -04007 */
8
9#ifndef __POWER_TPS65217_H__
10#define __POWER_TPS65217_H__
11
12/* I2C chip address */
13#define TPS65217_CHIP_PM 0x24
14
15/* Registers */
16enum {
17 TPS65217_CHIPID = 0x00,
18 TPS65217_POWER_PATH,
19 TPS65217_INTERRUPT,
20 TPS65217_CHGCONFIG0,
21 TPS65217_CHGCONFIG1,
22 TPS65217_CHGCONFIG2,
23 TPS65217_CHGCONFIG3,
24 TPS65217_WLEDCTRL1,
25 TPS65217_WLEDCTRL2,
26 TPS65217_MUXCTRL,
27 TPS65217_STATUS,
28 TPS65217_PASSWORD,
29 TPS65217_PGOOD,
30 TPS65217_DEFPG,
31 TPS65217_DEFDCDC1,
32 TPS65217_DEFDCDC2,
33 TPS65217_DEFDCDC3,
34 TPS65217_DEFSLEW,
35 TPS65217_DEFLDO1,
36 TPS65217_DEFLDO2,
37 TPS65217_DEFLS1,
38 TPS65217_DEFLS2,
39 TPS65217_ENABLE,
Brock Zheng Techyauld Ltdabf54bf2017-06-06 09:06:21 +080040 TPS65217_RESERVED0, /* no 0x17 register available */
Greg Guyotte8b65b122013-08-30 16:28:42 -040041 TPS65217_DEFUVLO,
42 TPS65217_SEQ1,
43 TPS65217_SEQ2,
44 TPS65217_SEQ3,
45 TPS65217_SEQ4,
46 TPS65217_SEQ5,
47 TPS65217_SEQ6,
48 TPS65217_PMIC_NUM_OF_REGS,
49};
50
51#define TPS65217_PROT_LEVEL_NONE 0x00
52#define TPS65217_PROT_LEVEL_1 0x01
53#define TPS65217_PROT_LEVEL_2 0x02
54
55#define TPS65217_PASSWORD_LOCK_FOR_WRITE 0x00
56#define TPS65217_PASSWORD_UNLOCK 0x7D
57
58#define TPS65217_DCDC_GO 0x80
59
60#define TPS65217_MASK_ALL_BITS 0xFF
61
62#define TPS65217_USB_INPUT_CUR_LIMIT_MASK 0x03
63#define TPS65217_USB_INPUT_CUR_LIMIT_100MA 0x00
64#define TPS65217_USB_INPUT_CUR_LIMIT_500MA 0x01
65#define TPS65217_USB_INPUT_CUR_LIMIT_1300MA 0x02
66#define TPS65217_USB_INPUT_CUR_LIMIT_1800MA 0x03
67
Heiko Schocher640ff602016-06-07 08:31:16 +020068#define TPS65217_DCDC_VOLT_SEL_950MV 0x02
69#define TPS65217_DCDC_VOLT_SEL_1100MV 0x08
Steve Kipisz52f7d842013-08-14 10:51:31 -040070#define TPS65217_DCDC_VOLT_SEL_1125MV 0x09
Heiko Schocher640ff602016-06-07 08:31:16 +020071#define TPS65217_DCDC_VOLT_SEL_1200MV 0x0c
Greg Guyotte8b65b122013-08-30 16:28:42 -040072#define TPS65217_DCDC_VOLT_SEL_1275MV 0x0F
73#define TPS65217_DCDC_VOLT_SEL_1325MV 0x11
74
75#define TPS65217_LDO_MASK 0x1F
76#define TPS65217_LDO_VOLTAGE_OUT_1_8 0x06
77#define TPS65217_LDO_VOLTAGE_OUT_3_3 0x1F
78
Hannes Petermaierfbd5aed2015-02-03 13:22:26 +010079#define TPS65217_PWR_OFF 0x80
Greg Guyotte8b65b122013-08-30 16:28:42 -040080#define TPS65217_PWR_SRC_USB_BITMASK 0x4
81#define TPS65217_PWR_SRC_AC_BITMASK 0x8
82
Jean-Jacques Hiblotfb1b7712018-12-07 14:50:46 +010083int power_tps65217_init(unsigned char bus);
84
Greg Guyotte8b65b122013-08-30 16:28:42 -040085int tps65217_reg_read(uchar src_reg, uchar *src_val);
86int tps65217_reg_write(uchar prot_level, uchar dest_reg, uchar dest_val,
87 uchar mask);
88int tps65217_voltage_update(uchar dc_cntrl_reg, uchar volt_sel);
89#endif /* __POWER_TPS65217_H__ */