diff mbox series

[v2,2/2] ASoC: codecs: wsa883x: Use proper shutdown GPIO polarity

Message ID 20221110133512.478831-2-krzysztof.kozlowski@linaro.org (mailing list archive)
State Accepted
Commit ec5dba73f7ba10797904cf18092d2e6975a22147
Headers show
Series [v2,1/2] ASoC: dt-bindings: qcom, wsa883x: Use correct SD_N polarity | expand

Commit Message

Krzysztof Kozlowski Nov. 10, 2022, 1:35 p.m. UTC
The shutdown GPIO is active low (SD_N), but this depends on actual board
layout.  Linux drivers should only care about logical state, where high
(1) means shutdown and low (0) means do not shutdown.

Invert the GPIO to match logical value.

Fixes: 43b8c7dc85a1 ("ASoC: codecs: add wsa883x amplifier support")
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

---

Changes since v1:
1. None.
---
 sound/soc/codecs/wsa883x.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Srinivas Kandagatla Nov. 11, 2022, 4:42 p.m. UTC | #1
On 10/11/2022 13:35, Krzysztof Kozlowski wrote:
> The shutdown GPIO is active low (SD_N), but this depends on actual board
> layout.  Linux drivers should only care about logical state, where high
> (1) means shutdown and low (0) means do not shutdown.
> 
> Invert the GPIO to match logical value.
> 
> Fixes: 43b8c7dc85a1 ("ASoC: codecs: add wsa883x amplifier support")
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> 
> ---

Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

> 
> Changes since v1:
> 1. None.
> ---
>   sound/soc/codecs/wsa883x.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/sound/soc/codecs/wsa883x.c b/sound/soc/codecs/wsa883x.c
> index c7b10bbfba7e..77a7dd3cf495 100644
> --- a/sound/soc/codecs/wsa883x.c
> +++ b/sound/soc/codecs/wsa883x.c
> @@ -1392,7 +1392,7 @@ static int wsa883x_probe(struct sdw_slave *pdev,
>   	}
>   
>   	wsa883x->sd_n = devm_gpiod_get_optional(&pdev->dev, "powerdown",
> -						GPIOD_FLAGS_BIT_NONEXCLUSIVE);
> +						GPIOD_FLAGS_BIT_NONEXCLUSIVE | GPIOD_OUT_HIGH);
>   	if (IS_ERR(wsa883x->sd_n)) {
>   		dev_err(&pdev->dev, "Shutdown Control GPIO not found\n");
>   		ret = PTR_ERR(wsa883x->sd_n);
> @@ -1411,7 +1411,7 @@ static int wsa883x_probe(struct sdw_slave *pdev,
>   	pdev->prop.simple_clk_stop_capable = true;
>   	pdev->prop.sink_dpn_prop = wsa_sink_dpn_prop;
>   	pdev->prop.scp_int1_mask = SDW_SCP_INT1_BUS_CLASH | SDW_SCP_INT1_PARITY;
> -	gpiod_direction_output(wsa883x->sd_n, 1);
> +	gpiod_direction_output(wsa883x->sd_n, 0);
>   
>   	wsa883x->regmap = devm_regmap_init_sdw(pdev, &wsa883x_regmap_config);
>   	if (IS_ERR(wsa883x->regmap)) {
diff mbox series

Patch

diff --git a/sound/soc/codecs/wsa883x.c b/sound/soc/codecs/wsa883x.c
index c7b10bbfba7e..77a7dd3cf495 100644
--- a/sound/soc/codecs/wsa883x.c
+++ b/sound/soc/codecs/wsa883x.c
@@ -1392,7 +1392,7 @@  static int wsa883x_probe(struct sdw_slave *pdev,
 	}
 
 	wsa883x->sd_n = devm_gpiod_get_optional(&pdev->dev, "powerdown",
-						GPIOD_FLAGS_BIT_NONEXCLUSIVE);
+						GPIOD_FLAGS_BIT_NONEXCLUSIVE | GPIOD_OUT_HIGH);
 	if (IS_ERR(wsa883x->sd_n)) {
 		dev_err(&pdev->dev, "Shutdown Control GPIO not found\n");
 		ret = PTR_ERR(wsa883x->sd_n);
@@ -1411,7 +1411,7 @@  static int wsa883x_probe(struct sdw_slave *pdev,
 	pdev->prop.simple_clk_stop_capable = true;
 	pdev->prop.sink_dpn_prop = wsa_sink_dpn_prop;
 	pdev->prop.scp_int1_mask = SDW_SCP_INT1_BUS_CLASH | SDW_SCP_INT1_PARITY;
-	gpiod_direction_output(wsa883x->sd_n, 1);
+	gpiod_direction_output(wsa883x->sd_n, 0);
 
 	wsa883x->regmap = devm_regmap_init_sdw(pdev, &wsa883x_regmap_config);
 	if (IS_ERR(wsa883x->regmap)) {