Skip to content

Commit

Permalink
iio: multiplexer: iio-mux: Support settle-time-us property
Browse files Browse the repository at this point in the history
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@axis.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Tested-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Peter Rosin <peda@axentia.se>
Link: https://lore.kernel.org/r/20211007134641.13417-4-vincent.whitchurch@axis.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
  • Loading branch information
Vincent Whitchurch authored and Jonathan Cameron committed Oct 21, 2021
1 parent b9221f7 commit 39aa504
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/iio/multiplexer/iio-mux.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 39aa504

Please sign in to comment.