brcm2708: add linux 4.19 support
[oweals/openwrt.git] / target / linux / brcm2708 / patches-4.19 / 950-0412-ASoC-tlv320aic32x4-Restructure-set_dai_sysclk.patch
1 From dc848cfb79aa1a4cea301c388e920e4205ac791a Mon Sep 17 00:00:00 2001
2 From: Annaliese McDermond <nh6z@nh6z.net>
3 Date: Thu, 21 Mar 2019 17:58:52 -0700
4 Subject: [PATCH 412/703] ASoC: tlv320aic32x4: Restructure set_dai_sysclk
5
6 commit aa6a60f7be925210d5156f0e8025f3afe1f4f54d upstream.
7
8 The sysclk is now managed by the CCF.  Change this function
9 to merely find the system clock and set it using
10 clk_set_rate.
11
12 Signed-off-by: Annaliese McDermond <nh6z@nh6z.net>
13 Signed-off-by: Mark Brown <broonie@kernel.org>
14 ---
15  sound/soc/codecs/tlv320aic32x4.c | 17 ++++++-----------
16  1 file changed, 6 insertions(+), 11 deletions(-)
17
18 --- a/sound/soc/codecs/tlv320aic32x4.c
19 +++ b/sound/soc/codecs/tlv320aic32x4.c
20 @@ -49,7 +49,6 @@
21  
22  struct aic32x4_priv {
23         struct regmap *regmap;
24 -       u32 sysclk;
25         u32 power_cfg;
26         u32 micpga_routing;
27         bool swapdacs;
28 @@ -569,17 +568,13 @@ static int aic32x4_set_dai_sysclk(struct
29                                   int clk_id, unsigned int freq, int dir)
30  {
31         struct snd_soc_component *component = codec_dai->component;
32 -       struct aic32x4_priv *aic32x4 = snd_soc_component_get_drvdata(component);
33 +       struct clk *mclk;
34 +       struct clk *pll;
35  
36 -       switch (freq) {
37 -       case 12000000:
38 -       case 24000000:
39 -       case 25000000:
40 -               aic32x4->sysclk = freq;
41 -               return 0;
42 -       }
43 -       printk(KERN_ERR "aic32x4: invalid frequency to set DAI system clock\n");
44 -       return -EINVAL;
45 +       pll = devm_clk_get(component->dev, "pll");
46 +       mclk = clk_get_parent(pll);
47 +
48 +       return clk_set_rate(mclk, freq);
49  }
50  
51  static int aic32x4_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)