All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: Brent Lu <brent.lu@intel.com>, alsa-devel@alsa-project.org
Cc: Cezary Rojewski <cezary.rojewski@intel.com>,
	Liam Girdwood <liam.r.girdwood@linux.intel.com>,
	Jie Yang <yang.jie@linux.intel.com>,
	Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
	Takashi Iwai <tiwai@suse.com>,
	Rander Wang <rander.wang@intel.com>,
	Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>,
	linux-kernel@vger.kernel.org,
	Ranjani Sridharan <ranjani.sridharan@linux.intel.com>,
	Kai Vehmanen <kai.vehmanen@linux.intel.com>,
	Dharageswari R <dharageswari.r@intel.com>,
	Sathyanarayana Nujella <sathyanarayana.nujella@intel.com>,
	Bard Liao <yung-chuan.liao@linux.intel.com>,
	Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>,
	Naveen Manohar <naveen.m@intel.com>,
	Yong Zhi <yong.zhi@intel.com>,
	Vamshi Krishna Gopal <vamshi.krishna.gopal@intel.com>,
	Fred Oh <fred.oh@linux.intel.com>,
	Tzung-Bi Shih <tzungbi@google.com>
Subject: Re: [PATCH 3/4] ASoC: intel: sof_cs42l42: add support for jsl_cs4242_mx98360a
Date: Mon, 7 Jun 2021 08:40:44 -0500	[thread overview]
Message-ID: <505c7e46-316c-9fa1-feaa-115f4561ed19@linux.intel.com> (raw)
In-Reply-To: <20210606004102.26190-4-brent.lu@intel.com>



On 6/5/21 7:41 PM, Brent Lu wrote:
> This patch adds driver data for jsl_cs4242_mx98360a which supports two
> max98360a speaker amplifiers on SSP1 and cs42l42 headphone codec on
> SSP0 running on JSL platform. DAI format is leveraged from sof_rt5682
> machine driver to reuse the topology.

This also looks like we have two topologies configuring the same DAIs 
differently on different platforms.

Why can't we pick one configuration that would work in all cases?

> Also use module device table to replace module alias.

Humm, this looks like a missing dependency, I modified this a while ago.

> 
> Signed-off-by: Brent Lu <brent.lu@intel.com>
> ---
>   sound/soc/intel/boards/sof_cs42l42.c          | 22 +++++++++++++++----
>   .../intel/common/soc-acpi-intel-jsl-match.c   |  8 +++++++
>   2 files changed, 26 insertions(+), 4 deletions(-)
> 
> diff --git a/sound/soc/intel/boards/sof_cs42l42.c b/sound/soc/intel/boards/sof_cs42l42.c
> index e3171242f612..d712cfb91fd1 100644
> --- a/sound/soc/intel/boards/sof_cs42l42.c
> +++ b/sound/soc/intel/boards/sof_cs42l42.c
> @@ -36,7 +36,9 @@
>   #define SOF_CS42L42_NUM_HDMIDEV_MASK		(GENMASK(9, 7))
>   #define SOF_CS42L42_NUM_HDMIDEV(quirk)	\
>   	(((quirk) << SOF_CS42L42_NUM_HDMIDEV_SHIFT) & SOF_CS42L42_NUM_HDMIDEV_MASK)
> -#define SOF_MAX98357A_SPEAKER_AMP_PRESENT	BIT(10)
> +#define SOF_CS42L42_BCLK_2400000		BIT(10)
> +#define SOF_MAX98357A_SPEAKER_AMP_PRESENT	BIT(11)
> +#define SOF_MAX98360A_SPEAKER_AMP_PRESENT	BIT(12)
>   
>   /* Default: SSP2 */
>   static unsigned long sof_cs42l42_quirk = SOF_CS42L42_SSP_CODEC(2);
> @@ -122,7 +124,10 @@ static int sof_cs42l42_hw_params(struct snd_pcm_substream *substream,
>   	struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
>   	int clk_freq, ret;
>   
> -	clk_freq = 3072000; /* BCLK freq */
> +	if (sof_cs42l42_quirk & SOF_CS42L42_BCLK_2400000)
> +		clk_freq = 2400000; /* BCLK freq */
> +	else
> +		clk_freq = 3072000; /* BCLK freq */
>   
>   	/* Configure sysclk for codec */
>   	ret = snd_soc_dai_set_sysclk(codec_dai, 0,
> @@ -281,6 +286,8 @@ static int create_spk_amp_dai_links(struct device *dev,
>   
>   	if (sof_cs42l42_quirk & SOF_MAX98357A_SPEAKER_AMP_PRESENT) {
>   		max_98357a_dai_link(&links[*id]);
> +	} else if (sof_cs42l42_quirk & SOF_MAX98360A_SPEAKER_AMP_PRESENT) {
> +		max_98360a_dai_link(&links[*id]);
>   	} else {
>   		dev_err(dev, "no amp defined\n");
>   		ret = -EINVAL;
> @@ -584,8 +591,17 @@ static const struct platform_device_id board_ids[] = {
>   					SOF_MAX98357A_SPEAKER_AMP_PRESENT |
>   					SOF_CS42L42_SSP_AMP(1)),
>   	},
> +	{
> +		.name = "jsl_cs4242_mx98360a",
> +		.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_BCLK_2400000,
> +	},
>   	{ }
>   };
> +MODULE_DEVICE_TABLE(platform, board_ids);
>   
>   static struct platform_driver sof_audio = {
>   	.probe = sof_audio_probe,
> @@ -601,7 +617,5 @@ module_platform_driver(sof_audio)
>   MODULE_DESCRIPTION("SOF Audio Machine driver for CS42L42");
>   MODULE_AUTHOR("Brent Lu <brent.lu@intel.com>");
>   MODULE_LICENSE("GPL");
> -MODULE_ALIAS("platform:sof_cs42l42");
> -MODULE_ALIAS("platform:glk_cs4242_max98357a");
>   MODULE_IMPORT_NS(SND_SOC_INTEL_HDA_DSP_COMMON);
>   MODULE_IMPORT_NS(SND_SOC_INTEL_SOF_MAXIM_COMMON);
> diff --git a/sound/soc/intel/common/soc-acpi-intel-jsl-match.c b/sound/soc/intel/common/soc-acpi-intel-jsl-match.c
> index 73fe4f89a82d..8e86476d48de 100644
> --- a/sound/soc/intel/common/soc-acpi-intel-jsl-match.c
> +++ b/sound/soc/intel/common/soc-acpi-intel-jsl-match.c
> @@ -73,6 +73,14 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_jsl_machines[] = {
>   		.quirk_data = &mx98360a_spk,
>   		.sof_tplg_filename = "sof-jsl-rt5682-mx98360a.tplg",
>   	},
> +	{
> +		.id = "10134242",
> +		.drv_name = "jsl_cs4242_mx98360a",
> +		.sof_fw_filename = "sof-jsl.ri",
> +		.machine_quirk = snd_soc_acpi_codec_list,
> +		.quirk_data = &mx98360a_spk,
> +		.sof_tplg_filename = "sof-jsl-rt5682-mx98360a.tplg",
> +	},
>   	{},
>   };
>   EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_jsl_machines);
> 

WARNING: multiple messages have this Message-ID (diff)
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: Brent Lu <brent.lu@intel.com>, alsa-devel@alsa-project.org
Cc: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>,
	Cezary Rojewski <cezary.rojewski@intel.com>,
	Dharageswari R <dharageswari.r@intel.com>,
	Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>,
	Kai Vehmanen <kai.vehmanen@linux.intel.com>,
	Tzung-Bi Shih <tzungbi@google.com>,
	linux-kernel@vger.kernel.org, Jie Yang <yang.jie@linux.intel.com>,
	Takashi Iwai <tiwai@suse.com>,
	Liam Girdwood <liam.r.girdwood@linux.intel.com>,
	Yong Zhi <yong.zhi@intel.com>, Mark Brown <broonie@kernel.org>,
	Ranjani Sridharan <ranjani.sridharan@linux.intel.com>,
	Naveen Manohar <naveen.m@intel.com>,
	Rander Wang <rander.wang@intel.com>,
	Bard Liao <yung-chuan.liao@linux.intel.com>,
	Fred Oh <fred.oh@linux.intel.com>,
	Vamshi Krishna Gopal <vamshi.krishna.gopal@intel.com>,
	Sathyanarayana Nujella <sathyanarayana.nujella@intel.com>
Subject: Re: [PATCH 3/4] ASoC: intel: sof_cs42l42: add support for jsl_cs4242_mx98360a
Date: Mon, 7 Jun 2021 08:40:44 -0500	[thread overview]
Message-ID: <505c7e46-316c-9fa1-feaa-115f4561ed19@linux.intel.com> (raw)
In-Reply-To: <20210606004102.26190-4-brent.lu@intel.com>



On 6/5/21 7:41 PM, Brent Lu wrote:
> This patch adds driver data for jsl_cs4242_mx98360a which supports two
> max98360a speaker amplifiers on SSP1 and cs42l42 headphone codec on
> SSP0 running on JSL platform. DAI format is leveraged from sof_rt5682
> machine driver to reuse the topology.

This also looks like we have two topologies configuring the same DAIs 
differently on different platforms.

Why can't we pick one configuration that would work in all cases?

> Also use module device table to replace module alias.

Humm, this looks like a missing dependency, I modified this a while ago.

> 
> Signed-off-by: Brent Lu <brent.lu@intel.com>
> ---
>   sound/soc/intel/boards/sof_cs42l42.c          | 22 +++++++++++++++----
>   .../intel/common/soc-acpi-intel-jsl-match.c   |  8 +++++++
>   2 files changed, 26 insertions(+), 4 deletions(-)
> 
> diff --git a/sound/soc/intel/boards/sof_cs42l42.c b/sound/soc/intel/boards/sof_cs42l42.c
> index e3171242f612..d712cfb91fd1 100644
> --- a/sound/soc/intel/boards/sof_cs42l42.c
> +++ b/sound/soc/intel/boards/sof_cs42l42.c
> @@ -36,7 +36,9 @@
>   #define SOF_CS42L42_NUM_HDMIDEV_MASK		(GENMASK(9, 7))
>   #define SOF_CS42L42_NUM_HDMIDEV(quirk)	\
>   	(((quirk) << SOF_CS42L42_NUM_HDMIDEV_SHIFT) & SOF_CS42L42_NUM_HDMIDEV_MASK)
> -#define SOF_MAX98357A_SPEAKER_AMP_PRESENT	BIT(10)
> +#define SOF_CS42L42_BCLK_2400000		BIT(10)
> +#define SOF_MAX98357A_SPEAKER_AMP_PRESENT	BIT(11)
> +#define SOF_MAX98360A_SPEAKER_AMP_PRESENT	BIT(12)
>   
>   /* Default: SSP2 */
>   static unsigned long sof_cs42l42_quirk = SOF_CS42L42_SSP_CODEC(2);
> @@ -122,7 +124,10 @@ static int sof_cs42l42_hw_params(struct snd_pcm_substream *substream,
>   	struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
>   	int clk_freq, ret;
>   
> -	clk_freq = 3072000; /* BCLK freq */
> +	if (sof_cs42l42_quirk & SOF_CS42L42_BCLK_2400000)
> +		clk_freq = 2400000; /* BCLK freq */
> +	else
> +		clk_freq = 3072000; /* BCLK freq */
>   
>   	/* Configure sysclk for codec */
>   	ret = snd_soc_dai_set_sysclk(codec_dai, 0,
> @@ -281,6 +286,8 @@ static int create_spk_amp_dai_links(struct device *dev,
>   
>   	if (sof_cs42l42_quirk & SOF_MAX98357A_SPEAKER_AMP_PRESENT) {
>   		max_98357a_dai_link(&links[*id]);
> +	} else if (sof_cs42l42_quirk & SOF_MAX98360A_SPEAKER_AMP_PRESENT) {
> +		max_98360a_dai_link(&links[*id]);
>   	} else {
>   		dev_err(dev, "no amp defined\n");
>   		ret = -EINVAL;
> @@ -584,8 +591,17 @@ static const struct platform_device_id board_ids[] = {
>   					SOF_MAX98357A_SPEAKER_AMP_PRESENT |
>   					SOF_CS42L42_SSP_AMP(1)),
>   	},
> +	{
> +		.name = "jsl_cs4242_mx98360a",
> +		.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_BCLK_2400000,
> +	},
>   	{ }
>   };
> +MODULE_DEVICE_TABLE(platform, board_ids);
>   
>   static struct platform_driver sof_audio = {
>   	.probe = sof_audio_probe,
> @@ -601,7 +617,5 @@ module_platform_driver(sof_audio)
>   MODULE_DESCRIPTION("SOF Audio Machine driver for CS42L42");
>   MODULE_AUTHOR("Brent Lu <brent.lu@intel.com>");
>   MODULE_LICENSE("GPL");
> -MODULE_ALIAS("platform:sof_cs42l42");
> -MODULE_ALIAS("platform:glk_cs4242_max98357a");
>   MODULE_IMPORT_NS(SND_SOC_INTEL_HDA_DSP_COMMON);
>   MODULE_IMPORT_NS(SND_SOC_INTEL_SOF_MAXIM_COMMON);
> diff --git a/sound/soc/intel/common/soc-acpi-intel-jsl-match.c b/sound/soc/intel/common/soc-acpi-intel-jsl-match.c
> index 73fe4f89a82d..8e86476d48de 100644
> --- a/sound/soc/intel/common/soc-acpi-intel-jsl-match.c
> +++ b/sound/soc/intel/common/soc-acpi-intel-jsl-match.c
> @@ -73,6 +73,14 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_jsl_machines[] = {
>   		.quirk_data = &mx98360a_spk,
>   		.sof_tplg_filename = "sof-jsl-rt5682-mx98360a.tplg",
>   	},
> +	{
> +		.id = "10134242",
> +		.drv_name = "jsl_cs4242_mx98360a",
> +		.sof_fw_filename = "sof-jsl.ri",
> +		.machine_quirk = snd_soc_acpi_codec_list,
> +		.quirk_data = &mx98360a_spk,
> +		.sof_tplg_filename = "sof-jsl-rt5682-mx98360a.tplg",
> +	},
>   	{},
>   };
>   EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_jsl_machines);
> 

  reply	other threads:[~2021-06-07 13:58 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-06  0:40 [PATCH 0/4] Support CS42L42 on JSL platform Brent Lu
2021-06-06  0:40 ` Brent Lu
2021-06-06  0:40 ` [PATCH 1/4] ASoC: Intel: sof_cs42l42: support JSL DAI link sequence Brent Lu
2021-06-06  0:40   ` Brent Lu
2021-06-07 13:32   ` Pierre-Louis Bossart
2021-06-07 13:32     ` Pierre-Louis Bossart
2021-06-07 14:23     ` Lu, Brent
2021-06-07 14:23       ` Lu, Brent
2021-06-07 20:49       ` Pierre-Louis Bossart
2021-06-07 20:49         ` Pierre-Louis Bossart
2021-06-06  0:41 ` [PATCH 2/4] ASoC: Intel: maxim-common: support max98360a Brent Lu
2021-06-06  0:41   ` Brent Lu
2021-06-06  0:41 ` [PATCH 3/4] ASoC: intel: sof_cs42l42: add support for jsl_cs4242_mx98360a Brent Lu
2021-06-06  0:41   ` Brent Lu
2021-06-07 13:40   ` Pierre-Louis Bossart [this message]
2021-06-07 13:40     ` Pierre-Louis Bossart
2021-06-07 14:29     ` Lu, Brent
2021-06-07 14:29       ` Lu, Brent
2021-06-07 14:43       ` Pierre-Louis Bossart
2021-06-07 14:43         ` Pierre-Louis Bossart
2021-06-07 16:28         ` Lu, Brent
2021-06-07 16:28           ` Lu, Brent
2021-06-07 18:32           ` Pierre-Louis Bossart
2021-06-07 18:32             ` Pierre-Louis Bossart
2021-06-06  0:41 ` [PATCH 4/4] ASoC: Intel: sof_rt5682: code refactor for max98360a Brent Lu
2021-06-06  0:41   ` Brent Lu

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=505c7e46-316c-9fa1-feaa-115f4561ed19@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=cezary.rojewski@intel.com \
    --cc=dharageswari.r@intel.com \
    --cc=fred.oh@linux.intel.com \
    --cc=guennadi.liakhovetski@linux.intel.com \
    --cc=kai.vehmanen@linux.intel.com \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=liam.r.girdwood@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=naveen.m@intel.com \
    --cc=perex@perex.cz \
    --cc=rander.wang@intel.com \
    --cc=ranjani.sridharan@linux.intel.com \
    --cc=sathyanarayana.nujella@intel.com \
    --cc=tiwai@suse.com \
    --cc=tzungbi@google.com \
    --cc=vamshi.krishna.gopal@intel.com \
    --cc=yang.jie@linux.intel.com \
    --cc=yong.zhi@intel.com \
    --cc=yung-chuan.liao@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.