Cleanups for the dmaengine code build on top of current fixes.
This commit is contained in:
Mark Brown 2022-05-04 15:30:32 +01:00
Родитель 55d2a66cfe a962890a5a
Коммит c0b38be14f
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 24D68B725D5487D0
22 изменённых файлов: 124 добавлений и 70 удалений

Просмотреть файл

@ -955,8 +955,7 @@ static int cs_dsp_create_control(struct cs_dsp *dsp,
ctl->alg_region = *alg_region;
if (subname && dsp->fw_ver >= 2) {
ctl->subname_len = subname_len;
ctl->subname = kmemdup(subname,
strlen(subname) + 1, GFP_KERNEL);
ctl->subname = kasprintf(GFP_KERNEL, "%.*s", subname_len, subname);
if (!ctl->subname) {
ret = -ENOMEM;
goto err_ctl;

Просмотреть файл

@ -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)

Просмотреть файл

@ -446,7 +446,7 @@ 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;
/*
@ -454,13 +454,19 @@ static int da7219_tonegen_freq_put(struct snd_kcontrol *kcontrol,
* 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;
}

Просмотреть файл

@ -3566,12 +3566,16 @@ static int rx_macro_probe(struct platform_device *pdev)
return PTR_ERR(rx->pds);
base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(base))
return PTR_ERR(base);
if (IS_ERR(base)) {
ret = PTR_ERR(base);
goto err;
}
rx->regmap = devm_regmap_init_mmio(dev, base, &rx_regmap_config);
if (IS_ERR(rx->regmap))
return PTR_ERR(rx->regmap);
if (IS_ERR(rx->regmap)) {
ret = PTR_ERR(rx->regmap);
goto err;
}
dev_set_drvdata(dev, rx);
@ -3632,6 +3636,8 @@ err_mclk:
err_dcodec:
clk_disable_unprepare(rx->macro);
err:
lpass_macro_pds_exit(rx->pds);
return ret;
}

Просмотреть файл

@ -1828,8 +1828,10 @@ static int tx_macro_probe(struct platform_device *pdev)
return PTR_ERR(tx->pds);
base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(base))
return PTR_ERR(base);
if (IS_ERR(base)) {
ret = PTR_ERR(base);
goto err;
}
/* Update defaults for lpass sc7280 */
if (of_device_is_compatible(np, "qcom,sc7280-lpass-tx-macro")) {
@ -1846,8 +1848,10 @@ static int tx_macro_probe(struct platform_device *pdev)
}
tx->regmap = devm_regmap_init_mmio(dev, base, &tx_regmap_config);
if (IS_ERR(tx->regmap))
return PTR_ERR(tx->regmap);
if (IS_ERR(tx->regmap)) {
ret = PTR_ERR(tx->regmap);
goto err;
}
dev_set_drvdata(dev, tx);
@ -1907,6 +1911,8 @@ err_mclk:
err_dcodec:
clk_disable_unprepare(tx->macro);
err:
lpass_macro_pds_exit(tx->pds);
return ret;
}

Просмотреть файл

@ -1434,8 +1434,10 @@ static int va_macro_probe(struct platform_device *pdev)
va->dmic_clk_div = VA_MACRO_CLK_DIV_2;
} else {
ret = va_macro_validate_dmic_sample_rate(sample_rate, va);
if (!ret)
return -EINVAL;
if (!ret) {
ret = -EINVAL;
goto err;
}
}
base = devm_platform_ioremap_resource(pdev, 0);
@ -1492,6 +1494,8 @@ err_mclk:
err_dcodec:
clk_disable_unprepare(va->macro);
err:
lpass_macro_pds_exit(va->pds);
return ret;
}

Просмотреть файл

