From patchwork Fri Jan 10 10:24:13 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Angelo Dureghello X-Patchwork-Id: 13934202 Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B465E20B1E9 for ; Fri, 10 Jan 2025 10:25:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736504752; cv=none; b=hIEqoZS9Zl+p9j2wAdFmHUjVpXy3pSu3i/Weth8huh+IaVfg09ixDOzf1tejH8faDc1q2nyvtSj2El5GkiU+pC2dTQgdGfbJVGaDKpLmDjzShtbZyRo/RCrI84KGVYXn7tsuokWgolmTHl427e/aNN68/5krUr7GMS+d49AJjMs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736504752; c=relaxed/simple; bh=BU8usK5hfPm4w0lU+vwnmS92dSAjZsWnIkUPfiLZiok=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=uJlgLSMaK44u6Tf3hVnA1gGMXHDz8kLHTNbpMq9H4PmV99WmMJoHnlECkTmFTAiFo/tVZnWOa0triuBbgWZZJBCtLi1LsU627hObDJjPbOdKQhmJHwcz3xMxPqAlDAxjsnvguwkYak+VuU+sbWwx87yybQXr3xeylEUK5CArJc4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=FbHN+Yyd; arc=none smtp.client-ip=209.85.221.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="FbHN+Yyd" Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-3863703258fso1927317f8f.1 for ; Fri, 10 Jan 2025 02:25:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1736504748; x=1737109548; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=LTzMiHBO+Ydh4211xpRKGTzEHCkmIaaesvGZwqEp6FU=; b=FbHN+YydoS7KqxUzvrG/7bEYyMaiJ7LtvKDBEE6XuSNWVaqcpacyNZmyLVZN2znuNU AYNyzhVUOERojTPvODoZ4y+5MaIo4TTerNSb2v9KAz33fUz2Kf4WOt1dw92yNWXhCfNH fL6WXPSfJ6X0hwTTiutUAUbPNzb3mhFMVC9+UQ4ic9EPRl3uOyOEQjsHnjCO18Sii4zB xSUqvqjdTZb4AcQJVKH6m+DCUz3CAC4M4gDTRwWRlfrZyS9bGD1Mney0X81VUytzKI+T 6SVStyDTx3ZpgV8aRCTLXdR/0ullhbGg6b02JABQmd8GZUSvmxtBnyLpr2kQr63SXNfn lMnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736504748; x=1737109548; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LTzMiHBO+Ydh4211xpRKGTzEHCkmIaaesvGZwqEp6FU=; b=JXllkRGixLEODWhWvIf1dVgyF5y2sXI6sRAmAxvh30Nt6vWlyJ+ABbJ5CPu7QngrjR 1Or7+SVBYO/vfVoy195wQ0UFqHA7obyLEjmJukclg9iXt1JiMRA+1zSMHlSaP5+LQ5N7 Y7QsMXAZKD8s2W3x3iWFDi3UCl5LEwCZ7/hYcWz3f3VZZRA+racVEhy9s9tyl04n2/1u viZiHMyn1/2zwQcjSmcCn1VynaiNcySFqwNjX1LNHKl2R+dA8iZ7jDnwdh3leTxk8ffB abH36hquz666Xgx3aDip4bCNl4yeJv6lbL92OhBe6xeVn6/OltIAEz56YcL4YBoXpKY3 fNRw== X-Forwarded-Encrypted: i=1; AJvYcCVSp00XJUMGRRlQmcyBqJ/oAPBlYUm/HEWAwq0Ws4u7YueMRY/GiG3aFG0Ncqm2mWV67gMgNJRzM0w=@vger.kernel.org X-Gm-Message-State: AOJu0YzggHg479tFPm5Y4pdaQIe4uqbJUoBAlzVZ7EcTm8MwtJf/qewm ebjHp2wOczwPdMq2ogYCOwhSCKFrjhz6GG2pyMI1Syu1yLYJLg4NviOkpIt40cs= X-Gm-Gg: ASbGnctvQTTXrm86jaKlXsfj/SO4hvC3PJnMI8ll9hEBR1hRMe99FG/aBm3gwjrX5Wu 2Cgl6FpGNtySlh8hPxYsEuoPp/5dPj4TnMAl2TwsEh02o6yhD7UTNbG0YQZ+6b6v4KqPgffJXj0 2pYWK9uxBqV4RLPrgwYVUVfSaHZZUPXfaNOJ/z2z3owB1H4uRtgHd3umbh1J3ahdfA5pQsOHb/5 wYAeIJmD5GT6R96em46W+WfI0qTxjJ1U1lH3C6iM4uoYPDCYEv2WfC8cPc= X-Google-Smtp-Source: AGHT+IF+TvdLKJqiFKbCKWWoktZaPfZ/8uKZuWN2qtyGhWJ4PS0vvIbOvdfel9z+Fck1EgMS2G9Mew== X-Received: by 2002:a05:6000:4026:b0:386:3c2f:a3e7 with SMTP id ffacd0b85a97d-38a8b0b7fdcmr5660709f8f.3.1736504748107; Fri, 10 Jan 2025 02:25:48 -0800 (PST) Received: from [127.0.1.1] ([87.13.70.66]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a8e37d085sm4246430f8f.13.2025.01.10.02.25.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jan 2025 02:25:47 -0800 (PST) From: Angelo Dureghello X-Google-Original-From: Angelo Dureghello Date: Fri, 10 Jan 2025 11:24:13 +0100 Subject: [PATCH v3 1/9] iio: dac: ad3552r-common: fix ad3541/2r ranges Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250110-wip-bl-ad3552r-axi-v0-iio-testing-carlos-v3-1-ab42aef0d840@baylibre.com> References: <20250110-wip-bl-ad3552r-axi-v0-iio-testing-carlos-v3-0-ab42aef0d840@baylibre.com> In-Reply-To: <20250110-wip-bl-ad3552r-axi-v0-iio-testing-carlos-v3-0-ab42aef0d840@baylibre.com> To: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , David Lechner , Nuno Sa Cc: Jonathan Cameron , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Angelo Dureghello X-Mailer: b4 0.14.1 From: Angelo Dureghello Fix ad3541/2r voltage ranges to be as per ad3542r datasheet, rev. C, table 38 (page 57). The wrong ad354xr ranges was generating erroneous Vpp output. In more details: - fix wrong number of ranges, they are 5 ranges, not 6, - remove non-existent 0-3V range, - adjust order, since ad3552r_find_range() get a wrong index, producing a wrong Vpp as output. Retested all the ranges on real hardware, EVALAD3542RFMCZ: adi,output-range-microvolt (fdt): <(000000) (2500000)>; ok (Rfbx1, switch 10) <(000000) (5000000)>; ok (Rfbx1, switch 10) <(000000) (10000000)>; ok (Rfbx1, switch 10) <(-5000000) (5000000)>; ok (Rfbx2, switch +/- 5) <(-2500000) (7500000)>; ok (Rfbx2, switch -2.5/7.5) Fixes: 8f2b54824b28 ("drivers:iio:dac: Add AD3552R driver support") Reviewed-by: David Lechner Signed-off-by: Angelo Dureghello --- drivers/iio/dac/ad3552r-common.c | 5 ++--- drivers/iio/dac/ad3552r.h | 8 +++----- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/iio/dac/ad3552r-common.c b/drivers/iio/dac/ad3552r-common.c index 0f495df2e5ce..03e0864f5084 100644 --- a/drivers/iio/dac/ad3552r-common.c +++ b/drivers/iio/dac/ad3552r-common.c @@ -22,11 +22,10 @@ EXPORT_SYMBOL_NS_GPL(ad3552r_ch_ranges, "IIO_AD3552R"); const s32 ad3542r_ch_ranges[AD3542R_MAX_RANGES][2] = { [AD3542R_CH_OUTPUT_RANGE_0__2P5V] = { 0, 2500 }, - [AD3542R_CH_OUTPUT_RANGE_0__3V] = { 0, 3000 }, [AD3542R_CH_OUTPUT_RANGE_0__5V] = { 0, 5000 }, [AD3542R_CH_OUTPUT_RANGE_0__10V] = { 0, 10000 }, - [AD3542R_CH_OUTPUT_RANGE_NEG_2P5__7P5V] = { -2500, 7500 }, - [AD3542R_CH_OUTPUT_RANGE_NEG_5__5V] = { -5000, 5000 } + [AD3542R_CH_OUTPUT_RANGE_NEG_5__5V] = { -5000, 5000 }, + [AD3542R_CH_OUTPUT_RANGE_NEG_2P5__7P5V] = { -2500, 7500 } }; EXPORT_SYMBOL_NS_GPL(ad3542r_ch_ranges, "IIO_AD3552R"); diff --git a/drivers/iio/dac/ad3552r.h b/drivers/iio/dac/ad3552r.h index fd5a3dfd1d1c..4b5581039ae9 100644 --- a/drivers/iio/dac/ad3552r.h +++ b/drivers/iio/dac/ad3552r.h @@ -131,7 +131,7 @@ #define AD3552R_CH1_ACTIVE BIT(1) #define AD3552R_MAX_RANGES 5 -#define AD3542R_MAX_RANGES 6 +#define AD3542R_MAX_RANGES 5 #define AD3552R_QUAD_SPI 2 extern const s32 ad3552r_ch_ranges[AD3552R_MAX_RANGES][2]; @@ -189,16 +189,14 @@ enum ad3552r_ch_vref_select { enum ad3542r_ch_output_range { /* Range from 0 V to 2.5 V. Requires Rfb1x connection */ AD3542R_CH_OUTPUT_RANGE_0__2P5V, - /* Range from 0 V to 3 V. Requires Rfb1x connection */ - AD3542R_CH_OUTPUT_RANGE_0__3V, /* Range from 0 V to 5 V. Requires Rfb1x connection */ AD3542R_CH_OUTPUT_RANGE_0__5V, /* Range from 0 V to 10 V. Requires Rfb2x connection */ AD3542R_CH_OUTPUT_RANGE_0__10V, - /* Range from -2.5 V to 7.5 V. Requires Rfb2x connection */ - AD3542R_CH_OUTPUT_RANGE_NEG_2P5__7P5V, /* Range from -5 V to 5 V. Requires Rfb2x connection */ AD3542R_CH_OUTPUT_RANGE_NEG_5__5V, + /* Range from -2.5 V to 7.5 V. Requires Rfb2x connection */ + AD3542R_CH_OUTPUT_RANGE_NEG_2P5__7P5V, }; enum ad3552r_ch_output_range { From patchwork Fri Jan 10 10:24:14 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Angelo Dureghello X-Patchwork-Id: 13934203 Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 369E520B1EC for ; Fri, 10 Jan 2025 10:25:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736504753; cv=none; b=rzManCAXNF0O1IC+gHjKE0nBfJBECVb0+BnR0yG1SoSLgUCoEm+s9l2S9SzVGm8uRD8Ha0lX3twV+VVEmN40+GyBKaFHU637jH3UqAHtI2HF6lbWUDUm5eDfrYXhELx2jo+Hyb9Le6+UK+bcZJOPogUbhx9b67iGYpBMXNzMe0Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736504753; c=relaxed/simple; bh=pJ/8SnERbBF2D7kFoBgho5WN/rZlNOVicoi4/vwnVhk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=iywtVs/pQrXziX5HFVSdRmcOo/ytbSu7e0GZXEVpiGxEbmlDeRxhQf0hfIDEbYryAPY1FsJKnVzab+gfTe4WZCh2bo6EJuhgP5Wo2uW5wN9UwhxLz9V3wW8M+LyfpiURyBLDQUnObNyzoZSyemu4lTFb0+wv56gxyszEIscPANI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=CiePnfjm; arc=none smtp.client-ip=209.85.221.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="CiePnfjm" Received: by mail-wr1-f41.google.com with SMTP id ffacd0b85a97d-3862f32a33eso859425f8f.3 for ; Fri, 10 Jan 2025 02:25:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1736504749; x=1737109549; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=gzGFXpuMS6bd9jRjpgjdc1eSoCWcqwcy2tSSy+G0v9g=; b=CiePnfjmXBlsi3uz1h8ADe0hphBU+XVq6p5oJ/CCowW11MXCj6Lr/lIcT0Zfh4+WRe VouscVAloQFmMQdiHmiqgBvPlySVYXT7lnBJUi8L3hCtyWg3lvbAK6tT1GfEeCvZN22U hHkjqB7qayWMeDd+KNr24Ygxf49rrV7yy2aMOEyezzsyp72Jr6oF/BG9ZY6phMgwpSu2 TRzOElxot/od8LH6Vr8ep4/nXaGWb0cxE2t3jRY3Uaa1TSc5ZzCCQPwc+Or/gfCKcq4S jP6Bwvl0wA8wcmInQzid1oVw5/YdSJqNhodDj60OJ4Zn6aNrPb+IEx15F29Ml5PZfM78 EtPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736504749; x=1737109549; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gzGFXpuMS6bd9jRjpgjdc1eSoCWcqwcy2tSSy+G0v9g=; b=ZojdAo+woLImx7HVn6+0wzNMzLkGD5+EeEb9IUdnlmsTUtekuY2XqxXvPBWaWvh5Tm PG1aayAYH3G+D8CNziXHM5BPtXxodtGQfTXyctHIIlJo7COa4N8nLmOGAGpkoz1Mzklz lnE/yg/Cu7DvDgWhG2B28FNyyBC7JCeIkSP52gUTD6wstLvfZYtBGSbenFRsuQi0s6EN ET4MapAiQa3Dn4xuxgPAN/V5ZPV41AbwKdpgap+JGaTaD3N9316EhQA0WhGLmVX/dzkw sQiht9qGw5IIucT8dRwWmceRkz1+dgo19MBL8oaxRsJRHnd/LFasxBgycnkJowz3gKCc KZXA== X-Forwarded-Encrypted: i=1; AJvYcCUYtTG97OktLny5PmAPJ8cekZZQIPw4RkwL6LXBkbd5aBIA0CX0Swapox2R8aIu/BAPYwAyAf0dpCU=@vger.kernel.org X-Gm-Message-State: AOJu0Yz9egEqhKg/HgMwi/zhMFyKOefHSQeZiiu+Ea60Djz2jrQTIAQu u0ZZRffzFu98QWD5sQUuOpXGUPTloSERYKsAoqWPOh8gKU7K30VC+uBBQwXMMWM= X-Gm-Gg: ASbGncuE20NOIdd215fPG22MrqTVoYKt+uDHr7MPmeQmcGKobylwwtcf2DckeVtumuI Xfh5ZUsb78qbPPzxCgKEv28RDIpCLOTaM9JdJmyzDWlutPdYga3A6KzfSWt/GTcJK1fJtHbTxMl V5kUHI2Yzaa7roI+Hz7hEzXOSPnrcaHuZwYnM4vDQqns1rxicCmayI1DxzpNtKx4DoPBmgsrNRb LaSLgEg70Nhg1XQG6ZU9WKUftpS2ahsmjSEgtdjBoZMI67pknKaEFQ3yvM= X-Google-Smtp-Source: AGHT+IFDoAfC2TEGvWdsgMiIGabTAjDbrdPRG6NL0tEiw6hi8UXbV2vsFwEBCEBl43yYldJWGWPxVg== X-Received: by 2002:a5d:5f52:0:b0:382:4926:98fa with SMTP id ffacd0b85a97d-38a8733691amr9689710f8f.40.1736504749506; Fri, 10 Jan 2025 02:25:49 -0800 (PST) Received: from [127.0.1.1] ([87.13.70.66]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a8e37d085sm4246430f8f.13.2025.01.10.02.25.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jan 2025 02:25:48 -0800 (PST) From: Angelo Dureghello X-Google-Original-From: Angelo Dureghello Date: Fri, 10 Jan 2025 11:24:14 +0100 Subject: [PATCH v3 2/9] iio: dac: ad3552r-hs: clear reset status flag Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250110-wip-bl-ad3552r-axi-v0-iio-testing-carlos-v3-2-ab42aef0d840@baylibre.com> References: <20250110-wip-bl-ad3552r-axi-v0-iio-testing-carlos-v3-0-ab42aef0d840@baylibre.com> In-Reply-To: <20250110-wip-bl-ad3552r-axi-v0-iio-testing-carlos-v3-0-ab42aef0d840@baylibre.com> To: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , David Lechner , Nuno Sa Cc: Jonathan Cameron , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Angelo Dureghello X-Mailer: b4 0.14.1 From: Angelo Dureghello Clear reset status flag, to keep error status register clean after reset (ad3552r manual, rev B table 38). Reset error flag was left to 1, so debugging registers, the "Error Status Register" was dirty (0x01). It is important to clear this bit, so if there is any reset event over normal working mode, it is possible to detect it. Fixes: 0b4d9fe58be8 ("iio: dac: ad3552r: add high-speed platform driver") Reviewed-by: David Lechner Signed-off-by: Angelo Dureghello --- drivers/iio/dac/ad3552r-hs.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/iio/dac/ad3552r-hs.c b/drivers/iio/dac/ad3552r-hs.c index 216c634f3eaf..8974df625670 100644 --- a/drivers/iio/dac/ad3552r-hs.c +++ b/drivers/iio/dac/ad3552r-hs.c @@ -329,6 +329,12 @@ static int ad3552r_hs_setup(struct ad3552r_hs_state *st) dev_info(st->dev, "Chip ID error. Expected 0x%x, Read 0x%x\n", AD3552R_ID, id); + /* Clear reset error flag, see ad3552r manual, rev B table 38. */ + ret = st->data->bus_reg_write(st->back, AD3552R_REG_ADDR_ERR_STATUS, + AD3552R_MASK_RESET_STATUS, 1); + if (ret) + return ret; + ret = st->data->bus_reg_write(st->back, AD3552R_REG_ADDR_SH_REFERENCE_CONFIG, 0, 1); From patchwork Fri Jan 10 10:24:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Angelo Dureghello X-Patchwork-Id: 13934204 Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7466320B215 for ; Fri, 10 Jan 2025 10:25:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736504754; cv=none; b=NomBRIrc719zcx9qTvxqgxo32061WR5R2kENynvOlaw5EKO8azprgIfwbBvcxRLNXK7y34M5/hFWdNloAaIGpad9Dy4OyKSRxfeIPdAYlUeLI970pCbBjTvHnrTRSVf7H2ZUeMj6DQORtuEUjlBRsocxplf5+kPBMckqK3B2GN4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736504754; c=relaxed/simple; bh=h6TjUogOr8G2ArhkLLAgjQA6se+8ftza7DkNnQZNqFo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=L7C7gQLZV60lwjFn5onsyv0T1vYBXpu1kEHuv7fHqH/Zo3T/Q2XVWwL2RxA4n3WJ2gM8Nz81IFPlt8HVdv/BLazHl1LSdKRq7wNSbh9cjAc4KFDTAqGyBzoMSUoy26YmF4PMnDuap7gYUcoOgNvgQdM/aISBtsdW4MDkbbWtF1Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=ureUcsLt; arc=none smtp.client-ip=209.85.221.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="ureUcsLt" Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-385e1fcb0e1so1036466f8f.2 for ; Fri, 10 Jan 2025 02:25:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1736504751; x=1737109551; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=2Vf/r8AjrH4xqsFpa+mVu0wFfb25pyxBmrDXflBiTGw=; b=ureUcsLtcv53+kWai3Fe6HZBto+it7DL2EdmMCXr4zVJHJb8SY5sgUwhNlCyhRmvxf nQ1Nar1ZgdiBSXpU3e43KGyeVBsny0jKgLs4P6TtAgf2xeZkRzjD79MJnisWQSOQ09Ei 5wSOL0DwOYWGC3apAojz61g45/g+9n610YbVV3FU0IvyDGolknlkPMNKNAZpHg1YaqFH 7BgmMbMPhelPK3AIixEYEuqDF4J+TMUmFh0f7EiTlArML+UgtnmuCuHmmSSGJGNL6oCy S4HDMuvCvNkkdVkyoHqjd48pxCyiCFb+qx+Z/Xvpx7UxDAv6PL9EM3J21AaR9wt5G3S5 KXHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736504751; x=1737109551; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2Vf/r8AjrH4xqsFpa+mVu0wFfb25pyxBmrDXflBiTGw=; b=cJgAiSdvgf+D9N/BzihQf3IZlj1HhWbffwu7E+DXmY4NSMjjQHOQdYr2ExmUxgiUBa mXQCWN1dal1w/ETdWzvO8k8k4Sum8KNgJygP5mhBPcrfohONedAsrfN1eotv5OmSqUbi dwwP003EAd22SSu3aBocSu3txB+j7kPXTk4tXfjIbO7TkVNGAZHzxmbC7mRmKZVJj3o5 tz0WZXmPvqKA4u/tCDYz7xjBq1W+HutHYt+rK3qFjinK6lWT0xvrsFlsk5DI1nh3AyVO 855Uk7SNdskGcTS85Ljn/fBZIVqMEhj3IVpTcswSTDlshCvoATcZtOCjWPRCpOxwnlkA bUqg== X-Forwarded-Encrypted: i=1; AJvYcCVlJwPGYDKselq2xr9Z22LutfouduJAf7lxLVUHKy9Ukn0xbltzvGbiRoJr+Fxo7QV3dw4c/96ItrU=@vger.kernel.org X-Gm-Message-State: AOJu0Yy1zSwDlscxf5y/6eR4103Jao5di2qL58jp0dp+R5QxmrjxOvOw 6unil1ELDK06Y70VIJbJ9zRVFiIGoA+OOATjpxj7cG1dkLHXBeRkkY1jCwImJbs= X-Gm-Gg: ASbGncvho9752LnN9pFiOmMqapjo5yUBwQdsCQPnLnVBkyNikQfLn5KV+qYotniWhtw /CBB9r3rztnx0EAx4rC4zcSNqxx1hgOAsI1Nuo3Vmj/gCBLvTpn/BvHl9AAIq3Fvdc5Y7vteDtW PSur2GIetL3cB5rvMFSKIpSLAFxKlLRy6KxMfJHc15iNe2OFJ+OGqQv/WiZC8kKwUW6N4kImwCT 6kArnFlviQiYanao0n+autnL1cxc2/CSN3ALNzpD4RAiPQ4Kq+DmKe5Psk= X-Google-Smtp-Source: AGHT+IEgQfMCXod30H10ecsy4cPLhjVsKghHNktGHr/r89eUKsk5O137W3pmpAMmF8b11ri+VzGJ8Q== X-Received: by 2002:a05:6000:2a3:b0:385:e30a:e0f7 with SMTP id ffacd0b85a97d-38a87309cedmr8799140f8f.22.1736504750816; Fri, 10 Jan 2025 02:25:50 -0800 (PST) Received: from [127.0.1.1] ([87.13.70.66]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a8e37d085sm4246430f8f.13.2025.01.10.02.25.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jan 2025 02:25:50 -0800 (PST) From: Angelo Dureghello X-Google-Original-From: Angelo Dureghello Date: Fri, 10 Jan 2025 11:24:15 +0100 Subject: [PATCH v3 3/9] iio: dac: adi-axi-dac: modify stream enable Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250110-wip-bl-ad3552r-axi-v0-iio-testing-carlos-v3-3-ab42aef0d840@baylibre.com> References: <20250110-wip-bl-ad3552r-axi-v0-iio-testing-carlos-v3-0-ab42aef0d840@baylibre.com> In-Reply-To: <20250110-wip-bl-ad3552r-axi-v0-iio-testing-carlos-v3-0-ab42aef0d840@baylibre.com> To: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , David Lechner , Nuno Sa Cc: Jonathan Cameron , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Angelo Dureghello X-Mailer: b4 0.14.1 From: Angelo Dureghello Change suggested from the AXI HDL team, modify the function axi_dac_data_stream_enable() to check for interface busy, to avoid possible issues when starting the stream. Fixes: e61d7178429a ("iio: dac: adi-axi-dac: extend features") Signed-off-by: Angelo Dureghello --- drivers/iio/dac/adi-axi-dac.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/iio/dac/adi-axi-dac.c b/drivers/iio/dac/adi-axi-dac.c index b143f7ed6847..ac871deb8063 100644 --- a/drivers/iio/dac/adi-axi-dac.c +++ b/drivers/iio/dac/adi-axi-dac.c @@ -585,6 +585,14 @@ static int axi_dac_ddr_disable(struct iio_backend *back) static int axi_dac_data_stream_enable(struct iio_backend *back) { struct axi_dac_state *st = iio_backend_get_priv(back); + int ret, val; + + ret = regmap_read_poll_timeout(st->regmap, + AXI_DAC_UI_STATUS_REG, val, + FIELD_GET(AXI_DAC_UI_STATUS_IF_BUSY, val) == 0, + 10, 100 * KILO); + if (ret) + return ret; return regmap_set_bits(st->regmap, AXI_DAC_CUSTOM_CTRL_REG, AXI_DAC_CUSTOM_CTRL_STREAM_ENABLE); From patchwork Fri Jan 10 10:24:16 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Angelo Dureghello X-Patchwork-Id: 13934205 Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B347E20C017 for ; Fri, 10 Jan 2025 10:25:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736504756; cv=none; b=X4HVQ617jwJ/OaKzJNakonVIWLMsmeNP4GWx/ryxG0JUG1J8yaX5luZTXyiqa3K41ty53q6omxcSmT/o8mj4W6nZYdESA5Txk0/6oNd03SCYpEP8xMItqd7pRJXiVGCPblmE3dvDZLynxgJKx8iqKDXlcjoQRpgTf9/N2i4CXUM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736504756; c=relaxed/simple; bh=DSWN/o0cgi3x6KUQNRx0A1I4b2JRVAVg3CF1OrlSau0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=i0ZGfiJe8cUeoIgso2X08sTFAMuIw5ua9AnLM9vdooy28epPrU4RTS7pBjoutF6fWPrOhsEoGvqLXGqV0G+BVcoPYcJ6m8wJcJT2ROFnAfLo/JQsiVnEn5JPoWAFW+rt1nJLbsPv5/AyX5WjPQZ9PxylC38t/jniZy0QEB7BKV4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=okzMFdhb; arc=none smtp.client-ip=209.85.221.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="okzMFdhb" Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-3863494591bso1042129f8f.1 for ; Fri, 10 Jan 2025 02:25:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1736504752; x=1737109552; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=lH1+QRISrYTJQCkHtDpmUGDETZeTsT0d2K55FhuHdOs=; b=okzMFdhbkLkahVbLoQ14eXcVbLvvx8nzEm1oAngmOjuIQMPzn6zIYzAeuwqM73CzD4 qG0ZtRAeaDuVQCkyQwwG9LOxINPKma0AEWB5/jlIJDwS9LaXRksQu1Le5+2/dvwALLE5 rdQcz25IvHeGSWSqTWjqhsDYAnITk3FShpu1AD1eWYK9tdlYRLVvUl+OkRF2Y3rfUHaq zmXyU6zDJwg/1T5w0P+J2YDWJP9ygGoa4V12StGIaHwZxKyClfVLS9T1qudVK9kTtAj2 xXES6aW7AVHQ0bEM68FnqSRg12qVytVkhxG4Ad2wuOgqLt62BQmrAYy1YdN7YpyqEB9C Y5AA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736504752; x=1737109552; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lH1+QRISrYTJQCkHtDpmUGDETZeTsT0d2K55FhuHdOs=; b=UINzoQgAtHJ1vzNUn5/F91SmlH+RwEkb67akiZlKjLukcUbsZyEQf32ncMKfb2xD/d m0A4YvYHLyuREFGkvXNTxlTz/YAzsnHNL+QMAwQ40i3J7MFuxkABYLbHW0438xr8Gyfp t6Sp/E+13gHaG/WcnFr3RjvcXG/m8CQDeEndGiGy6K5hGoWpbeQVFtJciJC7riFe93zb DFgqoxHoUpdhrIeKJ6+WM7U/Yq8Ak0U/rp2iUphY8v8tuAOCK2QMBwXPtd/IJEmdYMcL LzObt5n4v+fbafNYpOlrRT2rGixa24Wu0qLqQmG7UyB2QrGLz8/V4FQSgfvXpddhsvNe HbnQ== X-Forwarded-Encrypted: i=1; AJvYcCUNTwSJGtakJwIskzeh0NF9aW0xkpOscfds+FXArGW8eZgVk4gOAoqV9FW+XSExGm/DD1z2mAYOLZM=@vger.kernel.org X-Gm-Message-State: AOJu0Yz002qKKhuAa/dlpHNaYxL8t4wKreXLN0S9w7ecwyd2H01C6X9j H1U1YSRrRuS8Ru2IHLEo+EH8agZ/0jgXsQLeeDEwsVkYP/xvm5uwvV8WczXAnmE= X-Gm-Gg: ASbGncu9ich2qcKh09VTcfx44K12dsK+2PaASY8g/FvozkcImOg7Mj0BqdZPlZPO6TZ qsZ9dVYlPcFFFSsUbGFnjzJKx5erOJV/NCVkdbKQUftyVMPeSCZRE0hJUOweYHsqpDc3vgRDQet 18/dOvI6h2q7CBWCP2m8Pz1fHA/VPQaq0U90J3TPO2snY4sP2kDs8F/f0IVUJllAnfUyeHnwHfe LAWef2I6c0DWz6/Fpc/G3P4mQekfUu7YGdOa9x/1TKr5vP1uPvcLioC4hQ= X-Google-Smtp-Source: AGHT+IE3++VQas4z/zJgn8dOh3EWyLSfjzOqCP0Tafv+3AGDb+Y5NSNOWs8Ujr3/PvFa0mPhc9Mqdg== X-Received: by 2002:a05:6000:4b1e:b0:386:4034:f9a0 with SMTP id ffacd0b85a97d-38a87315be0mr8543043f8f.52.1736504752143; Fri, 10 Jan 2025 02:25:52 -0800 (PST) Received: from [127.0.1.1] ([87.13.70.66]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a8e37d085sm4246430f8f.13.2025.01.10.02.25.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jan 2025 02:25:51 -0800 (PST) From: Angelo Dureghello X-Google-Original-From: Angelo Dureghello Date: Fri, 10 Jan 2025 11:24:16 +0100 Subject: [PATCH v3 4/9] iio: dac: adi-axi-dac: add bus mode setup Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250110-wip-bl-ad3552r-axi-v0-iio-testing-carlos-v3-4-ab42aef0d840@baylibre.com> References: <20250110-wip-bl-ad3552r-axi-v0-iio-testing-carlos-v3-0-ab42aef0d840@baylibre.com> In-Reply-To: <20250110-wip-bl-ad3552r-axi-v0-iio-testing-carlos-v3-0-ab42aef0d840@baylibre.com> To: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , David Lechner , Nuno Sa Cc: Jonathan Cameron , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Angelo Dureghello X-Mailer: b4 0.14.1 From: Angelo Dureghello The ad354xr requires DSPI mode (2 data lanes) to work in buffering mode, so backend needs to allow a mode selection between: SPI (entire ad35xxr family), DSPI (ad354xr), QSPI (ad355xr). About removal of AXI_DAC_CUSTOM_CTRL_SYNCED_TRANSFER, according to the HDL history the flag has never been used. So looks like the driver was including it by mistake or in anticipation for something that was never implemented on HDL side. Current HDL updated documentation confirm it is actually not in use anymore and replaced by the IO_MODE bits. Signed-off-by: Angelo Dureghello --- drivers/iio/dac/ad3552r-hs.h | 8 ++++++++ drivers/iio/dac/adi-axi-dac.c | 22 +++++++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/drivers/iio/dac/ad3552r-hs.h b/drivers/iio/dac/ad3552r-hs.h index 724261d38dea..4a9e35234124 100644 --- a/drivers/iio/dac/ad3552r-hs.h +++ b/drivers/iio/dac/ad3552r-hs.h @@ -8,11 +8,19 @@ struct iio_backend; +enum ad3552r_io_mode { + AD3552R_IO_MODE_SPI, + AD3552R_IO_MODE_DSPI, + AD3552R_IO_MODE_QSPI, +}; + struct ad3552r_hs_platform_data { int (*bus_reg_read)(struct iio_backend *back, u32 reg, u32 *val, size_t data_size); int (*bus_reg_write)(struct iio_backend *back, u32 reg, u32 val, size_t data_size); + int (*bus_set_io_mode)(struct iio_backend *back, + enum ad3552r_io_mode mode); u32 bus_sample_data_clock_hz; }; diff --git a/drivers/iio/dac/adi-axi-dac.c b/drivers/iio/dac/adi-axi-dac.c index ac871deb8063..bcaf365feef4 100644 --- a/drivers/iio/dac/adi-axi-dac.c +++ b/drivers/iio/dac/adi-axi-dac.c @@ -64,7 +64,7 @@ #define AXI_DAC_UI_STATUS_IF_BUSY BIT(4) #define AXI_DAC_CUSTOM_CTRL_REG 0x008C #define AXI_DAC_CUSTOM_CTRL_ADDRESS GENMASK(31, 24) -#define AXI_DAC_CUSTOM_CTRL_SYNCED_TRANSFER BIT(2) +#define AXI_DAC_CUSTOM_CTRL_MULTI_IO_MODE GENMASK(3, 2) #define AXI_DAC_CUSTOM_CTRL_STREAM BIT(1) #define AXI_DAC_CUSTOM_CTRL_TRANSFER_DATA BIT(0) @@ -722,6 +722,25 @@ static int axi_dac_bus_reg_read(struct iio_backend *back, u32 reg, u32 *val, return regmap_read(st->regmap, AXI_DAC_CUSTOM_RD_REG, val); } +static int axi_dac_bus_set_io_mode(struct iio_backend *back, + enum ad3552r_io_mode mode) +{ + struct axi_dac_state *st = iio_backend_get_priv(back); + int ival, ret; + + guard(mutex)(&st->lock); + + ret = regmap_update_bits(st->regmap, AXI_DAC_CUSTOM_CTRL_REG, + AXI_DAC_CUSTOM_CTRL_MULTI_IO_MODE, + FIELD_PREP(AXI_DAC_CUSTOM_CTRL_MULTI_IO_MODE, mode)); + if (ret) + return ret; + + return regmap_read_poll_timeout(st->regmap, AXI_DAC_UI_STATUS_REG, ival, + FIELD_GET(AXI_DAC_UI_STATUS_IF_BUSY, ival) == 0, 10, + 100 * KILO); +} + static void axi_dac_child_remove(void *data) { platform_device_unregister(data); @@ -733,6 +752,7 @@ static int axi_dac_create_platform_device(struct axi_dac_state *st, struct ad3552r_hs_platform_data pdata = { .bus_reg_read = axi_dac_bus_reg_read, .bus_reg_write = axi_dac_bus_reg_write, + .bus_set_io_mode = axi_dac_bus_set_io_mode, .bus_sample_data_clock_hz = st->dac_clk_rate, }; struct platform_device_info pi = { From patchwork Fri Jan 10 10:24:17 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Angelo Dureghello X-Patchwork-Id: 13934206 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 33E8320C471 for ; Fri, 10 Jan 2025 10:25:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736504757; cv=none; b=IEHoMkGjAZwM0+NLYicCDPqti55x1+jaSfH2DWD/QjcPuYzMsfnR/5HICXd5iSjSGOj+cdEzA/Nn4tTIsP8jjBfiBJRaIm4rZwWHSk7GDhdiO8+tM60jv/v6LsBVrhvKJ2UNYNno9Uy3KBv6/tfFYfaHLRhsf6jAjLujUiGQub8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736504757; c=relaxed/simple; bh=IuHaI/semL+Hv8JNr40Pmjd0RO8u7Ce4lu8w8B537I0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=GZXkdmAcWXT+33Dz3+gNoEFKBAO370o1bN/ZE44eoD8OnEWHYIMKKEI6vi3ZVQmjgnG7iMSZdtYfklp1DxOq0YUZ+haBf64Kj8Whgr4yUJTFZJjJBuXMM9A4BuITv0mKCX5H3KZsVMfaDh+vBhIufjGNr3jOv9dQyKUW23zsXI8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=ALApDXEh; arc=none smtp.client-ip=209.85.128.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="ALApDXEh" Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-4361815b96cso13693745e9.1 for ; Fri, 10 Jan 2025 02:25:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1736504753; x=1737109553; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=szKwztPhzV6CVF/0X9HGbGEX7Uh9TD9UOgptum5XTx8=; b=ALApDXEh3OlM4oxg+GozuS2phdcQ0sXXmBzbwaPlqscwWTwjvmn55PmUU0daQ0Lfut +Hp88trRBbiUWN5bqwhQKGh4kLX2kDS7/ERJrzWVMqCqDmvpZm25lMwYYktOciIxqkVn Mkw8jsLGyfPn1wzMfzkzKdjuwDnxfnZBwMBttVzJL8Ql1MCfNI3szOR/jsQgYUm2666g QcNVX+agtfLl2OKKNXXZb30VslQiw2b0B4iroCL5FF+CCJ18WWajNeSFG557dVcM/xbf VZ5klflBOYlgfElCbzhkMbZH2s7i5nuiXe0kko4OTxkVQzRtj4HGj8jfHCkC0R+EH1Gy wOfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736504753; x=1737109553; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=szKwztPhzV6CVF/0X9HGbGEX7Uh9TD9UOgptum5XTx8=; b=ZDEdLo2jFw3LHxtBQI84Z9VFazhQeysC6VO8wAPdHKQEPySRNatr16EJPxjjcWx3bu ygRciPmrZRbBcQ1TIld4Nc1CUV78TlLuFU2YoqDSmRvJy8+AZ7uUBhJ1ctZKe6A3mnAY HyHbWNmqfZys2PH3t67PMGuw9FWNEbj3qthm/E4ZTBeptQZ/2YiN8heyNNUbomJeglmd M4t9QYvf+Ca4Ac5Nd3CP+uH/EenZ167ZYmIVPz+Euz+s4b4mokfgO5QAKZCkVF5BFc1D 59n1bKhEoewlhu19m0b1oIlbHm5hgWCwwyCCOajS1RkUWLc6uhyCsNcaUJQNhgpTuvtz tyEg== X-Forwarded-Encrypted: i=1; AJvYcCX7NcCTbAESgOF+OkV6ut8EDwy1IT2e3d012fQj/rm16EiuU1oxbByy5AH7/CktRXL2Rm8dZrdJFXE=@vger.kernel.org X-Gm-Message-State: AOJu0Yxk8xMTvSI71VwKlIJJrFldKrjlkZHtUt3yh2LDegGb80wJY4pU PqRuV85uBobs6KaNQ57KTpAJ4I67Nv/D+y9/tYoYvi6k9fUX9jkuyXGynwcr7Ka6rK2X7itHNH5 t X-Gm-Gg: ASbGncvkaZvkNWiB3z9QBRrhfTKNE98WlskJ3tZ2mF6PXZr1O9pXIziFIutN1Y2o9ih p5WqW9zwtprvFIJt5pTT72P8Em2YQ1REo/fRGDwgDT+9UXjO/3pbdeZyyhf6Iv0hxwlRDvNbGZ9 fK13gkx+Mj//DRkKIbhN5jOGfJvPwvSUOUfDezruAiCANcNZVKEU6RizoDuhxgCt5mPWnnYLZfs Yk8NAYJFqyH9NJ2Bgl74X45nOX2h/9AzOd6fLIa09uE+RF8CX3KQTwYK+U= X-Google-Smtp-Source: AGHT+IGNS4AxOhKeAKUJUDRT1G2Jf4e2tT1rbepjOnwCwFe20rGAGSm7JFfzQTBHtaUnVgT5XIJj1g== X-Received: by 2002:a05:6000:2ce:b0:385:ee59:44f1 with SMTP id ffacd0b85a97d-38a872dec2amr8572781f8f.20.1736504753515; Fri, 10 Jan 2025 02:25:53 -0800 (PST) Received: from [127.0.1.1] ([87.13.70.66]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a8e37d085sm4246430f8f.13.2025.01.10.02.25.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jan 2025 02:25:52 -0800 (PST) From: Angelo Dureghello X-Google-Original-From: Angelo Dureghello Date: Fri, 10 Jan 2025 11:24:17 +0100 Subject: [PATCH v3 5/9] iio: dac: ad3552r-hs: fix message on wrong chip id Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250110-wip-bl-ad3552r-axi-v0-iio-testing-carlos-v3-5-ab42aef0d840@baylibre.com> References: <20250110-wip-bl-ad3552r-axi-v0-iio-testing-carlos-v3-0-ab42aef0d840@baylibre.com> In-Reply-To: <20250110-wip-bl-ad3552r-axi-v0-iio-testing-carlos-v3-0-ab42aef0d840@baylibre.com> To: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , David Lechner , Nuno Sa Cc: Jonathan Cameron , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Angelo Dureghello X-Mailer: b4 0.14.1 From: Angelo Dureghello Set a better info message on wrong chip id, fixing the expected value as read from the info struct. Signed-off-by: Angelo Dureghello --- drivers/iio/dac/ad3552r-hs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/iio/dac/ad3552r-hs.c b/drivers/iio/dac/ad3552r-hs.c index 8974df625670..27949f207d42 100644 --- a/drivers/iio/dac/ad3552r-hs.c +++ b/drivers/iio/dac/ad3552r-hs.c @@ -326,8 +326,9 @@ static int ad3552r_hs_setup(struct ad3552r_hs_state *st) id |= val << 8; if (id != st->model_data->chip_id) - dev_info(st->dev, "Chip ID error. Expected 0x%x, Read 0x%x\n", - AD3552R_ID, id); + dev_info(st->dev, + "Chip ID mismatch, detected 0x%x but expected 0x%x\n", + id, st->model_data->chip_id); /* Clear reset error flag, see ad3552r manual, rev B table 38. */ ret = st->data->bus_reg_write(st->back, AD3552R_REG_ADDR_ERR_STATUS, From patchwork Fri Jan 10 10:24:18 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Angelo Dureghello X-Patchwork-Id: 13934208 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6D83A20CCD3 for ; Fri, 10 Jan 2025 10:25:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736504760; cv=none; b=qI3CzEpygNx669YXgFBqBYSN2shdJQpgawW4ypAQZxDFES3BY1TVWvSYMMuv/NoYNjDQfDAfL3lEYC2dn+Ky5L8+/e291kHbT81L5zq9qzQPI0ivD8Ud39MtevO0wsO0JrYC2LkVGTNpTzOCVlWgdL3i9nZBVbyYQCaIQ0TxYkA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736504760; c=relaxed/simple; bh=DnAjjx0PkSOieNJ5OJb2nk2Cce0Mvn+naUnXYCUW1PM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=W9AHrnG9oiw7cI1DcVj1Fqwto4ufcMSDC4iT5i7apmWtqtwD3L2gwfw480i5e4j0+HmIWgqpxd3CZo+xGREMF1moL7GYJnniel/u4hnoS5xqSDHHgMpUapPLmlKygdULrXf/+G39bfjPmKUolsSU02cxRynCcx1wuQYtUi7qzeM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=S1fOCyZM; arc=none smtp.client-ip=209.85.128.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="S1fOCyZM" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-43618283d48so14110995e9.1 for ; Fri, 10 Jan 2025 02:25:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1736504756; x=1737109556; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=qABqYAhj0TrQzJxH7XVarpnbO7+OveXqYM2s3icznC4=; b=S1fOCyZMWePF7zwDB3hI05dTQpXzZ879uIuCyKopxdOgJf9AtSS5tp6PQeE2T6qC4U VSAehJqWQl5sE67izvqP0ZC2sXfvLLEue+712HCVf9ScLhzFQO+Zjwn+YiZjMCUDaRr2 ufwmcy5463w1QaVXWdWj43kYje1NXmlDO1xX8ZPW/4pqpalatXGUNx+EfqR92SKHJiun hzYGHXrYrmpIr6z8r5xQifTyJt+SxQpIN1LVVwVXLXuc8MAVmae37zN51cbAAh/faM3d kkCFV+I221aBz8vPP2zUcpTjAbk8bL2PDV8kaNGNWOfRm8HC/vEQajGlVoFl4DvPuApU Yw8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736504756; x=1737109556; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qABqYAhj0TrQzJxH7XVarpnbO7+OveXqYM2s3icznC4=; b=m5tq3hzjbHYQ0p3C/YVkqB/NtZr1jloLQrXL+1e2Fvi/QX03wJwIZxue4CRg8Y3N0x EhHacCPiWI0MA+h4x5y4cgFWC2nAlojWepdqRAAHzNnH7J6iILJBXYm4MtWz5dJl9pA9 vj1djKlOcdduN2s1s9gmSJjzoCe2PvUV+BKQ/YbtqPVnd9puSGqjwVDKbnyX0c97/zo9 X5CwNrRn+5H3NssltWgNNPKYJ6qlfwkRCiamQaqmjMFx8EEph6TctUVv7tlcETmmKr4L yeYeXIXL8zmM4e0IRV4SZMmBlExMMTcMRF3FKRONkO6e2YqZkNqnhlrZghoroJeizbh9 nKmg== X-Forwarded-Encrypted: i=1; AJvYcCUBMnDj94hviDl2WmNnGuE0kC0KOsxFErU0TWlvqKIUnqgs/HLKP9/TgoScFpm6mZ5aOD0WyQKqCN0=@vger.kernel.org X-Gm-Message-State: AOJu0YzK3UHOT/9cGR+waaCHrlsxrmWTuQOAgh9JSVIGSLJ9tz9JlABg EkaIQzWEv9RKqXHZ17va7rOpRyumCKz3zaAs3tu5BilCsmyhyPyFq6PVrFGkQzc= X-Gm-Gg: ASbGncu8Q5uGyU9aaLUfi6rAfWLlaSkIvZHT2/2G6idRHYDdpIAm6Cmiadq6yyT+bdi gxnRIeK2bTF4N8VrvOtgJYUpqZKpE1k5NpDW8OFRDAb4DV1+IHpYmvCoP7CWtP6vxoQ2nFwSCCI Sw01hf1Kuq7py9FHla7HipmqCiy2HXhTpExc5lIa7xJE4ubZI0/YAgiFfSXaOB1T3A4vHFRIyr/ 7rQAOKcGAv93CkC9e0PMrhlcKDaw9QOfmpCHNg+p5XWS85HuBO3c6xZCbk= X-Google-Smtp-Source: AGHT+IHVTtg/VQnGvUCRt2oKOr92lb02jK+IARgNZEIOjrxyoLmMhc1xHBMyeYvuSdonJxgo9+CMhA== X-Received: by 2002:a05:6000:401e:b0:38a:4184:151c with SMTP id ffacd0b85a97d-38a8730ad01mr9040183f8f.27.1736504754872; Fri, 10 Jan 2025 02:25:54 -0800 (PST) Received: from [127.0.1.1] ([87.13.70.66]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a8e37d085sm4246430f8f.13.2025.01.10.02.25.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jan 2025 02:25:54 -0800 (PST) From: Angelo Dureghello X-Google-Original-From: Angelo Dureghello Date: Fri, 10 Jan 2025 11:24:18 +0100 Subject: [PATCH v3 6/9] iio: dac: ad3552r-hs: use instruction mode for configuration Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250110-wip-bl-ad3552r-axi-v0-iio-testing-carlos-v3-6-ab42aef0d840@baylibre.com> References: <20250110-wip-bl-ad3552r-axi-v0-iio-testing-carlos-v3-0-ab42aef0d840@baylibre.com> In-Reply-To: <20250110-wip-bl-ad3552r-axi-v0-iio-testing-carlos-v3-0-ab42aef0d840@baylibre.com> To: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , David Lechner , Nuno Sa Cc: Jonathan Cameron , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Angelo Dureghello X-Mailer: b4 0.14.1 From: Angelo Dureghello Use "instruction" mode over initial configuration and all other non-streaming operations. DAC boots in streaming mode as default, and the driver is not changing this mode. Instruction r/w is still working becouse instruction is processed from the DAC after chip select is deasserted, this works until loop mode is 0 or greater than the instruction size. All initial operations should be more safely done in instruction mode, a mode provided for this. Signed-off-by: Angelo Dureghello --- drivers/iio/dac/ad3552r-hs.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/iio/dac/ad3552r-hs.c b/drivers/iio/dac/ad3552r-hs.c index 27949f207d42..991b11702273 100644 --- a/drivers/iio/dac/ad3552r-hs.c +++ b/drivers/iio/dac/ad3552r-hs.c @@ -132,6 +132,13 @@ static int ad3552r_hs_buffer_postenable(struct iio_dev *indio_dev) return -EINVAL; } + /* Primary region access, set streaming mode (now in SPI + SDR). */ + ret = ad3552r_qspi_update_reg_bits(st, + AD3552R_REG_ADDR_INTERFACE_CONFIG_B, + AD3552R_MASK_SINGLE_INST, 0, 1); + if (ret) + return ret; + ret = st->data->bus_reg_write(st->back, AD3552R_REG_ADDR_STREAM_MODE, loop_len, 1); if (ret) @@ -198,6 +205,14 @@ static int ad3552r_hs_buffer_predisable(struct iio_dev *indio_dev) if (ret) return ret; + /* Back to single instruction mode, disabling loop. */ + ret = ad3552r_qspi_update_reg_bits(st, + AD3552R_REG_ADDR_INTERFACE_CONFIG_B, + AD3552R_MASK_SINGLE_INST, + AD3552R_MASK_SINGLE_INST, 1); + if (ret) + return ret; + return 0; } @@ -308,6 +323,13 @@ static int ad3552r_hs_setup(struct ad3552r_hs_state *st) if (ret) return ret; + ret = st->data->bus_reg_write(st->back, + AD3552R_REG_ADDR_INTERFACE_CONFIG_B, + AD3552R_MASK_SINGLE_INST | + AD3552R_MASK_SHORT_INSTRUCTION, 1); + if (ret) + return ret; + ret = ad3552r_hs_scratch_pad_test(st); if (ret) return ret; From patchwork Fri Jan 10 10:24:19 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Angelo Dureghello X-Patchwork-Id: 13934207 Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E5B1020CCDC for ; Fri, 10 Jan 2025 10:25:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736504760; cv=none; b=dRqUIplqy+Ro4DaSsekjtdx7Jmw1NJIb0yYkz0ZTkY+NFC/q3Y1wMx6fP45tgvQyKirsFlOaaxiNvFb8g6+wWyzatidq0nXd/1ZQF2/ONDFqSvNFogPLzGHzwXow4zwnlS1U1B5X0ddKh8uAqS1TBv3Q20nW47ueKBn7na3stFk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736504760; c=relaxed/simple; bh=qbjBbaaMORZ2C/r7D6kKFFoTby+h9J4MotML4lNxyIA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=XSNp/scjdVVK+0r9a+22vsPKiLrGfPQvLmmj1Lmv4vp6uQMDvG3RsBzFzF4fScpR06foe3uRqcsOrpISjKJ7pxhQL/HDf6zFOBzmxBl0mrY3+/R9KtmJZC4QXpxRpjWo9uW4zpD8XDQWl8KsxqCnxF32meT5uIlAYTB+kjWCNfA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=w/gORKiK; arc=none smtp.client-ip=209.85.221.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="w/gORKiK" Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-385dece873cso988032f8f.0 for ; Fri, 10 Jan 2025 02:25:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1736504756; x=1737109556; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=8Kx2U6q9HoFXfGBhWuMH4r6aDSJAYrYoiytjBds/B5M=; b=w/gORKiKcmqjTdn8eMNtXcfMcVfcoZBFQtlKOQWQ2ZP0s7VT6nN1sX/fsDDY8ZTmKY cNxEOJH1/FIvi1hll9vdBflgkMyfNYfLB8x6fpVQp7Vu3UCREh4G+bKTcv7zOUTU1fP/ w5mQX6CtVmWohtpD5OqNfKFXV/7Jl5+oq7HdKgv0f83KfMHlNsmAfVl27eLv0EXdKq9b c1XwzLfDQM5HU8LTqfU0QhpWOE27aMlTAyh21x5kWgKLXIDPhZtkfSvcTr/p9cnEcEuz q3UWQw4rut9dZHpOcCbZwpMi0DWd4Z/glCKwVy1D4+DlH44bNn7Hitq3BOy8ddplomP9 y9cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736504756; x=1737109556; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8Kx2U6q9HoFXfGBhWuMH4r6aDSJAYrYoiytjBds/B5M=; b=Vm3OFjBXoxoaiDzloHmvh7p9u5v3qGQi4gmIBstgy/0bibsZoILhjehFaIyIAgSEig I5H807329HsuAWpK2iQgYMROcETXaWrrCnxYKNnWkgpEXl5V/ciWBAGP0SDJwiMxhcZB V3h6h8ZgEcw4GWAHYlmoHikGZFBDr7CXI3COcqEoEt5AvlTgEYfNk45aGrJmZxDl8J1y hwrJ5hGLt41KufMODeT5wu12AXqOYcHZzpWODo96kQSaMwyZxCuRvj4LmdsLFMyfAl90 Dz3F7A2hBHPt5MsMHrxzmbeXfHcTR3u1Y7/OY48pkc+1Js67zudiAe3eC05IeAgvISwr ewFg== X-Forwarded-Encrypted: i=1; AJvYcCX6LsGNF77w2apOpc1iS6gax/TXvP7N0+N3l8Di3Q4J+zgHs5IF/jv7TnhakgXt+7l2uRRW/QN8IYE=@vger.kernel.org X-Gm-Message-State: AOJu0Yys+NRWXEoobzYRh8ZsdPrwo/QCZ2NJHyd+bl2hgChzOYYibTI+ drnQifXjbc4QvQmLQEehzjAlYM7REAWtOsBj4pircIDWBFSJcJxCdb42lZM+G4Q= X-Gm-Gg: ASbGncv7r3I1UKZQrqk8Q22LDaVfw1VqGJ09+l3y2QElcSc2TFJnDEu/mHG7oGb7bYY JIEMe5ZJecWlGS6+Yq0Qucyh/IcOIKjAJkt1qaT8nMXl8mSmXUmPoA0bNccdI4wGKaiDwtGKp5s kWfyXmEMWXq5/3NrXRlkLQSsFMH0DjmtewaFkFZvzJYsfqlsYE2l9E9nRrwWPrz+4Z5dKKrVk8q uG6KNlzWTClp7PPSQM+PpoJprZuRdUAnrURUAxul7yl+wr3E098iogqIlA= X-Google-Smtp-Source: AGHT+IG82hMo5QGB6iKUOWfQPS4RQCDDjewm0fKX2KX/ecqqguePtF0145e0Hk0+9rBXeMiMBSaS0Q== X-Received: by 2002:a05:6000:4022:b0:386:459e:655d with SMTP id ffacd0b85a97d-38a87306d7bmr8351298f8f.20.1736504756228; Fri, 10 Jan 2025 02:25:56 -0800 (PST) Received: from [127.0.1.1] ([87.13.70.66]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a8e37d085sm4246430f8f.13.2025.01.10.02.25.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jan 2025 02:25:55 -0800 (PST) From: Angelo Dureghello X-Google-Original-From: Angelo Dureghello Date: Fri, 10 Jan 2025 11:24:19 +0100 Subject: [PATCH v3 7/9] iio: dac: ad3552r: share model data structures Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250110-wip-bl-ad3552r-axi-v0-iio-testing-carlos-v3-7-ab42aef0d840@baylibre.com> References: <20250110-wip-bl-ad3552r-axi-v0-iio-testing-carlos-v3-0-ab42aef0d840@baylibre.com> In-Reply-To: <20250110-wip-bl-ad3552r-axi-v0-iio-testing-carlos-v3-0-ab42aef0d840@baylibre.com> To: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , David Lechner , Nuno Sa Cc: Jonathan Cameron , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Angelo Dureghello X-Mailer: b4 0.14.1 From: Angelo Dureghello Preparing for new parts to be added also in the hs driver, set model data structures in ad3552r-common.c, to be accessible from both -hs and non hs driver. Signed-off-by: Angelo Dureghello Reviewed-by: David Lechner --- drivers/iio/dac/ad3552r-common.c | 46 ++++++++++++++++++++++++++++++++++++---- drivers/iio/dac/ad3552r-hs.c | 8 ------- drivers/iio/dac/ad3552r.c | 36 ------------------------------- drivers/iio/dac/ad3552r.h | 6 ++++-- 4 files changed, 46 insertions(+), 50 deletions(-) diff --git a/drivers/iio/dac/ad3552r-common.c b/drivers/iio/dac/ad3552r-common.c index 03e0864f5084..ded90bf57baf 100644 --- a/drivers/iio/dac/ad3552r-common.c +++ b/drivers/iio/dac/ad3552r-common.c @@ -11,23 +11,21 @@ #include "ad3552r.h" -const s32 ad3552r_ch_ranges[AD3552R_MAX_RANGES][2] = { +static const s32 ad3552r_ch_ranges[AD3552R_MAX_RANGES][2] = { [AD3552R_CH_OUTPUT_RANGE_0__2P5V] = { 0, 2500 }, [AD3552R_CH_OUTPUT_RANGE_0__5V] = { 0, 5000 }, [AD3552R_CH_OUTPUT_RANGE_0__10V] = { 0, 10000 }, [AD3552R_CH_OUTPUT_RANGE_NEG_5__5V] = { -5000, 5000 }, [AD3552R_CH_OUTPUT_RANGE_NEG_10__10V] = { -10000, 10000 } }; -EXPORT_SYMBOL_NS_GPL(ad3552r_ch_ranges, "IIO_AD3552R"); -const s32 ad3542r_ch_ranges[AD3542R_MAX_RANGES][2] = { +static const s32 ad3542r_ch_ranges[AD3542R_MAX_RANGES][2] = { [AD3542R_CH_OUTPUT_RANGE_0__2P5V] = { 0, 2500 }, [AD3542R_CH_OUTPUT_RANGE_0__5V] = { 0, 5000 }, [AD3542R_CH_OUTPUT_RANGE_0__10V] = { 0, 10000 }, [AD3542R_CH_OUTPUT_RANGE_NEG_5__5V] = { -5000, 5000 }, [AD3542R_CH_OUTPUT_RANGE_NEG_2P5__7P5V] = { -2500, 7500 } }; -EXPORT_SYMBOL_NS_GPL(ad3542r_ch_ranges, "IIO_AD3552R"); /* Gain * AD3552R_GAIN_SCALE */ static const s32 gains_scaling_table[] = { @@ -37,6 +35,46 @@ static const s32 gains_scaling_table[] = { [AD3552R_CH_GAIN_SCALING_0_125] = 125 }; +const struct ad3552r_model_data ad3541r_model_data = { + .model_name = "ad3541r", + .chip_id = AD3541R_ID, + .num_hw_channels = 1, + .ranges_table = ad3542r_ch_ranges, + .num_ranges = ARRAY_SIZE(ad3542r_ch_ranges), + .requires_output_range = true, +}; +EXPORT_SYMBOL_NS_GPL(ad3541r_model_data, "IIO_AD3552R"); + +const struct ad3552r_model_data ad3542r_model_data = { + .model_name = "ad3542r", + .chip_id = AD3542R_ID, + .num_hw_channels = 2, + .ranges_table = ad3542r_ch_ranges, + .num_ranges = ARRAY_SIZE(ad3542r_ch_ranges), + .requires_output_range = true, +}; +EXPORT_SYMBOL_NS_GPL(ad3542r_model_data, "IIO_AD3552R"); + +const struct ad3552r_model_data ad3551r_model_data = { + .model_name = "ad3551r", + .chip_id = AD3551R_ID, + .num_hw_channels = 1, + .ranges_table = ad3552r_ch_ranges, + .num_ranges = ARRAY_SIZE(ad3552r_ch_ranges), + .requires_output_range = false, +}; +EXPORT_SYMBOL_NS_GPL(ad3551r_model_data, "IIO_AD3552R"); + +const struct ad3552r_model_data ad3552r_model_data = { + .model_name = "ad3552r", + .chip_id = AD3552R_ID, + .num_hw_channels = 2, + .ranges_table = ad3552r_ch_ranges, + .num_ranges = ARRAY_SIZE(ad3552r_ch_ranges), + .requires_output_range = false, +}; +EXPORT_SYMBOL_NS_GPL(ad3552r_model_data, "IIO_AD3552R"); + u16 ad3552r_calc_custom_gain(u8 p, u8 n, s16 goffs) { return FIELD_PREP(AD3552R_MASK_CH_RANGE_OVERRIDE, 1) | diff --git a/drivers/iio/dac/ad3552r-hs.c b/drivers/iio/dac/ad3552r-hs.c index 991b11702273..bfb6228c9b9b 100644 --- a/drivers/iio/dac/ad3552r-hs.c +++ b/drivers/iio/dac/ad3552r-hs.c @@ -527,14 +527,6 @@ static int ad3552r_hs_probe(struct platform_device *pdev) return devm_iio_device_register(&pdev->dev, indio_dev); } -static const struct ad3552r_model_data ad3552r_model_data = { - .model_name = "ad3552r", - .chip_id = AD3552R_ID, - .num_hw_channels = 2, - .ranges_table = ad3552r_ch_ranges, - .num_ranges = ARRAY_SIZE(ad3552r_ch_ranges), -}; - static const struct of_device_id ad3552r_hs_of_id[] = { { .compatible = "adi,ad3552r", .data = &ad3552r_model_data }, { } diff --git a/drivers/iio/dac/ad3552r.c b/drivers/iio/dac/ad3552r.c index e7206af53af6..9d28e06b80c0 100644 --- a/drivers/iio/dac/ad3552r.c +++ b/drivers/iio/dac/ad3552r.c @@ -649,42 +649,6 @@ static int ad3552r_probe(struct spi_device *spi) return devm_iio_device_register(&spi->dev, indio_dev); } -static const struct ad3552r_model_data ad3541r_model_data = { - .model_name = "ad3541r", - .chip_id = AD3541R_ID, - .num_hw_channels = 1, - .ranges_table = ad3542r_ch_ranges, - .num_ranges = ARRAY_SIZE(ad3542r_ch_ranges), - .requires_output_range = true, -}; - -static const struct ad3552r_model_data ad3542r_model_data = { - .model_name = "ad3542r", - .chip_id = AD3542R_ID, - .num_hw_channels = 2, - .ranges_table = ad3542r_ch_ranges, - .num_ranges = ARRAY_SIZE(ad3542r_ch_ranges), - .requires_output_range = true, -}; - -static const struct ad3552r_model_data ad3551r_model_data = { - .model_name = "ad3551r", - .chip_id = AD3551R_ID, - .num_hw_channels = 1, - .ranges_table = ad3552r_ch_ranges, - .num_ranges = ARRAY_SIZE(ad3552r_ch_ranges), - .requires_output_range = false, -}; - -static const struct ad3552r_model_data ad3552r_model_data = { - .model_name = "ad3552r", - .chip_id = AD3552R_ID, - .num_hw_channels = 2, - .ranges_table = ad3552r_ch_ranges, - .num_ranges = ARRAY_SIZE(ad3552r_ch_ranges), - .requires_output_range = false, -}; - static const struct spi_device_id ad3552r_id[] = { { .name = "ad3541r", diff --git a/drivers/iio/dac/ad3552r.h b/drivers/iio/dac/ad3552r.h index 4b5581039ae9..3dc8d1d9c0f9 100644 --- a/drivers/iio/dac/ad3552r.h +++ b/drivers/iio/dac/ad3552r.h @@ -134,8 +134,10 @@ #define AD3542R_MAX_RANGES 5 #define AD3552R_QUAD_SPI 2 -extern const s32 ad3552r_ch_ranges[AD3552R_MAX_RANGES][2]; -extern const s32 ad3542r_ch_ranges[AD3542R_MAX_RANGES][2]; +extern const struct ad3552r_model_data ad3541r_model_data; +extern const struct ad3552r_model_data ad3542r_model_data; +extern const struct ad3552r_model_data ad3551r_model_data; +extern const struct ad3552r_model_data ad3552r_model_data; enum ad3552r_id { AD3541R_ID = 0x400b, From patchwork Fri Jan 10 10:24:20 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Angelo Dureghello X-Patchwork-Id: 13934209 Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 66A2D20CCF8 for ; Fri, 10 Jan 2025 10:25:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736504761; cv=none; b=u1LaRVfS2vyJx5P7s+/Em8sL0Qq8H/+FjeMRNOLBAaovsn6hA/ZUIRxlhM8Wr+ta/O8CWl8JI6Kvu1wydXZDc56tywSoi8NpGjj2N4h06O41DFQVDrbeGg6B02jrw5k/ZHs1R5mNE0e5d/HF9eAAAQ0kGFSLOc7rRWG8/jmunrA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736504761; c=relaxed/simple; bh=eLmsRz2kU/VsBTLT7cWoZsFdHlw9EcfCKFfQ7MuoN+8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=sxAixvXnYU3F5TlL9zCZ4mbgrnqyQLDwsjdrXTXZ+Mv5njz3X4gtobkx0SSjjqnmbHSWUIG/Kv5uB1ZKYpb4tDRvpYyApKT3tnsD7LNLXYWMasZUyVEv39biR3a33LVqY9CV05CmrZSHx5TF5qaLvImAhTJjlylHtwiNd8EB3Tg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=dZyjTiU4; arc=none smtp.client-ip=209.85.221.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="dZyjTiU4" Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-3862f32a33eso859494f8f.3 for ; Fri, 10 Jan 2025 02:25:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1736504758; x=1737109558; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=9csxIoZsnXnkQ0kjyXCuv17Gc+ddK30W2l+lJEIpIR8=; b=dZyjTiU4aSwBraDinzbgQw1mkYpDMMS30dJm3IjlR/e6OZJpWrxG0NoqcVLtciTS18 dgA1iogKfbYxmdh3I9k9Y8dwZzjKAon0VSq9XBCoSNMNsWODVTKoQp4bP8gd6u7Xp0rt xmj+xTNvOzfk8AsQS4kD4gX2Y4VyV7n7FoJCcPMU0DA9yXPKjHtQ3EmQygjkwATE1S6m iM2GB05JMwQ+yCiw2jqu//jnzat8ilJNjUSeW8ZjaSGXdyj6k6NpN55OYJEkI6zh9rcL 49DQU8maEKhkc4+ngnvL3OiOcwQkkECbgyLM9zaHM6o/9CVHdNqFaf3DesXoeRdJKuuc 7c/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736504758; x=1737109558; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9csxIoZsnXnkQ0kjyXCuv17Gc+ddK30W2l+lJEIpIR8=; b=rPKcBnG87zuWQTIANgJPBgWk0YvBC/NlAutKyeQjJ+L93LhXiRHAjREuSEyVvxVSOB y+Izuy+CtAJk/1PtewWZAWWbJvZg2ARYCLNjKNTFnm1NJK7LE+ZUFVoPjb/dGOu3/vuy cFOl43cSZxg8kwRQHrF9/Tsc3NGCer90SvSS+/DrYMKu7iVUaJzkEpXuL5Y8BGFtY/k3 YNfCVYMMobxS941hl0dvZ2VpuJzvxoaLV+Ye55bfsqrD/m65eifA+DxWo/JyPr6gUtg/ Pgq4jihTHZ0/oiXqnsSinp9rqSE2vsidCyp/iigrjNIWj1197qOa854opiqxuWUDyZYJ qWRQ== X-Forwarded-Encrypted: i=1; AJvYcCUEesWuwYlfvUSXIPRuiQA585SdhYP7sB/wlUHTh2aniHsBrU5CkpwqsCsHozXa3ILtgEAONROBR3g=@vger.kernel.org X-Gm-Message-State: AOJu0YzXH/N2QViso/Y7Rll4X9UFb4Ae4KFPPoMQ87lB4ZH/ARvTajVc V71u8ptyiMkdjuGhtzEYtn+HeM2PM+arTxxZVQY6jbSMTs6GnV86hUELZOdhRio= X-Gm-Gg: ASbGncs+bX08rio4AMXrijW4ds0QWX7Xazq8AOMo+uQHOuoOGVm/zM2z826ay7a4peU 3Uizs0OeXcTcgLlA8mjO6PGyC4+vJBmgLURWxS/cVsiiqKKYJXBKiIUZhqCA2rHOiOYQA3alvXH VlzWALt1JycxHXdOOuu7n2rty+kRg9w+oSkHEfmqXVQnXFdThkfcnLE8FxYyb9DICp3hPpvY6kC waPbs0yLXbn0hyoHXzV75gp6O4RNc9SXSx8gHLNVuQyy0N6uzFwOaZRQR8= X-Google-Smtp-Source: AGHT+IG3fecs8hj3Sm7/qV9LSBCo9KPWT3dpQPzpENKp6Hw42lpcZG9kE3jbZ4hxYhurp6vUcQ6Oxw== X-Received: by 2002:a05:6000:4607:b0:386:380d:2cac with SMTP id ffacd0b85a97d-38a8730a7bdmr8198024f8f.26.1736504757608; Fri, 10 Jan 2025 02:25:57 -0800 (PST) Received: from [127.0.1.1] ([87.13.70.66]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a8e37d085sm4246430f8f.13.2025.01.10.02.25.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jan 2025 02:25:57 -0800 (PST) From: Angelo Dureghello X-Google-Original-From: Angelo Dureghello Date: Fri, 10 Jan 2025 11:24:20 +0100 Subject: [PATCH v3 8/9] iio: dac: ad3552r-hs: add ad3541/2r support Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250110-wip-bl-ad3552r-axi-v0-iio-testing-carlos-v3-8-ab42aef0d840@baylibre.com> References: <20250110-wip-bl-ad3552r-axi-v0-iio-testing-carlos-v3-0-ab42aef0d840@baylibre.com> In-Reply-To: <20250110-wip-bl-ad3552r-axi-v0-iio-testing-carlos-v3-0-ab42aef0d840@baylibre.com> To: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , David Lechner , Nuno Sa Cc: Jonathan Cameron , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Angelo Dureghello X-Mailer: b4 0.14.1 From: Angelo Dureghello A new FPGA HDL has been developed from ADI to support ad354xr devices. Add support for ad3541r and ad3542r with following additions: - use common device_info structures for hs and non hs drivers, - DMA buffering, use DSPI mode for ad354xr and QSPI for ad355xr, - change sample rate to respect number of lanes. Signed-off-by: Angelo Dureghello --- drivers/iio/dac/ad3552r-common.c | 4 + drivers/iio/dac/ad3552r-hs.c | 225 ++++++++++++++++++++++++++++++++------- drivers/iio/dac/ad3552r.h | 3 + 3 files changed, 195 insertions(+), 37 deletions(-) diff --git a/drivers/iio/dac/ad3552r-common.c b/drivers/iio/dac/ad3552r-common.c index ded90bf57baf..b8807e54fa05 100644 --- a/drivers/iio/dac/ad3552r-common.c +++ b/drivers/iio/dac/ad3552r-common.c @@ -42,6 +42,7 @@ const struct ad3552r_model_data ad3541r_model_data = { .ranges_table = ad3542r_ch_ranges, .num_ranges = ARRAY_SIZE(ad3542r_ch_ranges), .requires_output_range = true, + .num_spi_data_lanes = 2, }; EXPORT_SYMBOL_NS_GPL(ad3541r_model_data, "IIO_AD3552R"); @@ -52,6 +53,7 @@ const struct ad3552r_model_data ad3542r_model_data = { .ranges_table = ad3542r_ch_ranges, .num_ranges = ARRAY_SIZE(ad3542r_ch_ranges), .requires_output_range = true, + .num_spi_data_lanes = 2, }; EXPORT_SYMBOL_NS_GPL(ad3542r_model_data, "IIO_AD3552R"); @@ -62,6 +64,7 @@ const struct ad3552r_model_data ad3551r_model_data = { .ranges_table = ad3552r_ch_ranges, .num_ranges = ARRAY_SIZE(ad3552r_ch_ranges), .requires_output_range = false, + .num_spi_data_lanes = 4, }; EXPORT_SYMBOL_NS_GPL(ad3551r_model_data, "IIO_AD3552R"); @@ -72,6 +75,7 @@ const struct ad3552r_model_data ad3552r_model_data = { .ranges_table = ad3552r_ch_ranges, .num_ranges = ARRAY_SIZE(ad3552r_ch_ranges), .requires_output_range = false, + .num_spi_data_lanes = 4, }; EXPORT_SYMBOL_NS_GPL(ad3552r_model_data, "IIO_AD3552R"); diff --git a/drivers/iio/dac/ad3552r-hs.c b/drivers/iio/dac/ad3552r-hs.c index bfb6228c9b9b..4600a9e84dfc 100644 --- a/drivers/iio/dac/ad3552r-hs.c +++ b/drivers/iio/dac/ad3552r-hs.c @@ -19,6 +19,31 @@ #include "ad3552r.h" #include "ad3552r-hs.h" +/* + * Important notes for register map access: + * ======================================== + * + * Register address space is divided in 2 regions, primary (config) and + * secondary (DAC). Primary region can only be accessed in simple SPI mode, + * with exception for ad355x models where setting QSPI pin high allows QSPI + * access to both the regions. + * + * Due to the fact that ad3541/2r do not implement QSPI, for proper device + * detection, HDL keeps "QSPI" pin level low at boot (see ad3552r manual, rev B + * table 7, pin 31, digital input). For this reason, actually the working mode + * between SPI, DSPI and QSPI must be set via software, configuring the target + * DAC appropriately, together with the backend API to configure the bus mode + * accordingly. + * + * Also, important to note that none of the three modes allow to read in DDR. + * + * In non-buffering operations, mode is set to simple SPI SDR for all primary + * and secondary region r/w accesses, to avoid to switch the mode each time DAC + * register is accessed (raw accesses, r/w), and to be able to dump registers + * content (possible as non DDR only). + * In buffering mode, driver sets best possible mode, D/QSPI and DDR. + */ + struct ad3552r_hs_state { const struct ad3552r_model_data *model_data; struct gpio_desc *reset_gpio; @@ -27,6 +52,8 @@ struct ad3552r_hs_state { bool single_channel; struct ad3552r_ch_data ch_data[AD3552R_MAX_CH]; struct ad3552r_hs_platform_data *data; + /* INTERFACE_CONFIG_D register cache, in DDR we cannot read values. */ + u32 config_d; }; static int ad3552r_qspi_update_reg_bits(struct ad3552r_hs_state *st, @@ -56,15 +83,19 @@ static int ad3552r_hs_read_raw(struct iio_dev *indio_dev, switch (mask) { case IIO_CHAN_INFO_SAMP_FREQ: /* - * Using 4 lanes (QSPI), then using 2 as DDR mode is - * considered always on (considering buffering mode always). + * Using a "num_spi_data_lanes" variable since ad3541/2 have + * only DSPI interface, while ad355x is QSPI. Then using 2 as + * DDR mode is considered always on (considering buffering + * mode always). */ *val = DIV_ROUND_CLOSEST(st->data->bus_sample_data_clock_hz * - 4 * 2, chan->scan_type.realbits); + st->model_data->num_spi_data_lanes * 2, + chan->scan_type.realbits); return IIO_VAL_INT; case IIO_CHAN_INFO_RAW: + /* For RAW accesses, stay always in simple-spi. */ ret = st->data->bus_reg_read(st->back, AD3552R_REG_ADDR_CH_DAC_16B(chan->channel), val, 2); @@ -93,6 +124,7 @@ static int ad3552r_hs_write_raw(struct iio_dev *indio_dev, switch (mask) { case IIO_CHAN_INFO_RAW: + /* For RAW accesses, stay always in simple-spi. */ iio_device_claim_direct_scoped(return -EBUSY, indio_dev) { return st->data->bus_reg_write(st->back, AD3552R_REG_ADDR_CH_DAC_16B(chan->channel), @@ -104,6 +136,42 @@ static int ad3552r_hs_write_raw(struct iio_dev *indio_dev, } } +static int ad3552r_hs_set_bus_io_mode_hs(struct ad3552r_hs_state *st) +{ + int bus_mode; + + if (st->model_data->num_spi_data_lanes == 4) + bus_mode = AD3552R_IO_MODE_QSPI; + else + bus_mode = AD3552R_IO_MODE_DSPI; + + return st->data->bus_set_io_mode(st->back, bus_mode); +} + +static int ad3552r_hs_set_target_io_mode_hs(struct ad3552r_hs_state *st) +{ + int mode_target; + + /* + * Best access for secondary reg area, QSPI where possible, + * else as DSPI. + */ + if (st->model_data->num_spi_data_lanes == 4) + mode_target = AD3552R_QUAD_SPI; + else + mode_target = AD3552R_DUAL_SPI; + + /* + * Better to not use update here, since generally it is already + * set as DDR mode, and it's not possible to read in DDR mode. + */ + return st->data->bus_reg_write(st->back, + AD3552R_REG_ADDR_TRANSFER_REGISTER, + FIELD_PREP(AD3552R_MASK_MULTI_IO_MODE, + mode_target) | + AD3552R_MASK_STREAM_LENGTH_KEEP_VALUE, 1); +} + static int ad3552r_hs_buffer_postenable(struct iio_dev *indio_dev) { struct ad3552r_hs_state *st = iio_priv(indio_dev); @@ -132,6 +200,11 @@ static int ad3552r_hs_buffer_postenable(struct iio_dev *indio_dev) return -EINVAL; } + /* + * With ad3541/2r support, QSPI pin is held low at reset from HDL, + * streaming start sequence must respect strictly the order below. + */ + /* Primary region access, set streaming mode (now in SPI + SDR). */ ret = ad3552r_qspi_update_reg_bits(st, AD3552R_REG_ADDR_INTERFACE_CONFIG_B, @@ -139,48 +212,106 @@ static int ad3552r_hs_buffer_postenable(struct iio_dev *indio_dev) if (ret) return ret; - ret = st->data->bus_reg_write(st->back, AD3552R_REG_ADDR_STREAM_MODE, + /* + * Set target loop len, 0x2c 0r 0x2a, descending loop, and keeping loop + * len value so it's not cleared hereafter when enabling streaming mode + * (cleared by CS_ up). + */ + ret = ad3552r_qspi_update_reg_bits(st, + AD3552R_REG_ADDR_TRANSFER_REGISTER, + AD3552R_MASK_STREAM_LENGTH_KEEP_VALUE, + AD3552R_MASK_STREAM_LENGTH_KEEP_VALUE, 1); + if (ret) + goto exit_err_streaming; + + ret = st->data->bus_reg_write(st->back, + AD3552R_REG_ADDR_STREAM_MODE, loop_len, 1); if (ret) - return ret; + goto exit_err_streaming; - /* Inform DAC chip to switch into DDR mode */ - ret = ad3552r_qspi_update_reg_bits(st, - AD3552R_REG_ADDR_INTERFACE_CONFIG_D, - AD3552R_MASK_SPI_CONFIG_DDR, - AD3552R_MASK_SPI_CONFIG_DDR, 1); + /* Setting DDR now, caching current config_d. */ + ret = st->data->bus_reg_read(st->back, + AD3552R_REG_ADDR_INTERFACE_CONFIG_D, + &st->config_d, 1); if (ret) - return ret; + goto exit_err_streaming; + + st->config_d |= AD3552R_MASK_SPI_CONFIG_DDR; + ret = st->data->bus_reg_write(st->back, + AD3552R_REG_ADDR_INTERFACE_CONFIG_D, + st->config_d, 1); + if (ret) + goto exit_err_streaming; - /* Inform DAC IP to go for DDR mode from now on */ ret = iio_backend_ddr_enable(st->back); - if (ret) { - dev_err(st->dev, "could not set DDR mode, not streaming"); - goto exit_err; - } + if (ret) + goto exit_err_ddr_mode_target; + + /* + * From here onward mode is DDR, so reading any register is not possible + * anymore, including calling "ad3552r_qspi_update_reg_bits" function. + */ + + /* Set target to best high speed mode (D or QSPI). */ + ret = ad3552r_hs_set_target_io_mode_hs(st); + if (ret) + goto exit_err_ddr_mode; + + /* Set bus to best high speed mode (D or QSPI). */ + ret = ad3552r_hs_set_bus_io_mode_hs(st); + if (ret) + goto exit_err_bus_mode_target; + /* + * Backend setup must be done now only, or related register values will + * be disrupted by previous bus accesses. + */ ret = iio_backend_data_transfer_addr(st->back, val); if (ret) - goto exit_err; + goto exit_err_bus_mode_target; ret = iio_backend_data_format_set(st->back, 0, &fmt); if (ret) - goto exit_err; + goto exit_err_bus_mode_target; ret = iio_backend_data_stream_enable(st->back); if (ret) - goto exit_err; + goto exit_err_bus_mode_target; return 0; -exit_err: - ad3552r_qspi_update_reg_bits(st, - AD3552R_REG_ADDR_INTERFACE_CONFIG_D, - AD3552R_MASK_SPI_CONFIG_DDR, - 0, 1); +exit_err_bus_mode_target: + /* Back to simple SPI, not using update to avoid read. */ + st->data->bus_reg_write(st->back, AD3552R_REG_ADDR_TRANSFER_REGISTER, + FIELD_PREP(AD3552R_MASK_MULTI_IO_MODE, + AD3552R_SPI) | + AD3552R_MASK_STREAM_LENGTH_KEEP_VALUE, 1); + + /* + * Back bus to simple SPI, this must be executed together with above + * target mode unwind, and can be done only after it. + */ + st->data->bus_set_io_mode(st->back, AD3552R_IO_MODE_SPI); +exit_err_ddr_mode: iio_backend_ddr_disable(st->back); +exit_err_ddr_mode_target: + /* + * Back to SDR. In DDR we cannot read, whatever the mode is, so not + * using update. + */ + st->data->bus_reg_write(st->back, AD3552R_REG_ADDR_INTERFACE_CONFIG_D, + FIELD_PREP(AD3552R_MASK_SDO_DRIVE_STRENGTH, 1), + 1); + +exit_err_streaming: + /* Back to single instruction mode, disabling loop. */ + st->data->bus_reg_write(st->back, AD3552R_REG_ADDR_INTERFACE_CONFIG_B, + AD3552R_MASK_SINGLE_INST | + AD3552R_MASK_SHORT_INSTRUCTION, 1); + return ret; } @@ -193,11 +324,22 @@ static int ad3552r_hs_buffer_predisable(struct iio_dev *indio_dev) if (ret) return ret; - /* Inform DAC to set in SDR mode */ - ret = ad3552r_qspi_update_reg_bits(st, - AD3552R_REG_ADDR_INTERFACE_CONFIG_D, - AD3552R_MASK_SPI_CONFIG_DDR, - 0, 1); + /* + * Set us to simple SPI, even if still in ddr, so to be able to write + * in primary region. + */ + ret = st->data->bus_set_io_mode(st->back, AD3552R_IO_MODE_SPI); + if (ret) + return ret; + + /* + * Back to SDR (in DDR we cannot read, whatever the mode is, so not + * using update). + */ + st->config_d &= ~AD3552R_MASK_SPI_CONFIG_DDR; + ret = st->data->bus_reg_write(st->back, + AD3552R_REG_ADDR_INTERFACE_CONFIG_D, + st->config_d, 1); if (ret) return ret; @@ -205,6 +347,17 @@ static int ad3552r_hs_buffer_predisable(struct iio_dev *indio_dev) if (ret) return ret; + /* + * Back to simple SPI for secondary region too now, so to be able to + * dump/read registers there too if needed. + */ + ret = ad3552r_qspi_update_reg_bits(st, + AD3552R_REG_ADDR_TRANSFER_REGISTER, + AD3552R_MASK_MULTI_IO_MODE, + AD3552R_SPI, 1); + if (ret) + return ret; + /* Back to single instruction mode, disabling loop. */ ret = ad3552r_qspi_update_reg_bits(st, AD3552R_REG_ADDR_INTERFACE_CONFIG_B, @@ -319,6 +472,7 @@ static int ad3552r_hs_setup(struct ad3552r_hs_state *st) if (ret) return ret; + /* HDL starts with DDR enabled, disabling it. */ ret = iio_backend_ddr_disable(st->back); if (ret) return ret; @@ -352,6 +506,8 @@ static int ad3552r_hs_setup(struct ad3552r_hs_state *st) "Chip ID mismatch, detected 0x%x but expected 0x%x\n", id, st->model_data->chip_id); + dev_dbg(st->dev, "chip id %s detected", st->model_data->model_name); + /* Clear reset error flag, see ad3552r manual, rev B table 38. */ ret = st->data->bus_reg_write(st->back, AD3552R_REG_ADDR_ERR_STATUS, AD3552R_MASK_RESET_STATUS, 1); @@ -364,14 +520,6 @@ static int ad3552r_hs_setup(struct ad3552r_hs_state *st) if (ret) return ret; - ret = st->data->bus_reg_write(st->back, - AD3552R_REG_ADDR_TRANSFER_REGISTER, - FIELD_PREP(AD3552R_MASK_MULTI_IO_MODE, - AD3552R_QUAD_SPI) | - AD3552R_MASK_STREAM_LENGTH_KEEP_VALUE, 1); - if (ret) - return ret; - ret = iio_backend_data_source_set(st->back, 0, IIO_BACKEND_EXTERNAL); if (ret) return ret; @@ -528,6 +676,9 @@ static int ad3552r_hs_probe(struct platform_device *pdev) } static const struct of_device_id ad3552r_hs_of_id[] = { + { .compatible = "adi,ad3541r", .data = &ad3541r_model_data }, + { .compatible = "adi,ad3542r", .data = &ad3542r_model_data }, + { .compatible = "adi,ad3551r", .data = &ad3551r_model_data }, { .compatible = "adi,ad3552r", .data = &ad3552r_model_data }, { } }; diff --git a/drivers/iio/dac/ad3552r.h b/drivers/iio/dac/ad3552r.h index 3dc8d1d9c0f9..768fa264d39e 100644 --- a/drivers/iio/dac/ad3552r.h +++ b/drivers/iio/dac/ad3552r.h @@ -132,6 +132,8 @@ #define AD3552R_MAX_RANGES 5 #define AD3542R_MAX_RANGES 5 +#define AD3552R_SPI 0 +#define AD3552R_DUAL_SPI 1 #define AD3552R_QUAD_SPI 2 extern const struct ad3552r_model_data ad3541r_model_data; @@ -153,6 +155,7 @@ struct ad3552r_model_data { const s32 (*ranges_table)[2]; int num_ranges; bool requires_output_range; + int num_spi_data_lanes; }; struct ad3552r_ch_data { From patchwork Fri Jan 10 10:24:21 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Angelo Dureghello X-Patchwork-Id: 13934210 Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6E68E20ADD6 for ; Fri, 10 Jan 2025 10:26:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736504762; cv=none; b=ULrH9/7jr6M4i/AB5clv0oedja7nJXTzoapu6a429ehsyysSDHwZsnD4VgdijObSsBt1tPwPm5DZ3rBU22xg51fXL5h3u4z8hd5VqBhWLdd+PTkXWBuUA7JvAmspHZF9JXjV7olviZn+Qja0scKGa+2hktHVwDdTTYQrUxR6TUo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736504762; c=relaxed/simple; bh=Cetkvl4PSgSp8r4LBcQ/oO5ROIb21xyaaDHdT7rDFbc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bMdwv/x2qEhnQEJfgz5KC62k43S5Mvyjrn/VrVtBdehARg6y0tXpr5EPm8raLwWw12Tn78muA2Z6KSeF5aCNIeGBEaSROD9Es/njMUdGBAhEQZ68OgXOGTbuRBX/SZCoF6kgx82G1UB6p1o0FdwqS7BSAEDC0C7AQJWqAcr9bLM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=qhXsHZaB; arc=none smtp.client-ip=209.85.221.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="qhXsHZaB" Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-388cae9eb9fso1012168f8f.3 for ; Fri, 10 Jan 2025 02:26:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1736504759; x=1737109559; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=uzJfdRltAIOkuP5dMKF44Xk1jV6rv0f5zBzA2zGr32Y=; b=qhXsHZaB2e/hNb6M+DeZNjEDJ/eZanhG0r+PHWF+KUwGmxH1UUsb85x7XzEdo7sSXc k2Xn1vrefHdQKUvctd2udWo+3NUGwVZfuLmUs67CIV1jC/V0onssngBvNEFzI0hfBqTx SjfNg34sTZnzhUDMMeF3mNGU0mB1NHNuzpAhvuN//URIKjA4UP0EpJS/UxIXyIwe5Bz8 CK2fTHvEWw4ErTvkBfeTo7nfyh+RLpvY4E1uQ59MHVJpSCc+YtNcBpO5jTlCg6AiccTp L0zvZT2u2B1wCWgEvwKhb/Y+jQfyczzgM0cto2JjIWTuYw5Q+dZ5MwsBeRAHSfFB0dTO bR2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736504759; x=1737109559; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uzJfdRltAIOkuP5dMKF44Xk1jV6rv0f5zBzA2zGr32Y=; b=erokiN/R+5ftm+B73R9Cjfow0iECDKtahqXAkZsA8IqPnQjCmed8hjU2AVIeQSOLIf KijV9MPcIFf1KK/dc2HoE0GrqhDdRId2dPZB9osjm2JvrF+9eDslEkwIw/dP/BRK++fb 8czRy/w1S4uJbWj3o6R6dBfSdxRcmrIJwU1STury6vjN4bfieUFvlm7MeZNBS1keUvUS xsOnDYSaa2yFZmqbhgeqNiRZMCdUszeIm3FVeJIglb+yvGWTmDVI0PAld6Zg0chpjffL UM5MzUotRf7OZBIIhng2k5cbw0lWnr9Y7Sfl8bzbmapbyWqzlcYQZDCG+0ex4Vbm1ryz Z3bQ== X-Forwarded-Encrypted: i=1; AJvYcCX3xLQ/40RRLSRGMG4HrSY0xA7Ej/hcTI2IEV8n+4rBoeBrZ01jj2mqh6PjJ1An5CPFVrDSwRvGJd8=@vger.kernel.org X-Gm-Message-State: AOJu0YwzKjNvhYqGpg4gGI1IfmNnQQuYRyieiduS+R84AgeFRqv6wEqN GsRinxZObGPwlzYBg1VtgvcW8IUDSRDhwl0Fi5GKdKYbXI3MT6UNimOJ4QJK01o= X-Gm-Gg: ASbGncsFDau+//KyVs3mhOmu4bIkCa+rgJuMsKBJmnNE1EjZR8uzbMsFKwG7jFjZHeF jhVznE+yeDz1StshycvN2zRI5W4C9yEeXtw0WeIXBVXgvYNuvohRdPm8fBJJkAk9CgS1uwxUMZ/ /vP2a3tsOAbZ66vALRw3rt3U2FqMp8bmjSNuEJi6ofze+bbUxtragsx9u6DDV0ADDUhkxmd3Jbn 5l7XuXnfsxBFcg0ACSDA5VigFTFLeivE6Lc2Z/dUqV5w9MuSqmaSXOazmg= X-Google-Smtp-Source: AGHT+IE8AWi1rJIsWVBQxRjhyCoBqve14gftE1xdxrCjFpQzufHJpWFgUOLqlAFdwMxWeSN3m8Twnw== X-Received: by 2002:a05:6000:4102:b0:38a:8b4c:886d with SMTP id ffacd0b85a97d-38a8b4c88b7mr4952227f8f.46.1736504758945; Fri, 10 Jan 2025 02:25:58 -0800 (PST) Received: from [127.0.1.1] ([87.13.70.66]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a8e37d085sm4246430f8f.13.2025.01.10.02.25.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jan 2025 02:25:58 -0800 (PST) From: Angelo Dureghello X-Google-Original-From: Angelo Dureghello Date: Fri, 10 Jan 2025 11:24:21 +0100 Subject: [PATCH v3 9/9] iio: dac: ad3552r-hs: update function name (non functional) Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250110-wip-bl-ad3552r-axi-v0-iio-testing-carlos-v3-9-ab42aef0d840@baylibre.com> References: <20250110-wip-bl-ad3552r-axi-v0-iio-testing-carlos-v3-0-ab42aef0d840@baylibre.com> In-Reply-To: <20250110-wip-bl-ad3552r-axi-v0-iio-testing-carlos-v3-0-ab42aef0d840@baylibre.com> To: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , David Lechner , Nuno Sa Cc: Jonathan Cameron , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Angelo Dureghello X-Mailer: b4 0.14.1 From: Angelo Dureghello Update ad3552r_qspi_update_reg_bits function name to a more generic name, since used mode can be SIMPLE/DUAL/QUAD SPI. Signed-off-by: Angelo Dureghello Reviewed-by: David Lechner --- drivers/iio/dac/ad3552r-hs.c | 64 ++++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 35 deletions(-) diff --git a/drivers/iio/dac/ad3552r-hs.c b/drivers/iio/dac/ad3552r-hs.c index 4600a9e84dfc..7f3a70cfbef8 100644 --- a/drivers/iio/dac/ad3552r-hs.c +++ b/drivers/iio/dac/ad3552r-hs.c @@ -56,9 +56,9 @@ struct ad3552r_hs_state { u32 config_d; }; -static int ad3552r_qspi_update_reg_bits(struct ad3552r_hs_state *st, - u32 reg, u32 mask, u32 val, - size_t xfer_size) +static int ad3552r_update_reg_bits(struct ad3552r_hs_state *st, + u32 reg, u32 mask, u32 val, + size_t xfer_size) { u32 rval; int ret; @@ -206,9 +206,8 @@ static int ad3552r_hs_buffer_postenable(struct iio_dev *indio_dev) */ /* Primary region access, set streaming mode (now in SPI + SDR). */ - ret = ad3552r_qspi_update_reg_bits(st, - AD3552R_REG_ADDR_INTERFACE_CONFIG_B, - AD3552R_MASK_SINGLE_INST, 0, 1); + ret = ad3552r_update_reg_bits(st, AD3552R_REG_ADDR_INTERFACE_CONFIG_B, + AD3552R_MASK_SINGLE_INST, 0, 1); if (ret) return ret; @@ -217,10 +216,9 @@ static int ad3552r_hs_buffer_postenable(struct iio_dev *indio_dev) * len value so it's not cleared hereafter when enabling streaming mode * (cleared by CS_ up). */ - ret = ad3552r_qspi_update_reg_bits(st, - AD3552R_REG_ADDR_TRANSFER_REGISTER, - AD3552R_MASK_STREAM_LENGTH_KEEP_VALUE, - AD3552R_MASK_STREAM_LENGTH_KEEP_VALUE, 1); + ret = ad3552r_update_reg_bits(st, AD3552R_REG_ADDR_TRANSFER_REGISTER, + AD3552R_MASK_STREAM_LENGTH_KEEP_VALUE, + AD3552R_MASK_STREAM_LENGTH_KEEP_VALUE, 1); if (ret) goto exit_err_streaming; @@ -250,7 +248,7 @@ static int ad3552r_hs_buffer_postenable(struct iio_dev *indio_dev) /* * From here onward mode is DDR, so reading any register is not possible - * anymore, including calling "ad3552r_qspi_update_reg_bits" function. + * anymore, including calling "ad3552r_update_reg_bits" function. */ /* Set target to best high speed mode (D or QSPI). */ @@ -351,18 +349,16 @@ static int ad3552r_hs_buffer_predisable(struct iio_dev *indio_dev) * Back to simple SPI for secondary region too now, so to be able to * dump/read registers there too if needed. */ - ret = ad3552r_qspi_update_reg_bits(st, - AD3552R_REG_ADDR_TRANSFER_REGISTER, - AD3552R_MASK_MULTI_IO_MODE, - AD3552R_SPI, 1); + ret = ad3552r_update_reg_bits(st, AD3552R_REG_ADDR_TRANSFER_REGISTER, + AD3552R_MASK_MULTI_IO_MODE, + AD3552R_SPI, 1); if (ret) return ret; /* Back to single instruction mode, disabling loop. */ - ret = ad3552r_qspi_update_reg_bits(st, - AD3552R_REG_ADDR_INTERFACE_CONFIG_B, - AD3552R_MASK_SINGLE_INST, - AD3552R_MASK_SINGLE_INST, 1); + ret = ad3552r_update_reg_bits(st, AD3552R_REG_ADDR_INTERFACE_CONFIG_B, + AD3552R_MASK_SINGLE_INST, + AD3552R_MASK_SINGLE_INST, 1); if (ret) return ret; @@ -379,10 +375,10 @@ static inline int ad3552r_hs_set_output_range(struct ad3552r_hs_state *st, else val = FIELD_PREP(AD3552R_MASK_CH1_RANGE, mode); - return ad3552r_qspi_update_reg_bits(st, - AD3552R_REG_ADDR_CH0_CH1_OUTPUT_RANGE, - AD3552R_MASK_CH_OUTPUT_RANGE_SEL(ch), - val, 1); + return ad3552r_update_reg_bits(st, + AD3552R_REG_ADDR_CH0_CH1_OUTPUT_RANGE, + AD3552R_MASK_CH_OUTPUT_RANGE_SEL(ch), + val, 1); } static int ad3552r_hs_reset(struct ad3552r_hs_state *st) @@ -398,10 +394,10 @@ static int ad3552r_hs_reset(struct ad3552r_hs_state *st) fsleep(10); gpiod_set_value_cansleep(st->reset_gpio, 0); } else { - ret = ad3552r_qspi_update_reg_bits(st, - AD3552R_REG_ADDR_INTERFACE_CONFIG_A, - AD3552R_MASK_SOFTWARE_RESET, - AD3552R_MASK_SOFTWARE_RESET, 1); + ret = ad3552r_update_reg_bits(st, + AD3552R_REG_ADDR_INTERFACE_CONFIG_A, + AD3552R_MASK_SOFTWARE_RESET, + AD3552R_MASK_SOFTWARE_RESET, 1); if (ret) return ret; } @@ -534,19 +530,17 @@ static int ad3552r_hs_setup(struct ad3552r_hs_state *st) val = ret; - ret = ad3552r_qspi_update_reg_bits(st, - AD3552R_REG_ADDR_SH_REFERENCE_CONFIG, - AD3552R_MASK_REFERENCE_VOLTAGE_SEL, - val, 1); + ret = ad3552r_update_reg_bits(st, AD3552R_REG_ADDR_SH_REFERENCE_CONFIG, + AD3552R_MASK_REFERENCE_VOLTAGE_SEL, + val, 1); if (ret) return ret; ret = ad3552r_get_drive_strength(st->dev, &val); if (!ret) { - ret = ad3552r_qspi_update_reg_bits(st, - AD3552R_REG_ADDR_INTERFACE_CONFIG_D, - AD3552R_MASK_SDO_DRIVE_STRENGTH, - val, 1); + ret = ad3552r_update_reg_bits(st, + AD3552R_REG_ADDR_INTERFACE_CONFIG_D, + AD3552R_MASK_SDO_DRIVE_STRENGTH, val, 1); if (ret) return ret; }