[12/12] ASoC: Intel: sof_rt5682: Add compress probe DAI links
diff mbox series

Message ID 20200124190413.18154-13-cezary.rojewski@intel.com
State New
Headers show
Series
  • ASoC: SOF: Data probing
Related show

Commit Message

Cezary Rojewski Jan. 24, 2020, 7:04 p.m. UTC
Assign probe DAI link to actively used SOF machine boards.
For current upstream, it is only sof_rt5682.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 sound/soc/intel/boards/sof_rt5682.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

Comments

Pierre-Louis Bossart Jan. 24, 2020, 7:31 p.m. UTC | #1
On 1/24/20 1:04 PM, Cezary Rojewski wrote:
> Assign probe DAI link to actively used SOF machine boards.
> For current upstream, it is only sof_rt5682.

This patch should really be an example, do we really want this upstream 
as is?
I'd like to have 'clean' support for probes once Ranjani's multi-client 
work is available, without changes to any machine driver.

> 
> Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
> ---
>   sound/soc/intel/boards/sof_rt5682.c | 20 ++++++++++++++++++--
>   1 file changed, 18 insertions(+), 2 deletions(-)
> 
> diff --git a/sound/soc/intel/boards/sof_rt5682.c b/sound/soc/intel/boards/sof_rt5682.c
> index 5d878873a8e0..8c26214b19d3 100644
> --- a/sound/soc/intel/boards/sof_rt5682.c
> +++ b/sound/soc/intel/boards/sof_rt5682.c
> @@ -417,6 +417,8 @@ static struct snd_soc_dai_link_component max98357a_component[] = {
>   	}
>   };
>   
> +SND_SOC_DAILINK_DEF(dummy, DAILINK_COMP_ARRAY(COMP_DUMMY()));
> +
>   static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev,
>   							  int ssp_codec,
>   							  int ssp_amp,
> @@ -580,8 +582,22 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev,
>   			if (!links[id].cpus->dai_name)
>   				goto devm_err;
>   		}
> +		id++;
>   	}
>   
> +#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_PROBES)
> +	links[id].name = "Compress Probe Capture";
> +	links[id].id = id;
> +	links[id].cpus = &cpus[id];
> +	links[id].num_cpus = 1;
> +	links[id].cpus->dai_name = "Probe Extraction CPU DAI";
> +	links[id].codecs = dummy;
> +	links[id].num_codecs = 1;
> +	links[id].platforms = platform_component;
> +	links[id].num_platforms = ARRAY_SIZE(platform_component);
> +	links[id].nonatomic = 1;
> +#endif
> +
>   	return links;
>   devm_err:
>   	return NULL;
> @@ -656,8 +672,8 @@ static int sof_audio_probe(struct platform_device *pdev)
>   
>   	ssp_codec = sof_rt5682_quirk & SOF_RT5682_SSP_CODEC_MASK;
>   
> -	/* compute number of dai links */
> -	sof_audio_card_rt5682.num_links = 1 + dmic_be_num + hdmi_num;
> +	/* account for SSP and probes when computing total dai link count */
> +	sof_audio_card_rt5682.num_links = 1 + dmic_be_num + hdmi_num + 1;
>   
>   	if (sof_rt5682_quirk & SOF_SPEAKER_AMP_PRESENT)
>   		sof_audio_card_rt5682.num_links++;
>
Cezary Rojewski Jan. 27, 2020, 12:32 p.m. UTC | #2
On 2020-01-24 20:31, Pierre-Louis Bossart wrote:
> On 1/24/20 1:04 PM, Cezary Rojewski wrote:
>> Assign probe DAI link to actively used SOF machine boards.
>> For current upstream, it is only sof_rt5682.
> 
> This patch should really be an example, do we really want this upstream 
> as is?
> I'd like to have 'clean' support for probes once Ranjani's multi-client 
> work is available, without changes to any machine driver.
> 

Removed from probes patchset in v2 as requested.

Patch
diff mbox series

diff --git a/sound/soc/intel/boards/sof_rt5682.c b/sound/soc/intel/boards/sof_rt5682.c
index 5d878873a8e0..8c26214b19d3 100644
--- a/sound/soc/intel/boards/sof_rt5682.c
+++ b/sound/soc/intel/boards/sof_rt5682.c
@@ -417,6 +417,8 @@  static struct snd_soc_dai_link_component max98357a_component[] = {
 	}
 };
 
+SND_SOC_DAILINK_DEF(dummy, DAILINK_COMP_ARRAY(COMP_DUMMY()));
+
 static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev,
 							  int ssp_codec,
 							  int ssp_amp,
@@ -580,8 +582,22 @@  static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev,
 			if (!links[id].cpus->dai_name)
 				goto devm_err;
 		}
+		id++;
 	}
 
+#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_PROBES)
+	links[id].name = "Compress Probe Capture";
+	links[id].id = id;
+	links[id].cpus = &cpus[id];
+	links[id].num_cpus = 1;
+	links[id].cpus->dai_name = "Probe Extraction CPU DAI";
+	links[id].codecs = dummy;
+	links[id].num_codecs = 1;
+	links[id].platforms = platform_component;
+	links[id].num_platforms = ARRAY_SIZE(platform_component);
+	links[id].nonatomic = 1;
+#endif
+
 	return links;
 devm_err:
 	return NULL;
@@ -656,8 +672,8 @@  static int sof_audio_probe(struct platform_device *pdev)
 
 	ssp_codec = sof_rt5682_quirk & SOF_RT5682_SSP_CODEC_MASK;
 
-	/* compute number of dai links */
-	sof_audio_card_rt5682.num_links = 1 + dmic_be_num + hdmi_num;
+	/* account for SSP and probes when computing total dai link count */
+	sof_audio_card_rt5682.num_links = 1 + dmic_be_num + hdmi_num + 1;
 
 	if (sof_rt5682_quirk & SOF_SPEAKER_AMP_PRESENT)
 		sof_audio_card_rt5682.num_links++;