Skip to content

Commit 529b10c

Browse files
committed
Merge tag 'sound-6.9-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Pull sound fixes from Takashi Iwai: "A collection of device-specific small fixes: a series of fixes for TAS2781 HD-audio codec, ASoC SOF, Cirrus CS35L56 and a couple of legacy drivers" * tag 'sound-6.9-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: ALSA: hda/tas2781: remove useless dev_dbg from playback_hook ALSA: hda/tas2781: add debug statements to kcontrols ALSA: hda/tas2781: add locks to kcontrols ALSA: hda/tas2781: remove digital gain kcontrol ALSA: aoa: avoid false-positive format truncation warning ALSA: sh: aica: reorder cleanup operations to avoid UAF bugs ALSA: hda: cs35l56: Set the init_done flag before component_add() ALSA: hda: cs35l56: Raise device name message log level ASoC: SOF: ipc4-topology: support NHLT device type ALSA: hda: intel-nhlt: add intel_nhlt_ssp_device_type() function
2 parents 6e7a2ff + 1506d96 commit 529b10c

File tree

7 files changed

+148
-52
lines changed

7 files changed

+148
-52
lines changed

include/sound/intel-nhlt.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,9 @@ intel_nhlt_get_endpoint_blob(struct device *dev, struct nhlt_acpi_table *nhlt,
143143
u32 bus_id, u8 link_type, u8 vbps, u8 bps,
144144
u8 num_ch, u32 rate, u8 dir, u8 dev_type);
145145

146+
int intel_nhlt_ssp_device_type(struct device *dev, struct nhlt_acpi_table *nhlt,
147+
u8 virtual_bus_id);
148+
146149
#else
147150

148151
static inline struct nhlt_acpi_table *intel_nhlt_init(struct device *dev)
@@ -184,6 +187,13 @@ intel_nhlt_get_endpoint_blob(struct device *dev, struct nhlt_acpi_table *nhlt,
184187
return NULL;
185188
}
186189

190+
static inline int intel_nhlt_ssp_device_type(struct device *dev,
191+
struct nhlt_acpi_table *nhlt,
192+
u8 virtual_bus_id)
193+
{
194+
return -EINVAL;
195+
}
196+
187197
#endif
188198

189199
#endif

sound/aoa/soundbus/i2sbus/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ static int i2sbus_add_dev(struct macio_dev *macio,
158158
struct device_node *child, *sound = NULL;
159159
struct resource *r;
160160
int i, layout = 0, rlen, ok = force;
161-
char node_name[6];
161+
char node_name[8];
162162
static const char *rnames[] = { "i2sbus: %pOFn (control)",
163163
"i2sbus: %pOFn (tx)",
164164
"i2sbus: %pOFn (rx)" };

sound/hda/intel-nhlt.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,3 +343,29 @@ intel_nhlt_get_endpoint_blob(struct device *dev, struct nhlt_acpi_table *nhlt,
343343
return NULL;
344344
}
345345
EXPORT_SYMBOL(intel_nhlt_get_endpoint_blob);
346+
347+
int intel_nhlt_ssp_device_type(struct device *dev, struct nhlt_acpi_table *nhlt,
348+
u8 virtual_bus_id)
349+
{
350+
struct nhlt_endpoint *epnt;
351+
int i;
352+
353+
if (!nhlt)
354+
return -EINVAL;
355+
356+
epnt = (struct nhlt_endpoint *)nhlt->desc;
357+
for (i = 0; i < nhlt->endpoint_count; i++) {
358+
/* for SSP link the virtual bus id is the SSP port number */
359+
if (epnt->linktype == NHLT_LINK_SSP &&
360+
epnt->virtual_bus_id == virtual_bus_id) {
361+
dev_dbg(dev, "SSP%d: dev_type=%d\n", virtual_bus_id,
362+
epnt->device_type);
363+
return epnt->device_type;
364+
}
365+
366+
epnt = (struct nhlt_endpoint *)((u8 *)epnt + epnt->length);
367+
}
368+
369+
return -EINVAL;
370+
}
371+
EXPORT_SYMBOL(intel_nhlt_ssp_device_type);

sound/pci/hda/cs35l56_hda.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,8 +1024,8 @@ int cs35l56_hda_common_probe(struct cs35l56_hda *cs35l56, int hid, int id)
10241024
goto err;
10251025
}
10261026

