Linux IIO development
 help / color / mirror / Atom feed
* [PATCH 0/2] Fix AD3531/AD3531R powerdown modes
@ 2026-05-05  4:34 Kim Seer Paller
  2026-05-05  4:34 ` [PATCH 1/2] iio: ABI: Add DAC 500ohm, 3.85kohm, and 16kohm " Kim Seer Paller
  2026-05-05  4:34 ` [PATCH 2/2] iio: dac: ad3530r: Fix AD3531/AD3531R powerdown mode strings Kim Seer Paller
  0 siblings, 2 replies; 5+ messages in thread
From: Kim Seer Paller @ 2026-05-05  4:34 UTC (permalink / raw)
  To: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
	Lars-Peter Clausen, Michael Hennerich
  Cc: linux-iio, linux-kernel, Kim Seer Paller, Jonathan Cameron

The AD3531/AD3531R has different powerdown output impedance modes from
the AD3530/AD3530R. The driver currently uses the AD3530R modes (1k,
7.7k, 32k) for all variants, which is incorrect for the AD3531/AD3531R
which has 500 Ohm, 3.85 kOhm, and 16 kOhm modes per the datasheet.

This series adds the missing ABI entries for the new powerdown modes
and fixes the driver to use the correct mode strings for AD3531/AD3531R
chip variants.

Signed-off-by: Kim Seer Paller <kimseer.paller@analog.com>
---
Kim Seer Paller (2):
      iio: ABI: Add DAC 500ohm, 3.85kohm, and 16kohm powerdown modes
      iio: dac: ad3530r: Fix AD3531/AD3531R powerdown mode strings

 Documentation/ABI/testing/sysfs-bus-iio |  3 ++
 drivers/iio/dac/ad3530r.c               | 54 ++++++++++++++++++++++++---------
 2 files changed, 43 insertions(+), 14 deletions(-)
---
base-commit: 39b80c5c9830d12d2d6531059001301c4265322a
change-id: 20260505-dev-ad3531r-2a3091fc7c12

Best regards,
--  
Kim Seer Paller <kimseer.paller@analog.com>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] iio: ABI: Add DAC 500ohm, 3.85kohm, and 16kohm powerdown modes
  2026-05-05  4:34 [PATCH 0/2] Fix AD3531/AD3531R powerdown modes Kim Seer Paller
@ 2026-05-05  4:34 ` Kim Seer Paller
  2026-05-06 16:23   ` Jonathan Cameron
  2026-05-05  4:34 ` [PATCH 2/2] iio: dac: ad3530r: Fix AD3531/AD3531R powerdown mode strings Kim Seer Paller
  1 sibling, 1 reply; 5+ messages in thread
From: Kim Seer Paller @ 2026-05-05  4:34 UTC (permalink / raw)
  To: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
	Lars-Peter Clausen, Michael Hennerich
  Cc: linux-iio, linux-kernel, Kim Seer Paller, Jonathan Cameron

Add powerdown mode entries for DACs with 500 Ohm, 3.85 kOhm, and
16 kOhm resistor to ground output impedance states. These are used
by the AD3531/AD3531R 4-channel DAC.

Signed-off-by: Kim Seer Paller <kimseer.paller@analog.com>
---
 Documentation/ABI/testing/sysfs-bus-iio | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio
index 60dfeff8f2c9..925a33fd309a 100644
--- a/Documentation/ABI/testing/sysfs-bus-iio
+++ b/Documentation/ABI/testing/sysfs-bus-iio
@@ -764,10 +764,13 @@ Contact:	linux-iio@vger.kernel.org
 Description:
 		Specifies the output powerdown mode.
 		DAC output stage is disconnected from the amplifier and
+		500ohm_to_gnd: connected to ground via a 500Ohm resistor,
 		1kohm_to_gnd: connected to ground via an 1kOhm resistor,
 		2.5kohm_to_gnd: connected to ground via a 2.5kOhm resistor,
+		3.85kohm_to_gnd: connected to ground via a 3.85kOhm resistor,
 		6kohm_to_gnd: connected to ground via a 6kOhm resistor,
 		7.7kohm_to_gnd: connected to ground via a 7.7kOhm resistor,
+		16kohm_to_gnd: connected to ground via a 16kOhm resistor,
 		20kohm_to_gnd: connected to ground via a 20kOhm resistor,
 		32kohm_to_gnd: connected to ground via a 32kOhm resistor,
 		42kohm_to_gnd: connected to ground via a 42kOhm resistor,

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] iio: dac: ad3530r: Fix AD3531/AD3531R powerdown mode strings
  2026-05-05  4:34 [PATCH 0/2] Fix AD3531/AD3531R powerdown modes Kim Seer Paller
  2026-05-05  4:34 ` [PATCH 1/2] iio: ABI: Add DAC 500ohm, 3.85kohm, and 16kohm " Kim Seer Paller
@ 2026-05-05  4:34 ` Kim Seer Paller
  2026-05-06 16:25   ` Jonathan Cameron
  1 sibling, 1 reply; 5+ messages in thread