@ -396,6 +396,7 @@ static int max98090_put_enab_tlv(struct snd_kcontrol *kcontrol,
unsigned int sel = ucontrol->value.integer.value[0];
unsigned int val = snd_soc_component_read(component, mc->reg);
unsigned int *select;
int change;
switch (mc->reg) {
case M98090_REG_MIC1_INPUT_LEVEL:
@ -413,6 +414,10 @@ static int max98090_put_enab_tlv(struct snd_kcontrol *kcontrol,
val = (val >> mc->shift) & mask;
if (sel < 0 || sel > mc->max)
return -EINVAL;
change = *select != sel;
*select = sel;
/* Setting a volume is only valid if it is already On */
@ -427,7 +432,7 @@ static int max98090_put_enab_tlv(struct snd_kcontrol *kcontrol,
mask << mc->shift,
sel << mc->shift);
return 0;
return change;
}
static const char *max98090_perf_pwr_text[] =

Просмотреть файл

@ -419,7 +419,7 @@ static int rt5514_dsp_voice_wake_up_put(struct snd_kcontrol *kcontrol,
}
}
return 0;
return 1;
}
static const struct snd_kcontrol_new rt5514_snd_controls[] = {

Просмотреть файл

@ -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:

Просмотреть файл

@ -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) {\
@ -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;
}
@ -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) {\
@ -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) {\

Просмотреть файл

@ -14,6 +14,7 @@
#include <linux/pm.h>
#include <linux/clk.h>
#include <linux/i2c.h>
#include <linux/acpi.h>
#include <linux/slab.h>
#include <sound/core.h>
#include <sound/pcm.h>
@ -1497,16 +1498,28 @@ static const struct i2c_device_id wm8960_i2c_id[] = {
};
MODULE_DEVICE_TABLE(i2c, wm8960_i2c_id);
#if defined(CONFIG_OF)
static const struct of_device_id wm8960_of_match[] = {
{ .compatible = "wlf,wm8960", },
{ }
};
MODULE_DEVICE_TABLE(of, wm8960_of_match);
#endif
#if defined(CONFIG_ACPI)
static const struct acpi_device_id wm8960_acpi_match[] = {
{ "1AEC8960", 0 }, /* Wolfson PCI ID + part ID */
{ "10138960", 0 }, /* Cirrus Logic PCI ID + part ID */
{ },
};
MODULE_DEVICE_TABLE(acpi, wm8960_acpi_match);
#endif
static struct i2c_driver wm8960_i2c_driver = {
.driver = {
.name = "wm8960",
.of_match_table = wm8960_of_match,
.of_match_table = of_match_ptr(wm8960_of_match),
.acpi_match_table = ACPI_PTR(wm8960_acpi_match),
},
.probe_new = wm8960_i2c_probe,
.remove = wm8960_i2c_remove,

Просмотреть файл

@ -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);
}

Просмотреть файл

@ -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,

Просмотреть файл

@ -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,

Просмотреть файл

@ -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);

Просмотреть файл

@ -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);
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;
}
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)
@ -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 */

Просмотреть файл

@ -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,

Просмотреть файл

@ -3437,7 +3437,6 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol,
update.val = val;
card->update = &update;
}
change |= reg_change;
ret = soc_dapm_mixer_update_power(card, kcontrol, connect,
rconnect);
@ -3539,7 +3538,6 @@ int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol,
update.val = val;
card->update = &update;
}
change |= reg_change;
ret = soc_dapm_mux_update_power(card, kcontrol, item[0], e);

Просмотреть файл

@ -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);

Просмотреть файл

@ -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);
@ -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;
@ -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

Просмотреть файл

@ -20,7 +20,8 @@
struct sof_widget_data {
int ctrl_type;
int ipc_cmd;
struct sof_abi_hdr *pdata;
void *pdata;
size_t pdata_size;
struct snd_sof_control *control;
};
@ -784,16 +785,26 @@ static int sof_get_control_data(struct snd_soc_component *scomp,
}
cdata = wdata[i].control->ipc_control_data;
wdata[i].pdata = cdata->data;
if (!wdata[i].pdata)
return -EINVAL;
/* make sure data is valid - data can be updated at runtime */
if (widget->dobj.widget.kcontrol_type[i] == SND_SOC_TPLG_TYPE_BYTES &&
wdata[i].pdata->magic != SOF_ABI_MAGIC)
return -EINVAL;
if (widget->dobj.widget.kcontrol_type[i] == SND_SOC_TPLG_TYPE_BYTES) {
/* make sure data is valid - data can be updated at runtime */
if (cdata->data->magic != SOF_ABI_MAGIC)
return -EINVAL;
*size += wdata[i].pdata->size;
wdata[i].pdata = cdata->data->data;
wdata[i].pdata_size = cdata->data->size;
} else {
/* points to the control data union */
wdata[i].pdata = cdata->chanv;
/*
* wdata[i].control->size is calculated with struct_size
* and includes the size of struct sof_ipc_ctrl_data
*/
wdata[i].pdata_size = wdata[i].control->size -
sizeof(struct sof_ipc_ctrl_data);
}
*size += wdata[i].pdata_size;
/* get data type */
switch (cdata->cmd) {
@ -876,10 +887,12 @@ static int sof_process_load(struct snd_soc_component *scomp,
*/
if (ipc_data_size) {
for (i = 0; i < widget->num_kcontrols; i++) {
memcpy(&process->data[offset],
wdata[i].pdata->data,
wdata[i].pdata->size);
offset += wdata[i].pdata->size;
if (!wdata[i].pdata_size)
continue;
memcpy(&process->data[offset], wdata[i].pdata,
wdata[i].pdata_size);
offset += wdata[i].pdata_size;
}
}

Просмотреть файл

@ -187,6 +187,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;