aboutsummaryrefslogtreecommitdiff
path: root/include/power/tps65217.h
blob: 69a49f76fefb372b7e6b15c2eed33d4875118292 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/*
 * (C) Copyright 2011-2013
 * Texas Instruments, <www.ti.com>
 *
 * SPDX-License-Identifier:	GPL-2.0+
 *
 * For more details, please see the TRM at http://www.ti.com/product/tps65217a
 */

#ifndef __POWER_TPS65217_H__
#define __POWER_TPS65217_H__

/* I2C chip address */
#define TPS65217_CHIP_PM			0x24

/* Registers */
enum {
	TPS65217_CHIPID				= 0x00,
	TPS65217_POWER_PATH,
	TPS65217_INTERRUPT,
	TPS65217_CHGCONFIG0,
	TPS65217_CHGCONFIG1,
	TPS65217_CHGCONFIG2,
	TPS65217_CHGCONFIG3,
	TPS65217_WLEDCTRL1,
	TPS65217_WLEDCTRL2,
	TPS65217_MUXCTRL,
	TPS65217_STATUS,
	TPS65217_PASSWORD,
	TPS65217_PGOOD,
	TPS65217_DEFPG,
	TPS65217_DEFDCDC1,
	TPS65217_DEFDCDC2,
	TPS65217_DEFDCDC3,
	TPS65217_DEFSLEW,
	TPS65217_DEFLDO1,
	TPS65217_DEFLDO2,
	TPS65217_DEFLS1,
	TPS65217_DEFLS2,
	TPS65217_ENABLE,
	TPS65217_DEFUVLO,
	TPS65217_SEQ1,
	TPS65217_SEQ2,
	TPS65217_SEQ3,
	TPS65217_SEQ4,
	TPS65217_SEQ5,
	TPS65217_SEQ6,
	TPS65217_PMIC_NUM_OF_REGS,
};

#define TPS65217_PROT_LEVEL_NONE		0x00
#define TPS65217_PROT_LEVEL_1			0x01
#define TPS65217_PROT_LEVEL_2			0x02

#define TPS65217_PASSWORD_LOCK_FOR_WRITE	0x00
#define TPS65217_PASSWORD_UNLOCK		0x7D

#define TPS65217_DCDC_GO			0x80

#define TPS65217_MASK_ALL_BITS			0xFF

#define TPS65217_USB_INPUT_CUR_LIMIT_MASK	0x03
#define TPS65217_USB_INPUT_CUR_LIMIT_100MA	0x00
#define TPS65217_USB_INPUT_CUR_LIMIT_500MA	0x01
#define TPS65217_USB_INPUT_CUR_LIMIT_1300MA	0x02
#define TPS65217_USB_INPUT_CUR_LIMIT_1800MA	0x03

#define TPS65217_DCDC_VOLT_SEL_950MV		0x02
#define TPS65217_DCDC_VOLT_SEL_1100MV		0x08
#define TPS65217_DCDC_VOLT_SEL_1125MV		0x09
#define TPS65217_DCDC_VOLT_SEL_1200MV		0x0c
#define TPS65217_DCDC_VOLT_SEL_1275MV		0x0F
#define TPS65217_DCDC_VOLT_SEL_1325MV		0x11

#define TPS65217_LDO_MASK			0x1F
#define TPS65217_LDO_VOLTAGE_OUT_1_8		0x06
#define TPS65217_LDO_VOLTAGE_OUT_3_3		0x1F

#define TPS65217_PWR_OFF			0x80
#define TPS65217_PWR_SRC_USB_BITMASK		0x4
#define TPS65217_PWR_SRC_AC_BITMASK		0x8

int tps65217_reg_read(uchar src_reg, uchar *src_val);
int tps65217_reg_write(uchar prot_level, uchar dest_reg, uchar dest_val,
		       uchar mask);
int tps65217_voltage_update(uchar dc_cntrl_reg, uchar volt_sel);
#endif	/* __POWER_TPS65217_H__ */