From patchwork Sat Oct 31 18:24:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 314648 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=-13.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable 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 464F1C5517A for ; Sat, 31 Oct 2020 18:26:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0D01A20709 for ; Sat, 31 Oct 2020 18:26:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604168797; bh=U1dh3AOQV2DXiOJH4cpAjoDC8XqoWAgV4iaJYvGXQtg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ng0AySx5bOYK9I1cNmQtNfRbN8lDOMP3uGKwoYEUIfnWfweTG+ZNc18Vm/zA8c8Gk ekOm3dcHFZDs8Z7cQcoIEzlxjl2gGJ1jl8LQwDwMTUNRixoImMmA+uult9VEVTvpEJ 7MD9TxKfWC8jW8BKeZsym3JB7lnZAh+1cKPPs35E= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728238AbgJaS0g (ORCPT ); Sat, 31 Oct 2020 14:26:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:51474 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727967AbgJaS0g (ORCPT ); Sat, 31 Oct 2020 14:26:36 -0400 Received: from localhost.localdomain (cpc149474-cmbg20-2-0-cust94.5-4.cable.virginm.net [82.4.196.95]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BF5D3206E5; Sat, 31 Oct 2020 18:26:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604168795; bh=U1dh3AOQV2DXiOJH4cpAjoDC8XqoWAgV4iaJYvGXQtg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TryrTrDxC0xSVC3Omn3nqpQKjoikf2Zd2F4cH4+DJRhMlfSl3I1IE115ySymNamTY JcO4sG1eVrL/UjFa25Ca0gtNVu8eRHE6FV29iQzIb8eM1AUsEgsGLhHgmIPIucpow4 RTjZTELc7iq6OQviUAM3mfAQSoiPRi+Jif/8YWhs= From: Jonathan Cameron To: linux-iio@vger.kernel.org, Rob Herring , devicetree@vger.kernel.org Cc: Jonathan Cameron Subject: [PATCH 1/3] dt-bindings:iio:adc: convert adc.txt to yaml Date: Sat, 31 Oct 2020 18:24:21 +0000 Message-Id: <20201031182423.742798-2-jic23@kernel.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201031182423.742798-1-jic23@kernel.org> References: <20201031182423.742798-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Jonathan Cameron Each driver that uses this will need to use a $ref We can't always enable it like most of the generic bindings due to channel@X matching far more widely than IIO. Signed-off-by: Jonathan Cameron --- .../devicetree/bindings/iio/adc/adc.txt | 23 ----------- .../devicetree/bindings/iio/adc/adc.yaml | 38 +++++++++++++++++++ 2 files changed, 38 insertions(+), 23 deletions(-) diff --git a/Documentation/devicetree/bindings/iio/adc/adc.txt b/Documentation/devicetree/bindings/iio/adc/adc.txt deleted file mode 100644 index 5bbaa330a250..000000000000 --- a/Documentation/devicetree/bindings/iio/adc/adc.txt +++ /dev/null @@ -1,23 +0,0 @@ -Common ADCs properties - -Optional properties for child nodes: -- bipolar : Boolean, if set the channel is used in bipolar mode. -- diff-channels : Differential channels muxed for this ADC. The first value - specifies the positive input pin, the second value the negative - input pin. - -Example: - adc@0 { - compatible = "some,adc"; - ... - channel@0 { - bipolar; - diff-channels = <0 1>; - ... - }; - - channel@1 { - diff-channels = <2 3>; - ... - }; - }; diff --git a/Documentation/devicetree/bindings/iio/adc/adc.yaml b/Documentation/devicetree/bindings/iio/adc/adc.yaml new file mode 100644 index 000000000000..328a4318feee --- /dev/null +++ b/Documentation/devicetree/bindings/iio/adc/adc.yaml @@ -0,0 +1,38 @@ +# SPDX-License-Identifier: GPL-2.0 +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/iio/adc/adc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Generic IIO bindings for ADC channels + +maintainers: + - Jonathan Cameron + +description: + A few properties are defined in a common way ADC channels. + +properties: + $nodename: + pattern: "^channel(@[0-9a-f]+)?$" + description: + A channel index should match reg. + + reg: + maxItems: 1 + + bipolar: + $ref: /schemas/types.yaml#/definitions/flag + description: If provided, the channel is to be used in bipolar mode. + + diff-channels: + $ref: /schemas/types.yaml#/definitions/uint32-array + maxItems: 2 + minItems: 2 + description: + Many ADCs have dual Muxes to allow different input pins to be routed + to both the positive and negative inputs of a differential ADC. + The first value specifies the positive input pin, the second + specifies the negative input pin. + +additionalProperties: true From patchwork Sat Oct 31 18:18:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 314653 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=-13.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 37B4CC55178 for ; Sat, 31 Oct 2020 18:20:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F0AA620719 for ; Sat, 31 Oct 2020 18:20:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604168418; bh=gfl1n+x4WbQDsrGohgRC0WCtr5ijNKHsIMlJA0UxVe4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=zw9+uu9nGzUw83xj95uuA2qsvQoVgfRJ8G++stP0q/7XSY7eVvw3Vep0QpfAh/SWA /Nny9QE/w1jyAXr/M0ymGw+snHqy0j+N00FRj0IPAY4lwnWbSxZSOpbE6s4dYoD2Ui qCjkHRrJluvyJ2wfnI65ROOX6eKQphxDbDiBkI2c= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728232AbgJaSUR (ORCPT ); Sat, 31 Oct 2020 14:20:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:47402 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727967AbgJaSUR (ORCPT ); Sat, 31 Oct 2020 14:20:17 -0400 Received: from localhost.localdomain (cpc149474-cmbg20-2-0-cust94.5-4.cable.virginm.net [82.4.196.95]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B119B20709; Sat, 31 Oct 2020 18:20:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604168416; bh=gfl1n+x4WbQDsrGohgRC0WCtr5ijNKHsIMlJA0UxVe4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Brepfq6Uj7dYMC7nt5hp2NcJ2NywXysRiXpLMqS6SWXied/SlgCtS6UEmLARQAuru FT3LaD6LSjyr0SFthw/CWKqF0cl+jpCyrddfGuFc4BGa2hXEXZrRHvGwUL2hjYF0YF dyoIlNMU2JCWVXLYkKMZqtBTA0ck/skcFcI078X8= From: Jonathan Cameron To: linux-iio@vger.kernel.org, Rob Herring , devicetree@vger.kernel.org, linux-i2c@vger.kernel.org Cc: Wolfram Sang , Jonathan Cameron , Jean-Baptiste Maneyrol , Wolfram Sang , Peter Rosin Subject: [PATCH 2/3] dt-bindings:iio:imu:invensense, mpu6050: txt to yaml conversion Date: Sat, 31 Oct 2020 18:18:00 +0000 Message-Id: <20201031181801.742585-3-jic23@kernel.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201031181801.742585-1-jic23@kernel.org> References: <20201031181801.742585-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Jonathan Cameron Relies on the patch to convert i2c-gate over to yaml. 2 prior examples combinded into one as a single example can show all of the binding elements as long as the right part is selected. I don't know if there is a simple way to exclude i2c-gate if the master interface is SPI. Signed-off-by: Jonathan Cameron Cc: Jean-Baptiste Maneyrol Cc: Wolfram Sang Cc: Peter Rosin Reviewed-by: Rob Herring --- .../bindings/iio/imu/inv_mpu6050.txt | 67 ----------- .../bindings/iio/imu/invensense,mpu6050.yaml | 105 ++++++++++++++++++ 2 files changed, 105 insertions(+), 67 deletions(-) diff --git a/Documentation/devicetree/bindings/iio/imu/inv_mpu6050.txt b/Documentation/devicetree/bindings/iio/imu/inv_mpu6050.txt deleted file mode 100644 index f2f64749e818..000000000000 --- a/Documentation/devicetree/bindings/iio/imu/inv_mpu6050.txt +++ /dev/null @@ -1,67 +0,0 @@ -InvenSense MPU-6050 Six-Axis (Gyro + Accelerometer) MEMS MotionTracking Device - -http://www.invensense.com/mems/gyro/mpu6050.html - -Required properties: - - compatible : should be one of - "invensense,mpu6000" - "invensense,mpu6050" - "invensense,mpu6500" - "invensense,mpu6515" - "invensense,mpu9150" - "invensense,mpu9250" - "invensense,mpu9255" - "invensense,icm20608" - "invensense,icm20609" - "invensense,icm20689" - "invensense,icm20602" - "invensense,icm20690" - "invensense,iam20680" - - reg : the I2C address of the sensor - - interrupts: interrupt mapping for IRQ. It should be configured with flags - IRQ_TYPE_LEVEL_HIGH, IRQ_TYPE_EDGE_RISING, IRQ_TYPE_LEVEL_LOW or - IRQ_TYPE_EDGE_FALLING. - - Refer to interrupt-controller/interrupts.txt for generic interrupt client node - bindings. - -Optional properties: - - vdd-supply: regulator phandle for VDD supply - - vddio-supply: regulator phandle for VDDIO supply - - mount-matrix: an optional 3x3 mounting rotation matrix - - i2c-gate node. These devices also support an auxiliary i2c bus. This is - simple enough to be described using the i2c-gate binding. See - i2c/i2c-gate.txt for more details. - -Example: - mpu6050@68 { - compatible = "invensense,mpu6050"; - reg = <0x68>; - interrupt-parent = <&gpio1>; - interrupts = <18 IRQ_TYPE_EDGE_RISING>; - mount-matrix = "-0.984807753012208", /* x0 */ - "0", /* y0 */ - "-0.173648177666930", /* z0 */ - "0", /* x1 */ - "-1", /* y1 */ - "0", /* z1 */ - "-0.173648177666930", /* x2 */ - "0", /* y2 */ - "0.984807753012208"; /* z2 */ - }; - - - mpu9250@68 { - compatible = "invensense,mpu9250"; - reg = <0x68>; - interrupt-parent = <&gpio3>; - interrupts = <21 IRQ_TYPE_LEVEL_HIGH>; - i2c-gate { - #address-cells = <1>; - #size-cells = <0>; - ax8975@c { - compatible = "ak,ak8975"; - reg = <0x0c>; - }; - }; - }; diff --git a/Documentation/devicetree/bindings/iio/imu/invensense,mpu6050.yaml b/Documentation/devicetree/bindings/iio/imu/invensense,mpu6050.yaml new file mode 100644 index 000000000000..f640d161773c --- /dev/null +++ b/Documentation/devicetree/bindings/iio/imu/invensense,mpu6050.yaml @@ -0,0 +1,105 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/iio/imu/invensense,mpu6050.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: InvenSense MPU-6050 Six-Axis (Gyro + Accelerometer) MEMS MotionTracking Device + +maintainers: + - Jean-Baptiste Maneyrol + +description: | + These devices support both I2C and SPI bus interfaces. + +properties: + compatible: + enum: + - invensense,iam20680 + - invensense,icm20608 + - invensense,icm20609 + - invensense,icm20689 + - invensense,icm20602 + - invensense,icm20690 + - invensense,mpu6000 + - invensense,mpu6050 + - invensense,mpu6500 + - invensense,mpu6515 + - invensense,mpu9150 + - invensense,mpu9250 + - invensense,mpu9255 + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + spi-max-frequency: true + + vdd-supply: true + vddio-supply: true + + mount-matrix: true + + i2c-gate: + $ref: "../../i2c/i2c-gate.yaml" + unevaluatedProperties: false + description: | + These devices also support an auxiliary i2c bus. This is + simple enough to be described using the i2c-gate binding. + Only possible if using an I2C interface to the host. + +allOf: + - if: + not: + properties: + compatible: + contains: + enum: + - invensense,mpu9150 + - invensense,mpu9250 + - invensense,mpu9255 + then: + properties: + i2c-gate: false + +additionalProperties: false + +required: + - compatible + - reg + - interrupts + +examples: + - | + #include + i2c { + #address-cells = <1>; + #size-cells = <0>; + + imu@68 { + compatible = "invensense,mpu9250"; + reg = <0x68>; + interrupt-parent = <&gpio3>; + interrupts = <21 IRQ_TYPE_LEVEL_HIGH>; + mount-matrix = "-0.984807753012208", /* x0 */ + "0", /* y0 */ + "-0.173648177666930", /* z0 */ + "0", /* x1 */ + "-1", /* y1 */ + "0", /* z1 */ + "-0.173648177666930", /* x2 */ + "0", /* y2 */ + "0.984807753012208"; /* z2 */ + i2c-gate { + #address-cells = <1>; + #size-cells = <0>; + magnetometer@c { + compatible = "ak,ak8975"; + reg = <0x0c>; + }; + }; + }; + }; +... From patchwork Sat Oct 31 18:24:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 314647 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=-13.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable 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 20C30C388F7 for ; Sat, 31 Oct 2020 18:26:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D00A4206F9 for ; Sat, 31 Oct 2020 18:26:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604168799; bh=iG4tEeMkuEN1CjPDrAJAVJqqu/0GAuYu7rHxJfcwEh8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=q6r/FeDnIBElNaOrVlSa94Yqpj8cACPfyXGjTEq9SPK+zyjtytXV/AmKQnE2dymyr eaI/ouFPovTEWiP2/a668lsE9nI+welBqCmeMXffU6tHr70Ln3IadPR2XAWaBWOZsc FhRHMuK66np+B1rVBS5iJoAvCs4ZtzEPhNM5VpCM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728254AbgJaS0j (ORCPT ); Sat, 31 Oct 2020 14:26:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:51548 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727967AbgJaS0j (ORCPT ); Sat, 31 Oct 2020 14:26:39 -0400 Received: from localhost.localdomain (cpc149474-cmbg20-2-0-cust94.5-4.cable.virginm.net [82.4.196.95]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8837520709; Sat, 31 Oct 2020 18:26:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604168798; bh=iG4tEeMkuEN1CjPDrAJAVJqqu/0GAuYu7rHxJfcwEh8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wqS9/8BwBiYbW0ULplEDBToNq1SznyfAKwUbxV6XQeYTSwDigiVowT8Ktx3TzeQ9Q enr/GAIrB4QSDbI+IUiGfRk1g4sQdoHIsVMX1WxnzsRkThugBwGmyOOJAQXySGok0H 7EIv99V96O4Nmekn4dp/Q+cYTl94tJFwzey4iBtM= From: Jonathan Cameron To: linux-iio@vger.kernel.org, Rob Herring , devicetree@vger.kernel.org Cc: Jonathan Cameron , Marcelo Schmitt Subject: [PATCH 3/3] dt-bindings:iio:adc:adi, ad7292: Use new adc.yaml binding for channels. Date: Sat, 31 Oct 2020 18:24:23 +0000 Message-Id: <20201031182423.742798-4-jic23@kernel.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201031182423.742798-1-jic23@kernel.org> References: <20201031182423.742798-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Jonathan Cameron Also add additionalProperties: false for the child nodes. Signed-off-by: Jonathan Cameron Cc: Marcelo Schmitt --- Documentation/devicetree/bindings/iio/adc/adi,ad7292.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7292.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad7292.yaml index 108d202b288f..a3e39a40c9b3 100644 --- a/Documentation/devicetree/bindings/iio/adc/adi,ad7292.yaml +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7292.yaml @@ -45,10 +45,10 @@ required: patternProperties: "^channel@[0-7]$": + $ref: "adc.yaml" type: object description: | Represents the external channels which are connected to the ADC. - See Documentation/devicetree/bindings/iio/adc/adc.txt. properties: reg: @@ -58,13 +58,13 @@ patternProperties: - minimum: 0 maximum: 7 - diff-channels: - description: see Documentation/devicetree/bindings/iio/adc/adc.txt - maxItems: 1 + diff-channels: true required: - reg + additionalProperties: true + additionalProperties: false examples: