diff mbox series

[v4,1/3] dt-bindings: adc-joystick: add poll-interval

Message ID 20220627221444.3638-2-macroalpha82@gmail.com (mailing list archive)
State Superseded
Headers show
Series adc-joystick: Add polled support | expand

Commit Message

Chris Morgan June 27, 2022, 10:14 p.m. UTC
Add poll-interval support for the adc-joystick documentation. This is
an optional value and if not provided the adc-joystick works as it
does today (with triggered buffers). If this value is provided, the
adc-joystick driver is polled at the specified interval.

Signed-off-by: Maya Matuszczyk <maccraft123mc@gmail.com>
Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
---
 Documentation/devicetree/bindings/input/adc-joystick.yaml | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Paul Cercueil June 27, 2022, 10:33 p.m. UTC | #1
Hi Chris,

Le lun., juin 27 2022 at 17:14:42 -0500, Chris Morgan 
<macroalpha82@gmail.com> a écrit :
> Add poll-interval support for the adc-joystick documentation. This is
> an optional value and if not provided the adc-joystick works as it
> does today (with triggered buffers). If this value is provided, the
> adc-joystick driver is polled at the specified interval.
> 
> Signed-off-by: Maya Matuszczyk <maccraft123mc@gmail.com>
> Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
> ---
>  Documentation/devicetree/bindings/input/adc-joystick.yaml | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git 
> a/Documentation/devicetree/bindings/input/adc-joystick.yaml 
> b/Documentation/devicetree/bindings/input/adc-joystick.yaml
> index 2ee04e03bc22..2d755091e46d 100644
> --- a/Documentation/devicetree/bindings/input/adc-joystick.yaml
> +++ b/Documentation/devicetree/bindings/input/adc-joystick.yaml
> @@ -18,6 +18,12 @@ properties:
>    compatible:
>      const: adc-joystick
> 
> +  poll-interval:
> +    description:
> +      Poll interval time in milliseconds. If not specified, device 
> will use
> +      triggered buffer.

It doesn't have to use *triggered* buffer - it can use regular buffer 
as well.

The property should use a unit suffix, as explained here:
https://github.com/devicetree-org/dt-schema/blob/main/dtschema/schemas/property-units.yaml

So it should be named poll-interval-ms.

Cheers,
-Paul

> +    $ref: /schemas/types.yaml#/definitions/uint32
> +
>    io-channels:
>      minItems: 1
>      maxItems: 1024
> --
> 2.34.1
>
Chris Morgan June 27, 2022, 10:41 p.m. UTC | #2
On Mon, Jun 27, 2022 at 11:33:28PM +0100, Paul Cercueil wrote:
> Hi Chris,
> 
> Le lun., juin 27 2022 at 17:14:42 -0500, Chris Morgan
> <macroalpha82@gmail.com> a écrit :
> > Add poll-interval support for the adc-joystick documentation. This is
> > an optional value and if not provided the adc-joystick works as it
> > does today (with triggered buffers). If this value is provided, the
> > adc-joystick driver is polled at the specified interval.
> > 
> > Signed-off-by: Maya Matuszczyk <maccraft123mc@gmail.com>
> > Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
> > ---
> >  Documentation/devicetree/bindings/input/adc-joystick.yaml | 6 ++++++
> >  1 file changed, 6 insertions(+)
> > 
> > diff --git a/Documentation/devicetree/bindings/input/adc-joystick.yaml
> > b/Documentation/devicetree/bindings/input/adc-joystick.yaml
> > index 2ee04e03bc22..2d755091e46d 100644
> > --- a/Documentation/devicetree/bindings/input/adc-joystick.yaml
> > +++ b/Documentation/devicetree/bindings/input/adc-joystick.yaml
> > @@ -18,6 +18,12 @@ properties:
> >    compatible:
> >      const: adc-joystick
> > 
> > +  poll-interval:
> > +    description:
> > +      Poll interval time in milliseconds. If not specified, device will
> > use
> > +      triggered buffer.
> 
> It doesn't have to use *triggered* buffer - it can use regular buffer as
> well.
> 
> The property should use a unit suffix, as explained here:
> https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fdevicetree-org%2Fdt-schema%2Fblob%2Fmain%2Fdtschema%2Fschemas%2Fproperty-units.yaml&amp;data=05%7C01%7C%7Cf6306210eda84b58f7f408da588d1627%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637919660856597552%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=NVqhWKdycQsv0ksiILD8aH%2BnZ6aji%2BhNxSEwBkQlZC0%3D&amp;reserved=0
> 
> So it should be named poll-interval-ms.
> 
> Cheers,
> -Paul

