Lines Matching full:dac

3  * IIO DAC emulation driver using a digital potentiometer
24 * | '---' dac output voltage
56 struct dpot_dac *dac = iio_priv(indio_dev); in dpot_dac_read_raw() local
62 return iio_read_channel_raw(dac->dpot, val); in dpot_dac_read_raw()
65 ret = iio_read_channel_scale(dac->dpot, val, val2); in dpot_dac_read_raw()
69 do_div(tmp, dac->max_ohms); in dpot_dac_read_raw()
70 tmp *= regulator_get_voltage(dac->vref) / 1000; in dpot_dac_read_raw()
84 *val *= regulator_get_voltage(dac->vref) / 1000; in dpot_dac_read_raw()
85 *val2 *= dac->max_ohms; in dpot_dac_read_raw()
100 struct dpot_dac *dac = iio_priv(indio_dev); in dpot_dac_read_avail() local
105 return iio_read_avail_channel_raw(dac->dpot, vals, length); in dpot_dac_read_avail()
115 struct dpot_dac *dac = iio_priv(indio_dev); in dpot_dac_write_raw() local
119 return iio_write_channel_raw(dac->dpot, val); in dpot_dac_write_raw()
134 struct dpot_dac *dac = iio_priv(indio_dev); in dpot_dac_channel_max_ohms() local
141 ret = iio_read_max_channel_raw(dac->dpot, &max); in dpot_dac_channel_max_ohms()
147 switch (iio_read_channel_scale(dac->dpot, &val, &val2)) { in dpot_dac_channel_max_ohms()
169 struct dpot_dac *dac; in dpot_dac_probe() local
173 indio_dev = devm_iio_device_alloc(dev, sizeof(*dac)); in dpot_dac_probe()
178 dac = iio_priv(indio_dev); in dpot_dac_probe()
186 dac->vref = devm_regulator_get(dev, "vref"); in dpot_dac_probe()
187 if (IS_ERR(dac->vref)) in dpot_dac_probe()
188 return dev_err_probe(&pdev->dev, PTR_ERR(dac->vref), in dpot_dac_probe()
191 dac->dpot = devm_iio_channel_get(dev, "dpot"); in dpot_dac_probe()
192 if (IS_ERR(dac->dpot)) in dpot_dac_probe()
193 return dev_err_probe(&pdev->dev, PTR_ERR(dac->dpot), in dpot_dac_probe()
196 ret = iio_get_channel_type(dac->dpot, &type); in dpot_dac_probe()
208 dac->max_ohms = ret; in dpot_dac_probe()
210 ret = regulator_enable(dac->vref); in dpot_dac_probe()
225 regulator_disable(dac->vref); in dpot_dac_probe()
232 struct dpot_dac *dac = iio_priv(indio_dev); in dpot_dac_remove() local
235 regulator_disable(dac->vref); in dpot_dac_remove()
241 { .compatible = "dpot-dac" },
250 .name = "iio-dpot-dac",
256 MODULE_DESCRIPTION("DAC emulation driver using a digital potentiometer");