linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/2] i2c-mux-gpmux: Support settle-time-us property
@ 2021-11-03  9:18 Horatiu Vultur
  2021-11-03  9:18 ` [PATCH v4 1/2] dt-bindings: i2c-mux: Add property for settle time Horatiu Vultur
  2021-11-03  9:18 ` [PATCH v4 2/2] i2c-mux-gpmux: Support settle-time-us property Horatiu Vultur
  0 siblings, 2 replies; 5+ messages in thread
From: Horatiu Vultur @ 2021-11-03  9:18 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.

v3->v4:
 - update i2c-mux.yaml by adding required and select properties

v2->v3:
 - move the binding changes into i2c-mux.yaml
 - read at a later point the DT property 'settle-time-us'

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: Add property for settle time
  i2c-mux-gpmux: Support settle-time-us property

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

-- 
2.33.0


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

* [PATCH v4 1/2] dt-bindings: i2c-mux: Add property for settle time
  2021-11-03  9:18 [PATCH v4 0/2] i2c-mux-gpmux: Support settle-time-us property Horatiu Vultur
@ 2021-11-03  9:18 ` Horatiu Vultur
  2021-11-12 19:51   ` Rob Herring
  2021-11-03  9:18 ` [PATCH v4 2/2] i2c-mux-gpmux: Support settle-time-us property Horatiu Vultur
  1 sibling, 1 reply; 5+ messages in thread
From: Horatiu Vultur @ 2021-11-03  9:18 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.yaml | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/Documentation/devicetree/bindings/i2c/i2c-mux.yaml b/Documentation/devicetree/bindings/i2c/i2c-mux.yaml
index 24cac36037f5..4c81e56d02f7 100644
--- a/Documentation/devicetree/bindings/i2c/i2c-mux.yaml
+++ b/Documentation/devicetree/bindings/i2c/i2c-mux.yaml
@@ -19,6 +19,11 @@ description: |+
   populating the i2c child busses.  If an 'i2c-mux' subnode is present, only
   subnodes of this will be considered as i2c child busses.
 
+  Optional properties may not be supported by all drivers. However, if a driver
+  wants to support one of the below features, it should adopt these bindings.
+
+select: false
+
 properties:
   $nodename:
     pattern: '^(i2c-?)?mux'
@@ -29,6 +34,11 @@ properties:
   '#size-cells':
     const: 0
 
+  settle-time-us:
+    default: 0
+    description:
+      The time required for the signals to settle.
+
 patternProperties:
   '^i2c@[0-9a-f]+$':
     $ref: /schemas/i2c/i2c-controller.yaml
@@ -41,6 +51,10 @@ patternProperties:
 
 additionalProperties: true
 
+required:
+  - '#address-cells'
+  - '#size-cells'
+
 examples:
   - |
     /*
-- 
2.33.0


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

* [PATCH v4 2/2] i2c-mux-gpmux: Support settle-time-us property
  2021-11-03  9:18 [PATCH v4 0/2] i2c-mux-gpmux: Support settle-time-us property Horatiu Vultur
  2021-11-03  9:18 ` [PATCH v4 1/2] dt-bindings: i2c-mux: Add property for settle time Horatiu Vultur
@ 2021-11-03  9:18 ` Horatiu Vultur
  1 sibling, 0 replies; 5+ messages in thread
From: Horatiu Vultur @ 2021-11-03  9:18 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 | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/muxes/i2c-mux-gpmux.c b/drivers/i2c/muxes/i2c-mux-gpmux.c
index d3acd8d66c32..f64a4b6034df 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;
@@ -106,6 +107,7 @@ static int i2c_mux_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, muxc);
 
+	of_property_read_u32(np, "settle-time-us", &mux->delay_us);
 	muxc->mux_locked = of_property_read_bool(np, "mux-locked");
 
 	for_each_child_of_node(np, child) {
-- 
2.33.0


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

* Re: [PATCH v4 1/2] dt-bindings: i2c-mux: Add property for settle time
  2021-11-03  9:18 ` [PATCH v4 1/2] dt-bindings: i2c-mux: Add property for settle time Horatiu Vultur
@ 2021-11-12 19:51   ` Rob Herring
  2021-11-18 14:19     ` Horatiu Vultur
  0 siblings, 1 reply; 5+ messages in thread
From: Rob Herring @ 2021-11-12 19:51 UTC (permalink / raw)
  To: Horatiu Vultur; +Cc: peda, linux-i2c, devicetree, linux-kernel

On Wed, Nov 03, 2021 at 10:18:38AM +0100, 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>
> ---
>  Documentation/devicetree/bindings/i2c/i2c-mux.yaml | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/i2c/i2c-mux.yaml b/Documentation/devicetree/bindings/i2c/i2c-mux.yaml
> index 24cac36037f5..4c81e56d02f7 100644
> --- a/Documentation/devicetree/bindings/i2c/i2c-mux.yaml
> +++ b/Documentation/devicetree/bindings/i2c/i2c-mux.yaml
> @@ -19,6 +19,11 @@ description: |+
>    populating the i2c child busses.  If an 'i2c-mux' subnode is present, only
>    subnodes of this will be considered as i2c child busses.
>  
> +  Optional properties may not be supported by all drivers. However, if a driver
> +  wants to support one of the below features, it should adopt these bindings.

What drivers? Bindings are independent. I don't think you need the 
comment, but this should be a separate change with an explanation along 
the lines of what we discussed.

> +
> +select: false
> +
>  properties:
>    $nodename:
>      pattern: '^(i2c-?)?mux'
> @@ -29,6 +34,11 @@ properties:
>    '#size-cells':
>      const: 0
>  
> +  settle-time-us:
> +    default: 0
> +    description:
> +      The time required for the signals to settle.
> +
>  patternProperties:
>    '^i2c@[0-9a-f]+$':
>      $ref: /schemas/i2c/i2c-controller.yaml
> @@ -41,6 +51,10 @@ patternProperties:
>  
>  additionalProperties: true
>  
> +required:
> +  - '#address-cells'
> +  - '#size-cells'
> +

This too is a separate change.

>  examples:
>    - |
>      /*
> -- 
> 2.33.0
> 
> 

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

* Re: [PATCH v4 1/2] dt-bindings: i2c-mux: Add property for settle time
  2021-11-12 19:51   ` Rob Herring
@ 2021-11-18 14:19     ` Horatiu Vultur
  0 siblings, 0 replies; 5+ messages in thread
From: Horatiu Vultur @ 2021-11-18 14:19 UTC (permalink / raw)
  To: Rob Herring; +Cc: peda, linux-i2c, devicetree, linux-kernel

The 11/12/2021 13:51, Rob Herring wrote:

Hi Rob,

Sorry for the late reply, I was caught with some other patches.

> 
> On Wed, Nov 03, 2021 at 10:18:38AM +0100, 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>
> > ---
> >  Documentation/devicetree/bindings/i2c/i2c-mux.yaml | 14 ++++++++++++++
> >  1 file changed, 14 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/i2c/i2c-mux.yaml b/Documentation/devicetree/bindings/i2c/i2c-mux.yaml
> > index 24cac36037f5..4c81e56d02f7 100644
> > --- a/Documentation/devicetree/bindings/i2c/i2c-mux.yaml
> > +++ b/Documentation/devicetree/bindings/i2c/i2c-mux.yaml
> > @@ -19,6 +19,11 @@ description: |+
> >    populating the i2c child busses.  If an 'i2c-mux' subnode is present, only
> >    subnodes of this will be considered as i2c child busses.
> >
> > +  Optional properties may not be supported by all drivers. However, if a driver
> > +  wants to support one of the below features, it should adopt these bindings.
> 
> What drivers? Bindings are independent. I don't think you need the
> comment, but this should be a separate change with an explanation along
> the lines of what we discussed.
> 
> > +
> > +select: false
> > +
> >  properties:
> >    $nodename:
> >      pattern: '^(i2c-?)?mux'
> > @@ -29,6 +34,11 @@ properties:
> >    '#size-cells':
> >      const: 0
> >
> > +  settle-time-us:
> > +    default: 0
> > +    description:
> > +      The time required for the signals to settle.
> > +
> >  patternProperties:
> >    '^i2c@[0-9a-f]+$':
> >      $ref: /schemas/i2c/i2c-controller.yaml
> > @@ -41,6 +51,10 @@ patternProperties:
> >
> >  additionalProperties: true
> >
> > +required:
> > +  - '#address-cells'
> > +  - '#size-cells'
> > +
> 
> This too is a separate change.

So just to be sure that I follow up correctly, then there will be one
patch with the 'select: false' explaining why is added and another one
with the new property and the required properties.
Or am I still off?

> 
> >  examples:
> >    - |
> >      /*
> > --
> > 2.33.0
> >
> >

-- 
/Horatiu

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

end of thread, other threads:[~2021-11-18 14:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-03  9:18 [PATCH v4 0/2] i2c-mux-gpmux: Support settle-time-us property Horatiu Vultur
2021-11-03  9:18 ` [PATCH v4 1/2] dt-bindings: i2c-mux: Add property for settle time Horatiu Vultur
2021-11-12 19:51   ` Rob Herring
2021-11-18 14:19     ` Horatiu Vultur
2021-11-03  9:18 ` [PATCH v4 2/2] i2c-mux-gpmux: Support settle-time-us property Horatiu Vultur

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