openwrt/target/linux/d1/patches-6.1/0069-ASoC-sun4i-spdif-Simpl...

79 lines
2.6 KiB
Diff

From 0efd742482dbe4b17a441eab5c57231d65f9a852 Mon Sep 17 00:00:00 2001
From: Samuel Holland <samuel@sholland.org>
Date: Sat, 13 Nov 2021 11:14:30 -0600
Subject: [PATCH 069/117] ASoC: sun4i-spdif: Simplify code around optional
resets
The driver does not need to care about which variants have a reset;
the devicetree binding already enforces that the necessary resources are
provided. Simplify the logic by always calling the optional getter,
which will return NULL if no reset reference is found.
Also clean up the error handling, which should not print a misleading
error in the EPROBE_DEFER case.
Signed-off-by: Samuel Holland <samuel@sholland.org>
---
sound/soc/sunxi/sun4i-spdif.c | 22 ++++++----------------
1 file changed, 6 insertions(+), 16 deletions(-)
--- a/sound/soc/sunxi/sun4i-spdif.c
+++ b/sound/soc/sunxi/sun4i-spdif.c
@@ -170,12 +170,10 @@
* struct sun4i_spdif_quirks - Differences between SoC variants.
*
* @reg_dac_txdata: TX FIFO offset for DMA config.
- * @has_reset: SoC needs reset deasserted.
* @val_fctl_ftx: TX FIFO flush bitmask.
*/
struct sun4i_spdif_quirks {
unsigned int reg_dac_txdata;
- bool has_reset;
unsigned int val_fctl_ftx;
};
@@ -546,19 +544,16 @@ static const struct sun4i_spdif_quirks s
static const struct sun4i_spdif_quirks sun6i_a31_spdif_quirks = {
.reg_dac_txdata = SUN4I_SPDIF_TXFIFO,
.val_fctl_ftx = SUN4I_SPDIF_FCTL_FTX,
- .has_reset = true,
};
static const struct sun4i_spdif_quirks sun8i_h3_spdif_quirks = {
.reg_dac_txdata = SUN8I_SPDIF_TXFIFO,
.val_fctl_ftx = SUN4I_SPDIF_FCTL_FTX,
- .has_reset = true,
};
static const struct sun4i_spdif_quirks sun50i_h6_spdif_quirks = {
.reg_dac_txdata = SUN8I_SPDIF_TXFIFO,
.val_fctl_ftx = SUN50I_H6_SPDIF_FCTL_FTX,
- .has_reset = true,
};
static const struct of_device_id sun4i_spdif_of_match[] = {
@@ -672,17 +667,12 @@ static int sun4i_spdif_probe(struct plat
platform_set_drvdata(pdev, host);
- if (quirks->has_reset) {
- host->rst = devm_reset_control_get_optional_exclusive(&pdev->dev,
- NULL);
- if (PTR_ERR(host->rst) == -EPROBE_DEFER) {
- ret = -EPROBE_DEFER;
- dev_err(&pdev->dev, "Failed to get reset: %d\n", ret);
- return ret;
- }
- if (!IS_ERR(host->rst))
- reset_control_deassert(host->rst);
- }
+ host->rst = devm_reset_control_get_optional_exclusive(&pdev->dev, NULL);
+ if (IS_ERR(host->rst))
+ return dev_err_probe(&pdev->dev, PTR_ERR(host->rst),
+ "Failed to get reset\n");
+
+ reset_control_deassert(host->rst);
ret = devm_snd_soc_register_component(&pdev->dev,
&sun4i_spdif_component, &sun4i_spdif_dai, 1);