Lines Matching +full:reg +full:- +full:rc

6  * SPDX-License-Identifier: Apache-2.0
24 int jc42_reg_read(const struct device *dev, uint8_t reg, uint16_t *val) in jc42_reg_read() argument
26 const struct jc42_config *cfg = dev->config; in jc42_reg_read()
27 int rc = i2c_write_read_dt(&cfg->i2c, &reg, sizeof(reg), val, sizeof(*val)); in jc42_reg_read() local
29 if (rc == 0) { in jc42_reg_read()
33 return rc; in jc42_reg_read()
36 int jc42_reg_write_16bit(const struct device *dev, uint8_t reg, uint16_t val) in jc42_reg_write_16bit() argument
38 const struct jc42_config *cfg = dev->config; in jc42_reg_write_16bit()
42 buf[0] = reg; in jc42_reg_write_16bit()
45 return i2c_write_dt(&cfg->i2c, buf, sizeof(buf)); in jc42_reg_write_16bit()
48 int jc42_reg_write_8bit(const struct device *dev, uint8_t reg, uint8_t val) in jc42_reg_write_8bit() argument
50 const struct jc42_config *cfg = dev->config; in jc42_reg_write_8bit()
52 reg, in jc42_reg_write_8bit()
56 return i2c_write_dt(&cfg->i2c, buf, sizeof(buf)); in jc42_reg_write_8bit()
66 struct jc42_data *data = dev->data; in jc42_sample_fetch()
70 return jc42_reg_read(dev, JC42_REG_TEMP_AMB, &data->reg_val); in jc42_sample_fetch()
76 const struct jc42_data *data = dev->data; in jc42_channel_get()
77 int temp = jc42_temp_signed_from_reg(data->reg_val); in jc42_channel_get()
82 return -ENOTSUP; in jc42_channel_get()
85 val->val1 = temp / JC42_TEMP_SCALE_CEL; in jc42_channel_get()
86 temp -= val->val1 * JC42_TEMP_SCALE_CEL; in jc42_channel_get()
87 val->val2 = (temp * 1000000) / JC42_TEMP_SCALE_CEL; in jc42_channel_get()
103 const struct jc42_config *cfg = dev->config; in jc42_init()
104 int rc = 0; in jc42_init() local
106 if (!device_is_ready(cfg->i2c.bus)) { in jc42_init()
108 return -ENODEV; in jc42_init()
111 rc = jc42_set_temperature_resolution(dev, cfg->resolution); in jc42_init()
112 if (rc) { in jc42_init()
114 return rc; in jc42_init()
118 if (cfg->int_gpio.port) { in jc42_init()
119 rc = jc42_setup_interrupt(dev); in jc42_init()
123 return rc; in jc42_init()