Commit 992fd39a authored by Mark Brown's avatar Mark Brown

Merge branch 'for-5.4' of...

Merge branch 'for-5.4' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-5.5
parents 18dd66ea 9508ef5a
...@@ -136,7 +136,7 @@ int asoc_simple_init_priv(struct asoc_simple_priv *priv, ...@@ -136,7 +136,7 @@ int asoc_simple_init_priv(struct asoc_simple_priv *priv,
struct link_info *li); struct link_info *li);
#ifdef DEBUG #ifdef DEBUG
inline void asoc_simple_debug_dai(struct asoc_simple_priv *priv, static inline void asoc_simple_debug_dai(struct asoc_simple_priv *priv,
char *name, char *name,
struct asoc_simple_dai *dai) struct asoc_simple_dai *dai)
{ {
...@@ -168,7 +168,7 @@ inline void asoc_simple_debug_dai(struct asoc_simple_priv *priv, ...@@ -168,7 +168,7 @@ inline void asoc_simple_debug_dai(struct asoc_simple_priv *priv,
dev_dbg(dev, "%s clk %luHz\n", name, clk_get_rate(dai->clk)); dev_dbg(dev, "%s clk %luHz\n", name, clk_get_rate(dai->clk));
} }
inline void asoc_simple_debug_info(struct asoc_simple_priv *priv) static inline void asoc_simple_debug_info(struct asoc_simple_priv *priv)
{ {
struct snd_soc_card *card = simple_priv_to_card(priv); struct snd_soc_card *card = simple_priv_to_card(priv);
struct device *dev = simple_priv_to_dev(priv); struct device *dev = simple_priv_to_dev(priv);
......
...@@ -528,7 +528,7 @@ static int snd_compress_check_input(struct snd_compr_params *params) ...@@ -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;
......
...@@ -500,8 +500,8 @@ static void hdac_hda_codec_remove(struct snd_soc_component *component) ...@@ -500,8 +500,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[] = {
......
...@@ -274,7 +274,7 @@ struct hdmi_codec_priv { ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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) ...@@ -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;
......
...@@ -960,11 +960,11 @@ static int max98373_i2c_probe(struct i2c_client *i2c, ...@@ -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);
......
...@@ -310,7 +310,7 @@ struct pm8916_wcd_analog_priv { ...@@ -310,7 +310,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(
...@@ -326,7 +326,7 @@ static const struct soc_enum adc2_enum = SOC_ENUM_SINGLE_VIRT( ...@@ -326,7 +326,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)
......
...@@ -243,6 +243,10 @@ static const char *const rx_mix1_text[] = { ...@@ -243,6 +243,10 @@ static const char *const rx_mix1_text[] = {
"ZERO", "IIR1", "IIR2", "RX1", "RX2", "RX3" "ZERO", "IIR1", "IIR2", "RX1", "RX2", "RX3"
}; };
static const char * const rx_mix2_text[] = {
"ZERO", "IIR1", "IIR2"
};
static const char *const dec_mux_text[] = { static const char *const dec_mux_text[] = {
"ZERO", "ADC1", "ADC2", "ADC3", "DMIC1", "DMIC2" "ZERO", "ADC1", "ADC2", "ADC3", "DMIC1", "DMIC2"
}; };
...@@ -270,6 +274,16 @@ static const struct soc_enum rx3_mix1_inp_enum[] = { ...@@ -270,6 +274,16 @@ static const struct soc_enum rx3_mix1_inp_enum[] = {
SOC_ENUM_SINGLE(LPASS_CDC_CONN_RX3_B2_CTL, 0, 6, rx_mix1_text), SOC_ENUM_SINGLE(LPASS_CDC_CONN_RX3_B2_CTL, 0, 6, rx_mix1_text),
}; };
/* RX1 MIX2 */
static const struct soc_enum rx_mix2_inp1_chain_enum =
SOC_ENUM_SINGLE(LPASS_CDC_CONN_RX1_B3_CTL,
0, 3, rx_mix2_text);
/* RX2 MIX2 */
static const struct soc_enum rx2_mix2_inp1_chain_enum =
SOC_ENUM_SINGLE(LPASS_CDC_CONN_RX2_B3_CTL,
0, 3, rx_mix2_text);
/* DEC */ /* DEC */
static const struct soc_enum dec1_mux_enum = SOC_ENUM_SINGLE( static const struct soc_enum dec1_mux_enum = SOC_ENUM_SINGLE(
LPASS_CDC_CONN_TX_B1_CTL, 0, 6, dec_mux_text); LPASS_CDC_CONN_TX_B1_CTL, 0, 6, dec_mux_text);
...@@ -309,6 +323,10 @@ static const struct snd_kcontrol_new rx3_mix1_inp2_mux = SOC_DAPM_ENUM( ...@@ -309,6 +323,10 @@ static const struct snd_kcontrol_new rx3_mix1_inp2_mux = SOC_DAPM_ENUM(
"RX3 MIX1 INP2 Mux", rx3_mix1_inp_enum[1]); "RX3 MIX1 INP2 Mux", rx3_mix1_inp_enum[1]);
static const struct snd_kcontrol_new rx3_mix1_inp3_mux = SOC_DAPM_ENUM( static const struct snd_kcontrol_new rx3_mix1_inp3_mux = SOC_DAPM_ENUM(
"RX3 MIX1 INP3 Mux", rx3_mix1_inp_enum[2]); "RX3 MIX1 INP3 Mux", rx3_mix1_inp_enum[2]);
static const struct snd_kcontrol_new rx1_mix2_inp1_mux = SOC_DAPM_ENUM(
"RX1 MIX2 INP1 Mux", rx_mix2_inp1_chain_enum);
static const struct snd_kcontrol_new rx2_mix2_inp1_mux = SOC_DAPM_ENUM(
"RX2 MIX2 INP1 Mux", rx2_mix2_inp1_chain_enum);
/* Digital Gain control -38.4 dB to +38.4 dB in 0.3 dB steps */ /* Digital Gain control -38.4 dB to +38.4 dB in 0.3 dB steps */
static const DECLARE_TLV_DB_SCALE(digital_gain, -3840, 30, 0); static const DECLARE_TLV_DB_SCALE(digital_gain, -3840, 30, 0);
...@@ -740,6 +758,10 @@ static const struct snd_soc_dapm_widget msm8916_wcd_digital_dapm_widgets[] = { ...@@ -740,6 +758,10 @@ static const struct snd_soc_dapm_widget msm8916_wcd_digital_dapm_widgets[] = {
&rx3_mix1_inp2_mux), &rx3_mix1_inp2_mux),
SND_SOC_DAPM_MUX("RX3 MIX1 INP3", SND_SOC_NOPM, 0, 0, SND_SOC_DAPM_MUX("RX3 MIX1 INP3", SND_SOC_NOPM, 0, 0,
&rx3_mix1_inp3_mux), &rx3_mix1_inp3_mux),
SND_SOC_DAPM_MUX("RX1 MIX2 INP1", SND_SOC_NOPM, 0, 0,
&rx1_mix2_inp1_mux),
SND_SOC_DAPM_MUX("RX2 MIX2 INP1", SND_SOC_NOPM, 0, 0,
&rx2_mix2_inp1_mux),
SND_SOC_DAPM_MUX("CIC1 MUX", SND_SOC_NOPM, 0, 0, &cic1_mux), SND_SOC_DAPM_MUX("CIC1 MUX", SND_SOC_NOPM, 0, 0, &cic1_mux),
SND_SOC_DAPM_MUX("CIC2 MUX", SND_SOC_NOPM, 0, 0, &cic2_mux), SND_SOC_DAPM_MUX("CIC2 MUX", SND_SOC_NOPM, 0, 0, &cic2_mux),
......
...@@ -1259,7 +1259,6 @@ static unsigned int wmfw_convert_flags(unsigned int in, unsigned int len) ...@@ -1259,7 +1259,6 @@ static unsigned int wmfw_convert_flags(unsigned int in, unsigned int len)
} }
if (in) { if (in) {
if (in & WMFW_CTL_FLAG_READABLE)
out |= rd; out |= rd;
if (in & WMFW_CTL_FLAG_WRITEABLE) if (in & WMFW_CTL_FLAG_WRITEABLE)
out |= wr; out |= wr;
......
...@@ -612,6 +612,15 @@ static int sof_audio_probe(struct platform_device *pdev) ...@@ -612,6 +612,15 @@ static int sof_audio_probe(struct platform_device *pdev)
/* need to get main clock from pmc */ /* need to get main clock from pmc */
if (sof_rt5682_quirk & SOF_RT5682_MCLK_BYTCHT_EN) { if (sof_rt5682_quirk & SOF_RT5682_MCLK_BYTCHT_EN) {
ctx->mclk = devm_clk_get(&pdev->dev, "pmc_plt_clk_3"); ctx->mclk = devm_clk_get(&pdev->dev, "pmc_plt_clk_3");
if (IS_ERR(ctx->mclk)) {
ret = PTR_ERR(ctx->mclk);
dev_err(&pdev->dev,
"Failed to get MCLK from pmc_plt_clk_3: %d\n",
ret);
return ret;
}
ret = clk_prepare_enable(ctx->mclk); ret = clk_prepare_enable(ctx->mclk);
if (ret < 0) { if (ret < 0) {
dev_err(&pdev->dev, dev_err(&pdev->dev,
......
...@@ -555,10 +555,6 @@ static int kirkwood_i2s_dev_probe(struct platform_device *pdev) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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);
......
...@@ -677,7 +677,7 @@ static int rockchip_i2s_probe(struct platform_device *pdev) ...@@ -677,7 +677,7 @@ static int rockchip_i2s_probe(struct platform_device *pdev)
ret = rockchip_pcm_platform_register(&pdev->dev); ret = rockchip_pcm_platform_register(&pdev->dev);
if (ret) { if (ret) {
dev_err(&pdev->dev, "Could not register PCM\n"); dev_err(&pdev->dev, "Could not register PCM\n");
return ret; goto err_suspend;
} }
return 0; return 0;
......
...@@ -113,10 +113,13 @@ static int rk_jack_event(struct notifier_block *nb, unsigned long event, ...@@ -113,10 +113,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);
......
...@@ -761,6 +761,7 @@ static int rsnd_soc_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) ...@@ -761,6 +761,7 @@ static int rsnd_soc_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
} }
/* set format */ /* set format */
rdai->bit_clk_inv = 0;
switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
case SND_SOC_DAIFMT_I2S: case SND_SOC_DAIFMT_I2S:
rdai->sys_delay = 0; rdai->sys_delay = 0;
......
...@@ -534,10 +534,10 @@ static struct rsnd_mod_ops rsnd_dmapp_ops = { ...@@ -534,10 +534,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))
......
...@@ -1182,6 +1182,7 @@ static int dpcm_be_connect(struct snd_soc_pcm_runtime *fe, ...@@ -1182,6 +1182,7 @@ static int dpcm_be_connect(struct snd_soc_pcm_runtime *fe,
{ {
struct snd_soc_dpcm *dpcm; struct snd_soc_dpcm *dpcm;
unsigned long flags; unsigned long flags;
char *name;
/* only add new dpcms */ /* only add new dpcms */
for_each_dpcm_be(fe, stream, dpcm) { for_each_dpcm_be(fe, stream, dpcm) {
...@@ -1207,9 +1208,15 @@ static int dpcm_be_connect(struct snd_soc_pcm_runtime *fe, ...@@ -1207,9 +1208,15 @@ static int dpcm_be_connect(struct snd_soc_pcm_runtime *fe,
stream ? "<-" : "->", be->dai_link->name); stream ? "<-" : "->", be->dai_link->name);
#ifdef CONFIG_DEBUG_FS #ifdef CONFIG_DEBUG_FS
dpcm->debugfs_state = debugfs_create_dir(be->dai_link->name, name = kasprintf(GFP_KERNEL, "%s:%s", be->dai_link->name,
stream ? "capture" : "playback");
if (name) {
dpcm->debugfs_state = debugfs_create_dir(name,
fe->debugfs_dpcm_root); fe->debugfs_dpcm_root);
debugfs_create_u32("state", 0644, dpcm->debugfs_state, &dpcm->state); debugfs_create_u32("state", 0644, dpcm->debugfs_state,
&dpcm->state);
kfree(name);
}
#endif #endif
return 1; return 1;
} }
......
...@@ -91,13 +91,16 @@ int snd_sof_volume_put(struct snd_kcontrol *kcontrol, ...@@ -91,13 +91,16 @@ int snd_sof_volume_put(struct snd_kcontrol *kcontrol,
struct snd_sof_dev *sdev = scontrol->sdev; struct snd_sof_dev *sdev = scontrol->sdev;
struct sof_ipc_ctrl_data *cdata = scontrol->control_data; struct sof_ipc_ctrl_data *cdata = scontrol->control_data;
unsigned int i, channels = scontrol->num_channels; unsigned int i, channels = scontrol->num_channels;
bool change = false;
u32 value;
/* update each channel */ /* update each channel */
for (i = 0; i < channels; i++) { for (i = 0; i < channels; i++) {
cdata->chanv[i].value = value = mixer_to_ipc(ucontrol->value.integer.value[i],
mixer_to_ipc(ucontrol->value.integer.value[i],
scontrol->volume_table, sm->max + 1); scontrol->volume_table, sm->max + 1);
change = change || (value != cdata->chanv[i].value);
cdata->chanv[i].channel = i; cdata->chanv[i].channel = i;
cdata->chanv[i].value = value;
} }
/* notify DSP of mixer updates */ /* notify DSP of mixer updates */
...@@ -107,8 +110,7 @@ int snd_sof_volume_put(struct snd_kcontrol *kcontrol, ...@@ -107,8 +110,7 @@ int snd_sof_volume_put(struct snd_kcontrol *kcontrol,
SOF_CTRL_TYPE_VALUE_CHAN_GET, SOF_CTRL_TYPE_VALUE_CHAN_GET,
SOF_CTRL_CMD_VOLUME, SOF_CTRL_CMD_VOLUME,
true); true);
return change;
return 0;
} }
int snd_sof_switch_get(struct snd_kcontrol *kcontrol, int snd_sof_switch_get(struct snd_kcontrol *kcontrol,
...@@ -136,11 +138,15 @@ int snd_sof_switch_put(struct snd_kcontrol *kcontrol, ...@@ -136,11 +138,15 @@ int snd_sof_switch_put(struct snd_kcontrol *kcontrol,
struct snd_sof_dev *sdev = scontrol->sdev; struct snd_sof_dev *sdev = scontrol->sdev;
struct sof_ipc_ctrl_data *cdata = scontrol->control_data; struct sof_ipc_ctrl_data *cdata = scontrol->control_data;
unsigned int i, channels = scontrol->num_channels; unsigned int i, channels = scontrol->num_channels;
bool change = false;
u32 value;
/* update each channel */ /* update each channel */
for (i = 0; i < channels; i++) { for (i = 0; i < channels; i++) {
cdata->chanv[i].value = ucontrol->value.integer.value[i]; value = ucontrol->value.integer.value[i];
change = change || (value != cdata->chanv[i].value);
cdata->chanv[i].channel = i; cdata->chanv[i].channel = i;
cdata->chanv[i].value = value;
} }
if (scontrol->led_ctl.use_led) if (scontrol->led_ctl.use_led)
...@@ -154,7 +160,7 @@ int snd_sof_switch_put(struct snd_kcontrol *kcontrol, ...@@ -154,7 +160,7 @@ int snd_sof_switch_put(struct snd_kcontrol *kcontrol,
SOF_CTRL_CMD_SWITCH, SOF_CTRL_CMD_SWITCH,
true); true);
return 0; return change;
} }
int snd_sof_enum_get(struct snd_kcontrol *kcontrol, int snd_sof_enum_get(struct snd_kcontrol *kcontrol,
...@@ -182,11 +188,15 @@ int snd_sof_enum_put(struct snd_kcontrol *kcontrol, ...@@ -182,11 +188,15 @@ int snd_sof_enum_put(struct snd_kcontrol *kcontrol,
struct snd_sof_dev *sdev = scontrol->sdev; struct snd_sof_dev *sdev = scontrol->sdev;
struct sof_ipc_ctrl_data *cdata = scontrol->control_data; struct sof_ipc_ctrl_data *cdata = scontrol->control_data;
unsigned int i, channels = scontrol->num_channels; unsigned int i, channels = scontrol->num_channels;
bool change = false;
u32 value;
/* update each channel */ /* update each channel */
for (i = 0; i < channels; i++) { for (i = 0; i < channels; i++) {
cdata->chanv[i].value = ucontrol->value.enumerated.item[i]; value = ucontrol->value.enumerated.item[i];
change = change || (value != cdata->chanv[i].value);
cdata->chanv[i].channel = i; cdata->chanv[i].channel = i;
cdata->chanv[i].value = value;
} }
/* notify DSP of enum updates */ /* notify DSP of enum updates */
...@@ -197,7 +207,7 @@ int snd_sof_enum_put(struct snd_kcontrol *kcontrol, ...@@ -197,7 +207,7 @@ int snd_sof_enum_put(struct snd_kcontrol *kcontrol,
SOF_CTRL_CMD_ENUM, SOF_CTRL_CMD_ENUM,
true); true);
return 0; return change;
} }
int snd_sof_bytes_get(struct snd_kcontrol *kcontrol, int snd_sof_bytes_get(struct snd_kcontrol *kcontrol,
......
...@@ -152,8 +152,10 @@ static ssize_t sof_dfsentry_write(struct file *file, const char __user *buffer, ...@@ -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;
......
...@@ -190,7 +190,7 @@ hda_dsp_stream_get(struct snd_sof_dev *sdev, int direction) ...@@ -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) ...@@ -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,
......
...@@ -570,8 +570,10 @@ static int sof_set_get_large_ctrl_data(struct snd_sof_dev *sdev, ...@@ -570,8 +570,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;
......
...@@ -505,10 +505,20 @@ static int stm32_sai_set_sysclk(struct snd_soc_dai *cpu_dai, ...@@ -505,10 +505,20 @@ static int stm32_sai_set_sysclk(struct snd_soc_dai *cpu_dai,
if (dir == SND_SOC_CLOCK_OUT && sai->sai_mclk) { if (dir == SND_SOC_CLOCK_OUT && sai->sai_mclk) {
ret = regmap_update_bits(sai->regmap, STM_SAI_CR1_REGX, ret = regmap_update_bits(sai->regmap, STM_SAI_CR1_REGX,
SAI_XCR1_NODIV, SAI_XCR1_NODIV,
(unsigned int)~SAI_XCR1_NODIV); freq ? 0 : SAI_XCR1_NODIV);
if (ret < 0) if (ret < 0)
return ret; return ret;
/* Assume shutdown if requested frequency is 0Hz */
if (!freq) {
/* Release mclk rate only if rate was actually set */
if (sai->mclk_rate) {
clk_rate_exclusive_put(sai->sai_mclk);
sai->mclk_rate = 0;
}
return 0;
}
/* If master clock is used, set parent clock now */ /* If master clock is used, set parent clock now */
ret = stm32_sai_set_parent_clock(sai, freq); ret = stm32_sai_set_parent_clock(sai, freq);
if (ret) if (ret)
...@@ -1093,15 +1103,6 @@ static void stm32_sai_shutdown(struct snd_pcm_substream *substream, ...@@ -1093,15 +1103,6 @@ static void stm32_sai_shutdown(struct snd_pcm_substream *substream,
regmap_update_bits(sai->regmap, STM_SAI_IMR_REGX, SAI_XIMR_MASK, 0); regmap_update_bits(sai->regmap, STM_SAI_IMR_REGX, SAI_XIMR_MASK, 0);
regmap_update_bits(sai->regmap, STM_SAI_CR1_REGX, SAI_XCR1_NODIV,
SAI_XCR1_NODIV);
/* Release mclk rate only if rate was actually set */
if (sai->mclk_rate) {
clk_rate_exclusive_put(sai->sai_mclk);
sai->mclk_rate = 0;
}
clk_disable_unprepare(sai->sai_ck); clk_disable_unprepare(sai->sai_ck);
spin_lock_irqsave(&sai->irq_lock, flags); spin_lock_irqsave(&sai->irq_lock, flags);
...@@ -1217,6 +1218,16 @@ static int stm32_sai_pcm_process_spdif(struct snd_pcm_substream *substream, ...@@ -1217,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,
...@@ -1269,7 +1280,7 @@ static const struct snd_dmaengine_pcm_config stm32_sai_pcm_config = { ...@@ -1269,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,
}; };
......
...@@ -62,7 +62,7 @@ int sdma_pcm_platform_register(struct device *dev, ...@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment