From 19098a4922b81d3207fddb971f7a88eb4e4aeb15 Mon Sep 17 00:00:00 2001 From: David Lechner Date: Fri, 13 Oct 2023 11:59:29 -0500 Subject: [PATCH] iio: adc: ad_pulsar: initial support for turbo gpio This adds initial support for the TURBO gpio. The TURBO input is available on some chips (e.g. AD7944) and is used to enable the maximum sample rate at the expense of increased power consumption. For now, the TURBO mode is always enabled. In the future, we can add support to turn it off for lower sample rates. Signed-off-by: David Lechner --- drivers/iio/adc/ad_pulsar.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/iio/adc/ad_pulsar.c b/drivers/iio/adc/ad_pulsar.c index 37d7ba65e48ae5..d925f95749895d 100644 --- a/drivers/iio/adc/ad_pulsar.c +++ b/drivers/iio/adc/ad_pulsar.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -327,6 +328,7 @@ struct ad_pulsar_adc { const struct ad_pulsar_chip_info *info; struct iio_chan_spec *channels; struct spi_transfer *seq_xfer; + struct gpio_desc *turbo_gpio; unsigned int cfg; unsigned long ref_clk_rate; struct pwm_device *cnv; @@ -911,6 +913,13 @@ static int ad_pulsar_probe(struct spi_device *spi) if (ret) return ret; + /* REVISIT: for now, turbo mode is always enabled */ + adc->turbo_gpio = devm_gpiod_get_optional(&spi->dev, "turbo", + GPIOD_OUT_HIGH); + if (IS_ERR(adc->turbo_gpio)) + return dev_err_probe(&spi->dev, PTR_ERR(adc->turbo_gpio), + "Failed to get turbo GPIO\n"); + return devm_iio_device_register(&spi->dev, indio_dev); }