brcm2708: update to latest patches from the RPi foundation
[openwrt/staging/lynxis.git] / target / linux / brcm2708 / patches-4.19 / 950-0211-rpi-wm8804-soundcard-drop-PWRDN-register-writes.patch
1 From a93fcdaf72291fea4661690cc35e1a45834e3cb7 Mon Sep 17 00:00:00 2001
2 From: Matthias Reichl <hias@horus.com>
3 Date: Sun, 18 Nov 2018 15:24:16 +0100
4 Subject: [PATCH 211/725] rpi-wm8804-soundcard: drop PWRDN register writes
5
6 Since kernel 4.0 the PWRDN register bits are under DAPM
7 control from the wm8804 driver.
8
9 Drop code that modifies that register to avoid interfering
10 with DAPM.
11
12 Signed-off-by: Matthias Reichl <hias@horus.com>
13 ---
14 sound/soc/bcm/rpi-wm8804-soundcard.c | 55 ----------------------------
15 1 file changed, 55 deletions(-)
16
17 --- a/sound/soc/bcm/rpi-wm8804-soundcard.c
18 +++ b/sound/soc/bcm/rpi-wm8804-soundcard.c
19 @@ -54,8 +54,6 @@ struct snd_rpi_wm8804_drvdata {
20 struct snd_soc_dai_link *dai;
21 /* Required - snd_soc_card name */
22 const char *card_name;
23 - /* Optional- Overrides the module paramter */
24 - unsigned short auto_shutdown_output;
25 /* Optional DT node names if card info is defined in DT */
26 const char *card_name_dt;
27 const char *dai_name_dt;
28 @@ -64,51 +62,12 @@ struct snd_rpi_wm8804_drvdata {
29 int (*probe)(struct platform_device *pdev);
30 };
31
32 -static short int auto_shutdown_output;
33 -module_param(auto_shutdown_output, short, 0660);
34 -MODULE_PARM_DESC(auto_shutdown_output, "Shutdown SP/DIF output if playback is stopped");
35 -
36 static struct gpio_desc *snd_clk44gpio;
37 static struct gpio_desc *snd_clk48gpio;
38
39 #define CLK_44EN_RATE 22579200UL
40 #define CLK_48EN_RATE 24576000UL
41
42 -static int snd_rpi_wm8804_init(struct snd_soc_pcm_runtime *rtd)
43 -{
44 - struct snd_soc_component *component = rtd->codec_dai->component;
45 - int rc;
46 -
47 - pr_debug("%s\n", __func__);
48 -
49 - rc = snd_soc_component_update_bits(component, WM8804_PWRDN, 0x4, 0x0);
50 - return rc < 0 ? rc : 0;
51 -}
52 -
53 -static int snd_rpi_wm8804_digi_startup(struct snd_pcm_substream *substream)
54 -{
55 - struct snd_soc_pcm_runtime *rtd = substream->private_data;
56 - struct snd_soc_component *component = rtd->codec_dai->component;
57 - int rc;
58 -
59 - pr_debug("%s\n", __func__);
60 -
61 - rc = snd_soc_component_update_bits(component, WM8804_PWRDN, 0x3c, 0x00);
62 - return rc < 0 ? rc : 0;
63 -}
64 -
65 -static void snd_rpi_wm8804_digi_shutdown(struct snd_pcm_substream *substream)
66 -{
67 - struct snd_soc_pcm_runtime *rtd = substream->private_data;
68 - struct snd_soc_component *component = rtd->codec_dai->component;
69 -
70 - pr_debug("%s %d\n", __func__, auto_shutdown_output);
71 -
72 - if (auto_shutdown_output)
73 - snd_soc_component_update_bits(component, WM8804_PWRDN,
74 - 0x3c, 0x3c);
75 -}
76 -
77 static unsigned int snd_rpi_wm8804_enable_clock(unsigned int samplerate)
78 {
79 switch (samplerate) {
80 @@ -204,12 +163,6 @@ static int snd_rpi_wm8804_hw_params(stru
81 return ret;
82 }
83
84 - /* Enable TX output */
85 - snd_soc_component_update_bits(component, WM8804_PWRDN, 0x4, 0x0);
86 -
87 - /* Power on */
88 - snd_soc_component_update_bits(component, WM8804_PWRDN, 0x9, 0);
89 -
90 /* set sampling frequency status bits */
91 snd_soc_component_update_bits(component, WM8804_SPDTX4, 0x0f,
92 sampling_freq);
93 @@ -219,8 +172,6 @@ static int snd_rpi_wm8804_hw_params(stru
94
95 static struct snd_soc_ops snd_rpi_wm8804_ops = {
96 .hw_params = snd_rpi_wm8804_hw_params,
97 - .startup = snd_rpi_wm8804_digi_startup,
98 - .shutdown = snd_rpi_wm8804_digi_shutdown,
99 };
100
101 static struct snd_soc_dai_link snd_justboom_digi_dai[] = {
102 @@ -233,7 +184,6 @@ static struct snd_soc_dai_link snd_justb
103 static struct snd_rpi_wm8804_drvdata drvdata_justboom_digi = {
104 .card_name = "snd_rpi_justboom_digi",
105 .dai = snd_justboom_digi_dai,
106 - .auto_shutdown_output = 1,
107 };
108
109 static struct snd_soc_dai_link snd_iqaudio_digi_dai[] = {
110 @@ -335,8 +285,6 @@ static int snd_rpi_wm8804_probe(struct p
111
112 snd_soc_card_set_drvdata(&snd_rpi_wm8804, drvdata);
113
114 - if (!dai->init)
115 - dai->init = snd_rpi_wm8804_init;
116 if (!dai->ops)
117 dai->ops = &snd_rpi_wm8804_ops;
118 if (!dai->codec_dai_name)
119 @@ -348,9 +296,6 @@ static int snd_rpi_wm8804_probe(struct p
120 SND_SOC_DAIFMT_NB_NF |
121 SND_SOC_DAIFMT_CBM_CFM;
122
123 - if (drvdata->auto_shutdown_output)
124 - auto_shutdown_output = 1;
125 -
126 snd_rpi_wm8804.dai_link = dai;
127 i2s_node = of_parse_phandle(pdev->dev.of_node,
128 "i2s-controller", 0);