[PATCH 01/10] iio: frequency: ad9910: powerdown fix

From: Rodrigo Alencar via B4 Relay

Date: Thu Oct 15 2026 - 14:24:37 EST


From: Rodrigo Alencar <rodrigo.alencar@xxxxxxxxxx>

Enable the software powerdown on all the applicable CFR1 register bits at
once with an IO update.

It turns out that DIGITAL and REFCLK_INPUT powerdown do need an IO update
when enabling the powerdown, but that is not the case when powering it up
again. It is an asymmetric behavior, which was observed while profiling
power consumption in the lab.

Fixes: 22452fe6cd08 ("iio: frequency: ad9910: initial driver implementation")
Signed-off-by: Rodrigo Alencar <rodrigo.alencar@xxxxxxxxxx>
---
drivers/iio/frequency/ad9910.c | 26 ++++++++------------------
1 file changed, 8 insertions(+), 18 deletions(-)

diff --git a/drivers/iio/frequency/ad9910.c b/drivers/iio/frequency/ad9910.c
index 04a4e184b873..8bc24d0b7442 100644
--- a/drivers/iio/frequency/ad9910.c
+++ b/drivers/iio/frequency/ad9910.c
@@ -621,26 +621,16 @@ static int ad9910_sw_powerdown_set(struct ad9910_state *st, bool enable)
if (ad9910_sw_powerdown_get(st) == enable)
return 0;

- /*
- * When powering down, the DAC and AUX_DAC (SW1) must be powered down
- * first, as they require an I/O update to take effect. The opposite is
- * true when powering up, the DAC and AUX_DAC must be powered up last,
- * i.e., after the DIGITAL and REFCLK_INPUT (SW0) power up.
- */
- if (enable) {
- ret = ad9910_reg32_update(st, AD9910_REG_CFR1,
- AD9910_CFR1_SW1_POWER_DOWN_MSK,
- AD9910_CFR1_SW1_POWER_DOWN_MSK,
- true);
- if (ret)
- return ret;
-
+ if (enable)
return ad9910_reg32_update(st, AD9910_REG_CFR1,
- AD9910_CFR1_SW0_POWER_DOWN_MSK,
- AD9910_CFR1_SW0_POWER_DOWN_MSK,
- false);
- }
+ AD9910_CFR1_SW_POWER_DOWN_MSK,
+ AD9910_CFR1_SW_POWER_DOWN_MSK,
+ true);

+ /*
+ * When powering up, the DIGITAL and REFCLK_INPUT (SW0) must be powered
+ * up first, as they do not require an I/O update to take effect.
+ */
ret = ad9910_reg32_update(st, AD9910_REG_CFR1,
AD9910_CFR1_SW0_POWER_DOWN_MSK, 0, false);
if (ret)

--
2.43.0