Lines Matching +full:iio +full:- +full:consumer

1 // SPDX-License-Identifier: GPL-2.0
4 * x9250.c -- Renesas X9250 potentiometers IIO driver
12 #include <linux/gpio/consumer.h>
13 #include <linux/iio/iio.h>
16 #include <linux/regulator/consumer.h>
43 return spi_write_then_read(x9250->spi, txbuf, ARRAY_SIZE(txbuf), NULL, 0); in x9250_write8()
53 return spi_write_then_read(x9250->spi, txbuf, ARRAY_SIZE(txbuf), val, 1); in x9250_read8()
77 int ch = chan->channel; in x9250_read_raw()
90 *val = 1000 * x9250->cfg->kohms; in x9250_read_raw()
95 return -EINVAL; in x9250_read_raw()
111 return -EINVAL; in x9250_read_avail()
118 int ch = chan->channel; in x9250_write_raw()
122 return -EINVAL; in x9250_write_raw()
125 return -EINVAL; in x9250_write_raw()
127 gpiod_set_value_cansleep(x9250->wp_gpio, 0); in x9250_write_raw()
129 gpiod_set_value_cansleep(x9250->wp_gpio, 1); in x9250_write_raw()
162 ret = devm_regulator_bulk_get_enable(&spi->dev, ARRAY_SIZE(x9250_regulator_names), in x9250_probe()
165 return dev_err_probe(&spi->dev, ret, "Failed to get regulators\n"); in x9250_probe()
168 * The x9250 needs a 5ms maximum delay after the power-supplies are set in x9250_probe()
173 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*x9250)); in x9250_probe()
175 return -ENOMEM; in x9250_probe()
178 x9250->spi = spi; in x9250_probe()
179 x9250->cfg = spi_get_device_match_data(spi); in x9250_probe()
180 x9250->wp_gpio = devm_gpiod_get_optional(&spi->dev, "wp", GPIOD_OUT_LOW); in x9250_probe()
181 if (IS_ERR(x9250->wp_gpio)) in x9250_probe()
182 return dev_err_probe(&spi->dev, PTR_ERR(x9250->wp_gpio), in x9250_probe()
185 indio_dev->info = &x9250_info; in x9250_probe()
186 indio_dev->channels = x9250_channels; in x9250_probe()
187 indio_dev->num_channels = ARRAY_SIZE(x9250_channels); in x9250_probe()
188 indio_dev->name = x9250->cfg->name; in x9250_probe()
190 return devm_iio_device_register(&spi->dev, indio_dev); in x9250_probe()