Skip to content

Commit a0309c3

Browse files
committed
Merge tag 'asoc-fix-v5.13-rc4' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
ASoC: Fixes for v5.13 A collection of fixes and device ID updates that have come up in the past few -rcs, none of which stand out particularly.
2 parents 600dd2a + c8a4556 commit a0309c3

File tree

10 files changed

+122
-18
lines changed

10 files changed

+122
-18
lines changed

Documentation/devicetree/bindings/sound/amlogic,gx-sound-card.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ patternProperties:
5757
rate
5858
5959
sound-dai:
60-
$ref: /schemas/types.yaml#/definitions/phandle
60+
$ref: /schemas/types.yaml#/definitions/phandle-array
6161
description: phandle of the CPU DAI
6262

6363
patternProperties:
@@ -71,7 +71,7 @@ patternProperties:
7171
7272
properties:
7373
sound-dai:
74-
$ref: /schemas/types.yaml#/definitions/phandle
74+
$ref: /schemas/types.yaml#/definitions/phandle-array
7575
description: phandle of the codec DAI
7676

7777
required:

sound/soc/codecs/rt5659.c

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2433,13 +2433,18 @@ static int set_dmic_power(struct snd_soc_dapm_widget *w,
24332433
return 0;
24342434
}
24352435

2436-
static const struct snd_soc_dapm_widget rt5659_dapm_widgets[] = {
2436+
static const struct snd_soc_dapm_widget rt5659_particular_dapm_widgets[] = {
24372437
SND_SOC_DAPM_SUPPLY("LDO2", RT5659_PWR_ANLG_3, RT5659_PWR_LDO2_BIT, 0,
24382438
NULL, 0),
2439-
SND_SOC_DAPM_SUPPLY("PLL", RT5659_PWR_ANLG_3, RT5659_PWR_PLL_BIT, 0,
2440-
NULL, 0),
2439+
SND_SOC_DAPM_SUPPLY("MICBIAS1", RT5659_PWR_ANLG_2, RT5659_PWR_MB1_BIT,
2440+
0, NULL, 0),
24412441
SND_SOC_DAPM_SUPPLY("Mic Det Power", RT5659_PWR_VOL,
24422442
RT5659_PWR_MIC_DET_BIT, 0, NULL, 0),
2443+
};
2444+
2445+
static const struct snd_soc_dapm_widget rt5659_dapm_widgets[] = {
2446+
SND_SOC_DAPM_SUPPLY("PLL", RT5659_PWR_ANLG_3, RT5659_PWR_PLL_BIT, 0,
2447+
NULL, 0),
24432448
SND_SOC_DAPM_SUPPLY("Mono Vref", RT5659_PWR_ANLG_1,
24442449
RT5659_PWR_VREF3_BIT, 0, NULL, 0),
24452450

@@ -2464,8 +2469,6 @@ static const struct snd_soc_dapm_widget rt5659_dapm_widgets[] = {
24642469
RT5659_ADC_MONO_R_ASRC_SFT, 0, NULL, 0),
24652470

24662471
/* Input Side */
2467-
SND_SOC_DAPM_SUPPLY("MICBIAS1", RT5659_PWR_ANLG_2, RT5659_PWR_MB1_BIT,
2468-
0, NULL, 0),
24692472
SND_SOC_DAPM_SUPPLY("MICBIAS2", RT5659_PWR_ANLG_2, RT5659_PWR_MB2_BIT,
24702473
0, NULL, 0),
24712474
SND_SOC_DAPM_SUPPLY("MICBIAS3", RT5659_PWR_ANLG_2, RT5659_PWR_MB3_BIT,
@@ -3660,10 +3663,23 @@ static int rt5659_set_bias_level(struct snd_soc_component *component,
36603663

36613664
static int rt5659_probe(struct snd_soc_component *component)
36623665
{
3666+
struct snd_soc_dapm_context *dapm =
3667+
snd_soc_component_get_dapm(component);
36633668
struct rt5659_priv *rt5659 = snd_soc_component_get_drvdata(component);
36643669

36653670
rt5659->component = component;
36663671

3672+
switch (rt5659->pdata.jd_src) {
3673+
case RT5659_JD_HDA_HEADER:
3674+
break;
3675+
3676+
default:
3677+
snd_soc_dapm_new_controls(dapm,
3678+
rt5659_particular_dapm_widgets,
3679+
ARRAY_SIZE(rt5659_particular_dapm_widgets));
3680+
break;
3681+
}
3682+
36673683
return 0;
36683684
}
36693685

sound/soc/codecs/rt5682-sdw.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,8 @@ static int rt5682_io_init(struct device *dev, struct sdw_slave *slave)
462462

463463
regmap_update_bits(rt5682->regmap, RT5682_CBJ_CTRL_2,
464464
RT5682_EXT_JD_SRC, RT5682_EXT_JD_SRC_MANUAL);
465-
regmap_write(rt5682->regmap, RT5682_CBJ_CTRL_1, 0xd042);
465+
regmap_write(rt5682->regmap, RT5682_CBJ_CTRL_1, 0xd142);
466+
regmap_update_bits(rt5682->regmap, RT5682_CBJ_CTRL_5, 0x0700, 0x0600);
466467
regmap_update_bits(rt5682->regmap, RT5682_CBJ_CTRL_3,
467468
RT5682_CBJ_IN_BUF_EN, RT5682_CBJ_IN_BUF_EN);
468469
regmap_update_bits(rt5682->regmap, RT5682_SAR_IL_CMD_1,

sound/soc/codecs/tas2562.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@
5757
#define TAS2562_TDM_CFG0_RAMPRATE_MASK BIT(5)
5858
#define TAS2562_TDM_CFG0_RAMPRATE_44_1 BIT(5)
5959
#define TAS2562_TDM_CFG0_SAMPRATE_MASK GENMASK(3, 1)
60-
#define TAS2562_TDM_CFG0_SAMPRATE_7305_8KHZ 0x0
61-
#define TAS2562_TDM_CFG0_SAMPRATE_14_7_16KHZ 0x1
62-
#define TAS2562_TDM_CFG0_SAMPRATE_22_05_24KHZ 0x2
63-
#define TAS2562_TDM_CFG0_SAMPRATE_29_4_32KHZ 0x3
64-
#define TAS2562_TDM_CFG0_SAMPRATE_44_1_48KHZ 0x4
65-
#define TAS2562_TDM_CFG0_SAMPRATE_88_2_96KHZ 0x5
66-
#define TAS2562_TDM_CFG0_SAMPRATE_176_4_192KHZ 0x6
60+
#define TAS2562_TDM_CFG0_SAMPRATE_7305_8KHZ (0x0 << 1)
61+
#define TAS2562_TDM_CFG0_SAMPRATE_14_7_16KHZ (0x1 << 1)
62+
#define TAS2562_TDM_CFG0_SAMPRATE_22_05_24KHZ (0x2 << 1)
63+
#define TAS2562_TDM_CFG0_SAMPRATE_29_4_32KHZ (0x3 << 1)
64+
#define TAS2562_TDM_CFG0_SAMPRATE_44_1_48KHZ (0x4 << 1)
65+
#define TAS2562_TDM_CFG0_SAMPRATE_88_2_96KHZ (0x5 << 1)
66+
#define TAS2562_TDM_CFG0_SAMPRATE_176_4_192KHZ (0x6 << 1)
6767

6868
#define TAS2562_TDM_CFG2_RIGHT_JUSTIFY BIT(6)
6969

sound/soc/fsl/fsl-asoc-card.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,7 @@ static int fsl_asoc_card_probe(struct platform_device *pdev)
744744
/* Initialize sound card */
745745
priv->pdev = pdev;
746746
priv->card.dev = &pdev->dev;
747+
priv->card.owner = THIS_MODULE;
747748
ret = snd_soc_of_parse_card_name(&priv->card, "model");
748749
if (ret) {
749750
snprintf(priv->name, sizeof(priv->name), "%s-audio",

sound/soc/qcom/lpass-cpu.c

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,30 @@ static void lpass_cpu_daiops_shutdown(struct snd_pcm_substream *substream,
9393
struct snd_soc_dai *dai)
9494
{
9595
struct lpass_data *drvdata = snd_soc_dai_get_drvdata(dai);
96+
struct lpaif_i2sctl *i2sctl = drvdata->i2sctl;
97+
unsigned int id = dai->driver->id;
9698

9799
clk_disable_unprepare(drvdata->mi2s_osr_clk[dai->driver->id]);
100+
/*
101+
* Ensure LRCLK is disabled even in device node validation.
102+
* Will not impact if disabled in lpass_cpu_daiops_trigger()
103+
* suspend.
104+
*/
105+
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
106+
regmap_fields_write(i2sctl->spken, id, LPAIF_I2SCTL_SPKEN_DISABLE);
107+
else
108+
regmap_fields_write(i2sctl->micen, id, LPAIF_I2SCTL_MICEN_DISABLE);
109+
110+
/*
111+
* BCLK may not be enabled if lpass_cpu_daiops_prepare is called before
112+
* lpass_cpu_daiops_shutdown. It's paired with the clk_enable in
113+
* lpass_cpu_daiops_prepare.
114+
*/
115+
if (drvdata->mi2s_was_prepared[dai->driver->id]) {
116+
drvdata->mi2s_was_prepared[dai->driver->id] = false;
117+
clk_disable(drvdata->mi2s_bit_clk[dai->driver->id]);
118+
}
119+
98120
clk_unprepare(drvdata->mi2s_bit_clk[dai->driver->id]);
99121
}
100122

@@ -275,6 +297,18 @@ static int lpass_cpu_daiops_trigger(struct snd_pcm_substream *substream,
275297
case SNDRV_PCM_TRIGGER_START:
276298
case SNDRV_PCM_TRIGGER_RESUME:
277299
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
300+
/*
301+
* Ensure lpass BCLK/LRCLK is enabled during
302+
* device resume as lpass_cpu_daiops_prepare() is not called
303+
* after the device resumes. We don't check mi2s_was_prepared before
304+
* enable/disable BCLK in trigger events because:
305+
* 1. These trigger events are paired, so the BCLK
306+
* enable_count is balanced.
307+
* 2. the BCLK can be shared (ex: headset and headset mic),
308+
* we need to increase the enable_count so that we don't
309+
* turn off the shared BCLK while other devices are using
310+
* it.
311+
*/
278312
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
279313
ret = regmap_fields_write(i2sctl->spken, id,
280314
LPAIF_I2SCTL_SPKEN_ENABLE);
@@ -296,6 +330,10 @@ static int lpass_cpu_daiops_trigger(struct snd_pcm_substream *substream,
296330
case SNDRV_PCM_TRIGGER_STOP:
297331
case SNDRV_PCM_TRIGGER_SUSPEND:
298332
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
333+
/*
334+
* To ensure lpass BCLK/LRCLK is disabled during
335+
* device suspend.
336+
*/
299337
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
300338
ret = regmap_fields_write(i2sctl->spken, id,
301339
LPAIF_I2SCTL_SPKEN_DISABLE);
@@ -315,12 +353,53 @@ static int lpass_cpu_daiops_trigger(struct snd_pcm_substream *substream,
315353
return ret;
316354
}
317355

356+
static int lpass_cpu_daiops_prepare(struct snd_pcm_substream *substream,
357+
struct snd_soc_dai *dai)
358+
{
359+
struct lpass_data *drvdata = snd_soc_dai_get_drvdata(dai);
360+
struct lpaif_i2sctl *i2sctl = drvdata->i2sctl;
361+
unsigned int id = dai->driver->id;
362+
int ret;
363+
364+
/*
365+
* Ensure lpass BCLK/LRCLK is enabled bit before playback/capture
366+
* data flow starts. This allows other codec to have some delay before
367+
* the data flow.
368+
* (ex: to drop start up pop noise before capture starts).
369+
*/
370+
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
371+
ret = regmap_fields_write(i2sctl->spken, id, LPAIF_I2SCTL_SPKEN_ENABLE);
372+
else
373+
ret = regmap_fields_write(i2sctl->micen, id, LPAIF_I2SCTL_MICEN_ENABLE);
374+
375+
if (ret) {
376+
dev_err(dai->dev, "error writing to i2sctl reg: %d\n", ret);
377+
return ret;
378+
}
379+
380+
/*
381+
* Check mi2s_was_prepared before enabling BCLK as lpass_cpu_daiops_prepare can
382+
* be called multiple times. It's paired with the clk_disable in
383+
* lpass_cpu_daiops_shutdown.
384+
*/
385+
if (!drvdata->mi2s_was_prepared[dai->driver->id]) {
386+
ret = clk_enable(drvdata->mi2s_bit_clk[id]);
387+
if (ret) {
388+
dev_err(dai->dev, "error in enabling mi2s bit clk: %d\n", ret);
389+
return ret;
390+
}
391+
drvdata->mi2s_was_prepared[dai->driver->id] = true;
392+
}
393+
return 0;
394+
}
395+
318396
const struct snd_soc_dai_ops asoc_qcom_lpass_cpu_dai_ops = {
319397
.set_sysclk = lpass_cpu_daiops_set_sysclk,
320398
.startup = lpass_cpu_daiops_startup,
321399
.shutdown = lpass_cpu_daiops_shutdown,
322400
.hw_params = lpass_cpu_daiops_hw_params,
323401
.trigger = lpass_cpu_daiops_trigger,
402+
.prepare = lpass_cpu_daiops_prepare,
324403
};
325404
EXPORT_SYMBOL_GPL(asoc_qcom_lpass_cpu_dai_ops);
326405

sound/soc/qcom/lpass.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ struct lpass_data {
6767
/* MI2S SD lines to use for playback/capture */
6868
unsigned int mi2s_playback_sd_mode[LPASS_MAX_MI2S_PORTS];
6969
unsigned int mi2s_capture_sd_mode[LPASS_MAX_MI2S_PORTS];
70+
71+
/* The state of MI2S prepare dai_ops was called */
72+
bool mi2s_was_prepared[LPASS_MAX_MI2S_PORTS];
73+
7074
int hdmi_port_enable;
7175

7276
/* low-power audio interface (LPAIF) registers */

sound/soc/soc-core.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2225,6 +2225,8 @@ static char *fmt_single_name(struct device *dev, int *id)
22252225
return NULL;
22262226

22272227
name = devm_kstrdup(dev, devname, GFP_KERNEL);
2228+
if (!name)
2229+
return NULL;
22282230

22292231
/* are we a "%s.%d" name (platform and SPI components) */
22302232
found = strstr(name, dev->driver->name);

sound/soc/soc-topology.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1901,7 +1901,7 @@ static void stream_caps_new_ver(struct snd_soc_tplg_stream_caps *dest,
19011901
* @src: older version of pcm as a source
19021902
* @pcm: latest version of pcm created from the source
19031903
*
1904-
* Support from vesion 4. User should free the returned pcm manually.
1904+
* Support from version 4. User should free the returned pcm manually.
19051905
*/
19061906
static int pcm_new_ver(struct soc_tplg *tplg,
19071907
struct snd_soc_tplg_pcm *src,
@@ -2089,7 +2089,7 @@ static void set_link_hw_format(struct snd_soc_dai_link *link,
20892089
* @src: old version of phyical link config as a source
20902090
* @link: latest version of physical link config created from the source
20912091
*
2092-
* Support from vesion 4. User need free the returned link config manually.
2092+
* Support from version 4. User need free the returned link config manually.
20932093
*/
20942094
static int link_new_ver(struct soc_tplg *tplg,
20952095
struct snd_soc_tplg_link_config *src,
@@ -2400,7 +2400,7 @@ static int soc_tplg_dai_elems_load(struct soc_tplg *tplg,
24002400
* @src: old version of manifest as a source
24012401
* @manifest: latest version of manifest created from the source
24022402
*
2403-
* Support from vesion 4. Users need free the returned manifest manually.
2403+
* Support from version 4. Users need free the returned manifest manually.
24042404
*/
24052405
static int manifest_new_ver(struct soc_tplg *tplg,
24062406
struct snd_soc_tplg_manifest *src,

sound/soc/sof/pm.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ static int sof_suspend(struct device *dev, bool runtime_suspend)
256256

257257
/* reset FW state */
258258
sdev->fw_state = SOF_FW_BOOT_NOT_STARTED;
259+
sdev->enabled_cores_mask = 0;
259260

260261
return ret;
261262
}

0 commit comments

Comments
 (0)