|
10 | 10 | #include <linux/platform_device.h>
|
11 | 11 | #include <sound/graph_card.h>
|
12 | 12 | #include <sound/pcm_params.h>
|
| 13 | +#include <sound/soc-dai.h> |
13 | 14 |
|
14 | 15 | #define MAX_PLLA_OUT0_DIV 128
|
15 | 16 |
|
@@ -44,6 +45,21 @@ struct tegra_audio_cdata {
|
44 | 45 | unsigned int plla_out0_rates[NUM_RATE_TYPE];
|
45 | 46 | };
|
46 | 47 |
|
| 48 | +static bool need_clk_update(struct snd_soc_dai *dai) |
| 49 | +{ |
| 50 | + if (snd_soc_dai_is_dummy(dai) || |
| 51 | + !dai->driver->ops || |
| 52 | + !dai->driver->name) |
| 53 | + return false; |
| 54 | + |
| 55 | + if (strstr(dai->driver->name, "I2S") || |
| 56 | + strstr(dai->driver->name, "DMIC") || |
| 57 | + strstr(dai->driver->name, "DSPK")) |
| 58 | + return true; |
| 59 | + |
| 60 | + return false; |
| 61 | +} |
| 62 | + |
47 | 63 | /* Setup PLL clock as per the given sample rate */
|
48 | 64 | static int tegra_audio_graph_update_pll(struct snd_pcm_substream *substream,
|
49 | 65 | struct snd_pcm_hw_params *params)
|
@@ -140,19 +156,7 @@ static int tegra_audio_graph_hw_params(struct snd_pcm_substream *substream,
|
140 | 156 | struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
|
141 | 157 | int err;
|
142 | 158 |
|
143 |
| - /* |
144 |
| - * This gets called for each DAI link (FE or BE) when DPCM is used. |
145 |
| - * We may not want to update PLLA rate for each call. So PLLA update |
146 |
| - * must be restricted to external I/O links (I2S, DMIC or DSPK) since |
147 |
| - * they actually depend on it. I/O modules update their clocks in |
148 |
| - * hw_param() of their respective component driver and PLLA rate |
149 |
| - * update here helps them to derive appropriate rates. |
150 |
| - * |
151 |
| - * TODO: When more HW accelerators get added (like sample rate |
152 |
| - * converter, volume gain controller etc., which don't really |
153 |
| - * depend on PLLA) we need a better way to filter here. |
154 |
| - */ |
155 |
| - if (cpu_dai->driver->ops && rtd->dai_link->no_pcm) { |
| 159 | + if (need_clk_update(cpu_dai)) { |
156 | 160 | err = tegra_audio_graph_update_pll(substream, params);
|
157 | 161 | if (err)
|
158 | 162 | return err;
|
|
0 commit comments