From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52])
	(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 5597637E5C5
	for <devicetree@vger.kernel.org>; Sat, 22 Aug 2026 08:59:02 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1787389143; cv=none; b=lzY/X1C9/w71ebq302GFpaxHCsRACddKHOLV5m/FQBycUkgIkG5NfQtSQ2SuZMQGzIdhS15nYFZJlhikvDtYJ+XE89HHBbE2KxCmu549+1M7yDdO89R7teC4aVNaVGlz83w9HSs3O9WMjKVo1CuEFuTAOhZWz7vNWlMiSKCFy4M=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1787389143; c=relaxed/simple;
	bh=W779wj4mHSsllfXyzqDdo2yZBI6PkocPY2PxiztL+mY=;
	h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=E4VyA0qJBesrc0umR4wT9qNmCHWcOv4gYV3MCG9G6Hsme5RTEesFid4LuRkaoohaFQbfmxE4PU87TYBQx1Stlc9QcxrpxerPiev3gwZQhymjzoefy1kqBjLTG8d6DxEhK2hPU3ModtGo1jBbiBaEA6YqgimiWpsuG6skMu3ZLw8=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Jh6EYLUo; arc=none smtp.client-ip=209.85.128.52
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Jh6EYLUo"
Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-499b2981a7bso2948155e9.3
        for <devicetree@vger.kernel.org>; Sat, 22 Aug 2026 01:59:02 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20251104; t=1787389140; x=1787993940; darn=vger.kernel.org;
        h=content-transfer-encoding:content-type:mime-version:message-id:date
         :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to
         :content-type;
        bh=WWg7QwAg3+JgYt2P6ZQJVJ6LXE55gmzN7FLka57N1Pc=;
        b=Jh6EYLUoMDF2kytgYdHpirVTRqJeGqSBek6bLlnNfYOaK8xbjAePcUOlcLlCEdrG/O
         4yl4ylKvk2Ns0Xs4tVDls7jwLl/QVmhCidN4jNWlJ+UngHgm9l8h9INR3HlihovVLr/j
         MbnSWxxIwUyZMJNPupsxKaPT6MNLxrQB7YsGSC2j77jwU/9wzab3kfOcnX9dWZmA4bd/
         MYR6O/Q7E8f2cf3OTLOqmQB/3guJrdBjPePrfUYVcJwSvD8Z3RBV/fBrJeFodBSnc0Q5
         vCizSINdaTmwVrQKrX0KCw0b6xKQEYG7kdNPVfg4EbBUJ6LWgkoRiEVGMBmdy3yhZEQJ
         FTuw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20251104; t=1787389140; x=1787993940;
        h=content-transfer-encoding:content-type:mime-version:message-id:date
         :subject:cc:to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject
         :date:message-id:reply-to:content-type;
        bh=WWg7QwAg3+JgYt2P6ZQJVJ6LXE55gmzN7FLka57N1Pc=;
        b=bhmf94ix5fjZEdnTZ9zDeizkBog83vUMLphis7w08Uc02daCG/lui3hEjofHmguy6g
         gZ3MNwNT9OhfyRAVXOeZ9fiXdP5CVRFX/QOxb/l4JCEUQpK2FPjWWY6SOyEnAGzmbRNe
         it0Bdz+vNB3SJvTS3017iokqt5wpAKHd8bdFvxH1bMUSzQrL86KEjuoAFG+4JzRmdLzy
         SjVPxNGm4fBOiv1nqY7f/0aTW86nBJU031Hxb+nBWRgIcwCRTvUlQCCvN9ZVpW9l/+Mn
         9VLOBHyAEaYnuuBcwrX+IwAmAZnUhyhcty7adt1rkmJzRs/ZSrAhNVIv61ivko+gPKyf
         PsQg==
X-Forwarded-Encrypted: i=1; AHgh+RqFbT89vdBRgJ3Uo6Nnqyz4llX84xl1puNFsOL6LYN6WK093AHDS05XUiLlvVIaMcwf/ing6F4g1EUj@vger.kernel.org
X-Gm-Message-State: AFuF++nQgbmirlorIDxzmK+aGgQ2Mqr72LPvyJB6d83FX3KKLDaiSDeB
	PeZOJdO61LYvUwQ5eeGnjOYXfpXlPvQo/78c4OQR1fOdhrpIDRGr5/pA
X-Gm-Gg: AR+sD12hhN1zHQAeod/RZ1JY8fxx9Senp8pYDdifjJ5+QJTTdhxzl5K6RgGRLYrupmE
	Q2EN5l/9/xZ2rKbl0aYZPzABDVaK6HGGHqQO0UnhEbBMo1iW8A4unvRRUmuKVG2Mlsoalx0GnCz
	FApL8NKbP6/Ict7ao3vPOLFAX+NX0kARb5CqUC4XKVBgR66i8+QSuNCE2FLjUOhVsqLteRdoqqF
	uwhDllORbbFUE8SHonSTXWnFfw5LIIW92qSr/yCyt4i43zYUKryVxx4ClnwQem/VxlIR6CJHxPY
	DWZ9Y+t8ZFPK3Lb9oH/A0xgL1a6zFCgZ7DR4OaObQwYz+wUqwfKAi40ZpIgCVgoHPtRUoRVb3zV
	oPeVyF/FVmNNmX704NYdkPhErK3ZfYaDmTcfbDwz9fsEXaJarDNI35eJ9c2opQ6XvxQKIB8Z2x1
	Wl6j9tG3pZmFiEd3Ab2yRy8H6ZXu5Lau/lIyB6BiEtQeIaom1sQf56ub2AOn+m0FVM5BfEQOPWI
	9Rz6J4aEsE=
X-Received: by 2002:a05:600c:46cb:b0:499:a277:e8b5 with SMTP id 5b1f17b1804b1-499b82d2865mr143740845e9.3.1787389140327;
        Sat, 22 Aug 2026 01:59:00 -0700 (PDT)
Received: from fedora ([105.74.72.30])
        by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-499c359b9fcsm13596635e9.9.2026.08.22.01.58.58
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Sat, 22 Aug 2026 01:58:59 -0700 (PDT)
From: Taha Ed-Dafili <0rayn.dev@gmail.com>
To: jic23@kernel.org,
	lars@metafoo.de
Cc: Michael.Hennerich@analog.com,
	robh@kernel.org,
	krzk+dt@kernel.org,
	conor+dt@kernel.org,
	dlechner@baylibre.com,
	nuno.sa@analog.com,
	andy@kernel.org,
	skhan@linuxfoundation.org,
	linux@analog.com,
	linux-iio@vger.kernel.org,
	devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Taha Ed-Dafili <0rayn.dev@gmail.com>
Subject: [PATCH v6 0/6] iio: dac: ad5504: bindings, cleanups, locking, and scale fixes
Date: Sat, 22 Aug 2026 04:56:47 -0400
Message-ID: <20260822085850.17527-1-0rayn.dev@gmail.com>
X-Mailer: git-send-email 2.55.0
Precedence: bulk
X-Mailing-List: devicetree@vger.kernel.org
List-Id: <devicetree.vger.kernel.org>
List-Subscribe: <mailto:devicetree+subscribe@vger.kernel.org>
List-Unsubscribe: <mailto:devicetree+unsubscribe@vger.kernel.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Jonathan Cameron applied patches 2 (sort headers alphabetically) and 4
(introduce local dev pointer) from v3 directly to iio/testing. This
series rebases on top of that state and does not re-send those
patches.

This v6 series addresses one remaining item from the v5 review by
Andy Shevchenko:

* In ad5504_write_dac_powerdown(), move guard(mutex) to after
  kstrtobool() since input parsing does not touch shared state and
  does not need to be under the lock (Andy)

Testing:
No functional change from v5. This only narrows the critical section
in one sysfs write path. Re-verified on ARM64 Raspberry Pi 5 (BCM2712):
powerdown sysfs read/write and powerdown mode switching (20kohm_to_gnd,
three_state) verified on all four channels without errors.

Previous versions:
v5: https://lore.kernel.org/linux-iio/20260821102255.36705-1-0rayn.dev@gmail.com/
v4: https://lore.kernel.org/linux-iio/20260817211118.21833-1-0rayn.dev@gmail.com/
v3: https://lore.kernel.org/linux-iio/20260509142047.30302-1-0rayn.dev@gmail.com/
v2: https://lore.kernel.org/linux-iio/20260310174835.24209-1-0rayn.dev@gmail.com/
v1: https://lore.kernel.org/linux-iio/20260212181955.42724-1-0rayn.dev@gmail.com/

Thank you to Jonathan Cameron, David Lechner, Andy Shevchenko, Nuno Sá,
Krzysztof Kozlowski, Conor Dooley, Uwe Kleine-König, and Joshua Crofts
for the continued reviews.

Taha Ed-Dafili (6):
  dt-bindings: iio: dac: ad5504: add output-range and missing gpios
  iio: dac: ad5504: Align headers with IWYU principle
  iio: dac: ad5504: separate ACPI and DT paths
  iio: dac: ad5504: remove legacy platform data support
  iio: dac: ad5504: introduce local lock to protect state and spi
    transfers
  iio: dac: ad5504: support scale via output-range-microvolt property

 .../bindings/iio/dac/adi,ad5504.yaml          | 39 ++++++++-
 drivers/iio/dac/ad5504.c                      | 82 +++++++++++++++----
 include/linux/iio/dac/ad5504.h                | 15 ----
 3 files changed, 103 insertions(+), 33 deletions(-)
 delete mode 100644 include/linux/iio/dac/ad5504.h

-- 
2.55.0


From mboxrd@z Thu Jan  1 00:00:00 1970
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 6A88837E5C5
	for <devicetree@vger.kernel.org>; Sat, 22 Aug 2026 08:59:04 +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=1787389146; cv=none; b=FJl5jhKmUlfTiUYfIiQgN3bNJHumvvIeJWOGSaXAW92OboYBphCH+wf5m4R22OTnDajh36GVBNHZmQUJ63s1B3ctlpmf0y9d306O5o7w3NIHkIxjN/s6nhT1OyrZl445cKMIVfKIURT22/a0qhUa7z4+Vl4L1OtCa8oR32KxK10=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1787389146; c=relaxed/simple;
	bh=9gxlDRHqhuwt8FJ/CwukjTyzdPv7n6MCBFsd7dAHKR8=;
	h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
	 MIME-Version; b=BVcqDNSvmNsOq2TR23jTMqzCLTCmRBnEhaF+cj5b0Y+rF6UWHRkkIScDdqpAsilq9kGIbjG5sT/LWXXkcaBBAq2JubOLuCVU5sSpB8Yqxyd0jPYDdfoWSmyms8H/Ou4eKPrJmYcL8jjVFkUun39WKZQzyHDdE5sf1a1imJdBZ0g=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=WtURsgPa; arc=none smtp.client-ip=209.85.128.49
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WtURsgPa"
Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-49954b88fffso14776215e9.0
        for <devicetree@vger.kernel.org>; Sat, 22 Aug 2026 01:59:04 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20251104; t=1787389143; x=1787993943; darn=vger.kernel.org;
        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:content-type;
        bh=Ht5SF4+wx6Jf8JH+OLs35dYBN3IVS35rx1u5RktbmkM=;
        b=WtURsgPaY7dhFpQaoptaa5Gesp/20CvJpu5EiY2YfqTjvY6RxSy6el1MtxFSZws2Jo
         ODXcnLClj5KTue1lU4jRD19KEBDeY7U7X5fGn42fihQXeYsupxEuCxEDXDLX2hw4/5Uw
         ypnUKFweZyvSj8NDHS2j7cJzyWaG5mDOlzGhDqaXpX4zDh4tHFSRdEOvhFdElL8WkgsH
         LBR7rlkywUBlSWEsUNrsJ4SycwatjxqQFkenrw47tVlrmOv2HYeXet43WPYx69a6qRWI
         Lc2oguj8OWu9s7fONVt2ezLR0rOu4ZM2h3MMGC9ZbL9X2xm5GH6CCyOa92V2oCU7Rjn9
         5UZg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20251104; t=1787389143; x=1787993943;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from
         :to:cc:subject:date:message-id:reply-to:content-type;
        bh=Ht5SF4+wx6Jf8JH+OLs35dYBN3IVS35rx1u5RktbmkM=;
        b=Cd+Vh+Va8L43ScpgolKyJvQ29I/CDCoFUdLcRyN63qdcFdmBRJli7n4eEV+IMenjia
         /uv7M1kYBsfg+Hfa2EdQS4cb0L0OSw4/N8Tpg9dcfwEGzH163K6pWJcC9NoqLUa9eHbN
         1XEJWhuVLdkCdH3wfwtLb9f59bl3icRTLWMBoZnA8y3Ach5LhCMCWWF/02W8n7cxAi/T
         SvHNDchbEF8RUX3xCE5GGLM18ToOEOyiH7MKPCEZc6WOXyyfmYM8W3MHRtNqalYdL00H
         5QWyDsqM0sxBoBKTajAUAFObZ7tLktsL+LAnSwE/IsuavMQ76SMDyiHsPPrgQO1hSvcF
         oDpw==
X-Forwarded-Encrypted: i=1; AHgh+RqF/IqvZcFV1mwEBb9m1HnsHHXoVeKI5g2WZGwbZnsJufcXGN+pPQYJ8xlvu2KzVHa6rDqUFPBuxyPT@vger.kernel.org
X-Gm-Message-State: AFuF++nQhQnNs3WXTawzvtH8sEPVyw8iISpaKzMneI59XBYATlfwX6y7
	/Br5HG9O9pt+QqngV1THosbocQrmHeErSE/4pCHfQRlREmNeaB2ddD2F
X-Gm-Gg: AR+sD11NRBb33plNt0pRVlwhFQymu1aTceE0nRjr09ItO7neZTvo0QvBwxCGaQ/4mWM
	sIbzDSgU/46GypPZAYTXVOyWw511+hMppW7QX9YRADWHeIEdSibSJ4XCQjXNJyJazJKh4zfGFDI
	wXY8Syc3SCJrYnGKY/9zx97e38vf46c/0P6It0YHLDnepjUfUT7+40n65mg0dhTPpLUDIlKL4E8
	BIoC2LmkxER+slsM0ef9K5KhD5Fdcm43aznrJ6bsAtwI+RdZfqM/m5ZkCMc9zzV9+eB6Eh9so4I
	E6Af33kLwwlYzLGu4AAko7L9FCV9LEu43PgG9cWxsA1mRabM7/tfQVg4/UXJ18N0KLdCwDZ1LOe
	20YRBknHPI8Y4C6Zd/77BBk3koZrJ54Mk7kfwUZp5H4Us2je00y5yT31TVrIlHZVvZKWLfGkCA2
	HoZOSIGbZyS7GBuoy9hAug5n4lmBCGoudDshmBUScsr7eC0gHQZnhWJ0YQXp8nVIFMsQ4k80cuy
	xggGrkPwgE=
X-Received: by 2002:a05:600c:3111:b0:495:7888:281c with SMTP id 5b1f17b1804b1-499c1772dd5mr39257375e9.0.1787389142531;
        Sat, 22 Aug 2026 01:59:02 -0700 (PDT)
Received: from fedora ([105.74.72.30])
        by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-499c359b9fcsm13596635e9.9.2026.08.22.01.59.00
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Sat, 22 Aug 2026 01:59:02 -0700 (PDT)
From: Taha Ed-Dafili <0rayn.dev@gmail.com>
To: jic23@kernel.org,
	lars@metafoo.de
Cc: Michael.Hennerich@analog.com,
	robh@kernel.org,
	krzk+dt@kernel.org,
	conor+dt@kernel.org,
	dlechner@baylibre.com,
	nuno.sa@analog.com,
	andy@kernel.org,
	skhan@linuxfoundation.org,
	linux@analog.com,
	linux-iio@vger.kernel.org,
	devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Taha Ed-Dafili <0rayn.dev@gmail.com>,
	Conor Dooley <conor.dooley@microchip.com>
Subject: [PATCH v6 1/6] dt-bindings: iio: dac: ad5504: add output-range and missing gpios
Date: Sat, 22 Aug 2026 04:56:48 -0400
Message-ID: <20260822085850.17527-2-0rayn.dev@gmail.com>
X-Mailer: git-send-email 2.55.0
In-Reply-To: <20260822085850.17527-1-0rayn.dev@gmail.com>
References: <20260822085850.17527-1-0rayn.dev@gmail.com>
Precedence: bulk
X-Mailing-List: devicetree@vger.kernel.org
List-Id: <devicetree.vger.kernel.org>
List-Subscribe: <mailto:devicetree+subscribe@vger.kernel.org>
List-Unsubscribe: <mailto:devicetree+unsubscribe@vger.kernel.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

The AD5504 output range (0-30V or 0-60V) is determined by the R_SEL pin.

Use standard output-range-microvolt and range-sel-gpios properties to
describe the hardware configuration of the R_SEL pin. Ensure mutual
exclusivity using the not/required logic. Additionally, add missing
vlogic-supply, clr-gpios, ldac-gpios and datasheet links, and provide
a complete usage example.

Signed-off-by: Taha Ed-Dafili <0rayn.dev@gmail.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
---
 .../bindings/iio/dac/adi,ad5504.yaml          | 39 ++++++++++++++++++-
 1 file changed, 38 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/iio/dac/adi,ad5504.yaml b/Documentation/devicetree/bindings/iio/dac/adi,ad5504.yaml
index 9c2c038683b4..e0123dceaa33 100644
--- a/Documentation/devicetree/bindings/iio/dac/adi,ad5504.yaml
+++ b/Documentation/devicetree/bindings/iio/dac/adi,ad5504.yaml
@@ -10,8 +10,10 @@ maintainers:
   - Lars-Peter Clausen <lars@metafoo.de>
   - Jonathan Cameron <jic23@kernel.org>
 
-description:
+description: |
   High voltage (up to 60V) DACs with temperature sensor alarm function
+  https://www.analog.com/media/en/technical-documentation/data-sheets/ad5504.pdf
+  https://www.analog.com/media/en/technical-documentation/data-sheets/ad5501.pdf
 
 properties:
   compatible:
@@ -27,6 +29,29 @@ properties:
     maxItems: 1
 
   vcc-supply: true
+  vlogic-supply: true
+
+  output-range-microvolt:
+    description: |
+      Specify the channel output full scale range. The R_SEL pin
+      determines if the range is 0-30V or 0-60V.
+    items:
+      - const: 0
+      - enum: [30000000, 60000000]
+    default: [0, 60000000]
+
+  range-sel-gpios:
+    description:
+      GPIO connected to the R_SEL pin to select the output voltage range.
+    maxItems: 1
+
+  clr-gpios:
+    description: GPIO that controls the /CLR pin (active low).
+    maxItems: 1
+
+  ldac-gpios:
+    description: GPIO that controls the /LDAC pin (active low).
+    maxItems: 1
 
 additionalProperties: false
 
@@ -34,9 +59,17 @@ required:
   - compatible
   - reg
 
+allOf:
+  - not:
+      required:
+        - range-sel-gpios
+        - output-range-microvolt
+
 examples:
   - |
     #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/gpio/gpio.h>
+
     spi {
         #address-cells = <1>;
         #size-cells = <0>;
@@ -45,6 +78,10 @@ examples:
             compatible = "adi,ad5504";
             vcc-supply = <&dac_vcc>;
             interrupts = <55 IRQ_TYPE_EDGE_FALLING>;
+
+            output-range-microvolt = <0 60000000>;
+            clr-gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
+            ldac-gpios = <&gpio 5 GPIO_ACTIVE_LOW>;
         };
     };
 ...
