diff mbox series

[1/2] dt-bindings: i2c-mux-gpio: Add optional DT property

Message ID 20211013141003.2388495-2-horatiu.vultur@microchip.com
State Changes Requested, archived
Headers show
Series i2c-mux-gpio: Add optional 'select-delay' DT property | expand

Checks

Context Check Description
robh/checkpatch success

Commit Message

Horatiu Vultur Oct. 13, 2021, 2:10 p.m. UTC
Add optional property 'select-delay' DT property. In case this is set
then a delay is added when changing mux state. The value is specified in
usec.

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

Comments

Rob Herring Oct. 26, 2021, 8:29 p.m. UTC | #1
On Wed, Oct 13, 2021 at 04:10:02PM +0200, Horatiu Vultur wrote:
> Add optional property 'select-delay' DT property. In case this is set
> then a delay is added when changing mux state. The value is specified in
> usec.
> 
> Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
> ---
>  Documentation/devicetree/bindings/i2c/i2c-mux-gpio.txt | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/Documentation/devicetree/bindings/i2c/i2c-mux-gpio.txt b/Documentation/devicetree/bindings/i2c/i2c-mux-gpio.txt
> index d4cf10582a26..d0dacbad491a 100644
> --- a/Documentation/devicetree/bindings/i2c/i2c-mux-gpio.txt
> +++ b/Documentation/devicetree/bindings/i2c/i2c-mux-gpio.txt
> @@ -28,6 +28,7 @@ Required properties:
>  Optional properties:
>  - idle-state: value to set the muxer to when idle. When no value is
>    given, it defaults to the last value used.
> +- select-delay: GPIO settle delay when changing mux state. In usec.

Seems generally useful. Can we add this first to the mux control 
binding, then use it here (or better yet, use the mux binding if you 
can instead).

Also, properties with units need a standard unit suffix.

>  
>  For each i2c child node, an I2C child bus will be created. They will
>  be numbered based on their order in the device tree.
> -- 
> 2.33.0
> 
>
Peter Rosin Oct. 26, 2021, 9:02 p.m. UTC | #2
On 2021-10-26 22:29, Rob Herring wrote:
> On Wed, Oct 13, 2021 at 04:10:02PM +0200, Horatiu Vultur wrote:
>> Add optional property 'select-delay' DT property. In case this is set
>> then a delay is added when changing mux state. The value is specified in
>> usec.
>>
>> Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
>> ---
>>  Documentation/devicetree/bindings/i2c/i2c-mux-gpio.txt | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/Documentation/devicetree/bindings/i2c/i2c-mux-gpio.txt b/Documentation/devicetree/bindings/i2c/i2c-mux-gpio.txt
>> index d4cf10582a26..d0dacbad491a 100644
>> --- a/Documentation/devicetree/bindings/i2c/i2c-mux-gpio.txt
>> +++ b/Documentation/devicetree/bindings/i2c/i2c-mux-gpio.txt
>> @@ -28,6 +28,7 @@ Required properties:
>>  Optional properties:
>>  - idle-state: value to set the muxer to when idle. When no value is
>>    given, it defaults to the last value used.
>> +- select-delay: GPIO settle delay when changing mux state. In usec.
> 
> Seems generally useful. Can we add this first to the mux control 
> binding, then use it here (or better yet, use the mux binding if you 
> can instead).

It is actually not very useful here, nor in the mux-control binding. The
same gpio lines (or mux-control) could be used to control several muxes,
all with vastly different needs as to how long the settle time needs to
be. I.e. it is not the gpio lines (or mux-control) that need to settle,
it is the signal(s) that travel through the controlled mux(es) that need
to settle.

In this case, a settle time property was added to the io-channel-mux
binding, which makes much more sense.

https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git/commit/Documentation/devicetree/bindings/iio/multiplexer/io-channel-mux.yaml?h=char-misc-next&id=b9221f71c285

Cheers,
Peter

