linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] Add settle time support to iio-mux
@ 2021-10-07 13:46 Vincent Whitchurch
  2021-10-07 13:46 ` [PATCH v2 1/3] mux: add support for delay after muxing Vincent Whitchurch
                   ` (4 more replies)
  0 siblings, 5 replies; 21+ messages in thread
From: Vincent Whitchurch @ 2021-10-07 13:46 UTC (permalink / raw)
  To: peda, jic23, devicetree
  Cc: kernel, lars, linux-iio, robh+dt, linux-kernel, Vincent Whitchurch

On one of our boards we use gpio-mux with iio-mux to read voltages using an ADC
from a few different channels, and on this board the input voltage needs some
time to stabilize after a switch of the mux.

This series add devicetree and driver support for this kind of hardware which
requries a settle time after muxing.

v1 -> v2:
- Move property support to iio-mux and delay handling to mux core as suggested
  by Peter.

v1: https://lore.kernel.org/all/20211004153640.20650-1-vincent.whitchurch@axis.com/

Vincent Whitchurch (3):
  mux: add support for delay after muxing
  dt-bindings: iio: io-channel-mux: Add property for settle time
  iio: multiplexer: iio-mux: Support settle-time-us property

 .../iio/multiplexer/io-channel-mux.yaml       |  5 +++
 drivers/iio/multiplexer/iio-mux.c             |  7 +++-
 drivers/mux/core.c                            | 36 ++++++++++++++++---
 include/linux/mux/consumer.h                  | 23 +++++++++---
 include/linux/mux/driver.h                    |  4 +++
 5 files changed, 65 insertions(+), 10 deletions(-)

-- 
2.28.0


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH v2 1/3] mux: add support for delay after muxing
  2021-10-07 13:46 [PATCH v2 0/3] Add settle time support to iio-mux Vincent Whitchurch
@ 2021-10-07 13:46 ` Vincent Whitchurch
  2021-10-07 13:46 ` [PATCH v2 2/3] dt-bindings: iio: io-channel-mux: Add property for settle time Vincent Whitchurch
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 21+ messages in thread
From: Vincent Whitchurch @ 2021-10-07 13:46 UTC (permalink / raw)
  To: peda, jic23, devicetree
  Cc: kernel, lars, linux-iio, robh+dt, linux-kernel, Vincent Whitchurch

Hardware may require some time for the muxed analog signals to settle
after the muxing is changed.  Allow users of the mux subsystem to
specify this delay with the new mux_control_select_delay() function (and
the _try equivalent).

Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com>
---
 drivers/mux/core.c           | 36 +++++++++++++++++++++++++++++++-----
 include/linux/mux/consumer.h | 23 +++++++++++++++++++----
 include/linux/mux/driver.h   |  4 ++++
 3 files changed, 54 insertions(+), 9 deletions(-)

diff --git a/drivers/mux/core.c b/drivers/mux/core.c
index 1fb22388e7e0..dee6945e92f7 100644
--- a/drivers/mux/core.c
+++ b/drivers/mux/core.c
@@ -9,6 +9,7 @@
 
 #define pr_fmt(fmt) "mux-core: " fmt
 
+#include <linux/delay.h>
 #include <linux/device.h>
 #include <linux/err.h>
 #include <linux/export.h>
@@ -116,6 +117,7 @@ struct mux_chip *mux_chip_alloc(struct device *dev,
 		sema_init(&mux->lock, 1);
 		mux->cached_state = MUX_CACHE_UNKNOWN;
 		mux->idle_state = MUX_IDLE_AS_IS;
+		mux->last_change = ktime_get();
 	}
 
 	device_initialize(&mux_chip->dev);
@@ -129,6 +131,8 @@ static int mux_control_set(struct mux_control *mux, int state)
 	int ret = mux->chip->ops->set(mux, state);
 
 	mux->cached_state = ret < 0 ? MUX_CACHE_UNKNOWN : state;
+	if (ret >= 0)
+		mux->last_change = ktime_get();
 
 	return ret;
 }
@@ -314,10 +318,25 @@ static int __mux_control_select(struct mux_control *mux, int state)
 	return ret;
 }
 
+static void mux_control_delay(struct mux_control *mux, unsigned int delay_us)
+{
+	ktime_t delayend;
+	s64 remaining;
+
+	if (!delay_us)
+		return;
+
+	delayend = ktime_add_us(mux->last_change, delay_us);
+	remaining = ktime_us_delta(delayend, ktime_get());
+	if (remaining > 0)
+		fsleep(remaining);
+}
+
 /**
- * mux_control_select() - Select the given multiplexer state.
+ * mux_control_select_delay() - Select the given multiplexer state.
  * @mux: The mux-control to request a change of state from.
  * @state: The new requested state.
+ * @delay_us: The time to delay (in microseconds) if the mux state is changed.
  *
  * On successfully selecting the mux-control state, it will be locked until
  * there is a call to mux_control_deselect(). If the mux-control is already
@@ -331,7 +350,8 @@ static int __mux_control_select(struct mux_control *mux, int state)
  * Return: 0 when the mux-control state has the requested state or a negative
  * errno on error.
  */
-int mux_control_select(struct mux_control *mux, unsigned int state)
+int mux_control_select_delay(struct mux_control *mux, unsigned int state,
+			     unsigned int delay_us)
 {
 	int ret;
 
@@ -340,18 +360,21 @@ int mux_control_select(struct mux_control *mux, unsigned int state)
 		return ret;
 
 	ret = __mux_control_select(mux, state);
+	if (ret >= 0)
+		mux_control_delay(mux, delay_us);
 
 	if (ret < 0)
 		up(&mux->lock);
 
 	return ret;
 }
-EXPORT_SYMBOL_GPL(mux_control_select);
+EXPORT_SYMBOL_GPL(mux_control_select_delay);
 
 /**
  * mux_control_try_select() - Try to select the given multiplexer state.
  * @mux: The mux-control to request a change of state from.
  * @state: The new requested state.
+ * @delay_us: The time to delay (in microseconds) if the mux state is changed.
  *
  * On successfully selecting the mux-control state, it will be locked until
  * mux_control_deselect() called.
@@ -363,7 +386,8 @@ EXPORT_SYMBOL_GPL(mux_control_select);
  * Return: 0 when the mux-control state has the requested state or a negative
  * errno on error. Specifically -EBUSY if the mux-control is contended.
  */
-int mux_control_try_select(struct mux_control *mux, unsigned int state)
+int mux_control_try_select_delay(struct mux_control *mux, unsigned int state,
+				 unsigned int delay_us)
 {
 	int ret;
 
@@ -371,13 +395,15 @@ int mux_control_try_select(struct mux_control *mux, unsigned int state)
 		return -EBUSY;
 
 	ret = __mux_control_select(mux, state);
+	if (ret >= 0)
+		mux_control_delay(mux, delay_us);
 
 	if (ret < 0)
 		up(&mux->lock);
 
 	return ret;
 }