1027-
dev_dbg(cs35l56->base.dev, "DSP system name: '%s', amp name: '%s'\n",
1028-
cs35l56->system_name, cs35l56->amp_name);
1027+
dev_info(cs35l56->base.dev, "DSP system name: '%s', amp name: '%s'\n",
1028+
cs35l56->system_name, cs35l56->amp_name);
10291029

10301030
regmap_multi_reg_write(cs35l56->base.regmap, cs35l56_hda_dai_config,
10311031
ARRAY_SIZE(cs35l56_hda_dai_config));
@@ -1045,14 +1045,14 @@ int cs35l56_hda_common_probe(struct cs35l56_hda *cs35l56, int hid, int id)
10451045
pm_runtime_mark_last_busy(cs35l56->base.dev);
10461046
pm_runtime_enable(cs35l56->base.dev);
10471047

1048+
cs35l56->base.init_done = true;
1049+
10481050
ret = component_add(cs35l56->base.dev, &cs35l56_hda_comp_ops);
10491051
if (ret) {
10501052
dev_err(cs35l56->base.dev, "Register component failed: %d\n", ret);
10511053
goto pm_err;
10521054
}
10531055

1054-
cs35l56->base.init_done = true;
1055-
10561056
return 0;
10571057

10581058
pm_err:

sound/pci/hda/tas2781_hda_i2c.c

Lines changed: 77 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ struct tas2781_hda {
8989
struct snd_kcontrol *dsp_prog_ctl;
9090
struct snd_kcontrol *dsp_conf_ctl;
9191
struct snd_kcontrol *prof_ctl;
92-
struct snd_kcontrol *snd_ctls[3];
92+
struct snd_kcontrol *snd_ctls[2];
9393
};
9494

