From patchwork Mon Jan 4 09:33:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 356344 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp14825277jai; Mon, 4 Jan 2021 01:34:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJwT/fJZLRa0Dmszd8+ysEUxsrvd3nSP9msdaGyOnt40pt4W7MmD5Rb8UWuxgNB7yLBoKZDV X-Received: by 2002:a17:906:d0c1:: with SMTP id bq1mr59733642ejb.202.1609752882299; Mon, 04 Jan 2021 01:34:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609752882; cv=none; d=google.com; s=arc-20160816; b=nkTOtTrEZFPFP6bV/dgMKbAZMvFZPIJ9ljjw7QvCJP+h+CCHy3v0+XFzGzHee3u3d1 56wAsXVxFa8LrWy2yX4zDB/mZ+viENJ1gf7tdhgQ1wfPVVutroEXlHtxlGuPV+sjApB4 6gfoHAcVMNKbl8eOlmK+QL3pCdsIga44cpsWVTkWz7+lE/s2Znrrz/yIl3AKhQOPPjO7 X3uOA4Ji69Lm6+w+lKzrRU+D4pUHgpa3lMFfKTOjTXt2d48jAFt1zWSNdEN10/BtEfrq adFV0QIqSQ5hXWiZD2UVh6BJkX/ONDep5FVHd2LVLDnRG2xy6TPisL45DZPK2ThL+pzM lJ7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Sp2ZVVsfaRn48/FhBoaoMwI8s72Iim60HIepCXCqUd0=; b=tkhkWpD3/RiL0rsGClLRiJ9+8pFhP6d/wkmDDRucq83lmD6DCwG88GNablJMiz77xV A+z8bhuHpumRBLagGHatpD+HAIDVnO4CAsZEdMQvRstdkeEjAwJ/2TV3D8fXo6cVTiX0 EsdffSxuJvgf/PtlgbprtOxxt2dA55PT0yY5z/zGJDw0FDnFGybu+ijLVY6XW0OFcZa8 pqq1/GURA+XB2StS+LhmOY6GoQhCbdvPHyUcH+FvtoSHkO4ePp0sctgcEI+P+/kTHOze CPBCzvQCbpcJE3DN+kl7vFKyxosYDvF8WLQBjErLedFr5zSIy9fsBWFz+esK1rd6irxN 36fA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EoSoBjXH; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id sa7si29627638ejb.706.2021.01.04.01.34.42; Mon, 04 Jan 2021 01:34:42 -0800 (PST) Received-SPF: pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EoSoBjXH; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726260AbhADJe2 (ORCPT + 6 others); Mon, 4 Jan 2021 04:34:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726173AbhADJe2 (ORCPT ); Mon, 4 Jan 2021 04:34:28 -0500 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3684C061793 for ; Mon, 4 Jan 2021 01:33:47 -0800 (PST) Received: by mail-lf1-x131.google.com with SMTP id h205so62788253lfd.5 for ; Mon, 04 Jan 2021 01:33:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Sp2ZVVsfaRn48/FhBoaoMwI8s72Iim60HIepCXCqUd0=; b=EoSoBjXHKV33QXrS65xXQT0RSqjSjwTnNxzldDSo0hu2nRScEvP8o+tQlz0zhorHJU raQkPU4N+O8uP/XNRFqx9nIV05dScIhm/xiFGwkB86RNgppiFdLjtmBhbGnOd+xzLs79 lr5fbjB++iJVRxgldiFtjOm/KmYnpHtCavLYQTVeCj3fq/WvCe2QvGNAiBRTptfTTnkc jzt7b00qxYKXU6mkaOXVURVJ8l4oRtTWF6sqdhV9QQczEJas/a1gsroHrih+NzkY8I6J nVZY36xpjC3o4kNffXP7sfJvyt3NHE1ZPu7itIZWgM93CNJdbh3SDZqoz25SEnGUq//h tJNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Sp2ZVVsfaRn48/FhBoaoMwI8s72Iim60HIepCXCqUd0=; b=CimQ6eN4QM4shiUKGnpujXEgiZXkvdZfHlZxlvJxq9ZBK6hG7UUih0SFbG1Rf0lIDf lHhb5VTqwih1YT80zAnXKsjdhgBZw2GrKwrdPJFJYMWGoZIqsqDLGvHifndIiqKH5NGY xQOlM/vTJMydN7alY0bwukgpN+n35xbgVqezUD74Z0rfKFKj2p3Z08oW4+6wBpmsLjP3 0IuY/fRC6foB8HHYEK9RIlQMjzZLsNejH8dld48IPOqRJ2xDH8stQOJOvxPLbyWeOzrY sR8+c715C/dtsMB2paICqzQwV8wFgb8jA+BfIzqGjZXgZXwymjHuhvCRsuKz+OL/vfrn wObg== X-Gm-Message-State: AOAM533UY2Es+y+/4iJ/EEdi3G/p3O4jrEZ29fhERnn2BxBpvYKvsnHg u1sfwAIql2wsB5YY6/OGGBw8zw== X-Received: by 2002:a05:651c:2101:: with SMTP id a1mr29304029ljq.322.1609752825999; Mon, 04 Jan 2021 01:33:45 -0800 (PST) Received: from localhost.localdomain (c-92d7225c.014-348-6c756e10.bbcust.telenor.se. [92.34.215.146]) by smtp.gmail.com with ESMTPSA id o21sm7234066lfc.153.2021.01.04.01.33.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Jan 2021 01:33:45 -0800 (PST) From: Linus Walleij To: Jonathan Cameron , linux-iio@vger.kernel.org Cc: Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Linus Walleij , devicetree@vger.kernel.org, Rob Herring Subject: [PATCH] iio: st-sensors: Update ST Sensor bindings Date: Mon, 4 Jan 2021 10:33:43 +0100 Message-Id: <20210104093343.2134410-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org This adjusts the ST Sensor bindings with the more fine-grained syntax checks that were proposed late in the last kernel cycle and colliding with parallel work. Cc: devicetree@vger.kernel.org Reviewed-by: Rob Herring Signed-off-by: Linus Walleij --- .../bindings/iio/st,st-sensors.yaml | 252 ++++++++++++------ 1 file changed, 174 insertions(+), 78 deletions(-) -- 2.29.2 diff --git a/Documentation/devicetree/bindings/iio/st,st-sensors.yaml b/Documentation/devicetree/bindings/iio/st,st-sensors.yaml index db291a9390b7..aba8dc4275a9 100644 --- a/Documentation/devicetree/bindings/iio/st,st-sensors.yaml +++ b/Documentation/devicetree/bindings/iio/st,st-sensors.yaml @@ -6,7 +6,9 @@ $schema: http://devicetree.org/meta-schemas/core.yaml# title: STMicroelectronics MEMS sensors -description: | +description: The STMicroelectronics sensor devices are pretty straight-forward + I2C or SPI devices, all sharing the same device tree descriptions no matter + what type of sensor it is. Note that whilst this covers many STMicro MEMs sensors, some more complex IMUs need their own bindings. The STMicroelectronics sensor devices are pretty straight-forward I2C or @@ -15,89 +17,181 @@ description: | maintainers: - Denis Ciocca + - Linus Walleij properties: compatible: - description: | - Some values are deprecated. - st,lis3lv02d (deprecated, use st,lis3lv02dl-accel) - st,lis302dl-spi (deprecated, use st,lis3lv02dl-accel) - enum: - # Accelerometers - - st,lis3lv02d - - st,lis302dl-spi - - st,lis3lv02dl-accel - - st,lsm303dlh-accel - - st,lsm303dlhc-accel - - st,lis3dh-accel - - st,lsm330d-accel - - st,lsm330dl-accel - - st,lsm330dlc-accel - - st,lis331dl-accel - - st,lis331dlh-accel - - st,lsm303dl-accel - - st,lsm303dlm-accel - - st,lsm330-accel - - st,lsm303agr-accel - - st,lis2dh12-accel - - st,h3lis331dl-accel - - st,lng2dm-accel - - st,lis3l02dq - - st,lis2dw12 - - st,lis3dhh - - st,lis3de - - st,lis2de12 - - st,lis2hh12 - # Gyroscopes - - st,l3g4200d-gyro - - st,lsm330d-gyro - - st,lsm330dl-gyro - - st,lsm330dlc-gyro - - st,l3gd20-gyro - - st,l3gd20h-gyro - - st,l3g4is-gyro - - st,lsm330-gyro - - st,lsm9ds0-gyro - # Magnetometers - - st,lsm303agr-magn - - st,lsm303dlh-magn - - st,lsm303dlhc-magn - - st,lsm303dlm-magn - - st,lis3mdl-magn - - st,lis2mdl - - st,lsm9ds1-magn - # Pressure sensors - - st,lps001wp-press - - st,lps25h-press - - st,lps331ap-press - - st,lps22hb-press - - st,lps33hw - - st,lps35hw - - st,lps22hh + oneOf: + - description: STMicroelectronics Accelerometers + enum: + - st,h3lis331dl-accel + - st,lis2de12 + - st,lis2dw12 + - st,lis2hh12 + - st,lis2dh12-accel + - st,lis331dl-accel + - st,lis331dlh-accel + - st,lis3de + - st,lis3dh-accel + - st,lis3dhh + - st,lis3l02dq + - st,lis3lv02dl-accel + - st,lng2dm-accel + - st,lsm303agr-accel + - st,lsm303dl-accel + - st,lsm303dlh-accel + - st,lsm303dlhc-accel + - st,lsm303dlm-accel + - st,lsm330-accel + - st,lsm330d-accel + - st,lsm330dl-accel + - st,lsm330dlc-accel + - description: STMicroelectronics Gyroscopes + enum: + - st,l3g4200d-gyro + - st,l3g4is-gyro + - st,l3gd20-gyro + - st,l3gd20h-gyro + - st,lsm330-gyro + - st,lsm330d-gyro + - st,lsm330dl-gyro + - st,lsm330dlc-gyro + - st,lsm9ds0-gyro + - description: STMicroelectronics Magnetometers + enum: + - st,lis2mdl + - st,lis3mdl-magn + - st,lsm303agr-magn + - st,lsm303dlh-magn + - st,lsm303dlhc-magn + - st,lsm303dlm-magn + - st,lsm9ds1-magn + - description: STMicroelectronics Pressure Sensors + enum: + - st,lps001wp-press + - st,lps22hb-press + - st,lps22hh + - st,lps25h-press + - st,lps331ap-press + - st,lps33hw + - st,lps35hw + - description: Deprecated bindings + enum: + - st,lis302dl-spi + - st,lis3lv02d + deprecated: true reg: maxItems: 1 interrupts: + description: interrupt line(s) connected to the DRDY line(s) and/or the + Intertial interrupt lines INT1 and INT2 if these exist. This means up to + three interrupts, and the DRDY must be the first one if it exists on + the package. The trigger edge of the interrupts is sometimes software + configurable in the hardware so the operating system should parse this + flag and set up the trigger edge as indicated in the device tree. minItems: 1 + maxItems: 2 vdd-supply: true vddio-supply: true st,drdy-int-pin: $ref: /schemas/types.yaml#/definitions/uint32 - description: - Some sensors have multiple possible pins via which they can provide - a data ready interrupt. This selects which one. - enum: - - 1 - - 2 + maxItems: 1 + description: the pin on the package that will be used to signal + "data ready" (valid values 1 or 2). This property is not configurable + on all sensors. + items: + minimum: 1 + maximum: 2 drive-open-drain: - $ref: /schemas/types.yaml#/definitions/flag - description: | - The interrupt/data ready line will be configured as open drain, which - is useful if several sensors share the same interrupt line. + type: boolean + description: the interrupt/data ready line will be configured + as open drain, which is useful if several sensors share the same + interrupt line. (This binding is taken from pinctrl.) + + mount-matrix: + description: an optional 3x3 mounting rotation matrix. + +allOf: + - if: + properties: + compatible: + enum: + # These have no interrupts + - st,lps001wp + then: + properties: + interrupts: false + st,drdy-int-pin: false + drive-open-drain: false + + - if: + properties: + compatible: + enum: + # These have only DRDY + - st,lis2mdl + - st,lis3l02dq + - st,lis3lv02dl-accel + - st,lps22hb-press + - st,lps22hh + - st,lps25h-press + - st,lps33hw + - st,lps35hw + - st,lsm303agr-magn + - st,lsm303dlh-magn + - st,lsm303dlhc-magn + - st,lsm303dlm-magn + then: + properties: + interrupts: + maxItems: 1 + st,drdy-int-pin: false + + - if: + properties: + compatible: + enum: + # Two intertial interrupts i.e. accelerometer/gyro interrupts + - st,h3lis331dl-accel + - st,l3g4200d-gyro + - st,l3g4is-gyro + - st,l3gd20-gyro + - st,l3gd20h-gyro + - st,lis2de12 + - st,lis2dw12 + - st,lis2hh12 + - st,lis2dh12-accel + - st,lis331dl-accel + - st,lis331dlh-accel + - st,lis3de + - st,lis3dh-accel + - st,lis3dhh + - st,lis3mdl-magn + - st,lng2dm-accel + - st,lps331ap-press + - st,lsm303agr-accel + - st,lsm303dlh-accel + - st,lsm303dlhc-accel + - st,lsm303dlm-accel + - st,lsm330-accel + - st,lsm330-gyro + - st,lsm330d-accel + - st,lsm330d-gyro + - st,lsm330dl-accel + - st,lsm330dl-gyro + - st,lsm330dlc-accel + - st,lsm330dlc-gyro + - st,lsm9ds0-gyro + - st,lsm9ds1-magn + then: + properties: + interrupts: + maxItems: 2 required: - compatible @@ -108,16 +202,18 @@ additionalProperties: false examples: - | #include + #include i2c { - #address-cells = <1>; - #size-cells = <0>; - accelerometer@1d { - compatible = "st,lis3lv02dl-accel"; - reg = <0x1d>; - interrupt-parent = <&gpio2>; - interrupts = <18 IRQ_TYPE_EDGE_RISING>; - pinctrl-0 = <&lis3lv02dl_nhk_mode>; - pinctrl-names = "default"; - }; + #address-cells = <1>; + #size-cells = <0>; + + accelerometer@1c { + compatible = "st,lis331dl-accel"; + reg = <0x1c>; + st,drdy-int-pin = <1>; + vdd-supply = <&ldo1>; + vddio-supply = <&ldo2>; + interrupt-parent = <&gpio>; + interrupts = <18 IRQ_TYPE_EDGE_RISING>, <19 IRQ_TYPE_EDGE_RISING>; + }; }; -...