brcm2708: rename target to bcm27xx
[openwrt/staging/wigyori.git] / target / linux / bcm27xx / patches-4.19 / 950-0440-Fixed-48k-timing-issue.patch
1 From 539e2eef7dbfb58ab028a5530430611973dd4c84 Mon Sep 17 00:00:00 2001
2 From: IQaudIO <gordon@iqaudio.com>
3 Date: Thu, 6 Jun 2019 10:20:55 +0100
4 Subject: [PATCH] Fixed 48k timing issue
5
6 ---
7 sound/soc/bcm/iqaudio-codec.c | 33 ++++++++++++++++++++++++++++-----
8 1 file changed, 28 insertions(+), 5 deletions(-)
9
10 --- a/sound/soc/bcm/iqaudio-codec.c
11 +++ b/sound/soc/bcm/iqaudio-codec.c
12 @@ -45,11 +45,15 @@ static int snd_rpi_iqaudio_pll_control(s
13 0);
14 if (ret)
15 dev_err(card->dev, "Failed to bypass PLL: %d\n", ret);
16 + /* Allow PLL time to bypass */
17 + msleep(100);
18 } else if (SND_SOC_DAPM_EVENT_ON(event)) {
19 ret = snd_soc_dai_set_pll(codec_dai, 0, DA7213_SYSCLK_PLL, 0,
20 pll_out);
21 if (ret)
22 dev_err(card->dev, "Failed to enable PLL: %d\n", ret);
23 + /* Allow PLL time to lock */
24 + msleep(100);
25 }
26
27 return ret;
28 @@ -71,6 +75,13 @@ static int snd_rpi_iqaudio_post_dapm_eve
29 return 0;
30 }
31
32 +static const struct snd_kcontrol_new dapm_controls[] = {
33 + SOC_DAPM_PIN_SWITCH("HP Jack"),
34 + SOC_DAPM_PIN_SWITCH("MIC Jack"),
35 + SOC_DAPM_PIN_SWITCH("Onboard MIC"),
36 + SOC_DAPM_PIN_SWITCH("AUX Jack"),
37 +};
38 +
39 static const struct snd_soc_dapm_widget dapm_widgets[] = {
40 SND_SOC_DAPM_HP("HP Jack", NULL),
41 SND_SOC_DAPM_MIC("MIC Jack", NULL),
42 @@ -87,14 +98,14 @@ static const struct snd_soc_dapm_route a
43 {"HP Jack", NULL, "HPR"},
44 {"HP Jack", NULL, "PLL Control"},
45
46 - {"AUX Jack", NULL, "AUXR"},
47 - {"AUX Jack", NULL, "AUXL"},
48 + {"AUXR", NULL, "AUX Jack"},
49 + {"AUXL", NULL, "AUX Jack"},
50 {"AUX Jack", NULL, "PLL Control"},
51
52 /* Assume Mic1 is linked to Headset and Mic2 to on-board mic */
53 - {"MIC Jack", NULL, "MIC1"},
54 + {"MIC1", NULL, "MIC Jack"},
55 {"MIC Jack", NULL, "PLL Control"},
56 - {"Onboard MIC", NULL, "MIC2"},
57 + {"MIC2", NULL, "Onboard MIC"},
58 {"Onboard MIC", NULL, "PLL Control"},
59 };
60
61 @@ -106,6 +117,16 @@ static int snd_rpi_iqaudio_codec_init(st
62 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
63 int ret;
64
65 + /*
66 + * Disable AUX Jack Pin by default to prevent PLL being enabled at
67 + * startup. This avoids holding the PLL to a fixed SR config for
68 + * subsequent streams.
69 + *
70 + * This pin can still be enabled later, as required by user-space.
71 + */
72 + snd_soc_dapm_disable_pin(&rtd->card->dapm, "AUX Jack");
73 + snd_soc_dapm_sync(&rtd->card->dapm);
74 +
75 /* Set bclk ratio to align with codec's BCLK rate */
76 ret = snd_soc_dai_set_bclk_ratio(cpu_dai, 64);
77 if (ret) {
78 @@ -168,6 +189,8 @@ static struct snd_soc_card snd_rpi_iqaud
79 .owner = THIS_MODULE,
80 .dai_link = snd_rpi_iqaudio_codec_dai,
81 .num_links = ARRAY_SIZE(snd_rpi_iqaudio_codec_dai),
82 + .controls = dapm_controls,
83 + .num_controls = ARRAY_SIZE(dapm_controls),
84 .dapm_widgets = dapm_widgets,
85 .num_dapm_widgets = ARRAY_SIZE(dapm_widgets),
86 .dapm_routes = audio_map,
87 @@ -204,7 +227,7 @@ static int snd_rpi_iqaudio_codec_probe(s
88
89 if (of_property_read_string(pdev->dev.of_node,
90 "dai_stream_name", &dai->stream_name))
91 - dai->stream_name = "IQaudIO CODEC HiFi v1.1";
92 + dai->stream_name = "IQaudIO CODEC HiFi v1.2";
93
94 }
95