Skip to content

Commit 3a230f7

Browse files
committed
Merge tag 'asoc-fix-4.17-rc2' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
ASoC: Fixes for v4.17 A small batch of fixes collected since the merge window, none of which are particularly large or remarkable. They've all been cooking in -next for a while.
2 parents 6581183 + a8419a0 commit 3a230f7

File tree

11 files changed

+85
-33
lines changed

11 files changed

+85
-33
lines changed

sound/soc/amd/acp-da7219-max98357a.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
#define DUAL_CHANNEL 2
4444

4545
static struct snd_soc_jack cz_jack;
46-
struct clk *da7219_dai_clk;
46+
static struct clk *da7219_dai_clk;
4747

4848
static int cz_da7219_init(struct snd_soc_pcm_runtime *rtd)
4949
{

sound/soc/codecs/adau17x1.c

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ static int adau17x1_hw_params(struct snd_pcm_substream *substream,
502502
}
503503

504504
if (adau->sigmadsp) {
505-
ret = adau17x1_setup_firmware(adau, params_rate(params));
505+
ret = adau17x1_setup_firmware(component, params_rate(params));
506506
if (ret < 0)
507507
return ret;
508508
}
@@ -835,26 +835,40 @@ bool adau17x1_volatile_register(struct device *dev, unsigned int reg)
835835
}
836836
EXPORT_SYMBOL_GPL(adau17x1_volatile_register);
837837

838-
int adau17x1_setup_firmware(struct adau *adau, unsigned int rate)
838+
int adau17x1_setup_firmware(struct snd_soc_component *component,
839+
unsigned int rate)
839840
{
840841
int ret;
841-
int dspsr;
842+
int dspsr, dsp_run;
843+
struct adau *adau = snd_soc_component_get_drvdata(component);
844+
struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
845+
846+
snd_soc_dapm_mutex_lock(dapm);
842847

843848
ret = regmap_read(adau->regmap, ADAU17X1_DSP_SAMPLING_RATE, &dspsr);
844849
if (ret)
845-
return ret;
850+
goto err;
851+
852+
ret = regmap_read(adau->regmap, ADAU17X1_DSP_RUN, &dsp_run);
853+
if (ret)
854+
goto err;
846855

847856
regmap_write(adau->regmap, ADAU17X1_DSP_ENABLE, 1);
848857
regmap_write(adau->regmap, ADAU17X1_DSP_SAMPLING_RATE, 0xf);
858+
regmap_write(adau->regmap, ADAU17X1_DSP_RUN, 0);
849859

850860
ret = sigmadsp_setup(adau->sigmadsp, rate);
851861
if (ret) {
852862
regmap_write(adau->regmap, ADAU17X1_DSP_ENABLE, 0);
853-
return ret;
863+
goto err;
854864
}
855865
regmap_write(adau->regmap, ADAU17X1_DSP_SAMPLING_RATE, dspsr);
866+
regmap_write(adau->regmap, ADAU17X1_DSP_RUN, dsp_run);
856867

857-
return 0;
868+
err:
869+
snd_soc_dapm_mutex_unlock(dapm);
870+
871+
return ret;
858872
}
859873
EXPORT_SYMBOL_GPL(adau17x1_setup_firmware);
860874

sound/soc/codecs/adau17x1.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ int adau17x1_resume(struct snd_soc_component *component);
6868

6969
extern const struct snd_soc_dai_ops adau17x1_dai_ops;
7070

71-
int adau17x1_setup_firmware(struct adau *adau, unsigned int rate);
71+
int adau17x1_setup_firmware(struct snd_soc_component *component,
72+
unsigned int rate);
7273
bool adau17x1_has_dsp(struct adau *adau);
7374

7475
#define ADAU17X1_CLOCK_CONTROL 0x4000

sound/soc/codecs/msm8916-wcd-analog.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,7 +1187,8 @@ static int pm8916_wcd_analog_spmi_probe(struct platform_device *pdev)
11871187
return irq;
11881188
}
11891189

1190-
ret = devm_request_irq(dev, irq, pm8916_mbhc_switch_irq_handler,
1190+
ret = devm_request_threaded_irq(dev, irq, NULL,
1191+
pm8916_mbhc_switch_irq_handler,
11911192
IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING |
11921193
IRQF_ONESHOT,
11931194
"mbhc switch irq", priv);
@@ -1201,7 +1202,8 @@ static int pm8916_wcd_analog_spmi_probe(struct platform_device *pdev)
12011202
return irq;
12021203
}
12031204

