2 * Copyright (C) 2010 Motorola, Inc.
4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and
6 * may be copied, distributed, and modified under those terms.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * Based on w1_ds2784.h which is:
14 * Copyright (C) 2009 HTC Corporation
17 #ifndef __W1_DS2781_H__
18 #define __W1_DS2781_H__
22 /* Known commands to the DS2781 chip */
23 #define W1_DS2781_READ_DATA 0x69
24 #define W1_DS2781_WRITE_DATA 0x6C
25 #define W1_DS2781_COPY_DATA 0x48
26 #define W1_DS2781_RECALL_DATA 0xB8
27 #define W1_DS2781_LOCK 0x6A
29 /* Number of valid register addresses */
30 #define DS2781_DATA_SIZE 0x80
32 /* DS2781 1-wire slave memory map definitions */
34 #define DS2781_REG_STATUS 0x01
35 #define DS2781_REG_RAAC_MSB 0x02
36 #define DS2781_REG_RAAC_LSB 0x03
37 #define DS2781_REG_RSAC_MSB 0x04
38 #define DS2781_REG_RSAC_LSB 0x05
39 #define DS2781_REG_RARC 0x06
40 #define DS2781_REG_RSRC 0x07
41 #define DS2781_REG_AVG_CURR_MSB 0x08
42 #define DS2781_REG_AVG_CURR_LSB 0x09
43 #define DS2781_REG_TEMP_MSB 0x0A
44 #define DS2781_REG_TEMP_LSB 0x0B
45 #define DS2781_REG_VOLT_MSB 0x0C
46 #define DS2781_REG_VOLT_LSB 0x0D
47 #define DS2781_REG_CURR_MSB 0x0E
48 #define DS2781_REG_CURR_LSB 0x0F
49 #define DS2781_REG_ACCUMULATE_CURR_MSB 0x10
50 #define DS2781_REG_ACCUMULATE_CURR_LSB 0x11
51 #define DS2781_REG_ACCUMULATE_CURR_LSB1 0x12
52 #define DS2781_REG_ACCUMULATE_CURR_LSB2 0x13
53 #define DS2781_REG_AGE_SCALAR 0x14
54 #define DS2781_REG_SPECIAL_FEATURE 0x15
55 #define DS2781_REG_FULL_MSB 0x16
56 #define DS2781_REG_FULL_LSB 0x17
57 #define DS2781_REG_ACTIVE_EMPTY_MSB 0x18
58 #define DS2781_REG_ACTIVE_EMPTY_LSB 0x19
59 #define DS2781_REG_STBY_EMPTY_MSB 0x1A
60 #define DS2781_REG_STBY_EMPTY_LSB 0x1B
61 /* Reserved: 0x1C - 0x1E */
62 #define DS2781_REG_EEPROM 0x1F
63 #define DS2781_REG_USER_EEPROM 0x20
64 /* Reserved: 0x30 - 0x5F */
65 #define DS2781_REG_CTRL 0x60
66 #define DS2781_REG_ACCUMULATION_BIAS 0x61
67 #define DS2781_REG_AGE_CAPACITY_MSB 0x62
68 #define DS2781_REG_AGE_CAPACITY_LSB 0x63
69 #define DS2781_REG_CHARGE_VOLT 0x64
70 #define DS2781_REG_MIN_CHARGE_CURR 0x65
71 #define DS2781_REG_ACTIVE_EMPTY_VOLT 0x66
72 #define DS2781_REG_ACTIVE_EMPTY_CURR 0x67
73 #define DS2781_REG_ACTIVE_EMPTY_40 0x68
74 #define DS2781_REG_RSNSP 0x69
75 #define DS2781_REG_FULL_40_MSB 0x6A
76 #define DS2781_REG_FULL_40_LSB 0x6B
77 #define DS2781_REG_FULL_SEG_4_SLOPE 0x6C
78 #define DS2781_REG_FULL_SEG_3_SLOPE 0x6D
79 #define DS2781_REG_FULL_SEG_2_SLOPE 0x6E
80 #define DS2781_REG_FULL_SEG_1_SLOPE 0x6F
81 #define DS2781_REG_AE_SEG_4_SLOPE 0x70
82 #define DS2781_REG_AE_SEG_3_SLOPE 0x71
83 #define DS2781_REG_AE_SEG_2_SLOPE 0x72
84 #define DS2781_REG_AE_SEG_1_SLOPE 0x73
85 #define DS2781_REG_SE_SEG_4_SLOPE 0x74
86 #define DS2781_REG_SE_SEG_3_SLOPE 0x75
87 #define DS2781_REG_SE_SEG_2_SLOPE 0x76
88 #define DS2781_REG_SE_SEG_1_SLOPE 0x77
89 #define DS2781_REG_RSGAIN_MSB 0x78
90 #define DS2781_REG_RSGAIN_LSB 0x79
91 #define DS2781_REG_RSTC 0x7A
92 #define DS2781_REG_CURR_OFFSET_BIAS 0x7B
93 #define DS2781_REG_TBP34 0x7C
94 #define DS2781_REG_TBP23 0x7D
95 #define DS2781_REG_TBP12 0x7E
98 extern int w1_ds2781_read(struct device *dev, char *buf, int addr,
100 extern int w1_ds2781_write(struct device *dev, char *buf, int addr,
103 #endif /* __KERNEL__ */
105 #endif /* __W1_DS2781_H__ */