-EXPORT_SYMBOL_GPL(mux_control_try_select);
+EXPORT_SYMBOL_GPL(mux_control_try_select_delay);
 
 /**
  * mux_control_deselect() - Deselect the previously selected multiplexer state.
diff --git a/include/linux/mux/consumer.h b/include/linux/mux/consumer.h
index 5fc6bb2fefad..7a09b040ac39 100644
--- a/include/linux/mux/consumer.h
+++ b/include/linux/mux/consumer.h
@@ -16,10 +16,25 @@ struct device;
 struct mux_control;
 
 unsigned int mux_control_states(struct mux_control *mux);
-int __must_check mux_control_select(struct mux_control *mux,
-				    unsigned int state);
-int __must_check mux_control_try_select(struct mux_control *mux,
-					unsigned int state);
+int __must_check mux_control_select_delay(struct mux_control *mux,
+					  unsigned int state,
+					  unsigned int delay_us);
+int __must_check mux_control_try_select_delay(struct mux_control *mux,
+					      unsigned int state,
+					      unsigned int delay_us);
+
+static inline int __must_check mux_control_select(struct mux_control *mux,
+						  unsigned int state)
+{
+	return mux_control_select_delay(mux, state, 0);
+}
+
+static inline int __must_check mux_control_try_select(struct mux_control *mux,
+						      unsigned int state)
+{
+	return mux_control_try_select_delay(mux, state, 0);
+}
+
 int mux_control_deselect(struct mux_control *mux);
 
 struct mux_control *mux_control_get(struct device *dev, const char *mux_name);
diff --git a/include/linux/mux/driver.h b/include/linux/mux/driver.h
index 627a2c6bc02d..18824064f8c0 100644
--- a/include/linux/mux/driver.h
+++ b/include/linux/mux/driver.h
@@ -12,6 +12,7 @@
 
 #include <dt-bindings/mux/mux.h>
 #include <linux/device.h>
+#include <linux/ktime.h>
 #include <linux/semaphore.h>
 
 struct mux_chip;
@@ -33,6 +34,7 @@ struct mux_control_ops {
  * @states:		The number of mux controller states.
  * @idle_state:		The mux controller state to use when inactive, or one
  *			of MUX_IDLE_AS_IS and MUX_IDLE_DISCONNECT.
+ * @last_change:	Timestamp of last change
  *
  * Mux drivers may only change @states and @idle_state, and may only do so
  * between allocation and registration of the mux controller. Specifically,
@@ -47,6 +49,8 @@ struct mux_control {
 
 	unsigned int states;
 	int idle_state;
+
+	ktime_t last_change;
 };
 
 /**
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v2 2/3] dt-bindings: iio: io-channel-mux: Add property for settle time
  2021-10-07 13:46 [PATCH v2 0/3] Add settle time support to iio-mux Vincent Whitchurch
  2021-10-07 13:46 ` [PATCH v2 1/3] mux: add support for delay after muxing Vincent Whitchurch
@ 2021-10-07 13:46 ` Vincent Whitchurch
  2021-10-08  2:46   ` Rob Herring
                     ` (2 more replies)
  2021-10-07 13:46 ` [PATCH v2 3/3] iio: multiplexer: iio-mux: Support settle-time-us property Vincent Whitchurch
                   ` (2 subsequent siblings)
  4 siblings, 3 replies; 21+ messages in thread
From: Vincent Whitchurch @ 2021-10-07 13:46 UTC (permalink / raw)
  To: peda, jic23, devicetree
  Cc: kernel, lars, linux-iio, robh+dt, linux-kernel, Vincent Whitchurch

Hardware may require some time for the muxed analog signals to settle
after the muxing is changed.  Allow this time to be specified in the
devicetree.

Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com>
---
 .../devicetree/bindings/iio/multiplexer/io-channel-mux.yaml  | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/Documentation/devicetree/bindings/iio/multiplexer/io-channel-mux.yaml b/Documentation/devicetree/bindings/iio/multiplexer/io-channel-mux.yaml
index 870b043406d8..5a7328042c76 100644
--- a/Documentation/devicetree/bindings/iio/multiplexer/io-channel-mux.yaml
+++ b/Documentation/devicetree/bindings/iio/multiplexer/io-channel-mux.yaml
@@ -39,6 +39,11 @@ properties:
     description:
       List of strings, labeling the mux controller states.
 
+  settle-time-us:
+    default: 0
+    description:
+      Time required for analog signals to settle after muxing.
+
 required:
   - compatible
   - io-channels
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v2 3/3] iio: multiplexer: iio-mux: Support settle-time-us property
  2021-10-07 13:46 [PATCH v2 0/3] Add settle time support to iio-mux Vincent Whitchurch
  2021-10-07 13:46 ` [PATCH v2 1/3] mux: add support for delay after muxing Vincent Whitchurch
  2021-10-07 13:46 ` [PATCH v2 2/3] dt-bindings: iio: io-channel-mux: Add property for settle time Vincent Whitchurch
@ 2021-10-07 13:46 ` Vincent Whitchurch
  2021-10-08 19:19 ` [PATCH v2 0/3] Add settle time support to iio-mux Lars-Peter Clausen
  2021-10-08 23:09 ` Peter Rosin
  4 siblings, 0 replies; 21+ messages in thread
From: Vincent Whitchurch @ 2021-10-07 13:46 UTC (permalink / raw)
  To: peda, jic23, devicetree
  Cc: kernel, lars, linux-iio, robh+dt, linux-kernel, Vincent Whitchurch

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>
---
 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


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 2/3] dt-bindings: iio: io-channel-mux: Add property for settle time
  2021-10-07 13:46 ` [PATCH v2 2/3] dt-bindings: iio: io-channel-mux: Add property for settle time Vincent Whitchurch
@ 2021-10-08  2:46   ` Rob Herring
  2021-10-08 13:56     ` Vincent Whitchurch
  2021-10-08 22:11     ` [PATCH 4/3] dt-bindings: iio: io-channel-mux: add optional #io-channel-cells Peter Rosin
  2021-10-08 22:11   ` [PATCH 5/3] dt-bindings: iio: io-channel-mux: allow duplicate channel, labels Peter Rosin
  2021-10-18 19:52   ` [PATCH v2 2/3] dt-bindings: iio: io-channel-mux: Add property for settle time Rob Herring
  2 siblings, 2 replies; 21+ messages in thread
From: Rob Herring @ 2021-10-08  2:46 UTC (permalink / raw)
  To: Vincent Whitchurch
  Cc: kernel, linux-iio, robh+dt, peda, lars, jic23, linux-kernel, devicetree

On Thu, 07 Oct 2021 15:46:40 +0200, Vincent Whitchurch wrote:
> Hardware may require some time for the muxed analog signals to settle
> after the muxing is changed.  Allow this time to be specified in the
> devicetree.
> 
> Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com>
> ---
>  .../devicetree/bindings/iio/multiplexer/io-channel-mux.yaml  | 5 +++++
>  1 file changed, 5 insertions(+)
> 

Running 'make dtbs_check' with the schema in this patch gives the
following warnings. Consider if they are expected or the schema is
incorrect. These may not be new warnings.

Note that it is not yet a requirement to have 0 warnings for dtbs_check.
This will change in the future.

Full log is available here: https://patchwork.ozlabs.org/patch/1537724


adc0mux: '#io-channel-cells' does not match any of the regexes: 'pinctrl-[0-9]+'
	arch/arm/boot/dts/aspeed-bmc-ampere-mtjade.dt.yaml

adc10mux: '#io-channel-cells' does not match any of the regexes: 'pinctrl-[0-9]+'
	arch/arm/boot/dts/aspeed-bmc-ampere-mtjade.dt.yaml

adc11mux: '#io-channel-cells' does not match any of the regexes: 'pinctrl-[0-9]+'
	arch/arm/boot/dts/aspeed-bmc-ampere-mtjade.dt.yaml

adc12mux: '#io-channel-cells' does not match any of the regexes: 'pinctrl-[0-9]+'
	arch/arm/boot/dts/aspeed-bmc-ampere-mtjade.dt.yaml

adc13mux: '#io-channel-cells' does not match any of the regexes: 'pinctrl-[0-9]+'
	arch/arm/boot/dts/aspeed-bmc-ampere-mtjade.dt.yaml

adc1mux: '#io-channel-cells' does not match any of the regexes: 'pinctrl-[0-9]+'
	arch/arm/boot/dts/aspeed-bmc-ampere-mtjade.dt.yaml

adc2mux: '#io-channel-cells' does not match any of the regexes: 'pinctrl-[0-9]+'
	arch/arm/boot/dts/aspeed-bmc-ampere-mtjade.dt.yaml

adc3mux: '#io-channel-cells' does not match any of the regexes: 'pinctrl-[0-9]+'
	arch/arm/boot/dts/aspeed-bmc-ampere-mtjade.dt.yaml

adc4mux: '#io-channel-cells' does not match any of the regexes: 'pinctrl-[0-9]+'
	arch/arm/boot/dts/aspeed-bmc-ampere-mtjade.dt.yaml

adc5mux: '#io-channel-cells' does not match any of the regexes: 'pinctrl-[0-9]+'
	arch/arm/boot/dts/aspeed-bmc-ampere-mtjade.dt.yaml

adc6mux: '#io-channel-cells' does not match any of the regexes: 'pinctrl-[0-9]+'
	arch/arm/boot/dts/aspeed-bmc-ampere-mtjade.dt.yaml

adc7mux: '#io-channel-cells' does not match any of the regexes: 'pinctrl-[0-9]+'
	arch/arm/boot/dts/aspeed-bmc-ampere-mtjade.dt.yaml

adc8mux: '#io-channel-cells' does not match any of the regexes: 'pinctrl-[0-9]+'
	arch/arm/boot/dts/aspeed-bmc-ampere-mtjade.dt.yaml

adc9mux: '#io-channel-cells' does not match any of the regexes: 'pinctrl-[0-9]+'
	arch/arm/boot/dts/aspeed-bmc-ampere-mtjade.dt.yaml

envelope-detector-mux: channels: ['', '', 'sync-1', 'in', 'out', 'sync-2', 'sys-reg', 'ana-reg'] has non-unique elements
	arch/arm/boot/dts/at91-tse850-3.dt.yaml


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 2/3] dt-bindings: iio: io-channel-mux: Add property for settle time
  2021-10-08  2:46   ` Rob Herring
@ 2021-10-08 13:56     ` Vincent Whitchurch
  2021-10-08 15:27       ` Peter Rosin
  2021-10-08 22:11     ` [PATCH 4/3] dt-bindings: iio: io-channel-mux: add optional #io-channel-cells Peter Rosin
  1 sibling, 1 reply; 21+ messages in thread
From: Vincent Whitchurch @ 2021-10-08 13:56 UTC (permalink / raw)
  To: Rob Herring
  Cc: kernel, linux-iio, robh+dt, peda, lars, jic23, linux-kernel, devicetree

On Fri, Oct 08, 2021 at 04:46:12AM +0200, Rob Herring wrote:
> On Thu, 07 Oct 2021 15:46:40 +0200, Vincent Whitchurch wrote:
> > Hardware may require some time for the muxed analog signals to settle
> > after the muxing is changed.  Allow this time to be specified in the
> > devicetree.
> > 
> > Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com>
> > ---
> >  .../devicetree/bindings/iio/multiplexer/io-channel-mux.yaml  | 5 +++++
> >  1 file changed, 5 insertions(+)
> > 
> 
> Running 'make dtbs_check' with the schema in this patch gives the
> following warnings. Consider if they are expected or the schema is
> incorrect. These may not be new warnings.

Yes, these are not new warnings.

> Note that it is not yet a requirement to have 0 warnings for dtbs_check.
> This will change in the future.
> 
> Full log is available here: https://patchwork.ozlabs.org/patch/1537724
> 
> 
> adc0mux: '#io-channel-cells' does not match any of the regexes: 'pinctrl-[0-9]+'
> 	arch/arm/boot/dts/aspeed-bmc-ampere-mtjade.dt.yaml
> 
> adc10mux: '#io-channel-cells' does not match any of the regexes: 'pinctrl-[0-9]+'
> 	arch/arm/boot/dts/aspeed-bmc-ampere-mtjade.dt.yaml
[...]

I think the fix for these is to add a "#io-channel-cells": const 1 to
the schema.

> envelope-detector-mux: channels: ['', '', 'sync-1', 'in', 'out', 'sync-2', 'sys-reg', 'ana-reg'] has non-unique elements
> 	arch/arm/boot/dts/at91-tse850-3.dt.yaml

This one looks like an error in that particular devicetree.

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 2/3] dt-bindings: iio: io-channel-mux: Add property for settle time
  2021-10-08 13:56     ` Vincent Whitchurch
@ 2021-10-08 15:27       ` Peter Rosin
  2021-10-08 19:13         ` Rob Herring
  0 siblings, 1 reply; 21+ messages in thread
From: Peter Rosin @ 2021-10-08 15:27 UTC (permalink / raw)
  To: Vincent Whitchurch, Rob Herring
  Cc: kernel, linux-iio, robh+dt, lars, jic23, linux-kernel, devicetree

On 2021-10-08 15:56, Vincent Whitchurch wrote:
> On Fri, Oct 08, 2021 at 04:46:12AM +0200, Rob Herring wrote:
>> On Thu, 07 Oct 2021 15:46:40 +0200, Vincent Whitchurch wrote:
>>> Hardware may require some time for the muxed analog signals to settle
>>> after the muxing is changed.  Allow this time to be specified in the
>>> devicetree.
>>>
>>> Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com>
>>> ---
>>>  .../devicetree/bindings/iio/multiplexer/io-channel-mux.yaml  | 5 +++++
>>>  1 file changed, 5 insertions(+)
>>>
>>
>> Running 'make dtbs_check' with the schema in this patch gives the
>> following warnings. Consider if they are expected or the schema is
>> incorrect. These may not be new warnings.
> 
> Yes, these are not new warnings.
> 
>> Note that it is not yet a requirement to have 0 warnings for dtbs_check.
>> This will change in the future.
>>
>> Full log is available here: https://patchwork.ozlabs.org/patch/1537724
>>
>>
>> adc0mux: '#io-channel-cells' does not match any of the regexes: 'pinctrl-[0-9]+'
>> 	arch/arm/boot/dts/aspeed-bmc-ampere-mtjade.dt.yaml
>>
>> adc10mux: '#io-channel-cells' does not match any of the regexes: 'pinctrl-[0-9]+'
>> 	arch/arm/boot/dts/aspeed-bmc-ampere-mtjade.dt.yaml
> [...]
> 
> I think the fix for these is to add a "#io-channel-cells": const 1 to
> the schema.

Agreed.

>> envelope-detector-mux: channels: ['', '', 'sync-1', 'in', 'out', 'sync-2', 'sys-reg', 'ana-reg'] has non-unique elements
>> 	arch/arm/boot/dts/at91-tse850-3.dt.yaml
> 
> This one looks like an error in that particular devicetree.
> 
The double '' is intentional; this mux is 8-way but only 6 legs are
connected, with the first two unused. I don't know how or where to make
changes to dodge the warning. I don't want to put names on things that
do not exist, and the iio-mux driver is using empty names as a hint to
not configure any child channel for those indices that have empty names.
If e.g. channels 0-5 are in use, then this is not a problem since you
can just end early with 6 names instead of 8, but alas, channels 2-7
was what the hw-crowd fancied in this case.

Cheers,
Peter

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 2/3] dt-bindings: iio: io-channel-mux: Add property for settle time
  2021-10-08 15:27       ` Peter Rosin
@ 2021-10-08 19:13         ` Rob Herring
  0 siblings, 0 replies; 21+ messages in thread
From: Rob Herring @ 2021-10-08 19:13 UTC (permalink / raw)
  To: Peter Rosin
  Cc: Vincent Whitchurch, kernel, linux-iio, lars, jic23, linux-kernel,
	devicetree

On Fri, Oct 8, 2021 at 10:27 AM Peter Rosin <peda@axentia.se> wrote:
>
> On 2021-10-08 15:56, Vincent Whitchurch wrote:
> > On Fri, Oct 08, 2021 at 04:46:12AM +0200, Rob Herring wrote:
> >> On Thu, 07 Oct 2021 15:46:40 +0200, Vincent Whitchurch wrote:
> >>> Hardware may require some time for the muxed analog signals to settle
> >>> after the muxing is changed.  Allow this time to be specified in the
> >>> devicetree.
> >>>
> >>> Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com>
> >>> ---
> >>>  .../devicetree/bindings/iio/multiplexer/io-channel-mux.yaml  | 5 +++++
> >>>  1 file changed, 5 insertions(+)
> >>>
> >>
> >> Running 'make dtbs_check' with the schema in this patch gives the
> >> following warnings. Consider if they are expected or the schema is
> >> incorrect. These may not be new warnings.
> >
> > Yes, these are not new warnings.
> >
> >> Note that it is not yet a requirement to have 0 warnings for dtbs_check.
> >> This will change in the future.
> >>
> >> Full log is available here: https://patchwork.ozlabs.org/patch/1537724
> >>
> >>
> >> adc0mux: '#io-channel-cells' does not match any of the regexes: 'pinctrl-[0-9]+'
> >>      arch/arm/boot/dts/aspeed-bmc-ampere-mtjade.dt.yaml
> >>
> >> adc10mux: '#io-channel-cells' does not match any of the regexes: 'pinctrl-[0-9]+'
> >>      arch/arm/boot/dts/aspeed-bmc-ampere-mtjade.dt.yaml
> > [...]
> >
> > I think the fix for these is to add a "#io-channel-cells": const 1 to
> > the schema.
>
> Agreed.
>
> >> envelope-detector-mux: channels: ['', '', 'sync-1', 'in', 'out', 'sync-2', 'sys-reg', 'ana-reg'] has non-unique elements
> >>      arch/arm/boot/dts/at91-tse850-3.dt.yaml
> >
> > This one looks like an error in that particular devicetree.
> >
> The double '' is intentional; this mux is 8-way but only 6 legs are
> connected, with the first two unused. I don't know how or where to make
> changes to dodge the warning. I don't want to put names on things that
> do not exist, and the iio-mux driver is using empty names as a hint to
> not configure any child channel for those indices that have empty names.
> If e.g. channels 0-5 are in use, then this is not a problem since you
> can just end early with 6 names instead of 8, but alas, channels 2-7
> was what the hw-crowd fancied in this case.

There's a specific string type for this: non-unique-string-array

Unfortunately, no way to say unique or empty strings.

Rob

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 0/3] Add settle time support to iio-mux
  2021-10-07 13:46 [PATCH v2 0/3] Add settle time support to iio-mux Vincent Whitchurch
                   ` (2 preceding siblings ...)
  2021-10-07 13:46 ` [PATCH v2 3/3] iio: multiplexer: iio-mux: Support settle-time-us property Vincent Whitchurch
@ 2021-10-08 19:19 ` Lars-Peter Clausen
  2021-10-19  7:03   ` Lars-Peter Clausen
  2021-10-08 23:09 ` Peter Rosin
  4 siblings, 1 reply; 21+ messages in thread
From: Lars-Peter Clausen @ 2021-10-08 19:19 UTC (permalink / raw)
  To: Vincent Whitchurch, peda, jic23, devicetree
  Cc: kernel, linux-iio, robh+dt, linux-kernel

On 10/7/21 3:46 PM, Vincent Whitchurch wrote:
> On one of our boards we use gpio-mux with iio-mux to read voltages using an ADC
> from a few different channels, and on this board the input voltage needs some
> time to stabilize after a switch of the mux.
>
> This series add devicetree and driver support for this kind of hardware which
> requries a settle time after muxing.

I have a board with the very same problem. And a similar solution, but 
you beat me with upstreaming. I've switched to your patchset.

Whole series

Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>

Acked-by: Lars-Peter Clausen <lars@metafoo.de>


>
> v1 -> v2:
> - Move property support to iio-mux and delay handling to mux core as suggested
>    by Peter.
>
> v1: https://lore.kernel.org/all/20211004153640.20650-1-vincent.whitchurch@axis.com/
>
> Vincent Whitchurch (3):
>    mux: add support for delay after muxing
>    dt-bindings: iio: io-channel-mux: Add property for settle time
>    iio: multiplexer: iio-mux: Support settle-time-us property
>
>   .../iio/multiplexer/io-channel-mux.yaml       |  5 +++
>   drivers/iio/multiplexer/iio-mux.c             |  7 +++-
>   drivers/mux/core.c                            | 36 ++++++++++++++++---
>   include/linux/mux/consumer.h                  | 23 +++++++++---
>   include/linux/mux/driver.h                    |  4 +++
>   5 files changed, 65 insertions(+), 10 deletions(-)
>


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 4/3] dt-bindings: iio: io-channel-mux: add optional #io-channel-cells
  2021-10-08  2:46   ` Rob Herring
  2021-10-08 13:56     ` Vincent Whitchurch
@ 2021-10-08 22:11     ` Peter Rosin
  2021-10-19 21:25       ` Rob Herring
  1 sibling, 1 reply; 21+ messages in thread
From: Peter Rosin @ 2021-10-08 22:11 UTC (permalink / raw)
  To: Rob Herring, Vincent Whitchurch
  Cc: kernel, linux-iio, robh+dt, lars, jic23, linux-kernel, devicetree

Needed for in-kernel use of the child channels of the mux.

Fixes problems like this, reported by dtbs_check:
adc0mux: '#io-channel-cells' does not match any of the regexes: 'pinctrl-[0-9]+'
	arch/arm/boot/dts/aspeed-bmc-ampere-mtjade.dt.yaml

Suggested-by: Vincent Whitchurch <vincent.whitchurch@axis.com>
Signed-off-by: Peter Rosin <peda@axentia.se>
---
 .../devicetree/bindings/iio/multiplexer/io-channel-mux.yaml    | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Documentation/devicetree/bindings/iio/multiplexer/io-channel-mux.yaml b/Documentation/devicetree/bindings/iio/multiplexer/io-channel-mux.yaml
index 5a7328042c76..80b6229a6fad 100644
--- a/Documentation/devicetree/bindings/iio/multiplexer/io-channel-mux.yaml
+++ b/Documentation/devicetree/bindings/iio/multiplexer/io-channel-mux.yaml
@@ -44,6 +44,9 @@ properties:
     description:
       Time required for analog signals to settle after muxing.
 
+  "#io-channel-cells":
+    const: 1
+
 required:
   - compatible
   - io-channels
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 5/3] dt-bindings: iio: io-channel-mux: allow duplicate channel, labels
  2021-10-07 13:46 ` [PATCH v2 2/3] dt-bindings: iio: io-channel-mux: Add property for settle time Vincent Whitchurch
  2021-10-08  2:46   ` Rob Herring
@ 2021-10-08 22:11   ` Peter Rosin
  2021-10-19 21:25     ` Rob Herring
  2021-10-18 19:52   ` [PATCH v2 2/3] dt-bindings: iio: io-channel-mux: Add property for settle time Rob Herring
  2 siblings, 1 reply; 21+ messages in thread
From: Peter Rosin @ 2021-10-08 22:11 UTC (permalink / raw)
  To: Vincent Whitchurch, jic23, devicetree
  Cc: kernel, lars, linux-iio, robh+dt, linux-kernel

This is needed since an empty channel label is used to indicate an
unused channel, and there can be more that one of those.

Fixes the following problem reported by dtbs_check:
envelope-detector-mux: channels: ['', '', 'sync-1', 'in', 'out', 'sync-2', 'sys-reg', 'ana-reg'] has non-unique elements
	arch/arm/boot/dts/at91-tse850-3.dt.yaml

Suggested-by: Rob Herring <robh@kernel.org>
Signed-off-by: Peter Rosin <peda@axentia.se>
---
 .../devicetree/bindings/iio/multiplexer/io-channel-mux.yaml  | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/iio/multiplexer/io-channel-mux.yaml b/Documentation/devicetree/bindings/iio/multiplexer/io-channel-mux.yaml
index 80b6229a6fad..611ad4444cf0 100644
--- a/Documentation/devicetree/bindings/iio/multiplexer/io-channel-mux.yaml
+++ b/Documentation/devicetree/bindings/iio/multiplexer/io-channel-mux.yaml
@@ -35,9 +35,10 @@ properties:
   mux-control-names: true
 
   channels:
-    $ref: /schemas/types.yaml#/definitions/string-array
+    $ref: /schemas/types.yaml#/definitions/non-unique-string-array
     description:
-      List of strings, labeling the mux controller states.
+      List of strings, labeling the mux controller states. An empty
+      string for a state means that the channel is not available.
 
   settle-time-us:
     default: 0
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 0/3] Add settle time support to iio-mux
  2021-10-07 13:46 [PATCH v2 0/3] Add settle time support to iio-mux Vincent Whitchurch
                   ` (3 preceding siblings ...)
  2021-10-08 19:19 ` [PATCH v2 0/3] Add settle time support to iio-mux Lars-Peter Clausen
@ 2021-10-08 23:09 ` Peter Rosin
  2021-10-17 17:31   ` Jonathan Cameron
  4 siblings, 1 reply; 21+ messages in thread
From: Peter Rosin @ 2021-10-08 23:09 UTC (permalink / raw)
  To: Vincent Whitchurch, jic23, devicetree
  Cc: kernel, lars, linux-iio, robh+dt, linux-kernel

Hi Vincent!

On 2021-10-07 15:46, Vincent Whitchurch wrote:
> On one of our boards we use gpio-mux with iio-mux to read voltages using an ADC
> from a few different channels, and on this board the input voltage needs some
> time to stabilize after a switch of the mux.
> 
> This series add devicetree and driver support for this kind of hardware which
> requries a settle time after muxing.
> 
> v1 -> v2:
> - Move property support to iio-mux and delay handling to mux core as suggested
>   by Peter.
> 
> v1: https://lore.kernel.org/all/20211004153640.20650-1-vincent.whitchurch@axis.com/
> 
> Vincent Whitchurch (3):
>   mux: add support for delay after muxing
>   dt-bindings: iio: io-channel-mux: Add property for settle time
>   iio: multiplexer: iio-mux: Support settle-time-us property
> 
>  .../iio/multiplexer/io-channel-mux.yaml       |  5 +++
>  drivers/iio/multiplexer/iio-mux.c             |  7 +++-
>  drivers/mux/core.c                            | 36 ++++++++++++++++---
>  include/linux/mux/consumer.h                  | 23 +++++++++---
>  include/linux/mux/driver.h                    |  4 +++
>  5 files changed, 65 insertions(+), 10 deletions(-)
> 

This looks really nice, thank you! The only question I see is if it should
go via my (virtually unused) mux tree or via the iio tree. Yes, the meat is
in mux/core.c, but I'm happy to just ack these patches and have Jonathan
handle them. But, I'm also fine with handling it in the mux tree (but I'm
getting old and forgetful, and it's been so many moons that I need to
re-learn the steps).

Jonathan, you or me? If you, you can add:

Acked-by: Peter Rosin <peda@axentia.se>

Cheers,
Peter

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 0/3] Add settle time support to iio-mux
  2021-10-08 23:09 ` Peter Rosin
@ 2021-10-17 17:31   ` Jonathan Cameron
  2021-10-17 21:08     ` Peter Rosin
  0 siblings, 1 reply; 21+ messages in thread
From: Jonathan Cameron @ 2021-10-17 17:31 UTC (permalink / raw)
  To: Peter Rosin
  Cc: Vincent Whitchurch, devicetree, kernel, lars, linux-iio, robh+dt,
	linux-kernel

On Sat, 9 Oct 2021 01:09:56 +0200
Peter Rosin <peda@axentia.se> wrote:

> Hi Vincent!
> 
> On 2021-10-07 15:46, Vincent Whitchurch wrote:
> > On one of our boards we use gpio-mux with iio-mux to read voltages using an ADC
> > from a few different channels, and on this board the input voltage needs some
> > time to stabilize after a switch of the mux.
> > 
> > This series add devicetree and driver support for this kind of hardware which
> > requries a settle time after muxing.
> > 
> > v1 -> v2:
> > - Move property support to iio-mux and delay handling to mux core as suggested
> >   by Peter.
> > 
> > v1: https://lore.kernel.org/all/20211004153640.20650-1-vincent.whitchurch@axis.com/
> > 
> > Vincent Whitchurch (3):
> >   mux: add support for delay after muxing
> >   dt-bindings: iio: io-channel-mux: Add property for settle time
> >   iio: multiplexer: iio-mux: Support settle-time-us property
> > 
> >  .../iio/multiplexer/io-channel-mux.yaml       |  5 +++
> >  drivers/iio/multiplexer/iio-mux.c             |  7 +++-
> >  drivers/mux/core.c                            | 36 ++++++++++++++++---
> >  include/linux/mux/consumer.h                  | 23 +++++++++---
> >  include/linux/mux/driver.h                    |  4 +++
> >  5 files changed, 65 insertions(+), 10 deletions(-)
> >   
> 
> This looks really nice, thank you! The only question I see is if it should
> go via my (virtually unused) mux tree or via the iio tree. Yes, the meat is
> in mux/core.c, but I'm happy to just ack these patches and have Jonathan
> handle them. But, I'm also fine with handling it in the mux tree (but I'm
> getting old and forgetful, and it's been so many moons that I need to
> re-learn the steps).
> 
> Jonathan, you or me? If you, you can add:
> 
> Acked-by: Peter Rosin <peda@axentia.se>

I don't really mind, but the 4/3 and 5/3 have broken my b4 based flow + Rob
hasn't yet given an Ack on those two, so I'll not pick any of them up just yet.
I can sort out the two oddly numbered patches if Rob is happy, though they'll
probably not have the nice link tags that b4 automates.

Note Rob didn't actually say he was happy with patch 2 yet as far as I can tell.

Thanks,

Jonathan

> 
> Cheers,
> Peter


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 0/3] Add settle time support to iio-mux
  2021-10-17 17:31   ` Jonathan Cameron
@ 2021-10-17 21:08     ` Peter Rosin
  2021-10-18 20:13       ` Jonathan Cameron
  0 siblings, 1 reply; 21+ messages in thread
From: Peter Rosin @ 2021-10-17 21:08 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Vincent Whitchurch, devicetree, kernel, lars, linux-iio, robh+dt,
	linux-kernel

On 2021-10-17 19:31, Jonathan Cameron wrote:
> On Sat, 9 Oct 2021 01:09:56 +0200
> Peter Rosin <peda@axentia.se> wrote:
> 
>> Hi Vincent!
>>
>> On 2021-10-07 15:46, Vincent Whitchurch wrote:
>>> On one of our boards we use gpio-mux with iio-mux to read voltages using an ADC
>>> from a few different channels, and on this board the input voltage needs some
>>> time to stabilize after a switch of the mux.
>>>
>>> This series add devicetree and driver support for this kind of hardware which
>>> requries a settle time after muxing.
>>>
>>> v1 -> v2:
>>> - Move property support to iio-mux and delay handling to mux core as suggested
>>>   by Peter.
>>>
>>> v1: https://lore.kernel.org/all/20211004153640.20650-1-vincent.whitchurch@axis.com/
>>>
>>> Vincent Whitchurch (3):
>>>   mux: add support for delay after muxing
>>>   dt-bindings: iio: io-channel-mux: Add property for settle time
>>>   iio: multiplexer: iio-mux: Support settle-time-us property
>>>
>>>  .../iio/multiplexer/io-channel-mux.yaml       |  5 +++
>>>  drivers/iio/multiplexer/iio-mux.c             |  7 +++-
>>>  drivers/mux/core.c                            | 36 ++++++++++++++++---
>>>  include/linux/mux/consumer.h                  | 23 +++++++++---
>>>  include/linux/mux/driver.h                    |  4 +++
>>>  5 files changed, 65 insertions(+), 10 deletions(-)
>>>   
>>
>> This looks really nice, thank you! The only question I see is if it should
>> go via my (virtually unused) mux tree or via the iio tree. Yes, the meat is
>> in mux/core.c, but I'm happy to just ack these patches and have Jonathan
>> handle them. But, I'm also fine with handling it in the mux tree (but I'm
>> getting old and forgetful, and it's been so many moons that I need to
>> re-learn the steps).
>>
>> Jonathan, you or me? If you, you can add:
>>
>> Acked-by: Peter Rosin <peda@axentia.se>
> 
> I don't really mind, but the 4/3 and 5/3 have broken my b4 based flow + Rob
> hasn't yet given an Ack on those two, so I'll not pick any of them up just yet.
> I can sort out the two oddly numbered patches if Rob is happy, though they'll
> probably not have the nice link tags that b4 automates.
> 
> Note Rob didn't actually say he was happy with patch 2 yet as far as I can tell.

Getting Rob's ack on 2/3 is of course a prerequisite to 1/3 and 3/3.

Just ignore 4/3 and 5/3 if they are holding things back or are making things
difficult in any way. I'll resend them later if need be, as they really have
very little to do with this series.

With hindsight I should probably have sent them as a fresh series, and I can
re-post them as such immediately if that helps? But then again, maybe that
just muddies the water even further...

Cheers,
Peter

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 2/3] dt-bindings: iio: io-channel-mux: Add property for settle time
  2021-10-07 13:46 ` [PATCH v2 2/3] dt-bindings: iio: io-channel-mux: Add property for settle time Vincent Whitchurch
  2021-10-08  2:46   ` Rob Herring
  2021-10-08 22:11   ` [PATCH 5/3] dt-bindings: iio: io-channel-mux: allow duplicate channel, labels Peter Rosin
@ 2021-10-18 19:52   ` Rob Herring
  2 siblings, 0 replies; 21+ messages in thread
From: Rob Herring @ 2021-10-18 19:52 UTC (permalink / raw)
  To: Vincent Whitchurch
  Cc: kernel, lars, linux-iio, linux-kernel, robh+dt, jic23, devicetree, peda

On Thu, 07 Oct 2021 15:46:40 +0200, Vincent Whitchurch wrote:
> Hardware may require some time for the muxed analog signals to settle
> after the muxing is changed.  Allow this time to be specified in the
> devicetree.
> 
> Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com>
> ---
>  .../devicetree/bindings/iio/multiplexer/io-channel-mux.yaml  | 5 +++++
>  1 file changed, 5 insertions(+)
> 

Reviewed-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 0/3] Add settle time support to iio-mux
  2021-10-17 21:08     ` Peter Rosin
@ 2021-10-18 20:13       ` Jonathan Cameron
  0 siblings, 0 replies; 21+ messages in thread
From: Jonathan Cameron @ 2021-10-18 20:13 UTC (permalink / raw)
  To: Peter Rosin
  Cc: Vincent Whitchurch, devicetree, kernel, lars, linux-iio, robh+dt,
	linux-kernel

On Sun, 17 Oct 2021 23:08:06 +0200
Peter Rosin <peda@axentia.se> wrote:

> On 2021-10-17 19:31, Jonathan Cameron wrote:
> > On Sat, 9 Oct 2021 01:09:56 +0200
> > Peter Rosin <peda@axentia.se> wrote:
> >   
> >> Hi Vincent!
> >>
> >> On 2021-10-07 15:46, Vincent Whitchurch wrote:  
> >>> On one of our boards we use gpio-mux with iio-mux to read voltages using an ADC
> >>> from a few different channels, and on this board the input voltage needs some
> >>> time to stabilize after a switch of the mux.
> >>>
> >>> This series add devicetree and driver support for this kind of hardware which
> >>> requries a settle time after muxing.
> >>>
> >>> v1 -> v2:
> >>> - Move property support to iio-mux and delay handling to mux core as suggested
> >>>   by Peter.
> >>>
> >>> v1: https://lore.kernel.org/all/20211004153640.20650-1-vincent.whitchurch@axis.com/
> >>>
> >>> Vincent Whitchurch (3):
> >>>   mux: add support for delay after muxing
> >>>   dt-bindings: iio: io-channel-mux: Add property for settle time
> >>>   iio: multiplexer: iio-mux: Support settle-time-us property
> >>>
> >>>  .../iio/multiplexer/io-channel-mux.yaml       |  5 +++
> >>>  drivers/iio/multiplexer/iio-mux.c             |  7 +++-
> >>>  drivers/mux/core.c                            | 36 ++++++++++++++++---
> >>>  include/linux/mux/consumer.h                  | 23 +++++++++---
> >>>  include/linux/mux/driver.h                    |  4 +++
> >>>  5 files changed, 65 insertions(+), 10 deletions(-)
> >>>     
> >>
> >> This looks really nice, thank you! The only question I see is if it should
> >> go via my (virtually unused) mux tree or via the iio tree. Yes, the meat is
> >> in mux/core.c, but I'm happy to just ack these patches and have Jonathan
> >> handle them. But, I'm also fine with handling it in the mux tree (but I'm
> >> getting old and forgetful, and it's been so many moons that I need to
> >> re-learn the steps).
> >>
> >> Jonathan, you or me? If you, you can add:
> >>
> >> Acked-by: Peter Rosin <peda@axentia.se>  
> > 
> > I don't really mind, but the 4/3 and 5/3 have broken my b4 based flow + Rob
> > hasn't yet given an Ack on those two, so I'll not pick any of them up just yet.
> > I can sort out the two oddly numbered patches if Rob is happy, though they'll
> > probably not have the nice link tags that b4 automates.
> > 
> > Note Rob didn't actually say he was happy with patch 2 yet as far as I can tell.  
> 
> Getting Rob's ack on 2/3 is of course a prerequisite to 1/3 and 3/3.
Given Rob has now given that, I'll queue these 3 patches up.

Applied to the iio-togreg branch of iio.git and pushed out as testing for 0-day
to poke at.

> 
> Just ignore 4/3 and 5/3 if they are holding things back or are making things
> difficult in any way. I'll resend them later if need be, as they really have
> very little to do with this series.
> 
> With hindsight I should probably have sent them as a fresh series, and I can
> re-post them as such immediately if that helps? But then again, maybe that
> just muddies the water even further...

Let's deal with those two separately.  I can pick them off list if Rob is happy
with those two.  The dt bindings patchwork has them as needing review so 
I'm sure they'll get it shortly.

Thanks,

Jonathan

> 
> Cheers,
> Peter


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 0/3] Add settle time support to iio-mux
  2021-10-08 19:19 ` [PATCH v2 0/3] Add settle time support to iio-mux Lars-Peter Clausen
@ 2021-10-19  7:03   ` Lars-Peter Clausen
  2021-10-21 19:39     ` Jonathan Cameron
  0 siblings, 1 reply; 21+ messages in thread
From: Lars-Peter Clausen @ 2021-10-19  7:03 UTC (permalink / raw)
  To: Vincent Whitchurch, peda, jic23, devicetree
  Cc: kernel, linux-iio, robh+dt, linux-kernel

On 10/8/21 9:19 PM, Lars-Peter Clausen wrote:
> On 10/7/21 3:46 PM, Vincent Whitchurch wrote:
>> On one of our boards we use gpio-mux with iio-mux to read voltages 
>> using an ADC
>> from a few different channels, and on this board the input voltage 
>> needs some
>> time to stabilize after a switch of the mux.
>>
>> This series add devicetree and driver support for this kind of 
>> hardware which
>> requries a settle time after muxing.
>
> I have a board with the very same problem. And a similar solution, but 
> you beat me with upstreaming. I've switched to your patchset.
>
> Whole series
>
> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
>
> Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Oh, I just realized I messed up. I meant to write

Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Tested-by: Lars-Peter Clausen <lars@metafoo.de>


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 4/3] dt-bindings: iio: io-channel-mux: add optional #io-channel-cells
  2021-10-08 22:11     ` [PATCH 4/3] dt-bindings: iio: io-channel-mux: add optional #io-channel-cells Peter Rosin
@ 2021-10-19 21:25       ` Rob Herring
  0 siblings, 0 replies; 21+ messages in thread
From: Rob Herring @ 2021-10-19 21:25 UTC (permalink / raw)
  To: Peter Rosin
  Cc: jic23, robh+dt, linux-kernel, Vincent Whitchurch, kernel,
	devicetree, lars, linux-iio

On Sat, 09 Oct 2021 00:11:21 +0200, Peter Rosin wrote:
> Needed for in-kernel use of the child channels of the mux.
> 
> Fixes problems like this, reported by dtbs_check:
> adc0mux: '#io-channel-cells' does not match any of the regexes: 'pinctrl-[0-9]+'
> 	arch/arm/boot/dts/aspeed-bmc-ampere-mtjade.dt.yaml
> 
> Suggested-by: Vincent Whitchurch <vincent.whitchurch@axis.com>
> Signed-off-by: Peter Rosin <peda@axentia.se>
> ---
>  .../devicetree/bindings/iio/multiplexer/io-channel-mux.yaml    | 3 +++
>  1 file changed, 3 insertions(+)
> 

Acked-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 5/3] dt-bindings: iio: io-channel-mux: allow duplicate channel, labels
  2021-10-08 22:11   ` [PATCH 5/3] dt-bindings: iio: io-channel-mux: allow duplicate channel, labels Peter Rosin
@ 2021-10-19 21:25     ` Rob Herring
  2021-10-20 16:49       ` Jonathan Cameron
  0 siblings, 1 reply; 21+ messages in thread
From: Rob Herring @ 2021-10-19 21:25 UTC (permalink / raw)
  To: Peter Rosin
  Cc: jic23, kernel, devicetree, robh+dt, linux-iio,
	Vincent Whitchurch, lars, linux-kernel

On Sat, 09 Oct 2021 00:11:30 +0200, Peter Rosin wrote:
> This is needed since an empty channel label is used to indicate an
> unused channel, and there can be more that one of those.
> 
> Fixes the following problem reported by dtbs_check:
> envelope-detector-mux: channels: ['', '', 'sync-1', 'in', 'out', 'sync-2', 'sys-reg', 'ana-reg'] has non-unique elements
> 	arch/arm/boot/dts/at91-tse850-3.dt.yaml
> 
> Suggested-by: Rob Herring <robh@kernel.org>
> Signed-off-by: Peter Rosin <peda@axentia.se>
> ---
>  .../devicetree/bindings/iio/multiplexer/io-channel-mux.yaml  | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 

Acked-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 5/3] dt-bindings: iio: io-channel-mux: allow duplicate channel, labels
  2021-10-19 21:25     ` Rob Herring
@ 2021-10-20 16:49       ` Jonathan Cameron
  0 siblings, 0 replies; 21+ messages in thread
From: Jonathan Cameron @ 2021-10-20 16:49 UTC (permalink / raw)
  To: Rob Herring
  Cc: Peter Rosin, kernel, devicetree, robh+dt, linux-iio,
	Vincent Whitchurch, lars, linux-kernel

On Tue, 19 Oct 2021 16:25:49 -0500
Rob Herring <robh@kernel.org> wrote:

> On Sat, 09 Oct 2021 00:11:30 +0200, Peter Rosin wrote:
> > This is needed since an empty channel label is used to indicate an
> > unused channel, and there can be more that one of those.
> > 
> > Fixes the following problem reported by dtbs_check:
> > envelope-detector-mux: channels: ['', '', 'sync-1', 'in', 'out', 'sync-2', 'sys-reg', 'ana-reg'] has non-unique elements
> > 	arch/arm/boot/dts/at91-tse850-3.dt.yaml
> > 
> > Suggested-by: Rob Herring <robh@kernel.org>
> > Signed-off-by: Peter Rosin <peda@axentia.se>
> > ---
> >  .../devicetree/bindings/iio/multiplexer/io-channel-mux.yaml  | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> >   
> 
> Acked-by: Rob Herring <robh@kernel.org>

4 + 5 applied to the togreg branch of iio.git and pushed out as
testing for 0-day to give it a dry run.

Thanks,

Jonathan

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 0/3] Add settle time support to iio-mux
  2021-10-19  7:03   ` Lars-Peter Clausen
@ 2021-10-21 19:39     ` Jonathan Cameron
  0 siblings, 0 replies; 21+ messages in thread
From: Jonathan Cameron @ 2021-10-21 19:39 UTC (permalink / raw)
  To: Lars-Peter Clausen
  Cc: Vincent Whitchurch, peda, devicetree, kernel, linux-iio, robh+dt,
	linux-kernel

On Tue, 19 Oct 2021 09:03:00 +0200
Lars-Peter Clausen <lars@metafoo.de> wrote:

> On 10/8/21 9:19 PM, Lars-Peter Clausen wrote:
> > On 10/7/21 3:46 PM, Vincent Whitchurch wrote:  
> >> On one of our boards we use gpio-mux with iio-mux to read voltages 
> >> using an ADC
> >> from a few different channels, and on this board the input voltage 
> >> needs some
> >> time to stabilize after a switch of the mux.
> >>
> >> This series add devicetree and driver support for this kind of 
> >> hardware which
> >> requries a settle time after muxing.  
> >
> > I have a board with the very same problem. And a similar solution, but 
> > you beat me with upstreaming. I've switched to your patchset.
> >
> > Whole series
> >
> > Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
> >
> > Acked-by: Lars-Peter Clausen <lars@metafoo.de>  
> Oh, I just realized I messed up. I meant to write
> 
> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
> Tested-by: Lars-Peter Clausen <lars@metafoo.de>
> 
Fixed up.

Thanks,

Jonathan

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2021-10-21 19:35 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-07 13:46 [PATCH v2 0/3] Add settle time support to iio-mux Vincent Whitchurch
2021-10-07 13:46 ` [PATCH v2 1/3] mux: add support for delay after muxing Vincent Whitchurch
2021-10-07 13:46 ` [PATCH v2 2/3] dt-bindings: iio: io-channel-mux: Add property for settle time Vincent Whitchurch
2021-10-08  2:46   ` Rob Herring
2021-10-08 13:56     ` Vincent Whitchurch
2021-10-08 15:27       ` Peter Rosin
2021-10-08 19:13         ` Rob Herring
2021-10-08 22:11     ` [PATCH 4/3] dt-bindings: iio: io-channel-mux: add optional #io-channel-cells Peter Rosin
2021-10-19 21:25       ` Rob Herring
2021-10-08 22:11   ` [PATCH 5/3] dt-bindings: iio: io-channel-mux: allow duplicate channel, labels Peter Rosin
2021-10-19 21:25     ` Rob Herring
2021-10-20 16:49       ` Jonathan Cameron
2021-10-18 19:52   ` [PATCH v2 2/3] dt-bindings: iio: io-channel-mux: Add property for settle time Rob Herring
2021-10-07 13:46 ` [PATCH v2 3/3] iio: multiplexer: iio-mux: Support settle-time-us property Vincent Whitchurch
2021-10-08 19:19 ` [PATCH v2 0/3] Add settle time support to iio-mux Lars-Peter Clausen
2021-10-19  7:03   ` Lars-Peter Clausen
2021-10-21 19:39     ` Jonathan Cameron
2021-10-08 23:09 ` Peter Rosin
2021-10-17 17:31   ` Jonathan Cameron
2021-10-17 21:08     ` Peter Rosin
2021-10-18 20:13       ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).