All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] i2c-mux-gpmux: Support settle-time-us property
@ 2021-10-28 12:53 Horatiu Vultur
  2021-10-28 12:53 ` [PATCH v2 1/2] dt-bindings: i2c-mux-gpmux: Add property for settle time Horatiu Vultur
  2021-10-28 12:53 ` [PATCH v2 2/2] i2c-mux-gpmux: Support settle-time-us property Horatiu Vultur
  0 siblings, 2 replies; 5+ messages in thread
From: Horatiu Vultur @ 2021-10-28 12:53 UTC (permalink / raw)
  To: peda, robh+dt, linux-i2c, devicetree, linux-kernel; +Cc: Horatiu Vultur

Add support for settle-time-us property. If this is defined in device
tree then add this delay to mux APIs.

v1->v2:
 - add the changes to i2c-mux-gpmux instead of i2c-mux-gpio to be able
   to use mux_control_select_delay

Horatiu Vultur (2):
  dt-bindings: i2c-mux-gpmux: Add property for settle time
  i2c-mux-gpmux: Support settle-time-us property

 Documentation/devicetree/bindings/i2c/i2c-mux-gpmux.yaml | 5 +++++
 drivers/i2c/muxes/i2c-mux-gpmux.c                        | 6 +++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

-- 
2.33.0


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

* [PATCH v2 1/2] dt-bindings: i2c-mux-gpmux: Add property for settle time
  2021-10-28 12:53 [PATCH v2 0/2] i2c-mux-gpmux: Support settle-time-us property Horatiu Vultur
@ 2021-10-28 12:53 ` Horatiu Vultur
  2021-10-30 22:31   ` Peter Rosin
  2021-10-28 12:53 ` [PATCH v2 2/2] i2c-mux-gpmux: Support settle-time-us property Horatiu Vultur
  1 sibling, 1 reply; 5+ messages in thread
From: Horatiu Vultur @ 2021-10-28 12:53 UTC (permalink / raw)
  To: peda, robh+dt, linux-i2c, devicetree, linux-kernel; +Cc: Horatiu Vultur

Some HW requires some time for the signals to settle after the muxing is
changed. Allow this time to be specified in device tree.

Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
---
 Documentation/devicetree/bindings/i2c/i2c-mux-gpmux.yaml | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/Documentation/devicetree/bindings/i2c/i2c-mux-gpmux.yaml b/Documentation/devicetree/bindings/i2c/i2c-mux-gpmux.yaml
index 9b0603a72f40..4fef5aad360b 100644
--- a/Documentation/devicetree/bindings/i2c/i2c-mux-gpmux.yaml
+++ b/Documentation/devicetree/bindings/i2c/i2c-mux-gpmux.yaml
@@ -67,6 +67,11 @@ properties:
       The properties of mux-locked and parent-locked multiplexers are discussed
       in more detail in Documentation/i2c/i2c-topology.rst.
 
+  settle-time-us:
+    default: 0
+    description:
+      The time required for the signals to settle.
+
 required:
   - compatible
   - i2c-parent
-- 
2.33.0


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

* [PATCH v2 2/2] i2c-mux-gpmux: Support settle-time-us property
  2021-10-28 12:53 [PATCH v2 0/2] i2c-mux-gpmux: Support settle-time-us property Horatiu Vultur
  2021-10-28 12:53 ` [PATCH v2 1/2] dt-bindings: i2c-mux-gpmux: Add property for settle time Horatiu Vultur
@ 2021-10-28 12:53 ` Horatiu Vultur
  2021-10-30 22:31   ` Peter Rosin
  1 sibling, 1 reply; 5+ messages in thread
From: Horatiu Vultur @ 2021-10-28 12:53 UTC (permalink / raw)
  To: peda, robh+dt, linux-i2c, devicetree, linux-kernel
  Cc: Horatiu Vultur, Lars Povlsen

Add support for settle-time-us property. If this is defined in device
tree then add this delay to mux APIs.

Signed-off-by: Lars Povlsen <lars.povlsen@microchip.com>
Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
---
 drivers/i2c/muxes/i2c-mux-gpmux.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/muxes/i2c-mux-gpmux.c b/drivers/i2c/muxes/i2c-mux-gpmux.c
index d3acd8d66c32..569de1d8fdc1 100644
--- a/drivers/i2c/muxes/i2c-mux-gpmux.c
+++ b/drivers/i2c/muxes/i2c-mux-gpmux.c
@@ -16,6 +16,7 @@
 
 struct mux {
 	struct mux_control *control;
+	u32 delay_us;
 
 	bool do_not_deselect;
 };
@@ -25,7 +26,7 @@ static int i2c_mux_select(struct i2c_mux_core *muxc, u32 chan)
 	struct mux *mux = i2c_mux_priv(muxc);
 	int ret;
 