-- 
2.55.0


From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47])
	(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 5C46D374E73
	for <devicetree@vger.kernel.org>; Sat, 22 Aug 2026 08:59:09 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1787389150; cv=none; b=ekmLfn+ey9Fr1OZ5ZwaHdX4aX4jnWzZnZ8nyaiyhkhrBd+u8J4jc4L6LKGi2H0V23vct7/6nFdBv4AgIyPoo9C6MUOOl/m508vphyBxuwzmQESltdpXGMkeAcDxIfJdyyzPGYav5odXIpuP7zR0ad8EnBUMDVPpemii6vzQrF6c=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1787389150; c=relaxed/simple;
	bh=qh4p6NiaYYKZWRo5SdC+29bJh1njzkmd5IdAQaiKg10=;
	h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
	 MIME-Version; b=PYrM1kBSITJO+N0MSY2HhJm+xNy8AyPuX2IwJEV9+CPYgiHy8uG/IX8hi3o0sx2fn5vuxm6JmxCKw+6wPl3oAxQsGbJe5wJCZUz6cG9VIhhVTUA6dr9L86vr9xLdqV43Xy8+jMuQxnxtBxrfsuwcXdO1PvWrJg0U/QnO2smc2/E=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=TcVXS5Ig; arc=none smtp.client-ip=209.85.128.47
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TcVXS5Ig"
Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-49557167508so1998865e9.1
        for <devicetree@vger.kernel.org>; Sat, 22 Aug 2026 01:59:09 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20251104; t=1787389147; x=1787993947; darn=vger.kernel.org;
        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:content-type;
        bh=XsQREIODkCao/QDK0V814PCMzSICvR9cgatjnm3y9Ns=;
        b=TcVXS5Ig7krocPfP/9ao4ZyODVURPMyq6mDn0ZuHJdZ1Eoat34MD0jlK341uOkA9j4
         HDi9fuGMlZPXG4xNXrBOD9bXLfJ8LsAVM3OpOZ7JFIKWSkNPlbHKr4cjzdN+QmhNXVWD
         F5znCQZXZ798dW19vshgt9Hyf0gBSfGYB7VWGvjSza+7wdCKlOsRY4izrsK4fAifEEp1
         yjR5MIP6LdRNKcRAMcOwL8DRLn2uSliN4T7OCw3cSoJWtJZdjdAJlfajclsFdlFqqxuj
         CCawAFI2JFFSwmjoYis/FUT7vT1oBDvM3hBZC0AnE8Tws1vUp0C9VF9eeOp9BF7zdz9k
         ZObw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20251104; t=1787389147; x=1787993947;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from
         :to:cc:subject:date:message-id:reply-to:content-type;
        bh=XsQREIODkCao/QDK0V814PCMzSICvR9cgatjnm3y9Ns=;
        b=qfJvdcLCkGp+1Bi4rvV9hZrc2mEUzsq70GwgjZv/cRb14tml0EN1pUTO7qS7CB+KVf
         n/HEKjZMPU5vD4Ff0rJ6hkObE3rzixdVvt8HKmif3X5u4XrPcw4smrVkbThqW4cQYw/B
         LiXhYtCyrpk9wnvu8z6Dqqg0Jc+ZKwYDs09zPeZj+GhCGqy65qigtDWE4K/BTL3FdYNs
         kVlKhCDWEjrg1HZp+Np5d4rtoaNmuh09MFI6Lsbo9SHegoLh5ax8DZtA5xk2BYRJXgIv
         LZVCNWbCuynilbbnFSFVzDLNjHE9F9IymNqmDKBJAK4fRep68bHAMIfbmUPfmoXGWOoT
         opcg==
X-Forwarded-Encrypted: i=1; AHgh+Rpzo2nUcFrb/ApbsS17MOlMZtcyJzoP6bLB1VdkH7ZHNBD4C9oZAJtclJ1Wa0Xw2Sf/VZIk0f+reDvq@vger.kernel.org
X-Gm-Message-State: AFuF++kcnGkpmLZNc9iOQxBmE9qVSHT0a3RlnPVb+f7plumDZOeYmDTS
	gYQDFOLIxHMxq/CsLfwxj7JdNNrkrJiNLiT2bvTe1dlepyXUvqSSAhrT
X-Gm-Gg: AR+sD10yhhKn8k+dSK3fLwMbuxEVbtIcxi4eLUopJoDKdOcAmqJDx/CDy+VgX9rn1pX
	q2LuztmtHbvpss3zqQDvNwo8WURFDj9MCWcf8P01MsxLZ89Acg2NBeMsH/WTCRF63hzXNqwAZa6
	XmTeyp5VQZYWcYvU02onXfTdyM++XB+VuW6cDuvShXRBZvJN7a65NWdd5lpdz4f7/v9IpiqZYLQ
	EMv9pXBhgHKwLrPrTXs2/gmxLBmuJRxNZ7WxMp1nSZmoknTCu5snz23Kr1Sm0wPrfk30Pl5GfB2
	vhdQRZ20QMEuMMNw1ZtYP8wW7kpbAdH1VyT+7NTZJYGacjJeXhcQxVNAYq1nyVsQ+3Xbmm1Ga/P
	/g4jY2zw9fH6TAxTQYHfB8ldEXF8GYOBK9Wd6Fdb/tV9uAI7bh+rql/tyQp0dZ3LWB5sma1hjpU
	xrQJp4hj9vZge+t8xSE/Wpf1pVdkCA2An5+qUZxdq5TpGdWnm0aYgB7EXEF4k7Y/WXXSlHz6wjt
	p/VNzOzmLs=
X-Received: by 2002:a05:600c:b86:b0:499:8156:cd3f with SMTP id 5b1f17b1804b1-499b8301913mr118647255e9.8.1787389147451;
        Sat, 22 Aug 2026 01:59:07 -0700 (PDT)
Received: from fedora ([105.74.72.30])
        by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-499c359b9fcsm13596635e9.9.2026.08.22.01.59.05
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Sat, 22 Aug 2026 01:59:06 -0700 (PDT)
From: Taha Ed-Dafili <0rayn.dev@gmail.com>
To: jic23@kernel.org,
	lars@metafoo.de
Cc: Michael.Hennerich@analog.com,
	robh@kernel.org,
	krzk+dt@kernel.org,
	conor+dt@kernel.org,
	dlechner@baylibre.com,
	nuno.sa@analog.com,
	andy@kernel.org,
	skhan@linuxfoundation.org,
	linux@analog.com,
	linux-iio@vger.kernel.org,
	devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Taha Ed-Dafili <0rayn.dev@gmail.com>
Subject: [PATCH v6 3/6] iio: dac: ad5504: separate ACPI and DT paths
Date: Sat, 22 Aug 2026 04:56:50 -0400
Message-ID: <20260822085850.17527-4-0rayn.dev@gmail.com>
X-Mailer: git-send-email 2.55.0
In-Reply-To: <20260822085850.17527-1-0rayn.dev@gmail.com>
References: <20260822085850.17527-1-0rayn.dev@gmail.com>
Precedence: bulk
X-Mailing-List: devicetree@vger.kernel.org
List-Id: <devicetree.vger.kernel.org>
List-Subscribe: <mailto:devicetree+subscribe@vger.kernel.org>
List-Unsubscribe: <mailto:devicetree+unsubscribe@vger.kernel.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

The driver relied on a fragile -ENODEV check from the regulator
framework to bypass voltage configuration on ACPI platforms, sharing
the same fallback path as legacy pdata.

Fork probe on is_acpi_device_node() to explicitly handle each path.
On ACPI, skip the regulator and use a fixed 60V default via
AD5504_VREF_ACPI_DEFAULT_mV. The pdata fallback remains for non-ACPI
systems in this commit; it is removed in the next.

Signed-off-by: Taha Ed-Dafili <0rayn.dev@gmail.com>
---
 drivers/iio/dac/ad5504.c | 29 ++++++++++++++++++++---------
 1 file changed, 20 insertions(+), 9 deletions(-)

diff --git a/drivers/iio/dac/ad5504.c b/drivers/iio/dac/ad5504.c
index 5c9c66b04154..6f70c57c7a82 100644
--- a/drivers/iio/dac/ad5504.c
+++ b/drivers/iio/dac/ad5504.c
@@ -5,6 +5,7 @@
  * Copyright 2011 Analog Devices Inc.
  */
 
+#include <linux/acpi.h>
 #include <linux/array_size.h>
 #include <linux/bits.h>
 #include <linux/dev_printk.h>
@@ -12,10 +13,12 @@
 #include <linux/interrupt.h>
 #include <linux/kstrtox.h>
 #include <linux/module.h>
+#include <linux/property.h>
 #include <linux/regulator/consumer.h>
 #include <linux/spi/spi.h>
 #include <linux/sysfs.h>
 #include <linux/types.h>
+#include <linux/units.h>
 
 #include <linux/iio/dac/ad5504.h>
 #include <linux/iio/events.h>
@@ -24,6 +27,10 @@
 
 #include <asm/byteorder.h>
 
+/*
+ * In case of ACPI, we use the 60 V as default voltage reference.
+ */
+#define AD5504_VREF_ACPI_DEFAULT_mV	(60 * MILLI)
 #define AD5504_RES_MASK			GENMASK(11, 0)
 #define AD5504_CMD_READ			BIT(15)
 #define AD5504_CMD_WRITE		0
@@ -285,16 +292,20 @@ static int ad5504_probe(struct spi_device *spi)
 
 	st = iio_priv(indio_dev);
 
-	ret = devm_regulator_get_enable_read_voltage(dev, "vcc");
-	if (ret < 0 && ret != -ENODEV)
-		return ret;
-	if (ret == -ENODEV) {
-		if (pdata->vref_mv)
-			st->vref_mv = pdata->vref_mv;
-		else
-			dev_warn(dev, "reference voltage unspecified\n");
+	if (is_acpi_device_node(dev_fwnode(dev))) {
+		st->vref_mv = AD5504_VREF_ACPI_DEFAULT_mV;
 	} else {
-		st->vref_mv = ret / 1000;
+		ret = devm_regulator_get_enable_read_voltage(dev, "vcc");
+		if (ret < 0 && ret != -ENODEV)
+			return ret;
+		if (ret == -ENODEV) {
+			if (pdata->vref_mv)
+				st->vref_mv = pdata->vref_mv;
+			else
+				dev_warn(dev, "reference voltage unspecified\n");
+		} else {
+			st->vref_mv = ret / 1000;
+		}
 	}
 
 	st->spi = spi;
-- 
2.55.0


From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.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 604BE3939C8
	for <devicetree@vger.kernel.org>; Sat, 22 Aug 2026 08:59:06 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1787389150; cv=none; b=TbURFRJX4JcqkapKWBGEFGFWze8ySrFeysGcXYyVCI+uIDI3haYFdmVCg1RJgqTlKxzipsYmix4r/s6lo/joFvRz9rUYOQHNmyqx67aW0GFEIIPeR21m/yHVo14BTNQu9oyW5sezbkE1Hi4RvJYk6b2Dosn6Z15htNLIc9JWHCY=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1787389150; c=relaxed/simple;
	bh=FQ4fyjXp2OqEnkYHwsfz+TTm/oRpClpjq1D/SX+fetU=;
	h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
	 MIME-Version; b=Fr8tbc5hG91FsvaCMJt+ZVeoyJKI7wiYC/f7pUZqsVWqoxbThonn4/ctDD0FEOYx6EQQWWJ4A8EPEFHjNfjCCa5kbYWGypkhaPX3dFBYPyUYK2EBKCHbCbzZiDco4wyEenXrOtiOvnb+n6LvaNTecoE6Y4qI40HbRsGcvV9IVxg=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=qTZ29IQy; arc=none smtp.client-ip=209.85.128.41
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="qTZ29IQy"
Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-4954dff6536so14270675e9.0
        for <devicetree@vger.kernel.org>; Sat, 22 Aug 2026 01:59:06 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20251104; t=1787389145; x=1787993945; darn=vger.kernel.org;
        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:content-type;
        bh=cXCIKeHXfMN8TRcCWZhE+maVe8/ByjaTIx/Ywm2GTsw=;
        b=qTZ29IQyr6WAfQFmLVuB30Z/tcSUD7tVXaK7wntNOvG6urwOXQpqzu56OYxdJ8fT3T
         ZENgOfjon76VE3iWgBQpnevOkUHRiJb5VpqpFvgLlFIgZBvjL7ifrj8x5nEWDhaYgTYW
         5uc3EocqbrSV/8BVkRXOK19qx0OjiZequFGrHv8qSyMm+eepD2hAsW/ObThzu7uJhElX
         tUs7u9pD0YdKbqqHRs3RaLyytUrsSs2o2llzZAlTtKn+EwXdt62Qx4nuIj4A3fU27UEg
         sbQzr2WG+443fExtiLF5XfIbV3MZZNdBR36wcWUgX5PQrYi8N5DGW5Lj6qpVQbVPsBMG
         yjRQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20251104; t=1787389145; x=1787993945;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from
         :to:cc:subject:date:message-id:reply-to:content-type;
        bh=cXCIKeHXfMN8TRcCWZhE+maVe8/ByjaTIx/Ywm2GTsw=;
        b=eUACXJ2DUg5LTuVS19KFTx0RYGkNV4vpRN5B6ajg0aKTL9a8TqulUiHYPLAS84+JUF
         I43X5QdiLwh1QWFE9AAG8K2sTG/I90Cozfmak6e6MZyOuHgQa9qCkNJxV3GK17W1nIUP
         z+Owh5BR5GqxbliFwPNRsMaZEWuHgjBV6sG7n14sRNpyD8uhqg/VA0yArghqf28G8X00
         zad4eqhXZbjuWzF851Z6DhoqUaJUkAm5SbVp0jrQhEdaKiV4wPDiT9TbT/8hJiaY6+TG
         XTt+K70fMKqUKpCtdMNkZz2Mbbs92b4W8nFQfiA9hwxHKUJf5ZHizYrmAgtNnWeuTivj
         kNSQ==
X-Forwarded-Encrypted: i=1; AHgh+RovkMy6MLPRvgXgk/ME1uLkJ/puDpsFsF8/01+nG1+Dxv2OdmxhjIByfcKBFuehrOMNMxZvV4vZ8wWM@vger.kernel.org
X-Gm-Message-State: AFuF++kvUvxw5JoRxV19YedkJwuwH1+35JQ8VgfRipvGe66fzDBarj5J
	UkkG4wsqms9Y8yaXiiX6ihU30GCbtk++9+KMEAdCKkCVp9xq44djDnD0
X-Gm-Gg: AR+sD13lPsYBpVJ/6s1UQvlvL+o8eWtpfmQqWop/Ft3y8slzFi6aaT16kViOcJA6xQG
	4AnYukqzeLp8Q+AK/mWaLQJ+NAzjEIgvoz2CCRq48FPSETrQeO8vYVAG10Aa4KD2V3j5a3iE4Lu
	3qOeiMvrSDOdDbZSUxVbfrUHtLNNgGYRsa7we+YgswDTuzsSZDMu5JPZxjIJ13VKJ7tFc6HFjRJ
	0scD8IrJosr5C01bQNF6+bbpO5zhdh2XD0gpKsxcXxHKr+fI2fwjckxsNwbwQ8CCUanzThMYtrJ
	I3cPcHJljnjVIrs9PzulQWouVcKo8gK7D8pfydHKAsXIopYYtkiKwt4D91KvXpr8vRErqLytCO+
	MJSpifAK/gLkroD27uOajCpZQCgcFz7tM0TgckHNwxPDhFb4/55uOYX3kkbx+pAm4r0TzvT0OYJ
	kzPNwfxGv1GqqFvuEzrOD/o0vIVyXH6Xw7f9Z0RWVto3jBy6wW50pzJKTPgxctRgN+22oxe64YX
	bfZ0rHjJk8=
X-Received: by 2002:a05:600c:530f:b0:499:51f0:a9b2 with SMTP id 5b1f17b1804b1-499b82f3d1dmr168825025e9.1.1787389144645;
        Sat, 22 Aug 2026 01:59:04 -0700 (PDT)
Received: from fedora ([105.74.72.30])
        by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-499c359b9fcsm13596635e9.9.2026.08.22.01.59.02
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Sat, 22 Aug 2026 01:59:04 -0700 (PDT)
From: Taha Ed-Dafili <0rayn.dev@gmail.com>
To: jic23@kernel.org,
	lars@metafoo.de
Cc: Michael.Hennerich@analog.com,
	robh@kernel.org,
	krzk+dt@kernel.org,
	conor+dt@kernel.org,
	dlechner@baylibre.com,
	nuno.sa@analog.com,
	andy@kernel.org,
	skhan@linuxfoundation.org,
	linux@analog.com,
	linux-iio@vger.kernel.org,
	devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Taha Ed-Dafili <0rayn.dev@gmail.com>
Subject: [PATCH v6 2/6] iio: dac: ad5504: Align headers with IWYU principle
Date: Sat, 22 Aug 2026 04:56:49 -0400
Message-ID: <20260822085850.17527-3-0rayn.dev@gmail.com>
X-Mailer: git-send-email 2.55.0
In-Reply-To: <20260822085850.17527-1-0rayn.dev@gmail.com>
References: <20260822085850.17527-1-0rayn.dev@gmail.com>
Precedence: bulk
X-Mailing-List: devicetree@vger.kernel.org
List-Id: <devicetree.vger.kernel.org>
List-Subscribe: <mailto:devicetree+subscribe@vger.kernel.org>
List-Unsubscribe: <mailto:devicetree+unsubscribe@vger.kernel.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

Update the header inclusions to follow the IWYU principle and ensure
they are sorted alphabetically:

- Remove <linux/fs.h>, <linux/slab.h>, and <linux/kernel.h> as they
  are unused. The driver relies on devm_ managed allocations, so slab
  is not required.
- Replace <linux/bitops.h> with <linux/bits.h> as only the BIT() and
  GENMASK() macros are used.
- Add <linux/errno.h> and <linux/types.h> for error codes and data types.
- Add <asm/byteorder.h> for cpu_to_be16().
- Add <linux/array_size.h> for ARRAY_SIZE().
- Add <linux/kstrtox.h> for string to integer conversions.
- Replaced <linux/device.h> with <linux/dev_printk.h>

Signed-off-by: Taha Ed-Dafili <0rayn.dev@gmail.com>
---
 drivers/iio/dac/ad5504.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/iio/dac/ad5504.c b/drivers/iio/dac/ad5504.c
index ad1a74678cf2..5c9c66b04154 100644
--- a/drivers/iio/dac/ad5504.c
+++ b/drivers/iio/dac/ad5504.c
@@ -5,22 +5,25 @@
  * Copyright 2011 Analog Devices Inc.
  */
 
-#include <linux/bitops.h>
-#include <linux/device.h>
-#include <linux/fs.h>
+#include <linux/array_size.h>
+#include <linux/bits.h>
+#include <linux/dev_printk.h>
+#include <linux/errno.h>
 #include <linux/interrupt.h>
-#include <linux/kernel.h>
+#include <linux/kstrtox.h>
 #include <linux/module.h>
 #include <linux/regulator/consumer.h>
-#include <linux/slab.h>
 #include <linux/spi/spi.h>
 #include <linux/sysfs.h>
+#include <linux/types.h>
 
 #include <linux/iio/dac/ad5504.h>
 #include <linux/iio/events.h>
 #include <linux/iio/iio.h>
 #include <linux/iio/sysfs.h>
 
+#include <asm/byteorder.h>
+
 #define AD5504_RES_MASK			GENMASK(11, 0)
 #define AD5504_CMD_READ			BIT(15)
 #define AD5504_CMD_WRITE		0
-- 
2.55.0


From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.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 F0E0A384CD4
	for <devicetree@vger.kernel.org>; Sat, 22 Aug 2026 08:59:10 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1787389152; cv=none; b=lwDTFqr4RnZAU9mPBgef+vae+MGFxmifMyg8HbVtu3evM03FDTjXZc066HBVYKKZGxwHmChmxpRBtqGZKRpOKP81RrRf6uZ5fZ8KWLvPzeMQb+/2aNIrz9u9ALySd/WXss+6cwcCDgbOanAFuFuhOyl+XmLTHEOAybv7I4hd/0E=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1787389152; c=relaxed/simple;
	bh=HCZVOF8T9m7E1Gm3Iq+tZImcQ0gw7AQRtwevkDBWDd0=;
	h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
	 MIME-Version; b=TcTiqBbxTUTEVt+dA555hBxuEp82sMtAPxDV5LxLarPCMis2cZ2FI2dALxJ0y3VSpPmkM16VKDdk7xxTzFZBA12JvzgZN/SXvF4Z3zd1EHOfpDyASA4JdZWbeF7CzTCeLCIezmv9t2B/YCWXgZI30q0mqMLyaiOfYU4LTPenHXg=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=CpVO4Ppa; arc=none smtp.client-ip=209.85.128.45
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CpVO4Ppa"
Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-49978908b35so11933895e9.0
        for <devicetree@vger.kernel.org>; Sat, 22 Aug 2026 01:59:10 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20251104; t=1787389149; x=1787993949; darn=vger.kernel.org;
        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:content-type;
        bh=0dWiifvCNQ6/1XjQKOnLCIy+9xjui2vS7wMw6DuKzck=;
        b=CpVO4PpaADFUYZb9BdHz57T/9zlRaUoBDVipDhuy6607AqDegFbjE2NxH1KkdF6vsp
         XTqryFL1Y2rf5ejiYpe7rGDux2wRu3sbivQIvcHbCKo5e4nynSHQuoAhZXHg95svE2iC
         wKvS800DqoqInTYMk++f2TiHcEnJ+G3740Nu4BPxwpyMgbD2r115CLHOhSqJ0FNxgpyY
         6/rxlXw7Jgk/yca09cs0QzaowYOzy4YdMledBbN/HAb3Vhebv5y//AmQMZwzFQrzJKsq
         LFFuLr1P8je950f7gDTc6ypMo0f82hGCuvI1CPw+arnzuqqZnlai63OLHNKIR4jaZW38
         gGig==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20251104; t=1787389149; x=1787993949;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from
         :to:cc:subject:date:message-id:reply-to:content-type;
        bh=0dWiifvCNQ6/1XjQKOnLCIy+9xjui2vS7wMw6DuKzck=;
        b=XU8YlBiCIWy2jhqtAQg1Lgr7gQ1mYYBe1a1w6akZzflEK+eFtM1FSEJsihRWyT1g+g
         +W50xGw50pXcQ8yCc7C1SwuzbRjeEO+sh/RnRNx0KWJyD86uvXy9LuC4UMQlXP3mWZcv
         gIEoPx36S0yTVtFVchvAH7dD9Cg1j3pexduJXA0lLqQz3zJvAfyO1gnreq6JoN+abufE
         8OcRFdNwP86lT+CqKPg/8PvC25+Z7um4x4PzNercqCnMQSpwxPmdW6Jw6hPzRkdaZXeT
         FMyGIWngf433NItfNQCOpvkYLDzGvltmaciJjWiQIni4704g4P4ST1RRgLCD7TOOShAD
         TEWw==
X-Forwarded-Encrypted: i=1; AHgh+RrxiCCinRFmt7Jhkoxl3y0mJEie1QKe9mTIQXmNQRl1M25nA1TzUDJ/Xf6He+agHvIyb8z6VWBhQdkr@vger.kernel.org
X-Gm-Message-State: AFuF++k5zM9ht6p6EOQSyHX+SJLfxyJOsQthxd7rugMmZNbWK4yndp2q
	uXlllmT+qgNXY+Utegk1o0ost9dLjDvkMtZzegw3OTdmOHEZBTeSMxkJ
X-Gm-Gg: AR+sD122v2BxmbwlJJ6eKFwICq3nB/mVafoNNONOwVSIc5PHEd7BKXCv4wrwyJNz95D
	OCAWpF7KjQu46Hh3dQ4spT1qdJiMWlN8aS9rF3Xz0h+HhQ95WI+IeLjV1qin9uev4fTXp/n6tau
	8frg6SxLhWltKMOZbanOi89Bjv7D8ydIWK9UmVyryPbL6MhXKtQk4/jHBtSfHuUF8TL+60mAhZ+
	sHl4/8HZvZYhUzAMzwJ6YGYydRZnmheSJvAdIg0pnjsaXN7sUF/DpvqSUSTw3ltu1W3KgzGGbEg
	EEyiCB4pR8HaWW/lFIcDsjVy/sJE7buEfUdJUZkmaoQf7KR7VVUg22IbSA45dJ9FnZ0DVYd+tJd
	6cjOESu55Fjad0EGwaENpyqIPct+VvyIiPxCGCx1hhZilCG0pVY1WSzqt1Qef7JT7DqQ9a+v4ve
	DyEDp3yM/LTj2uHQIJKQ0K+fu0gzrdO2iT+cpiVCrKhtf1/2pI2W7FGN7P+wWtpMipp1vK3fLyx
	wlil/V2Kxg=
X-Received: by 2002:a05:600c:4e4e:b0:499:b01e:911c with SMTP id 5b1f17b1804b1-499b830d697mr175513185e9.2.1787389149299;
        Sat, 22 Aug 2026 01:59:09 -0700 (PDT)
Received: from fedora ([105.74.72.30])
        by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-499c359b9fcsm13596635e9.9.2026.08.22.01.59.07
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Sat, 22 Aug 2026 01:59:09 -0700 (PDT)
From: Taha Ed-Dafili <0rayn.dev@gmail.com>
To: jic23@kernel.org,
	lars@metafoo.de
Cc: Michael.Hennerich@analog.com,
	robh@kernel.org,
	krzk+dt@kernel.org,
	conor+dt@kernel.org,
	dlechner@baylibre.com,
	nuno.sa@analog.com,
	andy@kernel.org,
	skhan@linuxfoundation.org,
	linux@analog.com,
	linux-iio@vger.kernel.org,
	devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Taha Ed-Dafili <0rayn.dev@gmail.com>
Subject: [PATCH v6 4/6] iio: dac: ad5504: remove legacy platform data support
Date: Sat, 22 Aug 2026 04:56:51 -0400
Message-ID: <20260822085850.17527-5-0rayn.dev@gmail.com>
X-Mailer: git-send-email 2.55.0
In-Reply-To: <20260822085850.17527-1-0rayn.dev@gmail.com>
References: <20260822085850.17527-1-0rayn.dev@gmail.com>
Precedence: bulk
X-Mailing-List: devicetree@vger.kernel.org
List-Id: <devicetree.vger.kernel.org>
List-Subscribe: <mailto:devicetree+subscribe@vger.kernel.org>
List-Unsubscribe: <mailto:devicetree+unsubscribe@vger.kernel.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

The AD5504 driver has no in-tree users of its legacy platform data
support. Now that ACPI has its own explicit path, non-ACPI systems can
safely treat the vcc regulator as mandatory.

Drop the ad5504_platform_data structure, remove the fallback logic
from probe, and delete include/linux/iio/dac/ad5504.h.

Signed-off-by: Taha Ed-Dafili <0rayn.dev@gmail.com>
---
 drivers/iio/dac/ad5504.c       | 17 +++++------------
 include/linux/iio/dac/ad5504.h | 15 ---------------
 2 files changed, 5 insertions(+), 27 deletions(-)
 delete mode 100644 include/linux/iio/dac/ad5504.h

diff --git a/drivers/iio/dac/ad5504.c b/drivers/iio/dac/ad5504.c
index 6f70c57c7a82..799726eafdf2 100644
--- a/drivers/iio/dac/ad5504.c
+++ b/drivers/iio/dac/ad5504.c
@@ -20,7 +20,6 @@
 #include <linux/types.h>
 #include <linux/units.h>
 
-#include <linux/iio/dac/ad5504.h>
 #include <linux/iio/events.h>
 #include <linux/iio/iio.h>
 #include <linux/iio/sysfs.h>
@@ -281,7 +280,6 @@ static const struct iio_chan_spec ad5504_channels[] = {
 static int ad5504_probe(struct spi_device *spi)
 {
 	struct device *dev = &spi->dev;
-	const struct ad5504_platform_data *pdata = dev_get_platdata(dev);
 	struct iio_dev *indio_dev;
 	struct ad5504_state *st;
 	int ret;
@@ -296,16 +294,11 @@ static int ad5504_probe(struct spi_device *spi)
 		st->vref_mv = AD5504_VREF_ACPI_DEFAULT_mV;
 	} else {
 		ret = devm_regulator_get_enable_read_voltage(dev, "vcc");
-		if (ret < 0 && ret != -ENODEV)
-			return ret;
-		if (ret == -ENODEV) {
-			if (pdata->vref_mv)
-				st->vref_mv = pdata->vref_mv;
-			else
-				dev_warn(dev, "reference voltage unspecified\n");
-		} else {
-			st->vref_mv = ret / 1000;
-		}
+		if (ret < 0)
+			return dev_err_probe(dev, ret,
+					     "Failed to get vcc regulator\n");
+
+		st->vref_mv = ret / 1000;
 	}
 
 	st->spi = spi;
diff --git a/include/linux/iio/dac/ad5504.h b/include/linux/iio/dac/ad5504.h
deleted file mode 100644
index 9f23c90486ee..000000000000
--- a/include/linux/iio/dac/ad5504.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * AD5504 SPI DAC driver
- *
- * Copyright 2011 Analog Devices Inc.
- */
-
-#ifndef SPI_AD5504_H_
-#define SPI_AD5504_H_
-
-struct ad5504_platform_data {
-	u16				vref_mv;
-};
-
-#endif /* SPI_AD5504_H_ */
-- 
2.55.0


From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43])
	(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 5098A3955F3
	for <devicetree@vger.kernel.org>; Sat, 22 Aug 2026 08:59:14 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1787389157; cv=none; b=dbzXPFffMSN/Fkr8kXrzIcPWmDrEhaKQH+K5TXrNR5ovdCEJd/3qWH+jtN7GqxdfM1UxFs40/rggLhpPm4DC4tGYUICYRAxs3sQOXoBZY87tifWtn7VMLwCD3NFx28ru/hQhDfbJtpj1RXaVKOis09kgphidnHqWsoBEqBPd9dc=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1787389157; c=relaxed/simple;
	bh=GrjWD/fHDSl39omfPPPA6fY82p2QrwPspwwKONWixLU=;
	h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
	 MIME-Version; b=e94wGwMxJqlT7H2AZPieFYf6au0NnQxi2ZW+2f45opn3GPBrRJeu5mDIv5JwOcUftgmQu3ogjQZE3pyse8fq+nBKNWhF9rI/+EP9xfyviZ6Ec6L8xfb9tC5NjNjDVwfnVc1krseOAMu4wYqxBvVS9xpOfP8TGtH7GU4IrDPhsW4=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=kD7CUfgc; arc=none smtp.client-ip=209.85.128.43
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="kD7CUfgc"
Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-4998e0916faso11641545e9.2
        for <devicetree@vger.kernel.org>; Sat, 22 Aug 2026 01:59:14 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20251104; t=1787389152; x=1787993952; darn=vger.kernel.org;
        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:content-type;
        bh=luQR8xYtWNjcIKjnua7+NMXDIf2qqWk1d+lbBj05x0Q=;
        b=kD7CUfgcAdxfIqWoJWbLxfAn9h+Q4Z7UCv9VgUO2mfgDSasF7IQQ8/QqUzi2oDE5kU
         jMd2V5hkODd6P3fGom8qC8SUqfpViayyzMOc9XSn9tjdQWIuWjGAQ2pUN/H0hj0NsbLU
         VQgFsQZ65Ae1LJr6qGTAucb/Eu23GWpDW5x7ejrSH/1cvQdbXTvhOS2aduC/9ZUCZEOb
         TQyzHdhtC531HxwK7aXoqXhCUbsAarQtSZE22cyTFYssbrKSfzSmNDH/gxuEsGvpPBEC
         iNGIW353j2jCCJ6VqpI0ZKSn7iPZSe28V+R184ZyvxzM5+TlbY+ISgjl9M7xPrVTzjbh
         twzQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20251104; t=1787389152; x=1787993952;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from
         :to:cc:subject:date:message-id:reply-to:content-type;
        bh=luQR8xYtWNjcIKjnua7+NMXDIf2qqWk1d+lbBj05x0Q=;
        b=BWRQGRlg++hLq6s0yUhbFYDg6BVgebO9WADXfyDQaBHg7W6fZQr825zEnuxOaBYwht
         o5GvR++hADHp9JdFyDlZU5x5b0q9HxV9RUmFJ/fC1rkJv0EDGpWJRY9JNnUD0iDHrdLS
         H1QLe39OIzJH8BXRGof66lURAYwancmxqVy7xD+PbkT8FM+/5cYfqlNGCKCkSYSD+pL6
         73n4CeJTCROgKcm0JXa6WWc93FvaaYdZOAQTapwlRh4SuntJhAeerGMaA4eVUuXWeR5g
         iq42wH972+kdRGv/GuJEUJJ4ny059XkfSUVxgIQXLzxVDkKqQ1MsKasopEoOeitdhc4C
         xhfg==
X-Forwarded-Encrypted: i=1; AHgh+RqwMws3DCH9WqOHWqQx5zqy9K2B+T7/YF30SgwGNUUiPEyZccXBuaN35goD0KQMjaxGF8q+obgaHvKo@vger.kernel.org
X-Gm-Message-State: AFuF++nWzLXXrlSJghsvEsZW/kt9k9ZaPKds73LKn1cMtiUyAcxrhjaB
	FHN73FOJq0q7RwBbNB+J3oy8EIlfOXUhpY7GOSccg7DQRaliJE0CH4NUCXwJoA==
X-Gm-Gg: AR+sD11RYY4mgKaZSJr1xjr+g7Ah2sb+MFv2R6/JSLAqCZs4+E3NeCXQXEEgRfaKBLJ
	QBJN0U6MCISKKVYRgkJYf94AHesPY09rYAPJnKFzVpPTICCk74KNIEqJYdDyIhRDnh6/UOyoteV
	k/ab3U0dlRDbn2XOz8MqQPNciu0O96A6epBkU4WSCevnuXr7kEj0gW+FW/ektVfrhLUp+OOTzsD
	BG7374yF/826nBaycJn5tMFn9vsLWxOf6cDZh//FPdGniy3tzfBTmM8fA4G9K+eKsLx8OYWdYmW
	aMeVlOkZc6F/Tqh7igXzpOWnb7mTX3B78PWS+JeSlWQBohJK3ycGx+mqL70wRR9brLe+/OBxVaI
	Gw3CYHD+80M9tlMQg6Q78vJPssMKBrkmPFk7wS7ER3O/tna+Nad9KJ//vueAa+xpMUoGSEMozL2
	OKXz/FL7Na+84Vzk1OqTpq7YqrY0AZGtmn/0HLSpZtgFv7lTMbcLTmcuZVAW3BUce6tVC/6tkZL
	twBd96lw/A=
X-Received: by 2002:a05:600c:83ce:b0:493:a966:d5b5 with SMTP id 5b1f17b1804b1-499c19adad0mr42586245e9.2.1787389152523;
        Sat, 22 Aug 2026 01:59:12 -0700 (PDT)
Received: from fedora ([105.74.72.30])
        by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-499c359b9fcsm13596635e9.9.2026.08.22.01.59.09
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Sat, 22 Aug 2026 01:59:11 -0700 (PDT)
From: Taha Ed-Dafili <0rayn.dev@gmail.com>
To: jic23@kernel.org,
	lars@metafoo.de
Cc: Michael.Hennerich@analog.com,
	robh@kernel.org,
	krzk+dt@kernel.org,
	conor+dt@kernel.org,
	dlechner@baylibre.com,
	nuno.sa@analog.com,
	andy@kernel.org,
	skhan@linuxfoundation.org,
	linux@analog.com,
	linux-iio@vger.kernel.org,
	devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Taha Ed-Dafili <0rayn.dev@gmail.com>
Subject: [PATCH v6 5/6] iio: dac: ad5504: introduce local lock to protect state and spi transfers
Date: Sat, 22 Aug 2026 04:56:52 -0400
Message-ID: <20260822085850.17527-6-0rayn.dev@gmail.com>
X-Mailer: git-send-email 2.55.0
In-Reply-To: <20260822085850.17527-1-0rayn.dev@gmail.com>
References: <20260822085850.17527-1-0rayn.dev@gmail.com>
Precedence: bulk
X-Mailing-List: devicetree@vger.kernel.org
List-Id: <devicetree.vger.kernel.org>
List-Subscribe: <mailto:devicetree+subscribe@vger.kernel.org>
List-Unsubscribe: <mailto:devicetree+unsubscribe@vger.kernel.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

The driver lacks locking, exposing concurrent access to the shared DMA
SPI buffers, the non-atomic CTRL+NOOP write sequence in powerdown, and
the pwr_down_mask/pwr_down_mode state variables.

Introduce a mutex via devm_mutex_init() and guard(mutex) at the IIO
callbacks to serialize access. In read_raw() and write_raw(), scope the
lock to IIO_CHAN_INFO_RAW only since IIO_CHAN_INFO_SCALE reads vref_mv
which is immutable after probe.

Signed-off-by: Taha Ed-Dafili <0rayn.dev@gmail.com>
---
 drivers/iio/dac/ad5504.c | 26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/dac/ad5504.c b/drivers/iio/dac/ad5504.c
index 799726eafdf2..74679feea385 100644
--- a/drivers/iio/dac/ad5504.c
+++ b/drivers/iio/dac/ad5504.c
@@ -8,11 +8,13 @@
 #include <linux/acpi.h>
 #include <linux/array_size.h>
 #include <linux/bits.h>
+#include <linux/cleanup.h>
 #include <linux/dev_printk.h>
 #include <linux/errno.h>
 #include <linux/interrupt.h>
 #include <linux/kstrtox.h>
 #include <linux/module.h>
+#include <linux/mutex.h>
 #include <linux/property.h>
 #include <linux/regulator/consumer.h>
 #include <linux/spi/spi.h>
@@ -55,10 +57,12 @@
  * @pwr_down_mask:	power down mask
  * @pwr_down_mode:	current power down mode
  * @data:		transfer buffer
+ * @lock:		lock to protect state and spi transfers
  */
 struct ad5504_state {
 	struct spi_device		*spi;
 	struct regulator		*reg;
+	struct mutex			lock;
 	unsigned short			vref_mv;
 	unsigned			pwr_down_mask;
 	unsigned			pwr_down_mode;
@@ -109,7 +113,9 @@ static int ad5504_read_raw(struct iio_dev *indio_dev,
 	int ret;
 
 	switch (m) {
-	case IIO_CHAN_INFO_RAW:
+	case IIO_CHAN_INFO_RAW: {
+		guard(mutex)(&st->lock);
+
 		ret = ad5504_spi_read(st, chan->address);
 		if (ret < 0)
 			return ret;
@@ -117,6 +123,7 @@ static int ad5504_read_raw(struct iio_dev *indio_dev,
 		*val = ret;
 
 		return IIO_VAL_INT;
+	}
 	case IIO_CHAN_INFO_SCALE:
 		*val = st->vref_mv;
 		*val2 = chan->scan_type.realbits;
@@ -134,11 +141,14 @@ static int ad5504_write_raw(struct iio_dev *indio_dev,
 	struct ad5504_state *st = iio_priv(indio_dev);
 
 	switch (mask) {
-	case IIO_CHAN_INFO_RAW:
+	case IIO_CHAN_INFO_RAW: {
+		guard(mutex)(&st->lock);
+
 		if (val >= (1 << chan->scan_type.realbits) || val < 0)
 			return -EINVAL;
 
 		return ad5504_spi_write(st, chan->address, val);
+	}
 	default:
 		return -EINVAL;
 	}
@@ -154,6 +164,8 @@ static int ad5504_get_powerdown_mode(struct iio_dev *indio_dev,
 {
 	struct ad5504_state *st = iio_priv(indio_dev);
 
+	guard(mutex)(&st->lock);
+
 	return st->pwr_down_mode;
 }
 
@@ -162,6 +174,8 @@ static int ad5504_set_powerdown_mode(struct iio_dev *indio_dev,
 {
 	struct ad5504_state *st = iio_priv(indio_dev);
 
+	guard(mutex)(&st->lock);
+
 	st->pwr_down_mode = mode;
 
 	return 0;
@@ -179,6 +193,8 @@ static ssize_t ad5504_read_dac_powerdown(struct iio_dev *indio_dev,
 {
 	struct ad5504_state *st = iio_priv(indio_dev);
 
+	guard(mutex)(&st->lock);
+
 	return sysfs_emit(buf, "%d\n",
 			  !(st->pwr_down_mask & (1 << chan->channel)));
 }
@@ -195,6 +211,8 @@ static ssize_t ad5504_write_dac_powerdown(struct iio_dev *indio_dev,
 	if (ret)
 		return ret;
 
+	guard(mutex)(&st->lock);
+
 	if (pwr_down)
 		st->pwr_down_mask &= ~(1 << chan->channel);
 	else
@@ -290,6 +308,10 @@ static int ad5504_probe(struct spi_device *spi)
 
 	st = iio_priv(indio_dev);
 
+	ret = devm_mutex_init(dev, &st->lock);
+	if (ret)
+		return ret;
+
 	if (is_acpi_device_node(dev_fwnode(dev))) {
 		st->vref_mv = AD5504_VREF_ACPI_DEFAULT_mV;
 	} else {
-- 
2.55.0


From mboxrd@z Thu Jan  1 00:00:00 1970
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 C0D9C374E73
	for <devicetree@vger.kernel.org>; Sat, 22 Aug 2026 08:59:16 +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=1787389158; cv=none; b=UJSYpNnlyWIV7dzQyBQXzlAEb4GY962r6e7Gm6jmm1bF9CmbEfuVCfH/18mS5SLrkaFuEMKWHwdJMdkKIAXycF2MoUPKsJ5sw4qgk6vONJAYGA9CHlu55BJuIO5Je2nSBDO6Hs1a7xESJDEk719GWOEm1n9NqjANuYHsCFCcVLY=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1787389158; c=relaxed/simple;
	bh=knEBHlFfwfTg3BZHtVetu+4kkb6goYIW9lT42atil6A=;
	h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
	 MIME-Version; b=fe6wszpeb/NM/SWJKjuzkUy9aVLNuFA9MDgRPVm7yK35qXXC+i/DX4mfLr6yi5hyLHH4RBHlmQgGeUWJwZVgLsmV0pjKw9bp/316NK0x3AKEn/1qLUWkDXjtL1ChjQm8DdAPBM6+jzOm04lPoZd+8a+3GVmdzg7uyyh1XwBNVio=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=YQxcpLVe; arc=none smtp.client-ip=209.85.221.42
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="YQxcpLVe"
Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-47f96c5b722so829667f8f.0
        for <devicetree@vger.kernel.org>; Sat, 22 Aug 2026 01:59:16 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20251104; t=1787389155; x=1787993955; darn=vger.kernel.org;
        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:content-type;
        bh=gyzSFKMQwJr+T8EdF5oNgce8bGN34YWsrDUToLRcePQ=;
        b=YQxcpLVejS2q7sX6dDG7AVnPrRzjNFwe/Jg+at+teKir7AzRvy7iS9MxWop3w0ITJx
         wUxV0BNCZgauXWVLK78WHU2Dn57HABp2DWAu4h9SHc7qd7l4W6LuijQP3664ZA6JDXyF
         4a0aQ3rOUh7BA2HfDhSYMHBQrNXNGd0C6TrXq6vxbE7x9Ll+mJPKudIhOAlzQpu8O4WQ
         vPVv4sfmWzwdI0hiaCiE8AEtWPleFi48+8zjjzvj+ZGQgrD+pf8uDvGZBh+/GD8nTZ8A
         4qonsMMW+Hf6ynQsgw1rpLwiFKAvvCj9RFMwqhQJuiEfQ31JfwprW/hrqmsXUMKS0eGg
         KXcA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20251104; t=1787389155; x=1787993955;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from
         :to:cc:subject:date:message-id:reply-to:content-type;
        bh=gyzSFKMQwJr+T8EdF5oNgce8bGN34YWsrDUToLRcePQ=;
        b=SNZmbHDkNm67QsRIcBkWsKjDz+KNZTHG0Hip1GUPyf55XjKk8LXbnpH9VQTsooC5kD
         F59tZw8esQGzYrbrnntar25Yl6W7MAuOCUkBSZLQeu1mjhM/AZiZrFefFqBzjm+EpVNk
         k7b/O7vzrWzd95T0VHo7Sk9wrJZdfzjRZWzISbEAH+7BDXmQZvCTP15zohRJA6z62yrD
         ga+iz0DDN+Mof0871OyhcCCIXFKcW0R0w9AMd4b3mXui4CsCuHfnTJGXj2yvoYuetcc+
         lotvEWwO4oTNarzBcR9LApBxCz+tSHCXqU1LlOKrJUN6DltY1YrvKW8Fvph4nAULHogT
         pXmA==
X-Forwarded-Encrypted: i=1; AHgh+RoPC/8nJ8BFKqDc4PjF9TAJsYyhhjyTRHcNkdvEfb0P2Xg9YMstca6geS+0cbdkKv6Hz8MPovkoNFQB@vger.kernel.org
X-Gm-Message-State: AFuF++kZi7LmgEIpwWr5RvkqfC4wfO5qNQWRi2Xlor1GhiNwUDvZI0Qf
	ZQEaDTUeqldPMQfw3TVEXPn5q7K2lsbW7L47acAWEzr+jOCFxvZxBpls
X-Gm-Gg: AR+sD11mZN1o6950iGJkgQV9Hx+AHw5UQvWEAJs4F9Z4lhYEgVsLbhcJzz8bVuojNoU
	pyJdVkC9+sqz0/EXDUjFv0EcyjnXkJ4Clb7zWMG4kcJfbn3pX3kDZoP3nG8egA1lHWIHyoMWmLX
	9VJiaEP76FdGQnkjfASMZLfjlhji0Ij0Q/mHiK20FNd1jD1NecxTvVcg1f4WmFIXT9ewqtMSjSV
	Qv//husC9sAD3U2N3hazdk+AgMGyRAEi0o7gjJeM64riWVm0YrAeevPMJiQrZ2f7RtW+k6SjTi2
	cmgDxeS+4rLQJu67zqlr2CgS+DmIdW32Mtg1YEa4/KnGlX99fgyZMo/kFhXuKk7nGREXBCwI3Lo
	eEC5WJW9onEs1yRzAhDhxiE3rghHscIuTKBlYUcfnSXsauhKMGTyfrP86oalRIywLwzygmNlLJY
	zz49julxGsHx+1tQeAsED7xhO3c36RJnwDAff6QxgdSCAHzid10e6O6jCfTMjuVn7g38B/ey9RU
	4jDXdf7u1k=
X-Received: by 2002:a05:600c:45c3:b0:499:4e47:eaf2 with SMTP id 5b1f17b1804b1-499b8325c3fmr149228495e9.6.1787389154922;
        Sat, 22 Aug 2026 01:59:14 -0700 (PDT)
Received: from fedora ([105.74.72.30])
        by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-499c359b9fcsm13596635e9.9.2026.08.22.01.59.13
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Sat, 22 Aug 2026 01:59:14 -0700 (PDT)
From: Taha Ed-Dafili <0rayn.dev@gmail.com>
To: jic23@kernel.org,
	lars@metafoo.de
Cc: Michael.Hennerich@analog.com,
	robh@kernel.org,
	krzk+dt@kernel.org,
	conor+dt@kernel.org,
	dlechner@baylibre.com,
	nuno.sa@analog.com,
	andy@kernel.org,
	skhan@linuxfoundation.org,
	linux@analog.com,
	linux-iio@vger.kernel.org,
	devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Taha Ed-Dafili <0rayn.dev@gmail.com>
Subject: [PATCH v6 6/6] iio: dac: ad5504: support scale via output-range-microvolt property
Date: Sat, 22 Aug 2026 04:56:53 -0400
Message-ID: <20260822085850.17527-7-0rayn.dev@gmail.com>
X-Mailer: git-send-email 2.55.0
In-Reply-To: <20260822085850.17527-1-0rayn.dev@gmail.com>
References: <20260822085850.17527-1-0rayn.dev@gmail.com>
Precedence: bulk
X-Mailing-List: devicetree@vger.kernel.org
List-Id: <devicetree.vger.kernel.org>
List-Subscribe: <mailto:devicetree+subscribe@vger.kernel.org>
List-Unsubscribe: <mailto:devicetree+unsubscribe@vger.kernel.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

The AD5504 output range is set by the R_SEL pin, not the VCC supply.
Add support for 'output-range-microvolt' to set vref_mv directly from
firmware. Use device_property_present() to distinguish absent from
malformed property rather than relying on the ambiguous -EINVAL from
device_property_read_u32_array(). Fall back to the vcc regulator
voltage for old DTs that predate this property.

Signed-off-by: Taha Ed-Dafili <0rayn.dev@gmail.com>
---
 drivers/iio/dac/ad5504.c | 31 +++++++++++++++++++++++++------
 1 file changed, 25 insertions(+), 6 deletions(-)

diff --git a/drivers/iio/dac/ad5504.c b/drivers/iio/dac/ad5504.c
index 74679feea385..d0a3dd4b000d 100644
--- a/drivers/iio/dac/ad5504.c
+++ b/drivers/iio/dac/ad5504.c
@@ -300,6 +300,7 @@ static int ad5504_probe(struct spi_device *spi)
 	struct device *dev = &spi->dev;
 	struct iio_dev *indio_dev;
 	struct ad5504_state *st;
+	u32 range[2];
 	int ret;
 
 	indio_dev = devm_iio_device_alloc(dev, sizeof(*st));
@@ -315,12 +316,30 @@ static int ad5504_probe(struct spi_device *spi)
 	if (is_acpi_device_node(dev_fwnode(dev))) {
 		st->vref_mv = AD5504_VREF_ACPI_DEFAULT_mV;
 	} else {
-		ret = devm_regulator_get_enable_read_voltage(dev, "vcc");
-		if (ret < 0)
-			return dev_err_probe(dev, ret,
-					     "Failed to get vcc regulator\n");
-
-		st->vref_mv = ret / 1000;
+		if (device_property_present(dev, "output-range-microvolt")) {
+			ret = device_property_read_u32_array(dev, "output-range-microvolt",
+							     range, ARRAY_SIZE(range));
+			if (ret)
+				return dev_err_probe(dev, ret,
+							"Error parsing output-range-microvolt\n");
+
+			if (range[0] != 0 || (range[1] != 30 * MICRO && range[1] != 60 * MICRO))
+				return dev_err_probe(dev, -EINVAL,
+					"Invalid output-range-microvolt\n");
+
+			st->vref_mv = range[1] / (MICRO / MILLI);
+
+			ret = devm_regulator_get_enable(dev, "vcc");
+			if (ret < 0)
+				return dev_err_probe(dev, ret, "Failed to enable vcc regulator\n");
+		} else {
+			/* Backward compat: old DTs without output-range-microvolt */
+			ret = devm_regulator_get_enable_read_voltage(dev, "vcc");
+			if (ret < 0)
+				return dev_err_probe(dev, ret, "Failed to get vcc regulator\n");
+
+			st->vref_mv = ret / (MICRO / MILLI);
+		}
 	}
 
 	st->spi = spi;
-- 
2.55.0


From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 15C643546E5
	for <devicetree@vger.kernel.org>; Sat, 22 Aug 2026 09:10:13 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1787389815; cv=none; b=NfoqGXsH5a55pqSE/K7TJAYVzAQEfi0moGPYVoHEQ9IKDv+kQauCjX+QsHK+OQZ1oHcWhZUwh87WB8vmkMDdI3dslKxgcb148mROt4VZfMs09Idi8oURnn1QgjNkrj+mAxyVBaWZvBmOq4JZhKNjjnagTMp2JKNYNv66u4CZE7I=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1787389815; c=relaxed/simple;
	bh=sR6QARBBoCr1cbu7YoKCwLRJcUmzoU6nHiyGATjDNvA=;
	h=From:Subject:To:Cc:In-Reply-To:References:Content-Type:Date:
	 Message-Id; b=aYz6Yh3VGwiJLEm0Yy4ouJ9oXToF77yUliHdzTzCPR8xKL7LMllWnArHeJ1GWFX+nMLkvnlPULBacV9HEZa7lfI3/fDmkzdGmkU5gs3K8QVFM3QIotOYF3Dfxn2sXizGd8nAK+AktCEiPFQqrNJ7sz69hsszo/L08dw7B3pK7Fs=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PmUSwrsV; arc=none smtp.client-ip=100.103.45.18
Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="PmUSwrsV"
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6CB221F000E9;
	Sat, 22 Aug 2026 09:10:13 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1787389813;
	bh=McoomtCVwdo04oKv46vI7BzzP8aEKF45X/ArPLjHG0M=;
	h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date;
	b=PmUSwrsV1SGhMdqsCSRACgk92tHQdFyIkaLsr08xmxgYJahr3XWcFpfnPyhMN/sZh
	 h8OUmgxt6cZoVIpxLORSNVnHFR4IcRZyBubvvuVUu7K6lj4h61qOtfWFatfNXtzqyF
	 VdaMmlYiZDhEe4vnJv3XioPyF6LZHh/JNaJNF6Jf4l9iWUkMOH02IsagsM4tHnKkGD
	 dY5Ou0meynyoN5XAgyhpafXNBO+cUkJ35WRHpVK5RSPYTr3KUePUfNAwtRy1QxS3MB
	 ykh/RC0XoGwNDFZmTR+vun3txB3ye0QMHNCiUJGd3yY9Dk6yFBtUclCuhKGKI3RUqP
	 v9Dd44lvrcEsA==
From: sashiko-bot@kernel.org
Subject: Re: [PATCH v6 6/6] iio: dac: ad5504: support scale via
 output-range-microvolt property
Reply-To: sashiko-reviews@lists.linux.dev
To: "Taha Ed-Dafili" <0rayn.dev@gmail.com>
Cc: devicetree@vger.kernel.org, conor+dt@kernel.org, robh@kernel.org
In-Reply-To: <20260822085850.17527-7-0rayn.dev@gmail.com>
References: <20260822085850.17527-1-0rayn.dev@gmail.com>
 <20260822085850.17527-7-0rayn.dev@gmail.com>
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Date: Sat, 22 Aug 2026 09:10:12 +0000
Message-Id: <20260822091013.6CB221F000E9@smtp.kernel.org>
Precedence: bulk
X-Mailing-List: devicetree@vger.kernel.org
List-Id: <devicetree.vger.kernel.org>
List-Subscribe: <mailto:devicetree+subscribe@vger.kernel.org>
List-Unsubscribe: <mailto:devicetree+unsubscribe@vger.kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(=
s) to consider:
- [Medium] The driver ignores the unified 'output-range-microvolt' device p=
roperty for ACPI nodes.
--

--- Patch [6]: [PATCH v6 6/6] iio: dac: ad5504: support scale via output-ra=
nge-microvolt property ---
commit b4531e8367c77df3a5fc929eab7e4b61b58ad05a
Author: Taha Ed-Dafili <0rayn.dev@gmail.com>

iio: dac: ad5504: support scale via output-range-microvolt property

This commit introduces the output-range-microvolt device property to
configure the vref_mv scale directly from firmware. It provides a fallback
to the vcc regulator voltage for older device trees that do not have this
property.

> diff --git a/drivers/iio/dac/ad5504.c b/drivers/iio/dac/ad5504.c
> index d22bb16e911b9..9ad9d0666e271 100644
> --- a/drivers/iio/dac/ad5504.c
> +++ b/drivers/iio/dac/ad5504.c
> @@ -315,12 +316,30 @@ static int ad5504_probe(struct spi_device *spi)
>  	if (is_acpi_device_node(dev_fwnode(dev))) {
>  		st->vref_mv =3D AD5504_VREF_ACPI_DEFAULT_mV;
>  	} else {
> +		if (device_property_present(dev, "output-range-microvolt")) {

[Severity: Medium]
Does this structure prevent ACPI devices from utilizing the newly added
output-range-microvolt property?

Since the device_property_present() check in ad5504_probe() is located insi=
de
the else block of the is_acpi_device_node() condition, an ACPI platform
specifying this property via _DSD will have it silently ignored. The driver
will instead always use the hardcoded AD5504_VREF_ACPI_DEFAULT_mV value.

Should the firmware-agnostic device property check occur before falling back
to the legacy ACPI-specific default?

[ ... ]

--=20
Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20260822085850.1752=
7-1-0rayn.dev@gmail.com?part=3D6

From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from mail-ot1-f50.google.com (mail-ot1-f50.google.com [209.85.210.50])
	(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 21428493636
	for <devicetree@vger.kernel.org>; Sat, 22 Aug 2026 18:20:46 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.50
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1787422849; cv=none; b=qQl6hTLQrC+oggKdMcwSi7sKl+FfQgK8LK6lSNYSTkUE4a6h0owFuev0JgbQeSDY8reN7DrfRjNLTxCCbDonMz5Wa2BO22+kQQhLqPTt1qec3dfAzCFbhudUPp9f75dhE8/O0oI1YuNjUSsvzcb72ZD7NfTzThrEgoVWgTSVdKs=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1787422849; c=relaxed/simple;
	bh=yAd7mVfoTBbWlzpS260BpQ70itHd8Zbdwg1YAKphL9w=;
	h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
	 In-Reply-To:Content-Type; b=QA2S4gARQfMSsI07QCYCTXQsZVphgzuuaw9wuafI7wlvmvm0fHPLFJe/a6oGkS9gb07j4ngzoRY4+u/Rg0UeG/iFzeKJ1M0HKavZFzPdJUy4wMozcTmp8vMb282rmyqRIOjxVK5/wHX4x2sSEG8zxEfIC8+WrpswMgIBfLE1VUE=
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 header.i=@baylibre.com header.b=QtdB0DiS; arc=none smtp.client-ip=209.85.210.50
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 header.i=@baylibre.com header.b="QtdB0DiS"
Received: by mail-ot1-f50.google.com with SMTP id 46e09a7af769-7f434cc1c5eso1904014a34.0
        for <devicetree@vger.kernel.org>; Sat, 22 Aug 2026 11:20:46 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=baylibre.com; s=google; t=1787422846; x=1788027646; darn=vger.kernel.org;
        h=content-transfer-encoding:content-type:in-reply-to:content-language
         :from:references:cc:to:subject:user-agent:mime-version:date
         :message-id:from:to:cc:subject:date:message-id:reply-to:content-type;
        bh=NQNhgPr9yKeFxbuFf8eNz2imAjAUqFj9cvzQCXV9ESs=;
        b=QtdB0DiSzSVUfDZCjXeD9nEncE0SZ5qIlVFYDFNoIKJMeSlyjWcPg0ucyxPo3DZVfe
         KWr9do1iFWeblA8KhMWJhLkdGx9CRogPHU0ozgglmnUOIVeb5R46lIkrYHyTPPwsOGuk
         YuWsFh6BHdy4j+60yDKckvtXR8jZBd6fvuyE6wBAdTn97A/+FZUZoa7JgoZRX3ShyHCE
         ampOQ+wdbk0/QkRE1sroDVPXNvMRdcik0MtGDAqZC8OwQf8/VKeqEaNnEgFaPDK13xYS
         6TgEpgRA7wIJUvlbgbJbVOSeI0sROy66nSR1OuHh8VJqOl5cdJmJSLxO2W7uYAfpgk3j
         8W0A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20251104; t=1787422846; x=1788027646;
        h=content-transfer-encoding:content-type:in-reply-to:content-language
         :from:references:cc:to:subject:user-agent:mime-version:date
         :message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
         :message-id:reply-to:content-type;
        bh=NQNhgPr9yKeFxbuFf8eNz2imAjAUqFj9cvzQCXV9ESs=;
        b=X5bf573W3ZFV3/Yx95bCOQTCDMie4mSR2GUBCdVPnapWto2g/Rv2gYK80PIGE8lGaR
         uB5ylumGl+LUUFNr6+TKI60WEZ9KuReqQnGDv9xPI/MW6u7DtLyvpN/dH2mcsdoEAXhQ
         3xmTocVWstDidOyw3R4M2+RcNw4cIyUQ3RksXgJRIFcz+Q5d1VHcQ297FruZfVedUgFT
         m1huRE2bWeiDYdCn84y6Ah6/hGdG8M3zbq0j3wxvp6UsYzSvAEe5PxewlwADhRb0p9yx
         g+KuRZtV0RqBupfY7U7uMqTUuBo5+z7oD+TJhpSvlWpkDuwNQcprqkBD7CBwzCWc6iqi
         HaKg==
X-Forwarded-Encrypted: i=1; AHgh+Rq9LBn4XIpSpEMgE8nQesv5ALKhDr/6ib+hTgjBGAoweF8hgjVQSIGrt2eiRoOcrSLUmcav6FSL9xeD@vger.kernel.org
X-Gm-Message-State: AFuF++lsCNhXiH+I+bXC4HTFYxSFfQGrQiZcYs6nam6F+oPyWlzJrPju
	w7iv3D4APqviClnyO0Y12+tAzhsYLe9Pv4OuGc9E4zXXCW6qLv/aYaRgvKMGHUeBfaE=
X-Gm-Gg: AR+sD12YHnc2VgS0ZdtmFb22CnOiLuFZzZ6n8vwjCL2sirbz16e14VSFoPefZvkNK0q
	aTWsHj9TTO4GQp/NVKGwO7R5mrA677IifiErAd9Fm6HAgUrrCk45oJojefpbb9hJrXwvUDc3BOv
	mfMLocKHgr1CYh1gaHwiFW3bbx+Z6YQON42wGwzT5jodx9Ev69fVghiTa+snJXoUzpTQmsWeUBR
	4lkvHQ0XF9FO7DvV1mOmX7jz1AdHvFaRokrfCwtMpr7H74maGuygLE8TdDDAu84HD4jc9Rh7cXr
	2L+vN8Cc5iYi717Jc1cla0z4lkNNnVfy7Z8vhc9uXlqrMMxSfZbbGUVB2p3zAJpLPwIagMRJ2si
	5iuXq+dOWtQaKBu3fsWrt8Th3e4fcRrIlVOjjmjpSaKYGoU47qQJw1QKmIIybYY/4e91rozX+H1
	31979FaABrrFwbc43JJ7MCeNvmOM6xrILDXPHdjsHjL5YcZCqg+tWJfXLPfAeon65xc6yFfA58p
	Mw/Cu90FbB9+Arapj/j7HCeL0f0fY010FpjonA=
X-Received: by 2002:a05:6830:83a3:b0:7dc:dbe4:3f21 with SMTP id 46e09a7af769-7f461349073mr19255634a34.1.1787422846094;
        Sat, 22 Aug 2026 11:20:46 -0700 (PDT)
Received: from ?IPV6:2600:8803:e7e4:500:e0ca:316a:4629:d835? ([2600:8803:e7e4:500:e0ca:316a:4629:d835])
        by smtp.gmail.com with ESMTPSA id 46e09a7af769-7f43fe7065csm10638335a34.1.2026.08.22.11.20.45
        (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
        Sat, 22 Aug 2026 11:20:45 -0700 (PDT)
Message-ID: <f35aea7d-0844-426e-ac81-d5b156b60e4a@baylibre.com>
Date: Sat, 22 Aug 2026 13:20:44 -0500
Precedence: bulk
X-Mailing-List: devicetree@vger.kernel.org
List-Id: <devicetree.vger.kernel.org>
List-Subscribe: <mailto:devicetree+subscribe@vger.kernel.org>
List-Unsubscribe: <mailto:devicetree+unsubscribe@vger.kernel.org>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH v6 1/6] dt-bindings: iio: dac: ad5504: add output-range
 and missing gpios
To: Taha Ed-Dafili <0rayn.dev@gmail.com>, jic23@kernel.org, lars@metafoo.de
Cc: Michael.Hennerich@analog.com, robh@kernel.org, krzk+dt@kernel.org,
 conor+dt@kernel.org, nuno.sa@analog.com, andy@kernel.org,
 skhan@linuxfoundation.org, linux@analog.com, linux-iio@vger.kernel.org,
 devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
 Conor Dooley <conor.dooley@microchip.com>
References: <20260822085850.17527-1-0rayn.dev@gmail.com>
 <20260822085850.17527-2-0rayn.dev@gmail.com>
From: David Lechner <dlechner@baylibre.com>
Content-Language: en-US
In-Reply-To: <20260822085850.17527-2-0rayn.dev@gmail.com>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

On 8/22/26 3:56 AM, Taha Ed-Dafili wrote:
> The AD5504 output range (0-30V or 0-60V) is determined by the R_SEL pin.
> 
> Use standard output-range-microvolt and range-sel-gpios properties to
> describe the hardware configuration of the R_SEL pin. Ensure mutual
> exclusivity using the not/required logic. Additionally, add missing
> vlogic-supply, clr-gpios, ldac-gpios and datasheet links, and provide
> a complete usage example.
> 
> Signed-off-by: Taha Ed-Dafili <0rayn.dev@gmail.com>
> Acked-by: Conor Dooley <conor.dooley@microchip.com>
> ---
>  .../bindings/iio/dac/adi,ad5504.yaml          | 39 ++++++++++++++++++-
>  1 file changed, 38 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/iio/dac/adi,ad5504.yaml b/Documentation/devicetree/bindings/iio/dac/adi,ad5504.yaml
> index 9c2c038683b4..e0123dceaa33 100644
> --- a/Documentation/devicetree/bindings/iio/dac/adi,ad5504.yaml
> +++ b/Documentation/devicetree/bindings/iio/dac/adi,ad5504.yaml
> @@ -10,8 +10,10 @@ maintainers:
>    - Lars-Peter Clausen <lars@metafoo.de>
>    - Jonathan Cameron <jic23@kernel.org>
>  
> -description:
> +description: |
>    High voltage (up to 60V) DACs with temperature sensor alarm function
> +  https://www.analog.com/media/en/technical-documentation/data-sheets/ad5504.pdf
> +  https://www.analog.com/media/en/technical-documentation/data-sheets/ad5501.pdf
>  
>  properties:
>    compatible:
> @@ -27,6 +29,29 @@ properties:
>      maxItems: 1
>  
>    vcc-supply: true
> +  vlogic-supply: true
> +
> +  output-range-microvolt:
> +    description: |
> +      Specify the channel output full scale range. The R_SEL pin
> +      determines if the range is 0-30V or 0-60V.
> +    items:
> +      - const: 0
> +      - enum: [30000000, 60000000]
> +    default: [0, 60000000]
> +
> +  range-sel-gpios:
> +    description:
> +      GPIO connected to the R_SEL pin to select the output voltage range.
> +    maxItems: 1
> +
> +  clr-gpios:

This is one that is starting to emerge as a common name, so I would call
it clear-gpios instead to match the same name on chips with a similar
function.

> +    description: GPIO that controls the /CLR pin (active low).
> +    maxItems: 1
> +
> +  ldac-gpios:
> +    description: GPIO that controls the /LDAC pin (active low).
> +    maxItems: 1
>  
>  additionalProperties: false
>  
> @@ -34,9 +59,17 @@ required:
>    - compatible
>    - reg
>  
> +allOf:
> +  - not:
> +      required:
> +        - range-sel-gpios
> +        - output-range-microvolt
> +
>  examples:
>    - |
>      #include <dt-bindings/interrupt-controller/irq.h>
> +    #include <dt-bindings/gpio/gpio.h>
> +
>      spi {
>          #address-cells = <1>;
>          #size-cells = <0>;
> @@ -45,6 +78,10 @@ examples:
>              compatible = "adi,ad5504";
>              vcc-supply = <&dac_vcc>;
>              interrupts = <55 IRQ_TYPE_EDGE_FALLING>;
> +
> +            output-range-microvolt = <0 60000000>;
> +            clr-gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
> +            ldac-gpios = <&gpio 5 GPIO_ACTIVE_LOW>;
>          };
>      };
>  ...


From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from mail-oi1-f173.google.com (mail-oi1-f173.google.com [209.85.167.173])
	(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 E8E1F347BA7
	for <devicetree@vger.kernel.org>; Sat, 22 Aug 2026 18:24:32 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.173
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1787423074; cv=none; b=GcACOb2LdYmY++npRbfDIW2/Vi8EJ+iTqRR4YOBzxwlSyex67KfV23kH78oZc40uHXQOFHwiNqllzC7pS3FShOBQ70sBe078Rli5xWupaplKGgORei8MeWsdzCmM6NuTsCF0gRGFMCZulzhR/BHnsben43W8JZrDqSdMu68kShc=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1787423074; c=relaxed/simple;
	bh=I0EoiW47USBxE6T6MYvTawQh7ajMMiXvhTvG+Px5aok=;
	h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
	 In-Reply-To:Content-Type; b=QWOury8UAYR15xPzqVFtUuv8tMZSEaVLXCKBqsWsE5OXll61yAbh1Lmsy/LZvwSbLAKBkB3voOMnhQ3dAgwtDAaWHpGIjF3GSleqGKSUimOcN5g6gkpd1QatjsswGBsipLTv3jzUvznOCyr4/nqOdYlzIzQUeMMFklHpx4VpPAQ=
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 header.i=@baylibre.com header.b=D9PPhSdJ; arc=none smtp.client-ip=209.85.167.173
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 header.i=@baylibre.com header.b="D9PPhSdJ"
Received: by mail-oi1-f173.google.com with SMTP id 5614622812f47-4a43c2a126fso903043b6e.3
        for <devicetree@vger.kernel.org>; Sat, 22 Aug 2026 11:24:32 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=baylibre.com; s=google; t=1787423072; x=1788027872; darn=vger.kernel.org;
        h=content-transfer-encoding:content-type:in-reply-to:from
         :content-language:references:cc:to:subject:user-agent:mime-version
         :date:message-id:from:to:cc:subject:date:message-id:reply-to
         :content-type;
        bh=AAUPoDO0LbXR3ORuYSehuTzgSLzhcn+D4ZySu9rxxeM=;
        b=D9PPhSdJwq3c489sWygiPwnXLHEr04XOslOMbw3xJVOSgMiLVwO7Lro85RQdgZuU/q
         8nREs4ly8Pz2m9mJWDbBxPvTkaMF6wmwdKYGanP24VPh3IFApH/oqw6LHrpIg0z6udqH
         yne74shUQBcd5nABZR0ghbANn1pfkmYDG0f4nr18HCfvdfMhW/5ZveZMgcSfRt8AeI3n
         5pj5fC9rIWHo+s9dAJ+OXLUUCx6b1WCGqhNoNFIdMIX8q/xY58J1MqQN+ZrLfyC5C2sl
         044n47jrqnNmJtJHGJSDaZ/F7HojjX2TNHy7wY9GJCiYsf6I9uIyS4ee7z/b5G3S+Syv
         ldWg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20251104; t=1787423072; x=1788027872;
        h=content-transfer-encoding:content-type:in-reply-to:from
         :content-language:references:cc:to:subject:user-agent:mime-version
         :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
         :message-id:reply-to:content-type;
        bh=AAUPoDO0LbXR3ORuYSehuTzgSLzhcn+D4ZySu9rxxeM=;
        b=IegDqsnKvm+XXMQm9xEioDEbzIrJFXmCyGF82VAivEu31Wk0uagoe4hKaxBmkrrJ01
         QurPJpt9a2ORCrN1EDccYmul53UlZV8OPbByy0W1PKjKSRDh4wssL+pz2bJR/hxt6fv2
         DdcoXXfoM8ebwBTIQn4a9lyQiYmNHwsOQ7uP0K7QTcomWJM4BwMP/9YiWYvloe8cT4ws
         f7k/ADyry5NoNwgkAGvVptdXAvll9f+FkUTTh1hvgm7y+eA2K8YVs+KcYjxkP2STJSQA
         8InoPrX7oaYKVjFtu4wGpU7xGZ8b2t3jwtCrEDtffZzAiZspXbCKBt0jZ9Afg+XA81fL
         erxQ==
X-Forwarded-Encrypted: i=1; AHgh+RquBMmgXmo4VupCrB/WdM7a4AzZ6itAjCd/p+tEMSeDIWDp85YMNcgp6Pqjg+z4wJa8oPbluCnWtS8X@vger.kernel.org
X-Gm-Message-State: AFuF++nPlzY6mbeWJ28+z4P7n0KpJoorgRo/PhOIPMIqdOqZp8GmLXuF
	O4Jy3FniB6IfuD0RViO6kn3bWm+8GjPnnxapsAXUbOmqn3lfPtGPjLxhvte3dh53dGg=
X-Gm-Gg: AR+sD138RnXZhh9qYe5YIr3KwclCdhyn8mIjvLOZTYvK85Ij8lKonDeRDgvfdEewDa5
	SpClB11OG5Us4A198lemK2mWMTZuGkuPNrQ86zszqAmzbJFcCwGD2FhjtPM+nPlQC02bIEh87Mi
	hOPA5l4SV7cR5y/Xfc9TcmE8NwNg/PKH8k0uy3rfmlrY6AtH0c5rZ/uDXy4G869wfbSNlBjBrxB
	AxTrj/ZtD7W1Sh+bl2x/Xvi8KeFhtWpBJP66VlRMPJjDi9Xoj93TPlvlUeI7QWr4mqUE78jTCvP
	/EN11/EJaDHCQLKfvZ49ZSM5F697nsKWplJm2fvxs3qyyhTWc6DmRyNHhtBOBHvh77YH58Ddh8G
	FA7+H/tqGXO3tlAY3FCWlsxcY9GwQcM8Q4SNjLd7yFNlVATPr0PmyOyba2B1LtcB6KHsuxcJ9jn
	Idrts8//69YvIeh7k7HPwMtppZchan4U2gBiJLwVWBJQDO2su+dIMOxKplqsX0/INe/cVmU3IAU
	e71Ul60WBLZkNDxOWYGF8w8CmnJpss0+KYmwS0=
X-Received: by 2002:a05:6808:1998:b0:4a4:c12:49d9 with SMTP id 5614622812f47-4b30998a580mr8468928b6e.3.1787423071836;
        Sat, 22 Aug 2026 11:24:31 -0700 (PDT)
Received: from ?IPV6:2600:8803:e7e4:500:e0ca:316a:4629:d835? ([2600:8803:e7e4:500:e0ca:316a:4629:d835])
        by smtp.gmail.com with ESMTPSA id 5614622812f47-4b2d6cdd6cbsm7668245b6e.10.2026.08.22.11.24.29
        (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
        Sat, 22 Aug 2026 11:24:31 -0700 (PDT)
Message-ID: <fb0b857e-eac8-4755-9330-5cfe55523271@baylibre.com>
Date: Sat, 22 Aug 2026 13:24:29 -0500
Precedence: bulk
X-Mailing-List: devicetree@vger.kernel.org
List-Id: <devicetree.vger.kernel.org>
List-Subscribe: <mailto:devicetree+subscribe@vger.kernel.org>
List-Unsubscribe: <mailto:devicetree+unsubscribe@vger.kernel.org>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH v6 6/6] iio: dac: ad5504: support scale via
 output-range-microvolt property
To: Taha Ed-Dafili <0rayn.dev@gmail.com>, jic23@kernel.org, lars@metafoo.de
Cc: Michael.Hennerich@analog.com, robh@kernel.org, krzk+dt@kernel.org,
 conor+dt@kernel.org, nuno.sa@analog.com, andy@kernel.org,
 skhan@linuxfoundation.org, linux@analog.com, linux-iio@vger.kernel.org,
 devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
References: <20260822085850.17527-1-0rayn.dev@gmail.com>
 <20260822085850.17527-7-0rayn.dev@gmail.com>
Content-Language: en-US
From: David Lechner <dlechner@baylibre.com>
In-Reply-To: <20260822085850.17527-7-0rayn.dev@gmail.com>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

On 8/22/26 3:56 AM, Taha Ed-Dafili wrote:
> The AD5504 output range is set by the R_SEL pin, not the VCC supply.
> Add support for 'output-range-microvolt' to set vref_mv directly from
> firmware. Use device_property_present() to distinguish absent from
> malformed property rather than relying on the ambiguous -EINVAL from
> device_property_read_u32_array(). Fall back to the vcc regulator
> voltage for old DTs that predate this property.
> 
> Signed-off-by: Taha Ed-Dafili <0rayn.dev@gmail.com>
> ---
>  drivers/iio/dac/ad5504.c | 31 +++++++++++++++++++++++++------
>  1 file changed, 25 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/iio/dac/ad5504.c b/drivers/iio/dac/ad5504.c
> index 74679feea385..d0a3dd4b000d 100644
> --- a/drivers/iio/dac/ad5504.c
> +++ b/drivers/iio/dac/ad5504.c
> @@ -300,6 +300,7 @@ static int ad5504_probe(struct spi_device *spi)
>  	struct device *dev = &spi->dev;
>  	struct iio_dev *indio_dev;
>  	struct ad5504_state *st;
> +	u32 range[2];
>  	int ret;
>  
>  	indio_dev = devm_iio_device_alloc(dev, sizeof(*st));
> @@ -315,12 +316,30 @@ static int ad5504_probe(struct spi_device *spi)
>  	if (is_acpi_device_node(dev_fwnode(dev))) {
>  		st->vref_mv = AD5504_VREF_ACPI_DEFAULT_mV;
>  	} else {
> -		ret = devm_regulator_get_enable_read_voltage(dev, "vcc");
> -		if (ret < 0)
> -			return dev_err_probe(dev, ret,
> -					     "Failed to get vcc regulator\n");
> -
> -		st->vref_mv = ret / 1000;
> +		if (device_property_present(dev, "output-range-microvolt")) {
> +			ret = device_property_read_u32_array(dev, "output-range-microvolt",
> +							     range, ARRAY_SIZE(range));
> +			if (ret)
> +				return dev_err_probe(dev, ret,
> +							"Error parsing output-range-microvolt\n");
> +
> +			if (range[0] != 0 || (range[1] != 30 * MICRO && range[1] != 60 * MICRO))
> +				return dev_err_probe(dev, -EINVAL,
> +					"Invalid output-range-microvolt\n");
> +
> +			st->vref_mv = range[1] / (MICRO / MILLI);
> +
> +			ret = devm_regulator_get_enable(dev, "vcc");
> +			if (ret < 0)
> +				return dev_err_probe(dev, ret, "Failed to enable vcc regulator\n");

We should probably handle range-sel-gpios here. Otherwise, if a new DT tries
to use it, it will end up falling back to this old wrong behavior.

		} else if (device_property_present("range-sel-gpios")) {
			
Either return an error here that it is not supported. Or implement it by
making IIO_CHAN_INFO_SCALE writable.

> +		} else {
> +			/* Backward compat: old DTs without output-range-microvolt */
> +			ret = devm_regulator_get_enable_read_voltage(dev, "vcc");
> +			if (ret < 0)
> +				return dev_err_probe(dev, ret, "Failed to get vcc regulator\n");
> +
> +			st->vref_mv = ret / (MICRO / MILLI);
> +		}
>  	}
>  
>  	st->spi = spi;


From mboxrd@z Thu Jan  1 00:00:00 1970
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 4985032AAA8
	for <devicetree@vger.kernel.org>; Sat, 22 Aug 2026 19:36:34 +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=1787427395; cv=none; b=b8oiLCyZkBFiDMOsSQYYgD9j36vJc4IHUeYc+HbUoZJAcW+L3FVee26VAA8nseOaAG5qYvlphT6jBTLmmWTOpojoRbkMbq+CK6Sb/QBaWza1lBmNkhSAWgWn/vOtdEEmHuMsrmw41e/R75pIf3hj+lkywFEXHIYWQnDwyDrtvls=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1787427395; c=relaxed/simple;
	bh=MbxEwNo9hWBmu6Qp0a0JvOpRXaZcxRIfF//JVvtLqaI=;
	h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
	 MIME-Version; b=RJfu2IcJvXn/PlJuHBrzdJB2CUSfvcGg/X7SLcCz5s7j+8BoeSYmACPVigwwfhOimSPyEa/yD0bXhJV36BvlkRKoLW7gkPL0cDlG02ddaUDfP0PNh+KlwT/7QtN4z+ZN/dFCMfDwDXO49oIE+4f1k1nYyGmgtckc4HuL6tjgfSY=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=I/4OHsH5; arc=none smtp.client-ip=209.85.221.42
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="I/4OHsH5"
Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-47f71156e1aso784099f8f.3
        for <devicetree@vger.kernel.org>; Sat, 22 Aug 2026 12:36:34 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20251104; t=1787427392; x=1788032192; darn=vger.kernel.org;
        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:content-type;
        bh=MbxEwNo9hWBmu6Qp0a0JvOpRXaZcxRIfF//JVvtLqaI=;
        b=I/4OHsH5l9iGNLTuboskQPS/6dtrL9YwYqKrw0Ufk613I1j2lfRIk4OEG7LL2Mh+zV
         bM8LP5MTJlZZTdfwqMX2FmG2sYxY2wtJa+0CjQ0HJb1GbZ1BeGcKHCyUwXMHps4n0hUK
         B77fHxqNP8Bw86N2/KxXSnLlMfyDcB2+yecLbYvrTgOj8jsChCvwwYGxOqOY9/3vovVM
         JrSmGLC0eSuZVflfMXemW6LE/s2qPl96hzzXLWHwz43zpAzNKLEiwM3a9VOaf534rhen
         vLn0YORH/6Fy3EmE9T3YL7xTwlNJvqznFMuqshfv+m3KXRMKYgIsI+Nv/vsdasSI9lve
         jkXQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20251104; t=1787427392; x=1788032192;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from
         :to:cc:subject:date:message-id:reply-to:content-type;
        bh=MbxEwNo9hWBmu6Qp0a0JvOpRXaZcxRIfF//JVvtLqaI=;
        b=VFjELHd7vLg87COQ+m/UwM3vnKUzKrC3bnx+J0RJNyrHM9DlWX4PTat3WtP+EHw9iM
         ymg4WCeCa+fvTusyrqOv5ePqUycKwfvXDc8B1ZJLOYvEFwMiwJ3CUBfBV39A8rmh1FOU
         j1G0zfR5daBVtvTmwLQNH62ydOEd5MY+fXG7bhUfo593Ap2nexwa9cz/cxjuDry0vK+g
         dwmlsuyqIcgPyitZ5dzhVv2tR63wMBOztm9fU4xuO2mvi9RIiWTHxpzqnlJicuHyYjG1
         LSP8tMNqhZIz5USGUiCslFF2TlDPjrAupW8r05uUYrB+E10x9hTgcJO7NzCgPWUVN1cM
         me/w==
X-Forwarded-Encrypted: i=1; AHgh+Rp8PFaZkIMgg5RHgJ0V/FjflOc00/HjpCIs4/dpcB4AGJZP814JTsqBlvqVmhgvSdYfltJJPOSfTwPa@vger.kernel.org
X-Gm-Message-State: AFuF++miBtdFrcCWlXCuov5j8/MeUWolJzolUQ97npd6oDBvVxjr+6+M
	6CvufTnamtJU9GXTCvyadVKbPZunVVu74sl2qIcgYbEenly2BUIgB0MG
X-Gm-Gg: AR+sD10oow3qHBAa4YbmP1296OkxRmxmyBbpxDsgYys7sKZR5kgQRkkiG8PlLvKwhvt
	JHKXIUGLWpJBTq3LMTT4FuhL3WUPzRNIPmmT4zEtscdMR9BPAZe9LU1QsNhQJUMakQZyLGmUh3y
	X44LxVwN+2lajebmTzxmcwthxXBsYQvzUaKT5gCLj+3LASPzLH2QUql68YtTukcgd765dvBe9TZ
	wUipL/6Pf1n66rsYTC+5hnsUCGBIJLunJLe9Qv0woyLQOCadtgYojZAFMU6KUm81dGFg2Gq3HSt
	IBuKwKIYVthRqfQfQLdrOzwllZg9vFJ77N+rF+cslrz8d8fV1gGa1FcT9G7Xi0VK3Xxz+mRpSWv
	Oedib3ujfvYBHN2+8jmTBa5jSj04Syd2JtCCh3k9O0pv61tflliN7c4KEmf7HTUnnXCXH7/GrKP
	bZjLQFsE2+VPEJFOW/9Q7Vi1au1y2Q2UPvpA/8S5lLKzNTt2AgNiwoFf0XoxffE61alckYl/a1M
	179sB10YQ==
X-Received: by 2002:a05:6000:26d2:b0:47f:8d71:210a with SMTP id ffacd0b85a97d-482c81c5a4emr6272976f8f.15.1787427392334;
        Sat, 22 Aug 2026 12:36:32 -0700 (PDT)
Received: from fedora ([105.74.8.24])
        by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-482c9b855cdsm2878142f8f.16.2026.08.22.12.36.30
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Sat, 22 Aug 2026 12:36:31 -0700 (PDT)
From: Taha Ed-Dafili <0rayn.dev@gmail.com>
To: dlechner@baylibre.com
Cc: 0rayn.dev@gmail.com,
	Michael.Hennerich@analog.com,
	andy@kernel.org,
	conor+dt@kernel.org,
	conor.dooley@microchip.com,
	devicetree@vger.kernel.org,
	jic23@kernel.org,
	krzk+dt@kernel.org,
	lars@metafoo.de,
	linux-iio@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux@analog.com,
	nuno.sa@analog.com,
	robh@kernel.org,
	skhan@linuxfoundation.org
Subject: Re: [PATCH v6 1/6] dt-bindings: iio: dac: ad5504: add output-range and missing gpios
Date: Sat, 22 Aug 2026 15:36:21 -0400
Message-ID: <20260822193621.18800-1-0rayn.dev@gmail.com>
X-Mailer: git-send-email 2.55.0
In-Reply-To: <f35aea7d-0844-426e-ac81-d5b156b60e4a@baylibre.com>
References: <f35aea7d-0844-426e-ac81-d5b156b60e4a@baylibre.com>
Precedence: bulk
X-Mailing-List: devicetree@vger.kernel.org
List-Id: <devicetree.vger.kernel.org>
List-Subscribe: <mailto:devicetree+subscribe@vger.kernel.org>
List-Unsubscribe: <mailto:devicetree+unsubscribe@vger.kernel.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

> This is one that is starting to emerging as a common name, so I would
> call it clear-gpios instead to match the same name on chips with a
> similar function.

Worth noting Nuno asked for the opposite in v2 review, specifically
to match the datasheet's /CLR pin name:

https://lore.kernel.org/linux-iio/a79296dc96215a579c29c5c9eda464f818f050d6.camel@gmail.com/

Let me know which name you'd prefer given that context, and I'll
update it in v7.

Best Regards,
Taha Ed-Dafili

From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47])
	(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 ACF392EEE65
	for <devicetree@vger.kernel.org>; Sat, 22 Aug 2026 19:45:20 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1787427922; cv=none; b=iMmJZ4ZksmpAOSlKaVrwHe7MT0KL3ZbpjRtmg6J0vMP2Zo8IKwZZBFlXkdKsTWeIJTn2e4aykb6Wp69Nsg5L+sAH5eWB9Ef7xitChIV5GuxUa2Vqf3oyzHHNHJoSCkzkhhBcwJR43PpqD+wGnzHmaBUvoYj+C0h9c8NV7LOlgwE=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1787427922; c=relaxed/simple;
	bh=8Qig20Vn1Z39mL/aPI0UZZpoHMcdtsF7kx5Ekyaw5xc=;
	h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:
	 MIME-Version; b=O+Pxjooja568Q3Ezn7Y+I5zq4A3JB+ILAJd4+8Gyk8weqR1W1nzoV7WXhvdlNL22YpAGJP2P/7kp2EptogsA3ZrTvcx4HdeBDWAEngvxe+OU+Y6xLDba8XdURZWVqBb7awgQo83AWpoplvMw+weOXTVmmnFbWrweK/X9Z8NYbgA=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=UaItmTq0; arc=none smtp.client-ip=209.85.128.47
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UaItmTq0"
Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-4998e0916faso13370055e9.2
        for <devicetree@vger.kernel.org>; Sat, 22 Aug 2026 12:45:20 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20251104; t=1787427919; x=1788032719; darn=vger.kernel.org;
        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:content-type;
        bh=8Qig20Vn1Z39mL/aPI0UZZpoHMcdtsF7kx5Ekyaw5xc=;
        b=UaItmTq0/aOb78MI7RCW+m3E1neKc6PiOpHa3+nfuLYPY1cL5nsFJrV1eJSh9DGxq4
         52+DoJV15yssFXrw3aMNBU53p5PAoRCi8XaeVKIfiHj8kG2wzCC0dvPqEH9y70AYPedR
         uS2Rhfp+msL6RNsQ17a2F65WqFOmhxkjytZTZBDky5RvDLxuw9dWHG2dOF2kBL2EyfZ9
         ZJQQPG18corrP7M+Paoea3nLs7N8tppBEnmgAibMnG+FSkdWUq9Eq3sxz6NytKzowQPD
         eCBsg7KT5gViiMbRpq9zwGsOSxQ5atgNmA1y1pV9zlAn/ZccVoTlzmGCqYZPf5veC4hQ
         IOdA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20251104; t=1787427919; x=1788032719;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from
         :to:cc:subject:date:message-id:reply-to:content-type;
        bh=8Qig20Vn1Z39mL/aPI0UZZpoHMcdtsF7kx5Ekyaw5xc=;
        b=Qrm12tN9Ccc1XLyHQEBQ3VE70E1bhrC45xeJM9zp0bT4/tBMchap9k3dNXLHOjYMo5
         OynhGNlD8NBxKWOcs8JxxELju6+pbOUFq9YdQua5zaEUWB4w+SAvuLIxzfO5fqknQio/
         BYjvKqITcTyD59aOy+vjqdbLG3HvTxeh4q01SjgfMMTEH/7VBPO83BelbWKPEt80o4nh
         DN/qY03trVThk48BesB0OYpP1ZASaRTmgDOG6jzn9T6q4LJVIW7D1rSDk0UvTLZ6eoHe
         cGQOPp4/2tZUzKI/03O5rwNrQHh7PinLivj4ijPLb5h0VbsYHZn/kmCkgSg0H/9Zkagi
         RC9A==
X-Forwarded-Encrypted: i=1; AHgh+RrH1kKFmyFI9Xwdnce6IXrYhHQfG88Bh+95bQuFVFee+B9kOzD7scvFfvycID3ja6DaDozXFJ3erY18@vger.kernel.org
X-Gm-Message-State: AFuF++mux8KfFCXQ/wdg67qAcJt4btcZT00k3S6TAs8xqPi3EFESuN13
	EaaAGxxDCVueGUSeYcItPIPI1FnZyjWuN6hCG2uoxcHTSi19ifHIm1dW
X-Gm-Gg: AR+sD10AD7bmtimWEh4vJgTO+aMVHc8f/KNt/jFnu7vkXA0hFubPn3HIZumZj6cd/gM
	+sgzdYQsMuG+pjfqKAp5img9moQ6abXcn/U9dfrM3fM9SylPOadVCXMgT9L6ogbId5fjebB2c5G
	/q03iuX+JSnQkfht6QPgQeC7un920njmjiok3TBQ1YXUboLxfnRA3oaAvwxfCHcx0xui3Dg0N7P
	MwDx/he5NI+g/7UHlijBK7JLN2uUO5L3Z2RhoQCNzTqzn8ezjM5t3TeiVnkvb4b4VOt5UtDzPjh
	+scglvLODt5o8eK7xEbNGY72FSckjwkLc2ai7qqG8+sDhda+0lVHp8UkUmjkwH86zduUShYjwIc
	iKP6zNYEqmNda/9OstRhCw33jgugpaveEPVp3UoTA1EHfEvX9lnPc5mF7dTbIETPswbFKSH7d4g
	K1zd7cY5Xp8v0sbctpGyF2wtLfjkpFa7Qu5dOVyEzvvG+RfPSPibWdbp5OgnBn9frrRiNsq9OMv
	/eP0leoBg==
X-Received: by 2002:a05:600c:608f:b0:499:a4d1:d7d9 with SMTP id 5b1f17b1804b1-499c19d7367mr69091855e9.9.1787427918747;
        Sat, 22 Aug 2026 12:45:18 -0700 (PDT)
Received: from fedora ([105.74.8.24])
        by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-499bd581a49sm31267215e9.1.2026.08.22.12.45.16
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Sat, 22 Aug 2026 12:45:18 -0700 (PDT)
From: Taha Ed-Dafili <0rayn.dev@gmail.com>
To: dlechner@baylibre.com
Cc: 0rayn.dev@gmail.com,
	Michael.Hennerich@analog.com,
	andy@kernel.org,
	conor+dt@kernel.org,
	devicetree@vger.kernel.org,
	jic23@kernel.org,
	krzk+dt@kernel.org,
	lars@metafoo.de,
	linux-iio@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux@analog.com,
	nuno.sa@analog.com,
	robh@kernel.org,
	skhan@linuxfoundation.org
Subject: Re: [PATCH v6 6/6] iio: dac: ad5504: support scale via output-range-microvolt property
Date: Sat, 22 Aug 2026 15:45:05 -0400
Message-ID: <20260822194505.20389-1-0rayn.dev@gmail.com>
X-Mailer: git-send-email 2.55.0
In-Reply-To: <fb0b857e-eac8-4755-9330-5cfe55523271@baylibre.com>
References: <fb0b857e-eac8-4755-9330-5cfe55523271@baylibre.com>
Precedence: bulk
X-Mailing-List: devicetree@vger.kernel.org
List-Id: <devicetree.vger.kernel.org>
List-Subscribe: <mailto:devicetree+subscribe@vger.kernel.org>
List-Unsubscribe: <mailto:devicetree+unsubscribe@vger.kernel.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

> We should probably handle range-sel-gpios here. Otherwise, if a new
> DT tries to use it, it will end up falling back to this old wrong
> behavior.
>
> Either return an error here that it is not supported. Or implement
> it by making IIO_CHAN_INFO_SCALE writable.

Thank you for catching that. For now I'll return an error in that
case, we can always expand it later if needed.

Best Regards,
Taha Ed-Dafili

From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from mail-oa1-f41.google.com (mail-oa1-f41.google.com [209.85.160.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 646FC35677B
	for <devicetree@vger.kernel.org>; Sat, 22 Aug 2026 22:37:27 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.41
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1787438249; cv=none; b=cCrtgrmlAmsiQRn+V5cqsmCEIQrVqDNYs2VpXAyk84xlYn87siMsYhg/gDByyt74u6r7bT+tcPGFJJBPBWRDRhPDVp+1ef2h3EIVH/14Jt1iEBIhDNO4ockaDtgavbRoKdVURQNWEnULZZuXrGMIy/1BD+LRLPcraz3lHQtHKNk=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1787438249; c=relaxed/simple;
	bh=DH+J42rJRU47iRWVqVay7ZwyKA1pmoS9rIXhXaUE1ZY=;
	h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:
	 In-Reply-To:Content-Type; b=AExHs1t1/xOdckes1UNpH2HJsnCk4ARPMP2UgKH1Bm4RCVY1gCOk32oof5lbP1sFsPupHIe4AoL14mo0qQcvKNAWBV7jHZpzZPjAKg9UYVLQFhcC4WkHnO+KdLBU52xnHs/iTZYJSGXtRlVhwVvdozXrWCpwO1uLuJg2yqOiRdU=
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 header.i=@baylibre.com header.b=HJkHYFBv; arc=none smtp.client-ip=209.85.160.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 header.i=@baylibre.com header.b="HJkHYFBv"
Received: by mail-oa1-f41.google.com with SMTP id 586e51a60fabf-44cd237446cso1926312fac.1
        for <devicetree@vger.kernel.org>; Sat, 22 Aug 2026 15:37:27 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=baylibre.com; s=google; t=1787438246; x=1788043046; darn=vger.kernel.org;
        h=content-transfer-encoding:content-type:in-reply-to:from
         :content-language:references:cc:to:subject:user-agent:mime-version
         :date:message-id:from:to:cc:subject:date:message-id:reply-to
         :content-type;
        bh=CpJFDAtg7SWcM0ZQElBMQw5ahKUR/8XcA/uOWdRC5MA=;
        b=HJkHYFBvDlqwO+XFzEhCHWA+ZPus8DlnfUjrNsVmYeLRSsB+2mfbKijy4hd15huDGq
         Tx7qbT0Ruo8AsmuTEbUxN6CWHa1sV7BfNBzdjWaDpDK1tuGgq9Vm7RRg2qVnL7hUG4Zm
         AGuBkUbOBmo+9jVN3PNxjOQPQ7c3Ov8Ah3V0mraC/ezs/H/qX3NV70LKETdnRZ/Jxa7H
         JVakQjO5SGu9AUggdHr/eOUDhM5Ec5SwGmGeqhAaH+2DP7+nBgUobINY5fpX/SV5FjPM
         TAfs1PhiyiOLYnMuN8RnfK5xs0QWrV5OqO3tfR/gvh7QtZAxJE/ckYuqmUWQOgyTbcCY
         l+Fw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20251104; t=1787438246; x=1788043046;
        h=content-transfer-encoding:content-type:in-reply-to:from
         :content-language:references:cc:to:subject:user-agent:mime-version
         :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
         :message-id:reply-to:content-type;
        bh=CpJFDAtg7SWcM0ZQElBMQw5ahKUR/8XcA/uOWdRC5MA=;
        b=WorLRiJjs94aypgUlYRsBg8vgC6enum7JxyrcJq60bSiKTa66p9z4+hRQAzkoKRBrD
         /qhoKSomjutb9ZvcHI3cZ7XvK2BhIp3561qip2q66FQTclpou/FoBemGuV/xJXuzA25b
         Dtcu6UE+WvI5QILDQ+XdoS9GUA5dd0cMYqDZn8QAW9msKMHZ050GV5+z+VOE0rgV4Tog
         EiSHEFxdGLR9fe2FnvwG0aaXOSjv72OMSyyFWpIpf0ZQ0JXT+P4kc7+CvEhzCRK2BpbB
         N8tGNJg3AIVFZmNv26TTeXiYi8LXt9lSxaur8e36U68+MvaWMoapVRcQYksMHXoeh+IQ
         nRSQ==
X-Forwarded-Encrypted: i=1; AHgh+RqltTXVQG5SiIWyMqNirIr2mGPRGZSIQaOk3t1K+CHesV4WAWbXH8H1a9dVEMwDZwf4LBQyj4ng2yuM@vger.kernel.org
X-Gm-Message-State: AFuF++ndfkdJIurwyXxPUOr8ARFUbmGtmNdaFcYUlxub43lncVhVGF2f
	sFhVy/7rW1JXxmNankBs7zJ2zkB2tlcD86aVCihR+Yc4CAnFqw4IF7Shv2/S425c408=
X-Gm-Gg: AR+sD139V4nU/yv9O9iUkGANxoq+V+BqKOlanNA+3kLMsgNPXZkJfIyjptLZDkXLOgC
	QH5E8iDnB/QotGFdGS+JCkeNr1dgv4QU36ROy972NnnXkY3aLAGzTq/npuwj99wWi8Xb2ElPSqT
	ob82j6Dqy5XO6gmIOcsybA2n0EZEcIMqtBIxo1koU1CKXQNE6oeBNyrQt2JodAqgW93BoP+jL6I
	u7Q97tbJ2tIVxd5A4mts7Zo4os5rfurU7xk9j3Wqf2AWx0Gncmm+GfeOpIJlO+ZtS4U9NP99cQ0
	t+vJ1YVQGvzgAiLWyQmNv+vOSjMQsus4mhysk0OhnFh042iOSixfVYmjm9gyQ9TDQyDC5W+1qT/
	/Yr+vidWOMiFyPjidX5bjBex+Z3Q52PzXmOGgfDEQQTouKwHsNxA3meDtpU3+eS7h6mvtEW2axN
	YvcMn+KGEhiOJe8bPzGByOQy9J4IhyFjJZWDniseJ+iAuql2gELPZSXsvUJM11r10TEaZV1oG6k
	h27QQvWfLbqxwU/wsd6yEtcbS29cuEFucVzo9Q=
X-Received: by 2002:a05:6870:4589:b0:448:89e3:4c58 with SMTP id 586e51a60fabf-463514dfc38mr16883387fac.18.1787438246236;
        Sat, 22 Aug 2026 15:37:26 -0700 (PDT)
Received: from ?IPV6:2600:8803:e7e4:500:e0ca:316a:4629:d835? ([2600:8803:e7e4:500:e0ca:316a:4629:d835])
        by smtp.gmail.com with ESMTPSA id 586e51a60fabf-4638354650dsm2255165fac.16.2026.08.22.15.37.23
        (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
        Sat, 22 Aug 2026 15:37:24 -0700 (PDT)
Message-ID: <c34ed727-9ece-48f4-a7b7-45b0f5f558e3@baylibre.com>
Date: Sat, 22 Aug 2026 17:37:22 -0500
Precedence: bulk
X-Mailing-List: devicetree@vger.kernel.org
List-Id: <devicetree.vger.kernel.org>
List-Subscribe: <mailto:devicetree+subscribe@vger.kernel.org>
List-Unsubscribe: <mailto:devicetree+unsubscribe@vger.kernel.org>
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: [PATCH v6 1/6] dt-bindings: iio: dac: ad5504: add output-range
 and missing gpios
To: Taha Ed-Dafili <0rayn.dev@gmail.com>
Cc: Michael.Hennerich@analog.com, andy@kernel.org, conor+dt@kernel.org,
 conor.dooley@microchip.com, devicetree@vger.kernel.org, jic23@kernel.org,
 krzk+dt@kernel.org, lars@metafoo.de, linux-iio@vger.kernel.org,
 linux-kernel@vger.kernel.org, linux@analog.com, nuno.sa@analog.com,
 robh@kernel.org, skhan@linuxfoundation.org
References: <f35aea7d-0844-426e-ac81-d5b156b60e4a@baylibre.com>
 <20260822193621.18800-1-0rayn.dev@gmail.com>
Content-Language: en-US
From: David Lechner <dlechner@baylibre.com>
In-Reply-To: <20260822193621.18800-1-0rayn.dev@gmail.com>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

On 8/22/26 2:36 PM, Taha Ed-Dafili wrote:
>> This is one that is starting to emerging as a common name, so I would
>> call it clear-gpios instead to match the same name on chips with a
>> similar function.
> 
> Worth noting Nuno asked for the opposite in v2 review, specifically
> to match the datasheet's /CLR pin name:

Normally I advocate for matching the pin name too. But there are some common
things like reset-gpios where we try to always use the same name. This clear
input seems to be one of those common things.

> 
> https://lore.kernel.org/linux-iio/a79296dc96215a579c29c5c9eda464f818f050d6.camel@gmail.com/
> 
> Let me know which name you'd prefer given that context, and I'll
> update it in v7.
> 
> Best Regards,
> Taha Ed-Dafili


There is only one binding currently with clr-gpios (adi,ltc2688).

And only one with clear-gpios (adi,ad5791). Plus at least two more coming
soon [1] [2].

In [3], there is a /CLR pin, but we called it reset-gpios because it also
resets the control registers.

I didn't re-check the datasheets on all of these, but hopefully we are being
consistent.

[1]: https://lore.kernel.org/linux-iio/20260820-ad5529r-driver-v9-2-ba62e0b2a816@analog.com/
[2]: https://lore.kernel.org/linux-iio/20260802-dac8163-work-v3-1-3ecc7bc66d0d@gmx.net/
[3]: https://lore.kernel.org/linux-iio/20240714133000.5866-5-kimseer.paller@analog.com/




From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8417426F2BF;
	Sun, 23 Aug 2026 01:36:21 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18
ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1787448982; cv=none; b=gQxh5AUc5s/E78LWowK3zxO8hMdZVk56iL4KcsJ65+e1+xRpoxDCRUjlWJW6WjiIhur1Vcw7qjfZ7BPkiHW3EVyHdERC0Eor6losraV5O6G3slDmEr8/mPPq/h8/v8ayFCYGw6fkl10vGkFeLTsJ6fhdzEo9tU4+hvxxgxlBE30=
ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1787448982; c=relaxed/simple;
	bh=rGy1C5KTGmpezarM35jPwARJEsjZ/lcCaKEJ0PglKRc=;
	h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References:
	 MIME-Version:Content-Type; b=GvPJPh79/iXhcawhV6n1a72m+iplMDmJswH04njHzxZn2hYh6l6ecv9UNLikMxzQVq/D/YXtLnVDn/TmqKFTrGGmTJK459C8GvZX95Bwo61duHXjdESNdRBzguuwU++jVEzIFlMtrScvnAo8EuVEIA+UJE3lt5cebVBnpSAPFlQ=
ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=fTlq7o8W; arc=none smtp.client-ip=100.103.45.18
Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="fTlq7o8W"
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 626E71F000E9;
	Sun, 23 Aug 2026 01:36:17 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1787448981;
	bh=ZMyHtFrQUE8eFUZwUf19+PrFwGzliaDJUM4zDSpNMvU=;
	h=Date:From:To:Cc:Subject:In-Reply-To:References;
	b=fTlq7o8Wz+pa5H/3X4aaFELD32YVuO/MJHtZmPre8cQlQGAhm7hgh0PSzXJRfBH7S
	 dllZ3QbJTWARGBcd1sZQxRuAzqZxq1WLz9o3iFDHHiv4RnNgb/Ai/K/daCYTjg5v6t
	 rswbErNTDXltrA7Sq8MS+1S6nrouJAXyDgcKXK5jHJEhEaaKBj+zuA9kbxlaiaLexp
	 L6DKmw2smSGX1xXWXHC4rNE6zcIQsH0RUkyWLENxXA0zoqFeyQdztZshzLpU+o5Xnl
	 5vfP1PWlV2b/YuNhWFTxJGrzDVHzBGGijlvEYRx/1vVCpuXujVpnZD9XtVvTOAIV/I
	 Xz3XdNTU3FU+A==
Date: Sun, 23 Aug 2026 02:36:13 +0100
From: Jonathan Cameron <jic23@kernel.org>
To: David Lechner <dlechner@baylibre.com>
Cc: Taha Ed-Dafili <0rayn.dev@gmail.com>, Michael.Hennerich@analog.com,
 andy@kernel.org, conor+dt@kernel.org, conor.dooley@microchip.com,
 devicetree@vger.kernel.org, krzk+dt@kernel.org, lars@metafoo.de,
 linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux@analog.com,
 nuno.sa@analog.com, robh@kernel.org, skhan@linuxfoundation.org
Subject: Re: [PATCH v6 1/6] dt-bindings: iio: dac: ad5504: add output-range
 and missing gpios
Message-ID: <20260823023613.077ea05d@jic23-huawei>
In-Reply-To: <c34ed727-9ece-48f4-a7b7-45b0f5f558e3@baylibre.com>
References: <f35aea7d-0844-426e-ac81-d5b156b60e4a@baylibre.com>
	<20260822193621.18800-1-0rayn.dev@gmail.com>
	<c34ed727-9ece-48f4-a7b7-45b0f5f558e3@baylibre.com>
X-Mailer: Claws Mail 4.4.0 (GTK 3.24.52; x86_64-pc-linux-gnu)
Precedence: bulk
X-Mailing-List: devicetree@vger.kernel.org
List-Id: <devicetree.vger.kernel.org>
List-Subscribe: <mailto:devicetree+subscribe@vger.kernel.org>
List-Unsubscribe: <mailto:devicetree+unsubscribe@vger.kernel.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit

On Sat, 22 Aug 2026 17:37:22 -0500
David Lechner <dlechner@baylibre.com> wrote:

> On 8/22/26 2:36 PM, Taha Ed-Dafili wrote:
> >> This is one that is starting to emerging as a common name, so I would
> >> call it clear-gpios instead to match the same name on chips with a
> >> similar function.  
> > 
> > Worth noting Nuno asked for the opposite in v2 review, specifically
> > to match the datasheet's /CLR pin name:  
> 
> Normally I advocate for matching the pin name too. But there are some common
> things like reset-gpios where we try to always use the same name. This clear
> input seems to be one of those common things.
> 
> > 
> > https://lore.kernel.org/linux-iio/a79296dc96215a579c29c5c9eda464f818f050d6.camel@gmail.com/
> > 
> > Let me know which name you'd prefer given that context, and I'll
> > update it in v7.
> > 
> > Best Regards,
> > Taha Ed-Dafili  
> 
> 
> There is only one binding currently with clr-gpios (adi,ltc2688).

That one is a reset I think. Includes "The control registers are cleared
to default values".  It sort of clears the DAC as the default is 0V
So probably like 3 below.

> 
> And only one with clear-gpios (adi,ad5791). Plus at least two more coming
> soon [1] [2].
ad5701 clr sets it to a user defined value..  If that's left as default it
sets to 0. That does overwrite the dac register (table 9)

ad5529r actually calls it clear on the datasheet. And just sets DAC outputs
to 0 (including the registers)

dac8163 is 0 scale, or mid scale depending on part. Registers written.
> 
> In [3], there is a /CLR pin, but we called it reset-gpios because it also
> resets the control registers.
> 
> I didn't re-check the datasheets on all of these, but hopefully we are being
> consistent.
Other than the one that maybe should have been a reset and isn't :(

They aren't quite the same across parts but close enough perhaps to generalize
the binding with some flexibility in the description.

Jonathan

> 
> [1]: https://lore.kernel.org/linux-iio/20260820-ad5529r-driver-v9-2-ba62e0b2a816@analog.com/
> [2]: https://lore.kernel.org/linux-iio/20260802-dac8163-work-v3-1-3ecc7bc66d0d@gmx.net/
> [3]: https://lore.kernel.org/linux-iio/20240714133000.5866-5-kimseer.paller@analog.com/
> 
> 
> 
> 


