Re: [PATCH 5/8] dt-bindings: usb: usb-device: Add orientation

From: Ricardo Ribalda
Date: Fri Apr 04 2025 - 16:31:40 EST


Hi Rob

On Fri, 4 Apr 2025 at 21:36, Rob Herring <robh@xxxxxxxxxx> wrote:
>
> On Thu, Apr 03, 2025 at 07:16:16PM +0000, Ricardo Ribalda wrote:
> > For some devices, such as cameras, the OS needs to know where they are
> > mounted.
>
> Do you have a usecase that's not a camera?

I personally do not have other use cases, but I suspect that it could
be useful for more people.

The original proposal was more generic and "inspired" in _PLD:
https://lore.kernel.org/linux-devicetree/20241212-usb-orientation-v1-1-0b69adf05f37@xxxxxxxxxxxx/

You suggested using the camera's orientation.


>
> >
> > ACPI has a property for this purpose, which is parsed by
> > acpi_get_physical_device_location():
> > https://uefi.org/htmlspecs/ACPI_Spec_6_4_html/06_Device_Configuration/Device_Configuration.html#pld-physical-location-of-device
> >
> > In DT we have similar property for video-interface-devices called
> > orientation:
> > Documentation/devicetree/bindings/media/video-interface-devices.yaml
> >
> > Add a new property orientation for usb-devices that matches the already
> > existing orientation property of video-interface-devices.
> >
> > Signed-off-by: Ricardo Ribalda <ribalda@xxxxxxxxxxxx>
> > ---
> > Documentation/devicetree/bindings/usb/usb-device.yaml | 5 +++++
> > 1 file changed, 5 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/usb/usb-device.yaml b/Documentation/devicetree/bindings/usb/usb-device.yaml
> > index da890ee60ce6e71a11910c565b6f805470782e4f..bbcda28ec7d5695307efa797f57180044afda77f 100644
> > --- a/Documentation/devicetree/bindings/usb/usb-device.yaml
> > +++ b/Documentation/devicetree/bindings/usb/usb-device.yaml
>
> This is a binding for *all* USB devices. This property should only be
> added for devices where it makes sense.

Can you provide some examples of how I can do this?


>
> > @@ -42,6 +42,10 @@ properties:
> > port to which this device is attached. The range is 1-255.
> > maxItems: 1
> >
> > + orientation:
> > + description: If present, specifies the orientation of the usb device.
> > + $ref: /schemas/media/video-interface-devices.yaml#/properties/orientation
>
> Reference the schema from the top level and drop
> '/properties/orientation'.
>
> What about 'rotation'? Seems like you'd want that too.

At this moment I do not have a usecase for that. But sure, once I need
it I will add it the same way.

In the last thread I proposed Sakari to use:

+ image-sensor:
+ description: Video interface properties associated to USB cameras,
+ typically UVC compliant.
+ allOf:
+ - $ref: /schemas/media/video-interface-devices.yaml#
+

But he preferred to add orientation instead. Either ways work for me.


>
> > +
> > "#address-cells":
> > description: should be 1 for hub nodes with device nodes,
> > should be 2 for device nodes with interface nodes.
> > @@ -101,6 +105,7 @@ examples:
> > device@2 {
> > compatible = "usb123,4567";
> > reg = <2>;
> > + orientation = <0>;
> > };
> >
> > device@3 {
> >
> > --
> > 2.49.0.504.g3bcea36a83-goog
> >



--
Ricardo Ribalda