From patchwork Thu Apr 1 17:17:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 413633 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp768037jai; Thu, 1 Apr 2021 10:45:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx3OePuNKZcbV69R/Me3aok+sVmb/U9SPAeNmuIOCyHZSE73oEczk8Zjxe4zrzq7gY7hNrk X-Received: by 2002:a17:907:94cc:: with SMTP id dn12mr10432788ejc.177.1617299140062; Thu, 01 Apr 2021 10:45:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617299140; cv=none; d=google.com; s=arc-20160816; b=uxzlDn3y4bf9IglC//a+aKMVMimE+oJqhNZUavwng+x2ML5qGPqrIv4GuWpgHLIUii 0wz3slguTnjsqblutA0U4weVAqCHTG1plxcM+3w2heJJXKoB+UtiD1TMFDBItXjUzyh7 8iS8lGvzTXwkbJI0GVi3hyatovLyAOQGsJXbWvYSt35n5zlbR7mGqBoIMABcljhn9en4 Gazl2pcWtwHmNB4NMdguYJSjSQ1ppsf3lKUYxzuEGlYmrjCnfAHSqepjb4rjmwBbjzUm 1/b99vhXukIBCVBx22qIFBS3hqmhCHsTySr+ZboTQEsSzOCKLsJwo+wju41d3GgL722O iBhA== 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=ygJDp6Gy+4ANc8TCsq8Z+jh8sWtbLZ+Cz/sJaF8/vJY=; b=erEys7mbO3wG0kivbGQGVtvAlLqEp0OIqK9G6Yrh2U7jwHzl7Qd8+mlll0OgHIvu/s XMX9KmIbsnhsvwjkOqcIHw/XGVwimEKIw9vcBmuKMuAso+jnTmFBoBdZzbMuLW29ljMC KC4MZcpwHefS9WQh89cvfbssea/3f00W1sYaX/KIflOoBJYOmnSGopkdWxsaHTe5V9Nk zwfKBskCi2//UYto8DbdZskFfphuEsS0Xxb0LIxL7sVBNY2AkmK75XuFN9wSrd9aplRl qupltYYD9TFihdQ/jQcBmzwLFSjuBp7GpHc5QJe1zMppsoZrZ/FJkGEIlPWjVtih/nZV QPxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=W8IqReJr; 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 v24si4734993eja.84.2021.04.01.10.45.39; Thu, 01 Apr 2021 10:45:40 -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=W8IqReJr; 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 S235548AbhDARm4 (ORCPT + 6 others); Thu, 1 Apr 2021 13:42:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:40690 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234601AbhDARiV (ORCPT ); Thu, 1 Apr 2021 13:38:21 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 512D3613C9; Thu, 1 Apr 2021 17:20:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617297606; bh=ppFkbyhE1z8HEc1Vjh/sVhlr9mfGa9Nh8NUjxIGBCr4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W8IqReJrPDBe28rX9SpHJnVzragn++d0qpzhAmvdxvmFW1CVtSQwL2XX2tZjVr76f itxUNu0C7yvskWFvFHhBJpJ79KOQjYxqFeB8Cmi1gcpcI213MUsi6+xLTPBf8gsK56 KYIF+KUdCS2D4nTwkNE3EU4g1J055EWzwEE0SGBWi/DwyO2bE4iXvtlr0/lTqwVCfP Mu9dL7/vspVMjqlehguS98RUhWz3HZSRqSu80IyEeICZb5rvCJx7PDo8nyo/xOOW8+ 1A5ilHPpiVmqQDTCr6Pyey/ZH7u72NTCpPgylrHkCLVS6ShK/gAnRb+yIybQvpRRKq ixpSU5JKnRbrw== From: Jonathan Cameron To: linux-iio@vger.kernel.org, Rob Herring Cc: devicetree@vger.kernel.org, Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , Michael Hennerich Subject: [PATCH 1/3] iio:adc:ad7476: Fix remove handling Date: Thu, 1 Apr 2021 18:17:57 +0100 Message-Id: <20210401171759.318140-2-jic23@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210401171759.318140-1-jic23@kernel.org> References: <20210401171759.318140-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Jonathan Cameron This driver was in an odd half way state between devm based cleanup and manual cleanup (most of which was missing). I would guess something went wrong with a rebase or similar. Anyhow, this basially finishes the job as a precusor to improving the regulator handling. Signed-off-by: Jonathan Cameron Fixes: 4bb2b8f94ace3 ("iio: adc: ad7476: implement devm_add_action_or_reset") Cc: Michael Hennerich --- drivers/iio/adc/ad7476.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) -- 2.31.1 Reviewed-by: Alexandru Ardelean diff --git a/drivers/iio/adc/ad7476.c b/drivers/iio/adc/ad7476.c index 17402714b387..9e9ff07cf972 100644 --- a/drivers/iio/adc/ad7476.c +++ b/drivers/iio/adc/ad7476.c @@ -321,25 +321,15 @@ static int ad7476_probe(struct spi_device *spi) spi_message_init(&st->msg); spi_message_add_tail(&st->xfer, &st->msg); - ret = iio_triggered_buffer_setup(indio_dev, NULL, - &ad7476_trigger_handler, NULL); + ret = devm_iio_triggered_buffer_setup(&spi->dev, indio_dev, NULL, + &ad7476_trigger_handler, NULL); if (ret) - goto error_disable_reg; + return ret; if (st->chip_info->reset) st->chip_info->reset(st); - ret = iio_device_register(indio_dev); - if (ret) - goto error_ring_unregister; - return 0; - -error_ring_unregister: - iio_triggered_buffer_cleanup(indio_dev); -error_disable_reg: - regulator_disable(st->reg); - - return ret; + return devm_iio_device_register(&spi->dev, indio_dev); } static const struct spi_device_id ad7476_id[] = { From patchwork Thu Apr 1 17:17:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 413634 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp768071jai; Thu, 1 Apr 2021 10:45:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwF5clisJZBMJ3GZzrpjxpGhWTrzwLsTotyTHFmYRS9LjHybUDJheOwxK9cnf83rZ/9nVRx X-Received: by 2002:a17:906:e84:: with SMTP id p4mr10273768ejf.248.1617299141875; Thu, 01 Apr 2021 10:45:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617299141; cv=none; d=google.com; s=arc-20160816; b=ZyaZngjtkg9jfZ2nWhEz8TyFKhzmT92mHj8ilovyagOnkH3yWTFUt8QtxY+f+2D0IW p3+hudE818R/tS5oM049+Hiz0jgp9GzZYy6CLTlVkXj3ItvZ+YrOnekbB5q0CjqUvAop KBRWFDpfcRCeUNEK24/Rpc00IGvHFDOIf0ty9935UhKCKHDOcv/llyVYadX/cCLZUNUH uTAevAlpFQJfzRIPPNVtcv4nuCUw251wT0/KCQ4htDAQfX8k/ZY9jXYGIguxQS6mZzhy W3xpzyF2nK7buDO4jmHaMxTteorXXAK9Is61HloH7CVFUV/3+r39aN5tgiIIaIwyA40b Xx8w== 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=9eByecRc/9zNedNU/p+5DpVs4dGelil8g9pxCzLMGGA=; b=nt1pOy8OFyhWeuYMbW1cXz8pN6RHJ23YSPLVVTU89PnVew3VFaO6NtlSO5ZDwQJt8N kcNGecaLEF0pVx0pr2RYRhOmVgIZk111uaAcKg+19eWeO4vsrSt5vQ+r5ywmRMwIbNhh sLiaSvV4fov7WR4BI5LZAExq3G72lvO3aCXZdM/txH4WMTmaRVfBUmZvVrz+qr1teIQT MLI2j8et6043Y5ba21myHMU4pquRF+qchwsDxTk5/hSdNKYdgJCCFJdyzonkSqOAzuWR BNSnRJsc9z4Y01qjum22RWUSJNPaw63YQ45t721XzO7oZgumh/gKFXE1tU8WUsA633Pb HNig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="q/Cryuzy"; 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 v24si4734993eja.84.2021.04.01.10.45.41; Thu, 01 Apr 2021 10:45:41 -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="q/Cryuzy"; 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 S234576AbhDARm6 (ORCPT + 6 others); Thu, 1 Apr 2021 13:42:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:40714 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234614AbhDARiZ (ORCPT ); Thu, 1 Apr 2021 13:38:25 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9495B613CB; Thu, 1 Apr 2021 17:20:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617297609; bh=EshraPHggvWBzitSNOCgch/Nz5TGMwmZb4MjOUvnq78=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q/CryuzyglWNhXqf/lCuSoCSNdlnMAR4DJQzkA8pETAsmZnZz9xjTVN7IMHhHDUiC c/enp9R3/SgmMk7fhPu6OWSR3tHWI+sY48/eFQF4QFasqpnBSeGRgE/Qw8hq9JGzmp 9QGkk1l0ZCwWc2vscIOu7oiTSznGl5NDeKz70VE18mY3rX8iAAgADV3+KVOOVJkity xWQOChNHXCK/C5tCZe+vh3OhMbkBO+Df2P8ZfLMOAiXz6+iNsvboBSeN1h2pWZ0Ozf z4J8uDK58Xwkh11BhPryn4zI4uUQucceC+jYT+I/rkAW2Th67171cri4DfhbRXLZzB qOnrab7PZ+xSw== From: Jonathan Cameron To: linux-iio@vger.kernel.org, Rob Herring Cc: devicetree@vger.kernel.org, Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , Michael Hennerich Subject: [PATCH 2/3] iio:adc:ad7476: Handle the different regulators used by various parts. Date: Thu, 1 Apr 2021 18:17:58 +0100 Message-Id: <20210401171759.318140-3-jic23@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210401171759.318140-1-jic23@kernel.org> References: <20210401171759.318140-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. 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 | 81 +++++++++++++++++++++++++++++++++------- 1 file changed, 68 insertions(+), 13 deletions(-) -- 2.31.1 Reviewed-by: Lars-Peter Clausen diff --git a/drivers/iio/adc/ad7476.c b/drivers/iio/adc/ad7476.c index 9e9ff07cf972..49f7d252b200 100644 --- a/drivers/iio/adc/ad7476.c +++ b/drivers/iio/adc/ad7476.c @@ -32,12 +32,14 @@ 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; struct gpio_desc *convst_gpio; struct spi_transfer xfer; struct spi_message msg; @@ -53,12 +55,15 @@ struct ad7476_state { enum ad7476_supported_device_ids { 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, @@ -146,7 +151,7 @@ static int ad7476_read_raw(struct iio_dev *indio_dev, return IIO_VAL_INT; case IIO_CHAN_INFO_SCALE: if (!st->chip_info->int_vref_uv) { - scale_uv = regulator_get_voltage(st->reg); + scale_uv = regulator_get_voltage(st->ref_reg); if (scale_uv < 0) return scale_uv; } else { @@ -194,6 +199,16 @@ static const struct ad7476_chip_info ad7476_chip_info_tbl[] = { .convst_channel[1] = IIO_CHAN_SOFT_TIMESTAMP(1), .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 +233,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 +276,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 +286,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 +306,50 @@ 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; + if (st->chip_info->has_vref) { + reg = devm_regulator_get(&spi->dev, "vref"); + 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; + } + /* Either vcc or vref as appropriate */ + st->ref_reg = reg; + + 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); @@ -335,15 +390,15 @@ static int ad7476_probe(struct spi_device *spi) static const struct spi_device_id ad7476_id[] = { {"ad7091", ID_AD7091R}, {"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 Thu Apr 1 17:17:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 413632 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp766923jai; Thu, 1 Apr 2021 10:44:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxrmmVSLe5DXo0LRXzezgTx2yaTWvXvhvdxw8Ny7z1Z89rhkWoaD0TkOoDNNpqM2frfIyE9 X-Received: by 2002:a17:906:2759:: with SMTP id a25mr10552446ejd.122.1617299048789; Thu, 01 Apr 2021 10:44:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617299048; cv=none; d=google.com; s=arc-20160816; b=EHN270GfvTIY81CcsVge/Bl0TXemlHIAS+kzpzdMn8zpgBgc90GnlJ8Ra69Bgg3iK/ n67exqyM6xguyeyrxuUAXNiwPNRC4yE7EXw7vvqdQlsPbQTapAcq9s6pDbYszdumbdXH KxbFjQBmyQT0QLOdmVppy6INU4kMva7DKvETz3Siktp2oKZ8eFDeiZqhx3+5fGLJFwfn ow40A9oZWKqmAsMweQbbZ6rlHG66IzU7R8+gRsAe8luonWKjBJu31s3hTMYNN8YBZFYl WfVx+mPaet+/tBYQmLufFYZIr+YS89cJe5PKNK4It2mvb8VWHEFzb/76F+S49H8Vmb6j 7+4A== 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=gmfmM2sq0HC+Ba6sm5+SSoZOt48jmegMHeZxYbJBjVQ=; b=bXJMAkJ6CdOYIFtOorZsI0oCO6JY/UaT3/dFA1/NAk3JoMtldZ91nm2tCkmcwEdDOq 2tTa+qSehgEhMr77lw9gRmeFrb+7+S3ZQtpMSj57JOMBo5G6I2Xh6GcwBScRxPTCSbRU R8MVijQARuNdh5ZmqSPh7YpHeVBHGC/OQByJ1JY1JkYiv/ZgPvKtlnxsADGOR7JwCRFF b+CwIAMu6Psw+fgEZtZeC/6TYJSpR7aHExgAfmwXvc3WHMmrogc1xk6ZoCPXXnXeKtw0 Vyzp/ws69MF33Do8+q+bZCqJWS2PjSE/zapDyT2ish2vlwKhdrJfYThVSCa/2dvE6MON OK+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oQLebEoX; 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 v24si4734993eja.84.2021.04.01.10.44.08; Thu, 01 Apr 2021 10:44:08 -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=oQLebEoX; 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 S235470AbhDARmu (ORCPT + 6 others); Thu, 1 Apr 2021 13:42:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:40586 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234550AbhDARiA (ORCPT ); Thu, 1 Apr 2021 13:38:00 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 88E11613D2; Thu, 1 Apr 2021 17:20:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617297613; bh=K9Ub/CKfmRvSeQSmLNc98Iuwtk58+Z8qykYAOmarZrg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oQLebEoXWOH/wBVUjuu3aliho34wJhvYBBM6UfivNTTZYVv6LoD+mYB2NHLiDna+i K+Z1eFmF5sdIKpMbdzgPRQDW9eoFSS5YVX/7jAhL5MdML9kyZtRYwvG68HDJl+0cwT Oshc/82G0rzWXLMQx4oOlBGa401+6JXO2ReQ1v2U8SM5LigSWHNqQLGyvsiI5YDG99 Rls1A1jkpvSPmaFZtvgM3tmNl0t2YVXJK889XUVSJti0k90lT/l+2J8LvlOQnQXv/b E067Bgg+r961qxPSkC6whl2NNc5hSGAo2y7/nGfMzOV+MsNWVulzPLCrZdMq0UoYRV P7UqQ/N/0TbIA== From: Jonathan Cameron To: linux-iio@vger.kernel.org, Rob Herring Cc: devicetree@vger.kernel.org, Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , Michael Hennerich Subject: [PATCH 3/3] dt-bindings:iio:adc:adi, ad7474: Add missing binding document Date: Thu, 1 Apr 2021 18:17:59 +0100 Message-Id: <20210401171759.318140-4-jic23@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210401171759.318140-1-jic23@kernel.org> References: <20210401171759.318140-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 | 139 ++++++++++++++++++ 1 file changed, 139 insertions(+) -- 2.31.1 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..465c85add31d --- /dev/null +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7476.yaml @@ -0,0 +1,139 @@ +# 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. + + 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: + - if: + properties: + compatible: + contains: + enum: + - adi,ad7091 + - adi,ad7091r + then: + properties: + adi,conversion-start-gpios: true + else: + properties: + adi,conversion-start-gpios: false + - if: + properties: + compatible: + contains: + enum: + - adi,ad7273 + - adi,ad7274 + - adi,ad7475 + - lltc,ltc2314-14 + then: + properties: + vref-supply: true + required: + - vref-supply + else: + properties: + vref-supply: false + required: + - vcc-supply + - if: + properties: + compatible: + contains: + enum: + - adi,ad7475 + - adi,ad7495 + then: + properties: + vdrive-supply: true + else: + properties: + vdrive-supply: false + +examples: + - | + spi { + #address-cells = <1>; + #size-cells = <0>; + + adc@0 { + compatible = "adi,ad7091"; + reg = <0>; + spi-max-frequency = <5000000>; + vcc-supply = <&adc_vcc>; + }; + }; +...