Understood, though the logic here was to be consistent with existing
implementations (such as adc-keys and gpio-keys-polled) which all
use poll-interval (no ms). Honest question, would it be better to be
right (poll-interval-ms) or consistent (poll-interval) in this case?

Thank you.

> 
> > +    $ref: /schemas/types.yaml#/definitions/uint32
> > +
> >    io-channels:
> >      minItems: 1
> >      maxItems: 1024
> > --
> > 2.34.1
> > 
> 
>
Paul Cercueil June 27, 2022, 10:47 p.m. UTC | #3
Le lun., juin 27 2022 at 17:41:37 -0500, Chris Morgan 
<macromorgan@hotmail.com> a écrit :
> On Mon, Jun 27, 2022 at 11:33:28PM +0100, Paul Cercueil wrote:
>>  Hi Chris,
>> 
>>  Le lun., juin 27 2022 at 17:14:42 -0500, Chris Morgan
>>  <macroalpha82@gmail.com> a écrit :
>>  > Add poll-interval support for the adc-joystick documentation. 
>> This is
>>  > an optional value and if not provided the adc-joystick works as it
>>  > does today (with triggered buffers). If this value is provided, 
>> the
>>  > adc-joystick driver is polled at the specified interval.
>>  >
>>  > Signed-off-by: Maya Matuszczyk <maccraft123mc@gmail.com>
>>  > Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
>>  > ---
>>  >  Documentation/devicetree/bindings/input/adc-joystick.yaml | 6 
>> ++++++
>>  >  1 file changed, 6 insertions(+)
>>  >
>>  > diff --git 
>> a/Documentation/devicetree/bindings/input/adc-joystick.yaml
>>  > b/Documentation/devicetree/bindings/input/adc-joystick.yaml
>>  > index 2ee04e03bc22..2d755091e46d 100644
>>  > --- a/Documentation/devicetree/bindings/input/adc-joystick.yaml
>>  > +++ b/Documentation/devicetree/bindings/input/adc-joystick.yaml
>>  > @@ -18,6 +18,12 @@ properties:
>>  >    compatible:
>>  >      const: adc-joystick
>>  >
>>  > +  poll-interval:
>>  > +    description:
>>  > +      Poll interval time in milliseconds. If not specified, 
>> device will
>>  > use
>>  > +      triggered buffer.
>> 
>>  It doesn't have to use *triggered* buffer - it can use regular 
>> buffer as
>>  well.
>> 
>>  The property should use a unit suffix, as explained here:
>>  
>> https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fdevicetree-org%2Fdt-schema%2Fblob%2Fmain%2Fdtschema%2Fschemas%2Fproperty-units.yaml&data=05%7C01%7C%7Cf6306210eda84b58f7f408da588d1627%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637919660856597552%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=NVqhWKdycQsv0ksiILD8aH%2BnZ6aji%2BhNxSEwBkQlZC0%3D&reserved=0
>> 
>>  So it should be named poll-interval-ms.
>> 
>>  Cheers,
>>  -Paul
> 
> Understood, though the logic here was to be consistent with existing
> implementations (such as adc-keys and gpio-keys-polled) which all
> use poll-interval (no ms). Honest question, would it be better to be
> right (poll-interval-ms) or consistent (poll-interval) in this case?

I guess those don't have a suffix for legacy reasons, and newly 
introduced properties should follow the standard.

But I guess that's a question for DT maintainers.

Cheers,
-Paul