-	ret = mux_control_select(mux->control, chan);
+	ret = mux_control_select_delay(mux->control, chan, mux->delay_us);
 	mux->do_not_deselect = ret < 0;
 
 	return ret;
@@ -89,6 +90,9 @@ static int i2c_mux_probe(struct platform_device *pdev)
 		return dev_err_probe(dev, PTR_ERR(mux->control),
 				     "failed to get control-mux\n");
 
+	mux->delay_us = 0;
+	of_property_read_u32(np, "settle-time-us", &mux->delay_us);
+
 	parent = mux_parent_adapter(dev);
 	if (IS_ERR(parent))
 		return dev_err_probe(dev, PTR_ERR(parent),
-- 
2.33.0


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

* Re: [PATCH v2 1/2] dt-bindings: i2c-mux-gpmux: Add property for settle time
  2021-10-28 12:53 ` [PATCH v2 1/2] dt-bindings: i2c-mux-gpmux: Add property for settle time Horatiu Vultur
@ 2021-10-30 22:31   ` Peter Rosin
  0 siblings, 0 replies; 5+ messages in thread
From: Peter Rosin @ 2021-10-30 22:31 UTC (permalink / raw)
  To: Horatiu Vultur, robh+dt, linux-i2c, devicetree, linux-kernel

On 2021-10-28 14:53, Horatiu Vultur wrote:
> Some HW requires some time for the signals to settle after the muxing is
> changed. Allow this time to be specified in device tree.
> 
> Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>

Maybe this belongs in the i2c-mux binding? Because next week it's someone
with some other i2c-mux that needs the signals so settle. Please include
some language that maybe not all driver support this optional binding etc.
For reference, compare with the optional properties in the i2c binding.

Cheers,
Peter

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

* Re: [PATCH v2 2/2] i2c-mux-gpmux: Support settle-time-us property
  2021-10-28 12:53 ` [PATCH v2 2/2] i2c-mux-gpmux: Support settle-time-us property Horatiu Vultur
@ 2021-10-30 22:31   ` Peter Rosin
  0 siblings, 0 replies; 5+ messages in thread
From: Peter Rosin @ 2021-10-30 22:31 UTC (permalink / raw)
  To: Horatiu Vultur, robh+dt, linux-i2c, devicetree, linux-kernel; +Cc: Lars Povlsen

On 2021-10-28 14:53, Horatiu Vultur wrote:
> Add support for settle-time-us property. If this is defined in device
> tree then add this delay to mux APIs.
> 
> Signed-off-by: Lars Povlsen <lars.povlsen@microchip.com>
> Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
> ---
>  drivers/i2c/muxes/i2c-mux-gpmux.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/i2c/muxes/i2c-mux-gpmux.c b/drivers/i2c/muxes/i2c-mux-gpmux.c
> index d3acd8d66c32..569de1d8fdc1 100644
> --- a/drivers/i2c/muxes/i2c-mux-gpmux.c
> +++ b/drivers/i2c/muxes/i2c-mux-gpmux.c
> @@ -16,6 +16,7 @@
>  
>  struct mux {
>  	struct mux_control *control;
> +	u32 delay_us;
>  
>  	bool do_not_deselect;
>  };
> @@ -25,7 +26,7 @@ static int i2c_mux_select(struct i2c_mux_core *muxc, u32 chan)
>  	struct mux *mux = i2c_mux_priv(muxc);
>  	int ret;
>  
> -	ret = mux_control_select(mux->control, chan);
> +	ret = mux_control_select_delay(mux->control, chan, mux->delay_us);
>  	mux->do_not_deselect = ret < 0;
>  
>  	return ret;
> @@ -89,6 +90,9 @@ static int i2c_mux_probe(struct platform_device *pdev)
>  		return dev_err_probe(dev, PTR_ERR(mux->control),
>  				     "failed to get control-mux\n");
>  
> +	mux->delay_us = 0;
> +	of_property_read_u32(np, "settle-time-us", &mux->delay_us);

Some nitpicks, zeroing out the variable is not needed (the memory has
been cleared already) and I would like this a bit further down next
to digging out the mux-locked property.

Cheers,
Peter

> +
>  	parent = mux_parent_adapter(dev);
>  	if (IS_ERR(parent))
>  		return dev_err_probe(dev, PTR_ERR(parent),
> 

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

end of thread, other threads:[~2021-10-30 22:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-28 12:53 [PATCH v2 0/2] i2c-mux-gpmux: Support settle-time-us property Horatiu Vultur
2021-10-28 12:53 ` [PATCH v2 1/2] dt-bindings: i2c-mux-gpmux: Add property for settle time Horatiu Vultur
2021-10-30 22:31   ` Peter Rosin
2021-10-28 12:53 ` [PATCH v2 2/2] i2c-mux-gpmux: Support settle-time-us property Horatiu Vultur
2021-10-30 22:31   ` Peter Rosin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.