Skip to content

Commit 220c8f6

Browse files
committed
Merge tag 'asoc-fix-v6.5-rc6' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
ASoC: Fixes for v6.5 A fairly large collection of fixes here, mostly SOF and Intel related. The one core fix is Hans' change which reduces the log spam when working out new use cases for DPCM.
2 parents 7c76116 + 37aba31 commit 220c8f6

File tree

12 files changed

+73
-35
lines changed

12 files changed

+73
-35
lines changed

sound/soc/codecs/max98363.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,10 @@ static int max98363_io_init(struct sdw_slave *slave)
185185
pm_runtime_get_noresume(dev);
186186

187187
ret = regmap_read(max98363->regmap, MAX98363_R21FF_REV_ID, &reg);
188-
if (!ret) {
188+
if (!ret)
189189
dev_info(dev, "Revision ID: %X\n", reg);
190-
return ret;
191-
}
190+
else
191+
goto out;
192192

193193
if (max98363->first_hw_init) {
194194
regcache_cache_bypass(max98363->regmap, false);
@@ -198,10 +198,11 @@ static int max98363_io_init(struct sdw_slave *slave)
198198
max98363->first_hw_init = true;
199199
max98363->hw_init = true;
200200

201+
out:
201202
pm_runtime_mark_last_busy(dev);
202203
pm_runtime_put_autosuspend(dev);
203204

204-
return 0;
205+
return ret;
205206
}
206207

207208
#define MAX98363_RATES SNDRV_PCM_RATE_8000_192000

sound/soc/codecs/rt1308-sdw.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ static bool rt1308_volatile_register(struct device *dev, unsigned int reg)
5252
case 0x300a:
5353
case 0xc000:
5454
case 0xc710:
55+
case 0xcf01:
5556
case 0xc860 ... 0xc863:
5657
case 0xc870 ... 0xc873:
5758
return true;
@@ -213,7 +214,7 @@ static int rt1308_io_init(struct device *dev, struct sdw_slave *slave)
213214
{
214215
struct rt1308_sdw_priv *rt1308 = dev_get_drvdata(dev);
215216
int ret = 0;
216-
unsigned int tmp;
217+
unsigned int tmp, hibernation_flag;
217218

218219
if (rt1308->hw_init)
219220
return 0;
@@ -242,6 +243,10 @@ static int rt1308_io_init(struct device *dev, struct sdw_slave *slave)
242243

243244
pm_runtime_get_noresume(&slave->dev);
244245

246+
regmap_read(rt1308->regmap, 0xcf01, &hibernation_flag);
247+
if ((hibernation_flag != 0x00) && rt1308->first_hw_init)
248+
goto _preset_ready_;
249+
245250
/* sw reset */
246251
regmap_write(rt1308->regmap, RT1308_SDW_RESET, 0);
247252

@@ -282,6 +287,12 @@ static int rt1308_io_init(struct device *dev, struct sdw_slave *slave)
282287
regmap_write(rt1308->regmap, 0xc100, 0xd7);
283288
regmap_write(rt1308->regmap, 0xc101, 0xd7);
284289

290+
/* apply BQ params */
291+
rt1308_apply_bq_params(rt1308);
292+
293+
regmap_write(rt1308->regmap, 0xcf01, 0x01);
294+
295+
_preset_ready_:
285296
if (rt1308->first_hw_init) {
286297
regcache_cache_bypass(rt1308->regmap, false);
287298
regcache_mark_dirty(rt1308->regmap);

sound/soc/codecs/rt5665.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4472,6 +4472,8 @@ static void rt5665_remove(struct snd_soc_component *component)
44724472
struct rt5665_priv *rt5665 = snd_soc_component_get_drvdata(component);
44734473

44744474
regmap_write(rt5665->regmap, RT5665_RESET, 0);
4475+
4476+
regulator_bulk_disable(ARRAY_SIZE(rt5665->supplies), rt5665->supplies);
44754477
}
44764478

44774479
#ifdef CONFIG_PM

sound/soc/intel/boards/sof_sdw.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ static const struct dmi_system_id sof_sdw_quirk_table[] = {
476476
DMI_MATCH(DMI_SYS_VENDOR, "Intel Corporation"),
477477
DMI_MATCH(DMI_PRODUCT_NAME, "Lunar Lake Client Platform"),
478478
},
479-
.driver_data = (void *)(RT711_JD2_100K),
479+
.driver_data = (void *)(RT711_JD2),
480480
},
481481
{}
482482
};

