blob: f5218f9eb2b6cdda99721994e9f5d7b9aecc1cae [file] [log] [blame]
Tom Rini0634fc02014-06-05 11:15:29 -04001/*
2 * (C) Copyright 2014
3 * Texas Instruments, <www.ti.com>
4 *
5 * SPDX-License-Identifier: GPL-2.0+
6 */
7
8#ifndef __POWER_TPS65218_H__
9#define __POWER_TPS65218_H__
10
Nikita Kiryanova5c71ff2016-02-19 19:19:46 +020011#include <linux/bitops.h>
12
Tom Rini0634fc02014-06-05 11:15:29 -040013/* I2C chip address */
14#define TPS65218_CHIP_PM 0x24
15
16/* Registers */
17enum {
18 TPS65218_CHIPID = 0x00,
19 TPS65218_INT1,
20 TPS65218_INT2,
21 TPS65218_INT_MASK1,
22 TPS65218_INT_MASK2,
23 TPS65218_STATUS,
24 TPS65218_CONTROL,
25 TPS65218_FLAG,
26 TPS65218_PASSWORD = 0x10,
27 TPS65218_ENABLE1,
28 TPS65218_ENABLE2,
29 TPS65218_CONFIG1,
30 TPS65218_CONFIG2,
31 TPS65218_CONFIG3,
32 TPS65218_DCDC1,
33 TPS65218_DCDC2,
34 TPS65218_DCDC3,
35 TPS65218_DCDC4,
36 TPS65218_SLEW,
37 TPS65218_LDO1,
38 TPS65218_SEQ1 = 0x20,
39 TPS65218_SEQ2,
40 TPS65218_SEQ3,
41 TPS65218_SEQ4,
42 TPS65218_SEQ5,
43 TPS65218_SEQ6,
44 TPS65218_SEQ7,
45 TPS65218_PMIC_NUM_OF_REGS,
46};
47
48#define TPS65218_PROT_LEVEL_NONE 0x00
49#define TPS65218_PROT_LEVEL_1 0x01
50#define TPS65218_PROT_LEVEL_2 0x02
51
52#define TPS65218_PASSWORD_LOCK_FOR_WRITE 0x00
53#define TPS65218_PASSWORD_UNLOCK 0x7D
54
55#define TPS65218_DCDC_GO 0x80
56
57#define TPS65218_MASK_ALL_BITS 0xFF
58
Keerthy7cac6562017-05-24 10:19:27 +053059#define TPS65218_DCDC_VSEL_MASK 0x3F
60
Felipe Balbi8f2994b2014-12-22 16:26:14 -060061#define TPS65218_DCDC_VOLT_SEL_0950MV 0x0a
Tom Rini0634fc02014-06-05 11:15:29 -040062#define TPS65218_DCDC_VOLT_SEL_1100MV 0x19
Felipe Balbi8f2994b2014-12-22 16:26:14 -060063#define TPS65218_DCDC_VOLT_SEL_1200MV 0x23
64#define TPS65218_DCDC_VOLT_SEL_1260MV 0x29
Tom Rini0634fc02014-06-05 11:15:29 -040065#define TPS65218_DCDC_VOLT_SEL_1330MV 0x30
Keerthy6417a732017-06-02 15:00:31 +053066#define TPS65218_DCDC3_VOLT_SEL_1350MV 0x12
Keerthy00344c42018-05-02 15:06:31 +053067#define TPS65218_DCDC3_VOLT_SEL_1200MV 0xC
Tom Rini0634fc02014-06-05 11:15:29 -040068
Nikita Kiryanova5c71ff2016-02-19 19:19:46 +020069#define TPS65218_CC_STAT (BIT(0) | BIT(1))
70#define TPS65218_STATE (BIT(2) | BIT(3))
71#define TPS65218_PB_STATE BIT(4)
72#define TPS65218_AC_STATE BIT(5)
73#define TPS65218_EE BIT(6)
74#define TPS65218_FSEAL BIT(7)
75
76int tps65218_reg_read(uchar dest_reg, uchar *dest_val);
Tom Rini0634fc02014-06-05 11:15:29 -040077int tps65218_reg_write(uchar prot_level, uchar dest_reg, uchar dest_val,
78 uchar mask);
79int tps65218_voltage_update(uchar dc_cntrl_reg, uchar volt_sel);
Nikita Kiryanova5c71ff2016-02-19 19:19:46 +020080int tps65218_toggle_fseal(void);
81int tps65218_lock_fseal(void);
Tom Rini60d2f6f2014-06-23 16:06:29 -040082int power_tps65218_init(unsigned char bus);
Tom Rini0634fc02014-06-05 11:15:29 -040083#endif /* __POWER_TPS65218_H__ */