Skip to content

Commit 9c31957

Browse files
committed
Merge tag 'asoc-fix-v5.12-rc6' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
ASoC: Fixes for v5.12 A fairly small batch of driver specific fixes, mainly for various x86 systems with the biggest set being fixes to power down DSPs properly on x86 SOF systems.
2 parents 168632a + e7a48c7 commit 9c31957

File tree

18 files changed

+81
-39
lines changed

18 files changed

+81
-39
lines changed

sound/soc/bcm/cygnus-ssp.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1348,8 +1348,10 @@ static int cygnus_ssp_probe(struct platform_device *pdev)
13481348
&cygnus_ssp_dai[active_port_count]);
13491349

13501350
/* negative is err, 0 is active and good, 1 is disabled */
1351-
if (err < 0)
1351+
if (err < 0) {
1352+
of_node_put(child_node);
13521353
return err;
1354+
}
13531355
else if (!err) {
13541356
dev_dbg(dev, "Activating DAI: %s\n",
13551357
cygnus_ssp_dai[active_port_count].name);

sound/soc/codecs/lpass-rx-macro.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3551,7 +3551,7 @@ static int rx_macro_probe(struct platform_device *pdev)
35513551

35523552
/* set MCLK and NPL rates */
35533553
clk_set_rate(rx->clks[2].clk, MCLK_FREQ);
3554-
clk_set_rate(rx->clks[3].clk, MCLK_FREQ);
3554+
clk_set_rate(rx->clks[3].clk, 2 * MCLK_FREQ);
35553555

35563556
ret = clk_bulk_prepare_enable(RX_NUM_CLKS_MAX, rx->clks);
35573557
if (ret)

sound/soc/codecs/lpass-tx-macro.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1811,7 +1811,7 @@ static int tx_macro_probe(struct platform_device *pdev)
18111811

18121812
/* set MCLK and NPL rates */
18131813
clk_set_rate(tx->clks[2].clk, MCLK_FREQ);
1814-
clk_set_rate(tx->clks[3].clk, MCLK_FREQ);
1814+
clk_set_rate(tx->clks[3].clk, 2 * MCLK_FREQ);
18151815

18161816
ret = clk_bulk_prepare_enable(TX_NUM_CLKS_MAX, tx->clks);
18171817
if (ret)

sound/soc/codecs/max98373-i2c.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,7 @@ static bool max98373_volatile_reg(struct device *dev, unsigned int reg)
446446
case MAX98373_R2054_MEAS_ADC_PVDD_CH_READBACK:
447447
case MAX98373_R2055_MEAS_ADC_THERM_CH_READBACK:
448448
case MAX98373_R20B6_BDE_CUR_STATE_READBACK:
449+
case MAX98373_R20FF_GLOBAL_SHDN:
449450
case MAX98373_R21FF_REV_ID:
450451
return true;
451452
default:

sound/soc/codecs/max98373-sdw.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ static bool max98373_volatile_reg(struct device *dev, unsigned int reg)
220220
case MAX98373_R2054_MEAS_ADC_PVDD_CH_READBACK:
221221
case MAX98373_R2055_MEAS_ADC_THERM_CH_READBACK:
222222
case MAX98373_R20B6_BDE_CUR_STATE_READBACK:
223+
case MAX98373_R20FF_GLOBAL_SHDN:
223224
case MAX98373_R21FF_REV_ID:
224225
/* SoundWire Control Port Registers */
225226
case MAX98373_R0040_SCP_INIT_STAT_1 ... MAX98373_R0070_SCP_FRAME_CTLR:

sound/soc/codecs/max98373.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,13 @@ static int max98373_dac_event(struct snd_soc_dapm_widget *w,
2828
regmap_update_bits(max98373->regmap,
2929
MAX98373_R20FF_GLOBAL_SHDN,
3030
MAX98373_GLOBAL_EN_MASK, 1);
31+
usleep_range(30000, 31000);
3132
break;
3233
case SND_SOC_DAPM_POST_PMD:
3334
regmap_update_bits(max98373->regmap,
3435
MAX98373_R20FF_GLOBAL_SHDN,
3536
MAX98373_GLOBAL_EN_MASK, 0);
37+
usleep_range(30000, 31000);
3638
max98373->tdm_mode = false;
3739
break;
3840
default:

sound/soc/codecs/wm8960.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,13 @@ int wm8960_configure_pll(struct snd_soc_component *component, int freq_in,
707707
best_freq_out = -EINVAL;
708708
*sysclk_idx = *dac_idx = *bclk_idx = -1;
709709

710-
for (i = 0; i < ARRAY_SIZE(sysclk_divs); ++i) {
710+
/*
711+
* From Datasheet, the PLL performs best when f2 is between
712+
* 90MHz and 100MHz, the desired sysclk output is 11.2896MHz
713+
* or 12.288MHz, then sysclkdiv = 2 is the best choice.
714+
* So search sysclk_divs from 2 to 1 other than from 1 to 2.
715+
*/
716+
for (i = ARRAY_SIZE(sysclk_divs) - 1; i >= 0; --i) {
711717
if (sysclk_divs[i] == -1)
712718
continue;
713719
for (j = 0; j < ARRAY_SIZE(dac_divs); ++j) {

sound/soc/fsl/fsl_esai.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -519,11 +519,13 @@ static int fsl_esai_startup(struct snd_pcm_substream *substream,
519519
ESAI_SAICR_SYNC, esai_priv->synchronous ?
520520
ESAI_SAICR_SYNC : 0);
521521

522-
/* Set a default slot number -- 2 */
522+
/* Set slots count */
523523
regmap_update_bits(esai_priv->regmap, REG_ESAI_TCCR,
524-
ESAI_xCCR_xDC_MASK, ESAI_xCCR_xDC(2));
524+
ESAI_xCCR_xDC_MASK,
525+
ESAI_xCCR_xDC(esai_priv->slots));
525526
regmap_update_bits(esai_priv->regmap, REG_ESAI_RCCR,
526-
ESAI_xCCR_xDC_MASK, ESAI_xCCR_xDC(2));
527+
ESAI_xCCR_xDC_MASK,
528+
ESAI_xCCR_xDC(esai_priv->slots));
527529
}
528530

529531
return 0;

sound/soc/intel/atom/sst-mfld-platform-pcm.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -487,15 +487,15 @@ static struct snd_soc_dai_driver sst_platform_dai[] = {
487487
.stream_name = "Headset Playback",
488488
.channels_min = SST_STEREO,
489489
.channels_max = SST_STEREO,
490-
.rates = SNDRV_PCM_RATE_44100|SNDRV_PCM_RATE_48000,
491-
.formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE,
490+
.rates = SNDRV_PCM_RATE_48000,
491+
.formats = SNDRV_PCM_FMTBIT_S16_LE,
492492
},
493493
.capture = {
494494
.stream_name = "Headset Capture",
495495
.channels_min = 1,
496496
.channels_max = 2,
497-
.rates = SNDRV_PCM_RATE_44100|SNDRV_PCM_RATE_48000,
498-
.formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE,
497+
.rates = SNDRV_PCM_RATE_48000,
498+
.formats = SNDRV_PCM_FMTBIT_S16_LE,
499499
},
500500
},
501501
{
@@ -505,8 +505,8 @@ static struct snd_soc_dai_driver sst_platform_dai[] = {
505505
.stream_name = "Deepbuffer Playback",
506506
.channels_min = SST_STEREO,
507507
.channels_max = SST_STEREO,
508-
.rates = SNDRV_PCM_RATE_44100|SNDRV_PCM_RATE_48000,
509-
.formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE,
508+
.rates = SNDRV_PCM_RATE_48000,
509+
.formats = SNDRV_PCM_FMTBIT_S16_LE,
510510
},
511511
},
512512
{

sound/soc/sof/core.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,13 @@ int snd_sof_device_shutdown(struct device *dev)
399399
{
400400
struct snd_sof_dev *sdev = dev_get_drvdata(dev);
401401

402-
return snd_sof_shutdown(sdev);
402+
if (IS_ENABLED(CONFIG_SND_SOC_SOF_PROBE_WORK_QUEUE))
403+
cancel_work_sync(&sdev->probe_work);
404+
405+
if (sdev->fw_state == SOF_FW_BOOT_COMPLETE)
406+
return snd_sof_shutdown(sdev);
407+
408+
return 0;
403409
}
404410
EXPORT_SYMBOL(snd_sof_device_shutdown);
405411

sound/soc/sof/intel/apl.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,10 @@ static const struct snd_sof_debugfs_map apl_dsp_debugfs[] = {
2727

2828
/* apollolake ops */
2929
const struct snd_sof_dsp_ops sof_apl_ops = {
30-
/* probe and remove */
30+
/* probe/remove/shutdown */
3131
.probe = hda_dsp_probe,
3232
.remove = hda_dsp_remove,
33+
.shutdown = hda_dsp_shutdown,
3334

3435
/* Register IO */
3536
.write = sof_io_write,

sound/soc/sof/intel/cnl.c

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -232,9 +232,10 @@ void cnl_ipc_dump(struct snd_sof_dev *sdev)
232232

233233
/* cannonlake ops */
234234
const struct snd_sof_dsp_ops sof_cnl_ops = {
235-
/* probe and remove */
235+
/* probe/remove/shutdown */
236236
.probe = hda_dsp_probe,
237237
.remove = hda_dsp_remove,
238+
.shutdown = hda_dsp_shutdown,
238239

239240
/* Register IO */
240241
.write = sof_io_write,
@@ -349,22 +350,6 @@ const struct sof_intel_dsp_desc cnl_chip_info = {
349350
};
350351
EXPORT_SYMBOL_NS(cnl_chip_info, SND_SOC_SOF_INTEL_HDA_COMMON);
351352

352-
const struct sof_intel_dsp_desc ehl_chip_info = {
353-
/* Elkhartlake */
354-
.cores_num = 4,
355-
.init_core_mask = 1,
356-
.host_managed_cores_mask = BIT(0),
357-
.ipc_req = CNL_DSP_REG_HIPCIDR,
358-
.ipc_req_mask = CNL_DSP_REG_HIPCIDR_BUSY,
359-
.ipc_ack = CNL_DSP_REG_HIPCIDA,
360-
.ipc_ack_mask = CNL_DSP_REG_HIPCIDA_DONE,
361-
.ipc_ctl = CNL_DSP_REG_HIPCCTL,
362-
.rom_init_timeout = 300,
363-
.ssp_count = ICL_SSP_COUNT,
364-
.ssp_base_offset = CNL_SSP_BASE_OFFSET,
365-
};
366-
EXPORT_SYMBOL_NS(ehl_chip_info, SND_SOC_SOF_INTEL_HDA_COMMON);
367-
368353
const struct sof_intel_dsp_desc jsl_chip_info = {
369354
/* Jasperlake */
370355
.cores_num = 2,

sound/soc/sof/intel/hda-dsp.c

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,10 +226,17 @@ bool hda_dsp_core_is_enabled(struct snd_sof_dev *sdev,
226226

227227
val = snd_sof_dsp_read(sdev, HDA_DSP_BAR, HDA_DSP_REG_ADSPCS);
228228

229-
is_enable = (val & HDA_DSP_ADSPCS_CPA_MASK(core_mask)) &&
230-
(val & HDA_DSP_ADSPCS_SPA_MASK(core_mask)) &&
231-
!(val & HDA_DSP_ADSPCS_CRST_MASK(core_mask)) &&
232-
!(val & HDA_DSP_ADSPCS_CSTALL_MASK(core_mask));
229+
#define MASK_IS_EQUAL(v, m, field) ({ \
230+
u32 _m = field(m); \
231+
((v) & _m) == _m; \
232+
})
233+
234+
is_enable = MASK_IS_EQUAL(val, core_mask, HDA_DSP_ADSPCS_CPA_MASK) &&
235+
MASK_IS_EQUAL(val, core_mask, HDA_DSP_ADSPCS_SPA_MASK) &&
236+
!(val & HDA_DSP_ADSPCS_CRST_MASK(core_mask)) &&
237+
!(val & HDA_DSP_ADSPCS_CSTALL_MASK(core_mask));
238+
239+
#undef MASK_IS_EQUAL
233240

234241
dev_dbg(sdev->dev, "DSP core(s) enabled? %d : core_mask %x\n",
235242
is_enable, core_mask);
@@ -885,6 +892,12 @@ int hda_dsp_suspend(struct snd_sof_dev *sdev, u32 target_state)
885892
return snd_sof_dsp_set_power_state(sdev, &target_dsp_state);
886893
}
887894

895+
int hda_dsp_shutdown(struct snd_sof_dev *sdev)
896+
{
897+
sdev->system_suspend_target = SOF_SUSPEND_S3;
898+
return snd_sof_suspend(sdev->dev);
899+
}
900+
888901
int hda_dsp_set_hw_params_upon_resume(struct snd_sof_dev *sdev)
889902
{
890903
#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA)

sound/soc/sof/intel/hda.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,7 @@ int hda_dsp_resume(struct snd_sof_dev *sdev);
517517
int hda_dsp_runtime_suspend(struct snd_sof_dev *sdev);
518518
int hda_dsp_runtime_resume(struct snd_sof_dev *sdev);
519519
int hda_dsp_runtime_idle(struct snd_sof_dev *sdev);
520+
int hda_dsp_shutdown(struct snd_sof_dev *sdev);
520521
int hda_dsp_set_hw_params_upon_resume(struct snd_sof_dev *sdev);
521522
void hda_dsp_dump(struct snd_sof_dev *sdev, u32 flags);
522523
void hda_ipc_dump(struct snd_sof_dev *sdev);

sound/soc/sof/intel/icl.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,10 @@ static const struct snd_sof_debugfs_map icl_dsp_debugfs[] = {
2626

2727
/* Icelake ops */
2828
const struct snd_sof_dsp_ops sof_icl_ops = {
29-
/* probe and remove */
29+
/* probe/remove/shutdown */
3030
.probe = hda_dsp_probe,
3131
.remove = hda_dsp_remove,
32+
.shutdown = hda_dsp_shutdown,
3233

3334
/* Register IO */
3435
.write = sof_io_write,

sound/soc/sof/intel/pci-tgl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ static const struct sof_dev_desc ehl_desc = {
6565
.default_tplg_path = "intel/sof-tplg",
6666
.default_fw_filename = "sof-ehl.ri",
6767
.nocodec_tplg_filename = "sof-ehl-nocodec.tplg",
68-
.ops = &sof_cnl_ops,
68+
.ops = &sof_tgl_ops,
6969
};
7070

7171
static const struct sof_dev_desc adls_desc = {

sound/soc/sof/intel/tgl.c

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const struct snd_sof_dsp_ops sof_tgl_ops = {
2525
/* probe/remove/shutdown */
2626
.probe = hda_dsp_probe,
2727
.remove = hda_dsp_remove,
28-
.shutdown = hda_dsp_remove,
28+
.shutdown = hda_dsp_shutdown,
2929

3030
/* Register IO */
3131
.write = sof_io_write,
@@ -156,6 +156,22 @@ const struct sof_intel_dsp_desc tglh_chip_info = {
156156
};
157157
EXPORT_SYMBOL_NS(tglh_chip_info, SND_SOC_SOF_INTEL_HDA_COMMON);
158158

159+
const struct sof_intel_dsp_desc ehl_chip_info = {
160+
/* Elkhartlake */
161+
.cores_num = 4,
162+
.init_core_mask = 1,
163+
.host_managed_cores_mask = BIT(0),
164+
.ipc_req = CNL_DSP_REG_HIPCIDR,
165+
.ipc_req_mask = CNL_DSP_REG_HIPCIDR_BUSY,
166+
.ipc_ack = CNL_DSP_REG_HIPCIDA,
167+
.ipc_ack_mask = CNL_DSP_REG_HIPCIDA_DONE,
168+
.ipc_ctl = CNL_DSP_REG_HIPCCTL,
169+
.rom_init_timeout = 300,
170+
.ssp_count = ICL_SSP_COUNT,
171+
.ssp_base_offset = CNL_SSP_BASE_OFFSET,
172+
};
173+
EXPORT_SYMBOL_NS(ehl_chip_info, SND_SOC_SOF_INTEL_HDA_COMMON);
174+
159175
const struct sof_intel_dsp_desc adls_chip_info = {
160176
/* Alderlake-S */
161177
.cores_num = 2,

sound/soc/sunxi/sun4i-codec.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1364,6 +1364,7 @@ static struct snd_soc_card *sun4i_codec_create_card(struct device *dev)
13641364
return ERR_PTR(-ENOMEM);
13651365

13661366
card->dev = dev;
1367+
card->owner = THIS_MODULE;
13671368
card->name = "sun4i-codec";
13681369
card->dapm_widgets = sun4i_codec_card_dapm_widgets;
13691370
card->num_dapm_widgets = ARRAY_SIZE(sun4i_codec_card_dapm_widgets);
@@ -1396,6 +1397,7 @@ static struct snd_soc_card *sun6i_codec_create_card(struct device *dev)
13961397
return ERR_PTR(-ENOMEM);
13971398

13981399
card->dev = dev;
1400+
card->owner = THIS_MODULE;
13991401
card->name = "A31 Audio Codec";
14001402
card->dapm_widgets = sun6i_codec_card_dapm_widgets;
14011403
card->num_dapm_widgets = ARRAY_SIZE(sun6i_codec_card_dapm_widgets);
@@ -1449,6 +1451,7 @@ static struct snd_soc_card *sun8i_a23_codec_create_card(struct device *dev)
14491451
return ERR_PTR(-ENOMEM);
14501452

14511453
card->dev = dev;
1454+
card->owner = THIS_MODULE;
14521455
card->name = "A23 Audio Codec";
14531456
card->dapm_widgets = sun6i_codec_card_dapm_widgets;
14541457
card->num_dapm_widgets = ARRAY_SIZE(sun6i_codec_card_dapm_widgets);
@@ -1487,6 +1490,7 @@ static struct snd_soc_card *sun8i_h3_codec_create_card(struct device *dev)
14871490
return ERR_PTR(-ENOMEM);
14881491

14891492
card->dev = dev;
1493+
card->owner = THIS_MODULE;
14901494
card->name = "H3 Audio Codec";
14911495
card->dapm_widgets = sun6i_codec_card_dapm_widgets;
14921496
card->num_dapm_widgets = ARRAY_SIZE(sun6i_codec_card_dapm_widgets);
@@ -1525,6 +1529,7 @@ static struct snd_soc_card *sun8i_v3s_codec_create_card(struct device *dev)
15251529
return ERR_PTR(-ENOMEM);
15261530

15271531
card->dev = dev;
1532+
card->owner = THIS_MODULE;
15281533
card->name = "V3s Audio Codec";
15291534
card->dapm_widgets = sun6i_codec_card_dapm_widgets;
15301535
card->num_dapm_widgets = ARRAY_SIZE(sun6i_codec_card_dapm_widgets);

0 commit comments

Comments
 (0)