ASoC: Fixes for v5.4

These are a collection of fixes since v5.4-rc4 that have accumilated,
 they're all driver specific and there's nothing major in here so it's
 probably not essential to actually send them but I'll leave that call to
 you.
 -----BEGIN PGP SIGNATURE-----
 
 iQFHBAABCgAxFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAl3EETsTHGJyb29uaWVA
 a2VybmVsLm9yZwAKCRAk1otyXVSH0BJCB/968YQYuvmvJbBify4l+l56rz3O0Qge
 /dkifAsiBLYctwjYKVaqPhrcLts6gaKSZnKwNjF1d5ucjwb9y2cTuJoh65xJw4Z6
 wgOBJiVC0wTdLzLMStVAX6QKFP6oVgWkKuaWRfhWiCbdWMVQesQlZePmu/PYU2IH
 /B60aTN4noSMycFqmdHfyVGXnTX7cONCFr9cfE/EX+uQLCFe+QD7UItCEGl/1uwp
 84mfNdLFkhX72yEEb5SZvGac5k9fyRvy1TPqkO5r+BQeYnePUMCpuA2mZaO9yBUh
 r+6AMDcF300lXt860UtBidugpC5YM9vNUAu/dXMDowP8A+vBg2aquYe+
 =GWKb
 -----END PGP SIGNATURE-----

Merge tag 'asoc-fix-v5.4-rc6' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus

ASoC: Fixes for v5.4

These are a collection of fixes since v5.4-rc4 that have accumilated,
they're all driver specific and there's nothing major in here so it's
probably not essential to actually send them but I'll leave that call to
you.
This commit is contained in:
Takashi Iwai 2019-11-07 13:52:17 +01:00
commit df37d941c4
14 changed files with 52 additions and 35 deletions

View File

