Lines Matching full:rc
63 #define DPS310_POLL_TIMEOUT_US(rc) ((rc) <= 0 ? 1000000 : 1000000 / (rc)) argument
112 int rc; in dps310_get_coefs() local
118 rc = regmap_bulk_read(data->regmap, DPS310_COEF_BASE, coef, in dps310_get_coefs()
120 if (rc < 0) in dps310_get_coefs()
121 return rc; in dps310_get_coefs()
164 int rc; in dps310_get_pres_precision() local
167 rc = regmap_read(data->regmap, DPS310_PRS_CFG, &val); in dps310_get_pres_precision()
168 if (rc < 0) in dps310_get_pres_precision()
169 return rc; in dps310_get_pres_precision()
176 int rc; in dps310_get_temp_precision() local
179 rc = regmap_read(data->regmap, DPS310_TMP_CFG, &val); in dps310_get_temp_precision()
180 if (rc < 0) in dps310_get_temp_precision()
181 return rc; in dps310_get_temp_precision()
193 int rc; in dps310_set_pres_precision() local
200 rc = regmap_write_bits(data->regmap, DPS310_CFG_REG, in dps310_set_pres_precision()
202 if (rc) in dps310_set_pres_precision()
203 return rc; in dps310_set_pres_precision()
212 int rc; in dps310_set_temp_precision() local
219 rc = regmap_write_bits(data->regmap, DPS310_CFG_REG, in dps310_set_temp_precision()
221 if (rc) in dps310_set_temp_precision()
222 return rc; in dps310_set_temp_precision()
258 int rc; in dps310_get_pres_samp_freq() local
261 rc = regmap_read(data->regmap, DPS310_PRS_CFG, &val); in dps310_get_pres_samp_freq()
262 if (rc < 0) in dps310_get_pres_samp_freq()
263 return rc; in dps310_get_pres_samp_freq()
270 int rc; in dps310_get_temp_samp_freq() local
273 rc = regmap_read(data->regmap, DPS310_TMP_CFG, &val); in dps310_get_temp_samp_freq()
274 if (rc < 0) in dps310_get_temp_samp_freq()
275 return rc; in dps310_get_temp_samp_freq()
282 int rc = dps310_get_pres_precision(data); in dps310_get_pres_k() local
284 if (rc < 0) in dps310_get_pres_k()
285 return rc; in dps310_get_pres_k()
287 return scale_factors[ilog2(rc)]; in dps310_get_pres_k()
292 int rc = dps310_get_temp_precision(data); in dps310_get_temp_k() local
294 if (rc < 0) in dps310_get_temp_k()
295 return rc; in dps310_get_temp_k()
297 return scale_factors[ilog2(rc)]; in dps310_get_temp_k()
302 int rc; in dps310_read_pres_raw() local
316 rc = regmap_read_poll_timeout(data->regmap, DPS310_MEAS_CFG, ready, in dps310_read_pres_raw()
319 if (rc) in dps310_read_pres_raw()
322 rc = regmap_bulk_read(data->regmap, DPS310_PRS_BASE, val, sizeof(val)); in dps310_read_pres_raw()
323 if (rc < 0) in dps310_read_pres_raw()
331 return rc; in dps310_read_pres_raw()
337 int rc; in dps310_read_temp_ready() local
341 rc = regmap_bulk_read(data->regmap, DPS310_TMP_BASE, val, sizeof(val)); in dps310_read_temp_ready()
342 if (rc < 0) in dps310_read_temp_ready()
343 return rc; in dps310_read_temp_ready()
353 int rc; in dps310_read_temp_raw() local
365 rc = regmap_read_poll_timeout(data->regmap, DPS310_MEAS_CFG, ready, in dps310_read_temp_raw()
368 if (rc < 0) in dps310_read_temp_raw()
371 rc = dps310_read_temp_ready(data); in dps310_read_temp_raw()
375 return rc; in dps310_read_temp_raw()
417 int rc; in dps310_write_raw() local
427 rc = dps310_set_pres_samp_freq(data, val); in dps310_write_raw()
431 rc = dps310_set_temp_samp_freq(data, val); in dps310_write_raw()
435 rc = -EINVAL; in dps310_write_raw()
443 rc = dps310_set_pres_precision(data, val); in dps310_write_raw()
447 rc = dps310_set_temp_precision(data, val); in dps310_write_raw()
451 rc = -EINVAL; in dps310_write_raw()
457 rc = -EINVAL; in dps310_write_raw()
462 return rc; in dps310_write_raw()
468 int rc; in dps310_calculate_pressure() local
493 rc = regmap_read(data->regmap, DPS310_MEAS_CFG, &t_ready); in dps310_calculate_pressure()
494 if (rc >= 0 && t_ready & DPS310_TMP_RDY) in dps310_calculate_pressure()
546 int rc; in dps310_read_pressure() local
550 rc = dps310_get_pres_samp_freq(data); in dps310_read_pressure()
551 if (rc < 0) in dps310_read_pressure()
552 return rc; in dps310_read_pressure()
554 *val = rc; in dps310_read_pressure()
558 rc = dps310_read_pres_raw(data); in dps310_read_pressure()
559 if (rc) in dps310_read_pressure()
560 return rc; in dps310_read_pressure()
562 rc = dps310_calculate_pressure(data); in dps310_read_pressure()
563 if (rc < 0) in dps310_read_pressure()
564 return rc; in dps310_read_pressure()
566 *val = rc; in dps310_read_pressure()
571 rc = dps310_get_pres_precision(data); in dps310_read_pressure()
572 if (rc < 0) in dps310_read_pressure()
573 return rc; in dps310_read_pressure()
575 *val = rc; in dps310_read_pressure()
605 int rc; in dps310_read_temp() local
609 rc = dps310_get_temp_samp_freq(data); in dps310_read_temp()
610 if (rc < 0) in dps310_read_temp()
611 return rc; in dps310_read_temp()
613 *val = rc; in dps310_read_temp()
617 rc = dps310_read_temp_raw(data); in dps310_read_temp()
618 if (rc) in dps310_read_temp()
619 return rc; in dps310_read_temp()
621 rc = dps310_calculate_temp(data); in dps310_read_temp()
622 if (rc < 0) in dps310_read_temp()
623 return rc; in dps310_read_temp()
625 *val = rc; in dps310_read_temp()
629 rc = dps310_get_temp_precision(data); in dps310_read_temp()
630 if (rc < 0) in dps310_read_temp()
631 return rc; in dps310_read_temp()
633 *val = rc; in dps310_read_temp()
687 int rc; in dps310_temp_workaround() local
690 rc = regmap_read(data->regmap, 0x32, ®); in dps310_temp_workaround()
691 if (rc < 0) in dps310_temp_workaround()
692 return rc; in dps310_temp_workaround()
701 rc = regmap_write(data->regmap, 0x0e, 0xA5); in dps310_temp_workaround()
702 if (rc < 0) in dps310_temp_workaround()
703 return rc; in dps310_temp_workaround()
705 rc = regmap_write(data->regmap, 0x0f, 0x96); in dps310_temp_workaround()
706 if (rc < 0) in dps310_temp_workaround()
707 return rc; in dps310_temp_workaround()
709 rc = regmap_write(data->regmap, 0x62, 0x02); in dps310_temp_workaround()
710 if (rc < 0) in dps310_temp_workaround()
711 return rc; in dps310_temp_workaround()
713 rc = regmap_write(data->regmap, 0x0e, 0x00); in dps310_temp_workaround()
714 if (rc < 0) in dps310_temp_workaround()
715 return rc; in dps310_temp_workaround()
725 int rc, ready; in dps310_probe() local
746 rc = devm_add_action_or_reset(&client->dev, dps310_reset, data); in dps310_probe()
747 if (rc) in dps310_probe()
748 return rc; in dps310_probe()
754 rc = regmap_write(data->regmap, DPS310_PRS_CFG, 0); in dps310_probe()
760 rc = regmap_write(data->regmap, DPS310_TMP_CFG, DPS310_TMP_EXT); in dps310_probe()
761 if (rc < 0) in dps310_probe()
762 return rc; in dps310_probe()
765 rc = regmap_write_bits(data->regmap, DPS310_CFG_REG, in dps310_probe()
767 if (rc < 0) in dps310_probe()
768 return rc; in dps310_probe()
771 rc = regmap_write_bits(data->regmap, DPS310_MEAS_CFG, in dps310_probe()
773 if (rc < 0) in dps310_probe()
774 return rc; in dps310_probe()
777 rc = regmap_write_bits(data->regmap, DPS310_MEAS_CFG, in dps310_probe()
780 if (rc < 0) in dps310_probe()
781 return rc; in dps310_probe()
787 rc = regmap_read_poll_timeout(data->regmap, DPS310_MEAS_CFG, ready, in dps310_probe()
789 if (rc < 0) in dps310_probe()
790 return rc; in dps310_probe()
792 rc = dps310_get_coefs(data); in dps310_probe()
793 if (rc < 0) in dps310_probe()
794 return rc; in dps310_probe()
796 rc = dps310_temp_workaround(data); in dps310_probe()
797 if (rc < 0) in dps310_probe()
798 return rc; in dps310_probe()
800 rc = devm_iio_device_register(&client->dev, iio); in dps310_probe()
801 if (rc) in dps310_probe()
802 return rc; in dps310_probe()