Linux-IIO Archive on lore.kernel.org
 help / color / Atom feed
From: Fabrice Gasnier <fabrice.gasnier@st.com>
To: Rob Herring <robh@kernel.org>
Cc: Jonathan Cameron <jic23@kernel.org>,
	Alexandre Torgue <alexandre.torgue@st.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Hartmut Knaack <knaack.h@gmx.de>,
	Peter Meerwald <pmeerw@pmeerw.net>,
	olivier moysan <olivier.moysan@st.com>,
	"open list:IIO SUBSYSTEM AND DRIVERS" <linux-iio@vger.kernel.org>,
	<devicetree@vger.kernel.org>,
	<linux-stm32@st-md-mailman.stormreply.com>,
	"moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" 
	<linux-arm-kernel@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] dt-bindings: iio: adc: stm32-adc: convert bindings to json-schema
Date: Wed, 15 Jan 2020 14:34:11 +0100
Message-ID: <acb1e853-c673-7b6d-3ceb-6e994ae06fe1@st.com> (raw)
In-Reply-To: <CAL_JsqJdw=WzMhp1d9E3131AuyO7in7bgR5X4NM1n7Ox4X0YXw@mail.gmail.com>

On 1/14/20 8:20 PM, Rob Herring wrote:
> On Tue, Jan 14, 2020 at 10:02 AM Fabrice Gasnier <fabrice.gasnier@st.com> wrote:
>>
>> On 12/18/19 12:43 AM, Rob Herring wrote:
>>> On Fri, Dec 06, 2019 at 05:17:08PM +0100, Fabrice Gasnier wrote:
>>>> Convert the STM32 ADC binding to DT schema format using json-schema
>>>>
>>>> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
>>>> ---
>>>> Note: this applies on top of IIO tree currently (iio-for-5.5c).
>>>>
>>>> Changes in V2:
>>>> - Take almost all of Rob suggestions (removed reg generic description,
>>>>   added minItems, maxItems, st,max-clk-rate-hz range, drop some pipes,
>>>>   simplify clock-names, remove unneeded allOfs)
>>>> - For now, keep all in one file despite there are lots of if/thens in the
>>>>   bindings
>>>> ---
>>>>  .../devicetree/bindings/iio/adc/st,stm32-adc.txt   | 149 -------
>>>>  .../devicetree/bindings/iio/adc/st,stm32-adc.yaml  | 454 +++++++++++++++++++++
>>>>  2 files changed, 454 insertions(+), 149 deletions(-)
>>>>  delete mode 100644 Documentation/devicetree/bindings/iio/adc/st,stm32-adc.txt
>>>>  create mode 100644 Documentation/devicetree/bindings/iio/adc/st,stm32-adc.yaml
>>>
>>>
>>
>>
>> [snip]
>>
>>>> +
>>>> +      st,adc-channels:
>>>> +        description: |
>>>> +          List of single-ended channels muxed for this ADC. It can have up to:
>>>> +            - 16 channels, numbered from 0 to 15 (for in0..in15) on stm32f4
>>>> +            - 20 channels, numbered from 0 to 19 (for in0..in19) on stm32h7 and
>>>> +              stm32mp1.
>>>> +        allOf:
>>>> +          - $ref: /schemas/types.yaml#/definitions/uint32-array
>>>> +
>>
>> [snip]
>>
>>>> +
>>>> +    allOf:
>>>> +      - if:
>>>> +          properties:
>>>> +            compatible:
>>>> +              contains:
>>>> +                const: st,stm32f4-adc
>>>> +
>>>> +        then:
>>>> +          properties:
>>>> +            reg:
>>>> +              enum:
>>>> +                - 0x0
>>>> +                - 0x100
>>>> +                - 0x200
>>>> +
>>>> +            interrupts:
>>>> +              minimum: 0
>>>> +              maximum: 2
>>>> +
>>>> +            assigned-resolution-bits:
>>>> +              enum: [6, 8, 10, 12]
>>>> +              default: 12
>>>> +
>>>> +            st,adc-channels:
>>>> +              minItems: 1
>>>> +              maxItems: 16
>>>> +              minimum: 0
>>>> +              maximum: 15
>>>
>>> You are mixing array and scalar constraints here. You need:
>>>
>>> minItems: 1
>>> maxItems:16
>>> items:
>>>   minimum: 0
>>>   maximum: 15
>>>
>>> Update dtschema. It will now catch this. There's a few others too.
>>
>> Hi Rob,
>>
>> Sorry for the late reply. I updated dtschema. Now it catches it.
>>
>> I've tried your suggestion, but when I test it, I don't get any error on
>> maxItems.
>>
>> In the example: "st,adc-channels = <0>, <1>, ... more than 16 items;"
>>
>> Is it possible I face some other issue with dtschema ?
> 
> The problem is how "<0>, <1>" vs. "<0 1>" gets encoded. While those
> are the same in the dtb, in yaml we have "[[0], [1]]" vs. "[[0, 1]]".
> Making the brackets significant is helpful for some things like
> phandle+args and 'reg' where we have a matrix of values, but for
> arrays it just gets in the way. I think as I suggested is the right
> form for the binding schema, and we need to either decide what's the
> correct way for brackets or improve the tool to accept both ways.

Hi Rob,

Thanks for the quick answer and clarification.

I'll adopt the way you suggest in V3 (the dts files already use <0 1...>
syntax). I'll also update the example in the bindings to use it, to
point the right form.

Thanks,
Fabrice

> 
> Rob
> 

      reply index

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-06 16:17 Fabrice Gasnier
2019-12-17 23:43 ` Rob Herring
2020-01-14 16:01   ` Fabrice Gasnier
2020-01-14 19:20     ` Rob Herring
2020-01-15 13:34       ` Fabrice Gasnier [this message]

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=acb1e853-c673-7b6d-3ceb-6e994ae06fe1@st.com \
    --to=fabrice.gasnier@st.com \
    --cc=alexandre.torgue@st.com \
    --cc=devicetree@vger.kernel.org \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=mark.rutland@arm.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=olivier.moysan@st.com \
    --cc=pmeerw@pmeerw.net \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-IIO Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-iio/0 linux-iio/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-iio linux-iio/ https://lore.kernel.org/linux-iio \
		linux-iio@vger.kernel.org
	public-inbox-index linux-iio

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-iio


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git