0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef _W1_DS2780_H
0013 #define _W1_DS2780_H
0014
0015
0016 #define W1_DS2780_READ_DATA 0x69
0017 #define W1_DS2780_WRITE_DATA 0x6C
0018 #define W1_DS2780_COPY_DATA 0x48
0019 #define W1_DS2780_RECALL_DATA 0xB8
0020 #define W1_DS2780_LOCK 0x6A
0021
0022
0023
0024 #define DS2780_STATUS_REG 0x01
0025 #define DS2780_RAAC_MSB_REG 0x02
0026 #define DS2780_RAAC_LSB_REG 0x03
0027 #define DS2780_RSAC_MSB_REG 0x04
0028 #define DS2780_RSAC_LSB_REG 0x05
0029 #define DS2780_RARC_REG 0x06
0030 #define DS2780_RSRC_REG 0x07
0031 #define DS2780_IAVG_MSB_REG 0x08
0032 #define DS2780_IAVG_LSB_REG 0x09
0033 #define DS2780_TEMP_MSB_REG 0x0A
0034 #define DS2780_TEMP_LSB_REG 0x0B
0035 #define DS2780_VOLT_MSB_REG 0x0C
0036 #define DS2780_VOLT_LSB_REG 0x0D
0037 #define DS2780_CURRENT_MSB_REG 0x0E
0038 #define DS2780_CURRENT_LSB_REG 0x0F
0039 #define DS2780_ACR_MSB_REG 0x10
0040 #define DS2780_ACR_LSB_REG 0x11
0041 #define DS2780_ACRL_MSB_REG 0x12
0042 #define DS2780_ACRL_LSB_REG 0x13
0043 #define DS2780_AS_REG 0x14
0044 #define DS2780_SFR_REG 0x15
0045 #define DS2780_FULL_MSB_REG 0x16
0046 #define DS2780_FULL_LSB_REG 0x17
0047 #define DS2780_AE_MSB_REG 0x18
0048 #define DS2780_AE_LSB_REG 0x19
0049 #define DS2780_SE_MSB_REG 0x1A
0050 #define DS2780_SE_LSB_REG 0x1B
0051
0052 #define DS2780_EEPROM_REG 0x1F
0053 #define DS2780_EEPROM_BLOCK0_START 0x20
0054
0055 #define DS2780_EEPROM_BLOCK0_END 0x2F
0056
0057 #define DS2780_EEPROM_BLOCK1_START 0x60
0058 #define DS2780_CONTROL_REG 0x60
0059 #define DS2780_AB_REG 0x61
0060 #define DS2780_AC_MSB_REG 0x62
0061 #define DS2780_AC_LSB_REG 0x63
0062 #define DS2780_VCHG_REG 0x64
0063 #define DS2780_IMIN_REG 0x65
0064 #define DS2780_VAE_REG 0x66
0065 #define DS2780_IAE_REG 0x67
0066 #define DS2780_AE_40_REG 0x68
0067 #define DS2780_RSNSP_REG 0x69
0068 #define DS2780_FULL_40_MSB_REG 0x6A
0069 #define DS2780_FULL_40_LSB_REG 0x6B
0070 #define DS2780_FULL_3040_SLOPE_REG 0x6C
0071 #define DS2780_FULL_2030_SLOPE_REG 0x6D
0072 #define DS2780_FULL_1020_SLOPE_REG 0x6E
0073 #define DS2780_FULL_0010_SLOPE_REG 0x6F
0074 #define DS2780_AE_3040_SLOPE_REG 0x70
0075 #define DS2780_AE_2030_SLOPE_REG 0x71
0076 #define DS2780_AE_1020_SLOPE_REG 0x72
0077 #define DS2780_AE_0010_SLOPE_REG 0x73
0078 #define DS2780_SE_3040_SLOPE_REG 0x74
0079 #define DS2780_SE_2030_SLOPE_REG 0x75
0080 #define DS2780_SE_1020_SLOPE_REG 0x76
0081 #define DS2780_SE_0010_SLOPE_REG 0x77
0082 #define DS2780_RSGAIN_MSB_REG 0x78
0083 #define DS2780_RSGAIN_LSB_REG 0x79
0084 #define DS2780_RSTC_REG 0x7A
0085 #define DS2780_FRSGAIN_MSB_REG 0x7B
0086 #define DS2780_FRSGAIN_LSB_REG 0x7C
0087 #define DS2780_EEPROM_BLOCK1_END 0x7C
0088
0089
0090
0091 #define DS2780_DATA_SIZE 0x80
0092
0093
0094 #define DS2780_STATUS_REG_CHGTF (1 << 7)
0095 #define DS2780_STATUS_REG_AEF (1 << 6)
0096 #define DS2780_STATUS_REG_SEF (1 << 5)
0097 #define DS2780_STATUS_REG_LEARNF (1 << 4)
0098
0099 #define DS2780_STATUS_REG_UVF (1 << 2)
0100 #define DS2780_STATUS_REG_PORF (1 << 1)
0101
0102
0103
0104
0105 #define DS2780_CONTROL_REG_UVEN (1 << 6)
0106 #define DS2780_CONTROL_REG_PMOD (1 << 5)
0107 #define DS2780_CONTROL_REG_RNAOP (1 << 4)
0108
0109
0110
0111
0112 #define DS2780_SFR_REG_PIOSC (1 << 0)
0113
0114
0115 #define DS2780_EEPROM_REG_EEC (1 << 7)
0116 #define DS2780_EEPROM_REG_LOCK (1 << 6)
0117
0118 #define DS2780_EEPROM_REG_BL1 (1 << 1)
0119 #define DS2780_EEPROM_REG_BL0 (1 << 0)
0120
0121 extern int w1_ds2780_io(struct device *dev, char *buf, int addr, size_t count,
0122 int io);
0123 extern int w1_ds2780_eeprom_cmd(struct device *dev, int addr, int cmd);
0124
0125 #endif