mirror of
https://github.com/torvalds/linux.git
synced 2024-11-13 23:51:39 +00:00
ASoC: Fixes for v6.3
More fixes that came in since -rc1, a lot from Intel - looks like they've been busy test. Everything is driver specific. -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmQKUjgACgkQJNaLcl1U h9A1Kgf+IRw/PaAgptGwW8AeHgQEGxVRDEBOzYD+4LgYlDpYwIeSUJKAh2kn04k1 vx9+Eq4MwOhHSgNqnASGZK5vIFgLl3kZhI7o+rCjzbbTxQL0clYxtAjO17Ayw8Nn AtHpGzj4W7STRLZTgOTQfOC2idxizltBzAtpK5oWdhZKjtdHs95zGySmpzXrv0bM DYwHSokV1KuH3w1oDz47DF45GGHylwxCidrf1TC026xFwtSrKyYYKZOXqild7vpc 6SbLmEu9QCSQGRlSMMaim7t2hUpkr+EJpZOhBbs5eEyr4ngD2OSYxclbPo14+fmr XTKVALLlOMbN9no1BTy6IZ7qEvcztQ== =EWuz -----END PGP SIGNATURE----- Merge tag 'asoc-fix-v6.3-rc1' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus ASoC: Fixes for v6.3 More fixes that came in since -rc1, a lot from Intel - looks like they've been busy test. Everything is driver specific.
This commit is contained in:
commit
c24ff3ec55
@ -968,6 +968,8 @@ int da7219_aad_init(struct snd_soc_component *component)
|
||||
INIT_WORK(&da7219_aad->hptest_work, da7219_aad_hptest_work);
|
||||
INIT_WORK(&da7219_aad->jack_det_work, da7219_aad_jack_det_work);
|
||||
|
||||
mutex_init(&da7219_aad->jack_det_mutex);
|
||||
|
||||
ret = request_threaded_irq(da7219_aad->irq, da7219_aad_pre_irq_thread,
|
||||
da7219_aad_irq_thread,
|
||||
IRQF_TRIGGER_LOW | IRQF_ONESHOT,
|
||||
|
@ -428,8 +428,13 @@ static int hdmi_codec_startup(struct snd_pcm_substream *substream,
|
||||
{
|
||||
struct hdmi_codec_priv *hcp = snd_soc_dai_get_drvdata(dai);
|
||||
bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
|
||||
bool has_capture = !hcp->hcd.no_i2s_capture;
|
||||
bool has_playback = !hcp->hcd.no_i2s_playback;
|
||||
int ret = 0;
|
||||
|
||||
if (!((has_playback && tx) || (has_capture && !tx)))
|
||||
return 0;
|
||||
|
||||
mutex_lock(&hcp->lock);
|
||||
if (hcp->busy) {
|
||||
dev_err(dai->dev, "Only one simultaneous stream supported!\n");
|
||||
@ -468,6 +473,12 @@ static void hdmi_codec_shutdown(struct snd_pcm_substream *substream,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct hdmi_codec_priv *hcp = snd_soc_dai_get_drvdata(dai);
|
||||
bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
|
||||
bool has_capture = !hcp->hcd.no_i2s_capture;
|
||||
bool has_playback = !hcp->hcd.no_i2s_playback;
|
||||
|
||||
if (!((has_playback && tx) || (has_capture && !tx)))
|
||||
return;
|
||||
|
||||
hcp->chmap_idx = HDMI_CODEC_CHMAP_IDX_UNKNOWN;
|
||||
hcp->hcd.ops->audio_shutdown(dai->dev->parent, hcp->hcd.data);
|
||||
|
@ -242,7 +242,7 @@ enum {
|
||||
|
||||
struct tx_mute_work {
|
||||
struct tx_macro *tx;
|
||||
u32 decimator;
|
||||
u8 decimator;
|
||||
struct delayed_work dwork;
|
||||
};
|
||||
|
||||
@ -635,7 +635,7 @@ exit:
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool is_amic_enabled(struct snd_soc_component *component, int decimator)
|
||||
static bool is_amic_enabled(struct snd_soc_component *component, u8 decimator)
|
||||
{
|
||||
u16 adc_mux_reg, adc_reg, adc_n;
|
||||
|
||||
@ -849,7 +849,7 @@ static int tx_macro_enable_dec(struct snd_soc_dapm_widget *w,
|
||||
struct snd_kcontrol *kcontrol, int event)
|
||||
{
|
||||
struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
|
||||
unsigned int decimator;
|
||||
u8 decimator;
|
||||
u16 tx_vol_ctl_reg, dec_cfg_reg, hpf_gate_reg, tx_gain_ctl_reg;
|
||||
u8 hpf_cut_off_freq;
|
||||
int hpf_delay = TX_MACRO_DMIC_HPF_DELAY_MS;
|
||||
@ -1064,7 +1064,8 @@ static int tx_macro_hw_params(struct snd_pcm_substream *substream,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_component *component = dai->component;
|
||||
u32 decimator, sample_rate;
|
||||
u32 sample_rate;
|
||||
u8 decimator;
|
||||
int tx_fs_rate;
|
||||
struct tx_macro *tx = snd_soc_component_get_drvdata(component);
|
||||
|
||||
@ -1128,7 +1129,7 @@ static int tx_macro_digital_mute(struct snd_soc_dai *dai, int mute, int stream)
|
||||
{
|
||||
struct snd_soc_component *component = dai->component;
|
||||
struct tx_macro *tx = snd_soc_component_get_drvdata(component);
|
||||
u16 decimator;
|
||||
u8 decimator;
|
||||
|
||||
/* active decimator not set yet */
|
||||
if (tx->active_decimator[dai->id] == -1)
|
||||
|
@ -294,6 +294,10 @@ config SND_SOC_IMX_SGTL5000
|
||||
Say Y if you want to add support for SoC audio on an i.MX board with
|
||||
a sgtl5000 codec.
|
||||
|
||||
Note that this is an old driver. Consider enabling
|
||||
SND_SOC_FSL_ASOC_CARD and SND_SOC_SGTL5000 to use the newer
|
||||
driver.
|
||||
|
||||
config SND_SOC_IMX_SPDIF
|
||||
tristate "SoC Audio support for i.MX boards with S/PDIF"
|
||||
select SND_SOC_IMX_PCM_DMA
|
||||
|
@ -117,6 +117,26 @@ static void avs_da7219_codec_exit(struct snd_soc_pcm_runtime *rtd)
|
||||
snd_soc_component_set_jack(asoc_rtd_to_codec(rtd, 0)->component, NULL, NULL);
|
||||
}
|
||||
|
||||
static int
|
||||
avs_da7219_be_fixup(struct snd_soc_pcm_runtime *runrime, struct snd_pcm_hw_params *params)
|
||||
{
|
||||
struct snd_interval *rate, *channels;
|
||||
struct snd_mask *fmt;
|
||||
|
||||
rate = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE);
|
||||
channels = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS);
|
||||
fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
|
||||
|
||||
/* The ADSP will convert the FE rate to 48k, stereo */
|
||||
rate->min = rate->max = 48000;
|
||||
channels->min = channels->max = 2;
|
||||
|
||||
/* set SSP0 to 24 bit */
|
||||
snd_mask_none(fmt);
|
||||
snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S24_LE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int avs_create_dai_link(struct device *dev, const char *platform_name, int ssp_port,
|
||||
struct snd_soc_dai_link **dai_link)
|
||||
{
|
||||
@ -148,6 +168,7 @@ static int avs_create_dai_link(struct device *dev, const char *platform_name, in
|
||||
dl->num_platforms = 1;
|
||||
dl->id = 0;
|
||||
dl->dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS;
|
||||
dl->be_hw_params_fixup = avs_da7219_be_fixup;
|
||||
dl->init = avs_da7219_codec_init;
|
||||
dl->exit = avs_da7219_codec_exit;
|
||||
dl->nonatomic = 1;
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <sound/pcm_params.h>
|
||||
#include <sound/soc.h>
|
||||
#include <sound/soc-acpi.h>
|
||||
#include <sound/soc-dapm.h>
|
||||
@ -24,6 +25,26 @@ static const struct snd_soc_dapm_route card_base_routes[] = {
|
||||
{ "Spk", NULL, "Speaker" },
|
||||
};
|
||||
|
||||
static int
|
||||
avs_max98357a_be_fixup(struct snd_soc_pcm_runtime *runrime, struct snd_pcm_hw_params *params)
|
||||
{
|
||||
struct snd_interval *rate, *channels;
|
||||
struct snd_mask *fmt;
|
||||
|
||||
rate = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE);
|
||||
channels = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS);
|
||||
fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
|
||||
|
||||
/* The ADSP will convert the FE rate to 48k, stereo */
|
||||
rate->min = rate->max = 48000;
|
||||
channels->min = channels->max = 2;
|
||||
|
||||
/* set SSP0 to 16 bit */
|
||||
snd_mask_none(fmt);
|
||||
snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S16_LE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int avs_create_dai_link(struct device *dev, const char *platform_name, int ssp_port,
|
||||
struct snd_soc_dai_link **dai_link)
|
||||
{
|
||||
@ -55,6 +76,7 @@ static int avs_create_dai_link(struct device *dev, const char *platform_name, in
|
||||
dl->num_platforms = 1;
|
||||
dl->id = 0;
|
||||
dl->dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS;
|
||||
dl->be_hw_params_fixup = avs_max98357a_be_fixup;
|
||||
dl->nonatomic = 1;
|
||||
dl->no_pcm = 1;
|
||||
dl->dpcm_playback = 1;
|
||||
|
@ -33,15 +33,15 @@ avs_nau8825_clock_control(struct snd_soc_dapm_widget *w, struct snd_kcontrol *co
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (!SND_SOC_DAPM_EVENT_ON(event)) {
|
||||
if (SND_SOC_DAPM_EVENT_ON(event))
|
||||
ret = snd_soc_dai_set_sysclk(codec_dai, NAU8825_CLK_MCLK, 24000000,
|
||||
SND_SOC_CLOCK_IN);
|
||||
else
|
||||
ret = snd_soc_dai_set_sysclk(codec_dai, NAU8825_CLK_INTERNAL, 0, SND_SOC_CLOCK_IN);
|
||||
if (ret < 0) {
|
||||
dev_err(card->dev, "set sysclk err = %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
if (ret < 0)
|
||||
dev_err(card->dev, "Set sysclk failed: %d\n", ret);
|
||||
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const struct snd_kcontrol_new card_controls[] = {
|
||||
|
@ -169,6 +169,27 @@ static const struct snd_soc_ops avs_rt5682_ops = {
|
||||
.hw_params = avs_rt5682_hw_params,
|
||||
};
|
||||
|
||||
static int
|
||||
avs_rt5682_be_fixup(struct snd_soc_pcm_runtime *runtime, struct snd_pcm_hw_params *params)
|
||||
{
|
||||
struct snd_interval *rate, *channels;
|
||||
struct snd_mask *fmt;
|
||||
|
||||
rate = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE);
|
||||
channels = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS);
|
||||
fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
|
||||
|
||||
/* The ADSP will convert the FE rate to 48k, stereo */
|
||||
rate->min = rate->max = 48000;
|
||||
channels->min = channels->max = 2;
|
||||
|
||||
/* set SSPN to 24 bit */
|
||||
snd_mask_none(fmt);
|
||||
snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S24_LE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int avs_create_dai_link(struct device *dev, const char *platform_name, int ssp_port,
|
||||
struct snd_soc_dai_link **dai_link)
|
||||
{
|
||||
@ -201,6 +222,7 @@ static int avs_create_dai_link(struct device *dev, const char *platform_name, in
|
||||
dl->id = 0;
|
||||
dl->init = avs_rt5682_codec_init;
|
||||
dl->exit = avs_rt5682_codec_exit;
|
||||
dl->be_hw_params_fixup = avs_rt5682_be_fixup;
|
||||
dl->ops = &avs_rt5682_ops;
|
||||
dl->nonatomic = 1;
|
||||
dl->no_pcm = 1;
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include <sound/soc-acpi.h>
|
||||
#include "../../../codecs/nau8825.h"
|
||||
|
||||
#define SKL_NUVOTON_CODEC_DAI "nau8825-hifi"
|
||||
#define SKL_SSM_CODEC_DAI "ssm4567-hifi"
|
||||
|
||||
static struct snd_soc_codec_conf card_codec_conf[] = {
|
||||
@ -34,41 +33,11 @@ static const struct snd_kcontrol_new card_controls[] = {
|
||||
SOC_DAPM_PIN_SWITCH("Right Speaker"),
|
||||
};
|
||||
|
||||
static int
|
||||
platform_clock_control(struct snd_soc_dapm_widget *w, struct snd_kcontrol *control, int event)
|
||||
{
|
||||
struct snd_soc_dapm_context *dapm = w->dapm;
|
||||
struct snd_soc_card *card = dapm->card;
|
||||
struct snd_soc_dai *codec_dai;
|
||||
int ret;
|
||||
|
||||
codec_dai = snd_soc_card_get_codec_dai(card, SKL_NUVOTON_CODEC_DAI);
|
||||
if (!codec_dai) {
|
||||
dev_err(card->dev, "Codec dai not found\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (SND_SOC_DAPM_EVENT_ON(event)) {
|
||||
ret = snd_soc_dai_set_sysclk(codec_dai, NAU8825_CLK_MCLK, 24000000,
|
||||
SND_SOC_CLOCK_IN);
|
||||
if (ret < 0)
|
||||
dev_err(card->dev, "set sysclk err = %d\n", ret);
|
||||
} else {
|
||||
ret = snd_soc_dai_set_sysclk(codec_dai, NAU8825_CLK_INTERNAL, 0, SND_SOC_CLOCK_IN);
|
||||
if (ret < 0)
|
||||
dev_err(card->dev, "set sysclk err = %d\n", ret);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const struct snd_soc_dapm_widget card_widgets[] = {
|
||||
SND_SOC_DAPM_SPK("Left Speaker", NULL),
|
||||
SND_SOC_DAPM_SPK("Right Speaker", NULL),
|
||||
SND_SOC_DAPM_SPK("DP1", NULL),
|
||||
SND_SOC_DAPM_SPK("DP2", NULL),
|
||||
SND_SOC_DAPM_SUPPLY("Platform Clock", SND_SOC_NOPM, 0, 0, platform_clock_control,
|
||||
SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
|
||||
};
|
||||
|
||||
static const struct snd_soc_dapm_route card_base_routes[] = {
|
||||
|
@ -559,7 +559,7 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_adl_machines[] = {
|
||||
{
|
||||
.comp_ids = &essx_83x6,
|
||||
.drv_name = "sof-essx8336",
|
||||
.sof_tplg_filename = "sof-adl-es83x6", /* the tplg suffix is added at run time */
|
||||
.sof_tplg_filename = "sof-adl-es8336", /* the tplg suffix is added at run time */
|
||||
.tplg_quirk_mask = SND_SOC_ACPI_TPLG_INTEL_SSP_NUMBER |
|
||||
SND_SOC_ACPI_TPLG_INTEL_SSP_MSB |
|
||||
SND_SOC_ACPI_TPLG_INTEL_DMIC_NUMBER,
|
||||
|
@ -184,9 +184,9 @@ int q6prm_set_lpass_clock(struct device *dev, int clk_id, int clk_attr, int clk_
|
||||
unsigned int freq)
|
||||
{
|
||||
if (freq)
|
||||
return q6prm_request_lpass_clock(dev, clk_id, clk_attr, clk_attr, freq);
|
||||
return q6prm_request_lpass_clock(dev, clk_id, clk_attr, clk_root, freq);
|
||||
|
||||
return q6prm_release_lpass_clock(dev, clk_id, clk_attr, clk_attr, freq);
|
||||
return q6prm_release_lpass_clock(dev, clk_id, clk_attr, clk_root, freq);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(q6prm_set_lpass_clock);
|
||||
|
||||
|
@ -196,12 +196,15 @@ int hda_dsp_ctrl_init_chip(struct snd_sof_dev *sdev)
|
||||
goto err;
|
||||
}
|
||||
|
||||
usleep_range(500, 1000);
|
||||
|
||||
/* exit HDA controller reset */
|
||||
ret = hda_dsp_ctrl_link_reset(sdev, false);
|
||||
if (ret < 0) {
|
||||
dev_err(sdev->dev, "error: failed to exit HDA controller reset\n");
|
||||
goto err;
|
||||
}
|
||||
usleep_range(1000, 1200);
|
||||
|
||||
hda_codec_detect_mask(sdev);
|
||||
|
||||
|
@ -392,6 +392,12 @@ static int hda_dsp_update_d0i3c_register(struct snd_sof_dev *sdev, u8 value)
|
||||
snd_sof_dsp_update8(sdev, HDA_DSP_HDA_BAR, chip->d0i3_offset,
|
||||
SOF_HDA_VS_D0I3C_I3, value);
|
||||
|
||||
/*
|
||||
* The value written to the D0I3C::I3 bit may not be taken into account immediately.
|
||||
* A delay is recommended before checking if D0I3C::CIP is cleared
|
||||
*/
|
||||
usleep_range(30, 40);
|
||||
|
||||
/* Wait for cmd in progress to be cleared before exiting the function */
|
||||
ret = hda_dsp_wait_d0i3c_done(sdev);
|
||||
if (ret < 0) {
|
||||
@ -400,6 +406,12 @@ static int hda_dsp_update_d0i3c_register(struct snd_sof_dev *sdev, u8 value)
|
||||
}
|
||||
|
||||
reg = snd_sof_dsp_read8(sdev, HDA_DSP_HDA_BAR, chip->d0i3_offset);
|
||||
/* Confirm d0i3 state changed with paranoia check */
|
||||
if ((reg ^ value) & SOF_HDA_VS_D0I3C_I3) {
|
||||
dev_err(sdev->dev, "failed to update D0I3C!\n");
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
trace_sof_intel_D0I3C_updated(sdev, reg);
|
||||
|
||||
return 0;
|
||||
|
@ -78,6 +78,7 @@ static const struct sof_dev_desc glk_desc = {
|
||||
.nocodec_tplg_filename = "sof-glk-nocodec.tplg",
|
||||
.ops = &sof_apl_ops,
|
||||
.ops_init = sof_apl_ops_init,
|
||||
.ops_free = hda_ops_free,
|
||||
};
|
||||
|
||||
/* PCI IDs */
|
||||
|
@ -48,6 +48,7 @@ static const struct sof_dev_desc cnl_desc = {
|
||||
.nocodec_tplg_filename = "sof-cnl-nocodec.tplg",
|
||||
.ops = &sof_cnl_ops,
|
||||
.ops_init = sof_cnl_ops_init,
|
||||
.ops_free = hda_ops_free,
|
||||
};
|
||||
|
||||
static const struct sof_dev_desc cfl_desc = {
|
||||
@ -111,6 +112,7 @@ static const struct sof_dev_desc cml_desc = {
|
||||
.nocodec_tplg_filename = "sof-cnl-nocodec.tplg",
|
||||
.ops = &sof_cnl_ops,
|
||||
.ops_init = sof_cnl_ops_init,
|
||||
.ops_free = hda_ops_free,
|
||||
};
|
||||
|
||||
/* PCI IDs */
|
||||
|
@ -79,6 +79,7 @@ static const struct sof_dev_desc jsl_desc = {
|
||||
.nocodec_tplg_filename = "sof-jsl-nocodec.tplg",
|
||||
.ops = &sof_cnl_ops,
|
||||
.ops_init = sof_cnl_ops_init,
|
||||
.ops_free = hda_ops_free,
|
||||
};
|
||||
|
||||
/* PCI IDs */
|
||||
|
@ -46,6 +46,7 @@ static const struct sof_dev_desc mtl_desc = {
|
||||
.nocodec_tplg_filename = "sof-mtl-nocodec.tplg",
|
||||
.ops = &sof_mtl_ops,
|
||||
.ops_init = sof_mtl_ops_init,
|
||||
.ops_free = hda_ops_free,
|
||||
};
|
||||
|
||||
/* PCI IDs */
|
||||
|
@ -38,6 +38,7 @@ static struct sof_dev_desc skl_desc = {
|
||||
.nocodec_tplg_filename = "sof-skl-nocodec.tplg",
|
||||
.ops = &sof_skl_ops,
|
||||
.ops_init = sof_skl_ops_init,
|
||||
.ops_free = hda_ops_free,
|
||||
};
|
||||
|
||||
static struct sof_dev_desc kbl_desc = {
|
||||
@ -61,6 +62,7 @@ static struct sof_dev_desc kbl_desc = {
|
||||
.nocodec_tplg_filename = "sof-kbl-nocodec.tplg",
|
||||
.ops = &sof_skl_ops,
|
||||
.ops_init = sof_skl_ops_init,
|
||||
.ops_free = hda_ops_free,
|
||||
};
|
||||
|
||||
/* PCI IDs */
|
||||
|
@ -48,6 +48,7 @@ static const struct sof_dev_desc tgl_desc = {
|
||||
.nocodec_tplg_filename = "sof-tgl-nocodec.tplg",
|
||||
.ops = &sof_tgl_ops,
|
||||
.ops_init = sof_tgl_ops_init,
|
||||
.ops_free = hda_ops_free,
|
||||
};
|
||||
|
||||
static const struct sof_dev_desc tglh_desc = {
|
||||
@ -110,6 +111,7 @@ static const struct sof_dev_desc ehl_desc = {
|
||||
.nocodec_tplg_filename = "sof-ehl-nocodec.tplg",
|
||||
.ops = &sof_tgl_ops,
|
||||
.ops_init = sof_tgl_ops_init,
|
||||
.ops_free = hda_ops_free,
|
||||
};
|
||||
|
||||
static const struct sof_dev_desc adls_desc = {
|
||||
@ -141,6 +143,7 @@ static const struct sof_dev_desc adls_desc = {
|
||||
.nocodec_tplg_filename = "sof-adl-nocodec.tplg",
|
||||
.ops = &sof_tgl_ops,
|
||||
.ops_init = sof_tgl_ops_init,
|
||||
.ops_free = hda_ops_free,
|
||||
};
|
||||
|
||||
static const struct sof_dev_desc adl_desc = {
|
||||
@ -172,6 +175,7 @@ static const struct sof_dev_desc adl_desc = {
|
||||
.nocodec_tplg_filename = "sof-adl-nocodec.tplg",
|
||||
.ops = &sof_tgl_ops,
|
||||
.ops_init = sof_tgl_ops_init,
|
||||
.ops_free = hda_ops_free,
|
||||
};
|
||||
|
||||
static const struct sof_dev_desc adl_n_desc = {
|
||||
@ -203,6 +207,7 @@ static const struct sof_dev_desc adl_n_desc = {
|
||||
.nocodec_tplg_filename = "sof-adl-nocodec.tplg",
|
||||
.ops = &sof_tgl_ops,
|
||||
.ops_init = sof_tgl_ops_init,
|
||||
.ops_free = hda_ops_free,
|
||||
};
|
||||
|
||||
static const struct sof_dev_desc rpls_desc = {
|
||||
@ -234,6 +239,7 @@ static const struct sof_dev_desc rpls_desc = {
|
||||
.nocodec_tplg_filename = "sof-rpl-nocodec.tplg",
|
||||
.ops = &sof_tgl_ops,
|
||||
.ops_init = sof_tgl_ops_init,
|
||||
.ops_free = hda_ops_free,
|
||||
};
|
||||
|
||||
static const struct sof_dev_desc rpl_desc = {
|
||||
@ -265,6 +271,7 @@ static const struct sof_dev_desc rpl_desc = {
|
||||
.nocodec_tplg_filename = "sof-rpl-nocodec.tplg",
|
||||
.ops = &sof_tgl_ops,
|
||||
.ops_init = sof_tgl_ops_init,
|
||||
.ops_free = hda_ops_free,
|
||||
};
|
||||
|
||||
/* PCI IDs */
|
||||
|
@ -75,11 +75,7 @@ static int tangier_pci_probe(struct snd_sof_dev *sdev)
|
||||
|
||||
/* LPE base */
|
||||
base = pci_resource_start(pci, desc->resindex_lpe_base) - IRAM_OFFSET;
|
||||
size = pci_resource_len(pci, desc->resindex_lpe_base);
|
||||
if (size < PCI_BAR_SIZE) {
|
||||
dev_err(sdev->dev, "error: I/O region is too small.\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
size = PCI_BAR_SIZE;
|
||||
|
||||
dev_dbg(sdev->dev, "LPE PHY base at 0x%x size 0x%x", base, size);
|
||||
sdev->bar[DSP_BAR] = devm_ioremap(sdev->dev, base, size);
|
||||
|
@ -2081,7 +2081,9 @@ static int sof_ipc3_dai_config(struct snd_sof_dev *sdev, struct snd_sof_widget *
|
||||
break;
|
||||
case SOF_DAI_INTEL_ALH:
|
||||
if (data) {
|
||||
config->dai_index = data->dai_index;
|
||||
/* save the dai_index during hw_params and reuse it for hw_free */
|
||||
if (flags & SOF_DAI_CONFIG_FLAGS_HW_PARAMS)
|
||||
config->dai_index = data->dai_index;
|
||||
config->alh.stream_id = data->dai_data;
|
||||
}
|
||||
break;
|
||||
@ -2089,7 +2091,30 @@ static int sof_ipc3_dai_config(struct snd_sof_dev *sdev, struct snd_sof_widget *
|
||||
break;
|
||||
}
|
||||
|
||||
config->flags = flags;
|
||||
/*
|
||||
* The dai_config op is invoked several times and the flags argument varies as below:
|
||||
* BE DAI hw_params: When the op is invoked during the BE DAI hw_params, flags contains
|
||||
* SOF_DAI_CONFIG_FLAGS_HW_PARAMS along with quirks
|
||||
* FE DAI hw_params: When invoked during FE DAI hw_params after the DAI widget has
|
||||
* just been set up in the DSP, flags is set to SOF_DAI_CONFIG_FLAGS_HW_PARAMS with no
|
||||
* quirks
|
||||
* BE DAI trigger: When invoked during the BE DAI trigger, flags is set to
|
||||
* SOF_DAI_CONFIG_FLAGS_PAUSE and contains no quirks
|
||||
* BE DAI hw_free: When invoked during the BE DAI hw_free, flags is set to
|
||||
* SOF_DAI_CONFIG_FLAGS_HW_FREE and contains no quirks
|
||||
* FE DAI hw_free: When invoked during the FE DAI hw_free, flags is set to
|
||||
* SOF_DAI_CONFIG_FLAGS_HW_FREE and contains no quirks
|
||||
*
|
||||
* The DAI_CONFIG IPC is sent to the DSP, only after the widget is set up during the FE
|
||||
* DAI hw_params. But since the BE DAI hw_params precedes the FE DAI hw_params, the quirks
|
||||
* need to be preserved when assigning the flags before sending the IPC.
|
||||
* For the case of PAUSE/HW_FREE, since there are no quirks, flags can be used as is.
|
||||
*/
|
||||
|
||||
if (flags & SOF_DAI_CONFIG_FLAGS_HW_PARAMS)
|
||||
config->flags |= flags;
|
||||
else
|
||||
config->flags = flags;
|
||||
|
||||
/* only send the IPC if the widget is set up in the DSP */
|
||||
if (swidget->use_count > 0) {
|
||||
@ -2097,6 +2122,9 @@ static int sof_ipc3_dai_config(struct snd_sof_dev *sdev, struct snd_sof_widget *
|
||||
&reply, sizeof(reply));
|
||||
if (ret < 0)
|
||||
dev_err(sdev->dev, "Failed to set dai config for %s\n", dai->name);
|
||||
|
||||
/* clear the flags once the IPC has been sent even if it fails */
|
||||
config->flags = SOF_DAI_CONFIG_FLAGS_NONE;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -970,8 +970,9 @@ static void sof_ipc3_rx_msg(struct snd_sof_dev *sdev)
|
||||
return;
|
||||
}
|
||||
|
||||
if (hdr.size < sizeof(hdr)) {
|
||||
dev_err(sdev->dev, "The received message size is invalid\n");
|
||||
if (hdr.size < sizeof(hdr) || hdr.size > SOF_IPC_MSG_MAX_SIZE) {
|
||||
dev_err(sdev->dev, "The received message size is invalid: %u\n",
|
||||
hdr.size);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,8 @@ sof_ipc4_set_volume_data(struct snd_sof_dev *sdev, struct snd_sof_widget *swidge
|
||||
}
|
||||
|
||||
/* set curve type and duration from topology */
|
||||
data.curve_duration = gain->data.curve_duration;
|
||||
data.curve_duration_l = gain->data.curve_duration_l;
|
||||
data.curve_duration_h = gain->data.curve_duration_h;
|
||||
data.curve_type = gain->data.curve_type;
|
||||
|
||||
msg->data_ptr = &data;
|
||||
|
@ -107,7 +107,7 @@ static const struct sof_topology_token gain_tokens[] = {
|
||||
get_token_u32, offsetof(struct sof_ipc4_gain_data, curve_type)},
|
||||
{SOF_TKN_GAIN_RAMP_DURATION,
|
||||
SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32,
|
||||
offsetof(struct sof_ipc4_gain_data, curve_duration)},
|
||||
offsetof(struct sof_ipc4_gain_data, curve_duration_l)},
|
||||
{SOF_TKN_GAIN_VAL, SND_SOC_TPLG_TUPLE_TYPE_WORD,
|
||||
get_token_u32, offsetof(struct sof_ipc4_gain_data, init_val)},
|
||||
};
|
||||
@ -155,7 +155,7 @@ static void sof_ipc4_dbg_audio_format(struct device *dev,
|
||||
for (i = 0; i < num_format; i++, ptr = (u8 *)ptr + object_size) {
|
||||
fmt = ptr;
|
||||
dev_dbg(dev,
|
||||
" #%d: %uKHz, %ubit (ch_map %#x ch_cfg %u interleaving_style %u fmt_cfg %#x)\n",
|
||||
" #%d: %uHz, %ubit (ch_map %#x ch_cfg %u interleaving_style %u fmt_cfg %#x)\n",
|
||||
i, fmt->sampling_frequency, fmt->bit_depth, fmt->ch_map,
|
||||
fmt->ch_cfg, fmt->interleaving_style, fmt->fmt_cfg);
|
||||
}
|
||||
@ -692,7 +692,7 @@ static int sof_ipc4_widget_setup_comp_pga(struct snd_sof_widget *swidget)
|
||||
|
||||
dev_dbg(scomp->dev,
|
||||
"pga widget %s: ramp type: %d, ramp duration %d, initial gain value: %#x, cpc %d\n",
|
||||
swidget->widget->name, gain->data.curve_type, gain->data.curve_duration,
|
||||
swidget->widget->name, gain->data.curve_type, gain->data.curve_duration_l,
|
||||
gain->data.init_val, gain->base_config.cpc);
|
||||
|
||||
ret = sof_ipc4_widget_setup_msg(swidget, &gain->msg);
|
||||
@ -980,6 +980,7 @@ static void sof_ipc4_unprepare_copier_module(struct snd_sof_widget *swidget)
|
||||
|
||||
ipc4_copier = dai->private;
|
||||
if (ipc4_copier->dai_type == SOF_DAI_INTEL_ALH) {
|
||||
struct sof_ipc4_copier_data *copier_data = &ipc4_copier->data;
|
||||
struct sof_ipc4_alh_configuration_blob *blob;
|
||||
unsigned int group_id;
|
||||
|
||||
@ -989,6 +990,9 @@ static void sof_ipc4_unprepare_copier_module(struct snd_sof_widget *swidget)
|
||||
ALH_MULTI_GTW_BASE;
|
||||
ida_free(&alh_group_ida, group_id);
|
||||
}
|
||||
|
||||
/* clear the node ID */
|
||||
copier_data->gtw_cfg.node_id &= ~SOF_IPC4_NODE_INDEX_MASK;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1940,8 +1944,15 @@ static int sof_ipc4_dai_config(struct snd_sof_dev *sdev, struct snd_sof_widget *
|
||||
pipeline->skip_during_fe_trigger = true;
|
||||
fallthrough;
|
||||
case SOF_DAI_INTEL_ALH:
|
||||
copier_data->gtw_cfg.node_id &= ~SOF_IPC4_NODE_INDEX_MASK;
|
||||
copier_data->gtw_cfg.node_id |= SOF_IPC4_NODE_INDEX(data->dai_data);
|
||||
/*
|
||||
* Do not clear the node ID when this op is invoked with
|
||||
* SOF_DAI_CONFIG_FLAGS_HW_FREE. It is needed to free the group_ida during
|
||||
* unprepare.
|
||||
*/
|
||||
if (flags & SOF_DAI_CONFIG_FLAGS_HW_PARAMS) {
|
||||
copier_data->gtw_cfg.node_id &= ~SOF_IPC4_NODE_INDEX_MASK;
|
||||
copier_data->gtw_cfg.node_id |= SOF_IPC4_NODE_INDEX(data->dai_data);
|
||||
}
|
||||
break;
|
||||
case SOF_DAI_INTEL_DMIC:
|
||||
case SOF_DAI_INTEL_SSP:
|
||||
|
@ -46,7 +46,7 @@
|
||||
#define SOF_IPC4_NODE_INDEX_INTEL_SSP(x) (((x) & 0xf) << 4)
|
||||
|
||||
/* Node ID for DMIC type DAI copiers */
|
||||
#define SOF_IPC4_NODE_INDEX_INTEL_DMIC(x) (((x) & 0x7) << 5)
|
||||
#define SOF_IPC4_NODE_INDEX_INTEL_DMIC(x) ((x) & 0x7)
|
||||
|
||||
#define SOF_IPC4_GAIN_ALL_CHANNELS_MASK 0xffffffff
|
||||
#define SOF_IPC4_VOL_ZERO_DB 0x7fffffff
|
||||
@ -277,14 +277,16 @@ struct sof_ipc4_control_data {
|
||||
* @init_val: Initial value
|
||||
* @curve_type: Curve type
|
||||
* @reserved: reserved for future use
|
||||
* @curve_duration: Curve duration
|
||||
* @curve_duration_l: Curve duration low part
|
||||
* @curve_duration_h: Curve duration high part
|
||||
*/
|
||||
struct sof_ipc4_gain_data {
|
||||
uint32_t channels;
|
||||
uint32_t init_val;
|
||||
uint32_t curve_type;
|
||||
uint32_t reserved;
|
||||
uint32_t curve_duration;
|
||||
uint32_t curve_duration_l;
|
||||
uint32_t curve_duration_h;
|
||||
} __aligned(8);
|
||||
|
||||
/**
|
||||
|
@ -50,9 +50,27 @@ static int sof_widget_free_unlocked(struct snd_sof_dev *sdev,
|
||||
/* reset route setup status for all routes that contain this widget */
|
||||
sof_reset_route_setup_status(sdev, swidget);
|
||||
|
||||
/* free DAI config and continue to free widget even if it fails */
|
||||
if (WIDGET_IS_DAI(swidget->id)) {
|
||||
struct snd_sof_dai_config_data data;
|
||||
unsigned int flags = SOF_DAI_CONFIG_FLAGS_HW_FREE;
|
||||
|
||||
data.dai_data = DMA_CHAN_INVALID;
|
||||
|
||||
if (tplg_ops && tplg_ops->dai_config) {
|
||||
err = tplg_ops->dai_config(sdev, swidget, flags, &data);
|
||||
if (err < 0)
|
||||
dev_err(sdev->dev, "failed to free config for widget %s\n",
|
||||
swidget->widget->name);
|
||||
}
|
||||
}
|
||||
|
||||
/* continue to disable core even if IPC fails */
|
||||
if (tplg_ops && tplg_ops->widget_free)
|
||||
err = tplg_ops->widget_free(sdev, swidget);
|
||||
if (tplg_ops && tplg_ops->widget_free) {
|
||||
ret = tplg_ops->widget_free(sdev, swidget);
|
||||
if (ret < 0 && !err)
|
||||
err = ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* disable widget core. continue to route setup status and complete flag
|
||||
@ -151,8 +169,12 @@ static int sof_widget_setup_unlocked(struct snd_sof_dev *sdev,
|
||||
|
||||
/* send config for DAI components */
|
||||
if (WIDGET_IS_DAI(swidget->id)) {
|
||||
unsigned int flags = SOF_DAI_CONFIG_FLAGS_NONE;
|
||||
unsigned int flags = SOF_DAI_CONFIG_FLAGS_HW_PARAMS;
|
||||
|
||||
/*
|
||||
* The config flags saved during BE DAI hw_params will be used for IPC3. IPC4 does
|
||||
* not use the flags argument.
|
||||
*/
|
||||
if (tplg_ops && tplg_ops->dai_config) {
|
||||
ret = tplg_ops->dai_config(sdev, swidget, flags, NULL);
|
||||
if (ret < 0)
|
||||
@ -588,8 +610,8 @@ int sof_widget_list_setup(struct snd_sof_dev *sdev, struct snd_sof_pcm *spcm,
|
||||
ret = sof_walk_widgets_in_order(sdev, spcm, fe_params, platform_params,
|
||||
dir, SOF_WIDGET_SETUP);
|
||||
if (ret < 0) {
|
||||
ret = sof_walk_widgets_in_order(sdev, spcm, fe_params, platform_params,
|
||||
dir, SOF_WIDGET_UNPREPARE);
|
||||
sof_walk_widgets_in_order(sdev, spcm, fe_params, platform_params,
|
||||
dir, SOF_WIDGET_UNPREPARE);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -1388,14 +1388,15 @@ static int sof_widget_ready(struct snd_soc_component *scomp, int index,
|
||||
if (ret < 0) {
|
||||
dev_err(scomp->dev, "failed to parse component pin tokens for %s\n",
|
||||
w->name);
|
||||
return ret;
|
||||
goto widget_free;
|
||||
}
|
||||
|
||||
if (swidget->num_sink_pins > SOF_WIDGET_MAX_NUM_PINS ||
|
||||
swidget->num_source_pins > SOF_WIDGET_MAX_NUM_PINS) {
|
||||
dev_err(scomp->dev, "invalid pins for %s: [sink: %d, src: %d]\n",
|
||||
swidget->widget->name, swidget->num_sink_pins, swidget->num_source_pins);
|
||||
return -EINVAL;
|
||||
ret = -EINVAL;
|
||||
goto widget_free;
|
||||
}
|
||||
|
||||
if (swidget->num_sink_pins > 1) {
|
||||
@ -1404,7 +1405,7 @@ static int sof_widget_ready(struct snd_soc_component *scomp, int index,
|
||||
if (ret < 0) {
|
||||
dev_err(scomp->dev, "failed to parse sink pin binding for %s\n",
|
||||
w->name);
|
||||
return ret;
|
||||
goto widget_free;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1414,7 +1415,7 @@ static int sof_widget_ready(struct snd_soc_component *scomp, int index,
|
||||
if (ret < 0) {
|
||||
dev_err(scomp->dev, "failed to parse source pin binding for %s\n",
|
||||
w->name);
|
||||
return ret;
|
||||
goto widget_free;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1436,9 +1437,8 @@ static int sof_widget_ready(struct snd_soc_component *scomp, int index,
|
||||
case snd_soc_dapm_dai_out:
|
||||
dai = kzalloc(sizeof(*dai), GFP_KERNEL);
|
||||
if (!dai) {
|
||||
kfree(swidget);
|
||||
return -ENOMEM;
|
||||
|
||||
ret = -ENOMEM;
|
||||
goto widget_free;
|
||||
}
|
||||
|
||||
ret = sof_widget_parse_tokens(scomp, swidget, tw, token_list, token_list_size);
|
||||
@ -1496,8 +1496,7 @@ static int sof_widget_ready(struct snd_soc_component *scomp, int index,
|
||||
tw->shift, swidget->id, tw->name,
|
||||
strnlen(tw->sname, SNDRV_CTL_ELEM_ID_NAME_MAXLEN) > 0
|
||||
? tw->sname : "none");
|
||||
kfree(swidget);
|
||||
return ret;
|
||||
goto widget_free;
|
||||
}
|
||||
|
||||
if (sof_debug_check_flag(SOF_DBG_DISABLE_MULTICORE)) {
|
||||
@ -1518,10 +1517,7 @@ static int sof_widget_ready(struct snd_soc_component *scomp, int index,
|
||||
if (ret) {
|
||||
dev_err(scomp->dev, "widget event binding failed for %s\n",
|
||||
swidget->widget->name);
|
||||
kfree(swidget->private);
|
||||
kfree(swidget->tuples);
|
||||
kfree(swidget);
|
||||
return ret;
|
||||
goto free;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1532,10 +1528,8 @@ static int sof_widget_ready(struct snd_soc_component *scomp, int index,
|
||||
|
||||
spipe = kzalloc(sizeof(*spipe), GFP_KERNEL);
|
||||
if (!spipe) {
|
||||
kfree(swidget->private);
|
||||
kfree(swidget->tuples);
|
||||
kfree(swidget);
|
||||
return -ENOMEM;
|
||||
ret = -ENOMEM;
|
||||
goto free;
|
||||
}
|
||||
|
||||
spipe->pipe_widget = swidget;
|
||||
@ -1546,6 +1540,12 @@ static int sof_widget_ready(struct snd_soc_component *scomp, int index,
|
||||
w->dobj.private = swidget;
|
||||
list_add(&swidget->list, &sdev->widget_list);
|
||||
return ret;
|
||||
free:
|
||||
kfree(swidget->private);
|
||||
kfree(swidget->tuples);
|
||||
widget_free:
|
||||
kfree(swidget);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int sof_route_unload(struct snd_soc_component *scomp,
|
||||
|
Loading…
Reference in New Issue
Block a user