> Also, properties with units need a standard unit suffix.
> 
>>  
>>  For each i2c child node, an I2C child bus will be created. They will
>>  be numbered based on their order in the device tree.
>> -- 
>> 2.33.0
>>
>>
Peter Rosin Oct. 26, 2021, 9:16 p.m. UTC | #3
On 2021-10-26 23:02, Peter Rosin wrote:
> 
> 
> On 2021-10-26 22:29, Rob Herring wrote:
>> On Wed, Oct 13, 2021 at 04:10:02PM +0200, Horatiu Vultur wrote:
>>> Add optional property 'select-delay' DT property. In case this is set
>>> then a delay is added when changing mux state. The value is specified in
>>> usec.
>>>
>>> Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
>>> ---
>>>  Documentation/devicetree/bindings/i2c/i2c-mux-gpio.txt | 1 +
>>>  1 file changed, 1 insertion(+)
>>>
>>> diff --git a/Documentation/devicetree/bindings/i2c/i2c-mux-gpio.txt b/Documentation/devicetree/bindings/i2c/i2c-mux-gpio.txt
>>> index d4cf10582a26..d0dacbad491a 100644
>>> --- a/Documentation/devicetree/bindings/i2c/i2c-mux-gpio.txt
>>> +++ b/Documentation/devicetree/bindings/i2c/i2c-mux-gpio.txt
>>> @@ -28,6 +28,7 @@ Required properties:
>>>  Optional properties:
>>>  - idle-state: value to set the muxer to when idle. When no value is
>>>    given, it defaults to the last value used.
>>> +- select-delay: GPIO settle delay when changing mux state. In usec.
>>
>> Seems generally useful. Can we add this first to the mux control 
>> binding, then use it here (or better yet, use the mux binding if you 
>> can instead).
> 
> It is actually not very useful here, nor in the mux-control binding. The
> same gpio lines (or mux-control) could be used to control several muxes,
> all with vastly different needs as to how long the settle time needs to
> be. I.e. it is not the gpio lines (or mux-control) that need to settle,
> it is the signal(s) that travel through the controlled mux(es) that need
> to settle.
> 
> In this case, a settle time property was added to the io-channel-mux
> binding, which makes much more sense.
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git/commit/Documentation/devicetree/bindings/iio/multiplexer/io-channel-mux.yaml?h=char-misc-next&id=b9221f71c285

Oh crap, sorry. This series went right past me since it somehow didn't get
flagged in my inbox. But Robs answer did, and then I assumed it was a late
answer to this series:

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

Which it of course isn't. But in my mind it was. Result: my above response
does not make any sense. I'll have to go to bed now, but I promise to write
a proper answer tomorrow.

Cheers,
Peter

> Cheers,
> Peter
> 
>> Also, properties with units need a standard unit suffix.
>>
>>>  
>>>  For each i2c child node, an I2C child bus will be created. They will
>>>  be numbered based on their order in the device tree.
>>> -- 
>>> 2.33.0
>>>
>>>
Peter Rosin Oct. 27, 2021, 10:43 a.m. UTC | #4
On 2021-10-26 22:29, Rob Herring wrote:
> On Wed, Oct 13, 2021 at 04:10:02PM +0200, Horatiu Vultur wrote:
>> Add optional property 'select-delay' DT property. In case this is set
>> then a delay is added when changing mux state. The value is specified in
>> usec.
>>
>> Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
>> ---
>>  Documentation/devicetree/bindings/i2c/i2c-mux-gpio.txt | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/Documentation/devicetree/bindings/i2c/i2c-mux-gpio.txt b/Documentation/devicetree/bindings/i2c/i2c-mux-gpio.txt
>> index d4cf10582a26..d0dacbad491a 100644
>> --- a/Documentation/devicetree/bindings/i2c/i2c-mux-gpio.txt
>> +++ b/Documentation/devicetree/bindings/i2c/i2c-mux-gpio.txt
>> @@ -28,6 +28,7 @@ Required properties:
>>  Optional properties:
>>  - idle-state: value to set the muxer to when idle. When no value is
>>    given, it defaults to the last value used.
>> +- select-delay: GPIO settle delay when changing mux state. In usec.
> 
> Seems generally useful. Can we add this first to the mux control 
> binding, then use it here (or better yet, use the mux binding if you 
> can instead)
I do not think that adding a delay to the mux-control binding is what
we want. Any change to the mux-control will be quick. What may take time
is rearranging the routing inside the mux and for the muxed signals
affected by those changes to then settle.

This might sound like splitting hairs, but the distinction does provide
a hint for where the delay fits best. And I think that any user of a
mux-control that might need a delay after changed mux state knows best
what that delay really is. Considering the case where a single
mux-control is used for two different muxes that are routing signals
with different settling time requirements. Why should a quick path
suffer the delays enforced for some other, slow, path? So, I don't
think the delay fits as a property of the mux-control.

> Also, properties with units need a standard unit suffix.

Another naming issue is that the io-channel-mux binding recently added
a settle-time-us property for this exact purpose, it might be good to
follow that lead.

However, since I'm not really happy with the implementation, it might
be easier to instead use a generic mux-control and extend the
i2c-mux-gpmux driver with this settling time. See comments on patch
2/2 for details.

Cheers,
Peter

>>  
>>  For each i2c child node, an I2C child bus will be created. They will
>>  be numbered based on their order in the device tree.
>> -- 
>> 2.33.0
>>
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/i2c/i2c-mux-gpio.txt b/Documentation/devicetree/bindings/i2c/i2c-mux-gpio.txt
index d4cf10582a26..d0dacbad491a 100644
--- a/Documentation/devicetree/bindings/i2c/i2c-mux-gpio.txt
+++ b/Documentation/devicetree/bindings/i2c/i2c-mux-gpio.txt
@@ -28,6 +28,7 @@  Required properties:
 Optional properties:
 - idle-state: value to set the muxer to when idle. When no value is
   given, it defaults to the last value used.
+- select-delay: GPIO settle delay when changing mux state. In usec.
 
 For each i2c child node, an I2C child bus will be created. They will
 be numbered based on their order in the device tree.