From: Kim Seer Paller @ 2026-05-05  4:34 UTC (permalink / raw)
  To: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
	Lars-Peter Clausen, Michael Hennerich
  Cc: linux-iio, linux-kernel, Kim Seer Paller, Jonathan Cameron

The AD3531/AD3531R has different output operating modes from the
AD3530/AD3530R. According to the AD3531/AD3531R datasheet, the
powerdown modes are:
  01: 500 Ohm output impedance
  10: 3.85 kOhm output impedance
  11: 16 kOhm output impedance

The driver currently uses the AD3530R modes (1k, 7.7k, 32k) for all
variants, which is incorrect for AD3531/AD3531R.

Add AD3531R-specific powerdown mode strings and assign them to the
AD3531/AD3531R chip variants.

Fixes: 93583174a3df ("iio: dac: ad3530r: Add driver for AD3530R and AD3531R")
Signed-off-by: Kim Seer Paller <kimseer.paller@analog.com>
---
 drivers/iio/dac/ad3530r.c | 54 +++++++++++++++++++++++++++++++++++------------
 1 file changed, 40 insertions(+), 14 deletions(-)

diff --git a/drivers/iio/dac/ad3530r.c b/drivers/iio/dac/ad3530r.c
index b97b46090d80..d9db3226ecd6 100644
--- a/drivers/iio/dac/ad3530r.c
+++ b/drivers/iio/dac/ad3530r.c
@@ -105,6 +105,12 @@ static const char * const ad3530r_powerdown_modes[] = {
 	"32kohm_to_gnd",
 };
 
