Lines Matching refs:rc
63 #define DPS310_POLL_TIMEOUT_US(rc) ((rc) <= 0 ? 1000000 : 1000000 / (rc)) argument
113 int rc; in dps310_get_coefs() local
119 rc = regmap_bulk_read(data->regmap, DPS310_COEF_BASE, coef, in dps310_get_coefs()
121 if (rc < 0) in dps310_get_coefs()
122 return rc; in dps310_get_coefs()
170 int rc; in dps310_temp_workaround() local
173 rc = regmap_read(data->regmap, 0x32, ®); in dps310_temp_workaround()
174 if (rc) in dps310_temp_workaround()
175 return rc; in dps310_temp_workaround()
184 rc = regmap_write(data->regmap, 0x0e, 0xA5); in dps310_temp_workaround()
185 if (rc) in dps310_temp_workaround()
186 return rc; in dps310_temp_workaround()
188 rc = regmap_write(data->regmap, 0x0f, 0x96); in dps310_temp_workaround()
189 if (rc) in dps310_temp_workaround()
190 return rc; in dps310_temp_workaround()
192 rc = regmap_write(data->regmap, 0x62, 0x02); in dps310_temp_workaround()
193 if (rc) in dps310_temp_workaround()
194 return rc; in dps310_temp_workaround()
196 rc = regmap_write(data->regmap, 0x0e, 0x00); in dps310_temp_workaround()
197 if (rc) in dps310_temp_workaround()
198 return rc; in dps310_temp_workaround()
205 int rc; in dps310_startup() local
212 rc = regmap_write(data->regmap, DPS310_PRS_CFG, 0); in dps310_startup()
213 if (rc) in dps310_startup()
214 return rc; in dps310_startup()
220 rc = regmap_write(data->regmap, DPS310_TMP_CFG, DPS310_TMP_EXT); in dps310_startup()
221 if (rc) in dps310_startup()
222 return rc; in dps310_startup()
225 rc = regmap_write_bits(data->regmap, DPS310_CFG_REG, in dps310_startup()
227 if (rc) in dps310_startup()
228 return rc; in dps310_startup()
231 rc = regmap_write_bits(data->regmap, DPS310_MEAS_CFG, in dps310_startup()
233 if (rc) in dps310_startup()
234 return rc; in dps310_startup()
237 rc = regmap_write_bits(data->regmap, DPS310_MEAS_CFG, in dps310_startup()
240 if (rc) in dps310_startup()
241 return rc; in dps310_startup()
247 rc = regmap_read_poll_timeout(data->regmap, DPS310_MEAS_CFG, ready, in dps310_startup()
249 if (rc) in dps310_startup()
250 return rc; in dps310_startup()
252 rc = dps310_get_coefs(data); in dps310_startup()
253 if (rc) in dps310_startup()
254 return rc; in dps310_startup()
261 int rc; in dps310_get_pres_precision() local
264 rc = regmap_read(data->regmap, DPS310_PRS_CFG, &val); in dps310_get_pres_precision()
265 if (rc < 0) in dps310_get_pres_precision()
266 return rc; in dps310_get_pres_precision()
273 int rc; in dps310_get_temp_precision() local
276 rc = regmap_read(data->regmap, DPS310_TMP_CFG, &val); in dps310_get_temp_precision()
277 if (rc < 0) in dps310_get_temp_precision()
278 return rc; in dps310_get_temp_precision()
290 int rc; in dps310_set_pres_precision() local
297 rc = regmap_write_bits(data->regmap, DPS310_CFG_REG, in dps310_set_pres_precision()
299 if (rc) in dps310_set_pres_precision()
300 return rc; in dps310_set_pres_precision()
309 int rc; in dps310_set_temp_precision() local
316 rc = regmap_write_bits(data->regmap, DPS310_CFG_REG, in dps310_set_temp_precision()
318 if (rc) in dps310_set_temp_precision()
319 return rc; in dps310_set_temp_precision()
355 int rc; in dps310_get_pres_samp_freq() local
358 rc = regmap_read(data->regmap, DPS310_PRS_CFG, &val); in dps310_get_pres_samp_freq()
359 if (rc < 0) in dps310_get_pres_samp_freq()
360 return rc; in dps310_get_pres_samp_freq()
367 int rc; in dps310_get_temp_samp_freq() local
370 rc = regmap_read(data->regmap, DPS310_TMP_CFG, &val); in dps310_get_temp_samp_freq()
371 if (rc < 0) in dps310_get_temp_samp_freq()
372 return rc; in dps310_get_temp_samp_freq()
379 int rc = dps310_get_pres_precision(data); in dps310_get_pres_k() local
381 if (rc < 0) in dps310_get_pres_k()
382 return rc; in dps310_get_pres_k()
384 return scale_factors[ilog2(rc)]; in dps310_get_pres_k()
389 int rc = dps310_get_temp_precision(data); in dps310_get_temp_k() local
391 if (rc < 0) in dps310_get_temp_k()
392 return rc; in dps310_get_temp_k()
394 return scale_factors[ilog2(rc)]; in dps310_get_temp_k()
399 int rc; in dps310_reset_wait() local
401 rc = regmap_write(data->regmap, DPS310_RESET, DPS310_RESET_MAGIC); in dps310_reset_wait()
402 if (rc) in dps310_reset_wait()
403 return rc; in dps310_reset_wait()
412 int rc; in dps310_reset_reinit() local
414 rc = dps310_reset_wait(data); in dps310_reset_reinit()
415 if (rc) in dps310_reset_reinit()
416 return rc; in dps310_reset_reinit()
432 int rc; in dps310_ready() local
434 rc = dps310_ready_status(data, ready_bit, timeout); in dps310_ready()
435 if (rc) { in dps310_ready()
436 if (rc == -ETIMEDOUT && !data->timeout_recovery_failed) { in dps310_ready()
449 return rc; in dps310_ready()
458 int rc; in dps310_read_pres_raw() local
471 rc = dps310_ready(data, DPS310_PRS_RDY, timeout); in dps310_read_pres_raw()
472 if (rc) in dps310_read_pres_raw()
475 rc = regmap_bulk_read(data->regmap, DPS310_PRS_BASE, val, sizeof(val)); in dps310_read_pres_raw()
476 if (rc < 0) in dps310_read_pres_raw()
484 return rc; in dps310_read_pres_raw()
490 int rc; in dps310_read_temp_ready() local
494 rc = regmap_bulk_read(data->regmap, DPS310_TMP_BASE, val, sizeof(val)); in dps310_read_temp_ready()
495 if (rc < 0) in dps310_read_temp_ready()
496 return rc; in dps310_read_temp_ready()
506 int rc; in dps310_read_temp_raw() local
517 rc = dps310_ready(data, DPS310_TMP_RDY, timeout); in dps310_read_temp_raw()
518 if (rc) in dps310_read_temp_raw()
521 rc = dps310_read_temp_ready(data); in dps310_read_temp_raw()
525 return rc; in dps310_read_temp_raw()
567 int rc; in dps310_write_raw() local
577 rc = dps310_set_pres_samp_freq(data, val); in dps310_write_raw()
581 rc = dps310_set_temp_samp_freq(data, val); in dps310_write_raw()
585 rc = -EINVAL; in dps310_write_raw()
593 rc = dps310_set_pres_precision(data, val); in dps310_write_raw()
597 rc = dps310_set_temp_precision(data, val); in dps310_write_raw()
601 rc = -EINVAL; in dps310_write_raw()
607 rc = -EINVAL; in dps310_write_raw()
612 return rc; in dps310_write_raw()
618 int rc; in dps310_calculate_pressure() local
643 rc = regmap_read(data->regmap, DPS310_MEAS_CFG, &t_ready); in dps310_calculate_pressure()
644 if (rc >= 0 && t_ready & DPS310_TMP_RDY) in dps310_calculate_pressure()
696 int rc; in dps310_read_pressure() local
700 rc = dps310_get_pres_samp_freq(data); in dps310_read_pressure()
701 if (rc < 0) in dps310_read_pressure()
702 return rc; in dps310_read_pressure()
704 *val = rc; in dps310_read_pressure()
708 rc = dps310_read_pres_raw(data); in dps310_read_pressure()
709 if (rc) in dps310_read_pressure()
710 return rc; in dps310_read_pressure()
712 rc = dps310_calculate_pressure(data); in dps310_read_pressure()
713 if (rc < 0) in dps310_read_pressure()
714 return rc; in dps310_read_pressure()
716 *val = rc; in dps310_read_pressure()
721 rc = dps310_get_pres_precision(data); in dps310_read_pressure()
722 if (rc < 0) in dps310_read_pressure()
723 return rc; in dps310_read_pressure()
725 *val = rc; in dps310_read_pressure()
757 int rc; in dps310_read_temp() local
761 rc = dps310_get_temp_samp_freq(data); in dps310_read_temp()
762 if (rc < 0) in dps310_read_temp()
763 return rc; in dps310_read_temp()
765 *val = rc; in dps310_read_temp()
769 rc = dps310_read_temp_raw(data); in dps310_read_temp()
770 if (rc) in dps310_read_temp()
771 return rc; in dps310_read_temp()
773 rc = dps310_calculate_temp(data, val); in dps310_read_temp()
774 if (rc) in dps310_read_temp()
775 return rc; in dps310_read_temp()
780 rc = dps310_get_temp_precision(data); in dps310_read_temp()
781 if (rc < 0) in dps310_read_temp()
782 return rc; in dps310_read_temp()
784 *val = rc; in dps310_read_temp()
836 int rc; in dps310_probe() local
857 rc = devm_add_action_or_reset(&client->dev, dps310_reset, data); in dps310_probe()
858 if (rc) in dps310_probe()
859 return rc; in dps310_probe()
861 rc = dps310_startup(data); in dps310_probe()
862 if (rc) in dps310_probe()
863 return rc; in dps310_probe()
865 rc = devm_iio_device_register(&client->dev, iio); in dps310_probe()
866 if (rc) in dps310_probe()
867 return rc; in dps310_probe()