linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: Terry Chen <terry_chen@wistron.corp-partner.google.com>,
	alsa-devel@alsa-project.org
Cc: cezary.rojewski@intel.com, liam.r.girdwood@linux.intel.com,
	yang.jie@linux.intel.com, broonie@kernel.org, perex@perex.cz,
	tiwai@suse.com, brent.lu@intel.com, cujomalainey@chromium.org,
	seanpaul@chromium.org, casey.g.bowman@intel.com,
	mark_hsieh@wistron.corp-partner.google.com,
	vamshi.krishna.gopal@intel.com, mac.chiang@intel.com,
	kai.vehmanen@linux.intel.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] [v2] ASoC: Intel: sof_cs42l42: adding support for ADL configuration and BT offload audio
Date: Tue, 10 May 2022 09:40:34 -0500	[thread overview]
Message-ID: <190c9add-7fa4-8e76-bfcb-43d30f22f8d9@linux.intel.com> (raw)
In-Reply-To: <20220510104829.1466968-1-terry_chen@wistron.corp-partner.google.com>




> +static int create_bt_offload_dai_links(struct device *dev,
> +				       struct snd_soc_dai_link *links,
> +				       struct snd_soc_dai_link_component *cpus,
> +				       int *id, int ssp_bt)
> +{
> +	int ret = 0;

this variable is not used in the rest of this function, something's not
right here...

> +	/* bt offload */
> +	if (!(sof_cs42l42_quirk & SOF_BT_OFFLOAD_PRESENT))
> +		return 0;
> +
> +	links[*id].name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-BT",
> +					 ssp_bt);
> +	if (!links[*id].name)
> +		goto devm_err;

is this missing ret = -ENOMEM?

> +
> +	links[*id].id = *id;
> +	links[*id].codecs = dummy_component;
> +	links[*id].num_codecs = ARRAY_SIZE(dummy_component);
> +	links[*id].platforms = platform_component;
> +	links[*id].num_platforms = ARRAY_SIZE(platform_component);
> +
> +	links[*id].dpcm_playback = 1;
> +	links[*id].dpcm_capture = 1;
> +	links[*id].no_pcm = 1;
> +	links[*id].cpus = &cpus[*id];
> +	links[*id].num_cpus = 1;
> +
> +	links[*id].cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL,
> +						   "SSP%d Pin",
> +						   ssp_bt);
> +	if (!links[*id].cpus->dai_name)
> +		goto devm_err;

same here, ret = -ENOMEM; ?

> +
> +	(*id)++;
> +
> +	return 0;
> +
> +devm_err:
> +	return ret;

or use what the existing code does for other links:

devm_err:
	return -ENOMEM;


