Lines Matching refs:reg

102 static inline int dpot_read_r8d8(struct dpot_data *dpot, u8 reg)  in dpot_read_r8d8()  argument
104 return dpot->bdata.bops->read_r8d8(dpot->bdata.client, reg); in dpot_read_r8d8()
107 static inline int dpot_read_r8d16(struct dpot_data *dpot, u8 reg) in dpot_read_r8d16() argument
109 return dpot->bdata.bops->read_r8d16(dpot->bdata.client, reg); in dpot_read_r8d16()
117 static inline int dpot_write_r8d8(struct dpot_data *dpot, u8 reg, u16 val) in dpot_write_r8d8() argument
119 return dpot->bdata.bops->write_r8d8(dpot->bdata.client, reg, val); in dpot_write_r8d8()
122 static inline int dpot_write_r8d16(struct dpot_data *dpot, u8 reg, u16 val) in dpot_write_r8d16() argument
124 return dpot->bdata.bops->write_r8d16(dpot->bdata.client, reg, val); in dpot_write_r8d16()
127 static s32 dpot_read_spi(struct dpot_data *dpot, u8 reg) in dpot_read_spi() argument
132 if (!(reg & (DPOT_ADDR_EEPROM | DPOT_ADDR_CMD))) { in dpot_read_spi()
135 return dpot->rdac_cache[reg & DPOT_RDAC_MASK]; in dpot_read_spi()
163 } else if (reg & DPOT_ADDR_EEPROM) { in dpot_read_spi()
175 static s32 dpot_read_i2c(struct dpot_data *dpot, u8 reg) in dpot_read_i2c() argument
191 ctrl = ((reg & DPOT_RDAC_MASK) == DPOT_RDAC0) ? in dpot_read_i2c()
200 ctrl = ((reg & DPOT_RDAC_MASK) == DPOT_RDAC0) ? 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()
225 ((reg & 0x7) << 1)); 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
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
243 if (!(reg & (DPOT_ADDR_EEPROM | DPOT_ADDR_CMD | DPOT_ADDR_OTP))) { in dpot_write_spi()
245 dpot->rdac_cache[reg & DPOT_RDAC_MASK] = value; in dpot_write_spi()
249 val = ((reg & DPOT_RDAC_MASK) << in dpot_write_spi()
254 val = ((reg & DPOT_RDAC_MASK) << in dpot_write_spi()
288 val = DPOT_SPI_RDAC | (reg & DPOT_RDAC_MASK); in dpot_write_spi()
290 } else if (reg & DPOT_ADDR_EEPROM) { in dpot_write_spi()
291 val = DPOT_SPI_EEPROM | (reg & DPOT_RDAC_MASK); in dpot_write_spi()
292 } else if (reg & DPOT_ADDR_CMD) { in dpot_write_spi()
293 switch (reg) { in dpot_write_spi()
307 } else if (reg & DPOT_ADDR_OTP) { in dpot_write_spi()
328 static s32 dpot_write_i2c(struct dpot_data *dpot, u8 reg, u16 value) in dpot_write_i2c() argument
345 ctrl = ((reg & DPOT_RDAC_MASK) == DPOT_RDAC0) ? in dpot_write_i2c()
350 if (reg & DPOT_ADDR_OTP) { in dpot_write_i2c()
359 ctrl = ((reg & DPOT_RDAC_MASK) == DPOT_RDAC0) ? in dpot_write_i2c()
361 if (reg & DPOT_ADDR_OTP) { in dpot_write_i2c()
369 if (reg & DPOT_ADDR_OTP) { in dpot_write_i2c()
381 if (reg & DPOT_ADDR_OTP) in dpot_write_i2c()
391 if (reg & DPOT_ADDR_CMD) in dpot_write_i2c()
392 return dpot_write_d8(dpot, reg); in dpot_write_i2c()
395 return dpot_write_r8d16(dpot, (reg & 0xF8) | in dpot_write_i2c()
396 ((reg & 0x7) << 1), value); 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
406 return dpot_write_spi(dpot, reg, value); in dpot_write()
408 return dpot_write_i2c(dpot, reg, value); in dpot_write()
415 char *buf, u32 reg) in sysfs_show_reg() argument
420 if (reg & DPOT_ADDR_OTP_EN) in sysfs_show_reg()
422 test_bit(DPOT_RDAC_MASK & reg, data->otp_en_mask) ? in sysfs_show_reg()
427 value = dpot_read(data, reg); in sysfs_show_reg()
440 if (reg & DPOT_REG_TOL) in sysfs_show_reg()
448 const char *buf, size_t count, u32 reg) in sysfs_set_reg() argument
454 if (reg & DPOT_ADDR_OTP_EN) { in sysfs_set_reg()
456 set_bit(DPOT_RDAC_MASK & reg, data->otp_en_mask); in sysfs_set_reg()
458 clear_bit(DPOT_RDAC_MASK & reg, data->otp_en_mask); in sysfs_set_reg()
463 if ((reg & DPOT_ADDR_OTP) && in sysfs_set_reg()
464 !test_bit(DPOT_RDAC_MASK & reg, data->otp_en_mask)) in sysfs_set_reg()
475 dpot_write(data, reg, value); in sysfs_set_reg()
476 if (reg & DPOT_ADDR_EEPROM) in sysfs_set_reg()
478 else if (reg & DPOT_ADDR_OTP) in sysfs_set_reg()
487 const char *buf, size_t count, u32 reg) in sysfs_do_cmd() argument
492 dpot_write(data, reg, 0); in sysfs_do_cmd()
515 #define DPOT_DEVICE_SHOW_SET(name, reg) \ argument
516 DPOT_DEVICE_SHOW(name, reg) \
517 DPOT_DEVICE_SET(name, reg) \
520 #define DPOT_DEVICE_SHOW_ONLY(name, reg) \ argument
521 DPOT_DEVICE_SHOW(name, reg) \