+static const char * const ad3531r_powerdown_modes[] = {
+	"500ohm_to_gnd",
+	"3.85kohm_to_gnd",
+	"16kohm_to_gnd",
+};
+
 static int ad3530r_get_powerdown_mode(struct iio_dev *indio_dev,
 				      const struct iio_chan_spec *chan)
 {
@@ -133,6 +139,13 @@ static const struct iio_enum ad3530r_powerdown_mode_enum = {
 	.set = ad3530r_set_powerdown_mode,
 };
 
+static const struct iio_enum ad3531r_powerdown_mode_enum = {
+	.items = ad3531r_powerdown_modes,
+	.num_items = ARRAY_SIZE(ad3531r_powerdown_modes),
+	.get = ad3530r_get_powerdown_mode,
+	.set = ad3530r_set_powerdown_mode,
+};
+
 static ssize_t ad3530r_get_dac_powerdown(struct iio_dev *indio_dev,
 					 uintptr_t private,
 					 const struct iio_chan_spec *chan,
@@ -276,7 +289,20 @@ static const struct iio_chan_spec_ext_info ad3530r_ext_info[] = {
 	{ }
 };
 
-#define AD3530R_CHAN(_chan)					\
+static const struct iio_chan_spec_ext_info ad3531r_ext_info[] = {
+	{
+		.name = "powerdown",
+		.shared = IIO_SEPARATE,
+		.read = ad3530r_get_dac_powerdown,
+		.write = ad3530r_set_dac_powerdown,
+	},
+	IIO_ENUM("powerdown_mode", IIO_SEPARATE, &ad3531r_powerdown_mode_enum),
+	IIO_ENUM_AVAILABLE("powerdown_mode", IIO_SHARED_BY_TYPE,
+			   &ad3531r_powerdown_mode_enum),
+	{ }
+};
+
+#define AD3530R_CHAN(_chan, _ext_info)				\
 {								\
 	.type = IIO_VOLTAGE,					\
 	.indexed = 1,						\
@@ -284,25 +310,25 @@ static const struct iio_chan_spec_ext_info ad3530r_ext_info[] = {
 	.output = 1,						\
 	.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |		\
 			      BIT(IIO_CHAN_INFO_SCALE),		\
-	.ext_info = ad3530r_ext_info,				\
+	.ext_info = _ext_info,					\
 }
 
 static const struct iio_chan_spec ad3530r_channels[] = {
-	AD3530R_CHAN(0),
-	AD3530R_CHAN(1),
-	AD3530R_CHAN(2),
-	AD3530R_CHAN(3),
-	AD3530R_CHAN(4),
-	AD3530R_CHAN(5),
-	AD3530R_CHAN(6),
-	AD3530R_CHAN(7),
+	AD3530R_CHAN(0, ad3530r_ext_info),
+	AD3530R_CHAN(1, ad3530r_ext_info),
+	AD3530R_CHAN(2, ad3530r_ext_info),
+	AD3530R_CHAN(3, ad3530r_ext_info),
+	AD3530R_CHAN(4, ad3530r_ext_info),
+	AD3530R_CHAN(5, ad3530r_ext_info),
+	AD3530R_CHAN(6, ad3530r_ext_info),
+	AD3530R_CHAN(7, ad3530r_ext_info),
 };
 
 static const struct iio_chan_spec ad3531r_channels[] = {
-	AD3530R_CHAN(0),
-	AD3530R_CHAN(1),
-	AD3530R_CHAN(2),
-	AD3530R_CHAN(3),
+	AD3530R_CHAN(0, ad3531r_ext_info),
+	AD3530R_CHAN(1, ad3531r_ext_info),
+	AD3530R_CHAN(2, ad3531r_ext_info),
+	AD3530R_CHAN(3, ad3531r_ext_info),
 };
 
 static const struct ad3530r_chip_info ad3530_chip = {

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] iio: ABI: Add DAC 500ohm, 3.85kohm, and 16kohm powerdown modes
  2026-05-05  4:34 ` [PATCH 1/2] iio: ABI: Add DAC 500ohm, 3.85kohm, and 16kohm " Kim Seer Paller
@ 2026-05-06 16:23   ` Jonathan Cameron
  0 siblings, 0 replies; 5+ messages in thread
From: Jonathan Cameron @ 2026-05-06 16:23 UTC (permalink / raw)
  To: Kim Seer Paller
  Cc: David Lechner, Nuno Sá, Andy Shevchenko, Lars-Peter Clausen,
	Michael Hennerich, linux-iio, linux-kernel

On Tue, 5 May 2026 12:34:31 +0800
Kim Seer Paller <kimseer.paller@analog.com> wrote:

> Add powerdown mode entries for DACs with 500 Ohm, 3.85 kOhm, and
> 16 kOhm resistor to ground output impedance states. These are used
> by the AD3531/AD3531R 4-channel DAC.
> 
> Signed-off-by: Kim Seer Paller <kimseer.paller@analog.com>
Applied this one to the testing branch of iio.git.
I'm not bothered if the docs take a while to chase the fix
as not so important to backport given the meaning is obvious enough
and this is really just about completeness.

> ---
>  Documentation/ABI/testing/sysfs-bus-iio | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio
> index 60dfeff8f2c9..925a33fd309a 100644
> --- a/Documentation/ABI/testing/sysfs-bus-iio
> +++ b/Documentation/ABI/testing/sysfs-bus-iio
> @@ -764,10 +764,13 @@ Contact:	linux-iio@vger.kernel.org
>  Description:
>  		Specifies the output powerdown mode.
>  		DAC output stage is disconnected from the amplifier and
> +		500ohm_to_gnd: connected to ground via a 500Ohm resistor,
>  		1kohm_to_gnd: connected to ground via an 1kOhm resistor,
>  		2.5kohm_to_gnd: connected to ground via a 2.5kOhm resistor,
> +		3.85kohm_to_gnd: connected to ground via a 3.85kOhm resistor,
>  		6kohm_to_gnd: connected to ground via a 6kOhm resistor,
>  		7.7kohm_to_gnd: connected to ground via a 7.7kOhm resistor,
> +		16kohm_to_gnd: connected to ground via a 16kOhm resistor,
>  		20kohm_to_gnd: connected to ground via a 20kOhm resistor,
>  		32kohm_to_gnd: connected to ground via a 32kOhm resistor,
>  		42kohm_to_gnd: connected to ground via a 42kOhm resistor,
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] iio: dac: ad3530r: Fix AD3531/AD3531R powerdown mode strings
  2026-05-05  4:34 ` [PATCH 2/2] iio: dac: ad3530r: Fix AD3531/AD3531R powerdown mode strings Kim Seer Paller
@ 2026-05-06 16:25   ` Jonathan Cameron
  0 siblings, 0 replies; 5+ messages in thread
From: Jonathan Cameron @ 2026-05-06 16:25 UTC (permalink / raw)
  To: Kim Seer Paller
  Cc: David Lechner, Nuno Sá, Andy Shevchenko, Lars-Peter Clausen,
	Michael Hennerich, linux-iio, linux-kernel

On Tue, 5 May 2026 12:34:32 +0800
Kim Seer Paller <kimseer.paller@analog.com> wrote:

> The AD3531/AD3531R has different output operating modes from the
> AD3530/AD3530R. According to the AD3531/AD3531R datasheet, the
> powerdown modes are:
>   01: 500 Ohm output impedance
>   10: 3.85 kOhm output impedance
>   11: 16 kOhm output impedance
> 
> The driver currently uses the AD3530R modes (1k, 7.7k, 32k) for all
> variants, which is incorrect for AD3531/AD3531R.
> 
> Add AD3531R-specific powerdown mode strings and assign them to the
> AD3531/AD3531R chip variants.
> 
> Fixes: 93583174a3df ("iio: dac: ad3530r: Add driver for AD3530R and AD3531R")
> Signed-off-by: Kim Seer Paller <kimseer.paller@analog.com>
Applied to the fixes-togreg branch of iio.git and marked for stable

Thanks,

Jonathan

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-05-06 16:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-05  4:34 [PATCH 0/2] Fix AD3531/AD3531R powerdown modes Kim Seer Paller
2026-05-05  4:34 ` [PATCH 1/2] iio: ABI: Add DAC 500ohm, 3.85kohm, and 16kohm " Kim Seer Paller
2026-05-06 16:23   ` Jonathan Cameron
2026-05-05  4:34 ` [PATCH 2/2] iio: dac: ad3530r: Fix AD3531/AD3531R powerdown mode strings Kim Seer Paller
2026-05-06 16:25   ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox