diff mbox series

[v2] ASoC: Intel: sof_nau8825: add variant with nau8318 amplifier.

Message ID 20221216154938.9426-1-ajye_huang@compal.corp-partner.google.com (mailing list archive)
State Superseded
Headers show
Series [v2] ASoC: Intel: sof_nau8825: add variant with nau8318 amplifier. | expand

Commit Message

Ajye Huang Dec. 16, 2022, 3:49 p.m. UTC
This patch adds the driver data for two nau8318 speaker amplifiers on
SSP1 and nau8825 on SSP0 for ADL platform.

The nau8315 and nau8318 are both Nuvoton Amp chips. They use the same
Amp driver nau8315.c. The acpi_device_id for nau8315 is "NVTN2010",
for nau8318 is "NVTN2012".
The nau8825 is one of Nuvoton headset codec, and its acpi_device_id is
"10508825".

Signed-off-by: Ajye Huang <ajye_huang@compal.corp-partner.google.com>
---

 sound/soc/intel/boards/Kconfig                |  1 +
 sound/soc/intel/boards/sof_nau8825.c          | 23 +++++++++++++++++++
 .../intel/common/soc-acpi-intel-adl-match.c   | 12 ++++++++++
 3 files changed, 36 insertions(+)

Comments

Ajye Huang Dec. 16, 2022, 3:57 p.m. UTC | #1
Hi Pierre

On Fri, Dec 16, 2022 at 11:49 PM Ajye Huang
<ajye_huang@compal.corp-partner.google.com> wrote:

Based on the suggestions you provided in v1,
> Suggested edit:
>
> ASoC: Intel: sof_nau8825: add variant with nau8318 amplifier.
>
> That should be added in the commit message please.
>

The v2 includes:
changes from v1->v2:
* Modify title and add explanations in commit messages .
* Use new topology file "sof-adl-nau8318-nau8825.tplg" instead of
sof-adl-max98360a-nau8825.tplg.

Thanks for your suggestions.
Pierre-Louis Bossart Dec. 16, 2022, 4:03 p.m. UTC | #2
On 12/16/22 09:49, Ajye Huang wrote:
> This patch adds the driver data for two nau8318 speaker amplifiers on
> SSP1 and nau8825 on SSP0 for ADL platform.

So here you are making reference to two amplifiers...

> +static struct snd_soc_dai_link_component nau8318_components[] = {
> +	{
> +		.name = "NVTN2012:00",
> +		.dai_name = "nau8315-hifi",
> +	}
> +};

but here there's only one? I was expecting something like what we've
used for Maxim amplifiers with a codec configuration and dailink
components that list the two amplifiers.

static struct snd_soc_codec_conf max_98373_codec_conf[] = {
	{
		.dlc = COMP_CODEC_CONF(MAX_98373_DEV0_NAME),
		.name_prefix = "Right",
	},
	{
		.dlc = COMP_CODEC_CONF(MAX_98373_DEV1_NAME),
		.name_prefix = "Left",
	},
};

struct snd_soc_dai_link_component max_98373_components[] = {
	{  /* For Right */
		.name = MAX_98373_DEV0_NAME,
		.dai_name = MAX_98373_CODEC_DAI,
	},
	{  /* For Left */
		.name = MAX_98373_DEV1_NAME,
		.dai_name = MAX_98373_CODEC_DAI,
	},
};

Or is this a commit message problem and there's really only one amplifier?

> +
>  static struct snd_soc_dai_link_component dummy_component[] = {
>  	{
>  		.name = "snd-soc-dummy",
> @@ -486,6 +494,11 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev,
>  			max_98360a_dai_link(&links[id]);
>  		} else if (sof_nau8825_quirk & SOF_RT1015P_SPEAKER_AMP_PRESENT) {
>  			sof_rt1015p_dai_link(&links[id]);
> +		} else if (sof_nau8825_quirk &
> +				SOF_NAU8318_SPEAKER_AMP_PRESENT) {
> +			links[id].codecs = nau8318_components;
> +			links[id].num_codecs = ARRAY_SIZE(nau8318_components);
> +			links[id].init = speaker_codec_init;

The rest looks fine, I only have this one/two amplifier question.
Pierre-Louis Bossart Dec. 16, 2022, 4:05 p.m. UTC | #3
> The v2 includes:
> changes from v1->v2:
> * Modify title and add explanations in commit messages .
> * Use new topology file "sof-adl-nau8318-nau8825.tplg" instead of
> sof-adl-max98360a-nau8825.tplg.

You can add those directly in the patch, below the --- marker, e.g.


Signed-off-by: Ajye Huang <ajye_huang@compal.corp-partner.google.com>
---

changes from v1->v2:
* Modify title and add explanations in commit messages .
* Use new topology file "sof-adl-nau8318-nau8825.tplg" instead of
sof-adl-max98360a-nau8825.tplg.

 sound/soc/intel/boards/Kconfig                |  1 +
 sound/soc/intel/boards/sof_nau8825.c          | 23 +++++++++++++++++++
 .../intel/common/soc-acpi-intel-adl-match.c   | 12 ++++++++++
 3 files changed, 36 insertions(+)
Ajye Huang Dec. 16, 2022, 4:55 p.m. UTC | #4
Hi Pierre

On Sat, Dec 17, 2022 at 12:03 AM Pierre-Louis Bossart
<pierre-louis.bossart@linux.intel.com> wrote:

> On 12/16/22 09:49, Ajye Huang wrote:
> > This patch adds the driver data for two nau8318 speaker amplifiers on
> > SSP1 and nau8825 on SSP0 for ADL platform.
>
> So here you are making reference to two amplifiers...
>
> > +static struct snd_soc_dai_link_component nau8318_components[] = {
> > +     {
> > +             .name = "NVTN2012:00",
> > +             .dai_name = "nau8315-hifi",
> > +     }
> > +};
>
> but here there's only one? I was expecting something like what we've
> used for Maxim amplifiers with a codec configuration and dailink
> components that list the two amplifiers.
>
> static struct snd_soc_codec_conf max_98373_codec_conf[] = {
>         {
>                 .dlc = COMP_CODEC_CONF(MAX_98373_DEV0_NAME),
>                 .name_prefix = "Right",
>         },
>         {
>                 .dlc = COMP_CODEC_CONF(MAX_98373_DEV1_NAME),
>                 .name_prefix = "Left",
>         },
> };
>
> struct snd_soc_dai_link_component max_98373_components[] = {
>         {  /* For Right */
>                 .name = MAX_98373_DEV0_NAME,
>                 .dai_name = MAX_98373_CODEC_DAI,
>         },
>         {  /* For Left */
>                 .name = MAX_98373_DEV1_NAME,
>                 .dai_name = MAX_98373_CODEC_DAI,
>         },
> };
>
> Or is this a commit message problem and there's really only one amplifier?

Really , it has two speakers.  The nau8318 is an auto mode Amplifier
chip, similar to the max98360a amp chip.
EX: Sof_maxim_common.c (sound\soc\intel\boards):
static struct snd_soc_dai_link_component max_98360a_components[] = {
    {
        .name = MAX_98360A_DEV0_NAME,
        .dai_name = MAX_98357A_CODEC_DAI,
    }
};
It is not an i2c interface,  from the nau8318 data sheet, there are
five pins used mainly. one for enable, others for I2S.
EN-- enable pin
FSR-- Frame Sync, Right
FSL--  Frame Sync, Left
BCLK--  bit clock
DACIN-- Input i2s data

The FSR and FSL pins are for Left and Right channels used.
thanks
Ajye Huang Dec. 16, 2022, 4:57 p.m. UTC | #5
HI Pierre-Louis,

On Sat, Dec 17, 2022 at 12:06 AM Pierre-Louis Bossart
<pierre-louis.bossart@linux.intel.com> wrote:

> You can add those directly in the patch, below the --- marker, e.g.
>
>
> Signed-off-by: Ajye Huang <ajye_huang@compal.corp-partner.google.com>
> ---
>
> changes from v1->v2:
> * Modify title and add explanations in commit messages .
> * Use new topology file "sof-adl-nau8318-nau8825.tplg" instead of
> sof-adl-max98360a-nau8825.tplg.
>
>  sound/soc/intel/boards/Kconfig                |  1 +
>  sound/soc/intel/boards/sof_nau8825.c          | 23 +++++++++++++++++++
>  .../intel/common/soc-acpi-intel-adl-match.c   | 12 ++++++++++
>  3 files changed, 36 insertions(+)

Yes, it is really better, thanks for letting me know.
Pierre-Louis Bossart Dec. 16, 2022, 5:36 p.m. UTC | #6
On 12/16/22 10:55, Ajye Huang wrote:
> Hi Pierre
> 
> On Sat, Dec 17, 2022 at 12:03 AM Pierre-Louis Bossart
> <pierre-louis.bossart@linux.intel.com> wrote:
> 
>> On 12/16/22 09:49, Ajye Huang wrote:
>>> This patch adds the driver data for two nau8318 speaker amplifiers on
>>> SSP1 and nau8825 on SSP0 for ADL platform.
>>
>> So here you are making reference to two amplifiers...
>>
>>> +static struct snd_soc_dai_link_component nau8318_components[] = {
>>> +     {
>>> +             .name = "NVTN2012:00",
>>> +             .dai_name = "nau8315-hifi",
>>> +     }
>>> +};
>>
>> but here there's only one? I was expecting something like what we've
>> used for Maxim amplifiers with a codec configuration and dailink
>> components that list the two amplifiers.
>>
>> static struct snd_soc_codec_conf max_98373_codec_conf[] = {
>>         {
>>                 .dlc = COMP_CODEC_CONF(MAX_98373_DEV0_NAME),
>>                 .name_prefix = "Right",
>>         },
>>         {
>>                 .dlc = COMP_CODEC_CONF(MAX_98373_DEV1_NAME),
>>                 .name_prefix = "Left",
>>         },
>> };
>>
>> struct snd_soc_dai_link_component max_98373_components[] = {
>>         {  /* For Right */
>>                 .name = MAX_98373_DEV0_NAME,
>>                 .dai_name = MAX_98373_CODEC_DAI,
>>         },
>>         {  /* For Left */
>>                 .name = MAX_98373_DEV1_NAME,
>>                 .dai_name = MAX_98373_CODEC_DAI,
>>         },
>> };
>>
>> Or is this a commit message problem and there's really only one amplifier?
> 
> Really , it has two speakers.  The nau8318 is an auto mode Amplifier
> chip, similar to the max98360a amp chip.
> EX: Sof_maxim_common.c (sound\soc\intel\boards):
> static struct snd_soc_dai_link_component max_98360a_components[] = {
>     {
>         .name = MAX_98360A_DEV0_NAME,
>         .dai_name = MAX_98357A_CODEC_DAI,
>     }
> };
> It is not an i2c interface,  from the nau8318 data sheet, there are
> five pins used mainly. one for enable, others for I2S.
> EN-- enable pin
> FSR-- Frame Sync, Right
> FSL--  Frame Sync, Left
> BCLK--  bit clock
> DACIN-- Input i2s data
> 
> The FSR and FSL pins are for Left and Right channels used.
> thanks

Ok, thanks for the explanations.

Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Ajye Huang Dec. 20, 2022, 2:06 p.m. UTC | #7
Dear Mark,

On Sat, Dec 17, 2022 at 1:37 AM Pierre-Louis Bossart
<pierre-louis.bossart@linux.intel.com> wrote:
>
> Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

First of all, I apologize for this letter of inquiry.
I got "Acked-by" from Pierre .
Please kindly check this when you are free, thank you so much.
Ajye Huang Dec. 21, 2022, 11:30 p.m. UTC | #8
Hi Pierre

On Sat, Dec 17, 2022 at 1:37 AM Pierre-Louis Bossart
<pierre-louis.bossart@linux.intel.com> wrote:

>
> Ok, thanks for the explanations.
>
> Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

Yesterday, I saw Arnd Bergmann sent this patch "ASoC: Intel:
sof-nau8825: fix module alias overflow " for reducing the string to
prevent over length,https://patchwork.kernel.org/project/alsa-devel/patch/20221221132515.2363276-1-arnd@kernel.org/.

so, I need to check with you, should my string need to change the
format style with his, even the my string does not over length , from
.drv_name = "adl_nau8318_nau8825" to .drv_name = "adl_nau8318_8825",
align with his format style?

thanks
Pierre-Louis Bossart Dec. 22, 2022, 12:27 a.m. UTC | #9
On 12/21/22 17:30, Ajye Huang wrote:
> Hi Pierre
> 
> On Sat, Dec 17, 2022 at 1:37 AM Pierre-Louis Bossart
> <pierre-louis.bossart@linux.intel.com> wrote:
> 
>>
>> Ok, thanks for the explanations.
>>
>> Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> 
> Yesterday, I saw Arnd Bergmann sent this patch "ASoC: Intel:
> sof-nau8825: fix module alias overflow " for reducing the string to
> prevent over length,https://patchwork.kernel.org/project/alsa-devel/patch/20221221132515.2363276-1-arnd@kernel.org/.
> 
> so, I need to check with you, should my string need to change the
> format style with his, even the my string does not over length , from
> .drv_name = "adl_nau8318_nau8825" to .drv_name = "adl_nau8318_8825",
> align with his format style?

That would be more consistent indeed, no objections from me.
Ajye Huang Dec. 22, 2022, 2:38 a.m. UTC | #10
Hi Pierre

On Thu, Dec 22, 2022 at 8:27 AM Pierre-Louis Bossart
<pierre-louis.bossart@linux.intel.com> wrote:
>
>
> That would be more consistent indeed, no objections from me.

Thank you , I will send the v3 patch with modified string "adl_nau8318_8825".
Mark Brown Dec. 26, 2022, 11:33 p.m. UTC | #11
On Fri, 16 Dec 2022 23:49:38 +0800, Ajye Huang wrote:
> This patch adds the driver data for two nau8318 speaker amplifiers on
> SSP1 and nau8825 on SSP0 for ADL platform.
> 
> The nau8315 and nau8318 are both Nuvoton Amp chips. They use the same
> Amp driver nau8315.c. The acpi_device_id for nau8315 is "NVTN2010",
> for nau8318 is "NVTN2012".
> The nau8825 is one of Nuvoton headset codec, and its acpi_device_id is
> "10508825".
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: Intel: sof_nau8825: add variant with nau8318 amplifier.
      commit: ba7523bb0f494fc440d3a9bb0b665cfcaa192d0c

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark
diff mbox series

Patch

diff --git a/sound/soc/intel/boards/Kconfig b/sound/soc/intel/boards/Kconfig
index a472de1909f4..3f68e9edd853 100644
--- a/sound/soc/intel/boards/Kconfig
+++ b/sound/soc/intel/boards/Kconfig
@@ -554,6 +554,7 @@  config SND_SOC_INTEL_SOF_NAU8825_MACH
 	select SND_SOC_RT1015P
 	select SND_SOC_MAX98373_I2C
 	select SND_SOC_MAX98357A
+	select SND_SOC_NAU8315
 	select SND_SOC_DMIC
 	select SND_SOC_HDAC_HDMI
 	select SND_SOC_INTEL_HDA_DSP_COMMON
diff --git a/sound/soc/intel/boards/sof_nau8825.c b/sound/soc/intel/boards/sof_nau8825.c
index 27880224359d..0936450be153 100644
--- a/sound/soc/intel/boards/sof_nau8825.c
+++ b/sound/soc/intel/boards/sof_nau8825.c
@@ -48,6 +48,7 @@ 
 #define SOF_MAX98373_SPEAKER_AMP_PRESENT	BIT(15)
 #define SOF_MAX98360A_SPEAKER_AMP_PRESENT	BIT(16)
 #define SOF_RT1015P_SPEAKER_AMP_PRESENT	BIT(17)
+#define SOF_NAU8318_SPEAKER_AMP_PRESENT	BIT(18)
 
 static unsigned long sof_nau8825_quirk = SOF_NAU8825_SSP_CODEC(0);
 
@@ -338,6 +339,13 @@  static struct snd_soc_dai_link_component rt1019p_component[] = {
 	}
 };
 
+static struct snd_soc_dai_link_component nau8318_components[] = {
+	{
+		.name = "NVTN2012:00",
+		.dai_name = "nau8315-hifi",
+	}
+};
+
 static struct snd_soc_dai_link_component dummy_component[] = {
 	{
 		.name = "snd-soc-dummy",
@@ -486,6 +494,11 @@  static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev,
 			max_98360a_dai_link(&links[id]);
 		} else if (sof_nau8825_quirk & SOF_RT1015P_SPEAKER_AMP_PRESENT) {
 			sof_rt1015p_dai_link(&links[id]);
+		} else if (sof_nau8825_quirk &
+				SOF_NAU8318_SPEAKER_AMP_PRESENT) {
+			links[id].codecs = nau8318_components;
+			links[id].num_codecs = ARRAY_SIZE(nau8318_components);
+			links[id].init = speaker_codec_init;
 		} else {
 			goto devm_err;
 		}
@@ -657,6 +670,16 @@  static const struct platform_device_id board_ids[] = {
 					SOF_BT_OFFLOAD_SSP(2) |
 					SOF_SSP_BT_OFFLOAD_PRESENT),
 	},
+	{
+		.name = "adl_nau8318_nau8825",
+		.driver_data = (kernel_ulong_t)(SOF_NAU8825_SSP_CODEC(0) |
+					SOF_SPEAKER_AMP_PRESENT |
+					SOF_NAU8318_SPEAKER_AMP_PRESENT |
+					SOF_NAU8825_SSP_AMP(1) |
+					SOF_NAU8825_NUM_HDMIDEV(4) |
+					SOF_BT_OFFLOAD_SSP(2) |
+					SOF_SSP_BT_OFFLOAD_PRESENT),
+	},
 	{ }
 };
 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 60aee56f94bd..1a69cd8c5e18 100644
