2 * Copyright (c) 2012 Damjan Marion <dmarion@FreeBSD.org>
3 * Copyright (c) 2015 Maksym Sobolyev <sobomax@FreeBSD.org>
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 #ifndef __TPS65217X_H__
31 #define __TPS65217X_H__
34 * TPS65217 PMIC is a companion chip for AM335x SoC sitting on I2C bus
37 /* TPS65217 Registers */
38 #define TPS65217_CHIPID_REG 0x00
39 struct tps65217_chipid_reg {
46 } __attribute__((__packed__));
48 #define TPS65217_INT_REG 0x02
49 struct tps65217_int_reg {
53 unsigned int reserved3:1;
57 unsigned int reserved7:1;
58 } __attribute__((__packed__));
60 #define TPS65217_STATUS_REG 0x0A
61 struct tps65217_status_reg {
63 unsigned int reserved1:1;
64 unsigned int usbpwr:1;
66 unsigned int reserved4:3;
68 } __attribute__((__packed__));
70 #define TPS65217_CHGCONFIG0_REG 0x03
71 struct tps65217_chgconfig0_reg {
72 unsigned int battemp:1;
73 unsigned int pchgtout:1;
74 unsigned int chgtout:1;
75 unsigned int active:1;
80 } __attribute__((__packed__));
82 #define TPS65217_CHGCONFIG1_REG 0x04
83 struct tps65217_chgconfig1_reg {
84 unsigned int chg_en:1;
88 unsigned int ntc_type:1;
89 unsigned int tmr_en:1;
91 } __attribute__((__packed__));
93 #define TPS65217_CHGCONFIG2_REG 0x05
94 struct tps65217_chgconfig2_reg {
95 unsigned int reserved:4;
97 #define TPS65217_VO_410V 0b00
98 #define TPS65217_VO_415V 0b01
99 #define TPS65217_VO_420V 0b10
100 #define TPS65217_VO_425V 0b11
101 unsigned int vprechg:1;
102 unsigned int dyntmr:1;
103 } __attribute__((__packed__));
105 #define TPS65217_CHGCONFIG3_REG 0x06
106 struct tps65217_chgconfig3_reg {
107 unsigned int trange:1;
108 unsigned int termif:2;
109 unsigned int pchrgt:1;
110 unsigned int dppmth:2;
111 unsigned int ichrg:2;
112 } __attribute__((__packed__));
114 #endif /* __TPS65217X_H__ */