From patchwork Tue May 30 07:53:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabrizio Lamarque X-Patchwork-Id: 13259372 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EFC1AC7EE2F for ; Tue, 30 May 2023 07:53:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229612AbjE3Hxg (ORCPT ); Tue, 30 May 2023 03:53:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229622AbjE3Hxf (ORCPT ); Tue, 30 May 2023 03:53:35 -0400 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8085EEC; Tue, 30 May 2023 00:53:30 -0700 (PDT) Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-3f6e72a1464so27541355e9.1; Tue, 30 May 2023 00:53:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685433209; x=1688025209; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=XTV9XMaou7CNV6EOfKarXq32Ih9qfYOfAXq7949Wo3s=; b=i3pP6u5EQ1lX1blR3asUXta00++/WeAJzJYpjVbmSSnNnM9b0JsK9O6GJxJK/PnERk 56eVs5Po9NTUHfW2hNAACiHF+mLRFee1xbwQ+xaakXR3hY3zSsjqctQxj1NeKlUedHyJ v1BTlRzG5hfyJyh1+k8+YeUErve3Bo3YKYy7toHOX/e+ktdMhGud6tmX2SWmSp6F7cpV yiGznVv7RIvdwo1swh6I+DgEuy18fKjE8FtSg8XQ49BPVrDgzkRQ6J0A56GCpFWPr/hh eZC6V8HS505ZzoT2UAGRtRiiJ9+t+p4on4MYJyeLURencqsibXnxwHaOp7bYSgWSYhk/ p/pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685433209; x=1688025209; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XTV9XMaou7CNV6EOfKarXq32Ih9qfYOfAXq7949Wo3s=; b=ABXH0hKcXQWMdMcPGx+bxkdru7D56oedUxpIm1zUnqKdwrZH7hbp/Shk5uMrZNas4E 0oVWVKWhtegswXXFV4QD8EkfKYK2cShgJHpXBsN75zO4WsnUHAM/dFAaYfFzLJgLBQGR wSA5CGkDdfIxAZ08hEMtDqrGJg4Ft2DpFszvRllRznRnDVS8sWulLePq4SRohVZ3T3HB 281aMW768WfcbfJBt3qDvN79QqooDQ7YqZkWkh6Bc6rn295fUwSF9h4FNwxq3DC4tcnB oy0aYEnl+lHg5pGMqWlrNfafHREOEbejJ8sz/6BAkBXxOZrWzWkviiA3mKKKSZdeRF2a SqHw== X-Gm-Message-State: AC+VfDyIS+60A3oOFNUlD2zq/27A2n5UBZkDe1ZkzWizSzKjYR62h/Ls sT2VH6jBq7cZ3qyTsfxGH94= X-Google-Smtp-Source: ACHHUZ4/Os/xLZi9cKZd+cacH8GtfF0POVlxwYmzZcphgLW5DEqstlcIruTXf+kmAjOZbVhQb4TQ8A== X-Received: by 2002:a1c:7313:0:b0:3f4:2266:8cf0 with SMTP id d19-20020a1c7313000000b003f422668cf0mr872277wmb.10.1685433208715; Tue, 30 May 2023 00:53:28 -0700 (PDT) Received: from PC-UT2.ad.ennebielettronica.com ([78.152.97.130]) by smtp.gmail.com with ESMTPSA id x21-20020a05600c21d500b003f6041f5a6csm16561275wmj.12.2023.05.30.00.53.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 May 2023 00:53:28 -0700 (PDT) From: fl.scratchpad@gmail.com To: jic23@kernel.org, Alexandru Tachici , Lars-Peter Clausen , Michael Hennerich , Alexandru Ardelean Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Fabrizio Lamarque , Nuno Sa , Jonathan Cameron Subject: [PATCH v3 1/5] iio: adc: ad7192: Fix null ad7192_state pointer access Date: Tue, 30 May 2023 09:53:07 +0200 Message-Id: <20230530075311.400686-2-fl.scratchpad@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230530075311.400686-1-fl.scratchpad@gmail.com> References: <20230530075311.400686-1-fl.scratchpad@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Fabrizio Lamarque Pointer to indio_dev structure is obtained via spi_get_drvdata() at the beginning of function ad7192_setup(), but the spi->dev->driver_data member is not initialized, hence a NULL pointer is returned. Fix by changing ad7192_setup() signature to take pointer to struct iio_dev, and get ad7192_state pointer via st = iio_priv(indio_dev); Fixes: bd5dcdeb3fd0 ("iio: adc: ad7192: convert to device-managed functions") Signed-off-by: Fabrizio Lamarque Reviewed-by: Nuno Sa --- drivers/iio/adc/ad7192.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/iio/adc/ad7192.c b/drivers/iio/adc/ad7192.c index 55a6ab591016..94a9cf34a255 100644 --- a/drivers/iio/adc/ad7192.c +++ b/drivers/iio/adc/ad7192.c @@ -380,9 +380,9 @@ static int ad7192_of_clock_select(struct ad7192_state *st) return clock_sel; } -static int ad7192_setup(struct ad7192_state *st, struct device_node *np) +static int ad7192_setup(struct iio_dev *indio_dev, struct device_node *np) { - struct iio_dev *indio_dev = spi_get_drvdata(st->sd.spi); + struct ad7192_state *st = iio_priv(indio_dev); bool rej60_en, refin2_en; bool buf_en, bipolar, burnout_curr_en; unsigned long long scale_uv; @@ -1073,7 +1073,7 @@ static int ad7192_probe(struct spi_device *spi) } } - ret = ad7192_setup(st, spi->dev.of_node); + ret = ad7192_setup(indio_dev, spi->dev.of_node); if (ret) return ret; From patchwork Tue May 30 07:53:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabrizio Lamarque X-Patchwork-Id: 13259373 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 59939C77B7A for ; Tue, 30 May 2023 07:53:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229586AbjE3Hxh (ORCPT ); Tue, 30 May 2023 03:53:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229588AbjE3Hxg (ORCPT ); Tue, 30 May 2023 03:53:36 -0400 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D9C1BF; Tue, 30 May 2023 00:53:33 -0700 (PDT) Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-3f6d7abe9a4so27529025e9.2; Tue, 30 May 2023 00:53:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685433211; x=1688025211; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oJat+S2GRgqfm5ZimEWfP+mzTLI8bh6EOyD08golq/0=; b=UpieOk9BHq8mFg2B9lc37PmA3YmachbEQ0bDEErszcfoGBe0Q038rWYwIecXoOtRcT nkBlkMm9WQoqsvG4DMUq7SfEjCcaQK6TmSuutlIDwikWKpm5fLfB6d++CCS7GpD2/7xs nZoNtzH4rU4uzR3mPE4sSP2AAHgFs3bKlE+J73Rbgwf2X01ndDdoFmz74rVzAH7Jty/a SrKn1+SZoR8nzn2kg1BsI6CVteNzPmUrXCeKJWJI6tevNOaQ+AV5mNtFzTEf67Y76/L6 8O0U2WE4d42JAwkHIzdDwEqJfh6KkI9btRSQrsTmTKpXtA/z4byklhMwzTeP8Qh77MyU xnFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685433211; x=1688025211; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oJat+S2GRgqfm5ZimEWfP+mzTLI8bh6EOyD08golq/0=; b=HvHG9+SbU6mVgkylZyjAgzV40EYBQYkK3bOdi0+ObsKjODmvMNPrtBPYTgotK8A05+ grPkiRiLZuMo+VqKpyaTqGRbedDSEDOfA32Gt8avp5R4yv4Z/Azu/30h4Iq8RcFP8t7+ dMbJmcsaxKdJZmOcrozIS4rSPOHGELSPXLq2nuQE3W7GgcJEykoF63PqvrZ4ZV6hmHUD fa1GeuWryjGqXzX7vfu/UtiFdP/+lLGT4/GxYXr2eVVpXlRTC10IqNTuMcot+Ny9CsD7 NHoMyBA/tegr+2hzcE25fXYIEmOhkiPUVt6Rs1vIrsvnpFaz/GHO4QNr4hrFuHEbmLCW F+Jw== X-Gm-Message-State: AC+VfDxSH9C3NlSLsHWVvRMrAnWOnqHF0/g0vtXxoNoPmhqgTwt2Ri9F 52oC49sGT7BD+C0HpNHjV+M= X-Google-Smtp-Source: ACHHUZ7neRCo9PQMbFtuPKWWxHGVTFThCJ5fkWOBvPHhxRv52GblTGsu/qhVliAgHJj/52flMColSg== X-Received: by 2002:a05:600c:2106:b0:3f6:be1:b8d9 with SMTP id u6-20020a05600c210600b003f60be1b8d9mr752088wml.6.1685433211177; Tue, 30 May 2023 00:53:31 -0700 (PDT) Received: from PC-UT2.ad.ennebielettronica.com ([78.152.97.130]) by smtp.gmail.com with ESMTPSA id x21-20020a05600c21d500b003f6041f5a6csm16561275wmj.12.2023.05.30.00.53.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 May 2023 00:53:30 -0700 (PDT) From: fl.scratchpad@gmail.com To: jic23@kernel.org, Alexandru Tachici , Lars-Peter Clausen , Michael Hennerich , Alexandru Ardelean Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Fabrizio Lamarque , Nuno Sa , Jonathan Cameron Subject: [PATCH v3 2/5] iio: adc: ad7192: Fix internal/external clock selection Date: Tue, 30 May 2023 09:53:08 +0200 Message-Id: <20230530075311.400686-3-fl.scratchpad@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230530075311.400686-1-fl.scratchpad@gmail.com> References: <20230530075311.400686-1-fl.scratchpad@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Fabrizio Lamarque Fix wrong selection of internal clock when mclk is defined. Resolve a logical inversion introduced in c9ec2cb328e3. Fixes: c9ec2cb328e3 ("iio: adc: ad7192: use devm_clk_get_optional() for mclk") Signed-off-by: Fabrizio Lamarque Reviewed-by: Nuno Sa --- drivers/iio/adc/ad7192.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/adc/ad7192.c b/drivers/iio/adc/ad7192.c index 94a9cf34a255..5a9c8898f8af 100644 --- a/drivers/iio/adc/ad7192.c +++ b/drivers/iio/adc/ad7192.c @@ -367,7 +367,7 @@ static int ad7192_of_clock_select(struct ad7192_state *st) clock_sel = AD7192_CLK_INT; /* use internal clock */ - if (st->mclk) { + if (!st->mclk) { if (of_property_read_bool(np, "adi,int-clock-output-enable")) clock_sel = AD7192_CLK_INT_CO; } else { From patchwork Tue May 30 07:53:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabrizio Lamarque X-Patchwork-Id: 13259374 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 46E47C7EE23 for ; Tue, 30 May 2023 07:53:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229631AbjE3Hxi (ORCPT ); Tue, 30 May 2023 03:53:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229607AbjE3Hxg (ORCPT ); Tue, 30 May 2023 03:53:36 -0400 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A244990; Tue, 30 May 2023 00:53:34 -0700 (PDT) Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-3f60e536250so34227175e9.1; Tue, 30 May 2023 00:53:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685433213; x=1688025213; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ZkbCQOnKS0MEzWaipfWc4DGGonHwiuGiYcvsGowmXvU=; b=spBov/dTKnPQTzEzpMhXigoTX7X/8Uy9+xEi+2SGTI4nYTjx17cEVPOwNm4X9ikPH1 Qh0x7NptMwnX20XnhL/QATaCJ6TQZoVFb6dmIoUKhOymbyiBtWFHlePHn1N6p5nec3hv J1Khu3np4XVmYgPNIdRROtvsEVeHsLWQ+CGgGMApjBLtbjht1hd5TvPd3rLoXAauJmuU /cZNNPZCZtHyZASgWKJEimYxGxzKt4teB4H6hHL8WLKj3BJmYqqmKzXuoXuh/FOnAg3D quC+3OPRwDRP3yZzNmA9lFEn42YPk2kaYQw2bmvH2gPa6Mvz21HOwTgmW5bF2ebwTg/b PnjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685433213; x=1688025213; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZkbCQOnKS0MEzWaipfWc4DGGonHwiuGiYcvsGowmXvU=; b=fl0n5WddDCBZuIpHN1jCAgDQpi1Y0AD+sb47JahwL829ZvCf1XEvEwGu5tzhJm0HUT TVeC3+Y9FgX3HLtj3JRQFdCVsHW//F4jhTFRiBBJ+EHC9rP+RdtYRyZRdL1yYrfX75Uh l8MAmF3qtoKP2kKXl/vWwJ6+qF1H8+wm+WTu0UBplh4Qb0OcewBgxV1pmHY56r2od6KA 8hOyEYn5oT12FzPRSVqBu4l8L8xwHbb6+Y6lPx+Cnl/S6vajCuVlYy0xnOVWTqlsOOh/ mx+q8UhFOC+e+dgZI1HaCFN0+KEhmWneFOvrh1JlJGxrrrYdITCU/BXGUMn/EdiNOXza QmXg== X-Gm-Message-State: AC+VfDwP+nIwPBjg9jfL22FtahUYFtJ2M0IVWtvj8zDfT27Og8DHqGq6 P1NDCzX0JDqCh61JDqjal0E= X-Google-Smtp-Source: ACHHUZ5lS04TottrJMUXz+OX64OkqVEwB8rUwbfUhTJ/mSh0cTtiFFjMjhfvClBS2a93tbKFEGxkyw== X-Received: by 2002:a05:600c:19ca:b0:3f7:2da:8fb4 with SMTP id u10-20020a05600c19ca00b003f702da8fb4mr3522438wmq.17.1685433213186; Tue, 30 May 2023 00:53:33 -0700 (PDT) Received: from PC-UT2.ad.ennebielettronica.com ([78.152.97.130]) by smtp.gmail.com with ESMTPSA id x21-20020a05600c21d500b003f6041f5a6csm16561275wmj.12.2023.05.30.00.53.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 May 2023 00:53:32 -0700 (PDT) From: fl.scratchpad@gmail.com To: jic23@kernel.org, Lars-Peter Clausen , Michael Hennerich , Alexandru Tachici , Liam Girdwood , Mark Brown Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Fabrizio Lamarque , Jonathan Cameron Subject: [PATCH v3 3/5] iio: adc: ad7192: Use VRef instead of AVdd as reference voltage source Date: Tue, 30 May 2023 09:53:09 +0200 Message-Id: <20230530075311.400686-4-fl.scratchpad@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230530075311.400686-1-fl.scratchpad@gmail.com> References: <20230530075311.400686-1-fl.scratchpad@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Fabrizio Lamarque Add missing vref-supply and fix avdd-supply used as if it were vref. AD7192 requires three independent voltage sources, digital supply (on pin DVdd), analog supply (on AVdd) and reference voltage (VRef on alternate pin pair REFIN1 or REFIN2). Emit a warning message when AVdd is used in place of VRef for backwards compatibility. Fixes: b581f748cce0 ("staging: iio: adc: ad7192: move out of staging") Signed-off-by: Fabrizio Lamarque --- drivers/iio/adc/ad7192.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/drivers/iio/adc/ad7192.c b/drivers/iio/adc/ad7192.c index 5a9c8898f8af..bc41323ea810 100644 --- a/drivers/iio/adc/ad7192.c +++ b/drivers/iio/adc/ad7192.c @@ -177,6 +177,7 @@ struct ad7192_chip_info { struct ad7192_state { const struct ad7192_chip_info *chip_info; struct regulator *avdd; + struct regulator *vref; struct clk *mclk; u16 int_vref_mv; u32 fclk; @@ -1014,11 +1015,31 @@ static int ad7192_probe(struct spi_device *spi) if (ret) return ret; + st->vref = devm_regulator_get_optional(&spi->dev, "vref"); + if (!IS_ERR(st->vref)) { + ret = regulator_enable(st->vref); + if (ret) + return dev_err_probe(&spi->dev, ret, + "Failed to enable specified VRef supply\n"); + + ret = devm_add_action_or_reset(&spi->dev, ad7192_reg_disable, st->vref); + if (ret) + return ret; + } else if (PTR_ERR(st->vref) != -ENODEV) { + return PTR_ERR(st->vref); + } + ret = devm_regulator_get_enable(&spi->dev, "dvdd"); if (ret) return dev_err_probe(&spi->dev, ret, "Failed to enable specified DVdd supply\n"); - ret = regulator_get_voltage(st->avdd); + + if (!IS_ERR(st->vref)) { + ret = regulator_get_voltage(st->vref); + } else { + dev_warn(&spi->dev, "Using AVdd in place of VRef. Likely an old DTS\n"); + ret = regulator_get_voltage(st->avdd); + } if (ret < 0) { dev_err(&spi->dev, "Device tree error, reference voltage undefined\n"); return ret; From patchwork Tue May 30 07:53:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabrizio Lamarque X-Patchwork-Id: 13259375 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AF17EC77B7A for ; Tue, 30 May 2023 07:53:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229658AbjE3Hxr (ORCPT ); Tue, 30 May 2023 03:53:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229633AbjE3Hxi (ORCPT ); Tue, 30 May 2023 03:53:38 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B22ABBF; Tue, 30 May 2023 00:53:36 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-3f70fc4682aso1202395e9.1; Tue, 30 May 2023 00:53:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685433215; x=1688025215; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=79m/nLTn+NpENaFTAI+QR5GINZyts+HlG6WpZNU+yIw=; b=F5+vYVvaxjDo6inHzuMAL2MrxE+nEMCk+z9tMMKfMkiSuaCZrTZFRP0t59mWKWraYd qa1coa90wCL5s/0VX3Fk92oI0DDn8vHfZXVbShaA0JcJtYFmhxp1MD3MujagIfwRCKZg d3CdVqre2xpg8xFu6H1026eA771+DCRs/hw0/q9l+4juMCnDmOrZR/rYcSIOiBsz6QWW dq6HYvrsWNUlbQl6AhlGxKCUnfPcQ2RU82Qlv0zAD3EsIBLD6uG5I0NRr8kxVrAX/wAO XMzKH65MzQbx/QsQCv5PXKC1uTzZKnrcKsuUrHgriwofLv5md/ifahxjHnMS1NU3xFHV Mbmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685433215; x=1688025215; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=79m/nLTn+NpENaFTAI+QR5GINZyts+HlG6WpZNU+yIw=; b=YqFodE5wxVRzDEitq4tzOU9XdooP+m7ZjpQHvDNmZja4hda/wxyTPLjNeR1KiGuhnC naSlO8gXzn4jVhOPkZx1JFbRATc/zNoIPoHGnV/4qaeV7qzVqVVMxvdoHvgusSBYqEri YrbnmO4g0WeGUXqiPbh/6YYaYqOMZTnE0sDOqRj30xp/EEJ683UPS/ijDHVoZhpyR1S4 J8J56JE1JeDoPnYSn/QQinmf/mm4TKdRrf4EfBBMMNG7VeRnK5piOM2lUiT6KPp1dSY8 6MgfiWD44tem+QUOqKQ+AIZzTT1Gx2EiEXfVsa9Vin1uD9BRy5XocJj3ooKQ94i3wlR9 nqHw== X-Gm-Message-State: AC+VfDxiNnOew4jSCKwF0zg4eKqEcOBZLliBEOuFjLQ2ZRKx/IDQG2t4 VWOqFdMVXPKRWIjJCKDuwJ4= X-Google-Smtp-Source: ACHHUZ4Y35lfWLKOd4KKI0PoPFjBl9+AUjECZdfIJVdTTvYrvnGiUJQgTkTqIxohRARimju72GCFpw== X-Received: by 2002:a1c:7501:0:b0:3f7:5e3:c1f5 with SMTP id o1-20020a1c7501000000b003f705e3c1f5mr865894wmc.2.1685433215148; Tue, 30 May 2023 00:53:35 -0700 (PDT) Received: from PC-UT2.ad.ennebielettronica.com ([78.152.97.130]) by smtp.gmail.com with ESMTPSA id x21-20020a05600c21d500b003f6041f5a6csm16561275wmj.12.2023.05.30.00.53.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 May 2023 00:53:34 -0700 (PDT) From: fl.scratchpad@gmail.com To: jic23@kernel.org, Alexandru Tachici , Lars-Peter Clausen , Michael Hennerich , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Fabrizio Lamarque , Michael Hennerich , Jonathan Cameron , devicetree@vger.kernel.org Subject: [PATCH v3 4/5] dt-bindings: iio: ad7192: Add mandatory reference voltage source Date: Tue, 30 May 2023 09:53:10 +0200 Message-Id: <20230530075311.400686-5-fl.scratchpad@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230530075311.400686-1-fl.scratchpad@gmail.com> References: <20230530075311.400686-1-fl.scratchpad@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Fabrizio Lamarque Add required reference voltage (VRef) supply regulator. AD7192 requires three independent voltage sources: DVdd, AVdd and VRef (on REFINx pin pairs). Fixes: b581f748cce0 ("staging: iio: adc: ad7192: move out of staging") Signed-off-by: Fabrizio Lamarque Acked-by: Conor Dooley --- Documentation/devicetree/bindings/iio/adc/adi,ad7192.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7192.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad7192.yaml index d521d516088b..16def2985ab4 100644 --- a/Documentation/devicetree/bindings/iio/adc/adi,ad7192.yaml +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7192.yaml @@ -47,6 +47,9 @@ properties: avdd-supply: description: AVdd voltage supply + vref-supply: + description: VRef voltage supply + adi,rejection-60-Hz-enable: description: | This bit enables a notch at 60 Hz when the first notch of the sinc @@ -89,6 +92,7 @@ required: - interrupts - dvdd-supply - avdd-supply + - vref-supply - spi-cpol - spi-cpha @@ -115,6 +119,7 @@ examples: interrupt-parent = <&gpio>; dvdd-supply = <&dvdd>; avdd-supply = <&avdd>; + vref-supply = <&vref>; adi,refin2-pins-enable; adi,rejection-60-Hz-enable; From patchwork Tue May 30 07:53:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabrizio Lamarque X-Patchwork-Id: 13259376 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0A736C7EE2F for ; Tue, 30 May 2023 07:54:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229748AbjE3Hx6 (ORCPT ); Tue, 30 May 2023 03:53:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229698AbjE3Hxq (ORCPT ); Tue, 30 May 2023 03:53:46 -0400 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B002F0; Tue, 30 May 2023 00:53:39 -0700 (PDT) Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-3f60804faf4so26869735e9.3; Tue, 30 May 2023 00:53:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685433217; x=1688025217; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=mizo9gnkF3NdkFdByq3QjeHMqHH/cKSCHXOmzX7m6qI=; b=CiTz7HwUaUiU19fDMjGcyNpQMym6AXUPkMPMO8RN85jgjhc8V2EJRvcFAuKM3jkWlR mOxCIveZEZgC8sB4XDVKw0wAkALSGqd8UT2yl+ppK9eEeS7MIEuKZMQ+M+302iwfoD4U O/cgGQdpm8a9V9Ss/woUm+e0X+pS8ahcLrwEut9BeePMmuql/voi0pHsmB1bSSmro5tr HQcbtuwU4ZZaGUAuyWlKwEiMF0xcbu6sDrZA9aLcdgN48iOIy5Y3q9eHQPlVz2dd5UE7 1z862mWoekHg4sXcd8PcAMdmHcLuN0s9OlMhE4cbcF4ySmRtjcdzSJT7iThX8Z1IvR0I NaRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685433217; x=1688025217; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mizo9gnkF3NdkFdByq3QjeHMqHH/cKSCHXOmzX7m6qI=; b=Y2r1Vw0tps22k1GmyvPbyVb8cvbAMMm3blyAxfQyDYMcHWsZo7wbBUX7oolWfxtoum 8LqbvxTAZ9MFYzK54tCrgdYsGCkb/EI4jOD2e5RO8aRnxeje8ZLWdZv8tUPDNRSpPmQ9 sC88L0WUEh5EXV+eqfYb320MB74WofQY1GPPNm8uRPwpajXWEuX+zP54iVxm6gFZ451f B3rxwfW5cO6ssjB4LdaEsfEsSBLiky2CH658T+SYLj8QDSNxLbGEMEI1jjovvybDN4OX CdiZ0zaeNeIQprHPtQU+6yLjw8s1/4MeVsbkA+DiG+0Ld494c9qIp8HMb6f+J0Dd6fWq XfZA== X-Gm-Message-State: AC+VfDxg2DOfbaOf7iTiT29YsQ09V9lnEGCOtGY0UIEPh4CDmYKeqyI5 zchvnGdI8uuA7Ba4qSz36ws= X-Google-Smtp-Source: ACHHUZ4fRMBvqH4YW/Lcvfr+6QshvSlLHZ4Nnu6ybEKSJsxCfYPhuZP5/HGTlW0Nx89qpSvv7m/aPg== X-Received: by 2002:a1c:7716:0:b0:3f4:298b:d925 with SMTP id t22-20020a1c7716000000b003f4298bd925mr805890wmi.41.1685433217367; Tue, 30 May 2023 00:53:37 -0700 (PDT) Received: from PC-UT2.ad.ennebielettronica.com ([78.152.97.130]) by smtp.gmail.com with ESMTPSA id x21-20020a05600c21d500b003f6041f5a6csm16561275wmj.12.2023.05.30.00.53.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 May 2023 00:53:37 -0700 (PDT) From: fl.scratchpad@gmail.com To: jic23@kernel.org, Lars-Peter Clausen , Michael Hennerich , Alexandru Tachici , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Fabrizio Lamarque , Michael Hennerich , devicetree@vger.kernel.org Subject: [PATCH v3 5/5] dt-bindings: iio: ad7192: Allow selection of clock modes Date: Tue, 30 May 2023 09:53:11 +0200 Message-Id: <20230530075311.400686-6-fl.scratchpad@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230530075311.400686-1-fl.scratchpad@gmail.com> References: <20230530075311.400686-1-fl.scratchpad@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Fabrizio Lamarque AD7192 supports external clock sources, generated by a digital clock source or a crystal oscillator, or internally generated clock option without external components. Describe choice between internal and external clock, crystal or external oscillator, and internal clock output enable. Signed-off-by: Fabrizio Lamarque --- .../bindings/iio/adc/adi,ad7192.yaml | 27 ++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7192.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad7192.yaml index 16def2985ab4..f7ecfd65ad80 100644 --- a/Documentation/devicetree/bindings/iio/adc/adi,ad7192.yaml +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7192.yaml @@ -32,7 +32,8 @@ properties: clocks: maxItems: 1 - description: phandle to the master clock (mclk) + description: | + Master clock (mclk). If not set, internal clock is used. clock-names: items: @@ -50,6 +51,17 @@ properties: vref-supply: description: VRef voltage supply + adi,clock-xtal: + description: | + Select whether an external crystal oscillator or an external + clock is applied as master (mclk) clock. + type: boolean + + adi,int-clock-output-enable: + description: | + When internal clock is selected, this bit enables clock out pin. + type: boolean + adi,rejection-60-Hz-enable: description: | This bit enables a notch at 60 Hz when the first notch of the sinc @@ -84,11 +96,12 @@ properties: description: see Documentation/devicetree/bindings/iio/adc/adc.yaml type: boolean +dependencies: + adi,clock-xtal: ['clocks', 'clock-names'] + required: - compatible - reg - - clocks - - clock-names - interrupts - dvdd-supply - avdd-supply @@ -98,6 +111,13 @@ required: allOf: - $ref: /schemas/spi/spi-peripheral-props.yaml# + - if: + required: + - clocks + - clock-names + then: + properties: + adi,int-clock-output-enable: false unevaluatedProperties: false @@ -115,6 +135,7 @@ examples: spi-cpha; clocks = <&ad7192_mclk>; clock-names = "mclk"; + adi,clock-xtal; interrupts = <25 0x2>; interrupt-parent = <&gpio>; dvdd-supply = <&dvdd>;