sound/soc/intel/boards/sof_sdw_cs42l42.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ static int cs42l42_rtd_init(struct snd_soc_pcm_runtime *rtd)
9999
jack = &ctx->sdw_headset;
100100

101101
snd_jack_set_key(jack->jack, SND_JACK_BTN_0, KEY_PLAYPAUSE);
102-
snd_jack_set_key(jack->jack, SND_JACK_BTN_1, KEY_VOICECOMMAND);
103-
snd_jack_set_key(jack->jack, SND_JACK_BTN_2, KEY_VOLUMEUP);
104-
snd_jack_set_key(jack->jack, SND_JACK_BTN_3, KEY_VOLUMEDOWN);
102+
snd_jack_set_key(jack->jack, SND_JACK_BTN_1, KEY_VOLUMEUP);
103+
snd_jack_set_key(jack->jack, SND_JACK_BTN_2, KEY_VOLUMEDOWN);
104+
snd_jack_set_key(jack->jack, SND_JACK_BTN_3, KEY_VOICECOMMAND);
105105

106106
ret = snd_soc_component_set_jack(component, jack, NULL);
107107

sound/soc/meson/axg-tdm-formatter.c

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,27 +30,32 @@ int axg_tdm_formatter_set_channel_masks(struct regmap *map,
3030
struct axg_tdm_stream *ts,
3131
unsigned int offset)
3232
{
33-
unsigned int val, ch = ts->channels;
34-
unsigned long mask;
35-
int i, j;
33+
unsigned int ch = ts->channels;
34+
u32 val[AXG_TDM_NUM_LANES];
35+
int i, j, k;
36+
37+
/*
38+
* We need to mimick the slot distribution used by the HW to keep the
39+
* channel placement consistent regardless of the number of channel
40+
* in the stream. This is why the odd algorithm below is used.
41+
*/
42+
memset(val, 0, sizeof(*val) * AXG_TDM_NUM_LANES);
3643

3744
/*
3845
* Distribute the channels of the stream over the available slots
39-
* of each TDM lane
46+
* of each TDM lane. We need to go over the 32 slots ...
4047
*/
41-
for (i = 0; i < AXG_TDM_NUM_LANES; i++) {
42-
val = 0;
43-
mask = ts->mask[i];
44-
45-
for (j = find_first_bit(&mask, 32);
46-
(j < 32) && ch;
47-
j = find_next_bit(&mask, 32, j + 1)) {
48-
val |= 1 << j;
49-
ch -= 1;
48+
for (i = 0; (i < 32) && ch; i += 2) {
49+
/* ... of all the lanes ... */
50+
for (j = 0; j < AXG_TDM_NUM_LANES; j++) {
51+
/* ... then distribute the channels in pairs */
52+
for (k = 0; k < 2; k++) {
53+
if ((BIT(i + k) & ts->mask[j]) && ch) {
54+
val[j] |= BIT(i + k);
55+
ch -= 1;
56+
}
57+
}
5058
}
51-
52-
regmap_write(map, offset, val);
53-
offset += regmap_get_reg_stride(map);
5459
}
5560

5661
/*
@@ -63,6 +68,11 @@ int axg_tdm_formatter_set_channel_masks(struct regmap *map,
6368
return -EINVAL;
6469
}
6570

71+
for (i = 0; i < AXG_TDM_NUM_LANES; i++) {
72+
regmap_write(map, offset, val[i]);
73+
offset += regmap_get_reg_stride(map);
74+
}
75+
6676
return 0;
6777
}
6878
EXPORT_SYMBOL_GPL(axg_tdm_formatter_set_channel_masks);

sound/soc/soc-pcm.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ static inline int _soc_pcm_ret(struct snd_soc_pcm_runtime *rtd,
3838
switch (ret) {
3939
case -EPROBE_DEFER:
4040
case -ENOTSUPP:
41+
case -EINVAL:
4142
break;
4243
default:
4344
dev_err(rtd->dev,
@@ -2466,8 +2467,11 @@ static int dpcm_fe_dai_prepare(struct snd_pcm_substream *substream)
24662467

24672468
/* there is no point preparing this FE if there are no BEs */
24682469
if (list_empty(&fe->dpcm[stream].be_clients)) {
2469-
dev_err(fe->dev, "ASoC: no backend DAIs enabled for %s\n",
2470-
fe->dai_link->name);
2470+
/* dev_err_once() for visibility, dev_dbg() for debugging UCM profiles */
2471+
dev_err_once(fe->dev, "ASoC: no backend DAIs enabled for %s, possibly missing ALSA mixer-based routing or UCM profile\n",
2472+
fe->dai_link->name);
2473+
dev_dbg(fe->dev, "ASoC: no backend DAIs enabled for %s\n",
2474+
fe->dai_link->name);
24712475
ret = -EINVAL;
24722476
goto out;
24732477
}

sound/soc/sof/intel/hda-dai-ops.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,16 +372,25 @@ static const struct hda_dai_widget_dma_ops hda_ipc4_chain_dma_ops = {
372372
static int hda_ipc3_post_trigger(struct snd_sof_dev *sdev, struct snd_soc_dai *cpu_dai,
373373
struct snd_pcm_substream *substream, int cmd)
374374
{
375+
struct hdac_ext_stream *hext_stream = hda_get_hext_stream(sdev, cpu_dai, substream);
375376
struct snd_soc_dapm_widget *w = snd_soc_dai_get_widget(cpu_dai, substream->stream);
376377

377378
switch (cmd) {
378379
case SNDRV_PCM_TRIGGER_SUSPEND:
379380
case SNDRV_PCM_TRIGGER_STOP:
380381
{
381382
struct snd_sof_dai_config_data data = { 0 };
383+
int ret;
382384

383385
data.dai_data = DMA_CHAN_INVALID;
384-
return hda_dai_config(w, SOF_DAI_CONFIG_FLAGS_HW_FREE, &data);
386+
ret = hda_dai_config(w, SOF_DAI_CONFIG_FLAGS_HW_FREE, &data);
387+
if (ret < 0)
388+
return ret;
389+
390+
if (cmd == SNDRV_PCM_TRIGGER_STOP)
391+
return hda_link_dma_cleanup(substream, hext_stream, cpu_dai);
392+
393+
break;
385394
}
386395
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
387396
return hda_dai_config(w, SOF_DAI_CONFIG_FLAGS_PAUSE, NULL);

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,8 @@ hda_dai_get_ops(struct snd_pcm_substream *substream, struct snd_soc_dai *cpu_dai
107107
return sdai->platform_private;
108108
}
109109

110-
static int hda_link_dma_cleanup(struct snd_pcm_substream *substream,
111-
struct hdac_ext_stream *hext_stream,
112-
struct snd_soc_dai *cpu_dai)
110+
int hda_link_dma_cleanup(struct snd_pcm_substream *substream, struct hdac_ext_stream *hext_stream,
111+
struct snd_soc_dai *cpu_dai)
113112
{
114113
const struct hda_dai_widget_dma_ops *ops = hda_dai_get_ops(substream, cpu_dai);
115114
struct sof_intel_hda_stream *hda_stream;

sound/soc/sof/intel/hda.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -963,5 +963,7 @@ const struct hda_dai_widget_dma_ops *
963963
hda_select_dai_widget_ops(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget);
964964
int hda_dai_config(struct snd_soc_dapm_widget *w, unsigned int flags,
965965
struct snd_sof_dai_config_data *data);
966+
int hda_link_dma_cleanup(struct snd_pcm_substream *substream, struct hdac_ext_stream *hext_stream,
967+
struct snd_soc_dai *cpu_dai);
966968

967969
#endif

0 commit comments

Comments
 (0)