• Home
  • Raw
  • Download

Lines Matching refs:dpot

96 static inline int dpot_read_d8(struct dpot_data *dpot)  in dpot_read_d8()  argument
98 return dpot->bdata.bops->read_d8(dpot->bdata.client); in dpot_read_d8()
101 static inline int dpot_read_r8d8(struct dpot_data *dpot, u8 reg) in dpot_read_r8d8() argument
103 return dpot->bdata.bops->read_r8d8(dpot->bdata.client, reg); in dpot_read_r8d8()
106 static inline int dpot_read_r8d16(struct dpot_data *dpot, u8 reg) in dpot_read_r8d16() argument
108 return dpot->bdata.bops->read_r8d16(dpot->bdata.client, reg); in dpot_read_r8d16()
111 static inline int dpot_write_d8(struct dpot_data *dpot, u8 val) in dpot_write_d8() argument
113 return dpot->bdata.bops->write_d8(dpot->bdata.client, val); in dpot_write_d8()
116 static inline int dpot_write_r8d8(struct dpot_data *dpot, u8 reg, u16 val) in dpot_write_r8d8() argument
118 return dpot->bdata.bops->write_r8d8(dpot->bdata.client, reg, val); in dpot_write_r8d8()
121 static inline int dpot_write_r8d16(struct dpot_data *dpot, u8 reg, u16 val) in dpot_write_r8d16() argument
123 return dpot->bdata.bops->write_r8d16(dpot->bdata.client, reg, val); in dpot_write_r8d16()
126 static s32 dpot_read_spi(struct dpot_data *dpot, u8 reg) in dpot_read_spi() argument
133 if (dpot->feat & F_RDACS_WONLY) in dpot_read_spi()
134 return dpot->rdac_cache[reg & DPOT_RDAC_MASK]; in dpot_read_spi()
135 if (dpot->uid == DPOT_UID(AD5291_ID) || in dpot_read_spi()
136 dpot->uid == DPOT_UID(AD5292_ID) || in dpot_read_spi()
137 dpot->uid == DPOT_UID(AD5293_ID)) { in dpot_read_spi()
139 value = dpot_read_r8d8(dpot, in dpot_read_spi()
145 if (dpot->uid == DPOT_UID(AD5291_ID)) in dpot_read_spi()
149 } else if (dpot->uid == DPOT_UID(AD5270_ID) || in dpot_read_spi()
150 dpot->uid == DPOT_UID(AD5271_ID)) { in dpot_read_spi()
152 value = dpot_read_r8d8(dpot, in dpot_read_spi()
158 if (dpot->uid == DPOT_UID(AD5271_ID)) in dpot_read_spi()
169 if (dpot->feat & F_SPI_16BIT) in dpot_read_spi()
170 return dpot_read_r8d8(dpot, ctrl); in dpot_read_spi()
171 else if (dpot->feat & F_SPI_24BIT) in dpot_read_spi()
172 return dpot_read_r8d16(dpot, ctrl); in dpot_read_spi()
177 static s32 dpot_read_i2c(struct dpot_data *dpot, u8 reg) in dpot_read_i2c() argument
182 switch (dpot->uid) { in dpot_read_i2c()
185 return dpot_read_d8(dpot); in dpot_read_i2c()
195 return dpot_read_r8d8(dpot, ctrl); in dpot_read_i2c()
199 return dpot_read_d8(dpot); in dpot_read_i2c()
204 return dpot_read_r8d8(dpot, ctrl); in dpot_read_i2c()
207 dpot_write_r8d8(dpot, in dpot_read_i2c()
210 value = dpot_read_r8d16(dpot, DPOT_AD5270_1_2_4_RDAC << 2); in dpot_read_i2c()
219 if (dpot->uid == DPOT_UID(AD5274_ID)) in dpot_read_i2c()
223 if ((reg & DPOT_REG_TOL) || (dpot->max_pos > 256)) in dpot_read_i2c()
224 return dpot_read_r8d16(dpot, (reg & 0xF8) | in dpot_read_i2c()
227 return dpot_read_r8d8(dpot, reg); in dpot_read_i2c()
231 static s32 dpot_read(struct dpot_data *dpot, u8 reg) in dpot_read() argument
233 if (dpot->feat & F_SPI) in dpot_read()
234 return dpot_read_spi(dpot, reg); in dpot_read()
236 return dpot_read_i2c(dpot, reg); in dpot_read()
239 static s32 dpot_write_spi(struct dpot_data *dpot, u8 reg, u16 value) in dpot_write_spi() argument
244 if (dpot->feat & F_RDACS_WONLY) in dpot_write_spi()
245 dpot->rdac_cache[reg & DPOT_RDAC_MASK] = value; in dpot_write_spi()
247 if (dpot->feat & F_AD_APPDATA) { in dpot_write_spi()
248 if (dpot->feat & F_SPI_8BIT) { in dpot_write_spi()
250 DPOT_MAX_POS(dpot->devid)) | in dpot_write_spi()
252 return dpot_write_d8(dpot, val); in dpot_write_spi()
253 } else if (dpot->feat & F_SPI_16BIT) { in dpot_write_spi()
255 DPOT_MAX_POS(dpot->devid)) | in dpot_write_spi()
257 return dpot_write_r8d8(dpot, val >> 8, in dpot_write_spi()
262 if (dpot->uid == DPOT_UID(AD5291_ID) || in dpot_write_spi()
263 dpot->uid == DPOT_UID(AD5292_ID) || in dpot_write_spi()
264 dpot->uid == DPOT_UID(AD5293_ID)) { in dpot_write_spi()
266 dpot_write_r8d8(dpot, DPOT_AD5291_CTRLREG << 2, in dpot_write_spi()
269 if (dpot->uid == DPOT_UID(AD5291_ID)) in dpot_write_spi()
272 return dpot_write_r8d8(dpot, in dpot_write_spi()
275 } else if (dpot->uid == DPOT_UID(AD5270_ID) || in dpot_write_spi()
276 dpot->uid == DPOT_UID(AD5271_ID)) { in dpot_write_spi()
277 dpot_write_r8d8(dpot, in dpot_write_spi()
281 if (dpot->uid == DPOT_UID(AD5271_ID)) in dpot_write_spi()
284 return dpot_write_r8d8(dpot, in dpot_write_spi()
308 if (dpot->uid == DPOT_UID(AD5291_ID) || in dpot_write_spi()
309 dpot->uid == DPOT_UID(AD5292_ID)) { in dpot_write_spi()
310 return dpot_write_r8d8(dpot, in dpot_write_spi()
312 } else if (dpot->uid == DPOT_UID(AD5270_ID) || in dpot_write_spi()
313 dpot->uid == DPOT_UID(AD5271_ID)) { in dpot_write_spi()
314 return dpot_write_r8d8(dpot, in dpot_write_spi()
320 if (dpot->feat & F_SPI_16BIT) in dpot_write_spi()
321 return dpot_write_r8d8(dpot, val, value); in dpot_write_spi()
322 else if (dpot->feat & F_SPI_24BIT) in dpot_write_spi()
323 return dpot_write_r8d16(dpot, val, value); in dpot_write_spi()
328 static s32 dpot_write_i2c(struct dpot_data *dpot, u8 reg, u16 value) in dpot_write_i2c() argument
333 switch (dpot->uid) { in dpot_write_i2c()
336 return dpot_write_d8(dpot, value); in dpot_write_i2c()
347 return dpot_write_r8d8(dpot, ctrl, value); in dpot_write_i2c()
351 tmp = dpot_read_d8(dpot); in dpot_write_i2c()
356 return dpot_write_r8d8(dpot, ctrl, value); in dpot_write_i2c()
362 tmp = dpot_read_r8d16(dpot, ctrl); in dpot_write_i2c()
367 return dpot_write_r8d8(dpot, ctrl, value); in dpot_write_i2c()
370 tmp = dpot_read_r8d16(dpot, tmp); in dpot_write_i2c()
375 return dpot_write_r8d8(dpot, ctrl, value); in dpot_write_i2c()
378 dpot_write_r8d8(dpot, DPOT_AD5270_1_2_4_CTRLREG << 2, in dpot_write_i2c()
382 return dpot_write_r8d8(dpot, in dpot_write_i2c()
385 if (dpot->uid == DPOT_UID(AD5274_ID)) in dpot_write_i2c()
388 return dpot_write_r8d8(dpot, (DPOT_AD5270_1_2_4_RDAC << 2) | in dpot_write_i2c()
392 return dpot_write_d8(dpot, reg); in dpot_write_i2c()
394 if (dpot->max_pos > 256) in dpot_write_i2c()
395 return dpot_write_r8d16(dpot, (reg & 0xF8) | in dpot_write_i2c()
399 return dpot_write_r8d8(dpot, reg, value); in dpot_write_i2c()
403 static s32 dpot_write(struct dpot_data *dpot, u8 reg, u16 value) in dpot_write() argument
405 if (dpot->feat & F_SPI) in dpot_write()
406 return dpot_write_spi(dpot, reg, value); in dpot_write()
408 return dpot_write_i2c(dpot, reg, value); in dpot_write()