Commit 833a94aa authored by Judy Hsiao's avatar Judy Hsiao Committed by Mark Brown

ASoC: qcom: Distinguish headset codec by codec_dai->name

Distinguish which headset codec is on the board by codec_dai->name
instead of card->name.

It fixes the crash of being unable to handle kernel paging requests
at virtual address ADDR by initializing the correct audio codec on
the board.

Call stack of the crash:
```
 Unable to handle kernel paging request at virtual address ...
 ...
 Call trace:
  rt5682_set_component_pll+0xcc/0xb78 [snd_soc_rt5682]
  snd_soc_component_set_pll+0x90/0x154
  snd_soc_dai_set_pll+0xf4/0x1ac
  sc7180_snd_startup+0x268/0x3c0 [snd_soc_sc7180]
  snd_soc_link_startup+0xa4/0x180
  soc_pcm_open+0x35c/0x15c8
  snd_pcm_open_substream+0xa90/0x13b0
  snd_pcm_open+0x1a4/0x55c
  snd_pcm_capture_open+0x7c/0xe8
  snd_open+0x2b8/0x2e4
  chrdev_open+0x364/0x3d4
  do_dentry_open+0x66c/0xc58
  vfs_open+0x7c/0x8c
  path_openat+0x108c/0x2bbc
  do_filp_open+0x15c/0x258
  do_sys_open+0x278/0x62c
  __arm64_compat_sys_openat+0x9c/0xb0
  ...
```

Fixes: 425c5fce ("ASoC: qcom: Add support for ALC5682I-VS codec")
Signed-off-by: default avatarJudy Hsiao <judyhsiao@chromium.org>
Link: https://lore.kernel.org/r/20211214022509.1288245-1-judyhsiao@chromium.orgSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 190357e1
......@@ -131,13 +131,13 @@ static int sc7180_snd_startup(struct snd_pcm_substream *substream)
struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
int pll_id, pll_source, pll_in, pll_out, clk_id, ret;
if (!(strcmp(card->name, "sc7180-rt5682-max98357a-1mic"))) {
if (!strcmp(codec_dai->name, "rt5682-aif1")) {
pll_source = RT5682_PLL1_S_MCLK;
pll_id = 0;
clk_id = RT5682_SCLK_S_PLL1;
pll_out = RT5682_PLL1_FREQ;
pll_in = DEFAULT_MCLK_RATE;
} else if (!(strcmp(card->name, "sc7180-rt5682s-max98357a-1mic"))) {
} else if (!strcmp(codec_dai->name, "rt5682s-aif1")) {
pll_source = RT5682S_PLL_S_MCLK;
pll_id = RT5682S_PLL2;
clk_id = RT5682S_SCLK_S_PLL2;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment