Re: [PATCH] dt-bindings: pm8941-misc: Fix usb_id and usb_vbus definitions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2022-06-30 20:47:32, Krzysztof Kozlowski wrote:
> On 30/06/2022 06:23, Bryan O'Donoghue wrote:
> > dts validation is throwing an error for me on 8916 and 8939 with
> > extcon@1300. In this case we have usb_vbus but not usb_id.
> > 
> > Looking at the pm8941-misc driver we can have usb_id, usb_vbus or both at
> > the same time.
> 
> Implementation is not the best reason to change bindings. Implementation
> can change, bindings should not.
> 
> > 
> > Expand the definition with anyOf to capture the three different valid
> > modes.
> > 
> > Fixes: 4fcdd677c4ea ("bindings: pm8941-misc: Add support for VBUS detection")
> > Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@xxxxxxxxxx>
> > ---
> >  .../devicetree/bindings/extcon/qcom,pm8941-misc.yaml | 12 ++++++++----
> >  1 file changed, 8 insertions(+), 4 deletions(-)
> > 
> > diff --git a/Documentation/devicetree/bindings/extcon/qcom,pm8941-misc.yaml b/Documentation/devicetree/bindings/extcon/qcom,pm8941-misc.yaml
> > index 6a9c96f0352ac..1bc412a4ac5e6 100644
> > --- a/Documentation/devicetree/bindings/extcon/qcom,pm8941-misc.yaml
> > +++ b/Documentation/devicetree/bindings/extcon/qcom,pm8941-misc.yaml
> > @@ -27,10 +27,14 @@ properties:
> >  
> >    interrupt-names:
> >      minItems: 1
> > -    items:
> > -      - const: usb_id
> > -      - const: usb_vbus
> > -
> > +    anyOf:
> > +      - items:
> > +          - const: usb_id
> > +          - const: usb_vbus
> > +      - items:
> > +          - const: usb_id
> 
> I don't think you can have ID connected and VBUS disconnected, therefore
> is it even possible to have missing VBUS interrupt?

This is how I've been using it on the pmi8950 (apologies, patches not
yet upstream) because both interrupts are on a different block:

    pmi8950_usb_vbus: extcon-chgpth@1300 {
        compatible = "qcom,pm8941-misc";
        interrupts = <0x2 0x13 0x2 IRQ_TYPE_NONE>;
        interrupt-names = "usb_vbus";
    };

    pmi8950_usb_id: extcon-otg@1100 {
        compatible = "qcom,pm8941-misc";
        interrupts = <0x2 0x11 0x3 IRQ_TYPE_NONE>;
        interrupt-names = "usb_id";
    };

This also results in annoying errors (back in the day, found these on a
5.13 log but surely remember seeing it on 5.18 as well):

    [    1.377491] extcon-pm8941-misc 200f000.spmi:pmic@2:extcon_chgpth@1300: IRQ usb_id not found
    [    1.380399] extcon-pm8941-misc 200f000.spmi:pmic@2:extcon_otg@1100: IRQ usb_vbus not found

Now, given that the offset also seems to be encoded in the interrupt
definition, and it's been functioning without `reg` (required by the
dt-bindings but I see no register mapping in the driver, it reads
interrupt line level from the irqchip directly), it is perhaps possible
to throw them into one DT node without address altogether?  (untested)

    pmi8950_usb_extcon: extcon {
        compatible = "qcom,pm8941-misc";
        interrupts = <0x2 0x11 0x3 IRQ_TYPE_NONE>,
                     <0x2 0x13 0x2 IRQ_TYPE_NONE>;
        interrupt-names = "usb_id", "usb_vbus";
    };

- Marijn



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux