[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260119182424.1660601-7-o.rempel@pengutronix.de>
Date: Mon, 19 Jan 2026 19:24:22 +0100
From: Oleksij Rempel <o.rempel@...gutronix.de>
To: Jonathan Cameron <jic23@...nel.org>,
Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>
Cc: Oleksij Rempel <o.rempel@...gutronix.de>,
kernel@...gutronix.de,
linux-kernel@...r.kernel.org,
linux-iio@...r.kernel.org,
devicetree@...r.kernel.org,
Andy Shevchenko <andy@...nel.org>,
David Lechner <dlechner@...libre.com>,
Nuno Sá <nuno.sa@...log.com>,
David Jander <david@...tonic.nl>
Subject: [PATCH v1 6/8] iio: dac: ds4424: clear outputs on probe
The DS44xx devices have no reset pin or reset bit, so output registers
may retain preconfigured values across reboot or warm reset.
Also, the driver suspend/resume path restores from data->raw. When the
device is first probed, data->raw is zero-initialized and may not match
the actual hardware state. A later suspend/resume can therefore change an
output from a preconfigured non-zero value to 0 mA.
Initialize all channels to 0 output current during probe to ensure a
deterministic baseline and consistent suspend/resume behavior.
Signed-off-by: Oleksij Rempel <o.rempel@...gutronix.de>
---
drivers/iio/dac/ds4424.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/drivers/iio/dac/ds4424.c b/drivers/iio/dac/ds4424.c
index a0c60eb89717..2d299a52cede 100644
--- a/drivers/iio/dac/ds4424.c
+++ b/drivers/iio/dac/ds4424.c
@@ -220,6 +220,20 @@ static int ds4424_verify_chip(struct iio_dev *indio_dev)
return ret;
}
+static int ds4424_init(struct iio_dev *indio_dev)
+{
+ int i, ret;
+
+ /* Set all channels to 0 current. */
+ for (i = 0; i < indio_dev->num_channels; i++) {
+ ret = ds4424_set_value(indio_dev, 0, &indio_dev->channels[i]);
+ if (ret < 0)
+ return ret;
+ }
+
+ return 0;
+}
+
static int ds4424_setup_channels(struct i2c_client *client,
struct ds4424_data *data,
struct iio_dev *indio_dev)
@@ -397,6 +411,11 @@ static int ds4424_probe(struct i2c_client *client)
if (ret)
goto fail;
+ /* No reset pin/bit: clear any preconfigured output on probe. */
+ ret = ds4424_init(indio_dev);
+ if (ret)
+ goto fail;
+
indio_dev->modes = INDIO_DIRECT_MODE;
indio_dev->info = &ds4424_iio_info;
--
2.47.3
Powered by blists - more mailing lists