summaryrefslogtreecommitdiff
path: root/sound/soc/intel
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/intel')
-rw-r--r--sound/soc/intel/atom/sst-atom-controls.c15
-rw-r--r--sound/soc/intel/atom/sst/sst_acpi.c3
-rw-r--r--sound/soc/intel/avs/boards/da7219.c3
-rw-r--r--sound/soc/intel/avs/boards/es8336.c5
-rw-r--r--sound/soc/intel/avs/boards/nau8825.c3
-rw-r--r--sound/soc/intel/avs/boards/rt274.c6
-rw-r--r--sound/soc/intel/avs/boards/rt5514.c3
-rw-r--r--sound/soc/intel/avs/boards/rt5640.c3
-rw-r--r--sound/soc/intel/avs/control.c7
-rw-r--r--sound/soc/intel/avs/debugfs.c9
-rw-r--r--sound/soc/intel/avs/path.c13
-rw-r--r--sound/soc/intel/avs/pcm.c5
-rw-r--r--sound/soc/intel/avs/probes.c18
-rw-r--r--sound/soc/intel/avs/topology.c113
-rw-r--r--sound/soc/intel/avs/topology.h8
-rw-r--r--sound/soc/intel/boards/bdw-rt5677.c9
-rw-r--r--sound/soc/intel/boards/bytcht_cx2072x.c3
-rw-r--r--sound/soc/intel/boards/bytcht_es8316.c9
-rw-r--r--sound/soc/intel/boards/bytcr_rt5640.c25
-rw-r--r--sound/soc/intel/boards/bytcr_rt5651.c18
-rw-r--r--sound/soc/intel/boards/bytcr_wm5102.c14
-rw-r--r--sound/soc/intel/boards/cht_bsw_max98090_ti.c5
-rw-r--r--sound/soc/intel/boards/cht_bsw_rt5645.c12
-rw-r--r--sound/soc/intel/boards/cht_bsw_rt5672.c8
-rw-r--r--sound/soc/intel/boards/hda_dsp_common.c15
-rw-r--r--sound/soc/intel/boards/sof_board_helpers.c10
-rw-r--r--sound/soc/intel/boards/sof_cirrus_common.c5
-rw-r--r--sound/soc/intel/boards/sof_da7219.c5
-rw-r--r--sound/soc/intel/boards/sof_es8336.c14
-rw-r--r--sound/soc/intel/boards/sof_maxim_common.c22
-rw-r--r--sound/soc/intel/boards/sof_nau8825.c2
-rw-r--r--sound/soc/intel/boards/sof_nuvoton_common.c5
-rw-r--r--sound/soc/intel/boards/sof_pcm512x.c5
-rw-r--r--sound/soc/intel/boards/sof_realtek_common.c34
-rw-r--r--sound/soc/intel/boards/sof_rt5682.c17
-rw-r--r--sound/soc/intel/boards/sof_sdw.c80
-rw-r--r--sound/soc/intel/catpt/device.c26
-rw-r--r--sound/soc/intel/catpt/loader.c18
-rw-r--r--sound/soc/intel/catpt/pcm.c31
-rw-r--r--sound/soc/intel/catpt/sysfs.c2
-rw-r--r--sound/soc/intel/common/Makefile1
-rw-r--r--sound/soc/intel/common/soc-acpi-intel-nvl-match.c90
-rw-r--r--sound/soc/intel/common/soc-acpi-intel-ptl-match.c131
-rw-r--r--sound/soc/intel/common/sof-function-topology-lib.c8
44 files changed, 588 insertions, 250 deletions
diff --git a/sound/soc/intel/atom/sst-atom-controls.c b/sound/soc/intel/atom/sst-atom-controls.c
index 38116c758717..3629ceaaac17 100644
--- a/sound/soc/intel/atom/sst-atom-controls.c
+++ b/sound/soc/intel/atom/sst-atom-controls.c
@@ -142,7 +142,7 @@ static int sst_slot_enum_info(struct snd_kcontrol *kcontrol,
if (uinfo->value.enumerated.item > e->max - 1)
uinfo->value.enumerated.item = e->max - 1;
- strcpy(uinfo->value.enumerated.name,
+ strscpy(uinfo->value.enumerated.name,
e->texts[uinfo->value.enumerated.item]);
return 0;
@@ -218,7 +218,7 @@ static int sst_check_and_send_slot_map(struct sst_data *drv, struct snd_kcontrol
static int sst_slot_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_component *c = snd_soc_kcontrol_component(kcontrol);
+ struct snd_soc_component *c = snd_kcontrol_chip(kcontrol);
struct sst_data *drv = snd_soc_component_get_drvdata(c);
struct sst_enum *e = (void *)kcontrol->private_value;
int i, ret = 0;
@@ -349,7 +349,7 @@ static int sst_algo_control_set(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
int ret = 0;
- struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
+ struct snd_soc_component *cmpnt = snd_kcontrol_chip(kcontrol);
struct sst_data *drv = snd_soc_component_get_drvdata(cmpnt);
struct sst_algo_control *bc = (void *)kcontrol->private_value;
@@ -470,7 +470,7 @@ static int sst_gain_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
int ret = 0;
- struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
+ struct snd_soc_component *cmpnt = snd_kcontrol_chip(kcontrol);
struct sst_data *drv = snd_soc_component_get_drvdata(cmpnt);
struct sst_gain_mixer_control *mc = (void *)kcontrol->private_value;
struct sst_gain_value *gv = mc->gain_val;
@@ -637,7 +637,7 @@ static int sst_swm_mixer_event(struct snd_soc_dapm_widget *w,
* inputs as an IPC to the DSP.
*/
for (i = 0; i < w->num_kcontrols; i++) {
- if (dapm_kcontrol_get_value(w->kcontrols[i])) {
+ if (snd_soc_dapm_kcontrol_get_value(w->kcontrols[i])) {
mc = (struct soc_mixer_control *)(w->kcontrols[i])->private_value;
val |= 1 << mc->shift;
}
@@ -1530,8 +1530,7 @@ static int sst_map_modules_to_pipe(struct snd_soc_component *component)
int sst_dsp_init_v2_dpcm(struct snd_soc_component *component)
{
int i, ret = 0;
- struct snd_soc_dapm_context *dapm =
- snd_soc_component_get_dapm(component);
+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
struct sst_data *drv = snd_soc_component_get_drvdata(component);
unsigned int gains = ARRAY_SIZE(sst_gain_controls)/3;
@@ -1544,7 +1543,7 @@ int sst_dsp_init_v2_dpcm(struct snd_soc_component *component)
ARRAY_SIZE(sst_dapm_widgets));
snd_soc_dapm_add_routes(dapm, intercon,
ARRAY_SIZE(intercon));
- snd_soc_dapm_new_widgets(dapm->card);
+ snd_soc_dapm_new_widgets(component->card);
for (i = 0; i < gains; i++) {
sst_gains[i].mute = SST_GAIN_MUTE_DEFAULT;
diff --git a/sound/soc/intel/atom/sst/sst_acpi.c b/sound/soc/intel/atom/sst/sst_acpi.c
index 257180630475..73624e1b138a 100644
--- a/sound/soc/intel/atom/sst/sst_acpi.c
+++ b/sound/soc/intel/atom/sst/sst_acpi.c
@@ -12,6 +12,7 @@
#include <linux/fs.h>
#include <linux/interrupt.h>
#include <linux/slab.h>
+#include <linux/string.h>
#include <linux/io.h>
#include <linux/platform_device.h>
#include <linux/firmware.h>
@@ -356,7 +357,7 @@ static int sst_acpi_probe(struct platform_device *pdev)
/* Fill sst platform data */
ctx->pdata = pdata;
- strcpy(ctx->firmware_name, mach->fw_filename);
+ strscpy(ctx->firmware_name, mach->fw_filename);
ret = sst_platform_get_resources(ctx);
if (ret)
diff --git a/sound/soc/intel/avs/boards/da7219.c b/sound/soc/intel/avs/boards/da7219.c
index 6782dc7efae3..2b17abcbd2bc 100644
--- a/sound/soc/intel/avs/boards/da7219.c
+++ b/sound/soc/intel/avs/boards/da7219.c
@@ -29,8 +29,7 @@ static const struct snd_kcontrol_new card_controls[] = {
static int platform_clock_control(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *k, int event)
{
- struct snd_soc_dapm_context *dapm = w->dapm;
- struct snd_soc_card *card = dapm->card;
+ struct snd_soc_card *card = snd_soc_dapm_to_card(w->dapm);
struct snd_soc_dai *codec_dai;
int ret = 0;
diff --git a/sound/soc/intel/avs/boards/es8336.c b/sound/soc/intel/avs/boards/es8336.c
index eb2b40894e3f..301cfb3cf15b 100644
--- a/sound/soc/intel/avs/boards/es8336.c
+++ b/sound/soc/intel/avs/boards/es8336.c
@@ -38,7 +38,7 @@ static const struct acpi_gpio_mapping speaker_gpios[] = {
static int avs_es8336_speaker_power_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_card *card = w->dapm->card;
+ struct snd_soc_card *card = snd_soc_dapm_to_card(w->dapm);
struct avs_card_drvdata *data;
bool speaker_en;
@@ -101,6 +101,7 @@ static int avs_es8336_codec_init(struct snd_soc_pcm_runtime *runtime)
struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(runtime, 0);
struct snd_soc_component *component = codec_dai->component;
struct snd_soc_card *card = runtime->card;
+ struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card);
struct snd_soc_jack_pin *pins;
struct avs_card_drvdata *data;
struct gpio_desc *gpiod;
@@ -132,7 +133,7 @@ static int avs_es8336_codec_init(struct snd_soc_pcm_runtime *runtime)
snd_jack_set_key(data->jack.jack, SND_JACK_BTN_0, KEY_PLAYPAUSE);
snd_soc_component_set_jack(component, &data->jack, NULL);
- card->dapm.idle_bias = false;
+ snd_soc_dapm_set_idle_bias(dapm, false);
return 0;
}
diff --git a/sound/soc/intel/avs/boards/nau8825.c b/sound/soc/intel/avs/boards/nau8825.c
index 9ca400a6412e..d44edacbfc9a 100644
--- a/sound/soc/intel/avs/boards/nau8825.c
+++ b/sound/soc/intel/avs/boards/nau8825.c
@@ -23,8 +23,7 @@
static int
avs_nau8825_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_card *card = snd_soc_dapm_to_card(w->dapm);
struct snd_soc_dai *codec_dai;
int ret;
diff --git a/sound/soc/intel/avs/boards/rt274.c b/sound/soc/intel/avs/boards/rt274.c
index 4055ecc60838..a689f4c80867 100644
--- a/sound/soc/intel/avs/boards/rt274.c
+++ b/sound/soc/intel/avs/boards/rt274.c
@@ -27,8 +27,7 @@ static const struct snd_kcontrol_new card_controls[] = {
static int
avs_rt274_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_card *card = snd_soc_dapm_to_card(w->dapm);
struct snd_soc_dai *codec_dai;
int ret;
@@ -93,6 +92,7 @@ static int avs_rt274_codec_init(struct snd_soc_pcm_runtime *runtime)
struct snd_soc_jack_pin *pins;
struct snd_soc_jack *jack;
struct snd_soc_card *card = runtime->card;
+ struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card);
int num_pins, ret;
jack = snd_soc_card_get_drvdata(card);
@@ -117,7 +117,7 @@ static int avs_rt274_codec_init(struct snd_soc_pcm_runtime *runtime)
return ret;
}
- card->dapm.idle_bias = false;
+ snd_soc_dapm_set_idle_bias(dapm, false);
return 0;
}
diff --git a/sound/soc/intel/avs/boards/rt5514.c b/sound/soc/intel/avs/boards/rt5514.c
index 00b99e36d23c..22139eaad83a 100644
--- a/sound/soc/intel/avs/boards/rt5514.c
+++ b/sound/soc/intel/avs/boards/rt5514.c
@@ -33,7 +33,8 @@ static const struct snd_soc_dapm_route card_base_routes[] = {
static int avs_rt5514_codec_init(struct snd_soc_pcm_runtime *runtime)
{
- int ret = snd_soc_dapm_ignore_suspend(&runtime->card->dapm, "DMIC");
+ struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(runtime->card);
+ int ret = snd_soc_dapm_ignore_suspend(dapm, "DMIC");
if (ret)
dev_err(runtime->dev, "DMIC - Ignore suspend failed = %d\n", ret);
diff --git a/sound/soc/intel/avs/boards/rt5640.c b/sound/soc/intel/avs/boards/rt5640.c
index 97d1fa944188..2990d32f2301 100644
--- a/sound/soc/intel/avs/boards/rt5640.c
+++ b/sound/soc/intel/avs/boards/rt5640.c
@@ -50,6 +50,7 @@ static int avs_rt5640_codec_init(struct snd_soc_pcm_runtime *runtime)
{
struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(runtime, 0);
struct snd_soc_card *card = runtime->card;
+ struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card);
struct snd_soc_jack_pin *pins;
struct snd_soc_jack *jack;
int num_pins, ret;
@@ -67,7 +68,7 @@ static int avs_rt5640_codec_init(struct snd_soc_pcm_runtime *runtime)
return ret;
snd_soc_component_set_jack(codec_dai->component, jack, NULL);
- card->dapm.idle_bias = false;
+ snd_soc_dapm_set_idle_bias(dapm, false);
return 0;
}
diff --git a/sound/soc/intel/avs/control.c b/sound/soc/intel/avs/control.c
index 2e01dc75a15a..a8f05de338e0 100644
--- a/sound/soc/intel/avs/control.c
+++ b/sound/soc/intel/avs/control.c
@@ -15,11 +15,10 @@
static struct avs_dev *avs_get_kcontrol_adev(struct snd_kcontrol *kcontrol)
{
- struct snd_soc_dapm_widget *w;
+ struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kcontrol);
+ struct device *dev = snd_soc_dapm_to_dev(dapm);
- w = snd_soc_dapm_kcontrol_widget(kcontrol);
-
- return to_avs_dev(w->dapm->component->dev);
+ return to_avs_dev(dev);
}
static struct avs_path_module *avs_get_volume_module(struct avs_dev *adev, u32 id)
diff --git a/sound/soc/intel/avs/debugfs.c b/sound/soc/intel/avs/debugfs.c
index 3534de46f9e4..701c247227bf 100644
--- a/sound/soc/intel/avs/debugfs.c
+++ b/sound/soc/intel/avs/debugfs.c
@@ -119,16 +119,13 @@ static ssize_t probe_points_read(struct file *file, char __user *to, size_t coun
}
for (i = 0; i < num_desc; i++) {
- ret = snprintf(buf + len, PAGE_SIZE - len,
- "Id: %#010x Purpose: %d Node id: %#x\n",
- desc[i].id.value, desc[i].purpose, desc[i].node_id.val);
- if (ret < 0)
- goto free_desc;
+ ret = scnprintf(buf + len, PAGE_SIZE - len,
+ "Id: %#010x Purpose: %d Node id: %#x\n",
+ desc[i].id.value, desc[i].purpose, desc[i].node_id.val);
len += ret;
}
ret = simple_read_from_buffer(to, count, ppos, buf, len);
-free_desc:
kfree(desc);
exit:
kfree(buf);
diff --git a/sound/soc/intel/avs/path.c b/sound/soc/intel/avs/path.c
index 7aa20fcf1a33..c8b586aced20 100644
--- a/sound/soc/intel/avs/path.c
+++ b/sound/soc/intel/avs/path.c
@@ -210,9 +210,11 @@ int avs_path_set_constraint(struct avs_dev *adev, struct avs_tplg_path_template
continue;
}
- blob = avs_nhlt_config_or_default(adev, module_template);
- if (IS_ERR(blob))
- continue;
+ if (!module_template->nhlt_config) {
+ blob = avs_nhlt_config_or_default(adev, module_template);
+ if (IS_ERR(blob))
+ continue;
+ }
rlist[i] = path_template->fe_fmt->sampling_freq;
clist[i] = path_template->fe_fmt->num_channels;
@@ -382,7 +384,10 @@ static int avs_fill_gtw_config(struct avs_dev *adev, struct avs_copier_gtw_cfg *
struct acpi_nhlt_config *blob;
size_t gtw_size;
- blob = avs_nhlt_config_or_default(adev, t);
+ if (t->nhlt_config)
+ blob = t->nhlt_config->blob;
+ else
+ blob = avs_nhlt_config_or_default(adev, t);
if (IS_ERR(blob))
return PTR_ERR(blob);
diff --git a/sound/soc/intel/avs/pcm.c b/sound/soc/intel/avs/pcm.c
index d31058e2de5b..4a6deb599c88 100644
--- a/sound/soc/intel/avs/pcm.c
+++ b/sound/soc/intel/avs/pcm.c
@@ -651,6 +651,7 @@ static void avs_dai_fe_shutdown(struct snd_pcm_substream *substream, struct snd_
data = snd_soc_dai_get_dma_data(dai, substream);
+ disable_work_sync(&data->period_elapsed_work);
snd_hdac_ext_stream_release(data->host_stream, HDAC_EXT_STREAM_TYPE_HOST);
avs_dai_shutdown(substream, dai);
}
@@ -754,6 +755,8 @@ static int avs_dai_fe_prepare(struct snd_pcm_substream *substream, struct snd_so
data = snd_soc_dai_get_dma_data(dai, substream);
host_stream = data->host_stream;
+ if (runtime->state == SNDRV_PCM_STATE_XRUN)
+ hdac_stream(host_stream)->prepared = false;
if (hdac_stream(host_stream)->prepared)
return 0;
@@ -1621,7 +1624,7 @@ static int avs_component_hda_probe(struct snd_soc_component *component)
return -ENOMEM;
cname = dev_name(&codec->core.dev);
- dapm = snd_soc_component_get_dapm(component);
+ dapm = snd_soc_component_to_dapm(component);
pcm = list_first_entry(&codec->pcm_list_head, struct hda_pcm, list);
for (i = 0; i < pcm_count; i++, pcm = list_next_entry(pcm, list)) {
diff --git a/sound/soc/intel/avs/probes.c b/sound/soc/intel/avs/probes.c
index 693ecfe68fd0..74096236984a 100644
--- a/sound/soc/intel/avs/probes.c
+++ b/sound/soc/intel/avs/probes.c
@@ -14,8 +14,8 @@
#include "debug.h"
#include "messages.h"
-static int avs_dsp_init_probe(struct avs_dev *adev, union avs_connector_node_id node_id,
- size_t buffer_size)
+static int avs_dsp_init_probe(struct avs_dev *adev, struct snd_compr_params *params, int bps,
+ union avs_connector_node_id node_id, size_t buffer_size)
{
struct avs_probe_cfg cfg = {{0}};
struct avs_module_entry mentry;
@@ -27,12 +27,16 @@ static int avs_dsp_init_probe(struct avs_dev *adev, union avs_connector_node_id
return ret;
/*
- * Probe module uses no cycles, audio data format and input and output
- * frame sizes are unused. It is also not owned by any pipeline.
+ * Probe module uses no cycles, input and output frame sizes are unused.
+ * It is also not owned by any pipeline.
*/
cfg.base.ibs = 1;
/* BSS module descriptor is always segment of index=2. */
cfg.base.is_pages = mentry.segments[2].flags.length;
+ cfg.base.audio_fmt.sampling_freq = params->codec.sample_rate;
+ cfg.base.audio_fmt.bit_depth = bps;
+ cfg.base.audio_fmt.num_channels = params->codec.ch_out;
+ cfg.base.audio_fmt.valid_bit_depth = bps;
cfg.gtw_cfg.node_id = node_id;
cfg.gtw_cfg.dma_buffer_size = buffer_size;
@@ -128,8 +132,6 @@ static int avs_probe_compr_set_params(struct snd_compr_stream *cstream,
struct hdac_ext_stream *host_stream = avs_compr_get_host_stream(cstream);
struct snd_compr_runtime *rtd = cstream->runtime;
struct avs_dev *adev = to_avs_dev(dai->dev);
- /* compr params do not store bit depth, default to S32_LE. */
- snd_pcm_format_t format = SNDRV_PCM_FORMAT_S32_LE;
unsigned int format_val;
int bps, ret;
@@ -142,7 +144,7 @@ static int avs_probe_compr_set_params(struct snd_compr_stream *cstream,
ret = snd_compr_malloc_pages(cstream, rtd->buffer_size);
if (ret < 0)
return ret;
- bps = snd_pcm_format_physical_width(format);
+ bps = snd_pcm_format_physical_width(params->codec.format);
if (bps < 0)
return bps;
format_val = snd_hdac_stream_format(params->codec.ch_out, bps, params->codec.sample_rate);
@@ -166,7 +168,7 @@ static int avs_probe_compr_set_params(struct snd_compr_stream *cstream,
node_id.vindex = hdac_stream(host_stream)->stream_tag - 1;
node_id.dma_type = AVS_DMA_HDA_HOST_INPUT;
- ret = avs_dsp_init_probe(adev, node_id, rtd->dma_bytes);
+ ret = avs_dsp_init_probe(adev, params, bps, node_id, rtd->dma_bytes);
if (ret < 0) {
dev_err(dai->dev, "probe init failed: %d\n", ret);
avs_dsp_enable_d0ix(adev);
diff --git a/sound/soc/intel/avs/topology.c b/sound/soc/intel/avs/topology.c
index dfe8cf505381..9033f683393c 100644
--- a/sound/soc/intel/avs/topology.c
+++ b/sound/soc/intel/avs/topology.c
@@ -350,6 +350,7 @@ AVS_DEFINE_PTR_PARSER(modcfg_base, struct avs_tplg_modcfg_base, modcfgs_base);
AVS_DEFINE_PTR_PARSER(modcfg_ext, struct avs_tplg_modcfg_ext, modcfgs_ext);
AVS_DEFINE_PTR_PARSER(pplcfg, struct avs_tplg_pplcfg, pplcfgs);
AVS_DEFINE_PTR_PARSER(binding, struct avs_tplg_binding, bindings);
+AVS_DEFINE_PTR_PARSER(nhlt_config, struct avs_tplg_nhlt_config, nhlt_configs);
static int
parse_audio_format_bitfield(struct snd_soc_component *comp, void *elem, void *object, u32 offset)
@@ -420,6 +421,22 @@ static int parse_link_formatted_string(struct snd_soc_component *comp, void *ele
return 0;
}
+static int avs_parse_nhlt_config_size(struct snd_soc_component *comp, void *elem, void *object,
+ u32 offset)
+{
+ struct snd_soc_tplg_vendor_value_elem *tuple = elem;
+ struct acpi_nhlt_config **blob = (struct acpi_nhlt_config **)((u8 *)object + offset);
+ u32 size;
+
+ size = le32_to_cpu(tuple->value);
+ *blob = devm_kzalloc(comp->card->dev, struct_size(*blob, capabilities, size), GFP_KERNEL);
+ if (!*blob)
+ return -ENOMEM;
+
+ (*blob)->capabilities_size = size;
+ return 0;
+}
+
static int
parse_dictionary_header(struct snd_soc_component *comp,
struct snd_soc_tplg_vendor_array *tuples,
@@ -1184,6 +1201,12 @@ static const struct avs_tplg_token_parser module_parsers[] = {
.offset = offsetof(struct avs_tplg_module, num_config_ids),
.parse = avs_parse_byte_token,
},
+ {
+ .token = AVS_TKN_MOD_NHLT_CONFIG_ID_U32,
+ .type = SND_SOC_TPLG_TUPLE_TYPE_WORD,
+ .offset = offsetof(struct avs_tplg_module, nhlt_config),
+ .parse = avs_parse_nhlt_config_ptr,
+ },
};
static const struct avs_tplg_token_parser init_config_parsers[] = {
@@ -1651,12 +1674,14 @@ static const struct avs_tplg_token_parser mod_init_config_parsers[] = {
static int avs_tplg_parse_initial_configs(struct snd_soc_component *comp,
struct snd_soc_tplg_vendor_array *tuples,
- u32 block_size)
+ u32 block_size, u32 *offset)
{
struct avs_soc_component *acomp = to_avs_soc_component(comp);
struct avs_tplg *tplg = acomp->tplg;
int ret, i;
+ *offset = 0;
+
/* Parse tuple section telling how many init configs there are. */
ret = parse_dictionary_header(comp, tuples, (void **)&tplg->init_configs,
&tplg->num_init_configs,
@@ -1666,6 +1691,7 @@ static int avs_tplg_parse_initial_configs(struct snd_soc_component *comp,
return ret;
block_size -= le32_to_cpu(tuples->size);
+ *offset += le32_to_cpu(tuples->size);
/* With header parsed, move on to parsing entries. */
tuples = avs_tplg_vendor_array_next(tuples);
@@ -1681,6 +1707,7 @@ static int avs_tplg_parse_initial_configs(struct snd_soc_component *comp,
*/
tmp = avs_tplg_vendor_array_next(tuples);
esize = le32_to_cpu(tuples->size) + le32_to_cpu(tmp->size);
+ *offset += esize;
ret = parse_dictionary_entries(comp, tuples, esize, config, 1, sizeof(*config),
AVS_TKN_INIT_CONFIG_ID_U32,
@@ -1692,6 +1719,7 @@ static int avs_tplg_parse_initial_configs(struct snd_soc_component *comp,
/* handle raw data section */
init_config_data = (void *)tuples + esize;
esize = config->length;
+ *offset += esize;
config->data = devm_kmemdup(comp->card->dev, init_config_data, esize, GFP_KERNEL);
if (!config->data)
@@ -1704,6 +1732,70 @@ static int avs_tplg_parse_initial_configs(struct snd_soc_component *comp,
return 0;
}
+static const struct avs_tplg_token_parser mod_nhlt_config_parsers[] = {
+ {
+ .token = AVS_TKN_NHLT_CONFIG_ID_U32,
+ .type = SND_SOC_TPLG_TUPLE_TYPE_WORD,
+ .offset = offsetof(struct avs_tplg_nhlt_config, id),
+ .parse = avs_parse_word_token,
+ },
+ {
+ .token = AVS_TKN_NHLT_CONFIG_SIZE_U32,
+ .type = SND_SOC_TPLG_TUPLE_TYPE_WORD,
+ .offset = offsetof(struct avs_tplg_nhlt_config, blob),
+ .parse = avs_parse_nhlt_config_size,
+ },
+};
+
+static int avs_tplg_parse_nhlt_configs(struct snd_soc_component *comp,
+ struct snd_soc_tplg_vendor_array *tuples,
+ u32 block_size)
+{
+ struct avs_soc_component *acomp = to_avs_soc_component(comp);
+ struct avs_tplg *tplg = acomp->tplg;
+ int ret, i;
+
+ /* Parse the header section to know how many entries there are. */
+ ret = parse_dictionary_header(comp, tuples, (void **)&tplg->nhlt_configs,
+ &tplg->num_nhlt_configs,
+ sizeof(*tplg->nhlt_configs),
+ AVS_TKN_MANIFEST_NUM_NHLT_CONFIGS_U32);
+ if (ret)
+ return ret;
+
+ block_size -= le32_to_cpu(tuples->size);
+ /* With the header parsed, move on to parsing entries. */
+ tuples = avs_tplg_vendor_array_next(tuples);
+
+ for (i = 0; i < tplg->num_nhlt_configs && block_size > 0; i++) {
+ struct avs_tplg_nhlt_config *config;
+ u32 esize;
+
+ config = &tplg->nhlt_configs[i];
+ esize = le32_to_cpu(tuples->size);
+
+ ret = parse_dictionary_entries(comp, tuples, esize, config, 1, sizeof(*config),
+ AVS_TKN_NHLT_CONFIG_ID_U32,
+ mod_nhlt_config_parsers,
+ ARRAY_SIZE(mod_nhlt_config_parsers));
+ if (ret)
+ return ret;
+ /* With tuples parsed, the blob shall be allocated. */
+ if (!config->blob)
+ return -EINVAL;
+
+ /* Consume the raw data and move to the next entry. */
+ memcpy(config->blob->capabilities, (u8 *)tuples + esize,
+ config->blob->capabilities_size);
+ esize += config->blob->capabilities_size;
+
+ block_size -= esize;
+ tuples = avs_tplg_vendor_array_at(tuples, esize);
+ }
+
+ return 0;
+}
+
static int avs_route_load(struct snd_soc_component *comp, int index,
struct snd_soc_dapm_route *route)
{
@@ -2008,11 +2100,26 @@ static int avs_manifest(struct snd_soc_component *comp, int index,
tuples = avs_tplg_vendor_array_at(tuples, offset);
/* Initial configs dictionary. */
- ret = avs_tplg_parse_initial_configs(comp, tuples, remaining);
+ ret = avs_tplg_parse_initial_configs(comp, tuples, remaining, &offset);
if (ret < 0)
return ret;
- return 0;
+ remaining -= offset;
+ tuples = avs_tplg_vendor_array_at(tuples, offset);
+
+ ret = avs_tplg_vendor_array_lookup(tuples, remaining,
+ AVS_TKN_MANIFEST_NUM_NHLT_CONFIGS_U32, &offset);
+ if (ret == -ENOENT)
+ return 0;
+ if (ret) {
+ dev_err(comp->dev, "NHLT config lookup failed: %d\n", ret);
+ return ret;
+ }
+
+ tuples = avs_tplg_vendor_array_at(tuples, offset);
+
+ /* NHLT configs dictionary. */
+ return avs_tplg_parse_nhlt_configs(comp, tuples, remaining);
}
enum {
diff --git a/sound/soc/intel/avs/topology.h b/sound/soc/intel/avs/topology.h
index 1e83fccf2ea2..1cf7455b6c01 100644
--- a/sound/soc/intel/avs/topology.h
+++ b/sound/soc/intel/avs/topology.h
@@ -37,6 +37,8 @@ struct avs_tplg {
u32 num_condpath_tmpls;
struct avs_tplg_init_config *init_configs;
u32 num_init_configs;
+ struct avs_tplg_nhlt_config *nhlt_configs;
+ u32 num_nhlt_configs;
struct list_head path_tmpl_list;
};
@@ -175,6 +177,11 @@ struct avs_tplg_init_config {
void *data;
};
+struct avs_tplg_nhlt_config {
+ u32 id;
+ struct acpi_nhlt_config *blob;
+};
+
struct avs_tplg_path {
u32 id;
@@ -216,6 +223,7 @@ struct avs_tplg_module {
u32 ctl_id;
u32 num_config_ids;
u32 *config_ids;
+ struct avs_tplg_nhlt_config *nhlt_config;
struct avs_tplg_pipeline *owner;
/* Pipeline modules management. */
diff --git a/sound/soc/intel/boards/bdw-rt5677.c b/sound/soc/intel/boards/bdw-rt5677.c
index 9484f3410787..408d20ed8cee 100644
--- a/sound/soc/intel/boards/bdw-rt5677.c
+++ b/sound/soc/intel/boards/bdw-rt5677.c
@@ -27,8 +27,7 @@ struct bdw_rt5677_priv {
static int bdw_rt5677_event_hp(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *k, int event)
{
- struct snd_soc_dapm_context *dapm = w->dapm;
- struct snd_soc_card *card = dapm->card;
+ struct snd_soc_card *card = snd_soc_dapm_to_card(w->dapm);
struct bdw_rt5677_priv *bdw_rt5677 = snd_soc_card_get_drvdata(card);
if (SND_SOC_DAPM_EVENT_ON(event))
@@ -228,7 +227,7 @@ static int bdw_rt5677_init(struct snd_soc_pcm_runtime *rtd)
struct bdw_rt5677_priv *bdw_rt5677 =
snd_soc_card_get_drvdata(rtd->card);
struct snd_soc_component *component = snd_soc_rtd_to_codec(rtd, 0)->component;
- struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
int ret;
ret = devm_acpi_dev_add_driver_gpios(component->dev, bdw_rt5677_gpios);
@@ -366,7 +365,7 @@ static int bdw_rt5677_suspend_pre(struct snd_soc_card *card)
struct snd_soc_dapm_context *dapm;
if (bdw_rt5677->component) {
- dapm = snd_soc_component_get_dapm(bdw_rt5677->component);
+ dapm = snd_soc_component_to_dapm(bdw_rt5677->component);
snd_soc_dapm_disable_pin(dapm, "MICBIAS1");
}
return 0;
@@ -378,7 +377,7 @@ static int bdw_rt5677_resume_post(struct snd_soc_card *card)
struct snd_soc_dapm_context *dapm;
if (bdw_rt5677->component) {
- dapm = snd_soc_component_get_dapm(bdw_rt5677->component);
+ dapm = snd_soc_component_to_dapm(bdw_rt5677->component);
snd_soc_dapm_force_enable_pin(dapm, "MICBIAS1");
}
return 0;
diff --git a/sound/soc/intel/boards/bytcht_cx2072x.c b/sound/soc/intel/boards/bytcht_cx2072x.c
index 27b63a853a48..0a7e6d2e37cb 100644
--- a/sound/soc/intel/boards/bytcht_cx2072x.c
+++ b/sound/soc/intel/boards/bytcht_cx2072x.c
@@ -70,6 +70,7 @@ static const struct acpi_gpio_mapping byt_cht_cx2072x_acpi_gpios[] = {
static int byt_cht_cx2072x_init(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_card *card = rtd->card;
+ struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card);
struct snd_soc_component *codec = snd_soc_rtd_to_codec(rtd, 0)->component;
int ret;
@@ -77,7 +78,7 @@ static int byt_cht_cx2072x_init(struct snd_soc_pcm_runtime *rtd)
byt_cht_cx2072x_acpi_gpios))
dev_warn(rtd->dev, "Unable to add GPIO mapping table\n");
- card->dapm.idle_bias = false;
+ snd_soc_dapm_set_idle_bias(dapm, false);
/* set the default PLL rate, the clock is handled by the codec driver */
ret = snd_soc_dai_set_sysclk(snd_soc_rtd_to_codec(rtd, 0), CX2072X_MCLK_EXTERNAL_PLL,
diff --git a/sound/soc/intel/boards/bytcht_es8316.c b/sound/soc/intel/boards/bytcht_es8316.c
index 3b5f63112237..192e2a394ff3 100644
--- a/sound/soc/intel/boards/bytcht_es8316.c
+++ b/sound/soc/intel/boards/bytcht_es8316.c
@@ -89,7 +89,7 @@ static void log_quirks(struct device *dev)
static int byt_cht_es8316_speaker_power_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_card *card = w->dapm->card;
+ struct snd_soc_card *card = snd_soc_dapm_to_card(w->dapm);
struct byt_cht_es8316_private *priv = snd_soc_card_get_drvdata(card);
if (SND_SOC_DAPM_EVENT_ON(event))
@@ -174,12 +174,13 @@ static int byt_cht_es8316_init(struct snd_soc_pcm_runtime *runtime)
{
struct snd_soc_component *codec = snd_soc_rtd_to_codec(runtime, 0)->component;
struct snd_soc_card *card = runtime->card;
+ struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card);
struct byt_cht_es8316_private *priv = snd_soc_card_get_drvdata(card);
const struct snd_soc_dapm_route *custom_map;
int num_routes;
int ret;
- card->dapm.idle_bias = false;
+ snd_soc_dapm_set_idle_bias(dapm, false);
switch (BYT_CHT_ES8316_MAP(quirk)) {
case BYT_CHT_ES8316_INTMIC_IN1_MAP:
@@ -192,7 +193,7 @@ static int byt_cht_es8316_init(struct snd_soc_pcm_runtime *runtime)
num_routes = ARRAY_SIZE(byt_cht_es8316_intmic_in2_map);
break;
}
- ret = snd_soc_dapm_add_routes(&card->dapm, custom_map, num_routes);
+ ret = snd_soc_dapm_add_routes(dapm, custom_map, num_routes);
if (ret)
return ret;
@@ -203,7 +204,7 @@ static int byt_cht_es8316_init(struct snd_soc_pcm_runtime *runtime)
custom_map = byt_cht_es8316_ssp2_map;
num_routes = ARRAY_SIZE(byt_cht_es8316_ssp2_map);
}
- ret = snd_soc_dapm_add_routes(&card->dapm, custom_map, num_routes);
+ ret = snd_soc_dapm_add_routes(dapm, custom_map, num_routes);
if (ret)
return ret;
diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards/bytcr_rt5640.c
index 1e9b1903fae8..103e0b445603 100644
--- a/sound/soc/intel/boards/bytcr_rt5640.c
+++ b/sound/soc/intel/boards/bytcr_rt5640.c
@@ -257,7 +257,7 @@ static int byt_rt5640_prepare_and_enable_pll1(struct snd_soc_dai *codec_dai,
static struct snd_soc_dai *byt_rt5640_get_codec_dai(struct snd_soc_dapm_context *dapm)
{
- struct snd_soc_card *card = dapm->card;
+ struct snd_soc_card *card = snd_soc_dapm_to_card(dapm);
struct snd_soc_dai *codec_dai;
codec_dai = snd_soc_card_get_codec_dai(card, BYT_CODEC_DAI1);
@@ -273,7 +273,7 @@ static int platform_clock_control(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *k, int event)
{
struct snd_soc_dapm_context *dapm = w->dapm;
- struct snd_soc_card *card = dapm->card;
+ struct snd_soc_card *card = snd_soc_dapm_to_card(dapm);
struct snd_soc_dai *codec_dai;
struct byt_rt5640_private *priv = snd_soc_card_get_drvdata(card);
int ret;
@@ -1317,6 +1317,7 @@ put_adev:
static int byt_rt5640_init(struct snd_soc_pcm_runtime *runtime)
{
struct snd_soc_card *card = runtime->card;
+ struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card);
struct byt_rt5640_private *priv = snd_soc_card_get_drvdata(card);
struct rt5640_set_jack_data *jack_data = &priv->jack_data;
struct snd_soc_component *component = snd_soc_rtd_to_codec(runtime, 0)->component;
@@ -1324,7 +1325,7 @@ static int byt_rt5640_init(struct snd_soc_pcm_runtime *runtime)
int num_routes = 0;
int ret;
- card->dapm.idle_bias = false;
+ snd_soc_dapm_set_idle_bias(dapm, false);
jack_data->use_platform_clock = true;
/* Start with RC clk for jack-detect (we disable MCLK below) */
@@ -1367,12 +1368,12 @@ static int byt_rt5640_init(struct snd_soc_pcm_runtime *runtime)
break;
}
- ret = snd_soc_dapm_add_routes(&card->dapm, custom_map, num_routes);
+ ret = snd_soc_dapm_add_routes(dapm, custom_map, num_routes);
if (ret)
return ret;
if (byt_rt5640_quirk & BYT_RT5640_HSMIC2_ON_IN1) {
- ret = snd_soc_dapm_add_routes(&card->dapm,
+ ret = snd_soc_dapm_add_routes(dapm,
byt_rt5640_hsmic2_in1_map,
ARRAY_SIZE(byt_rt5640_hsmic2_in1_map));
if (ret)
@@ -1380,19 +1381,19 @@ static int byt_rt5640_init(struct snd_soc_pcm_runtime *runtime)
}
if (byt_rt5640_quirk & BYT_RT5640_SSP2_AIF2) {
- ret = snd_soc_dapm_add_routes(&card->dapm,
+ ret = snd_soc_dapm_add_routes(dapm,
byt_rt5640_ssp2_aif2_map,
ARRAY_SIZE(byt_rt5640_ssp2_aif2_map));
} else if (byt_rt5640_quirk & BYT_RT5640_SSP0_AIF1) {
- ret = snd_soc_dapm_add_routes(&card->dapm,
+ ret = snd_soc_dapm_add_routes(dapm,
byt_rt5640_ssp0_aif1_map,
ARRAY_SIZE(byt_rt5640_ssp0_aif1_map));
} else if (byt_rt5640_quirk & BYT_RT5640_SSP0_AIF2) {
- ret = snd_soc_dapm_add_routes(&card->dapm,
+ ret = snd_soc_dapm_add_routes(dapm,
byt_rt5640_ssp0_aif2_map,
ARRAY_SIZE(byt_rt5640_ssp0_aif2_map));
} else {
- ret = snd_soc_dapm_add_routes(&card->dapm,
+ ret = snd_soc_dapm_add_routes(dapm,
byt_rt5640_ssp2_aif1_map,
ARRAY_SIZE(byt_rt5640_ssp2_aif1_map));
}
@@ -1400,11 +1401,11 @@ static int byt_rt5640_init(struct snd_soc_pcm_runtime *runtime)
return ret;
if (byt_rt5640_quirk & BYT_RT5640_MONO_SPEAKER) {
- ret = snd_soc_dapm_add_routes(&card->dapm,
+ ret = snd_soc_dapm_add_routes(dapm,
byt_rt5640_mono_spk_map,
ARRAY_SIZE(byt_rt5640_mono_spk_map));
} else if (!(byt_rt5640_quirk & BYT_RT5640_NO_SPEAKERS)) {
- ret = snd_soc_dapm_add_routes(&card->dapm,
+ ret = snd_soc_dapm_add_routes(dapm,
byt_rt5640_stereo_spk_map,
ARRAY_SIZE(byt_rt5640_stereo_spk_map));
}
@@ -1412,7 +1413,7 @@ static int byt_rt5640_init(struct snd_soc_pcm_runtime *runtime)
return ret;
if (byt_rt5640_quirk & BYT_RT5640_LINEOUT) {
- ret = snd_soc_dapm_add_routes(&card->dapm,
+ ret = snd_soc_dapm_add_routes(dapm,
byt_rt5640_lineout_map,
ARRAY_SIZE(byt_rt5640_lineout_map));
if (ret)
diff --git a/sound/soc/intel/boards/bytcr_rt5651.c b/sound/soc/intel/boards/bytcr_rt5651.c
index ca540a66f22c..68cf463f1d50 100644
--- a/sound/soc/intel/boards/bytcr_rt5651.c
+++ b/sound/soc/intel/boards/bytcr_rt5651.c
@@ -188,8 +188,7 @@ static int byt_rt5651_prepare_and_enable_pll1(struct snd_soc_dai *codec_dai,
static int platform_clock_control(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *k, int event)
{
- struct snd_soc_dapm_context *dapm = w->dapm;
- struct snd_soc_card *card = dapm->card;
+ struct snd_soc_card *card = snd_soc_dapm_to_card(w->dapm);
struct snd_soc_dai *codec_dai;
struct byt_rt5651_private *priv = snd_soc_card_get_drvdata(card);
int ret;
@@ -234,7 +233,7 @@ static int platform_clock_control(struct snd_soc_dapm_widget *w,
static int rt5651_ext_amp_power_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_card *card = w->dapm->card;
+ struct snd_soc_card *card = snd_soc_dapm_to_card(w->dapm);
struct byt_rt5651_private *priv = snd_soc_card_get_drvdata(card);
if (SND_SOC_DAPM_EVENT_ON(event))
@@ -579,6 +578,7 @@ static int byt_rt5651_add_codec_device_props(struct device *i2c_dev,
static int byt_rt5651_init(struct snd_soc_pcm_runtime *runtime)
{
struct snd_soc_card *card = runtime->card;
+ struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card);
struct snd_soc_component *codec = snd_soc_rtd_to_codec(runtime, 0)->component;
struct byt_rt5651_private *priv = snd_soc_card_get_drvdata(card);
const struct snd_soc_dapm_route *custom_map;
@@ -586,7 +586,7 @@ static int byt_rt5651_init(struct snd_soc_pcm_runtime *runtime)
int report;
int ret;
- card->dapm.idle_bias = false;
+ snd_soc_dapm_set_idle_bias(dapm, false);
/* Start with RC clk for jack-detect (we disable MCLK below) */
if (byt_rt5651_quirk & BYT_RT5651_MCLK_EN)
@@ -610,24 +610,24 @@ static int byt_rt5651_init(struct snd_soc_pcm_runtime *runtime)
custom_map = byt_rt5651_intmic_dmic_map;
num_routes = ARRAY_SIZE(byt_rt5651_intmic_dmic_map);
}
- ret = snd_soc_dapm_add_routes(&card->dapm, custom_map, num_routes);
+ ret = snd_soc_dapm_add_routes(dapm, custom_map, num_routes);
if (ret)
return ret;
if (byt_rt5651_quirk & BYT_RT5651_SSP2_AIF2) {
- ret = snd_soc_dapm_add_routes(&card->dapm,
+ ret = snd_soc_dapm_add_routes(dapm,
byt_rt5651_ssp2_aif2_map,
ARRAY_SIZE(byt_rt5651_ssp2_aif2_map));
} else if (byt_rt5651_quirk & BYT_RT5651_SSP0_AIF1) {
- ret = snd_soc_dapm_add_routes(&card->dapm,
+ ret = snd_soc_dapm_add_routes(dapm,
byt_rt5651_ssp0_aif1_map,
ARRAY_SIZE(byt_rt5651_ssp0_aif1_map));
} else if (byt_rt5651_quirk & BYT_RT5651_SSP0_AIF2) {
- ret = snd_soc_dapm_add_routes(&card->dapm,
+ ret = snd_soc_dapm_add_routes(dapm,
byt_rt5651_ssp0_aif2_map,
ARRAY_SIZE(byt_rt5651_ssp0_aif2_map));
} else {
- ret = snd_soc_dapm_add_routes(&card->dapm,
+ ret = snd_soc_dapm_add_routes(dapm,
byt_rt5651_ssp2_aif1_map,
ARRAY_SIZE(byt_rt5651_ssp2_aif1_map));
}
diff --git a/sound/soc/intel/boards/bytcr_wm5102.c b/sound/soc/intel/boards/bytcr_wm5102.c
index 02b84c877e5f..4879f79aef29 100644
--- a/sound/soc/intel/boards/bytcr_wm5102.c
+++ b/sound/soc/intel/boards/bytcr_wm5102.c
@@ -99,7 +99,7 @@ static void log_quirks(struct device *dev)
static int byt_wm5102_spkvdd_power_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_card *card = w->dapm->card;
+ struct snd_soc_card *card = snd_soc_dapm_to_card(w->dapm);
struct byt_wm5102_private *priv = snd_soc_card_get_drvdata(card);
gpiod_set_value_cansleep(priv->spkvdd_en_gpio,
@@ -150,8 +150,7 @@ static int byt_wm5102_prepare_and_enable_pll1(struct snd_soc_dai *codec_dai, int
static int platform_clock_control(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *k, int event)
{
- struct snd_soc_dapm_context *dapm = w->dapm;
- struct snd_soc_card *card = dapm->card;
+ struct snd_soc_card *card = snd_soc_dapm_to_card(w->dapm);
struct snd_soc_dai *codec_dai;
struct byt_wm5102_private *priv = snd_soc_card_get_drvdata(card);
int ret;
@@ -283,12 +282,13 @@ static struct snd_soc_jack_pin byt_wm5102_pins[] = {
static int byt_wm5102_init(struct snd_soc_pcm_runtime *runtime)
{
struct snd_soc_card *card = runtime->card;
+ struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card);
struct byt_wm5102_private *priv = snd_soc_card_get_drvdata(card);
struct snd_soc_component *component = snd_soc_rtd_to_codec(runtime, 0)->component;
const struct snd_soc_dapm_route *custom_map = NULL;
int ret, jack_type, num_routes = 0;
- card->dapm.idle_bias = false;
+ snd_soc_dapm_set_idle_bias(dapm, false);
ret = snd_soc_add_card_controls(card, byt_wm5102_controls,
ARRAY_SIZE(byt_wm5102_controls));
@@ -307,7 +307,7 @@ static int byt_wm5102_init(struct snd_soc_pcm_runtime *runtime)
num_routes = ARRAY_SIZE(byt_wm5102_intmic_in1l_hsmic_in2l_map);
break;
}
- ret = snd_soc_dapm_add_routes(&card->dapm, custom_map, num_routes);
+ ret = snd_soc_dapm_add_routes(dapm, custom_map, num_routes);
if (ret)
return ret;
@@ -321,7 +321,7 @@ static int byt_wm5102_init(struct snd_soc_pcm_runtime *runtime)
num_routes = ARRAY_SIZE(byt_wm5102_spk_hpout2_map);
break;
}
- ret = snd_soc_dapm_add_routes(&card->dapm, custom_map, num_routes);
+ ret = snd_soc_dapm_add_routes(dapm, custom_map, num_routes);
if (ret)
return ret;
@@ -332,7 +332,7 @@ static int byt_wm5102_init(struct snd_soc_pcm_runtime *runtime)
custom_map = bytcr_wm5102_ssp0_map;
num_routes = ARRAY_SIZE(bytcr_wm5102_ssp0_map);
}
- ret = snd_soc_dapm_add_routes(&card->dapm, custom_map, num_routes);
+ ret = snd_soc_dapm_add_routes(dapm, custom_map, num_routes);
if (ret)
return ret;
diff --git a/sound/soc/intel/boards/cht_bsw_max98090_ti.c b/sound/soc/intel/boards/cht_bsw_max98090_ti.c
index 36984de8a067..ad45b79d3e4b 100644
--- a/sound/soc/intel/boards/cht_bsw_max98090_ti.c
+++ b/sound/soc/intel/boards/cht_bsw_max98090_ti.c
@@ -42,8 +42,7 @@ struct cht_mc_private {
static int platform_clock_control(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *k, int event)
{
- struct snd_soc_dapm_context *dapm = w->dapm;
- struct snd_soc_card *card = dapm->card;
+ struct snd_soc_card *card = snd_soc_dapm_to_card(w->dapm);
struct snd_soc_dai *codec_dai;
struct cht_mc_private *ctx = snd_soc_card_get_drvdata(card);
int ret;
@@ -130,7 +129,7 @@ static int cht_ti_jack_event(struct notifier_block *nb,
unsigned long event, void *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 = snd_soc_card_to_dapm(jack->card);
if (event & SND_JACK_MICROPHONE) {
snd_soc_dapm_force_enable_pin(dapm, "SHDN");
diff --git a/sound/soc/intel/boards/cht_bsw_rt5645.c b/sound/soc/intel/boards/cht_bsw_rt5645.c
index b977a2db73a3..249be121be15 100644
--- a/sound/soc/intel/boards/cht_bsw_rt5645.c
+++ b/sound/soc/intel/boards/cht_bsw_rt5645.c
@@ -66,8 +66,7 @@ static void log_quirks(struct device *dev)
static int platform_clock_control(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *k, int event)
{
- struct snd_soc_dapm_context *dapm = w->dapm;
- struct snd_soc_card *card = dapm->card;
+ struct snd_soc_card *card = snd_soc_dapm_to_card(w->dapm);
struct snd_soc_dai *codec_dai;
struct cht_mc_private *ctx = snd_soc_card_get_drvdata(card);
int ret;
@@ -250,6 +249,7 @@ static const struct dmi_system_id cht_rt5645_quirk_table[] = {
static int cht_codec_init(struct snd_soc_pcm_runtime *runtime)
{
struct snd_soc_card *card = runtime->card;
+ struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card);
struct cht_mc_private *ctx = snd_soc_card_get_drvdata(runtime->card);
struct snd_soc_component *component = snd_soc_rtd_to_codec(runtime, 0)->component;
int jack_type;
@@ -275,19 +275,19 @@ static int cht_codec_init(struct snd_soc_pcm_runtime *runtime)
}
if (cht_rt5645_quirk & CHT_RT5645_SSP2_AIF2) {
- ret = snd_soc_dapm_add_routes(&card->dapm,
+ ret = snd_soc_dapm_add_routes(dapm,
cht_rt5645_ssp2_aif2_map,
ARRAY_SIZE(cht_rt5645_ssp2_aif2_map));
} else if (cht_rt5645_quirk & CHT_RT5645_SSP0_AIF1) {
- ret = snd_soc_dapm_add_routes(&card->dapm,
+ ret = snd_soc_dapm_add_routes(dapm,
cht_rt5645_ssp0_aif1_map,
ARRAY_SIZE(cht_rt5645_ssp0_aif1_map));
} else if (cht_rt5645_quirk & CHT_RT5645_SSP0_AIF2) {
- ret = snd_soc_dapm_add_routes(&card->dapm,
+ ret = snd_soc_dapm_add_routes(dapm,
cht_rt5645_ssp0_aif2_map,
ARRAY_SIZE(cht_rt5645_ssp0_aif2_map));
} else {
- ret = snd_soc_dapm_add_routes(&card->dapm,
+ ret = snd_soc_dapm_add_routes(dapm,
cht_rt5645_ssp2_aif1_map,
ARRAY_SIZE(cht_rt5645_ssp2_aif1_map));
}
diff --git a/sound/soc/intel/boards/cht_bsw_rt5672.c b/sound/soc/intel/boards/cht_bsw_rt5672.c
index 54c1894ee96a..359723f2700e 100644
--- a/sound/soc/intel/boards/cht_bsw_rt5672.c
+++ b/sound/soc/intel/boards/cht_bsw_rt5672.c
@@ -51,8 +51,7 @@ static struct snd_soc_jack_pin cht_bsw_headset_pins[] = {
static int platform_clock_control(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *k, int event)
{
- struct snd_soc_dapm_context *dapm = w->dapm;
- struct snd_soc_card *card = dapm->card;
+ struct snd_soc_card *card = snd_soc_dapm_to_card(w->dapm);
struct snd_soc_dai *codec_dai;
struct cht_mc_private *ctx = snd_soc_card_get_drvdata(card);
int ret;
@@ -193,6 +192,7 @@ static const struct acpi_gpio_mapping cht_rt5672_gpios[] = {
static int cht_codec_init(struct snd_soc_pcm_runtime *runtime)
{
int ret;
+ struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(runtime->card);
struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(runtime, 0);
struct snd_soc_component *component = codec_dai->component;
struct cht_mc_private *ctx = snd_soc_card_get_drvdata(runtime->card);
@@ -215,11 +215,11 @@ static int cht_codec_init(struct snd_soc_pcm_runtime *runtime)
RT5670_CLK_SEL_I2S1_ASRC);
if (ctx->use_ssp0) {
- ret = snd_soc_dapm_add_routes(&runtime->card->dapm,
+ ret = snd_soc_dapm_add_routes(dapm,
cht_audio_ssp0_map,
ARRAY_SIZE(cht_audio_ssp0_map));
} else {
- ret = snd_soc_dapm_add_routes(&runtime->card->dapm,
+ ret = snd_soc_dapm_add_routes(dapm,
cht_audio_ssp2_map,
ARRAY_SIZE(cht_audio_ssp2_map));
}
diff --git a/sound/soc/intel/boards/hda_dsp_common.c b/sound/soc/intel/boards/hda_dsp_common.c
index 86e541a2c204..328ffff336a8 100644
--- a/sound/soc/intel/boards/hda_dsp_common.c
+++ b/sound/soc/intel/boards/hda_dsp_common.c
@@ -15,7 +15,7 @@
/*
* Search card topology and return PCM device number
- * matching Nth HDMI device (zero-based index).
+ * matching Nth playback HDMI device (zero-based index).
*/
static struct snd_pcm *hda_dsp_hdmi_pcm_handle(struct snd_soc_card *card,
int hdmi_idx)
@@ -25,8 +25,17 @@ static struct snd_pcm *hda_dsp_hdmi_pcm_handle(struct snd_soc_card *card,
int i = 0;
for_each_card_rtds(card, rtd) {
- spcm = rtd->pcm ?
- rtd->pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].pcm : NULL;
+ /* ignore BE PCMs */
+ if (rtd->dai_link && rtd->dai_link->no_pcm)
+ continue;
+
+ spcm = rtd->pcm;
+
+ /* ignore PCMs with no playback streams */
+ if (!spcm || !spcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream)
+ continue;
+
+ /* look for FE PCMs with name "HDMI x" */
if (spcm && strstr(spcm->id, "HDMI")) {
if (i == hdmi_idx)
return rtd->pcm;
diff --git a/sound/soc/intel/boards/sof_board_helpers.c b/sound/soc/intel/boards/sof_board_helpers.c
index 2ea1dda446ec..f741a1e142be 100644
--- a/sound/soc/intel/boards/sof_board_helpers.c
+++ b/sound/soc/intel/boards/sof_board_helpers.c
@@ -51,16 +51,17 @@ static const struct snd_soc_dapm_route dmic_routes[] = {
static int dmic_init(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_card *card = rtd->card;
+ struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card);
int ret;
- ret = snd_soc_dapm_new_controls(&card->dapm, dmic_widgets,
+ ret = snd_soc_dapm_new_controls(dapm, dmic_widgets,
ARRAY_SIZE(dmic_widgets));
if (ret) {
dev_err(rtd->dev, "fail to add dmic widgets, ret %d\n", ret);
return ret;
}
- ret = snd_soc_dapm_add_routes(&card->dapm, dmic_routes,
+ ret = snd_soc_dapm_add_routes(dapm, dmic_routes,
ARRAY_SIZE(dmic_routes));
if (ret) {
dev_err(rtd->dev, "fail to add dmic routes, ret %d\n", ret);
@@ -111,16 +112,17 @@ static const struct snd_soc_dapm_route hda_routes[] = {
static int hda_init(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_card *card = rtd->card;
+ struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card);
int ret;
- ret = snd_soc_dapm_new_controls(&card->dapm, hda_widgets,
+ ret = snd_soc_dapm_new_controls(dapm, hda_widgets,
ARRAY_SIZE(hda_widgets));
if (ret) {
dev_err(rtd->dev, "fail to add hda widgets, ret %d\n", ret);
return ret;
}
- ret = snd_soc_dapm_add_routes(&card->dapm, hda_routes,
+ ret = snd_soc_dapm_add_routes(dapm, hda_routes,
ARRAY_SIZE(hda_routes));
if (ret)
dev_err(rtd->dev, "fail to add hda routes, ret %d\n", ret);
diff --git a/sound/soc/intel/boards/sof_cirrus_common.c b/sound/soc/intel/boards/sof_cirrus_common.c
index 8db7695b9747..88fc6cb2bfd4 100644
--- a/sound/soc/intel/boards/sof_cirrus_common.c
+++ b/sound/soc/intel/boards/sof_cirrus_common.c
@@ -48,9 +48,10 @@ static struct snd_soc_codec_conf cs35l41_codec_conf[CS35L41_MAX_AMPS];
static int cs35l41_init(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_card *card = rtd->card;
+ struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card);
int ret;
- ret = snd_soc_dapm_new_controls(&card->dapm, cs35l41_dapm_widgets,
+ ret = snd_soc_dapm_new_controls(dapm, cs35l41_dapm_widgets,
ARRAY_SIZE(cs35l41_dapm_widgets));
if (ret) {
dev_err(rtd->dev, "fail to add dapm controls, ret %d\n", ret);
@@ -64,7 +65,7 @@ static int cs35l41_init(struct snd_soc_pcm_runtime *rtd)
return ret;
}
- ret = snd_soc_dapm_add_routes(&card->dapm, cs35l41_dapm_routes,
+ ret = snd_soc_dapm_add_routes(dapm, cs35l41_dapm_routes,
ARRAY_SIZE(cs35l41_dapm_routes));
if (ret)
diff --git a/sound/soc/intel/boards/sof_da7219.c b/sound/soc/intel/boards/sof_da7219.c
index 9b7082b239c1..ad845d32f642 100644
--- a/sound/soc/intel/boards/sof_da7219.c
+++ b/sound/soc/intel/boards/sof_da7219.c
@@ -29,8 +29,7 @@
static int platform_clock_control(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *k, int event)
{
- struct snd_soc_dapm_context *dapm = w->dapm;
- struct snd_soc_card *card = dapm->card;
+ struct snd_soc_card *card = snd_soc_dapm_to_card(w->dapm);
struct sof_card_private *ctx = snd_soc_card_get_drvdata(card);
struct snd_soc_dai *codec_dai;
int ret = 0;
@@ -181,7 +180,7 @@ static void da7219_codec_exit(struct snd_soc_pcm_runtime *rtd)
static int card_late_probe(struct snd_soc_card *card)
{
struct sof_card_private *ctx = snd_soc_card_get_drvdata(card);
- struct snd_soc_dapm_context *dapm = &card->dapm;
+ struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card);
int err;
if (ctx->amp_type == CODEC_MAX98373) {
diff --git a/sound/soc/intel/boards/sof_es8336.c b/sound/soc/intel/boards/sof_es8336.c
index 10b189ea88db..774fff58d51b 100644
--- a/sound/soc/intel/boards/sof_es8336.c
+++ b/sound/soc/intel/boards/sof_es8336.c
@@ -155,7 +155,7 @@ static int sof_8336_trigger(struct snd_pcm_substream *substream, int cmd)
static int sof_es8316_speaker_power_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_card *card = w->dapm->card;
+ struct snd_soc_card *card = snd_soc_dapm_to_card(w->dapm);
struct sof_es8336_private *priv = snd_soc_card_get_drvdata(card);
if (priv->speaker_en == !SND_SOC_DAPM_EVENT_ON(event))
@@ -163,7 +163,7 @@ static int sof_es8316_speaker_power_event(struct snd_soc_dapm_widget *w,
priv->speaker_en = !SND_SOC_DAPM_EVENT_ON(event);
- queue_delayed_work(system_wq, &priv->pcm_pop_work, msecs_to_jiffies(70));
+ queue_delayed_work(system_dfl_wq, &priv->pcm_pop_work, msecs_to_jiffies(70));
return 0;
}
@@ -231,16 +231,17 @@ static struct snd_soc_jack_pin sof_es8316_jack_pins[] = {
static int dmic_init(struct snd_soc_pcm_runtime *runtime)
{
struct snd_soc_card *card = runtime->card;
+ struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card);
int ret;
- ret = snd_soc_dapm_new_controls(&card->dapm, dmic_widgets,
+ ret = snd_soc_dapm_new_controls(dapm, dmic_widgets,
ARRAY_SIZE(dmic_widgets));
if (ret) {
dev_err(card->dev, "DMic widget addition failed: %d\n", ret);
return ret;
}
- ret = snd_soc_dapm_add_routes(&card->dapm, dmic_map,
+ ret = snd_soc_dapm_add_routes(dapm, dmic_map,
ARRAY_SIZE(dmic_map));
if (ret)
dev_err(card->dev, "DMic map addition failed: %d\n", ret);
@@ -271,12 +272,13 @@ static int sof_es8316_init(struct snd_soc_pcm_runtime *runtime)
{
struct snd_soc_component *codec = snd_soc_rtd_to_codec(runtime, 0)->component;
struct snd_soc_card *card = runtime->card;
+ struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card);
struct sof_es8336_private *priv = snd_soc_card_get_drvdata(card);
const struct snd_soc_dapm_route *custom_map;
int num_routes;
int ret;
- card->dapm.idle_bias = false;
+ snd_soc_dapm_set_idle_bias(dapm, false);
if (quirk & SOC_ES8336_HEADSET_MIC1) {
custom_map = sof_es8316_headset_mic1_map;
@@ -286,7 +288,7 @@ static int sof_es8316_init(struct snd_soc_pcm_runtime *runtime)
num_routes = ARRAY_SIZE(sof_es8316_headset_mic2_map);
}
- ret = snd_soc_dapm_add_routes(&card->dapm, custom_map, num_routes);
+ ret = snd_soc_dapm_add_routes(dapm, custom_map, num_routes);
if (ret)
return ret;
diff --git a/sound/soc/intel/boards/sof_maxim_common.c b/sound/soc/intel/boards/sof_maxim_common.c
index c98a67ae5e66..c3d0f697ff8d 100644
--- a/sound/soc/intel/boards/sof_maxim_common.c
+++ b/sound/soc/intel/boards/sof_maxim_common.c
@@ -201,8 +201,7 @@ static int max_98373_trigger(struct snd_pcm_substream *substream, int cmd)
cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
for_each_rtd_codec_dais(rtd, j, codec_dai) {
- struct snd_soc_dapm_context *dapm =
- snd_soc_component_get_dapm(cpu_dai->component);
+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(cpu_dai->component);
char pin_name[MAX_98373_PIN_NAME];
snprintf(pin_name, ARRAY_SIZE(pin_name), "%s Spk",
@@ -239,12 +238,13 @@ static const struct snd_soc_ops max_98373_ops = {
static int max_98373_spk_codec_init(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_card *card = rtd->card;
+ struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card);
unsigned int num_codecs = get_num_codecs(MAX_98373_ACPI_HID);
int ret;
switch (num_codecs) {
case 2:
- ret = snd_soc_dapm_new_controls(&card->dapm, maxim_2spk_widgets,
+ ret = snd_soc_dapm_new_controls(dapm, maxim_2spk_widgets,
ARRAY_SIZE(maxim_2spk_widgets));
if (ret) {
dev_err(rtd->dev, "fail to add max98373 widgets, ret %d\n",
@@ -260,7 +260,7 @@ static int max_98373_spk_codec_init(struct snd_soc_pcm_runtime *rtd)
return ret;
}
- ret = snd_soc_dapm_add_routes(&card->dapm, max_98373_dapm_routes,
+ ret = snd_soc_dapm_add_routes(dapm, max_98373_dapm_routes,
ARRAY_SIZE(max_98373_dapm_routes));
if (ret) {
dev_err(rtd->dev, "fail to add max98373 routes, ret %d\n",
@@ -416,13 +416,14 @@ static int max_98390_hw_params(struct snd_pcm_substream *substream,
static int max_98390_init(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_card *card = rtd->card;
+ struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card);
unsigned int num_codecs = get_num_codecs(MAX_98390_ACPI_HID);
int ret;
switch (num_codecs) {
case 4:
/* add widgets/controls/dapm for tweeter speakers */
- ret = snd_soc_dapm_new_controls(&card->dapm, max_98390_tt_dapm_widgets,
+ ret = snd_soc_dapm_new_controls(dapm, max_98390_tt_dapm_widgets,
ARRAY_SIZE(max_98390_tt_dapm_widgets));
if (ret) {
dev_err(rtd->dev, "unable to add tweeter dapm widgets, ret %d\n",
@@ -439,7 +440,7 @@ static int max_98390_init(struct snd_soc_pcm_runtime *rtd)
return ret;
}
- ret = snd_soc_dapm_add_routes(&card->dapm, max_98390_tt_dapm_routes,
+ ret = snd_soc_dapm_add_routes(dapm, max_98390_tt_dapm_routes,
ARRAY_SIZE(max_98390_tt_dapm_routes));
if (ret) {
dev_err(rtd->dev, "unable to add tweeter dapm routes, ret %d\n",
@@ -450,7 +451,7 @@ static int max_98390_init(struct snd_soc_pcm_runtime *rtd)
fallthrough;
case 2:
/* add regular speakers dapm route */
- ret = snd_soc_dapm_new_controls(&card->dapm, maxim_2spk_widgets,
+ ret = snd_soc_dapm_new_controls(dapm, maxim_2spk_widgets,
ARRAY_SIZE(maxim_2spk_widgets));
if (ret) {
dev_err(rtd->dev, "fail to add max98390 woofer widgets, ret %d\n",
@@ -466,7 +467,7 @@ static int max_98390_init(struct snd_soc_pcm_runtime *rtd)
return ret;
}
- ret = snd_soc_dapm_add_routes(&card->dapm, max_98390_dapm_routes,
+ ret = snd_soc_dapm_add_routes(dapm, max_98390_dapm_routes,
ARRAY_SIZE(max_98390_dapm_routes));
if (ret) {
dev_err(rtd->dev, "unable to add dapm routes, ret %d\n",
@@ -564,9 +565,10 @@ static struct snd_soc_dai_link_component max_98360a_components[] = {
static int max_98357a_init(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_card *card = rtd->card;
+ struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card);
int ret;
- ret = snd_soc_dapm_new_controls(&card->dapm, max_98357a_dapm_widgets,
+ ret = snd_soc_dapm_new_controls(dapm, max_98357a_dapm_widgets,
ARRAY_SIZE(max_98357a_dapm_widgets));
if (ret) {
dev_err(rtd->dev, "unable to add dapm controls, ret %d\n", ret);
@@ -581,7 +583,7 @@ static int max_98357a_init(struct snd_soc_pcm_runtime *rtd)
return ret;
}
- ret = snd_soc_dapm_add_routes(&card->dapm, max_98357a_dapm_routes,
+ ret = snd_soc_dapm_add_routes(dapm, max_98357a_dapm_routes,
ARRAY_SIZE(max_98357a_dapm_routes));
if (ret)
diff --git a/sound/soc/intel/boards/sof_nau8825.c b/sound/soc/intel/boards/sof_nau8825.c
index 72ce32e2cd57..15ba6f5c697c 100644
--- a/sound/soc/intel/boards/sof_nau8825.c
+++ b/sound/soc/intel/boards/sof_nau8825.c
@@ -122,7 +122,7 @@ static const struct snd_soc_ops sof_nau8825_ops = {
static int sof_card_late_probe(struct snd_soc_card *card)
{
struct sof_card_private *ctx = snd_soc_card_get_drvdata(card);
- struct snd_soc_dapm_context *dapm = &card->dapm;
+ struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card);
int err;
if (ctx->amp_type == CODEC_MAX98373) {
diff --git a/sound/soc/intel/boards/sof_nuvoton_common.c b/sound/soc/intel/boards/sof_nuvoton_common.c
index ed41cb6f7fa5..b09ecbab2fc9 100644
--- a/sound/soc/intel/boards/sof_nuvoton_common.c
+++ b/sound/soc/intel/boards/sof_nuvoton_common.c
@@ -34,9 +34,10 @@ static struct snd_soc_dai_link_component nau8318_components[] = {
static int nau8318_init(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_card *card = rtd->card;
+ struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card);
int ret;
- ret = snd_soc_dapm_new_controls(&card->dapm, nau8318_widgets,
+ ret = snd_soc_dapm_new_controls(dapm, nau8318_widgets,
ARRAY_SIZE(nau8318_widgets));
if (ret) {
dev_err(rtd->dev, "fail to add nau8318 widgets, ret %d\n", ret);
@@ -50,7 +51,7 @@ static int nau8318_init(struct snd_soc_pcm_runtime *rtd)
return ret;
}
- ret = snd_soc_dapm_add_routes(&card->dapm, nau8318_routes,
+ ret = snd_soc_dapm_add_routes(dapm, nau8318_routes,
ARRAY_SIZE(nau8318_routes));
if (ret) {
diff --git a/sound/soc/intel/boards/sof_pcm512x.c b/sound/soc/intel/boards/sof_pcm512x.c
index 2f43710c1bae..359559b6175b 100644
--- a/sound/soc/intel/boards/sof_pcm512x.c
+++ b/sound/soc/intel/boards/sof_pcm512x.c
@@ -177,9 +177,10 @@ static const struct snd_soc_dapm_route dmic_map[] = {
static int dmic_init(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_card *card = rtd->card;
+ struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card);
int ret;
- ret = snd_soc_dapm_new_controls(&card->dapm, dmic_widgets,
+ ret = snd_soc_dapm_new_controls(dapm, dmic_widgets,
ARRAY_SIZE(dmic_widgets));
if (ret) {
dev_err(card->dev, "DMic widget addition failed: %d\n", ret);
@@ -187,7 +188,7 @@ static int dmic_init(struct snd_soc_pcm_runtime *rtd)
return ret;
}
- ret = snd_soc_dapm_add_routes(&card->dapm, dmic_map,
+ ret = snd_soc_dapm_add_routes(dapm, dmic_map,
ARRAY_SIZE(dmic_map));
if (ret)
diff --git a/sound/soc/intel/boards/sof_realtek_common.c b/sound/soc/intel/boards/sof_realtek_common.c
index 600707d403b9..835186cf04d0 100644
--- a/sound/soc/intel/boards/sof_realtek_common.c
+++ b/sound/soc/intel/boards/sof_realtek_common.c
@@ -186,13 +186,14 @@ static const struct snd_soc_ops rt1011_ops = {
static int rt1011_init(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_card *card = rtd->card;
+ struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card);
unsigned int num_codecs = get_num_codecs(RT1011_ACPI_HID);
int ret;
switch (num_codecs) {
case 2:
if (!soc_intel_is_cml()) {
- ret = snd_soc_dapm_new_controls(&card->dapm, realtek_2spk_widgets,
+ ret = snd_soc_dapm_new_controls(dapm, realtek_2spk_widgets,
ARRAY_SIZE(realtek_2spk_widgets));
if (ret) {
dev_err(rtd->dev, "fail to add rt1011 widgets, ret %d\n",
@@ -208,7 +209,7 @@ static int rt1011_init(struct snd_soc_pcm_runtime *rtd)
return ret;
}
- ret = snd_soc_dapm_add_routes(&card->dapm, speaker_map_lr,
+ ret = snd_soc_dapm_add_routes(dapm, speaker_map_lr,
ARRAY_SIZE(speaker_map_lr));
if (ret) {
dev_err(rtd->dev, "fail to add rt1011 routes, ret %d\n",
@@ -225,24 +226,21 @@ static int rt1011_init(struct snd_soc_pcm_runtime *rtd)
*/
fallthrough;
case 4:
- ret = snd_soc_dapm_new_controls(&card->dapm, realtek_4spk_widgets,
- num_codecs);
+ ret = snd_soc_dapm_new_controls(dapm, realtek_4spk_widgets, num_codecs);
if (ret) {
dev_err(rtd->dev, "fail to add rt1011 widgets, ret %d\n",
ret);
return ret;
}
- ret = snd_soc_add_card_controls(card, realtek_4spk_kcontrols,
- num_codecs);
+ ret = snd_soc_add_card_controls(card, realtek_4spk_kcontrols, num_codecs);
if (ret) {
dev_err(rtd->dev, "fail to add rt1011 controls, ret %d\n",
ret);
return ret;
}
- ret = snd_soc_dapm_add_routes(&card->dapm, rt1011_4spk_routes,
- num_codecs);
+ ret = snd_soc_dapm_add_routes(dapm, rt1011_4spk_routes, num_codecs);
if (ret) {
dev_err(rtd->dev, "fail to add rt1011 routes, ret %d\n",
ret);
@@ -344,9 +342,10 @@ static const struct snd_soc_ops rt1015p_ops = {
static int rt1015p_init(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_card *card = rtd->card;
+ struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card);
int ret;
- ret = snd_soc_dapm_new_controls(&card->dapm, realtek_2spk_widgets,
+ ret = snd_soc_dapm_new_controls(dapm, realtek_2spk_widgets,
ARRAY_SIZE(realtek_2spk_widgets));
if (ret) {
dev_err(rtd->dev, "fail to add rt1015p widgets, ret %d\n", ret);
@@ -360,7 +359,7 @@ static int rt1015p_init(struct snd_soc_pcm_runtime *rtd)
return ret;
}
- ret = snd_soc_dapm_add_routes(&card->dapm, rt1015p_dapm_routes,
+ ret = snd_soc_dapm_add_routes(dapm, rt1015p_dapm_routes,
ARRAY_SIZE(rt1015p_dapm_routes));
if (ret)
dev_err(rtd->dev, "Speaker map addition failed: %d\n", ret);
@@ -481,12 +480,13 @@ static struct snd_soc_dai_link_component rt1015_components[] = {
static int speaker_codec_init_lr(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_card *card = rtd->card;
+ struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card);
unsigned int num_codecs = get_num_codecs(RT1015_ACPI_HID);
int ret;
switch (num_codecs) {
case 2:
- ret = snd_soc_dapm_new_controls(&card->dapm, realtek_2spk_widgets,
+ ret = snd_soc_dapm_new_controls(dapm, realtek_2spk_widgets,
ARRAY_SIZE(realtek_2spk_widgets));
if (ret) {
dev_err(rtd->dev, "fail to add rt1015 widgets, ret %d\n",
@@ -502,7 +502,7 @@ static int speaker_codec_init_lr(struct snd_soc_pcm_runtime *rtd)
return ret;
}
- ret = snd_soc_dapm_add_routes(&rtd->card->dapm, speaker_map_lr,
+ ret = snd_soc_dapm_add_routes(dapm, speaker_map_lr,
ARRAY_SIZE(speaker_map_lr));
if (ret) {
dev_err(rtd->dev, "fail to add rt1015 routes, ret %d\n",
@@ -561,9 +561,10 @@ static struct snd_soc_dai_link_component rt1308_components[] = {
static int rt1308_init(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_card *card = rtd->card;
+ struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card);
int ret;
- ret = snd_soc_dapm_new_controls(&card->dapm, rt1308_dapm_widgets,
+ ret = snd_soc_dapm_new_controls(dapm, rt1308_dapm_widgets,
ARRAY_SIZE(rt1308_dapm_widgets));
if (ret) {
dev_err(rtd->dev, "fail to add dapm controls, ret %d\n", ret);
@@ -577,7 +578,7 @@ static int rt1308_init(struct snd_soc_pcm_runtime *rtd)
return ret;
}
- ret = snd_soc_dapm_add_routes(&card->dapm, rt1308_dapm_routes,
+ ret = snd_soc_dapm_add_routes(dapm, rt1308_dapm_routes,
ARRAY_SIZE(rt1308_dapm_routes));
if (ret)
@@ -650,9 +651,10 @@ static struct snd_soc_dai_link_component rt1019p_components[] = {
static int rt1019p_init(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_card *card = rtd->card;
+ struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card);
int ret;
- ret = snd_soc_dapm_new_controls(&card->dapm, realtek_2spk_widgets,
+ ret = snd_soc_dapm_new_controls(dapm, realtek_2spk_widgets,
ARRAY_SIZE(realtek_2spk_widgets));
if (ret) {
dev_err(rtd->dev, "fail to add rt1019p widgets, ret %d\n", ret);
@@ -666,7 +668,7 @@ static int rt1019p_init(struct snd_soc_pcm_runtime *rtd)
return ret;
}
- ret = snd_soc_dapm_add_routes(&card->dapm, rt1019p_dapm_routes,
+ ret = snd_soc_dapm_add_routes(dapm, rt1019p_dapm_routes,
ARRAY_SIZE(rt1019p_dapm_routes));
if (ret) {
dev_err(rtd->dev, "Speaker map addition failed: %d\n", ret);
diff --git a/sound/soc/intel/boards/sof_rt5682.c b/sound/soc/intel/boards/sof_rt5682.c
index 4994aaccc583..3d9d8a97d153 100644
--- a/sound/soc/intel/boards/sof_rt5682.c
+++ b/sound/soc/intel/boards/sof_rt5682.c
@@ -35,6 +35,10 @@
static unsigned long sof_rt5682_quirk = SOF_RT5682_MCLK_EN |
SOF_SSP_PORT_CODEC(0);
+static int quirk_override = -1;
+module_param_named(quirk, quirk_override, int, 0444);
+MODULE_PARM_DESC(quirk, "Board-specific quirk override");
+
static int sof_rt5682_quirk_cb(const struct dmi_system_id *id)
{
sof_rt5682_quirk = (unsigned long)id->driver_data;
@@ -404,7 +408,7 @@ static const struct snd_soc_ops sof_rt5682_ops = {
static int sof_card_late_probe(struct snd_soc_card *card)
{
struct sof_card_private *ctx = snd_soc_card_get_drvdata(card);
- struct snd_soc_dapm_context *dapm = &card->dapm;
+ struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card);
int err;
if (ctx->amp_type == CODEC_MAX98373) {
@@ -458,9 +462,10 @@ static const struct snd_soc_dapm_route rt5650_spk_dapm_routes[] = {
static int rt5650_spk_init(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_card *card = rtd->card;
+ struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card);
int ret;
- ret = snd_soc_dapm_new_controls(&card->dapm, rt5650_spk_widgets,
+ ret = snd_soc_dapm_new_controls(dapm, rt5650_spk_widgets,
ARRAY_SIZE(rt5650_spk_widgets));
if (ret) {
dev_err(rtd->dev, "fail to add rt5650 spk widgets, ret %d\n",
@@ -476,7 +481,7 @@ static int rt5650_spk_init(struct snd_soc_pcm_runtime *rtd)
return ret;
}
- ret = snd_soc_dapm_add_routes(&card->dapm, rt5650_spk_dapm_routes,
+ ret = snd_soc_dapm_add_routes(dapm, rt5650_spk_dapm_routes,
ARRAY_SIZE(rt5650_spk_dapm_routes));
if (ret)
dev_err(rtd->dev, "fail to add dapm routes, ret=%d\n", ret);
@@ -643,6 +648,12 @@ static int sof_audio_probe(struct platform_device *pdev)
dmi_check_system(sof_rt5682_quirk_table);
+ if (quirk_override != -1) {
+ dev_info(&pdev->dev, "Overriding quirk 0x%lx => 0x%x\n",
+ sof_rt5682_quirk, quirk_override);
+ sof_rt5682_quirk = quirk_override;
+ }
+
dev_dbg(&pdev->dev, "sof_rt5682_quirk = %lx\n", sof_rt5682_quirk);
/* initialize ctx with board quirk */
diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c
index c013e31d098e..2c1001148d54 100644
--- a/sound/soc/intel/boards/sof_sdw.c
+++ b/sound/soc/intel/boards/sof_sdw.c
@@ -231,6 +231,20 @@ static const struct dmi_system_id sof_sdw_quirk_table[] = {
RT711_JD1),
},
{
+ /*
+ * Avell B.ON (OEM rebrand of NUC15 'Bishop County' LAPBC510 and
+ * LAPBC710)
+ */
+ .callback = sof_sdw_quirk_cb,
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "Avell High Performance"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "B.ON"),
+ },
+ .driver_data = (void *)(SOF_SDW_TGL_HDMI |
+ SOC_SDW_PCH_DMIC |
+ RT711_JD1),
+ },
+ {
/* NUC15 'Rooks County' LAPRC510 and LAPRC710 skews */
.callback = sof_sdw_quirk_cb,
.matches = {
@@ -761,6 +775,28 @@ static const struct dmi_system_id sof_sdw_quirk_table[] = {
.callback = sof_sdw_quirk_cb,
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Google"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "Lapis"),
+ },
+ .driver_data = (void *)(SOC_SDW_CODEC_SPKR |
+ SOC_SDW_PCH_DMIC |
+ SOF_BT_OFFLOAD_SSP(2) |
+ SOF_SSP_BT_OFFLOAD_PRESENT),
+ },
+ {
+ .callback = sof_sdw_quirk_cb,
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "Google"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "Francka"),
+ },
+ .driver_data = (void *)(SOC_SDW_CODEC_SPKR |
+ SOC_SDW_PCH_DMIC |
+ SOF_BT_OFFLOAD_SSP(2) |
+ SOF_SSP_BT_OFFLOAD_PRESENT),
+ },
+ {
+ .callback = sof_sdw_quirk_cb,
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "Google"),
DMI_MATCH(DMI_PRODUCT_FAMILY, "Google_Fatcat"),
},
.driver_data = (void *)(SOC_SDW_PCH_DMIC |
@@ -1113,15 +1149,22 @@ static int create_bt_dailinks(struct snd_soc_card *card,
struct snd_soc_dai_link **dai_links, int *be_id)
{
struct device *dev = card->dev;
- int port = (sof_sdw_quirk & SOF_BT_OFFLOAD_SSP_MASK) >>
- SOF_BT_OFFLOAD_SSP_SHIFT;
- char *name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-BT", port);
- char *cpu_dai_name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d Pin", port);
+ struct snd_soc_acpi_mach *mach = dev_get_platdata(dev);
+ char *cpu_dai_name;
+ char *name;
+ int port;
+ int ret;
+
+ if (sof_sdw_quirk & SOF_SSP_BT_OFFLOAD_PRESENT)
+ port = (sof_sdw_quirk & SOF_BT_OFFLOAD_SSP_MASK) >> SOF_BT_OFFLOAD_SSP_SHIFT;
+ else
+ port = fls(mach->mach_params.bt_link_mask) - 1;
+
+ name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-BT", port);
+ cpu_dai_name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d Pin", port);
if (!name || !cpu_dai_name)
return -ENOMEM;
- int ret;
-
ret = asoc_sdw_init_simple_dai_link(dev, *dai_links, be_id, name,
1, 1, cpu_dai_name, "dummy",
snd_soc_dummy_dlc.name, snd_soc_dummy_dlc.dai_name,
@@ -1146,8 +1189,11 @@ static int sof_card_dai_links_create(struct snd_soc_card *card)
struct asoc_sdw_codec_info *ssp_info;
struct asoc_sdw_endpoint *sof_ends;
struct asoc_sdw_dailink *sof_dais;
+ struct snd_soc_aux_dev *sof_aux;
int num_devs = 0;
int num_ends = 0;
+ int num_aux = 0;
+ int num_confs;
struct snd_soc_dai_link *dai_links;
int num_links;
int be_id = 0;
@@ -1155,12 +1201,14 @@ static int sof_card_dai_links_create(struct snd_soc_card *card)
unsigned long ssp_mask;
int ret;
- ret = asoc_sdw_count_sdw_endpoints(card, &num_devs, &num_ends);
+ ret = asoc_sdw_count_sdw_endpoints(card, &num_devs, &num_ends, &num_aux);
if (ret < 0) {
dev_err(dev, "failed to count devices/endpoints: %d\n", ret);
return ret;
}
+ num_confs = num_ends;
+
/*
* One per DAI link, worst case is a DAI link for every endpoint, also
* add one additional to act as a terminator such that code can iterate
@@ -1177,7 +1225,13 @@ static int sof_card_dai_links_create(struct snd_soc_card *card)
goto err_dai;
}
- ret = asoc_sdw_parse_sdw_endpoints(card, sof_dais, sof_ends, &num_devs);
+ sof_aux = devm_kcalloc(dev, num_aux, sizeof(*sof_aux), GFP_KERNEL);
+ if (!sof_aux) {
+ ret = -ENOMEM;
+ goto err_dai;
+ }
+
+ ret = asoc_sdw_parse_sdw_endpoints(card, sof_aux, sof_dais, sof_ends, &num_confs);
if (ret < 0)
goto err_end;
@@ -1218,14 +1272,14 @@ static int sof_card_dai_links_create(struct snd_soc_card *card)
mach_params->dmic_num = DMIC_DEFAULT_CHANNELS;
}
- if (sof_sdw_quirk & SOF_SSP_BT_OFFLOAD_PRESENT)
+ if (sof_sdw_quirk & SOF_SSP_BT_OFFLOAD_PRESENT || mach_params->bt_link_mask)
bt_num = 1;
dev_dbg(dev, "DAI link numbers: sdw %d, ssp %d, dmic %d, hdmi %d, bt: %d\n",
sdw_be_num, ssp_num, dmic_num,
intel_ctx->hdmi.idisp_codec ? hdmi_num : 0, bt_num);
- codec_conf = devm_kcalloc(dev, num_devs, sizeof(*codec_conf), GFP_KERNEL);
+ codec_conf = devm_kcalloc(dev, num_confs, sizeof(*codec_conf), GFP_KERNEL);
if (!codec_conf) {
ret = -ENOMEM;
goto err_end;
@@ -1240,9 +1294,11 @@ static int sof_card_dai_links_create(struct snd_soc_card *card)
}
card->codec_conf = codec_conf;
- card->num_configs = num_devs;
+ card->num_configs = num_confs;
card->dai_link = dai_links;
card->num_links = num_links;
+ card->aux_dev = sof_aux;
+ card->num_aux_devs = num_aux;
/* SDW */
if (sdw_be_num) {
@@ -1273,7 +1329,7 @@ static int sof_card_dai_links_create(struct snd_soc_card *card)
goto err_end;
/* BT */
- if (sof_sdw_quirk & SOF_SSP_BT_OFFLOAD_PRESENT) {
+ if (bt_num) {
ret = create_bt_dailinks(card, &dai_links, &be_id);
if (ret)
goto err_end;
diff --git a/sound/soc/intel/catpt/device.c b/sound/soc/intel/catpt/device.c
index faa916f40069..d13062c8e907 100644
--- a/sound/soc/intel/catpt/device.c
+++ b/sound/soc/intel/catpt/device.c
@@ -28,7 +28,7 @@
#define CREATE_TRACE_POINTS
#include "trace.h"
-static int catpt_suspend(struct device *dev)
+static int catpt_do_suspend(struct device *dev)
{
struct catpt_dev *cdev = dev_get_drvdata(dev);
struct dma_chan *chan;
@@ -72,6 +72,13 @@ release_dma_chan:
return catpt_dsp_power_down(cdev);
}
+/* Do not block the system from suspending, recover on resume() if needed. */
+static int catpt_suspend(struct device *dev)
+{
+ catpt_do_suspend(dev);
+ return 0;
+}
+
static int catpt_resume(struct device *dev)
{
struct catpt_dev *cdev = dev_get_drvdata(dev);
@@ -114,7 +121,7 @@ static int catpt_runtime_suspend(struct device *dev)
}
module_put(dev->driver->owner);
- return catpt_suspend(dev);
+ return catpt_do_suspend(dev);
}
static int catpt_runtime_resume(struct device *dev)
@@ -184,22 +191,25 @@ static int catpt_probe_components(struct catpt_dev *cdev)
goto err_boot_fw;
}
- ret = catpt_register_board(cdev);
- if (ret) {
- dev_err(cdev->dev, "register board failed: %d\n", ret);
- goto err_reg_board;
- }
-
/* reflect actual ADSP state in pm_runtime */
pm_runtime_set_active(cdev->dev);
pm_runtime_set_autosuspend_delay(cdev->dev, 2000);
pm_runtime_use_autosuspend(cdev->dev);
pm_runtime_mark_last_busy(cdev->dev);
+ /* Enable PM before spawning child device. See catpt_dai_pcm_new(). */
pm_runtime_enable(cdev->dev);
+
+ ret = catpt_register_board(cdev);
+ if (ret) {
+ dev_err(cdev->dev, "register board failed: %d\n", ret);
+ goto err_reg_board;
+ }
+
return 0;
err_reg_board:
+ pm_runtime_disable(cdev->dev);
snd_soc_unregister_component(cdev->dev);
err_boot_fw:
catpt_dmac_remove(cdev);
diff --git a/sound/soc/intel/catpt/loader.c b/sound/soc/intel/catpt/loader.c
index 696d84314eeb..f5705cd2c1e1 100644
--- a/sound/soc/intel/catpt/loader.c
+++ b/sound/soc/intel/catpt/loader.c
@@ -208,6 +208,7 @@ static int catpt_restore_memdumps(struct catpt_dev *cdev, struct dma_chan *chan)
for (i = 0; i < cdev->dx_ctx.num_meminfo; i++) {
struct catpt_save_meminfo *info;
+ struct resource r = {};
u32 off;
int ret;
@@ -216,7 +217,8 @@ static int catpt_restore_memdumps(struct catpt_dev *cdev, struct dma_chan *chan)
continue;
off = catpt_to_host_offset(info->offset);
- if (off < cdev->dram.start || off > cdev->dram.end)
+ resource_set_range(&r, off, info->size);
+ if (!resource_contains(&cdev->dram, &r))
continue;
dev_dbg(cdev->dev, "restoring memdump: off 0x%08x size %d\n",
@@ -239,34 +241,32 @@ static int catpt_restore_fwimage(struct catpt_dev *cdev,
struct dma_chan *chan, dma_addr_t paddr,
struct catpt_fw_block_hdr *blk)
{
- struct resource r1, r2, common;
+ struct resource r1 = {};
int i;
print_hex_dump_debug(__func__, DUMP_PREFIX_OFFSET, 8, 4,
blk, sizeof(*blk), false);
- r1.start = cdev->dram.start + blk->ram_offset;
- r1.end = r1.start + blk->size - 1;
+ resource_set_range(&r1, cdev->dram.start + blk->ram_offset, blk->size);
/* advance to data area */
paddr += sizeof(*blk);
for (i = 0; i < cdev->dx_ctx.num_meminfo; i++) {
struct catpt_save_meminfo *info;
+ struct resource common = {};
+ struct resource r2 = {};
u32 off;
int ret;
info = &cdev->dx_ctx.meminfo[i];
-
if (info->source != CATPT_DX_TYPE_FW_IMAGE)
continue;
off = catpt_to_host_offset(info->offset);
- if (off < cdev->dram.start || off > cdev->dram.end)
+ resource_set_range(&r2, off, info->size);
+ if (!resource_contains(&cdev->dram, &r2))
continue;
- r2.start = off;
- r2.end = r2.start + info->size - 1;
-
if (!resource_intersection(&r2, &r1, &common))
continue;
/* calculate start offset of common data area */
diff --git a/sound/soc/intel/catpt/pcm.c b/sound/soc/intel/catpt/pcm.c
index bf734c69c4e0..abd1cb07c60c 100644
--- a/sound/soc/intel/catpt/pcm.c
+++ b/sound/soc/intel/catpt/pcm.c
@@ -417,8 +417,10 @@ static int catpt_dai_hw_params(struct snd_pcm_substream *substream,
return CATPT_IPC_ERROR(ret);
ret = catpt_dai_apply_usettings(dai, stream);
- if (ret)
+ if (ret) {
+ catpt_ipc_free_stream(cdev, stream->info.stream_hw_id);
return ret;
+ }
stream->allocated = true;
return 0;
@@ -669,7 +671,7 @@ static int catpt_dai_pcm_new(struct snd_soc_pcm_runtime *rtm,
return 0;
ret = pm_runtime_resume_and_get(cdev->dev);
- if (ret < 0 && ret != -EACCES)
+ if (ret)
return ret;
ret = catpt_ipc_set_device_format(cdev, &devfmt);
@@ -865,15 +867,14 @@ static int catpt_volume_info(struct snd_kcontrol *kcontrol,
static int catpt_mixer_volume_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_component *component =
- snd_soc_kcontrol_component(kcontrol);
+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
struct catpt_dev *cdev = dev_get_drvdata(component->dev);
u32 dspvol;
int ret;
int i;
ret = pm_runtime_resume_and_get(cdev->dev);
- if (ret < 0 && ret != -EACCES)
+ if (ret)
return ret;
for (i = 0; i < CATPT_CHANNELS_MAX; i++) {
@@ -889,13 +890,12 @@ static int catpt_mixer_volume_get(struct snd_kcontrol *kcontrol,
static int catpt_mixer_volume_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_component *component =
- snd_soc_kcontrol_component(kcontrol);
+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
struct catpt_dev *cdev = dev_get_drvdata(component->dev);
int ret;
ret = pm_runtime_resume_and_get(cdev->dev);
- if (ret < 0 && ret != -EACCES)
+ if (ret)
return ret;
ret = catpt_set_dspvol(cdev, cdev->mixer.mixer_hw_id,
@@ -910,8 +910,7 @@ static int catpt_stream_volume_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol,
enum catpt_pin_id pin_id)
{
- struct snd_soc_component *component =
- snd_soc_kcontrol_component(kcontrol);
+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
struct catpt_stream_runtime *stream;
struct catpt_dev *cdev = dev_get_drvdata(component->dev);
long *ctlvol = (long *)kcontrol->private_value;
@@ -927,7 +926,7 @@ static int catpt_stream_volume_get(struct snd_kcontrol *kcontrol,
}
ret = pm_runtime_resume_and_get(cdev->dev);
- if (ret < 0 && ret != -EACCES)
+ if (ret)
return ret;
for (i = 0; i < CATPT_CHANNELS_MAX; i++) {
@@ -944,8 +943,7 @@ static int catpt_stream_volume_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol,
enum catpt_pin_id pin_id)
{
- struct snd_soc_component *component =
- snd_soc_kcontrol_component(kcontrol);
+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
struct catpt_stream_runtime *stream;
struct catpt_dev *cdev = dev_get_drvdata(component->dev);
long *ctlvol = (long *)kcontrol->private_value;
@@ -959,7 +957,7 @@ static int catpt_stream_volume_put(struct snd_kcontrol *kcontrol,
}
ret = pm_runtime_resume_and_get(cdev->dev);
- if (ret < 0 && ret != -EACCES)
+ if (ret)
return ret;
ret = catpt_set_dspvol(cdev, stream->info.stream_hw_id,
@@ -1021,8 +1019,7 @@ static int catpt_loopback_switch_get(struct snd_kcontrol *kcontrol,
static int catpt_loopback_switch_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_component *component =
- snd_soc_kcontrol_component(kcontrol);
+ struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
struct catpt_stream_runtime *stream;
struct catpt_dev *cdev = dev_get_drvdata(component->dev);
bool mute;
@@ -1036,7 +1033,7 @@ static int catpt_loopback_switch_put(struct snd_kcontrol *kcontrol,
}
ret = pm_runtime_resume_and_get(cdev->dev);
- if (ret < 0 && ret != -EACCES)
+ if (ret)
return ret;
ret = catpt_ipc_mute_loopback(cdev, stream->info.stream_hw_id, mute);
diff --git a/sound/soc/intel/catpt/sysfs.c b/sound/soc/intel/catpt/sysfs.c
index 048253002ec8..e961e172f9b7 100644
--- a/sound/soc/intel/catpt/sysfs.c
+++ b/sound/soc/intel/catpt/sysfs.c
@@ -16,7 +16,7 @@ static ssize_t fw_version_show(struct device *dev,
int ret;
ret = pm_runtime_resume_and_get(cdev->dev);
- if (ret < 0 && ret != -EACCES)
+ if (ret)
return ret;
ret = catpt_ipc_get_fw_version(cdev, &version);
diff --git a/sound/soc/intel/common/Makefile b/sound/soc/intel/common/Makefile
index 7822bcae6c69..dbfd9e2ac015 100644
--- a/sound/soc/intel/common/Makefile
+++ b/sound/soc/intel/common/Makefile
@@ -11,6 +11,7 @@ snd-soc-acpi-intel-match-y := soc-acpi-intel-byt-match.o soc-acpi-intel-cht-matc
soc-acpi-intel-arl-match.o \
soc-acpi-intel-lnl-match.o \
soc-acpi-intel-ptl-match.o \
+ soc-acpi-intel-nvl-match.o \
soc-acpi-intel-hda-match.o \
soc-acpi-intel-sdw-mockup-match.o sof-function-topology-lib.o
diff --git a/sound/soc/intel/common/soc-acpi-intel-nvl-match.c b/sound/soc/intel/common/soc-acpi-intel-nvl-match.c
new file mode 100644
index 000000000000..2768dd10aaa0
--- /dev/null
+++ b/sound/soc/intel/common/soc-acpi-intel-nvl-match.c
@@ -0,0 +1,90 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * soc-acpi-intel-nvl-match.c - tables and support for NVL ACPI enumeration.
+ *
+ * Copyright (c) 2025, Intel Corporation.
+ *
+ */
+
+#include <sound/soc-acpi.h>
+#include <sound/soc-acpi-intel-match.h>
+#include "soc-acpi-intel-sdw-mockup-match.h"
+
+struct snd_soc_acpi_mach snd_soc_acpi_intel_nvl_machines[] = {
+ {},
+};
+EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_nvl_machines);
+
+/*
+ * Multi-function codecs with three endpoints created for
+ * headset, amp and dmic functions.
+ */
+static const struct snd_soc_acpi_endpoint rt_mf_endpoints[] = {
+ {
+ .num = 0,
+ .aggregated = 0,
+ .group_position = 0,
+ .group_id = 0,
+ },
+ {
+ .num = 1,
+ .aggregated = 0,
+ .group_position = 0,
+ .group_id = 0,
+ },
+ {
+ .num = 2,
+ .aggregated = 0,
+ .group_position = 0,
+ .group_id = 0,
+ },
+};
+
+static const struct snd_soc_acpi_adr_device rt722_3_single_adr[] = {
+ {
+ .adr = 0x000330025d072201ull,
+ .num_endpoints = ARRAY_SIZE(rt_mf_endpoints),
+ .endpoints = rt_mf_endpoints,
+ .name_prefix = "rt722"
+ }
+};
+
+static const struct snd_soc_acpi_link_adr nvl_rt722_l3[] = {
+ {
+ .mask = BIT(3),
+ .num_adr = ARRAY_SIZE(rt722_3_single_adr),
+ .adr_d = rt722_3_single_adr,
+ },
+ {}
+};
+
+/* this table is used when there is no I2S codec present */
+struct snd_soc_acpi_mach snd_soc_acpi_intel_nvl_sdw_machines[] = {
+ /* mockup tests need to be first */
+ {
+ .link_mask = GENMASK(3, 0),
+ .links = sdw_mockup_headset_2amps_mic,
+ .drv_name = "sof_sdw",
+ .sof_tplg_filename = "sof-nvl-rt711-rt1308-rt715.tplg",
+ },
+ {
+ .link_mask = BIT(0) | BIT(1) | BIT(3),
+ .links = sdw_mockup_headset_1amp_mic,
+ .drv_name = "sof_sdw",
+ .sof_tplg_filename = "sof-nvl-rt711-rt1308-mono-rt715.tplg",
+ },
+ {
+ .link_mask = GENMASK(2, 0),
+ .links = sdw_mockup_mic_headset_1amp,
+ .drv_name = "sof_sdw",
+ .sof_tplg_filename = "sof-nvl-rt715-rt711-rt1308-mono.tplg",
+ },
+ {
+ .link_mask = BIT(3),
+ .links = nvl_rt722_l3,
+ .drv_name = "sof_sdw",
+ .sof_tplg_filename = "sof-nvl-rt722.tplg",
+ },
+ {},
+};
+EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_nvl_sdw_machines);
diff --git a/sound/soc/intel/common/soc-acpi-intel-ptl-match.c b/sound/soc/intel/common/soc-acpi-intel-ptl-match.c
index 3c8b10e21ceb..060955825fe0 100644
--- a/sound/soc/intel/common/soc-acpi-intel-ptl-match.c
+++ b/sound/soc/intel/common/soc-acpi-intel-ptl-match.c
@@ -227,33 +227,6 @@ static const struct snd_soc_acpi_endpoint cs42l43_amp_spkagg_endpoints[] = {
},
};
-static const struct snd_soc_acpi_endpoint cs42l43_endpoints[] = {
- { /* Jack Playback Endpoint */
- .num = 0,
- .aggregated = 0,
- .group_position = 0,
- .group_id = 0,
- },
- { /* DMIC Capture Endpoint */
- .num = 1,
- .aggregated = 0,
- .group_position = 0,
- .group_id = 0,
- },
- { /* Jack Capture Endpoint */
- .num = 2,
- .aggregated = 0,
- .group_position = 0,
- .group_id = 0,
- },
- { /* Speaker Playback Endpoint */
- .num = 3,
- .aggregated = 0,
- .group_position = 0,
- .group_id = 0,
- },
-};
-
static const struct snd_soc_acpi_adr_device cs42l43_2_adr[] = {
{
.adr = 0x00023001fa424301ull,
@@ -263,6 +236,30 @@ static const struct snd_soc_acpi_adr_device cs42l43_2_adr[] = {
}
};
+static const struct snd_soc_acpi_adr_device cs42l43_3_agg_adr[] = {
+ {
+ .adr = 0x00033001FA424301ull,
+ .num_endpoints = ARRAY_SIZE(cs42l43_amp_spkagg_endpoints),
+ .endpoints = cs42l43_amp_spkagg_endpoints,
+ .name_prefix = "cs42l43"
+ }
+};
+
+static const struct snd_soc_acpi_adr_device cs35l56_2_lr_adr[] = {
+ {
+ .adr = 0x00023001fa355601ull,
+ .num_endpoints = 1,
+ .endpoints = &spk_l_endpoint,
+ .name_prefix = "AMP1"
+ },
+ {
+ .adr = 0x00023101fa355601ull,
+ .num_endpoints = 1,
+ .endpoints = &spk_r_endpoint,
+ .name_prefix = "AMP2"
+ }
+};
+
static const struct snd_soc_acpi_adr_device cs35l56_1_3amp_adr[] = {
{
.adr = 0x00013001fa355601ull,
@@ -305,15 +302,6 @@ static const struct snd_soc_acpi_adr_device cs35l56_3_3amp_adr[] = {
}
};
-static const struct snd_soc_acpi_adr_device cs42l43_3_adr[] = {
- {
- .adr = 0x00033001FA424301ull,
- .num_endpoints = ARRAY_SIZE(cs42l43_endpoints),
- .endpoints = cs42l43_endpoints,
- .name_prefix = "cs42l43"
- }
-};
-
static const struct snd_soc_acpi_adr_device rt711_sdca_0_adr[] = {
{
.adr = 0x000030025D071101ull,
@@ -458,6 +446,15 @@ static const struct snd_soc_acpi_adr_device rt1320_2_group2_adr[] = {
}
};
+static const struct snd_soc_acpi_adr_device rt1320_2_group2_l_adr[] = {
+ {
+ .adr = 0x000230025D132001ull,
+ .num_endpoints = 1,
+ .endpoints = &spk_l_endpoint,
+ .name_prefix = "rt1320-1"
+ }
+};
+
static const struct snd_soc_acpi_adr_device rt1320_3_group2_adr[] = {
{
.adr = 0x000330025D132001ull,
@@ -467,6 +464,20 @@ static const struct snd_soc_acpi_adr_device rt1320_3_group2_adr[] = {
}
};
+static const struct snd_soc_acpi_link_adr ptl_cs42l43_agg_l3_cs35l56_l2[] = {
+ {
+ .mask = BIT(3),
+ .num_adr = ARRAY_SIZE(cs42l43_3_agg_adr),
+ .adr_d = cs42l43_3_agg_adr,
+ },
+ {
+ .mask = BIT(2),
+ .num_adr = ARRAY_SIZE(cs35l56_2_lr_adr),
+ .adr_d = cs35l56_2_lr_adr,
+ },
+ {}
+};
+
static const struct snd_soc_acpi_link_adr ptl_cs42l43_l2_cs35l56x6_l13[] = {
{
.mask = BIT(2),
@@ -486,15 +497,6 @@ static const struct snd_soc_acpi_link_adr ptl_cs42l43_l2_cs35l56x6_l13[] = {
{}
};
-static const struct snd_soc_acpi_link_adr ptl_cs42l43_l3[] = {
- {
- .mask = BIT(3),
- .num_adr = ARRAY_SIZE(cs42l43_3_adr),
- .adr_d = cs42l43_3_adr,
- },
- {}
-};
-
static const struct snd_soc_acpi_link_adr ptl_rt721_l0[] = {
{
.mask = BIT(0),
@@ -531,6 +533,25 @@ static const struct snd_soc_acpi_link_adr ptl_rt722_l3[] = {
{}
};
+static const struct snd_soc_acpi_link_adr ptl_rt722_l0_rt1320_l23[] = {
+ {
+ .mask = BIT(0),
+ .num_adr = ARRAY_SIZE(rt722_0_single_adr),
+ .adr_d = rt722_0_single_adr,
+ },
+ {
+ .mask = BIT(2),
+ .num_adr = ARRAY_SIZE(rt1320_2_group2_l_adr),
+ .adr_d = rt1320_2_group2_l_adr,
+ },
+ {
+ .mask = BIT(3),
+ .num_adr = ARRAY_SIZE(rt1320_3_group2_adr),
+ .adr_d = rt1320_3_group2_adr,
+ },
+ {}
+};
+
static const struct snd_soc_acpi_link_adr ptl_rvp[] = {
{
.mask = BIT(0),
@@ -670,6 +691,13 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_ptl_sdw_machines[] = {
.sof_tplg_filename = "sof-ptl-cs42l43-l2-cs35l56x6-l13.tplg",
},
{
+ .link_mask = BIT(0) | BIT(2) | BIT(3),
+ .links = ptl_rt722_l0_rt1320_l23,
+ .drv_name = "sof_sdw",
+ .sof_tplg_filename = "sof-ptl-rt722-l0-rt1320-l23.tplg",
+ .get_function_tplg_files = sof_sdw_get_tplg_files,
+ },
+ {
.link_mask = BIT(1) | BIT(2),
.links = ptl_sdw_rt712_vb_l2_rt1320_l1,
.drv_name = "sof_sdw",
@@ -686,6 +714,12 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_ptl_sdw_machines[] = {
.get_function_tplg_files = sof_sdw_get_tplg_files,
},
{
+ .link_mask = BIT(2) | BIT(3),
+ .links = ptl_cs42l43_agg_l3_cs35l56_l2,
+ .drv_name = "sof_sdw",
+ .sof_tplg_filename = "sof-ptl-cs42l43-agg-l3-cs35l56-l2.tplg",
+ },
+ {
.link_mask = BIT(0),
.links = ptl_rvp,
.drv_name = "sof_sdw",
@@ -714,13 +748,6 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_ptl_sdw_machines[] = {
},
{
.link_mask = BIT(3),
- .links = ptl_cs42l43_l3,
- .drv_name = "sof_sdw",
- .sof_tplg_filename = "sof-ptl-cs42l43-l3.tplg",
- .get_function_tplg_files = sof_sdw_get_tplg_files,
- },
- {
- .link_mask = BIT(3),
.links = ptl_sdw_rt712_vb_l3_rt1320_l3,
.drv_name = "sof_sdw",
.machine_check = snd_soc_acpi_intel_sdca_is_device_rt712_vb,
diff --git a/sound/soc/intel/common/sof-function-topology-lib.c b/sound/soc/intel/common/sof-function-topology-lib.c
index 3cc81dcf047e..b10d4794159a 100644
--- a/sound/soc/intel/common/sof-function-topology-lib.c
+++ b/sound/soc/intel/common/sof-function-topology-lib.c
@@ -126,11 +126,15 @@ int sof_sdw_get_tplg_files(struct snd_soc_card *card, const struct snd_soc_acpi_
if (!ret) {
release_firmware(fw);
} else {
- dev_dbg(card->dev, "Failed to open topology file: %s\n", (*tplg_files)[i]);
+ dev_warn(card->dev,
+ "Failed to open topology file: %s, you might need to\n",
+ (*tplg_files)[i]);
+ dev_warn(card->dev,
+ "download it from https://github.com/thesofproject/sof-bin/\n");
return 0;
}
}
return tplg_num;
}
-
+EXPORT_SYMBOL_GPL(sof_sdw_get_tplg_files);