public inbox for linux-kernel@vger.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>,
	Peter Ujfalusi <peter.ujfalusi@linux.intel.com>,
	Bard Liao <yung-chuan.liao@linux.intel.com>,
	Ranjani Sridharan <ranjani.sridharan@linux.intel.com>,
	Kai Vehmanen <kai.vehmanen@linux.intel.com>,
	Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
	Takashi Iwai <tiwai@suse.com>, Yong Zhi <yong.zhi@intel.com>,
	Uday M Bhat <uday.m.bhat@intel.com>,
	Gongjun Song <gongjun.song@intel.com>,
	Ajye Huang <ajye_huang@compal.corp-partner.google.com>,
	Arnd Bergmann <arnd@arndb.de>,
	Terry Cheong <htcheong@chromium.org>,
	"Dharageswari . R" <dharageswari.r@intel.com>,
	Mac Chiang <mac.chiang@intel.com>,
	Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] ASoC: Intel: sof_rt5682: add jsl_rt5650 board config
Date: Mon, 10 Jul 2023 09:35:57 +0200	[thread overview]
Message-ID: <f12360ff-cd8a-64b6-6cdd-beec2651787c@linux.intel.com> (raw)
In-Reply-To: <20230710141610.227988-1-brent.lu@intel.com>



On 7/10/23 16:16, Brent Lu wrote:
> This configuration supports JSL boards which implement ALC5650 dual
> I2S interface codec. Two DAI links are added: AIF1 (on codec side) for
> headphone and AIF2 for speakers.
> 
> Signed-off-by: Brent Lu <brent.lu@intel.com>
> ---
>  sound/soc/intel/boards/Kconfig                |  5 +-
>  sound/soc/intel/boards/sof_rt5682.c           | 81 ++++++++++++++++++-
>  .../intel/common/soc-acpi-intel-jsl-match.c   | 12 +++
>  3 files changed, 93 insertions(+), 5 deletions(-)
> 
> diff --git a/sound/soc/intel/boards/Kconfig b/sound/soc/intel/boards/Kconfig
> index f472f603ab75..1fe830af2b84 100644
> --- a/sound/soc/intel/boards/Kconfig
> +++ b/sound/soc/intel/boards/Kconfig
> @@ -475,7 +475,7 @@ endif ## SND_SOC_INTEL_SKYLAKE_HDAUDIO_CODEC || SND_SOC_SOF_HDA_AUDIO_CODEC
>  
>  if SND_SOC_SOF_HDA_LINK || SND_SOC_SOF_BAYTRAIL
>  config SND_SOC_INTEL_SOF_RT5682_MACH
> -	tristate "SOF with rt5682 codec in I2S Mode"
> +	tristate "SOF with rt5650/rt5682 codec in I2S Mode"
>  	depends on I2C && ACPI
>  	depends on ((SND_HDA_CODEC_HDMI && SND_SOC_SOF_HDA_AUDIO_CODEC) &&\
>  		    (MFD_INTEL_LPSS || COMPILE_TEST)) ||\
> @@ -485,6 +485,7 @@ config SND_SOC_INTEL_SOF_RT5682_MACH
>  	select SND_SOC_RT1011
>  	select SND_SOC_RT1015
>  	select SND_SOC_RT1015P
> +	select SND_SOC_RT5645
>  	select SND_SOC_RT5682_I2C
>  	select SND_SOC_RT5682S
>  	select SND_SOC_DMIC
> @@ -494,7 +495,7 @@ config SND_SOC_INTEL_SOF_RT5682_MACH
>  	select SND_SOC_INTEL_SOF_REALTEK_COMMON
>  	help
>  	   This adds support for ASoC machine driver for SOF platforms
> -	   with rt5682 codec.
> +	   with rt5650 or rt5682 codec.
>  	   Say Y if you have such a device.
>  	   If unsure select "N".
>  
> diff --git a/sound/soc/intel/boards/sof_rt5682.c b/sound/soc/intel/boards/sof_rt5682.c
> index 7c034d671cf3..53451c1b67f8 100644
> --- a/sound/soc/intel/boards/sof_rt5682.c
> +++ b/sound/soc/intel/boards/sof_rt5682.c
> @@ -22,6 +22,7 @@
>  #include <sound/soc-acpi.h>
>  #include "../../codecs/rt5682.h"
>  #include "../../codecs/rt5682s.h"
> +#include "../../codecs/rt5645.h"
>  #include "../../codecs/hdac_hdmi.h"
>  #include "../common/soc-intel-quirks.h"
>  #include "hda_dsp_common.h"
> @@ -60,6 +61,7 @@
>  #define SOF_MAX98390_SPEAKER_AMP_PRESENT	BIT(24)
>  #define SOF_MAX98390_TWEETER_SPEAKER_PRESENT	BIT(25)
>  #define SOF_RT1019_SPEAKER_AMP_PRESENT	BIT(26)
> +#define SOF_RT5650_HEADPHONE_CODEC_PRESENT	BIT(27)
>  
>  
>  /* Default: MCLK on, MCLK 19.2M, SSP0  */
> @@ -305,7 +307,7 @@ static int sof_rt5682_codec_init(struct snd_soc_pcm_runtime *rtd)
>  	struct sof_card_private *ctx = snd_soc_card_get_drvdata(rtd->card);
>  	struct snd_soc_component *component = asoc_rtd_to_codec(rtd, 0)->component;
>  	struct snd_soc_jack *jack;
> -	int ret;
> +	int ret, extra;

two lines, and rename to e.g. extra_jack_data


> +	if (sof_rt5682_quirk & SOF_RT5650_HEADPHONE_CODEC_PRESENT) {
> +		extra = SND_JACK_MICROPHONE | SND_JACK_BTN_0;
> +		ret = snd_soc_component_set_jack(component, jack, &extra);

I am a bit confused on why this wasn't set for rt5682?

> +	} else
> +		ret = snd_soc_component_set_jack(component, jack, NULL);

> +static const struct snd_soc_dapm_route rt5650_spk_dapm_routes[] = {
> +	/* speaker */
> +	{ "Left Spk", NULL, "SPOL" },
> +	{ "Right Spk", NULL, "SPOR" },
> +};
> +
>  static const struct snd_soc_dapm_route dmic_map[] = {
>  	/* digital mics */
>  	{"DMic", NULL, "SoC DMIC"},
>  };
>  
> +static int rt5650_spk_init(struct snd_soc_pcm_runtime *rtd)
> +{
> +	struct snd_soc_card *card = rtd->card;
> +	int ret;
> +
> +	ret = snd_soc_dapm_add_routes(&card->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);
> +
> +	return ret;
> +}
> +
>  static int dmic_init(struct snd_soc_pcm_runtime *rtd)
>  {
>  	struct snd_soc_card *card = rtd->card;
> @@ -614,6 +656,17 @@ static struct snd_soc_dai_link_component rt5682s_component[] = {
>  	}
>  };
>  
> +static struct snd_soc_dai_link_component rt5650_components[] = {
> +	{
> +		.name = "i2c-10EC5650:00",
> +		.dai_name = "rt5645-aif1",
> +	},
> +	{
> +		.name = "i2c-10EC5650:00",
> +		.dai_name = "rt5645-aif2",
> +	}
> +};

can we move these definitions to realtek_common.c, chances are other
boards will also use this codec. Thanks!

  reply	other threads:[~2023-07-11  6:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-10 14:16 [PATCH v2] ASoC: Intel: sof_rt5682: add jsl_rt5650 board config Brent Lu
2023-07-10  7:35 ` Pierre-Louis Bossart [this message]
2023-07-12  1:59   ` Lu, Brent

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=f12360ff-cd8a-64b6-6cdd-beec2651787c@linux.intel.com \
    --to=pierre-louis.bossart@linux.intel.com \
    --cc=ajye_huang@compal.corp-partner.google.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=arnd@arndb.de \
    --cc=brent.lu@intel.com \
    --cc=broonie@kernel.org \
    --cc=cezary.rojewski@intel.com \
    --cc=dharageswari.r@intel.com \
    --cc=gongjun.song@intel.com \
    --cc=htcheong@chromium.org \
    --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=mac.chiang@intel.com \
    --cc=perex@perex.cz \
    --cc=peter.ujfalusi@linux.intel.com \
    --cc=ranjani.sridharan@linux.intel.com \
    --cc=tiwai@suse.com \
    --cc=uday.m.bhat@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox