Greg Guyotte | 8b65b12 | 2013-08-30 16:28:42 -0400 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2011-2013 |
| 3 | * Texas Instruments, <www.ti.com> |
| 4 | * |
| 5 | * SPDX-License-Identifier: GPL-2.0+ |
| 6 | * |
| 7 | * For more details, please see the TRM at http://www.ti.com/product/tps65217a |
| 8 | */ |
| 9 | |
| 10 | #ifndef __POWER_TPS65217_H__ |
| 11 | #define __POWER_TPS65217_H__ |
| 12 | |
| 13 | /* I2C chip address */ |
| 14 | #define TPS65217_CHIP_PM 0x24 |
| 15 | |
| 16 | /* Registers */ |
| 17 | enum { |
| 18 | TPS65217_CHIPID = 0x00, |
| 19 | TPS65217_POWER_PATH, |
| 20 | TPS65217_INTERRUPT, |
| 21 | TPS65217_CHGCONFIG0, |
| 22 | TPS65217_CHGCONFIG1, |
| 23 | TPS65217_CHGCONFIG2, |
| 24 | TPS65217_CHGCONFIG3, |
| 25 | TPS65217_WLEDCTRL1, |
| 26 | TPS65217_WLEDCTRL2, |
| 27 | TPS65217_MUXCTRL, |
| 28 | TPS65217_STATUS, |
| 29 | TPS65217_PASSWORD, |
| 30 | TPS65217_PGOOD, |
| 31 | TPS65217_DEFPG, |
| 32 | TPS65217_DEFDCDC1, |
| 33 | TPS65217_DEFDCDC2, |
| 34 | TPS65217_DEFDCDC3, |
| 35 | TPS65217_DEFSLEW, |
| 36 | TPS65217_DEFLDO1, |
| 37 | TPS65217_DEFLDO2, |
| 38 | TPS65217_DEFLS1, |
| 39 | TPS65217_DEFLS2, |
| 40 | TPS65217_ENABLE, |
Brock Zheng Techyauld Ltd | abf54bf | 2017-06-06 09:06:21 +0800 | [diff] [blame] | 41 | TPS65217_RESERVED0, /* no 0x17 register available */ |
Greg Guyotte | 8b65b12 | 2013-08-30 16:28:42 -0400 | [diff] [blame] | 42 | TPS65217_DEFUVLO, |
| 43 | TPS65217_SEQ1, |
| 44 | TPS65217_SEQ2, |
| 45 | TPS65217_SEQ3, |
| 46 | TPS65217_SEQ4, |
| 47 | TPS65217_SEQ5, |
| 48 | TPS65217_SEQ6, |
| 49 | TPS65217_PMIC_NUM_OF_REGS, |
| 50 | }; |
| 51 | |
| 52 | #define TPS65217_PROT_LEVEL_NONE 0x00 |
| 53 | #define TPS65217_PROT_LEVEL_1 0x01 |
| 54 | #define TPS65217_PROT_LEVEL_2 0x02 |
| 55 | |
| 56 | #define TPS65217_PASSWORD_LOCK_FOR_WRITE 0x00 |
| 57 | #define TPS65217_PASSWORD_UNLOCK 0x7D |
| 58 | |
| 59 | #define TPS65217_DCDC_GO 0x80 |
| 60 | |
| 61 | #define TPS65217_MASK_ALL_BITS 0xFF |
| 62 | |
| 63 | #define TPS65217_USB_INPUT_CUR_LIMIT_MASK 0x03 |
| 64 | #define TPS65217_USB_INPUT_CUR_LIMIT_100MA 0x00 |
| 65 | #define TPS65217_USB_INPUT_CUR_LIMIT_500MA 0x01 |
| 66 | #define TPS65217_USB_INPUT_CUR_LIMIT_1300MA 0x02 |
| 67 | #define TPS65217_USB_INPUT_CUR_LIMIT_1800MA 0x03 |
| 68 | |
Heiko Schocher | 640ff60 | 2016-06-07 08:31:16 +0200 | [diff] [blame] | 69 | #define TPS65217_DCDC_VOLT_SEL_950MV 0x02 |
| 70 | #define TPS65217_DCDC_VOLT_SEL_1100MV 0x08 |
Steve Kipisz | 52f7d84 | 2013-08-14 10:51:31 -0400 | [diff] [blame] | 71 | #define TPS65217_DCDC_VOLT_SEL_1125MV 0x09 |
Heiko Schocher | 640ff60 | 2016-06-07 08:31:16 +0200 | [diff] [blame] | 72 | #define TPS65217_DCDC_VOLT_SEL_1200MV 0x0c |
Greg Guyotte | 8b65b12 | 2013-08-30 16:28:42 -0400 | [diff] [blame] | 73 | #define TPS65217_DCDC_VOLT_SEL_1275MV 0x0F |
| 74 | #define TPS65217_DCDC_VOLT_SEL_1325MV 0x11 |
| 75 | |
| 76 | #define TPS65217_LDO_MASK 0x1F |
| 77 | #define TPS65217_LDO_VOLTAGE_OUT_1_8 0x06 |
| 78 | #define TPS65217_LDO_VOLTAGE_OUT_3_3 0x1F |
| 79 | |
Hannes Petermaier | fbd5aed | 2015-02-03 13:22:26 +0100 | [diff] [blame] | 80 | #define TPS65217_PWR_OFF 0x80 |
Greg Guyotte | 8b65b12 | 2013-08-30 16:28:42 -0400 | [diff] [blame] | 81 | #define TPS65217_PWR_SRC_USB_BITMASK 0x4 |
| 82 | #define TPS65217_PWR_SRC_AC_BITMASK 0x8 |
| 83 | |
| 84 | int tps65217_reg_read(uchar src_reg, uchar *src_val); |
| 85 | int tps65217_reg_write(uchar prot_level, uchar dest_reg, uchar dest_val, |
| 86 | uchar mask); |
| 87 | int tps65217_voltage_update(uchar dc_cntrl_reg, uchar volt_sel); |
| 88 | #endif /* __POWER_TPS65217_H__ */ |