···6868 select SND_SOC_RT55146969 select SND_SOC_DA72197070 select SND_SOC_RT5514_SPI7171+ select SND_SOC_HDMI_CODEC7172 help7273 Say Y or M here if you want to add support multiple codecs for SoC7374 audio on Rockchip RK3399 GRU boards.
+57-2
sound/soc/rockchip/rk3399_gru_sound.c
···228228 return 0;229229}230230231231+static int rockchip_sound_cdndp_hw_params(struct snd_pcm_substream *substream,232232+ struct snd_pcm_hw_params *params)233233+{234234+ struct snd_soc_pcm_runtime *rtd = substream->private_data;235235+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai;236236+ struct snd_soc_dai *codec_dai = rtd->codec_dai;237237+ int mclk, ret;238238+239239+ /* in bypass mode, the mclk has to be one of the frequencies below */240240+ switch (params_rate(params)) {241241+ case 8000:242242+ case 16000:243243+ case 24000:244244+ case 32000:245245+ case 48000:246246+ case 64000:247247+ case 96000:248248+ mclk = 12288000;249249+ break;250250+ case 11025:251251+ case 22050:252252+ case 44100:253253+ case 88200:254254+ mclk = 11289600;255255+ break;256256+ default:257257+ return -EINVAL;258258+ }259259+260260+ ret = snd_soc_dai_set_sysclk(cpu_dai, 0, mclk,261261+ SND_SOC_CLOCK_OUT);262262+ if (ret < 0) {263263+ dev_err(codec_dai->dev, "Can't set cpu clock out %d\n", ret);264264+ return ret;265265+ }266266+267267+ return 0;268268+}269269+231270static const struct snd_soc_ops rockchip_sound_max98357a_ops = {232271 .hw_params = rockchip_sound_max98357a_hw_params,233272};···277238278239static const struct snd_soc_ops rockchip_sound_da7219_ops = {279240 .hw_params = rockchip_sound_da7219_hw_params,241241+};242242+243243+static struct snd_soc_ops rockchip_sound_cdndp_ops = {244244+ .hw_params = rockchip_sound_cdndp_hw_params,280245};281246282247static struct snd_soc_card rockchip_sound_card = {···295252};296253297254enum {255255+ DAILINK_CDNDP,298256 DAILINK_DA7219,299257 DAILINK_MAX98357A,300258 DAILINK_RT5514,···303259};304260305261static const char * const dailink_compat[] = {262262+ [DAILINK_CDNDP] = "rockchip,rk3399-cdn-dp",306263 [DAILINK_DA7219] = "dlg,da7219",307264 [DAILINK_MAX98357A] = "maxim,max98357a",308265 [DAILINK_RT5514] = "realtek,rt5514-i2c",···311266};312267313268static const struct snd_soc_dai_link rockchip_dais[] = {269269+ [DAILINK_CDNDP] = {270270+ .name = "DP",271271+ .stream_name = "DP PCM",272272+ .codec_dai_name = "i2s-hifi",273273+ .ops = &rockchip_sound_cdndp_ops,274274+ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |275275+ SND_SOC_DAIFMT_CBS_CFS,276276+ },314277 [DAILINK_DA7219] = {315278 .name = "DA7219",316279 .stream_name = "DA7219 PCM",···369316static int rockchip_sound_of_parse_dais(struct device *dev,370317 struct snd_soc_card *card)371318{372372- struct device_node *np_cpu;319319+ struct device_node *np_cpu, *np_cpu0, *np_cpu1;373320 struct device_node *np_codec;374321 struct snd_soc_dai_link *dai;375322 int i, index;···379326 if (!card->dai_link)380327 return -ENOMEM;381328382382- np_cpu = of_parse_phandle(dev->of_node, "rockchip,cpu", 0);329329+ np_cpu0 = of_parse_phandle(dev->of_node, "rockchip,cpu", 0);330330+ np_cpu1 = of_parse_phandle(dev->of_node, "rockchip,cpu", 1);383331384332 card->num_links = 0;385333 for (i = 0; i < ARRAY_SIZE(rockchip_dais); i++) {···396342 if (index < 0)397343 continue;398344345345+ np_cpu = (index == DAILINK_CDNDP) ? np_cpu1 : np_cpu0;399346 if (!np_cpu) {400347 dev_err(dev, "Missing 'rockchip,cpu' for %s\n",401348 rockchip_dais[index].name);