1204-
ret = devm_request_irq(dev, irq, mbhc_btn_press_irq_handler,
1205+
ret = devm_request_threaded_irq(dev, irq, NULL,
1206+
mbhc_btn_press_irq_handler,
12051207
IRQF_TRIGGER_RISING |
12061208
IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
12071209
"mbhc btn press irq", priv);
@@ -1214,7 +1216,8 @@ static int pm8916_wcd_analog_spmi_probe(struct platform_device *pdev)
12141216
return irq;
12151217
}
12161218

1217-
ret = devm_request_irq(dev, irq, mbhc_btn_release_irq_handler,
1219+
ret = devm_request_threaded_irq(dev, irq, NULL,
1220+
mbhc_btn_release_irq_handler,
12181221
IRQF_TRIGGER_RISING |
12191222
IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
12201223
"mbhc btn release irq", priv);

sound/soc/codecs/rt5514.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ static const struct reg_default rt5514_reg[] = {
8989
{RT5514_PLL3_CALIB_CTRL5, 0x40220012},
9090
{RT5514_DELAY_BUF_CTRL1, 0x7fff006a},
9191
{RT5514_DELAY_BUF_CTRL3, 0x00000000},
92+
{RT5514_ASRC_IN_CTRL1, 0x00000003},
9293
{RT5514_DOWNFILTER0_CTRL1, 0x00020c2f},
9394
{RT5514_DOWNFILTER0_CTRL2, 0x00020c2f},
9495
{RT5514_DOWNFILTER0_CTRL3, 0x10000362},
@@ -181,6 +182,7 @@ static bool rt5514_readable_register(struct device *dev, unsigned int reg)
181182
case RT5514_PLL3_CALIB_CTRL5:
182183
case RT5514_DELAY_BUF_CTRL1:
183184
case RT5514_DELAY_BUF_CTRL3:
185+
case RT5514_ASRC_IN_CTRL1:
184186
case RT5514_DOWNFILTER0_CTRL1:
185187
case RT5514_DOWNFILTER0_CTRL2:
186188
case RT5514_DOWNFILTER0_CTRL3:
@@ -238,6 +240,7 @@ static bool rt5514_i2c_readable_register(struct device *dev,
238240
case RT5514_DSP_MAPPING | RT5514_PLL3_CALIB_CTRL5:
239241
case RT5514_DSP_MAPPING | RT5514_DELAY_BUF_CTRL1:
240242
case RT5514_DSP_MAPPING | RT5514_DELAY_BUF_CTRL3:
243+
case RT5514_DSP_MAPPING | RT5514_ASRC_IN_CTRL1:
241244
case RT5514_DSP_MAPPING | RT5514_DOWNFILTER0_CTRL1:
242245
case RT5514_DSP_MAPPING | RT5514_DOWNFILTER0_CTRL2:
243246
case RT5514_DSP_MAPPING | RT5514_DOWNFILTER0_CTRL3:

sound/soc/fsl/fsl_esai.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,13 @@ static int fsl_esai_divisor_cal(struct snd_soc_dai *dai, bool tx, u32 ratio,
144144

145145
psr = ratio <= 256 * maxfp ? ESAI_xCCR_xPSR_BYPASS : ESAI_xCCR_xPSR_DIV8;
146146

147+
/* Do not loop-search if PM (1 ~ 256) alone can serve the ratio */
148+
if (ratio <= 256) {
149+
pm = ratio;
150+
fp = 1;
151+
goto out;
152+
}
153+
147154
/* Set the max fluctuation -- 0.1% of the max devisor */
148155
savesub = (psr ? 1 : 8) * 256 * maxfp / 1000;
149156

sound/soc/fsl/fsl_ssi.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ struct fsl_ssi_soc_data {
217217
* @dai_fmt: DAI configuration this device is currently used with
218218
* @streams: Mask of current active streams: BIT(TX) and BIT(RX)
219219
* @i2s_net: I2S and Network mode configurations of SCR register
220+
* (this is the initial settings based on the DAI format)
220221
* @synchronous: Use synchronous mode - both of TX and RX use STCK and SFCK
221222
* @use_dma: DMA is used or FIQ with stream filter
222223
* @use_dual_fifo: DMA with support for dual FIFO mode
@@ -829,16 +830,23 @@ static int fsl_ssi_hw_params(struct snd_pcm_substream *substream,
829830
}
830831

831832
if (!fsl_ssi_is_ac97(ssi)) {
833+
/*
834+
* Keep the ssi->i2s_net intact while having a local variable
835+
* to override settings for special use cases. Otherwise, the
836+
* ssi->i2s_net will lose the settings for regular use cases.
837+
*/
838+
u8 i2s_net = ssi->i2s_net;
839+
832840
/* Normal + Network mode to send 16-bit data in 32-bit frames */
833841
if (fsl_ssi_is_i2s_cbm_cfs(ssi) && sample_size == 16)
834-
ssi->i2s_net = SSI_SCR_I2S_MODE_NORMAL | SSI_SCR_NET;
842+
i2s_net = SSI_SCR_I2S_MODE_NORMAL | SSI_SCR_NET;
835843

836844
/* Use Normal mode to send mono data at 1st slot of 2 slots */
837845
if (channels == 1)
838-
ssi->i2s_net = SSI_SCR_I2S_MODE_NORMAL;
846+
i2s_net = SSI_SCR_I2S_MODE_NORMAL;
839847

840848
regmap_update_bits(regs, REG_SSI_SCR,
841-
SSI_SCR_I2S_NET_MASK, ssi->i2s_net);
849+
SSI_SCR_I2S_NET_MASK, i2s_net);
842850
}
843851

844852
/* In synchronous mode, the SSI uses STCCR for capture */

sound/soc/intel/Kconfig

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,24 +72,28 @@ config SND_SOC_INTEL_BAYTRAIL
7272
for Baytrail Chromebooks but this option is now deprecated and is
7373
not recommended, use SND_SST_ATOM_HIFI2_PLATFORM instead.
7474

75+
config SND_SST_ATOM_HIFI2_PLATFORM
76+
tristate
77+
select SND_SOC_COMPRESS
78+
7579
config SND_SST_ATOM_HIFI2_PLATFORM_PCI
76-
tristate "PCI HiFi2 (Medfield, Merrifield) Platforms"
80+
tristate "PCI HiFi2 (Merrifield) Platforms"
7781
depends on X86 && PCI
7882
select SND_SST_IPC_PCI
79-
select SND_SOC_COMPRESS
83+
select SND_SST_ATOM_HIFI2_PLATFORM
8084
help
81-
If you have a Intel Medfield or Merrifield/Edison platform, then
85+
If you have a Intel Merrifield/Edison platform, then
8286
enable this option by saying Y or m. Distros will typically not
83-
enable this option: Medfield devices are not available to
84-
developers and while Merrifield/Edison can run a mainline kernel with
85-
limited functionality it will require a firmware file which
86-
is not in the standard firmware tree
87+
enable this option: while Merrifield/Edison can run a mainline
88+
kernel with limited functionality it will require a firmware file
89+
which is not in the standard firmware tree
8790

88-
config SND_SST_ATOM_HIFI2_PLATFORM
91+
config SND_SST_ATOM_HIFI2_PLATFORM_ACPI
8992
tristate "ACPI HiFi2 (Baytrail, Cherrytrail) Platforms"
93+
default ACPI
9094
depends on X86 && ACPI
9195
select SND_SST_IPC_ACPI
92-
select SND_SOC_COMPRESS
96+
select SND_SST_ATOM_HIFI2_PLATFORM
9397
select SND_SOC_ACPI_INTEL_MATCH
9498
select IOSF_MBI
9599
help

sound/soc/omap/omap-dmic.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ static int omap_dmic_dai_trigger(struct snd_pcm_substream *substream,
281281
static int omap_dmic_select_fclk(struct omap_dmic *dmic, int clk_id,
282282
unsigned int freq)
283283
{
284-
struct clk *parent_clk;
284+
struct clk *parent_clk, *mux;
285285
char *parent_clk_name;
286286
int ret = 0;
287287

@@ -329,14 +329,21 @@ static int omap_dmic_select_fclk(struct omap_dmic *dmic, int clk_id,
329329
return -ENODEV;
330330
}
331331

332+
mux = clk_get_parent(dmic->fclk);
333+
if (IS_ERR(mux)) {
334+
dev_err(dmic->dev, "can't get fck mux parent\n");
335+
clk_put(parent_clk);
336+
return -ENODEV;
337+
}
338+
332339
mutex_lock(&dmic->mutex);
333340
if (dmic->active) {
334341
/* disable clock while reparenting */
335342
pm_runtime_put_sync(dmic->dev);
336-
ret = clk_set_parent(dmic->fclk, parent_clk);
343+
ret = clk_set_parent(mux, parent_clk);
337344
pm_runtime_get_sync(dmic->dev);
338345
} else {
339-
ret = clk_set_parent(dmic->fclk, parent_clk);
346+
ret = clk_set_parent(mux, parent_clk);
340347
}
341348
mutex_unlock(&dmic->mutex);
342349

@@ -349,6 +356,7 @@ static int omap_dmic_select_fclk(struct omap_dmic *dmic, int clk_id,
349356
dmic->fclk_freq = freq;
350357

351358
err_busy:
359+
clk_put(mux);
352360
clk_put(parent_clk);
353361

354362
return ret;

sound/soc/sh/rcar/core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1536,7 +1536,7 @@ static int rsnd_remove(struct platform_device *pdev)
15361536
return ret;
15371537
}
15381538

1539-
static int rsnd_suspend(struct device *dev)
1539+
static int __maybe_unused rsnd_suspend(struct device *dev)
15401540
{
15411541
struct rsnd_priv *priv = dev_get_drvdata(dev);
15421542

@@ -1545,7 +1545,7 @@ static int rsnd_suspend(struct device *dev)
15451545
return 0;
15461546
}
15471547

1548-
static int rsnd_resume(struct device *dev)
1548+
static int __maybe_unused rsnd_resume(struct device *dev)
15491549
{
15501550
struct rsnd_priv *priv = dev_get_drvdata(dev);
15511551

sound/soc/soc-topology.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ static void remove_widget(struct snd_soc_component *comp,
513513
*/
514514
if (dobj->widget.kcontrol_type == SND_SOC_TPLG_TYPE_ENUM) {
515515
/* enumerated widget mixer */
516-
for (i = 0; i < w->num_kcontrols; i++) {
516+
for (i = 0; w->kcontrols != NULL && i < w->num_kcontrols; i++) {
517517
struct snd_kcontrol *kcontrol = w->kcontrols[i];
518518
struct soc_enum *se =
519519
(struct soc_enum *)kcontrol->private_value;
@@ -530,7 +530,7 @@ static void remove_widget(struct snd_soc_component *comp,
530530
}
531531
} else {
532532
/* volume mixer or bytes controls */
533-
for (i = 0; i < w->num_kcontrols; i++) {
533+
for (i = 0; w->kcontrols != NULL && i < w->num_kcontrols; i++) {
534534
struct snd_kcontrol *kcontrol = w->kcontrols[i];
535535

536536
if (dobj->widget.kcontrol_type
@@ -1325,8 +1325,10 @@ static struct snd_kcontrol_new *soc_tplg_dapm_widget_denum_create(
13251325
ec->hdr.name);
13261326

13271327
kc[i].name = kstrdup(ec->hdr.name, GFP_KERNEL);
1328-
if (kc[i].name == NULL)
1328+
if (kc[i].name == NULL) {
1329+
kfree(se);
13291330
goto err_se;
1331+
}
13301332
kc[i].private_value = (long)se;
13311333
kc[i].iface = SNDRV_CTL_ELEM_IFACE_MIXER;
13321334
kc[i].access = ec->hdr.access;
@@ -1442,8 +1444,10 @@ static struct snd_kcontrol_new *soc_tplg_dapm_widget_dbytes_create(
14421444
be->hdr.name, be->hdr.access);
14431445

14441446
kc[i].name = kstrdup(be->hdr.name, GFP_KERNEL);
1445-
if (kc[i].name == NULL)
1447+
if (kc[i].name == NULL) {
1448+
kfree(sbe);
14461449
goto err;
1450+
}
14471451
kc[i].private_value = (long)sbe;
14481452
kc[i].iface = SNDRV_CTL_ELEM_IFACE_MIXER;
14491453
kc[i].access = be->hdr.access;
@@ -2576,7 +2580,7 @@ int snd_soc_tplg_component_remove(struct snd_soc_component *comp, u32 index)
25762580

25772581
/* match index */
25782582
if (dobj->index != index &&
2579-
dobj->index != SND_SOC_TPLG_INDEX_ALL)
2583+
index != SND_SOC_TPLG_INDEX_ALL)
25802584
continue;
25812585

25822586
switch (dobj->type) {

0 commit comments

Comments
 (0)