Skip to content

Commit

Permalink
Merge tag 'asoc-fix-v5.18-rc4' of https://git.kernel.org/pub/scm/linu…
Browse files Browse the repository at this point in the history
…x/kernel/git/broonie/sound into for-linus

ASoC: Fixes for v5.18

A larger collection of fixes than I'd like, mainly because mixer-test
is making it's way into the CI systems and turning up issues on a wider
range of systems.  The most substantial thing though is a revert and an
alternative fix for a dmaengine issue where the fix caused disruption
for some other configurations, the core fix is backed out an a driver
specific thing done instead.
  • Loading branch information
tiwai committed May 8, 2022
2 parents eb9d84b + c61711c commit ac02e3c
Show file tree
Hide file tree
Showing 14 changed files with 54 additions and 41 deletions.
1 change: 1 addition & 0 deletions sound/soc/atmel/mchp-pdmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -966,6 +966,7 @@ static int mchp_pdmc_process(struct snd_pcm_substream *substream,

static struct snd_dmaengine_pcm_config mchp_pdmc_config = {
.process = mchp_pdmc_process,
.prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config,
};

static int mchp_pdmc_probe(struct platform_device *pdev)
Expand Down
14 changes: 10 additions & 4 deletions sound/soc/codecs/da7219.c
Original file line number Diff line number Diff line change
Expand Up @@ -446,21 +446,27 @@ static int da7219_tonegen_freq_put(struct snd_kcontrol *kcontrol,
struct soc_mixer_control *mixer_ctrl =
(struct soc_mixer_control *) kcontrol->private_value;
unsigned int reg = mixer_ctrl->reg;
__le16 val;
__le16 val_new, val_old;
int ret;

/*
* Frequency value spans two 8-bit registers, lower then upper byte.
* Therefore we need to convert to little endian here to align with
* HW registers.
*/
val = cpu_to_le16(ucontrol->value.integer.value[0]);
val_new = cpu_to_le16(ucontrol->value.integer.value[0]);

mutex_lock(&da7219->ctrl_lock);
ret = regmap_raw_write(da7219->regmap, reg, &val, sizeof(val));
ret = regmap_raw_read(da7219->regmap, reg, &val_old, sizeof(val_old));
if (ret == 0 && (val_old != val_new))
ret = regmap_raw_write(da7219->regmap, reg,
&val_new, sizeof(val_new));
mutex_unlock(&da7219->ctrl_lock);

return ret;
if (ret < 0)
return ret;

return val_old != val_new;
}


Expand Down
5 changes: 4 additions & 1 deletion sound/soc/codecs/max98090.c
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,9 @@ static int max98090_put_enab_tlv(struct snd_kcontrol *kcontrol,

val = (val >> mc->shift) & mask;

if (sel < 0 || sel > mc->max)
return -EINVAL;

*select = sel;

/* Setting a volume is only valid if it is already On */
Expand All @@ -427,7 +430,7 @@ static int max98090_put_enab_tlv(struct snd_kcontrol *kcontrol,
mask << mc->shift,
sel << mc->shift);

return 0;
return *select != val;
}

static const char *max98090_perf_pwr_text[] =
Expand Down
1 change: 0 additions & 1 deletion sound/soc/codecs/rt9120.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,6 @@ static int rt9120_get_reg_size(unsigned int reg)
{
switch (reg) {
case 0x00:
case 0x09:
case 0x20 ... 0x27:
return 2;
case 0x30 ... 0x3D:
Expand Down
8 changes: 4 additions & 4 deletions sound/soc/codecs/wm8958-dsp2.c
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ static int wm8958_mbc_put(struct snd_kcontrol *kcontrol,

wm8958_dsp_apply(component, mbc, wm8994->mbc_ena[mbc]);

return 0;
return 1;
}

#define WM8958_MBC_SWITCH(xname, xval) {\
Expand Down Expand Up @@ -656,7 +656,7 @@ static int wm8958_vss_put(struct snd_kcontrol *kcontrol,

wm8958_dsp_apply(component, vss, wm8994->vss_ena[vss]);

return 0;
return 1;
}


Expand Down Expand Up @@ -730,7 +730,7 @@ static int wm8958_hpf_put(struct snd_kcontrol *kcontrol,

wm8958_dsp_apply(component, hpf % 3, ucontrol->value.integer.value[0]);

return 0;
return 1;
}

#define WM8958_HPF_SWITCH(xname, xval) {\
Expand Down Expand Up @@ -824,7 +824,7 @@ static int wm8958_enh_eq_put(struct snd_kcontrol *kcontrol,

wm8958_dsp_apply(component, eq, ucontrol->value.integer.value[0]);

return 0;
return 1;
}

#define WM8958_ENH_EQ_SWITCH(xname, xval) {\
Expand Down
2 changes: 1 addition & 1 deletion sound/soc/generic/simple-card-utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ void asoc_simple_shutdown(struct snd_pcm_substream *substream)

if (props->mclk_fs && !dai->clk_fixed && !snd_soc_dai_active(cpu_dai))
snd_soc_dai_set_sysclk(cpu_dai,
0, 0, SND_SOC_CLOCK_IN);
0, 0, SND_SOC_CLOCK_OUT);

asoc_simple_clk_disable(dai);
}
Expand Down
2 changes: 1 addition & 1 deletion sound/soc/meson/aiu-acodec-ctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ static int aiu_acodec_ctrl_mux_put_enum(struct snd_kcontrol *kcontrol,

snd_soc_dapm_mux_update_power(dapm, kcontrol, mux, e, NULL);

return 0;
return 1;
}

static SOC_ENUM_SINGLE_DECL(aiu_acodec_ctrl_mux_enum, AIU_ACODEC_CTRL,
Expand Down
2 changes: 1 addition & 1 deletion sound/soc/meson/aiu-codec-ctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ static int aiu_codec_ctrl_mux_put_enum(struct snd_kcontrol *kcontrol,

snd_soc_dapm_mux_update_power(dapm, kcontrol, mux, e, NULL);

return 0;
return 1;
}

static SOC_ENUM_SINGLE_DECL(aiu_hdmi_ctrl_mux_enum, AIU_HDMI_CLK_DATA_CTRL,
Expand Down
1 change: 0 additions & 1 deletion sound/soc/meson/axg-card.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,6 @@ static int axg_card_add_link(struct snd_soc_card *card, struct device_node *np,

dai_link->cpus = cpu;
dai_link->num_cpus = 1;
dai_link->nonatomic = true;

ret = meson_card_parse_dai(card, np, &dai_link->cpus->of_node,
&dai_link->cpus->dai_name);
Expand Down
26 changes: 5 additions & 21 deletions sound/soc/meson/axg-tdm-interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -351,29 +351,13 @@ static int axg_tdm_iface_hw_free(struct snd_pcm_substream *substream,
return 0;
}

static int axg_tdm_iface_trigger(struct snd_pcm_substream *substream,
int cmd,
static int axg_tdm_iface_prepare(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct axg_tdm_stream *ts =
snd_soc_dai_get_dma_data(dai, substream);

switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_RESUME:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
axg_tdm_stream_start(ts);
break;
case SNDRV_PCM_TRIGGER_SUSPEND:
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
case SNDRV_PCM_TRIGGER_STOP:
axg_tdm_stream_stop(ts);
break;
default:
return -EINVAL;
}
struct axg_tdm_stream *ts = snd_soc_dai_get_dma_data(dai, substream);

return 0;
/* Force all attached formatters to update */
return axg_tdm_stream_reset(ts);
}

static int axg_tdm_iface_remove_dai(struct snd_soc_dai *dai)
Expand Down Expand Up @@ -413,8 +397,8 @@ static const struct snd_soc_dai_ops axg_tdm_iface_ops = {
.set_fmt = axg_tdm_iface_set_fmt,
.startup = axg_tdm_iface_startup,
.hw_params = axg_tdm_iface_hw_params,
.prepare = axg_tdm_iface_prepare,
.hw_free = axg_tdm_iface_hw_free,
.trigger = axg_tdm_iface_trigger,
};

/* TDM Backend DAIs */
Expand Down
2 changes: 1 addition & 1 deletion sound/soc/meson/g12a-tohdmitx.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ static int g12a_tohdmitx_i2s_mux_put_enum(struct snd_kcontrol *kcontrol,

snd_soc_dapm_mux_update_power(dapm, kcontrol, mux, e, NULL);

return 0;
return 1;
}

static SOC_ENUM_SINGLE_DECL(g12a_tohdmitx_i2s_mux_enum, TOHDMITX_CTRL0,
Expand Down
6 changes: 3 additions & 3 deletions sound/soc/soc-generic-dmaengine-pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ static int dmaengine_pcm_hw_params(struct snd_soc_component *component,

memset(&slave_config, 0, sizeof(slave_config));

if (pcm->config && pcm->config->prepare_slave_config)
prepare_slave_config = pcm->config->prepare_slave_config;
else
if (!pcm->config)
prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config;
else
prepare_slave_config = pcm->config->prepare_slave_config;

if (prepare_slave_config) {
int ret = prepare_slave_config(substream, params, &slave_config);
Expand Down
20 changes: 18 additions & 2 deletions sound/soc/soc-ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol,
ret = err;
}
}
return err;
return ret;
}
EXPORT_SYMBOL_GPL(snd_soc_put_volsw_sx);

Expand Down Expand Up @@ -519,7 +519,15 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol,
unsigned int mask = (1 << fls(max)) - 1;
unsigned int invert = mc->invert;
unsigned int val, val_mask;
int err, ret;
int err, ret, tmp;

tmp = ucontrol->value.integer.value[0];
if (tmp < 0)
return -EINVAL;
if (mc->platform_max && tmp > mc->platform_max)
return -EINVAL;
if (tmp > mc->max - mc->min + 1)
return -EINVAL;

if (invert)
val = (max - ucontrol->value.integer.value[0]) & mask;
Expand All @@ -534,6 +542,14 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol,
ret = err;

if (snd_soc_volsw_is_stereo(mc)) {
tmp = ucontrol->value.integer.value[1];
if (tmp < 0)
return -EINVAL;
if (mc->platform_max && tmp > mc->platform_max)
return -EINVAL;
if (tmp > mc->max - mc->min + 1)
return -EINVAL;

if (invert)
val = (max - ucontrol->value.integer.value[1]) & mask;
else
Expand Down
5 changes: 5 additions & 0 deletions sound/soc/sof/sof-pci-dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,11 @@ int sof_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)

dev_dbg(&pci->dev, "PCI DSP detected");

if (!desc) {
dev_err(dev, "error: no matching PCI descriptor\n");
return -ENODEV;
}

if (!desc->ops) {
dev_err(dev, "error: no matching PCI descriptor ops\n");
return -ENODEV;
Expand Down

0 comments on commit ac02e3c

Please sign in to comment.