[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211007134641.13417-4-vincent.whitchurch@axis.com>
Date: Thu, 7 Oct 2021 15:46:41 +0200
From: Vincent Whitchurch <vincent.whitchurch@...s.com>
To: <peda@...ntia.se>, <jic23@...nel.org>, <devicetree@...r.kernel.org>
CC: <kernel@...s.com>, <lars@...afoo.de>, <linux-iio@...r.kernel.org>,
<robh+dt@...nel.org>, <linux-kernel@...r.kernel.org>,
Vincent Whitchurch <vincent.whitchurch@...s.com>
Subject: [PATCH v2 3/3] iio: multiplexer: iio-mux: Support settle-time-us property
If the devicetree specifies that the hardware requires a settle time,
pass this time on to the mux APIs.
Signed-off-by: Vincent Whitchurch <vincent.whitchurch@...s.com>
---
drivers/iio/multiplexer/iio-mux.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/iio/multiplexer/iio-mux.c b/drivers/iio/multiplexer/iio-mux.c
index d54ae5cbe51b..f422d44377df 100644
--- a/drivers/iio/multiplexer/iio-mux.c
+++ b/drivers/iio/multiplexer/iio-mux.c
@@ -33,6 +33,7 @@ struct mux {
struct iio_chan_spec *chan;
struct iio_chan_spec_ext_info *ext_info;
struct mux_child *child;
+ u32 delay_us;
};
static int iio_mux_select(struct mux *mux, int idx)
@@ -42,7 +43,8 @@ static int iio_mux_select(struct mux *mux, int idx)
int ret;
int i;
- ret = mux_control_select(mux->control, chan->channel);
+ ret = mux_control_select_delay(mux->control, chan->channel,
+ mux->delay_us);
if (ret < 0) {
mux->cached_state = -1;
return ret;
@@ -392,6 +394,9 @@ static int mux_probe(struct platform_device *pdev)
mux->parent = parent;
mux->cached_state = -1;
+ mux->delay_us = 0;
+ of_property_read_u32(np, "settle-time-us", &mux->delay_us);
+
indio_dev->name = dev_name(dev);
indio_dev->info = &mux_info;
indio_dev->modes = INDIO_DIRECT_MODE;
--
2.28.0
Powered by blists - more mailing lists