mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Nuno Sá" <nuno.sa@analog.com>
To: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	devicetree@vger.kernel.org
Cc: linux@analog.com,
	Michael Hennerich <Michael.Hennerich@analog.com>,
	Jonathan Cameron <jic23@kernel.org>,
	David Lechner <dlechner@baylibre.com>,
	Andy Shevchenko <andy@kernel.org>, Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>, Arnd Bergmann <arnd@arndb.de>,
	Jonathan Cameron <jic23@kernel.org>
Subject: [PATCH v2 02/11] iio: adc: ad7887: drop platform data support
Date: Wed, 02 Dec 2026 17:05:34 +0000	[thread overview]
Message-ID: <20261202-iio-adi-legacy-platdata-v2-2-0fd64abe73f4@analog.com> (raw)
In-Reply-To: <20261202-iio-adi-legacy-platdata-v2-0-0fd64abe73f4@analog.com>

There are no in-tree users of struct ad7887_platform_data, and the
driver works fine without it. Its only knob, en_dual, selects dual
channel mode, where the AIN1/VREF pin is used as a second input.

Drop the platform data header and default to single channel mode, which
is what the driver does when no platform data is given. The dual
channel code is kept so it can be enabled again should someone need it
and add a firmware property for it.

Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Nuno Sá <nuno.sa@analog.com>

---
As stated in the cover, I'm glad to drop dead code if no one sees value
in keeping it for possible future changes (which are unlikely tbh).
---
 drivers/iio/adc/ad7887.c             | 12 +++++++-----
 include/linux/platform_data/ad7887.h | 21 ---------------------
 2 files changed, 7 insertions(+), 26 deletions(-)

diff --git a/drivers/iio/adc/ad7887.c b/drivers/iio/adc/ad7887.c
index 980e6a303047..1ac8e2ddd44a 100644
--- a/drivers/iio/adc/ad7887.c
+++ b/drivers/iio/adc/ad7887.c
@@ -25,8 +25,6 @@
 #include <linux/iio/trigger_consumer.h>
 #include <linux/iio/triggered_buffer.h>
 
-#include <linux/platform_data/ad7887.h>
-
 #define AD7887_REF_DIS		BIT(5)	/* on-chip reference disable */
 #define AD7887_DUAL		BIT(4)	/* dual-channel mode */
 #define AD7887_CH_AIN1		BIT(3)	/* convert on channel 1, DUAL=1 */
@@ -229,7 +227,11 @@ static void ad7887_reg_disable(void *data)
 
 static int ad7887_probe(struct spi_device *spi)
 {
-	const struct ad7887_platform_data *pdata = dev_get_platdata(&spi->dev);
+	/*
+	 * Dual channel mode is not configurable yet. Keep the support around in
+	 * case someone needs it and adds a firmware property for it.
+	 */
+	bool en_dual = false;
 	struct ad7887_state *st;
 	struct iio_dev *indio_dev;
 	uint8_t mode;
@@ -273,7 +275,7 @@ static int ad7887_probe(struct spi_device *spi)
 	mode = AD7887_PM_MODE4;
 	if (st->reg)
 		mode |= AD7887_REF_DIS;
-	if (pdata && pdata->en_dual)
+	if (en_dual)
 		mode |= AD7887_DUAL;
 
 	st->tx_cmd_buf[0] = AD7887_CH_AIN0 | mode;
@@ -285,7 +287,7 @@ static int ad7887_probe(struct spi_device *spi)
 	spi_message_init(&st->msg[AD7887_CH0]);
 	spi_message_add_tail(&st->xfer[0], &st->msg[AD7887_CH0]);
 
-	if (pdata && pdata->en_dual) {
+	if (en_dual) {
 		st->tx_cmd_buf[2] = AD7887_CH_AIN1 | mode;
 
 		st->xfer[1].rx_buf = &st->data[0];
diff --git a/include/linux/platform_data/ad7887.h b/include/linux/platform_data/ad7887.h
deleted file mode 100644
index 9b4dca6ae70b..000000000000
--- a/include/linux/platform_data/ad7887.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/*
- * AD7887 SPI ADC driver
- *
- * Copyright 2010 Analog Devices Inc.
- */
-#ifndef IIO_ADC_AD7887_H_
-#define IIO_ADC_AD7887_H_
-
-/**
- * struct ad7887_platform_data - AD7887 ADC driver platform data
- * @en_dual: Whether to use dual channel mode. If set to true AIN1 becomes the
- *	second input channel, and Vref is internally connected to Vdd. If set to
- *	false the device is used in single channel mode and AIN1/Vref is used as
- *	VREF input.
- */
-struct ad7887_platform_data {
-	bool en_dual;
-};
-
-#endif /* IIO_ADC_AD7887_H_ */

-- 
2.56.0


  parent reply	other threads:[~2026-12-02 17:06 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02 17:05 [PATCH v2 00/11] iio: adc: drop platform data from some ADI ADC drivers Nuno Sá
2026-12-02 17:05 ` [PATCH v2 01/11] iio: adc: ad7887: fix on-chip reference enable logic Nuno Sá
2026-12-03 11:54   ` Andy Shevchenko
2026-12-02 17:05 ` Nuno Sá [this message]
2026-12-03 11:56   ` [PATCH v2 02/11] iio: adc: ad7887: drop platform data support Andy Shevchenko
2026-12-02 17:05 ` [PATCH v2 03/11] iio: adc: ad7266: " Nuno Sá
2026-12-03 11:57   ` Andy Shevchenko
2026-12-02 17:05 ` [PATCH v2 04/11] iio: adc: ad7791: " Nuno Sá
2026-12-02 17:05 ` [PATCH v2 05/11] dt-bindings: iio: adc: add AD7793 and similar ADCs Nuno Sá
2026-12-02 17:05 ` [PATCH v2 06/11] iio: adc: ad7793: use spi_get_device_match_data() Nuno Sá
2026-12-03 16:37   ` Andy Shevchenko
2026-12-02 17:05 ` [PATCH v2 07/11] iio: adc: ad7793: enable the AVDD and DVDD supplies Nuno Sá
2026-12-03 17:03   ` Andy Shevchenko
2026-12-02 17:05 ` [PATCH v2 08/11] iio: adc: ad7793: move platform data definitions into the driver Nuno Sá
2026-12-03 17:02   ` Andy Shevchenko
2026-12-02 17:05 ` [PATCH v2 09/11] iio: adc: ad7793: rename platform data to config Nuno Sá
2026-12-03 17:26   ` Andy Shevchenko
2026-12-02 17:05 ` [PATCH v2 10/11] iio: adc: ad7793: drop burnout current support Nuno Sá
2026-12-03 17:33   ` Andy Shevchenko
2026-12-02 17:05 ` [PATCH v2 11/11] iio: adc: ad7793: add firmware support Nuno Sá

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261202-iio-adi-legacy-platdata-v2-2-0fd64abe73f4@analog.com \
    --to=nuno.sa@analog.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=andy@kernel.org \
    --cc=arnd@arndb.de \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@analog.com \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®