kernel: bump 6.1 to 6.1.80
[openwrt/staging/mans0n.git] / target / linux / d1 / patches-6.1 / 0070-ASoC-sun4i-spdif-Add-support-for-separate-RX-TX-cloc.patch
1 From b42a9e0cf6b0ca78b4ef5310de967d515a3cca03 Mon Sep 17 00:00:00 2001
2 From: Samuel Holland <samuel@sholland.org>
3 Date: Sun, 13 Jun 2021 23:53:16 -0500
4 Subject: [PATCH 070/117] ASoC: sun4i-spdif: Add support for separate RX/TX
5 clocks
6
7 On older variants of the hardware, the RX and TX blocks share a single
8 module clock, named "spdif" in the DT binding. The D1 variant has
9 separate RX and TX clocks, so the TX module clock is named "tx" in the
10 binding. To support this, supply the clock name in the quirks structure.
11
12 Since the driver supports only TX, only the TX clock name is needed.
13
14 Signed-off-by: Samuel Holland <samuel@sholland.org>
15 ---
16 sound/soc/sunxi/sun4i-spdif.c | 24 +++++++++++++++---------
17 1 file changed, 15 insertions(+), 9 deletions(-)
18
19 --- a/sound/soc/sunxi/sun4i-spdif.c
20 +++ b/sound/soc/sunxi/sun4i-spdif.c
21 @@ -169,18 +169,20 @@
22 /**
23 * struct sun4i_spdif_quirks - Differences between SoC variants.
24 *
25 + * @tx_clk_name: firmware name for the TX clock reference.
26 * @reg_dac_txdata: TX FIFO offset for DMA config.
27 * @val_fctl_ftx: TX FIFO flush bitmask.
28 */
29 struct sun4i_spdif_quirks {
30 + const char *tx_clk_name;
31 unsigned int reg_dac_txdata;
32 unsigned int val_fctl_ftx;
33 };
34
35 struct sun4i_spdif_dev {
36 struct platform_device *pdev;
37 - struct clk *spdif_clk;
38 struct clk *apb_clk;
39 + struct clk *tx_clk;
40 struct reset_control *rst;
41 struct snd_soc_dai_driver cpu_dai_drv;
42 struct regmap *regmap;
43 @@ -313,7 +315,7 @@ static int sun4i_spdif_hw_params(struct
44 return -EINVAL;
45 }
46
47 - ret = clk_set_rate(host->spdif_clk, mclk);
48 + ret = clk_set_rate(host->tx_clk, mclk);
49 if (ret < 0) {
50 dev_err(&pdev->dev,
51 "Setting SPDIF clock rate for %d Hz failed!\n", mclk);
52 @@ -537,21 +539,25 @@ static struct snd_soc_dai_driver sun4i_s
53 };
54
55 static const struct sun4i_spdif_quirks sun4i_a10_spdif_quirks = {
56 + .tx_clk_name = "spdif",
57 .reg_dac_txdata = SUN4I_SPDIF_TXFIFO,
58 .val_fctl_ftx = SUN4I_SPDIF_FCTL_FTX,
59 };
60
61 static const struct sun4i_spdif_quirks sun6i_a31_spdif_quirks = {
62 + .tx_clk_name = "spdif",
63 .reg_dac_txdata = SUN4I_SPDIF_TXFIFO,
64 .val_fctl_ftx = SUN4I_SPDIF_FCTL_FTX,
65 };
66
67 static const struct sun4i_spdif_quirks sun8i_h3_spdif_quirks = {
68 + .tx_clk_name = "spdif",
69 .reg_dac_txdata = SUN8I_SPDIF_TXFIFO,
70 .val_fctl_ftx = SUN4I_SPDIF_FCTL_FTX,
71 };
72
73 static const struct sun4i_spdif_quirks sun50i_h6_spdif_quirks = {
74 + .tx_clk_name = "spdif",
75 .reg_dac_txdata = SUN8I_SPDIF_TXFIFO,
76 .val_fctl_ftx = SUN50I_H6_SPDIF_FCTL_FTX,
77 };
78 @@ -591,7 +597,7 @@ static int sun4i_spdif_runtime_suspend(s
79 {
80 struct sun4i_spdif_dev *host = dev_get_drvdata(dev);
81
82 - clk_disable_unprepare(host->spdif_clk);
83 + clk_disable_unprepare(host->tx_clk);
84 clk_disable_unprepare(host->apb_clk);
85
86 return 0;
87 @@ -602,12 +608,12 @@ static int sun4i_spdif_runtime_resume(st
88 struct sun4i_spdif_dev *host = dev_get_drvdata(dev);
89 int ret;
90
91 - ret = clk_prepare_enable(host->spdif_clk);
92 + ret = clk_prepare_enable(host->tx_clk);
93 if (ret)
94 return ret;
95 ret = clk_prepare_enable(host->apb_clk);
96 if (ret)
97 - clk_disable_unprepare(host->spdif_clk);
98 + clk_disable_unprepare(host->tx_clk);
99
100 return ret;
101 }
102 @@ -655,10 +661,10 @@ static int sun4i_spdif_probe(struct plat
103 return PTR_ERR(host->apb_clk);
104 }
105
106 - host->spdif_clk = devm_clk_get(&pdev->dev, "spdif");
107 - if (IS_ERR(host->spdif_clk)) {
108 - dev_err(&pdev->dev, "failed to get a spdif clock.\n");
109 - return PTR_ERR(host->spdif_clk);
110 + host->tx_clk = devm_clk_get(&pdev->dev, quirks->tx_clk_name);
111 + if (IS_ERR(host->tx_clk)) {
112 + dev_err(&pdev->dev, "failed to get TX module clock.\n");
113 + return PTR_ERR(host->tx_clk);
114 }
115
116 host->dma_params_tx.addr = res->start + quirks->reg_dac_txdata;