9595
static int tas2781_get_i2c_res(struct acpi_resource *ares, void *data)
@@ -161,8 +161,6 @@ static void tas2781_hda_playback_hook(struct device *dev, int action)
161161
pm_runtime_put_autosuspend(dev);
162162
break;
163163
default:
164-
dev_dbg(tas_hda->dev, "Playback action not supported: %d\n",
165-
action);
166164
break;
167165
}
168166
}
@@ -185,8 +183,15 @@ static int tasdevice_get_profile_id(struct snd_kcontrol *kcontrol,
185183
{
186184
struct tasdevice_priv *tas_priv = snd_kcontrol_chip(kcontrol);
187185

186+
mutex_lock(&tas_priv->codec_lock);
187+
188188
ucontrol->value.integer.value[0] = tas_priv->rcabin.profile_cfg_id;
189189

190+
dev_dbg(tas_priv->dev, "%s: kcontrol %s: %d\n",
191+
__func__, kcontrol->id.name, tas_priv->rcabin.profile_cfg_id);
192+
193+
mutex_unlock(&tas_priv->codec_lock);
194+
190195
return 0;
191196
}
192197

@@ -200,11 +205,19 @@ static int tasdevice_set_profile_id(struct snd_kcontrol *kcontrol,
200205

201206
val = clamp(nr_profile, 0, max);
202207

208+
mutex_lock(&tas_priv->codec_lock);
209+
210+
dev_dbg(tas_priv->dev, "%s: kcontrol %s: %d -> %d\n",
211+
__func__, kcontrol->id.name,
212+
tas_priv->rcabin.profile_cfg_id, val);
213+
203214
if (tas_priv->rcabin.profile_cfg_id != val) {
204215
tas_priv->rcabin.profile_cfg_id = val;
205216
ret = 1;
206217
}
207218

219+
mutex_unlock(&tas_priv->codec_lock);
220+
208221
return ret;
209222
}
210223

@@ -241,8 +254,15 @@ static int tasdevice_program_get(struct snd_kcontrol *kcontrol,
241254
{
242255
struct tasdevice_priv *tas_priv = snd_kcontrol_chip(kcontrol);
243256

257+
mutex_lock(&tas_priv->codec_lock);
258+
244259
ucontrol->value.integer.value[0] = tas_priv->cur_prog;
245260

261+
dev_dbg(tas_priv->dev, "%s: kcontrol %s: %d\n",
262+
__func__, kcontrol->id.name, tas_priv->cur_prog);
263+
264+
mutex_unlock(&tas_priv->codec_lock);
265+
246266
return 0;
247267
}
248268

@@ -257,11 +277,18 @@ static int tasdevice_program_put(struct snd_kcontrol *kcontrol,
257277

258278
val = clamp(nr_program, 0, max);
259279

280+
mutex_lock(&tas_priv->codec_lock);
281+
282+
dev_dbg(tas_priv->dev, "%s: kcontrol %s: %d -> %d\n",
283+
__func__, kcontrol->id.name, tas_priv->cur_prog, val);
284+
260285
if (tas_priv->cur_prog != val) {
261286
tas_priv->cur_prog = val;
262287
ret = 1;
263288
}
264289

290+
mutex_unlock(&tas_priv->codec_lock);
291+
265292
return ret;
266293
}
267294

@@ -270,8 +297,15 @@ static int tasdevice_config_get(struct snd_kcontrol *kcontrol,
270297
{
271298
struct tasdevice_priv *tas_priv = snd_kcontrol_chip(kcontrol);
272299

300+
mutex_lock(&tas_priv->codec_lock);
301+
273302
ucontrol->value.integer.value[0] = tas_priv->cur_conf;
274303

304+
dev_dbg(tas_priv->dev, "%s: kcontrol %s: %d\n",
305+
__func__, kcontrol->id.name, tas_priv->cur_conf);
306+
307+
mutex_unlock(&tas_priv->codec_lock);
308+
275309
return 0;
276310
}
277311

@@ -286,54 +320,39 @@ static int tasdevice_config_put(struct snd_kcontrol *kcontrol,
286320

287321
val = clamp(nr_config, 0, max);
288322

323+
mutex_lock(&tas_priv->codec_lock);
324+
325+
dev_dbg(tas_priv->dev, "%s: kcontrol %s: %d -> %d\n",
326+
__func__, kcontrol->id.name, tas_priv->cur_conf, val);
327+
289328
if (tas_priv->cur_conf != val) {
290329
tas_priv->cur_conf = val;
291330
ret = 1;
292331
}
293332

333+
mutex_unlock(&tas_priv->codec_lock);
334+
294335
return ret;
295336
}
296337

297-
/*
298-
* tas2781_digital_getvol - get the volum control
299-
* @kcontrol: control pointer
300-
* @ucontrol: User data
301-
* Customer Kcontrol for tas2781 is primarily for regmap booking, paging
302-
* depends on internal regmap mechanism.
303-
* tas2781 contains book and page two-level register map, especially
304-
* book switching will set the register BXXP00R7F, after switching to the
305-
* correct book, then leverage the mechanism for paging to access the
306-
* register.
307-
*/
308-
static int tas2781_digital_getvol(struct snd_kcontrol *kcontrol,
338+
static int tas2781_amp_getvol(struct snd_kcontrol *kcontrol,
309339
struct snd_ctl_elem_value *ucontrol)
310340
{
311341
struct tasdevice_priv *tas_priv = snd_kcontrol_chip(kcontrol);
312342
struct soc_mixer_control *mc =
313343
(struct soc_mixer_control *)kcontrol->private_value;
344+
int ret;
314345

315-
return tasdevice_digital_getvol(tas_priv, ucontrol, mc);
316-
}
346+
mutex_lock(&tas_priv->codec_lock);
317347

318-
static int tas2781_amp_getvol(struct snd_kcontrol *kcontrol,
319-
struct snd_ctl_elem_value *ucontrol)
320-
{
321-
struct tasdevice_priv *tas_priv = snd_kcontrol_chip(kcontrol);
322-
struct soc_mixer_control *mc =
323-
(struct soc_mixer_control *)kcontrol->private_value;
348+
ret = tasdevice_amp_getvol(tas_priv, ucontrol, mc);
324349

325-
return tasdevice_amp_getvol(tas_priv, ucontrol, mc);
326-
}
350+
dev_dbg(tas_priv->dev, "%s: kcontrol %s: %ld\n",
351+
__func__, kcontrol->id.name, ucontrol->value.integer.value[0]);
327352

328-
static int tas2781_digital_putvol(struct snd_kcontrol *kcontrol,
329-
struct snd_ctl_elem_value *ucontrol)
330-
{
331-
struct tasdevice_priv *tas_priv = snd_kcontrol_chip(kcontrol);
332-
struct soc_mixer_control *mc =
333-
(struct soc_mixer_control *)kcontrol->private_value;
353+
mutex_unlock(&tas_priv->codec_lock);
334354

335-
/* The check of the given value is in tasdevice_digital_putvol. */
336-
return tasdevice_digital_putvol(tas_priv, ucontrol, mc);
355+
return ret;
337356
}
338357

339358
static int tas2781_amp_putvol(struct snd_kcontrol *kcontrol,
@@ -342,19 +361,33 @@ static int tas2781_amp_putvol(struct snd_kcontrol *kcontrol,
342361
struct tasdevice_priv *tas_priv = snd_kcontrol_chip(kcontrol);
343362
struct soc_mixer_control *mc =
344363
(struct soc_mixer_control *)kcontrol->private_value;
364+
int ret;
365+
366+
mutex_lock(&tas_priv->codec_lock);
367+
368+
dev_dbg(tas_priv->dev, "%s: kcontrol %s: -> %ld\n",
369+
__func__, kcontrol->id.name, ucontrol->value.integer.value[0]);
345370

346371
/* The check of the given value is in tasdevice_amp_putvol. */
347-
return tasdevice_amp_putvol(tas_priv, ucontrol, mc);
372+
ret = tasdevice_amp_putvol(tas_priv, ucontrol, mc);
373+
374+
mutex_unlock(&tas_priv->codec_lock);
375+
376+
return ret;
348377
}
349378

350379
static int tas2781_force_fwload_get(struct snd_kcontrol *kcontrol,
351380
struct snd_ctl_elem_value *ucontrol)
352381
{
353382
struct tasdevice_priv *tas_priv = snd_kcontrol_chip(kcontrol);
354383

384+
mutex_lock(&tas_priv->codec_lock);
385+
355386
ucontrol->value.integer.value[0] = (int)tas_priv->force_fwload_status;
356-
dev_dbg(tas_priv->dev, "%s : Force FWload %s\n", __func__,
357-
tas_priv->force_fwload_status ? "ON" : "OFF");
387+
dev_dbg(tas_priv->dev, "%s: kcontrol %s: %d\n",
388+
__func__, kcontrol->id.name, tas_priv->force_fwload_status);
389+
390+
mutex_unlock(&tas_priv->codec_lock);
358391

359392
return 0;
360393
}
@@ -365,14 +398,20 @@ static int tas2781_force_fwload_put(struct snd_kcontrol *kcontrol,
365398
struct tasdevice_priv *tas_priv = snd_kcontrol_chip(kcontrol);
366399
bool change, val = (bool)ucontrol->value.integer.value[0];
367400

401+
mutex_lock(&tas_priv->codec_lock);
402+
403+
dev_dbg(tas_priv->dev, "%s: kcontrol %s: %d -> %d\n",
404+
__func__, kcontrol->id.name,
405+
tas_priv->force_fwload_status, val);
406+
368407
if (tas_priv->force_fwload_status == val)
369408
change = false;
370409
else {
371410
change = true;
372411
tas_priv->force_fwload_status = val;
373412
}
374-
dev_dbg(tas_priv->dev, "%s : Force FWload %s\n", __func__,
375-
tas_priv->force_fwload_status ? "ON" : "OFF");
413+
414+
mutex_unlock(&tas_priv->codec_lock);
376415

377416
return change;
378417
}
@@ -381,9 +420,6 @@ static const struct snd_kcontrol_new tas2781_snd_controls[] = {
381420
ACARD_SINGLE_RANGE_EXT_TLV("Speaker Analog Gain", TAS2781_AMP_LEVEL,
382421
1, 0, 20, 0, tas2781_amp_getvol,
383422
tas2781_amp_putvol, amp_vol_tlv),
384-
ACARD_SINGLE_RANGE_EXT_TLV("Speaker Digital Gain", TAS2781_DVC_LVL,
385-
0, 0, 200, 1, tas2781_digital_getvol,
386-
tas2781_digital_putvol, dvc_tlv),
387423
ACARD_SINGLE_BOOL_EXT("Speaker Force Firmware Load", 0,
388424
tas2781_force_fwload_get, tas2781_force_fwload_put),
389425
};

sound/sh/aica.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,8 @@ static void run_spu_dma(struct work_struct *work)
278278
dreamcastcard->clicks++;
279279
if (unlikely(dreamcastcard->clicks >= AICA_PERIOD_NUMBER))
280280
dreamcastcard->clicks %= AICA_PERIOD_NUMBER;
281-
mod_timer(&dreamcastcard->timer, jiffies + 1);
281+
if (snd_pcm_running(dreamcastcard->substream))
282+
mod_timer(&dreamcastcard->timer, jiffies + 1);
282283
}
283284
}
284285

@@ -290,6 +291,8 @@ static void aica_period_elapsed(struct timer_list *t)
290291
/*timer function - so cannot sleep */
291292
int play_period;
292293
struct snd_pcm_runtime *runtime;
294+
if (!snd_pcm_running(substream))
295+
return;
293296
runtime = substream->runtime;
294297
dreamcastcard = substream->pcm->private_data;
295298
/* Have we played out an additional period? */
@@ -350,12 +353,19 @@ static int snd_aicapcm_pcm_open(struct snd_pcm_substream
350353
return 0;
351354
}
352355

356+
static int snd_aicapcm_pcm_sync_stop(struct snd_pcm_substream *substream)
357+
{
358+
struct snd_card_aica *dreamcastcard = substream->pcm->private_data;
359+
360+
del_timer_sync(&dreamcastcard->timer);
361+
cancel_work_sync(&dreamcastcard->spu_dma_work);
362+
return 0;
363+
}
364+
353365
static int snd_aicapcm_pcm_close(struct snd_pcm_substream
354366
*substream)
355367
{
356368
struct snd_card_aica *dreamcastcard = substream->pcm->private_data;
357-
flush_work(&(dreamcastcard->spu_dma_work));
358-
del_timer(&dreamcastcard->timer);
359369
dreamcastcard->substream = NULL;
360370
kfree(dreamcastcard->channel);
361371
spu_disable();
@@ -401,6 +411,7 @@ static const struct snd_pcm_ops snd_aicapcm_playback_ops = {
401411
.prepare = snd_aicapcm_pcm_prepare,
402412
.trigger = snd_aicapcm_pcm_trigger,
403413
.pointer = snd_aicapcm_pcm_pointer,
414+
.sync_stop = snd_aicapcm_pcm_sync_stop,
404415
};
405416

406417
/* TO DO: set up to handle more than one pcm instance */

0 commit comments

Comments
 (0)