diff mbox series

[v1,1/2] dt-bindings: i2c: add "dev-name" property to assign specific device name

Message ID 20210407185039.621248-2-varmam@google.com
State New
Headers show
Series Override device name using DT "dev-name" property | expand

Commit Message

Manish Varma April 7, 2021, 6:50 p.m. UTC
I2C devices currently are named dynamically using
<adapter_id>-<device_address> convention, unless they are instantiated
through ACPI.

This means the device name may vary for the same device across different
systems, infact even on the same system if the I2C bus enumeration order
changes, i.e. because of device tree modifications.

By adding an optional "dev-name" property, it provides a mechanism to
set consistent and easy to recognize names for I2C devices.

Signed-off-by: Manish Varma <varmam@google.com>
---
 Documentation/devicetree/bindings/i2c/i2c.txt | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Rob Herring (Arm) April 9, 2021, 6:34 p.m. UTC | #1
On Wed, Apr 07, 2021 at 11:50:38AM -0700, Manish Varma wrote:
> I2C devices currently are named dynamically using
> <adapter_id>-<device_address> convention, unless they are instantiated
> through ACPI.
> 
> This means the device name may vary for the same device across different
> systems, infact even on the same system if the I2C bus enumeration order
> changes, i.e. because of device tree modifications.
> 
> By adding an optional "dev-name" property, it provides a mechanism to
> set consistent and easy to recognize names for I2C devices.

So? Why do you need 'easy to recognize names'?

Why is I2C special? If we wanted this in DT, it wouldn't be I2C specific 
and we probably would have added it long ago.

> Signed-off-by: Manish Varma <varmam@google.com>
> ---
>  Documentation/devicetree/bindings/i2c/i2c.txt | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/i2c/i2c.txt b/Documentation/devicetree/bindings/i2c/i2c.txt
> index df41f72afc87..6fb03f464b81 100644
> --- a/Documentation/devicetree/bindings/i2c/i2c.txt
> +++ b/Documentation/devicetree/bindings/i2c/i2c.txt
> @@ -130,6 +130,11 @@ wants to support one of the below features, it should adapt these bindings.
>  - wakeup-source
>  	device can be used as a wakeup source.
>  
> +- dev-name
> +	Name of the device.
> +	Overrides the default device name which is in the form of
> +	<busnr>-<addr>.

What's 'busnr'? No such thing in DT.

> +
>  Binding may contain optional "interrupts" property, describing interrupts
>  used by the device. I2C core will assign "irq" interrupt (or the very first
>  interrupt if not using interrupt names) as primary interrupt for the slave.
> -- 
> 2.31.1.295.g9ea45b61b8-goog
>
Manish Varma April 19, 2021, 11:21 p.m. UTC | #2
Hi Rob,

Thanks for the inputs.

On Fri, Apr 9, 2021 at 11:34 AM Rob Herring <robh@kernel.org> wrote:
>
> On Wed, Apr 07, 2021 at 11:50:38AM -0700, Manish Varma wrote:
> > I2C devices currently are named dynamically using
> > <adapter_id>-<device_address> convention, unless they are instantiated
> > through ACPI.
> >
> > This means the device name may vary for the same device across different
> > systems, infact even on the same system if the I2C bus enumeration order
> > changes, i.e. because of device tree modifications.
> >
> > By adding an optional "dev-name" property, it provides a mechanism to
> > set consistent and easy to recognize names for I2C devices.
>
> So? Why do you need 'easy to recognize names'?
>
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/i2c/i2c.txt b/Documentation/devicetree/bindings/i2c/i2c.txt
index df41f72afc87..6fb03f464b81 100644
--- a/Documentation/devicetree/bindings/i2c/i2c.txt
+++ b/Documentation/devicetree/bindings/i2c/i2c.txt
@@ -130,6 +130,11 @@  wants to support one of the below features, it should adapt these bindings.
 - wakeup-source
 	device can be used as a wakeup source.
 
+- dev-name
+	Name of the device.
+	Overrides the default device name which is in the form of
+	<busnr>-<addr>.
+
 Binding may contain optional "interrupts" property, describing interrupts
 used by the device. I2C core will assign "irq" interrupt (or the very first
 interrupt if not using interrupt names) as primary interrupt for the slave.