--- a/sound/soc/intel/common/soc-acpi-intel-adl-match.c
+++ b/sound/soc/intel/common/soc-acpi-intel-adl-match.c
@@ -450,6 +450,11 @@  static const struct snd_soc_acpi_codecs adl_lt6911_hdmi = {
 	.codecs = {"INTC10B0"}
 };
 
+static const struct snd_soc_acpi_codecs adl_nau8318_amp = {
+	.num_codecs = 1,
+	.codecs = {"NVTN2012"}
+};
+
 struct snd_soc_acpi_mach snd_soc_acpi_intel_adl_machines[] = {
 	{
 		.comp_ids = &adl_rt5682_rt5682s_hp,
@@ -507,6 +512,13 @@  struct snd_soc_acpi_mach snd_soc_acpi_intel_adl_machines[] = {
 		.quirk_data = &adl_rt1015p_amp,
 		.sof_tplg_filename = "sof-adl-rt1015-nau8825.tplg",
 	},
+	{
+		.id = "10508825",
+		.drv_name = "adl_nau8318_nau8825",
+		.machine_quirk = snd_soc_acpi_codec_list,
+		.quirk_data = &adl_nau8318_amp,
+		.sof_tplg_filename = "sof-adl-nau8318-nau8825.tplg",
+	},
 	{
 		.id = "10508825",
 		.drv_name = "sof_nau8825",