Lines Matching refs:ad7766

35 struct ad7766 {  struct
71 struct ad7766 *ad7766 = iio_priv(indio_dev); in ad7766_trigger_handler() argument
74 ret = spi_sync(ad7766->spi, &ad7766->msg); in ad7766_trigger_handler()
78 iio_push_to_buffers_with_timestamp(indio_dev, ad7766->data, in ad7766_trigger_handler()
88 struct ad7766 *ad7766 = iio_priv(indio_dev); in ad7766_preenable() local
91 ret = regulator_bulk_enable(ARRAY_SIZE(ad7766->reg), ad7766->reg); in ad7766_preenable()
93 dev_err(&ad7766->spi->dev, "Failed to enable supplies: %d\n", in ad7766_preenable()
98 ret = clk_prepare_enable(ad7766->mclk); in ad7766_preenable()
100 dev_err(&ad7766->spi->dev, "Failed to enable MCLK: %d\n", ret); in ad7766_preenable()
101 regulator_bulk_disable(ARRAY_SIZE(ad7766->reg), ad7766->reg); in ad7766_preenable()
105 gpiod_set_value(ad7766->pd_gpio, 0); in ad7766_preenable()
112 struct ad7766 *ad7766 = iio_priv(indio_dev); in ad7766_postdisable() local
114 gpiod_set_value(ad7766->pd_gpio, 1); in ad7766_postdisable()
122 clk_disable_unprepare(ad7766->mclk); in ad7766_postdisable()
123 regulator_bulk_disable(ARRAY_SIZE(ad7766->reg), ad7766->reg); in ad7766_postdisable()
131 struct ad7766 *ad7766 = iio_priv(indio_dev); in ad7766_read_raw() local
132 struct regulator *vref = ad7766->reg[AD7766_SUPPLY_VREF].consumer; in ad7766_read_raw()
144 *val = clk_get_rate(ad7766->mclk) / in ad7766_read_raw()
145 ad7766->chip_info->decimation_factor; in ad7766_read_raw()
196 struct ad7766 *ad7766 = iio_trigger_get_drvdata(trig); in ad7766_set_trigger_state() local
199 enable_irq(ad7766->spi->irq); in ad7766_set_trigger_state()
201 disable_irq(ad7766->spi->irq); in ad7766_set_trigger_state()
215 struct ad7766 *ad7766; in ad7766_probe() local
218 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*ad7766)); in ad7766_probe()
222 ad7766 = iio_priv(indio_dev); in ad7766_probe()
223 ad7766->chip_info = &ad7766_chip_info[id->driver_data]; in ad7766_probe()
225 ad7766->mclk = devm_clk_get(&spi->dev, "mclk"); in ad7766_probe()
226 if (IS_ERR(ad7766->mclk)) in ad7766_probe()
227 return PTR_ERR(ad7766->mclk); in ad7766_probe()
229 ad7766->reg[AD7766_SUPPLY_AVDD].supply = "avdd"; in ad7766_probe()
230 ad7766->reg[AD7766_SUPPLY_DVDD].supply = "dvdd"; in ad7766_probe()
231 ad7766->reg[AD7766_SUPPLY_VREF].supply = "vref"; in ad7766_probe()
233 ret = devm_regulator_bulk_get(&spi->dev, ARRAY_SIZE(ad7766->reg), in ad7766_probe()
234 ad7766->reg); in ad7766_probe()
238 ad7766->pd_gpio = devm_gpiod_get_optional(&spi->dev, "powerdown", in ad7766_probe()
240 if (IS_ERR(ad7766->pd_gpio)) in ad7766_probe()
241 return PTR_ERR(ad7766->pd_gpio); in ad7766_probe()
250 ad7766->trig = devm_iio_trigger_alloc(&spi->dev, "%s-dev%d", in ad7766_probe()
252 if (!ad7766->trig) in ad7766_probe()
255 ad7766->trig->ops = &ad7766_trigger_ops; in ad7766_probe()
256 ad7766->trig->dev.parent = &spi->dev; in ad7766_probe()
257 iio_trigger_set_drvdata(ad7766->trig, ad7766); in ad7766_probe()
261 ad7766->trig); in ad7766_probe()
272 ret = devm_iio_trigger_register(&spi->dev, ad7766->trig); in ad7766_probe()
279 ad7766->spi = spi; in ad7766_probe()
282 ad7766->xfer.rx_buf = &ad7766->data[1]; in ad7766_probe()
283 ad7766->xfer.len = 3; in ad7766_probe()
285 spi_message_init(&ad7766->msg); in ad7766_probe()
286 spi_message_add_tail(&ad7766->xfer, &ad7766->msg); in ad7766_probe()