Lines Matching full:afe
172 struct afe4404_data *afe = iio_priv(indio_dev); in afe440x_show_register() local
178 ret = regmap_field_read(afe->fields[afe440x_attr->field], ®_val); in afe440x_show_register()
196 struct afe4404_data *afe = iio_priv(indio_dev); in afe440x_store_register() local
211 ret = regmap_field_write(afe->fields[afe440x_attr->field], val); in afe440x_store_register()
252 struct afe4404_data *afe = iio_priv(indio_dev); in afe4404_read_raw() local
261 ret = regmap_read(afe->regmap, value_reg, val); in afe4404_read_raw()
267 ret = regmap_field_read(afe->fields[offdac_field], val); in afe4404_read_raw()
277 ret = regmap_field_read(afe->fields[led_field], val); in afe4404_read_raw()
298 struct afe4404_data *afe = iio_priv(indio_dev); in afe4404_write_raw() local
306 return regmap_field_write(afe->fields[offdac_field], val); in afe4404_write_raw()
313 return regmap_field_write(afe->fields[led_field], val); in afe4404_write_raw()
333 struct afe4404_data *afe = iio_priv(indio_dev); in afe4404_trigger_handler() local
337 ret = regmap_read(afe->regmap, afe4404_channel_values[bit], in afe4404_trigger_handler()
338 &afe->buffer[i++]); in afe4404_trigger_handler()
343 iio_push_to_buffers_with_timestamp(indio_dev, afe->buffer, in afe4404_trigger_handler()
429 struct afe4404_data *afe = iio_priv(indio_dev); in afe4404_suspend() local
432 ret = regmap_set_bits(afe->regmap, AFE440X_CONTROL2, in afe4404_suspend()
437 ret = regulator_disable(afe->regulator); in afe4404_suspend()
449 struct afe4404_data *afe = iio_priv(indio_dev); in afe4404_resume() local
452 ret = regulator_enable(afe->regulator); in afe4404_resume()
458 ret = regmap_clear_bits(afe->regmap, AFE440X_CONTROL2, in afe4404_resume()
472 struct afe4404_data *afe; in afe4404_probe() local
475 indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*afe)); in afe4404_probe()
479 afe = iio_priv(indio_dev); in afe4404_probe()
482 afe->dev = &client->dev; in afe4404_probe()
483 afe->irq = client->irq; in afe4404_probe()
485 afe->regmap = devm_regmap_init_i2c(client, &afe4404_regmap_config); in afe4404_probe()
486 if (IS_ERR(afe->regmap)) { in afe4404_probe()
487 dev_err(afe->dev, "Unable to allocate register map\n"); in afe4404_probe()
488 return PTR_ERR(afe->regmap); in afe4404_probe()
492 afe->fields[i] = devm_regmap_field_alloc(afe->dev, afe->regmap, in afe4404_probe()
494 if (IS_ERR(afe->fields[i])) { in afe4404_probe()
495 dev_err(afe->dev, "Unable to allocate regmap fields\n"); in afe4404_probe()
496 return PTR_ERR(afe->fields[i]); in afe4404_probe()
500 afe->regulator = devm_regulator_get(afe->dev, "tx_sup"); in afe4404_probe()
501 if (IS_ERR(afe->regulator)) in afe4404_probe()
502 return dev_err_probe(afe->dev, PTR_ERR(afe->regulator), in afe4404_probe()
505 ret = regulator_enable(afe->regulator); in afe4404_probe()
507 dev_err(afe->dev, "Unable to enable regulator\n"); in afe4404_probe()
510 ret = devm_add_action_or_reset(afe->dev, afe4404_regulator_disable, afe->regulator); in afe4404_probe()
512 dev_err(afe->dev, "Unable to enable regulator\n"); in afe4404_probe()
516 ret = regmap_write(afe->regmap, AFE440X_CONTROL0, in afe4404_probe()
519 dev_err(afe->dev, "Unable to reset device\n"); in afe4404_probe()
523 ret = regmap_multi_reg_write(afe->regmap, afe4404_reg_sequences, in afe4404_probe()
526 dev_err(afe->dev, "Unable to set register defaults\n"); in afe4404_probe()
536 if (afe->irq > 0) { in afe4404_probe()
537 afe->trig = devm_iio_trigger_alloc(afe->dev, in afe4404_probe()
541 if (!afe->trig) { in afe4404_probe()
542 dev_err(afe->dev, "Unable to allocate IIO trigger\n"); in afe4404_probe()
546 iio_trigger_set_drvdata(afe->trig, indio_dev); in afe4404_probe()
548 ret = devm_iio_trigger_register(afe->dev, afe->trig); in afe4404_probe()
550 dev_err(afe->dev, "Unable to register IIO trigger\n"); in afe4404_probe()
554 ret = devm_request_threaded_irq(afe->dev, afe->irq, in afe4404_probe()
558 afe->trig); in afe4404_probe()
560 dev_err(afe->dev, "Unable to request IRQ\n"); in afe4404_probe()
565 ret = devm_iio_triggered_buffer_setup(afe->dev, indio_dev, in afe4404_probe()
569 dev_err(afe->dev, "Unable to setup buffer\n"); in afe4404_probe()
573 ret = devm_iio_device_register(afe->dev, indio_dev); in afe4404_probe()
575 dev_err(afe->dev, "Unable to register IIO device\n"); in afe4404_probe()
600 MODULE_DESCRIPTION("TI AFE4404 Heart Rate Monitor and Pulse Oximeter AFE");