Skip to content

Commit

Permalink
iio: adc: ad_pulsar: initial support for turbo gpio
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
dlech committed Oct 31, 2023
1 parent 9168247 commit 19098a4
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions drivers/iio/adc/ad_pulsar.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <linux/dma-mapping.h>
#include <linux/dmaengine.h>
#include <linux/err.h>
#include <linux/gpio/consumer.h>
#include <linux/jiffies.h>
#include <linux/kernel.h>
#include <linux/module.h>
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit 19098a4

Please sign in to comment.