Linux Sound subsystem development
 help / color / mirror / Atom feed
* [PATCH] mfd: madera: Assert reset when requesting the reset GPIO
@ 2026-12-04  1:30 Fabricio Akio via B4 Relay
  2026-12-04 11:43 ` Charles Keepax
  0 siblings, 1 reply; 2+ messages in thread
From: Fabricio Akio via B4 Relay @ 2026-12-04  1:30 UTC (permalink / raw)
  To: Charles Keepax, Richard Fitzgerald, Lee Jones
  Cc: Nikesh Oswal, linux-sound, patches, mfd, Fabricio Akio

From: Fabricio Akio <fabricioakio@gmail.com>

The reset GPIO is set by raw value, low asserting reset, and the probe
releases it after turning on the chip's core supplies. It is requested
as GPIOD_OUT_LOW, a logical value, though, which drives it high when the
device tree flags it GPIO_ACTIVE_LOW, so the chip is powered up with its
reset released.

Request the GPIO as is, then make it an output driving the line low
whatever its polarity.

Fixes: 16b27467f46c ("mfd: madera: Add common support for Cirrus Logic Madera codecs")
Signed-off-by: Fabricio Akio <fabricioakio@gmail.com>
---
Tested on a CS47L35, the Motorola Moto X4, with the GPIO flagged
GPIO_ACTIVE_LOW and 0.
---
 drivers/mfd/madera-core.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/mfd/madera-core.c b/drivers/mfd/madera-core.c
index 2f74a8c644a3..461136e1425a 100644
--- a/drivers/mfd/madera-core.c
+++ b/drivers/mfd/madera-core.c
@@ -389,15 +389,24 @@ EXPORT_SYMBOL_GPL(madera_of_match);
 static int madera_get_reset_gpio(struct madera *madera)
 {
 	struct gpio_desc *reset;
+	int ret;
 
 	if (madera->pdata.reset)
 		return 0;
 
-	reset = devm_gpiod_get_optional(madera->dev, "reset", GPIOD_OUT_LOW);
+	reset = devm_gpiod_get_optional(madera->dev, "reset", GPIOD_ASIS);
 	if (IS_ERR(reset))
 		return dev_err_probe(madera->dev, PTR_ERR(reset),
 				"Failed to request /RESET");
 
+	/* Assert reset, driving the line low whatever its polarity */
+	if (reset) {
+		ret = gpiod_direction_output(reset, gpiod_is_active_low(reset));
+		if (ret)
+			return dev_err_probe(madera->dev, ret,
+					     "Failed to assert /RESET\n");
+	}
+
 	/*
 	 * A hard reset is needed for full reset of the chip. We allow running
 	 * without hard reset only because it can be useful for early

---
base-commit: 799dd936553182df5770dde7f38d94c8337df75a
change-id: 20261203-madera-reset-request-d61e537c5573

Best regards,
--  
Fabricio Akio <fabricioakio@gmail.com>



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

* Re: [PATCH] mfd: madera: Assert reset when requesting the reset GPIO
  2026-12-04  1:30 [PATCH] mfd: madera: Assert reset when requesting the reset GPIO Fabricio Akio via B4 Relay
@ 2026-12-04 11:43 ` Charles Keepax
  0 siblings, 0 replies; 2+ messages in thread
From: Charles Keepax @ 2026-12-04 11:43 UTC (permalink / raw)
  To: fabricioakio
  Cc: Richard Fitzgerald, Lee Jones, Nikesh Oswal, linux-sound, patches,
	mfd

On Thu, Dec 03, 2026 at 10:30:47PM -0300, Fabricio Akio via B4 Relay wrote:
> From: Fabricio Akio <fabricioakio@gmail.com>
> 
> The reset GPIO is set by raw value, low asserting reset, and the probe
> releases it after turning on the chip's core supplies. It is requested
> as GPIOD_OUT_LOW, a logical value, though, which drives it high when the
> device tree flags it GPIO_ACTIVE_LOW, so the chip is powered up with its
> reset released.
> 
> Request the GPIO as is, then make it an output driving the line low
> whatever its polarity.
> 
> Fixes: 16b27467f46c ("mfd: madera: Add common support for Cirrus Logic Madera codecs")
> Signed-off-by: Fabricio Akio <fabricioakio@gmail.com>
> ---

Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>

Thanks,
Charles

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

end of thread, other threads:[~2026-12-04 11:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-04  1:30 [PATCH] mfd: madera: Assert reset when requesting the reset GPIO Fabricio Akio via B4 Relay
2026-12-04 11:43 ` Charles Keepax

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