summaryrefslogtreecommitdiff
path: root/drivers/iio/adc/max11100.c
diff options
context:
space:
mode:
authorPhil Reid <preid@electromag.com.au>2017-01-16 16:38:24 +0800
committerJonathan Cameron <jic23@kernel.org>2017-01-22 13:21:28 +0000
commitac2bec9d587c6a423a00c7a2d21a8a5928dfedf5 (patch)
tree84fd27c6fb2daeb02b0485067bbd700e56c2a16f /drivers/iio/adc/max11100.c
parent0dbe71c274550a4a848f0b0753337a57f9125c92 (diff)
iio: adc: tlc4541: add support for TI tlc4541 adc
This adds TI's tlc4541 16-bit ADC driver. Which is a single channel ADC. Supports raw and trigger buffer access. Also supports the tlc3541 14-bit device, which has not been tested. Implementation of the tlc3541 is fairly straight forward thou. Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Phil Reid <preid@electromag.com.au> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/adc/max11100.c')
-rw-r--r--drivers/iio/adc/max11100.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/drivers/iio/adc/max11100.c b/drivers/iio/adc/max11100.c
index b738ecf1b234..a088cf99bfe1 100644
--- a/drivers/iio/adc/max11100.c
+++ b/drivers/iio/adc/max11100.c
@@ -30,7 +30,6 @@
#define MAX11100_LSB_DIV (1 << 16)
struct max11100_state {
- const struct max11100_chip_desc *desc;
struct regulator *vref_reg;
struct spi_device *spi;
@@ -49,14 +48,6 @@ static struct iio_chan_spec max11100_channels[] = {
},
};
-static struct max11100_chip_desc {
- unsigned int num_chan;
- const struct iio_chan_spec *channels;
-} max11100_desc = {
- .num_chan = ARRAY_SIZE(max11100_channels),
- .channels = max11100_channels,
-};
-
static int max11100_read_single(struct iio_dev *indio_dev, int *val)
{
int ret;
@@ -127,15 +118,14 @@ static int max11100_probe(struct spi_device *spi)
state = iio_priv(indio_dev);
state->spi = spi;
- state->desc = &max11100_desc;
indio_dev->dev.parent = &spi->dev;
indio_dev->dev.of_node = spi->dev.of_node;
indio_dev->name = "max11100";
indio_dev->info = &max11100_info;
indio_dev->modes = INDIO_DIRECT_MODE;
- indio_dev->channels = state->desc->channels;
- indio_dev->num_channels = state->desc->num_chan;
+ indio_dev->channels = max11100_channels,
+ indio_dev->num_channels = ARRAY_SIZE(max11100_channels),
state->vref_reg = devm_regulator_get(&spi->dev, "vref");
if (IS_ERR(state->vref_reg))
@@ -162,9 +152,8 @@ static int max11100_remove(struct spi_device *spi)
struct iio_dev *indio_dev = spi_get_drvdata(spi);
struct max11100_state *state = iio_priv(indio_dev);
- regulator_disable(state->vref_reg);
-
iio_device_unregister(indio_dev);
+ regulator_disable(state->vref_reg);
return 0;
}