iio: adc: ti-tsc2046: Simplify device handling

The driver was introduced in 2021 and since then only supports a single
chip variant. Simplify the driver by hard-coding the device properties
instead of using the id_table's abstraction for a single chip type.

Also drop the write-only struct member dcfg and the then unused struct
definition.

Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
Reviewed-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This commit is contained in:
Uwe Kleine-König (The Capable Hub) 2026-06-30 17:35:34 +02:00 committed by Jonathan Cameron
parent 0846f13ef4
commit e4f75f2144

View File

@ -121,11 +121,6 @@ struct tsc2046_adc_group_layout {
unsigned int skip;
};
struct tsc2046_adc_dcfg {
const struct iio_chan_spec *channels;
unsigned int num_channels;
};
struct tsc2046_adc_ch_cfg {
unsigned int settling_time_us;
unsigned int oversampling_ratio;
@ -141,7 +136,6 @@ enum tsc2046_state {
struct tsc2046_adc_priv {
struct spi_device *spi;
const struct tsc2046_adc_dcfg *dcfg;
bool internal_vref;
struct iio_trigger *trig;
@ -214,11 +208,6 @@ const struct iio_chan_spec name ## _channels[] = { \
static DECLARE_TI_TSC2046_8_CHANNELS(tsc2046_adc, 12);
static const struct tsc2046_adc_dcfg tsc2046_adc_dcfg_tsc2046e = {
.channels = tsc2046_adc_channels,
.num_channels = ARRAY_SIZE(tsc2046_adc_channels),
};
/*
* Convert time to a number of samples which can be transferred within this
* time.
@ -739,7 +728,6 @@ static void tsc2046_adc_parse_fwnode(struct tsc2046_adc_priv *priv)
static int tsc2046_adc_probe(struct spi_device *spi)
{
const struct tsc2046_adc_dcfg *dcfg;
struct device *dev = &spi->dev;
struct tsc2046_adc_priv *priv;
struct iio_dev *indio_dev;
@ -752,10 +740,6 @@ static int tsc2046_adc_probe(struct spi_device *spi)
return -EINVAL;
}
dcfg = spi_get_device_match_data(spi);
if (!dcfg)
return -EINVAL;
spi->mode &= ~SPI_MODE_X_MASK;
spi->mode |= SPI_MODE_0;
ret = spi_setup(spi);
@ -767,14 +751,13 @@ static int tsc2046_adc_probe(struct spi_device *spi)
return -ENOMEM;
priv = iio_priv(indio_dev);
priv->dcfg = dcfg;
priv->spi = spi;
indio_dev->name = TI_TSC2046_NAME;
indio_dev->modes = INDIO_DIRECT_MODE;
indio_dev->channels = dcfg->channels;
indio_dev->num_channels = dcfg->num_channels;
indio_dev->channels = tsc2046_adc_channels;
indio_dev->num_channels = ARRAY_SIZE(tsc2046_adc_channels);
indio_dev->info = &tsc2046_adc_info;
ret = devm_regulator_get_enable_read_voltage(dev, "vref");
@ -829,13 +812,13 @@ static int tsc2046_adc_probe(struct spi_device *spi)
}
static const struct of_device_id ads7950_of_table[] = {
{ .compatible = "ti,tsc2046e-adc", .data = &tsc2046_adc_dcfg_tsc2046e },
{ .compatible = "ti,tsc2046e-adc" },
{ }
};
MODULE_DEVICE_TABLE(of, ads7950_of_table);
static const struct spi_device_id tsc2046_adc_spi_ids[] = {
{ "tsc2046e-adc", (unsigned long)&tsc2046_adc_dcfg_tsc2046e },
{ .name = "tsc2046e-adc" },
{ }
};
MODULE_DEVICE_TABLE(spi, tsc2046_adc_spi_ids);