@ -528,7 +528,7 @@ static int snd_compress_check_input(struct snd_compr_params *params)
{ {
/* first let's check the buffer parameter's */ /* first let's check the buffer parameter's */
if (params->buffer.fragment_size == 0 || if (params->buffer.fragment_size == 0 ||
params->buffer.fragments > INT_MAX / params->buffer.fragment_size || params->buffer.fragments > U32_MAX / params->buffer.fragment_size ||
params->buffer.fragments == 0) params->buffer.fragments == 0)
return -EINVAL; return -EINVAL;

View File

@ -410,8 +410,8 @@ static void hdac_hda_codec_remove(struct snd_soc_component *component)
return; return;
} }
snd_hdac_ext_bus_link_put(hdev->bus, hlink);
pm_runtime_disable(&hdev->dev); pm_runtime_disable(&hdev->dev);
snd_hdac_ext_bus_link_put(hdev->bus, hlink);
} }
static const struct snd_soc_dapm_route hdac_hda_dapm_routes[] = { static const struct snd_soc_dapm_route hdac_hda_dapm_routes[] = {

View File

@ -274,7 +274,7 @@ struct hdmi_codec_priv {
uint8_t eld[MAX_ELD_BYTES]; uint8_t eld[MAX_ELD_BYTES];
struct snd_pcm_chmap *chmap_info; struct snd_pcm_chmap *chmap_info;
unsigned int chmap_idx; unsigned int chmap_idx;
struct mutex lock; unsigned long busy;
struct snd_soc_jack *jack; struct snd_soc_jack *jack;
unsigned int jack_status; unsigned int jack_status;
}; };
@ -390,8 +390,8 @@ static int hdmi_codec_startup(struct snd_pcm_substream *substream,
struct hdmi_codec_priv *hcp = snd_soc_dai_get_drvdata(dai); struct hdmi_codec_priv *hcp = snd_soc_dai_get_drvdata(dai);
int ret = 0; int ret = 0;
ret = mutex_trylock(&hcp->lock); ret = test_and_set_bit(0, &hcp->busy);
if (!ret) { if (ret) {
dev_err(dai->dev, "Only one simultaneous stream supported!\n"); dev_err(dai->dev, "Only one simultaneous stream supported!\n");
return -EINVAL; return -EINVAL;
} }
@ -419,7 +419,7 @@ static int hdmi_codec_startup(struct snd_pcm_substream *substream,
err: err:
/* Release the exclusive lock on error */ /* Release the exclusive lock on error */
mutex_unlock(&hcp->lock); clear_bit(0, &hcp->busy);
return ret; return ret;
} }
@ -431,7 +431,7 @@ static void hdmi_codec_shutdown(struct snd_pcm_substream *substream,
hcp->chmap_idx = HDMI_CODEC_CHMAP_IDX_UNKNOWN; hcp->chmap_idx = HDMI_CODEC_CHMAP_IDX_UNKNOWN;
hcp->hcd.ops->audio_shutdown(dai->dev->parent, hcp->hcd.data); hcp->hcd.ops->audio_shutdown(dai->dev->parent, hcp->hcd.data);
mutex_unlock(&hcp->lock); clear_bit(0, &hcp->busy);
} }
static int hdmi_codec_hw_params(struct snd_pcm_substream *substream, static int hdmi_codec_hw_params(struct snd_pcm_substream *substream,
@ -811,8 +811,6 @@ static int hdmi_codec_probe(struct platform_device *pdev)
return -ENOMEM; return -ENOMEM;
hcp->hcd = *hcd; hcp->hcd = *hcd;
mutex_init(&hcp->lock);
daidrv = devm_kcalloc(dev, dai_count, sizeof(*daidrv), GFP_KERNEL); daidrv = devm_kcalloc(dev, dai_count, sizeof(*daidrv), GFP_KERNEL);
if (!daidrv) if (!daidrv)
return -ENOMEM; return -ENOMEM;

View File

@ -960,11 +960,11 @@ static int max98373_i2c_probe(struct i2c_client *i2c,
/* Power on device */ /* Power on device */
if (gpio_is_valid(max98373->reset_gpio)) { if (gpio_is_valid(max98373->reset_gpio)) {
ret = gpio_request(max98373->reset_gpio, "MAX98373_RESET"); ret = devm_gpio_request(&i2c->dev, max98373->reset_gpio,
"MAX98373_RESET");
if (ret) { if (ret) {
dev_err(&i2c->dev, "%s: Failed to request gpio %d\n", dev_err(&i2c->dev, "%s: Failed to request gpio %d\n",
__func__, max98373->reset_gpio); __func__, max98373->reset_gpio);
gpio_free(max98373->reset_gpio);
return -EINVAL; return -EINVAL;
} }
gpio_direction_output(max98373->reset_gpio, 0); gpio_direction_output(max98373->reset_gpio, 0);

View File

@ -306,7 +306,7 @@ struct pm8916_wcd_analog_priv {
}; };
static const char *const adc2_mux_text[] = { "ZERO", "INP2", "INP3" }; static const char *const adc2_mux_text[] = { "ZERO", "INP2", "INP3" };
static const char *const rdac2_mux_text[] = { "ZERO", "RX2", "RX1" }; static const char *const rdac2_mux_text[] = { "RX1", "RX2" };
static const char *const hph_text[] = { "ZERO", "Switch", }; static const char *const hph_text[] = { "ZERO", "Switch", };
static const struct soc_enum hph_enum = SOC_ENUM_SINGLE_VIRT( static const struct soc_enum hph_enum = SOC_ENUM_SINGLE_VIRT(
@ -321,7 +321,7 @@ static const struct soc_enum adc2_enum = SOC_ENUM_SINGLE_VIRT(
/* RDAC2 MUX */ /* RDAC2 MUX */
static const struct soc_enum rdac2_mux_enum = SOC_ENUM_SINGLE( static const struct soc_enum rdac2_mux_enum = SOC_ENUM_SINGLE(
CDC_D_CDC_CONN_HPHR_DAC_CTL, 0, 3, rdac2_mux_text); CDC_D_CDC_CONN_HPHR_DAC_CTL, 0, 2, rdac2_mux_text);
static const struct snd_kcontrol_new spkr_switch[] = { static const struct snd_kcontrol_new spkr_switch[] = {
SOC_DAPM_SINGLE("Switch", CDC_A_SPKR_DAC_CTL, 7, 1, 0) SOC_DAPM_SINGLE("Switch", CDC_A_SPKR_DAC_CTL, 7, 1, 0)

View File

@ -555,10 +555,6 @@ static int kirkwood_i2s_dev_probe(struct platform_device *pdev)
return PTR_ERR(priv->clk); return PTR_ERR(priv->clk);
} }
err = clk_prepare_enable(priv->clk);
if (err < 0)
return err;
priv->extclk = devm_clk_get(&pdev->dev, "extclk"); priv->extclk = devm_clk_get(&pdev->dev, "extclk");
if (IS_ERR(priv->extclk)) { if (IS_ERR(priv->extclk)) {
if (PTR_ERR(priv->extclk) == -EPROBE_DEFER) if (PTR_ERR(priv->extclk) == -EPROBE_DEFER)
@ -574,6 +570,10 @@ static int kirkwood_i2s_dev_probe(struct platform_device *pdev)
} }
} }
err = clk_prepare_enable(priv->clk);
if (err < 0)
return err;
/* Some sensible defaults - this reflects the powerup values */ /* Some sensible defaults - this reflects the powerup values */
priv->ctl_play = KIRKWOOD_PLAYCTL_SIZE_24; priv->ctl_play = KIRKWOOD_PLAYCTL_SIZE_24;
priv->ctl_rec = KIRKWOOD_RECCTL_SIZE_24; priv->ctl_rec = KIRKWOOD_RECCTL_SIZE_24;
@ -587,7 +587,7 @@ static int kirkwood_i2s_dev_probe(struct platform_device *pdev)
priv->ctl_rec |= KIRKWOOD_RECCTL_BURST_128; priv->ctl_rec |= KIRKWOOD_RECCTL_BURST_128;
} }
err = devm_snd_soc_register_component(&pdev->dev, &kirkwood_soc_component, err = snd_soc_register_component(&pdev->dev, &kirkwood_soc_component,
soc_dai, 2); soc_dai, 2);
if (err) { if (err) {
dev_err(&pdev->dev, "snd_soc_register_component failed\n"); dev_err(&pdev->dev, "snd_soc_register_component failed\n");
@ -610,6 +610,7 @@ static int kirkwood_i2s_dev_remove(struct platform_device *pdev)
{ {
struct kirkwood_dma_data *priv = dev_get_drvdata(&pdev->dev); struct kirkwood_dma_data *priv = dev_get_drvdata(&pdev->dev);
snd_soc_unregister_component(&pdev->dev);
if (!IS_ERR(priv->extclk)) if (!IS_ERR(priv->extclk))
clk_disable_unprepare(priv->extclk); clk_disable_unprepare(priv->extclk);
clk_disable_unprepare(priv->clk); clk_disable_unprepare(priv->clk);

View File

@ -66,10 +66,13 @@ static int rk_jack_event(struct notifier_block *nb, unsigned long event,
struct snd_soc_jack *jack = (struct snd_soc_jack *)data; struct snd_soc_jack *jack = (struct snd_soc_jack *)data;
struct snd_soc_dapm_context *dapm = &jack->card->dapm; struct snd_soc_dapm_context *dapm = &jack->card->dapm;
if (event & SND_JACK_MICROPHONE) if (event & SND_JACK_MICROPHONE) {
snd_soc_dapm_force_enable_pin(dapm, "MICBIAS"); snd_soc_dapm_force_enable_pin(dapm, "MICBIAS");
else snd_soc_dapm_force_enable_pin(dapm, "SHDN");
} else {
snd_soc_dapm_disable_pin(dapm, "MICBIAS"); snd_soc_dapm_disable_pin(dapm, "MICBIAS");
snd_soc_dapm_disable_pin(dapm, "SHDN");
}
snd_soc_dapm_sync(dapm); snd_soc_dapm_sync(dapm);

View File

@ -508,10 +508,10 @@ static struct rsnd_mod_ops rsnd_dmapp_ops = {
#define RDMA_SSI_I_N(addr, i) (addr ##_reg - 0x00300000 + (0x40 * i) + 0x8) #define RDMA_SSI_I_N(addr, i) (addr ##_reg - 0x00300000 + (0x40 * i) + 0x8)
#define RDMA_SSI_O_N(addr, i) (addr ##_reg - 0x00300000 + (0x40 * i) + 0xc) #define RDMA_SSI_O_N(addr, i) (addr ##_reg - 0x00300000 + (0x40 * i) + 0xc)
#define RDMA_SSIU_I_N(addr, i, j) (addr ##_reg - 0x00441000 + (0x1000 * (i)) + (((j) / 4) * 0xA000) + (((j) % 4) * 0x400)) #define RDMA_SSIU_I_N(addr, i, j) (addr ##_reg - 0x00441000 + (0x1000 * (i)) + (((j) / 4) * 0xA000) + (((j) % 4) * 0x400) - (0x4000 * ((i) / 9) * ((j) / 4)))
#define RDMA_SSIU_O_N(addr, i, j) RDMA_SSIU_I_N(addr, i, j) #define RDMA_SSIU_O_N(addr, i, j) RDMA_SSIU_I_N(addr, i, j)
#define RDMA_SSIU_I_P(addr, i, j) (addr ##_reg - 0x00141000 + (0x1000 * (i)) + (((j) / 4) * 0xA000) + (((j) % 4) * 0x400)) #define RDMA_SSIU_I_P(addr, i, j) (addr ##_reg - 0x00141000 + (0x1000 * (i)) + (((j) / 4) * 0xA000) + (((j) % 4) * 0x400) - (0x4000 * ((i) / 9) * ((j) / 4)))
#define RDMA_SSIU_O_P(addr, i, j) RDMA_SSIU_I_P(addr, i, j) #define RDMA_SSIU_O_P(addr, i, j) RDMA_SSIU_I_P(addr, i, j)
#define RDMA_SRC_I_N(addr, i) (addr ##_reg - 0x00500000 + (0x400 * i)) #define RDMA_SRC_I_N(addr, i) (addr ##_reg - 0x00500000 + (0x400 * i))

View File

@ -152,8 +152,10 @@ static ssize_t sof_dfsentry_write(struct file *file, const char __user *buffer,
*/ */
dentry = file->f_path.dentry; dentry = file->f_path.dentry;
if (strcmp(dentry->d_name.name, "ipc_flood_count") && if (strcmp(dentry->d_name.name, "ipc_flood_count") &&
strcmp(dentry->d_name.name, "ipc_flood_duration_ms")) strcmp(dentry->d_name.name, "ipc_flood_duration_ms")) {
return -EINVAL; ret = -EINVAL;
goto out;
}
if (!strcmp(dentry->d_name.name, "ipc_flood_duration_ms")) if (!strcmp(dentry->d_name.name, "ipc_flood_duration_ms"))
flood_duration_test = true; flood_duration_test = true;

View File

@ -190,7 +190,7 @@ hda_dsp_stream_get(struct snd_sof_dev *sdev, int direction)
* Workaround to address a known issue with host DMA that results * Workaround to address a known issue with host DMA that results
* in xruns during pause/release in capture scenarios. * in xruns during pause/release in capture scenarios.
*/ */
if (!IS_ENABLED(SND_SOC_SOF_HDA_ALWAYS_ENABLE_DMI_L1)) if (!IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_ALWAYS_ENABLE_DMI_L1))
if (stream && direction == SNDRV_PCM_STREAM_CAPTURE) if (stream && direction == SNDRV_PCM_STREAM_CAPTURE)
snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR, snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR,
HDA_VS_INTEL_EM2, HDA_VS_INTEL_EM2,
@ -228,7 +228,7 @@ int hda_dsp_stream_put(struct snd_sof_dev *sdev, int direction, int stream_tag)
spin_unlock_irq(&bus->reg_lock); spin_unlock_irq(&bus->reg_lock);
/* Enable DMI L1 entry if there are no capture streams open */ /* Enable DMI L1 entry if there are no capture streams open */
if (!IS_ENABLED(SND_SOC_SOF_HDA_ALWAYS_ENABLE_DMI_L1)) if (!IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_ALWAYS_ENABLE_DMI_L1))
if (!active_capture_stream) if (!active_capture_stream)
snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR, snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR,
HDA_VS_INTEL_EM2, HDA_VS_INTEL_EM2,

View File

@ -572,8 +572,10 @@ static int sof_set_get_large_ctrl_data(struct snd_sof_dev *sdev,
else else
err = sof_get_ctrl_copy_params(cdata->type, partdata, cdata, err = sof_get_ctrl_copy_params(cdata->type, partdata, cdata,
sparams); sparams);
if (err < 0) if (err < 0) {
kfree(partdata);
return err; return err;
}
msg_bytes = sparams->msg_bytes; msg_bytes = sparams->msg_bytes;
pl_size = sparams->pl_size; pl_size = sparams->pl_size;

View File

@ -543,15 +543,16 @@ static int sof_control_load_bytes(struct snd_soc_component *scomp,
struct soc_bytes_ext *sbe = (struct soc_bytes_ext *)kc->private_value; struct soc_bytes_ext *sbe = (struct soc_bytes_ext *)kc->private_value;
int max_size = sbe->max; int max_size = sbe->max;
if (le32_to_cpu(control->priv.size) > max_size) {
dev_err(sdev->dev, "err: bytes data size %d exceeds max %d.\n",
control->priv.size, max_size);
return -EINVAL;
}
/* init the get/put bytes data */ /* init the get/put bytes data */
scontrol->size = sizeof(struct sof_ipc_ctrl_data) + scontrol->size = sizeof(struct sof_ipc_ctrl_data) +
le32_to_cpu(control->priv.size); le32_to_cpu(control->priv.size);
if (scontrol->size > max_size) {
dev_err(sdev->dev, "err: bytes data size %d exceeds max %d.\n",
scontrol->size, max_size);
return -EINVAL;
}
scontrol->control_data = kzalloc(max_size, GFP_KERNEL); scontrol->control_data = kzalloc(max_size, GFP_KERNEL);
cdata = scontrol->control_data; cdata = scontrol->control_data;
if (!scontrol->control_data) if (!scontrol->control_data)

View File

@ -1218,6 +1218,16 @@ static int stm32_sai_pcm_process_spdif(struct snd_pcm_substream *substream,
return 0; return 0;
} }
/* No support of mmap in S/PDIF mode */
static const struct snd_pcm_hardware stm32_sai_pcm_hw_spdif = {
.info = SNDRV_PCM_INFO_INTERLEAVED,
.buffer_bytes_max = 8 * PAGE_SIZE,
.period_bytes_min = 1024,
.period_bytes_max = PAGE_SIZE,
.periods_min = 2,
.periods_max = 8,
};
static const struct snd_pcm_hardware stm32_sai_pcm_hw = { static const struct snd_pcm_hardware stm32_sai_pcm_hw = {
.info = SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_MMAP, .info = SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_MMAP,
.buffer_bytes_max = 8 * PAGE_SIZE, .buffer_bytes_max = 8 * PAGE_SIZE,
@ -1270,7 +1280,7 @@ static const struct snd_dmaengine_pcm_config stm32_sai_pcm_config = {
}; };
static const struct snd_dmaengine_pcm_config stm32_sai_pcm_config_spdif = { static const struct snd_dmaengine_pcm_config stm32_sai_pcm_config_spdif = {
.pcm_hardware = &stm32_sai_pcm_hw, .pcm_hardware = &stm32_sai_pcm_hw_spdif,
.prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config, .prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config,
.process = stm32_sai_pcm_process_spdif, .process = stm32_sai_pcm_process_spdif,
}; };

View File

@ -62,7 +62,7 @@ int sdma_pcm_platform_register(struct device *dev,
config->chan_names[0] = txdmachan; config->chan_names[0] = txdmachan;
config->chan_names[1] = rxdmachan; config->chan_names[1] = rxdmachan;
return devm_snd_dmaengine_pcm_register(dev, config, 0); return devm_snd_dmaengine_pcm_register(dev, config, flags);
} }
EXPORT_SYMBOL_GPL(sdma_pcm_platform_register); EXPORT_SYMBOL_GPL(sdma_pcm_platform_register);