From patchwork Mon Apr 5 16:23:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 415297 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp3811491jai; Mon, 5 Apr 2021 09:25:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzWj1TGeKX4in2s5OKWxxbp5gw9iYRWr31p/3lCgK1L0SuPGn+cQ9qBGAdrCBj/PjUHdAe8 X-Received: by 2002:a17:906:f1d7:: with SMTP id gx23mr11605429ejb.109.1617639924736; Mon, 05 Apr 2021 09:25:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617639924; cv=none; d=google.com; s=arc-20160816; b=hyVzSh+uTmWOZOwPhLFbJE1xeN23LqMNL8A7svjTY9NAVt4ykPpKiW5tsD8hamY1NX WWaLnWwvjr9q0RjBU2txhVanfZL4qKR/+C0HjQU1UTPHG9B6ccGsq5Mwq+Pqk7pildKD d2xk03q1B5Bvhvqzh02lLQgF28NxliChPHX6ugUW0R0np37IyO1LdiYy78i6QL0QrQw8 4fNsLXGb2IywAgdjYUBCII0VNtPvecesCMV8I2aHb2luHd3Y+c+NVZzPFytJkr4lTzHl PUsX9bKNzkqd8PB7h3JwVogS5Gdi/6sfvBjSwNSkt9lOzV7mlWRFD5slq9Qfp4r+Xs/Y UDnA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=DuuOAFvfshgjh1gyOU3Y+PsfUD/7Q2sMgvguelx6c28=; b=aUBKN2EA/zzoz2+9V11t9fqlQBGcp8G0XlMhedVNdRHZGAomWIhDLth8FHzvEAogry G1g5aUr6TOUFBeX3bo3ZFJqsbztWQL8z8qWd+H7q9vzLhWE0m2+7up7Z6R1pTuCNZhsF WxW5k5JqQoltSk908PEqRbHmt8LuYiazT7OU0YY/e0rT+eSz1OywvPI3CPsduCtPk/BF H/WcHZAkJ3OcGCvjegfAO8RUcmg0alv/oGrePLkVDjc0d4orP3KSRcrGij6HVKPx2yX6 LeK9O5StArFAchf9Fd3ENpR8/B8lmYde0LsI8uAhdPybk4rbA8FImnK58QbmT9bZuqYU PE/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AipMG69A; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v10si2903810ejb.195.2021.04.05.09.25.24; Mon, 05 Apr 2021 09:25:24 -0700 (PDT) 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=@kernel.org header.s=k20201202 header.b=AipMG69A; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233805AbhDEQZa (ORCPT + 6 others); Mon, 5 Apr 2021 12:25:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:36436 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233795AbhDEQZ3 (ORCPT ); Mon, 5 Apr 2021 12:25:29 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0C6426139F; Mon, 5 Apr 2021 16:25:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617639923; bh=ZOW3mrwDd7Lb4ORQqzprHzWXlFL3Z2VrR4qbTRnCVkI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AipMG69AZ6l0OmXuuMnuKrep5KgvVeBVK75eyvghDTLZh1KqddJmGEqCEmLTjw5/f sQHFwLo+OjM+f8fp3DxfpsJRk2QvDWs7574OqdULI40TKr9xuCbgJNEkl6HZ4k/38j mFaMPscmNq8eIAXUSMwypdtZJ1LC7ZzGqlnRoEJ8w4q9/115oB6KQxszATGvDzT4k6 Pk4zQYlARzNvo54UAim2ldPqxhSgJd0wMA/JCKs8ARf1IIwPBS0zzdsv74mFYeax24 3HGQuCkw5PkJ8dhu4AYpUQyybYu8n0ulLmoh2jAlDWu/Q8FjkBQHJIiMBJpioe2Cyx hDwgFRxT9Od8A== From: Jonathan Cameron To: linux-iio@vger.kernel.org, Rob Herring Cc: Lars-Peter Clausen , devicetree@vger.kernel.org, Jonathan Cameron , Michael Hennerich Subject: [PATCH v2 1/2] iio:adc:ad7476: Handle the different regulators used by various parts. Date: Mon, 5 Apr 2021 17:23:24 +0100 Message-Id: <20210405162325.627977-2-jic23@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210405162325.627977-1-jic23@kernel.org> References: <20210405162325.627977-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Jonathan Cameron Not all of the parts supported by this driver use single supply. Hence we add chip_info fields to say what additional supplies exist and in the case of vref, ensure that is used for the reference voltage rather than vcc. One corner case is the ad7091r which has an internal reference that can be over-driven by an external reference connected on the vref pin. To handle that force_ext_vref is introduced and set if an optional vref regulator is present. Tested using really simple QEMU model and some fixed regulators. The devm_add_action_or_reset() callback is changed to take the regulator as it's parameter so we can use one callback for all the different regulators without having to store pointers to them in the iio_priv() structure. Signed-off-by: Jonathan Cameron Cc: Michael Hennerich --- drivers/iio/adc/ad7476.c | 108 +++++++++++++++++++++++++++++++++------ 1 file changed, 93 insertions(+), 15 deletions(-) -- 2.31.1 Reported-by: kernel test robot diff --git a/drivers/iio/adc/ad7476.c b/drivers/iio/adc/ad7476.c index 9e9ff07cf972..6867e96e3eda 100644 --- a/drivers/iio/adc/ad7476.c +++ b/drivers/iio/adc/ad7476.c @@ -32,12 +32,15 @@ struct ad7476_chip_info { /* channels used when convst gpio is defined */ struct iio_chan_spec convst_channel[2]; void (*reset)(struct ad7476_state *); + bool has_vref; + bool has_vdrive; }; struct ad7476_state { struct spi_device *spi; const struct ad7476_chip_info *chip_info; - struct regulator *reg; + struct regulator *ref_reg; + bool force_ext_vref; struct gpio_desc *convst_gpio; struct spi_transfer xfer; struct spi_message msg; @@ -52,13 +55,17 @@ struct ad7476_state { }; enum ad7476_supported_device_ids { + ID_AD7091, ID_AD7091R, + ID_AD7273, + ID_AD7274, ID_AD7276, ID_AD7277, ID_AD7278, ID_AD7466, ID_AD7467, ID_AD7468, + ID_AD7475, ID_AD7495, ID_AD7940, ID_ADC081S, @@ -145,8 +152,8 @@ static int ad7476_read_raw(struct iio_dev *indio_dev, GENMASK(st->chip_info->channel[0].scan_type.realbits - 1, 0); return IIO_VAL_INT; case IIO_CHAN_INFO_SCALE: - if (!st->chip_info->int_vref_uv) { - scale_uv = regulator_get_voltage(st->reg); + if (!st->chip_info->int_vref_uv || st->force_ext_vref) { + scale_uv = regulator_get_voltage(st->ref_reg); if (scale_uv < 0) return scale_uv; } else { @@ -187,13 +194,32 @@ static int ad7476_read_raw(struct iio_dev *indio_dev, BIT(IIO_CHAN_INFO_RAW)) static const struct ad7476_chip_info ad7476_chip_info_tbl[] = { + [ID_AD7091] = { + .channel[0] = AD7091R_CHAN(12), + .channel[1] = IIO_CHAN_SOFT_TIMESTAMP(1), + .convst_channel[0] = AD7091R_CONVST_CHAN(12), + .convst_channel[1] = IIO_CHAN_SOFT_TIMESTAMP(1), + .reset = ad7091_reset, + }, [ID_AD7091R] = { .channel[0] = AD7091R_CHAN(12), .channel[1] = IIO_CHAN_SOFT_TIMESTAMP(1), .convst_channel[0] = AD7091R_CONVST_CHAN(12), .convst_channel[1] = IIO_CHAN_SOFT_TIMESTAMP(1), + .int_vref_uv = 2500000, + .has_vref = true, .reset = ad7091_reset, }, + [ID_AD7273] = { + .channel[0] = AD7940_CHAN(10), + .channel[1] = IIO_CHAN_SOFT_TIMESTAMP(1), + .has_vref = true, + }, + [ID_AD7274] = { + .channel[0] = AD7940_CHAN(12), + .channel[1] = IIO_CHAN_SOFT_TIMESTAMP(1), + .has_vref = true, + }, [ID_AD7276] = { .channel[0] = AD7940_CHAN(12), .channel[1] = IIO_CHAN_SOFT_TIMESTAMP(1), @@ -218,10 +244,17 @@ static const struct ad7476_chip_info ad7476_chip_info_tbl[] = { .channel[0] = AD7476_CHAN(8), .channel[1] = IIO_CHAN_SOFT_TIMESTAMP(1), }, + [ID_AD7475] = { + .channel[0] = AD7476_CHAN(12), + .channel[1] = IIO_CHAN_SOFT_TIMESTAMP(1), + .has_vref = true, + .has_vdrive = true, + }, [ID_AD7495] = { .channel[0] = AD7476_CHAN(12), .channel[1] = IIO_CHAN_SOFT_TIMESTAMP(1), .int_vref_uv = 2500000, + .has_vdrive = true, }, [ID_AD7940] = { .channel[0] = AD7940_CHAN(14), @@ -254,6 +287,7 @@ static const struct ad7476_chip_info ad7476_chip_info_tbl[] = { [ID_LTC2314_14] = { .channel[0] = AD7940_CHAN(14), .channel[1] = IIO_CHAN_SOFT_TIMESTAMP(1), + .has_vref = true, }, }; @@ -263,15 +297,16 @@ static const struct iio_info ad7476_info = { static void ad7476_reg_disable(void *data) { - struct ad7476_state *st = data; + struct regulator *reg = data; - regulator_disable(st->reg); + regulator_disable(reg); } static int ad7476_probe(struct spi_device *spi) { struct ad7476_state *st; struct iio_dev *indio_dev; + struct regulator *reg; int ret; indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); @@ -282,19 +317,62 @@ static int ad7476_probe(struct spi_device *spi) st->chip_info = &ad7476_chip_info_tbl[spi_get_device_id(spi)->driver_data]; - st->reg = devm_regulator_get(&spi->dev, "vcc"); - if (IS_ERR(st->reg)) - return PTR_ERR(st->reg); + reg = devm_regulator_get(&spi->dev, "vcc"); + if (IS_ERR(reg)) + return PTR_ERR(reg); - ret = regulator_enable(st->reg); + ret = regulator_enable(reg); if (ret) return ret; - ret = devm_add_action_or_reset(&spi->dev, ad7476_reg_disable, - st); + ret = devm_add_action_or_reset(&spi->dev, ad7476_reg_disable, reg); if (ret) return ret; + /* Either vcc or vref (below) as appropriate */ + st->ref_reg = reg; + + if (st->chip_info->has_vref) { + + /* If a device has an internal reference vref is optional */ + if (st->chip_info->int_vref_uv) { + reg = devm_regulator_get_optional(&spi->dev, "vref"); + } else { + reg = devm_regulator_get(&spi->dev, "vref"); + if (IS_ERR(reg)) + return PTR_ERR(reg); + } + + if (!IS_ERR(reg)) { + ret = regulator_enable(reg); + if (ret) + return ret; + + ret = devm_add_action_or_reset(&spi->dev, + ad7476_reg_disable, + reg); + if (ret) + return ret; + st->ref_reg = reg; + st->force_ext_vref = true; + } + } + + if (st->chip_info->has_vdrive) { + reg = devm_regulator_get(&spi->dev, "vdrive"); + if (IS_ERR(reg)) + return PTR_ERR(reg); + + ret = regulator_enable(reg); + if (ret) + return ret; + + ret = devm_add_action_or_reset(&spi->dev, ad7476_reg_disable, + reg); + if (ret) + return ret; + } + st->convst_gpio = devm_gpiod_get_optional(&spi->dev, "adi,conversion-start", GPIOD_OUT_LOW); @@ -333,17 +411,17 @@ static int ad7476_probe(struct spi_device *spi) } static const struct spi_device_id ad7476_id[] = { - {"ad7091", ID_AD7091R}, + {"ad7091", ID_AD7091}, {"ad7091r", ID_AD7091R}, - {"ad7273", ID_AD7277}, - {"ad7274", ID_AD7276}, + {"ad7273", ID_AD7273}, + {"ad7274", ID_AD7274}, {"ad7276", ID_AD7276}, {"ad7277", ID_AD7277}, {"ad7278", ID_AD7278}, {"ad7466", ID_AD7466}, {"ad7467", ID_AD7467}, {"ad7468", ID_AD7468}, - {"ad7475", ID_AD7466}, + {"ad7475", ID_AD7475}, {"ad7476", ID_AD7466}, {"ad7476a", ID_AD7466}, {"ad7477", ID_AD7467}, From patchwork Mon Apr 5 16:23:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 415298 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp3811516jai; Mon, 5 Apr 2021 09:25:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzDLal5JxkIf52vkkTacgBhc7UN08FPwt8WWewSsfCTLsaXtsAxSushyXNlp5cVHUXLUABT X-Received: by 2002:a17:906:4b0e:: with SMTP id y14mr28610484eju.393.1617639927308; Mon, 05 Apr 2021 09:25:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617639927; cv=none; d=google.com; s=arc-20160816; b=VJIwThsX9nBi5phlAyBJg9xY/aaJuJ7vcxclHZbPeHtHj/3mYSoYNxcFsJT8bHnL0Z bT4zvouON/w7unroEydGp9Dt+WWn9VGlI7KfUSc4Pq0oeuo78qL5wMLR9s4V8cIZQGc0 p5aP3CVwIRY/+XWQl4Q1F7yQlpE0DYl77CEt2wjjAUikousZ60/b/oupeTf+vk/03+ef ya70yhuPjSpObIZMeEJnJBd3hvbSuUWSDXPh6vgyng1hWSWXUcamWeD0Wpx5rJpD91Od NteZBwbbVMJqHMaB+A5MjbANaRbocx7GIa6zFwQRwzXuOOup3zq7gXVAA00D2yGAFNhR qKZA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=hrWXo4c6M3fO3fazOOVfVoe2435Kn+3riik5njaq7vQ=; b=vS+qZg8y9tYPsahtBCPmmyDjBdZe0OMA72427/dIy8+UEMP6PAe9iApW6/kbekCvQ6 eXy+hTyHuMV+85zJsSanlCEbTIqKYLrMmHp7zFaBd4tXvUX3NQVfqsbQY3/pJx9l9ZSs dyyznx73cZS+Ve56WYaEYpkoYXav1ketjdvsa1rGwccbAc34uozOsdzzTvN9EfwkcsX8 PrjJyioB0MJ4oro9junqgFyQExbzgwmaxYuxGIzxcjT0/XEIrwNKfp5vqTiAG82H/RE3 w3i+IerO+bFxD4V1gG51Efk/pDu68qdWdfHJQM4hif94Xk45JyQinqDcpoyzzlrlndfc WRPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SHWPQsBj; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v10si2903810ejb.195.2021.04.05.09.25.27; Mon, 05 Apr 2021 09:25:27 -0700 (PDT) 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=@kernel.org header.s=k20201202 header.b=SHWPQsBj; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233879AbhDEQZc (ORCPT + 6 others); Mon, 5 Apr 2021 12:25:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:36508 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233795AbhDEQZb (ORCPT ); Mon, 5 Apr 2021 12:25:31 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id CC1F4613B1; Mon, 5 Apr 2021 16:25:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617639925; bh=w90Al8UaQbEJVuWG1mLWXHAH5ooii7iwT892IfFmog8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SHWPQsBjqWdAUwT89GesDL5EFdLHXxeP64C4a2wpU2y9bPcp/LvihmFDkPSu6XLzg 1mjc7bTnxg1zUbqDwQttubzN+hxaghPwlB00yjkA6LZxfatDbdKZ3AiDpaLBZNhoZR USEOZE8WfEsXY30x7otLnJGinE3MpwDPMja2Y4HTnvC/UP0VRsukhFIVRrUmAdWTei VZVz0kmqfwQJGO4e2xTUmsRm0grme4yPn6Gcp0joqugbY5QtI+lPKWsTLzcbJD7WsE PPfM/zxmBddsgd0ykqGRVj7HpcVdCPDDYu7Mn7d0OorXjWyQqbF8gns5pVN2qwucz0 OoXPdx8kJaXhg== From: Jonathan Cameron To: linux-iio@vger.kernel.org, Rob Herring Cc: Lars-Peter Clausen , devicetree@vger.kernel.org, Jonathan Cameron , Michael Hennerich Subject: [PATCH v2 2/2] dt-bindings:iio:adc:adi, ad7474: Add missing binding document Date: Mon, 5 Apr 2021 17:23:25 +0100 Message-Id: <20210405162325.627977-3-jic23@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210405162325.627977-1-jic23@kernel.org> References: <20210405162325.627977-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Jonathan Cameron This binding covers class of simple SPI ADCs which only provide data output - they don't have MOSI pin. The only real variation between them is over how many supplies they use and which one is used for the reference. Michael listed as maintainer for this one as it is his driver and falls under the catch all MAINTAINERS entry for ADI devices. Signed-off-by: Jonathan Cameron Cc: Michael Hennerich --- .../bindings/iio/adc/adi,ad7476.yaml | 173 ++++++++++++++++++ 1 file changed, 173 insertions(+) -- 2.31.1 Reviewed-by: Rob Herring diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7476.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad7476.yaml new file mode 100644 index 000000000000..bebf5b435947 --- /dev/null +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7476.yaml @@ -0,0 +1,173 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +# Copyright 2019 Analog Devices Inc. +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/iio/adc/adi,ad7476.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: AD7476 and similar simple SPI ADCs from multiple manufacturers. + +maintainers: + - Michael Hennerich + +description: | + A lot of simple SPI ADCs have very straight forward interfaces. + They typically don't provide a MOSI pin, simply reading out data + on MISO when the clock toggles. + +properties: + compatible: + enum: + - adi,ad7091 + - adi,ad7091r + - adi,ad7273 + - adi,ad7274 + - adi,ad7276 + - adi,ad7277 + - adi,ad7278 + - adi,ad7466 + - adi,ad7467 + - adi,ad7468 + - adi,ad7475 + - adi,ad7476 + - adi,ad7476a + - adi,ad7477 + - adi,ad7477a + - adi,ad7478 + - adi,ad7478a + - adi,ad7495 + - adi,ad7910 + - adi,ad7920 + - adi,ad7940 + - ti,adc081s + - ti,adc101s + - ti,adc121s + - ti,ads7866 + - ti,ads7867 + - ti,ads7868 + - lltc,ltc2314-14 + + reg: + maxItems: 1 + + vcc-supply: + description: + Main powersupply voltage for the chips, sometimes referred to as VDD on + datasheets. If there is no separate vref-supply, then this is needed + to establish channel scaling. + + vdrive-supply: + description: + Some devices have separate supply for their digital control side. + + vref-supply: + description: + Some devices have a specific reference voltage supplied on a different pin + to the other supplies. Needed to be able to establish channel scaling + unless there is also an internal reference available (e.g. ad7091r) + + spi-max-frequency: true + + adi,conversion-start-gpios: + description: A GPIO used to trigger the start of a conversion + +required: + - compatible + - reg + +additionalProperties: false + +allOf: + # Devices where reference is vcc + - if: + properties: + compatible: + contains: + enum: + - adi,ad7091 + - adi,ad7276 + - adi,ad7277 + - adi,ad7278 + - adi,ad7466 + - adi,ad7467 + - adi,ad7468 + - adi,ad7940 + - ti,adc081s + - ti,adc101s + - ti,adc121s + - ti,ads7866 + - ti,ads7868 + required: + - vcc-supply + # Devices with a vref + - if: + properties: + compatible: + contains: + enum: + - adi,ad7091r + - adi,ad7273 + - adi,ad7274 + - adi,ad7475 + - lltc,ltc2314-14 + then: + properties: + vref-supply: true + else: + properties: + vref-supply: false + # Devices with a vref where it is not optional + - if: + properties: + compatible: + contains: + enum: + - adi,ad7273 + - adi,ad7274 + - adi,ad7475 + - lltc,ltc2314-14 + then: + required: + - vref-supply + - if: + properties: + compatible: + contains: + enum: + - adi,ad7475 + - adi,ad7495 + then: + properties: + vdrive-supply: true + else: + properties: + vdrive-supply: false + - if: + properties: + compatible: + contains: + enum: + - adi,ad7091 + - adi,ad7091r + then: + properties: + adi,conversion-start-gpios: true + else: + properties: + adi,conversion-start-gpios: false + +examples: + - | + spi { + #address-cells = <1>; + #size-cells = <0>; + + adc@0 { + compatible = "adi,ad7091r"; + reg = <0>; + spi-max-frequency = <5000000>; + vcc-supply = <&adc_vcc>; + vref-supply = <&adc_vref>; + }; + }; +...