> +}
> +
>  static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev,
>  							  int ssp_codec,
>  							  int ssp_amp,
> +							  int ssp_bt,
>  							  int dmic_be_num,
>  							  int hdmi_num)
>  {
> @@ -522,6 +578,14 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev,
>  				goto devm_err;
>  			}
>  			break;
> +		case LINK_BT:
> +			ret = create_bt_offload_dai_links(dev, links, cpus, &id, ssp_bt);
> +			if (ret < 0) {
> +				dev_err(dev, "fail to create bt offload dai links, ret %d\n",
> +					ret);

one line?

> +				goto devm_err;
> +			}
> +			break;
>  		case LINK_NONE:
>  			/* caught here if it's not used as terminator in macro */
>  		default:
> @@ -543,7 +607,7 @@ static int sof_audio_probe(struct platform_device *pdev)
>  	struct snd_soc_acpi_mach *mach;
>  	struct sof_card_private *ctx;
>  	int dmic_be_num, hdmi_num;
> -	int ret, ssp_amp, ssp_codec;
> +	int ret, ssp_bt, ssp_amp, ssp_codec;
>  
>  	ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL);
>  	if (!ctx)
> @@ -568,6 +632,9 @@ static int sof_audio_probe(struct platform_device *pdev)
>  
>  	dev_dbg(&pdev->dev, "sof_cs42l42_quirk = %lx\n", sof_cs42l42_quirk);
>  
> +	ssp_bt = (sof_cs42l42_quirk & SOF_CS42L42_SSP_BT_MASK) >>
> +			SOF_CS42L42_SSP_BT_SHIFT;
> +
>  	ssp_amp = (sof_cs42l42_quirk & SOF_CS42L42_SSP_AMP_MASK) >>
>  			SOF_CS42L42_SSP_AMP_SHIFT;
>  
> @@ -578,9 +645,11 @@ static int sof_audio_probe(struct platform_device *pdev)
>  
>  	if (sof_cs42l42_quirk & SOF_SPEAKER_AMP_PRESENT)
>  		sof_audio_card_cs42l42.num_links++;
> +	if (sof_cs42l42_quirk & SOF_BT_OFFLOAD_PRESENT)
> +		sof_audio_card_cs42l42.num_links++;
>  
>  	dai_links = sof_card_dai_links_create(&pdev->dev, ssp_codec, ssp_amp,
> -					      dmic_be_num, hdmi_num);
> +					      ssp_bt, dmic_be_num, hdmi_num);
>  	if (!dai_links)
>  		return -ENOMEM;
>  
> @@ -621,6 +690,17 @@ static const struct platform_device_id board_ids[] = {
>  					SOF_CS42L42_SSP_AMP(1)) |
>  					SOF_CS42L42_DAILINK(LINK_HP, LINK_DMIC, LINK_HDMI, LINK_SPK, LINK_NONE),
>  	},
> +	{
> +		.name = "adl_mx98360a_cs4242",
> +		.driver_data = (kernel_ulong_t)(SOF_CS42L42_SSP_CODEC(0) |
> +					SOF_SPEAKER_AMP_PRESENT |
> +					SOF_MAX98360A_SPEAKER_AMP_PRESENT |
> +					SOF_CS42L42_SSP_AMP(1) |
> +					SOF_CS42L42_NUM_HDMIDEV(4) |
> +					SOF_BT_OFFLOAD_PRESENT |
> +					SOF_CS42L42_SSP_BT(2)) |
> +					SOF_CS42L42_DAILINK(LINK_HP, LINK_DMIC, LINK_HDMI, LINK_SPK, LINK_BT),
> +	},
>  	{ }
>  };
>  MODULE_DEVICE_TABLE(platform, board_ids);
> diff --git a/sound/soc/intel/common/soc-acpi-intel-adl-match.c b/sound/soc/intel/common/soc-acpi-intel-adl-match.c
> index 7c8cd00457f81..3f40519250a90 100644
> --- a/sound/soc/intel/common/soc-acpi-intel-adl-match.c
> +++ b/sound/soc/intel/common/soc-acpi-intel-adl-match.c
> @@ -384,6 +384,14 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_adl_machines[] = {
>  		.sof_fw_filename = "sof-adl.ri",
>  		.sof_tplg_filename = "sof-adl-cs35l41.tplg",
>  	},
> +	{
> +		.id = "10134242",
> +		.drv_name = "adl_mx98360a_cs4242",
> +		.machine_quirk = snd_soc_acpi_codec_list,
> +		.quirk_data = &adl_max98360a_amp,
> +		.sof_fw_filename = "sof-adl.ri",

no longer necessary, and probably will not compile. please remove this
field.

> +		.sof_tplg_filename = "sof-adl-max98360a-rt5682.tplg",

Why would you refer to a topology that uses a different codec?



  reply	other threads:[~2022-05-10 15:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-10 10:48 [PATCH] [v2] ASoC: Intel: sof_cs42l42: adding support for ADL configuration and BT offload audio Terry Chen
2022-05-10 14:40 ` Pierre-Louis Bossart [this message]
2022-05-11  6:49   ` Lu, Brent
     [not found]   ` <CAMmR3bFad5ODKYUCg8Tp8GVk__AdaQHcpLnRmFyAGXu8Wpycog@mail.gmail.com>
2022-05-11 14:02     ` Pierre-Louis Bossart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=190c9add-7fa4-8e76-bfcb-43d30f22f8d9@linux.intel.com \
    --to=pierre-louis.bossart@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=brent.lu@intel.com \
    --cc=broonie@kernel.org \
    --cc=casey.g.bowman@intel.com \
    --cc=cezary.rojewski@intel.com \
    --cc=cujomalainey@chromium.org \
    --cc=kai.vehmanen@linux.intel.com \
    --cc=liam.r.girdwood@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mac.chiang@intel.com \
    --cc=mark_hsieh@wistron.corp-partner.google.com \
    --cc=perex@perex.cz \
    --cc=seanpaul@chromium.org \
    --cc=terry_chen@wistron.corp-partner.google.com \
    --cc=tiwai@suse.com \
    --cc=vamshi.krishna.gopal@intel.com \
    --cc=yang.jie@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).