From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.7 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1584CC433DF for ; Thu, 14 May 2020 20:01:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E78882065C for ; Thu, 14 May 2020 20:01:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728366AbgENUBG (ORCPT ); Thu, 14 May 2020 16:01:06 -0400 Received: from mail-ot1-f65.google.com ([209.85.210.65]:44616 "EHLO mail-ot1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728021AbgENUBG (ORCPT ); Thu, 14 May 2020 16:01:06 -0400 Received: by mail-ot1-f65.google.com with SMTP id j4so37397otr.11; Thu, 14 May 2020 13:01:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=PtBjkIGGxXDp1dHFJEjYfiWUY2P5QlsKo/K6/+WZmeY=; b=eRLUE4rvRcOHfERfQ/lZ1rp8Kk//qNdCk4bS2xoOhfNO5mIntyKzTVA1Ew4NEPbqll Z9Xp/obclZWi7Rp8ZkJWnI40MuL/JroOONIWQ3nXX17Ik0xrhHlp8+icT4xbqol+nGG2 wyHt6VeTrarxUE3nWZYnrDC90la4CRI3f76nNCy/F0dr7Tobz3XX4F/z44r9E8SPGR1r NCBRJhVH4t/cyHUR6WVUYzlH/VJnE++5Aq9t7nfgoU+qwF2NCK0ffxo8V3TT03M2bGns efQnrPDQqMiZyu1ayC39UUJAcEf4tuOgT5p26XiynCL178rf1RL27Vgd3IwFD0QuO0w5 vV0Q== X-Gm-Message-State: AOAM532+LP+Ow5o84UFzRHCjQ/WL+gkAC6gY/oXaZMrd6GDDH462NWkj 8+JloxnL0KveMpiodaoOpCDwSFn/rQZtNOrNdJI= X-Google-Smtp-Source: ABdhPJxlL7bOKztMOeZJClvcFRKGEuvOXp/eLE3eVPuXdamQTY6erD7PmPjlCxeaUKv6T7vSuweVf114QyJxq2E0ayI= X-Received: by 2002:a9d:564:: with SMTP id 91mr4920155otw.250.1589486465222; Thu, 14 May 2020 13:01:05 -0700 (PDT) MIME-Version: 1.0 References: <20200417140920.22596-1-geert+renesas@glider.be> <20200430023237.GA23316@bogus> In-Reply-To: <20200430023237.GA23316@bogus> From: Geert Uytterhoeven Date: Thu, 14 May 2020 22:00:53 +0200 Message-ID: Subject: Re: [PATCH RFC] dt-bindings: pinctrl: sh-pfc: Convert to json-schema To: Rob Herring Cc: Linus Walleij , Linux-Renesas , "open list:GPIO SUBSYSTEM" , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" Content-Type: text/plain; charset="UTF-8" Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org Hi Rob, On Thu, Apr 30, 2020 at 4:32 AM Rob Herring wrote: > On Fri, Apr 17, 2020 at 04:09:20PM +0200, Geert Uytterhoeven wrote: > > Convert the Renesas Pin Function Controller (PFC) Device Tree binding > > documentation to json-schema. > > > > Document missing properties. > > Drop deprecated and obsolete #gpio-range-cells property. > > Update the example to match reality. > > Drop consumer examples, as they do not belong here. > > > > Signed-off-by: Geert Uytterhoeven > > --- > > How to describe that pin configuration nodes can have subnodes? > > E.g. > > > > arch/arm/boot/dts/sh73a0-kzm9g.dt.yaml: pin-controller@e6050000: mmc: Additional properties are not allowed ('cfg', 'mux' were unexpected) > > I shouldn't tell you so no one does this again... > > I think you want something like this assuming you have either > grandchildren or properties, but not both in the child nodes: > > patternProperties: > ".*": > if: > type: object > then: > oneOf: > - allOf: > - $ref: pincfg-node.yaml# > - $ref: pinmux-node.yaml# > ... > - patternProperties: > ".*": > type: object > allOf: > - $ref: pincfg-node.yaml# > - $ref: pinmux-node.yaml# Thanks, sounds sane! As there are phandles pointing to the child node, I do need an explicit phandle property in the child node... > If you did have a mixture, then you'd need the same if/then construct. ... so I have a mixture, and do need the if/then construct. However, that gives me "is valid under each of" errors for all child nodes of sh-pfc nodes. As both child and grandchild do not have any required properties, I tried adding some, but that didn't help. Do you have a clue? For reference, this is what I ended up with: patternProperties: "^.*$": if: type: object then: oneOf: - allOf: - $ref: pincfg-node.yaml# - $ref: pinmux-node.yaml# description: Pinctrl node's client devices use subnodes for desired pin configuration. Client device subnodes use below standard properties. properties: phandle: true pins: true groups: true function: true bias-disable: true bias-pull-down: true bias-pull-up: true drive-strength: enum: [ 3, 6, 9, 12, 15, 18, 21, 24 ] # Superset of supported values power-source: enum: [ 1800, 3300 ] gpio-hog: true gpios: true input: true output-high: true output-low: true additionalProperties: false - properties: phandle: true patternProperties: "^.*$": if: type: object then: allOf: - $ref: pincfg-node.yaml# - $ref: pinmux-node.yaml# description: Pinctrl node's client devices use subnodes for desired pin configuration. Client device subnodes use below standard properties. properties: pins: true groups: true function: true bias-disable: true bias-pull-down: true bias-pull-up: true drive-strength: enum: [ 3, 6, 9, 12, 15, 18, 21, 24 ] # Superset of supported values power-source: enum: [ 1800, 3300 ] gpio-hog: true gpios: true input: true output-high: true output-low: true additionalProperties: false additionalProperties: false > Now it probably ends up that the 'allOf' and everything else with it are > duplicated. If so you can do: > > definitions: > pin-nodes: > allOf: > ... > > And use '$ref: #/definitions/pin-nodes' where you need it. > > That probably is not going to work with the fixups the tooling does, but > we could fix that. Obviously I haven't tried this part yet, but I'll keep it in mind. Thanks! Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds