Skip to content

Commit 557ed56

Browse files
committed
Merge tag 'sound-4.10-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Pull sound fixes from Takashi Iwai: "This time we got a few more fixes than the previous rc's, and most of commits were about ASoC. The only significant change in the core side is the regression fix wrt the aux device list handling, and all the rest are driver-specific small / trivial fixes" * tag 'sound-4.10-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: ALSA: usb-audio: Add a quirk for Plantronics BT600 ASoC: rt5645: set sel_i2s_pre_div1 to 2 ASoC: dpcm: Avoid putting stream state to STOP when FE stream is paused ASoC: Intel: Skylake: Release FW ctx in cleanup ASoC: Intel: bytcr-rt5640: fix settings in internal clock mode ASoC: fsl_ssi: set fifo watermark to more reliable value ASoC: nau8825: fix invalid configuration in Pre-Scalar of FLL ASoC: nau8825: correct the function name of register ASoC: Intel: Skylake: Fix to fail safely if module not available in path ASoC: tlv320aic3x: Mark the RESET register as volatile ASoC: Fix binding and probing of auxiliary components ASoC: wm_adsp: Don't overrun firmware file buffer when reading region data ASoC: Intel: bytcr_rt5640: fallback mechanism if MCLK is not enabled ASoC: hdmi-codec: use unsigned type to structure members with bit-field ASoC: topology: kfree kcontrol->private_value before freeing kcontrol ASoC: rsnd: don't double free kctrl ASoC: dwc: Fix PIO mode initialization
2 parents e28ac1f + 6cf4569 commit 557ed56

File tree

17 files changed

+151
-62
lines changed

17 files changed

+151
-62
lines changed

include/sound/hdmi-codec.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ struct hdmi_codec_daifmt {
3636
HDMI_AC97,
3737
HDMI_SPDIF,
3838
} fmt;
39-
int bit_clk_inv:1;
40-
int frame_clk_inv:1;
41-
int bit_clk_master:1;
42-
int frame_clk_master:1;
39+
unsigned int bit_clk_inv:1;
40+
unsigned int frame_clk_inv:1;
41+
unsigned int bit_clk_master:1;
42+
unsigned int frame_clk_master:1;
4343
};
4444

4545
/*

include/sound/soc.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -813,6 +813,7 @@ struct snd_soc_component {
813813
unsigned int suspended:1; /* is in suspend PM state */
814814

815815
struct list_head list;
816+
struct list_head card_aux_list; /* for auxiliary bound components */
816817
struct list_head card_list;
817818

818819
struct snd_soc_dai_driver *dai_drv;
@@ -1152,6 +1153,7 @@ struct snd_soc_card {
11521153
*/
11531154
struct snd_soc_aux_dev *aux_dev;
11541155
int num_aux_devs;
1156+
struct list_head aux_comp_list;
11551157

11561158
const struct snd_kcontrol_new *controls;
11571159
int num_controls;
@@ -1547,6 +1549,7 @@ static inline void snd_soc_initialize_card_lists(struct snd_soc_card *card)
15471549
INIT_LIST_HEAD(&card->widgets);
15481550
INIT_LIST_HEAD(&card->paths);
15491551
INIT_LIST_HEAD(&card->dapm_list);
1552+
INIT_LIST_HEAD(&card->aux_comp_list);
15501553
INIT_LIST_HEAD(&card->component_dev_list);
15511554
}
15521555

sound/soc/codecs/nau8825.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -561,9 +561,9 @@ static void nau8825_xtalk_prepare(struct nau8825 *nau8825)
561561
nau8825_xtalk_backup(nau8825);
562562
/* Config IIS as master to output signal by codec */
563563
regmap_update_bits(nau8825->regmap, NAU8825_REG_I2S_PCM_CTRL2,
564-
NAU8825_I2S_MS_MASK | NAU8825_I2S_DRV_MASK |
564+
NAU8825_I2S_MS_MASK | NAU8825_I2S_LRC_DIV_MASK |
565565
NAU8825_I2S_BLK_DIV_MASK, NAU8825_I2S_MS_MASTER |
566-
(0x2 << NAU8825_I2S_DRV_SFT) | 0x1);
566+
(0x2 << NAU8825_I2S_LRC_DIV_SFT) | 0x1);
567567
/* Ramp up headphone volume to 0dB to get better performance and
568568
* avoid pop noise in headphone.
569569
*/
@@ -657,7 +657,7 @@ static void nau8825_xtalk_clean(struct nau8825 *nau8825)
657657
NAU8825_IRQ_RMS_EN, NAU8825_IRQ_RMS_EN);
658658
/* Recover default value for IIS */
659659
regmap_update_bits(nau8825->regmap, NAU8825_REG_I2S_PCM_CTRL2,
660-
NAU8825_I2S_MS_MASK | NAU8825_I2S_DRV_MASK |
660+
NAU8825_I2S_MS_MASK | NAU8825_I2S_LRC_DIV_MASK |
661661
NAU8825_I2S_BLK_DIV_MASK, NAU8825_I2S_MS_SLAVE);
662662
/* Restore value of specific register for cross talk */
663663
nau8825_xtalk_restore(nau8825);
@@ -2006,7 +2006,8 @@ static void nau8825_fll_apply(struct nau8825 *nau8825,
20062006
NAU8825_FLL_INTEGER_MASK, fll_param->fll_int);
20072007
/* FLL pre-scaler */
20082008
regmap_update_bits(nau8825->regmap, NAU8825_REG_FLL4,
2009-
NAU8825_FLL_REF_DIV_MASK, fll_param->clk_ref_div);
2009+
NAU8825_FLL_REF_DIV_MASK,
2010+
fll_param->clk_ref_div << NAU8825_FLL_REF_DIV_SFT);
20102011
/* select divided VCO input */
20112012
regmap_update_bits(nau8825->regmap, NAU8825_REG_FLL5,
20122013
NAU8825_FLL_CLK_SW_MASK, NAU8825_FLL_CLK_SW_REF);

sound/soc/codecs/nau8825.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,8 @@
137137
#define NAU8825_FLL_CLK_SRC_FS (0x3 << NAU8825_FLL_CLK_SRC_SFT)
138138

139139
/* FLL4 (0x07) */
140-
#define NAU8825_FLL_REF_DIV_MASK (0x3 << 10)
140+
#define NAU8825_FLL_REF_DIV_SFT 10
141+
#define NAU8825_FLL_REF_DIV_MASK (0x3 << NAU8825_FLL_REF_DIV_SFT)
141142

142143
/* FLL5 (0x08) */
143144
#define NAU8825_FLL_PDB_DAC_EN (0x1 << 15)
@@ -247,8 +248,8 @@
247248

248249
/* I2S_PCM_CTRL2 (0x1d) */
249250
#define NAU8825_I2S_TRISTATE (1 << 15) /* 0 - normal mode, 1 - Hi-Z output */
250-
#define NAU8825_I2S_DRV_SFT 12
251-
#define NAU8825_I2S_DRV_MASK (0x3 << NAU8825_I2S_DRV_SFT)
251+
#define NAU8825_I2S_LRC_DIV_SFT 12
252+
#define NAU8825_I2S_LRC_DIV_MASK (0x3 << NAU8825_I2S_LRC_DIV_SFT)
252253
#define NAU8825_I2S_MS_SFT 3
253254
#define NAU8825_I2S_MS_MASK (1 << NAU8825_I2S_MS_SFT)
254255
#define NAU8825_I2S_MS_MASTER (1 << NAU8825_I2S_MS_SFT)

sound/soc/codecs/rt5645.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3833,6 +3833,9 @@ static int rt5645_i2c_probe(struct i2c_client *i2c,
38333833
}
38343834
}
38353835

3836+
regmap_update_bits(rt5645->regmap, RT5645_ADDA_CLK1,
3837+
RT5645_I2S_PD1_MASK, RT5645_I2S_PD1_2);
3838+
38363839
if (rt5645->pdata.jd_invert) {
38373840
regmap_update_bits(rt5645->regmap, RT5645_IRQ_CTRL2,
38383841
RT5645_JD_1_1_MASK, RT5645_JD_1_1_INV);

sound/soc/codecs/tlv320aic3x.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,26 @@ static const struct reg_default aic3x_reg[] = {
126126
{ 108, 0x00 }, { 109, 0x00 },
127127
};
128128

129+
static bool aic3x_volatile_reg(struct device *dev, unsigned int reg)
130+
{
131+
switch (reg) {
132+
case AIC3X_RESET:
133+
return true;
134+
default:
135+
return false;
136+
}
137+
}
138+
129139
static const struct regmap_config aic3x_regmap = {
130140
.reg_bits = 8,
131141
.val_bits = 8,
132142

133143
.max_register = DAC_ICC_ADJ,
134144
.reg_defaults = aic3x_reg,
135145
.num_reg_defaults = ARRAY_SIZE(aic3x_reg),
146+
147+
.volatile_reg = aic3x_volatile_reg,
148+
136149
.cache_type = REGCACHE_RBTREE,
137150
};
138151

sound/soc/codecs/wm_adsp.c

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1551,7 +1551,7 @@ static int wm_adsp_load(struct wm_adsp *dsp)
15511551
const struct wmfw_region *region;
15521552
const struct wm_adsp_region *mem;
15531553
const char *region_name;
1554-
char *file, *text;
1554+
char *file, *text = NULL;
15551555
struct wm_adsp_buf *buf;
15561556
unsigned int reg;
15571557
int regions = 0;
@@ -1700,10 +1700,21 @@ static int wm_adsp_load(struct wm_adsp *dsp)
17001700
regions, le32_to_cpu(region->len), offset,
17011701
region_name);
17021702

1703+
if ((pos + le32_to_cpu(region->len) + sizeof(*region)) >
1704+
firmware->size) {
1705+
adsp_err(dsp,
1706+
"%s.%d: %s region len %d bytes exceeds file length %zu\n",
1707+
file, regions, region_name,
1708+
le32_to_cpu(region->len), firmware->size);
1709+
ret = -EINVAL;
1710+
goto out_fw;
1711+
}
1712+
17031713
if (text) {
17041714
memcpy(text, region->data, le32_to_cpu(region->len));
17051715
adsp_info(dsp, "%s: %s\n", file, text);
17061716
kfree(text);
1717+
text = NULL;
17071718
}
17081719

17091720
if (reg) {
@@ -1748,6 +1759,7 @@ static int wm_adsp_load(struct wm_adsp *dsp)
17481759
regmap_async_complete(regmap);
17491760
wm_adsp_buf_free(&buf_list);
17501761
release_firmware(firmware);
1762+
kfree(text);
17511763
out:
17521764
kfree(file);
17531765

@@ -2233,6 +2245,17 @@ static int wm_adsp_load_coeff(struct wm_adsp *dsp)
22332245
}
22342246

22352247
if (reg) {
2248+
if ((pos + le32_to_cpu(blk->len) + sizeof(*blk)) >
2249+
firmware->size) {
2250+
adsp_err(dsp,
2251+
"%s.%d: %s region len %d bytes exceeds file length %zu\n",
2252+
file, blocks, region_name,
2253+
le32_to_cpu(blk->len),
2254+
firmware->size);
2255+
ret = -EINVAL;
2256+
goto out_fw;
2257+
}
2258+
22362259
buf = wm_adsp_buf_alloc(blk->data,
22372260
le32_to_cpu(blk->len),
22382261
&buf_list);

sound/soc/dwc/designware_i2s.c

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -681,22 +681,19 @@ static int dw_i2s_probe(struct platform_device *pdev)
681681
}
682682

683683
if (!pdata) {
684-
ret = devm_snd_dmaengine_pcm_register(&pdev->dev, NULL, 0);
685-
if (ret == -EPROBE_DEFER) {
686-
dev_err(&pdev->dev,
687-
"failed to register PCM, deferring probe\n");
688-
return ret;
689-
} else if (ret) {
690-
dev_err(&pdev->dev,
691-
"Could not register DMA PCM: %d\n"
692-
"falling back to PIO mode\n", ret);
684+
if (irq >= 0) {
693685
ret = dw_pcm_register(pdev);
694-
if (ret) {
695-
dev_err(&pdev->dev,
696-
"Could not register PIO PCM: %d\n",
686+
dev->use_pio = true;
687+
} else {
688+
ret = devm_snd_dmaengine_pcm_register(&pdev->dev, NULL,
689+
0);
690+
dev->use_pio = false;
691+
}
692+
693+
if (ret) {
694+
dev_err(&pdev->dev, "could not register pcm: %d\n",
697695
ret);
698-
goto err_clk_disable;
699-
}
696+
goto err_clk_disable;
700697
}
701698
}
702699

sound/soc/fsl/fsl_ssi.c

Lines changed: 53 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,12 @@ struct fsl_ssi_soc_data {
224224
* @dbg_stats: Debugging statistics
225225
*
226226
* @soc: SoC specific data
227+
*
228+
* @fifo_watermark: the FIFO watermark setting. Notifies DMA when
229+
* there are @fifo_watermark or fewer words in TX fifo or
230+
* @fifo_watermark or more empty words in RX fifo.
231+
* @dma_maxburst: max number of words to transfer in one go. So far,
232+
* this is always the same as fifo_watermark.
227233
*/
228234
struct fsl_ssi_private {
229235
struct regmap *regs;
@@ -263,6 +269,9 @@ struct fsl_ssi_private {
263269

264270
const struct fsl_ssi_soc_data *soc;
265271
struct device *dev;
272+
273+
u32 fifo_watermark;
274+
u32 dma_maxburst;
266275
};
267276

268277
/*
@@ -1051,21 +1060,7 @@ static int _fsl_ssi_set_dai_fmt(struct device *dev,
10511060
regmap_write(regs, CCSR_SSI_SRCR, srcr);
10521061
regmap_write(regs, CCSR_SSI_SCR, scr);
10531062

1054-
/*
1055-
* Set the watermark for transmit FIFI 0 and receive FIFO 0. We don't
1056-
* use FIFO 1. We program the transmit water to signal a DMA transfer
1057-
* if there are only two (or fewer) elements left in the FIFO. Two
1058-
* elements equals one frame (left channel, right channel). This value,
1059-
* however, depends on the depth of the transmit buffer.
1060-
*
1061-
* We set the watermark on the same level as the DMA burstsize. For
1062-
* fiq it is probably better to use the biggest possible watermark
1063-
* size.
1064-
*/
1065-
if (ssi_private->use_dma)
1066-
wm = ssi_private->fifo_depth - 2;
1067-
else
1068-
wm = ssi_private->fifo_depth;
1063+
wm = ssi_private->fifo_watermark;
10691064

10701065
regmap_write(regs, CCSR_SSI_SFCSR,
10711066
CCSR_SSI_SFCSR_TFWM0(wm) | CCSR_SSI_SFCSR_RFWM0(wm) |
@@ -1373,12 +1368,8 @@ static int fsl_ssi_imx_probe(struct platform_device *pdev,
13731368
dev_dbg(&pdev->dev, "could not get baud clock: %ld\n",
13741369
PTR_ERR(ssi_private->baudclk));
13751370

1376-
/*
1377-
* We have burstsize be "fifo_depth - 2" to match the SSI
1378-
* watermark setting in fsl_ssi_startup().
1379-
*/
1380-
ssi_private->dma_params_tx.maxburst = ssi_private->fifo_depth - 2;
1381-
ssi_private->dma_params_rx.maxburst = ssi_private->fifo_depth - 2;
1371+
ssi_private->dma_params_tx.maxburst = ssi_private->dma_maxburst;
1372+
ssi_private->dma_params_rx.maxburst = ssi_private->dma_maxburst;
13821373
ssi_private->dma_params_tx.addr = ssi_private->ssi_phys + CCSR_SSI_STX0;
13831374
ssi_private->dma_params_rx.addr = ssi_private->ssi_phys + CCSR_SSI_SRX0;
13841375

@@ -1543,6 +1534,47 @@ static int fsl_ssi_probe(struct platform_device *pdev)
15431534
/* Older 8610 DTs didn't have the fifo-depth property */
15441535
ssi_private->fifo_depth = 8;
15451536

1537+
/*
1538+
* Set the watermark for transmit FIFO 0 and receive FIFO 0. We don't
1539+
* use FIFO 1 but set the watermark appropriately nontheless.
1540+
* We program the transmit water to signal a DMA transfer
1541+
* if there are N elements left in the FIFO. For chips with 15-deep
1542+
* FIFOs, set watermark to 8. This allows the SSI to operate at a
1543+
* high data rate without channel slipping. Behavior is unchanged
1544+
* for the older chips with a fifo depth of only 8. A value of 4
1545+
* might be appropriate for the older chips, but is left at
1546+
* fifo_depth-2 until sombody has a chance to test.
1547+
*
1548+
* We set the watermark on the same level as the DMA burstsize. For
1549+
* fiq it is probably better to use the biggest possible watermark
1550+
* size.
1551+
*/
1552+
switch (ssi_private->fifo_depth) {
1553+
case 15:
1554+
/*
1555+
* 2 samples is not enough when running at high data
1556+
* rates (like 48kHz @ 16 bits/channel, 16 channels)
1557+
* 8 seems to split things evenly and leave enough time
1558+
* for the DMA to fill the FIFO before it's over/under
1559+
* run.
1560+
*/
1561+
ssi_private->fifo_watermark = 8;
1562+
ssi_private->dma_maxburst = 8;
1563+
break;
1564+
case 8:
1565+
default:
1566+
/*
1567+
* maintain old behavior for older chips.
1568+
* Keeping it the same because I don't have an older
1569+
* board to test with.
1570+
* I suspect this could be changed to be something to
1571+
* leave some more space in the fifo.
1572+
*/
1573+
ssi_private->fifo_watermark = ssi_private->fifo_depth - 2;
1574+
ssi_private->dma_maxburst = ssi_private->fifo_depth - 2;
1575+
break;
1576+
}
1577+
15461578
dev_set_drvdata(&pdev->dev, ssi_private);
15471579

15481580
if (ssi_private->soc->imx) {

sound/soc/intel/boards/bytcr_rt5640.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ static int platform_clock_control(struct snd_soc_dapm_widget *w,
142142
* for Jack detection and button press
143143
*/
144144
ret = snd_soc_dai_set_sysclk(codec_dai, RT5640_SCLK_S_RCCLK,
145-
0,
145+
48000 * 512,
146146
SND_SOC_CLOCK_IN);
147147
if (!ret) {
148148
if ((byt_rt5640_quirk & BYT_RT5640_MCLK_EN) && priv->mclk)
@@ -825,10 +825,20 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
825825
if ((byt_rt5640_quirk & BYT_RT5640_MCLK_EN) && (is_valleyview())) {
826826
priv->mclk = devm_clk_get(&pdev->dev, "pmc_plt_clk_3");
827827
if (IS_ERR(priv->mclk)) {
828+
ret_val = PTR_ERR(priv->mclk);
829+
828830
dev_err(&pdev->dev,
829-
"Failed to get MCLK from pmc_plt_clk_3: %ld\n",
830-
PTR_ERR(priv->mclk));
831-
return PTR_ERR(priv->mclk);
831+
"Failed to get MCLK from pmc_plt_clk_3: %d\n",
832+
ret_val);
833+
834+
/*
835+
* Fall back to bit clock usage for -ENOENT (clock not
836+
* available likely due to missing dependencies), bail
837+
* for all other errors, including -EPROBE_DEFER
838+
*/
839+
if (ret_val != -ENOENT)
840+
return ret_val;
841+
byt_rt5640_quirk &= ~BYT_RT5640_MCLK_EN;
832842
}
833843
}
834844

sound/soc/intel/skylake/skl-pcm.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,9 @@ static int skl_pcm_open(struct snd_pcm_substream *substream,
180180
snd_pcm_set_sync(substream);
181181

182182
mconfig = skl_tplg_fe_get_cpr_module(dai, substream->stream);
183+
if (!mconfig)
184+
return -EINVAL;
185+
183186
skl_tplg_d0i3_get(skl, mconfig->d0i3_caps);
184187

185188
return 0;

sound/soc/intel/skylake/skl-sst.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,9 @@ EXPORT_SYMBOL_GPL(skl_sst_init_fw);
515515

516516
void skl_sst_dsp_cleanup(struct device *dev, struct skl_sst *ctx)
517517
{
518+
519+
if (ctx->dsp->fw)
520+
release_firmware(ctx->dsp->fw);
518521
skl_clear_module_table(ctx->dsp);
519522
skl_freeup_uuid_list(ctx);
520523
skl_ipc_free(&ctx->ipc);

sound/soc/sh/rcar/core.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,10 +1030,8 @@ static int __rsnd_kctrl_new(struct rsnd_mod *mod,
10301030
return -ENOMEM;
10311031

10321032
ret = snd_ctl_add(card, kctrl);
1033-
if (ret < 0) {
1034-
snd_ctl_free_one(kctrl);
1033+
if (ret < 0)
10351034
return ret;
1036-
}
10371035

10381036
cfg->update = update;
10391037
cfg->card = card;

0 commit comments

Comments
 (0)