> 
> Thank you.
> 
>> 
>>  > +    $ref: /schemas/types.yaml#/definitions/uint32
>>  > +
>>  >    io-channels:
>>  >      minItems: 1
>>  >      maxItems: 1024
>>  > --
>>  > 2.34.1
>>  >
>> 
>>
Rob Herring June 30, 2022, 3:08 p.m. UTC | #4
On Mon, Jun 27, 2022 at 4:48 PM Paul Cercueil <paul@crapouillou.net> wrote:
>
>
>
> Le lun., juin 27 2022 at 17:41:37 -0500, Chris Morgan
> <macromorgan@hotmail.com> a écrit :
> > On Mon, Jun 27, 2022 at 11:33:28PM +0100, Paul Cercueil wrote:
> >>  Hi Chris,
> >>
> >>  Le lun., juin 27 2022 at 17:14:42 -0500, Chris Morgan
> >>  <macroalpha82@gmail.com> a écrit :
> >>  > Add poll-interval support for the adc-joystick documentation.
> >> This is
> >>  > an optional value and if not provided the adc-joystick works as it
> >>  > does today (with triggered buffers). If this value is provided,
> >> the
> >>  > adc-joystick driver is polled at the specified interval.
> >>  >
> >>  > Signed-off-by: Maya Matuszczyk <maccraft123mc@gmail.com>
> >>  > Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
> >>  > ---
> >>  >  Documentation/devicetree/bindings/input/adc-joystick.yaml | 6
> >> ++++++
> >>  >  1 file changed, 6 insertions(+)
> >>  >
> >>  > diff --git
> >> a/Documentation/devicetree/bindings/input/adc-joystick.yaml
> >>  > b/Documentation/devicetree/bindings/input/adc-joystick.yaml
> >>  > index 2ee04e03bc22..2d755091e46d 100644
> >>  > --- a/Documentation/devicetree/bindings/input/adc-joystick.yaml
> >>  > +++ b/Documentation/devicetree/bindings/input/adc-joystick.yaml
> >>  > @@ -18,6 +18,12 @@ properties:
> >>  >    compatible:
> >>  >      const: adc-joystick
> >>  >
> >>  > +  poll-interval:
> >>  > +    description:
> >>  > +      Poll interval time in milliseconds. If not specified,
> >> device will
> >>  > use
> >>  > +      triggered buffer.
> >>
> >>  It doesn't have to use *triggered* buffer - it can use regular
> >> buffer as
> >>  well.
> >>
> >>  The property should use a unit suffix, as explained here:
> >>
> >> https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fdevicetree-org%2Fdt-schema%2Fblob%2Fmain%2Fdtschema%2Fschemas%2Fproperty-units.yaml&data=05%7C01%7C%7Cf6306210eda84b58f7f408da588d1627%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637919660856597552%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=NVqhWKdycQsv0ksiILD8aH%2BnZ6aji%2BhNxSEwBkQlZC0%3D&reserved=0
> >>
> >>  So it should be named poll-interval-ms.
> >>
> >>  Cheers,
> >>  -Paul
> >
> > Understood, though the logic here was to be consistent with existing
> > implementations (such as adc-keys and gpio-keys-polled) which all
> > use poll-interval (no ms). Honest question, would it be better to be
> > right (poll-interval-ms) or consistent (poll-interval) in this case?
>
> I guess those don't have a suffix for legacy reasons, and newly
> introduced properties should follow the standard.
>
> But I guess that's a question for DT maintainers.

It should be consistent with the rest of the input bindings.

Rob
Rob Herring June 30, 2022, 3:11 p.m. UTC | #5
On Mon, Jun 27, 2022 at 4:14 PM Chris Morgan <macroalpha82@gmail.com> wrote:
>
> Add poll-interval support for the adc-joystick documentation. This is
> an optional value and if not provided the adc-joystick works as it
> does today (with triggered buffers). If this value is provided, the
> adc-joystick driver is polled at the specified interval.
>
> Signed-off-by: Maya Matuszczyk <maccraft123mc@gmail.com>
> Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
> ---
>  Documentation/devicetree/bindings/input/adc-joystick.yaml | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/input/adc-joystick.yaml b/Documentation/devicetree/bindings/input/adc-joystick.yaml
> index 2ee04e03bc22..2d755091e46d 100644
> --- a/Documentation/devicetree/bindings/input/adc-joystick.yaml
> +++ b/Documentation/devicetree/bindings/input/adc-joystick.yaml
> @@ -18,6 +18,12 @@ properties:
>    compatible:
>      const: adc-joystick
>
> +  poll-interval:
> +    description:
> +      Poll interval time in milliseconds. If not specified, device will use
> +      triggered buffer.
> +    $ref: /schemas/types.yaml#/definitions/uint32

Already defined in input.yaml, so add a $ref to it and here you just
need 'poll-interval: true'.

Rob
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/input/adc-joystick.yaml b/Documentation/devicetree/bindings/input/adc-joystick.yaml
index 2ee04e03bc22..2d755091e46d 100644
--- a/Documentation/devicetree/bindings/input/adc-joystick.yaml
+++ b/Documentation/devicetree/bindings/input/adc-joystick.yaml
@@ -18,6 +18,12 @@  properties:
   compatible:
     const: adc-joystick
 
+  poll-interval:
+    description:
+      Poll interval time in milliseconds. If not specified, device will use
+      triggered buffer.
+    $ref: /schemas/types.yaml#/definitions/uint32
+
   io-channels:
     minItems: 1
     maxItems: 1024