Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Reddy, V sujith kumar" <vsujithkumar.reddy@amd.com>
To: Marian Postevca <posteuca@mutex.one>,
	alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org
Cc: Takashi Iwai <tiwai@suse.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>,
	Mario Limonciello <mario.limonciello@amd.com>,
	Vijendar Mukunda <Vijendar.Mukunda@amd.com>,
	syed sabakareem <Syed.SabaKareem@amd.com>
Subject: Re: [RFC] Sound support for Huawei line of AMD laptops using ACP and ES8336 codec
Date: Sat, 7 Jan 2023 12:28:07 +0530	[thread overview]
Message-ID: <598ca0a8-8aef-a030-7060-f76ba4700bbf@amd.com> (raw)
In-Reply-To: <871qo7fqjp.fsf@mutex.one>

Hi Marian,

Thanks for the query.

On 1/7/2023 12:17 AM, Marian Postevca wrote:
> I have a Huawei Matebook 14 AMD 2021 laptop for which the sound isn't
> supported on Linux. On further investigation in Windows and ACPI tables
> I could determine that this particular SKU has an ES8336 codec connected
> to the CPU ACP module.
> The CPU of my laptop is an AMD Ryzen 5 5500U which seems to be codenamed
> Lucienne and is a derivation of the Renoir family.
> Acording to lspci the ACP is revision 1:
>
> 03:00.5 Multimedia controller [0480]: Advanced Micro Devices, Inc. [AMD] Raven/Raven2/FireFlight/Renoir Audio Processor [1022:15e2] (rev 01)
> 	Subsystem: Device [1e83:3e4d]
> 	Kernel driver in use: snd_rn_pci_acp3x
> 	Kernel modules: snd_pci_acp3x, snd_rn_pci_acp3x, snd_pci_acp5x,
> 	snd_pci_acp6x, snd_acp_pci, snd_rpl_pci_acp6x,
> 	snd_sof_amd_renoir
>
> I have written a machine driver for this platform and managed to make
> the sound and internal microphone work. I am looking to integrate this
> support but there are some issues with the current implementation of ACP
> support.
>
> As far as I can tell there are 4 directions I could take to add support:
>
> 1. A standalone machine driver in sound/soc/amd that uses the platform
>    drivers from sound/soc/amd/raven/
>
> 2. An embedded driver in sound/soc/amd/acp/acp-legacy-mach.c
>
> 3. A standalone machine driver in sound/soc/amd that uses the platform
>    drivers from sound/soc/amd/renoir
>
> 4. Use the SOF infrastructure
>
> Now as far as I can tell, all of these directions have issues:
>
> 1. The pci driver from sound/soc/amd/raven/pci-acp3x.c doesn't support Lucienne
>     since it blocks rev 1 devices in :
>
>     /* Raven device detection */
>     if (pci->revision != 0x00)
>         return -ENODEV;
>
>     This is the approach I took and just changed the check to add support
>     for rev 1.
>     The sound and internal microphone worked ok and I didn't encounter any
>     issues with it. Of course I don't know the internals of ACP and
>     don't know what are the differences between rev 0 and rev 1.


Not recommended

>
> 2. This approach could work but I would need to change the structure
>     acp_card_drvdata and struct snd_soc_dapm_widget acp_widgets,
>     to add proper support for jack handling (and maybe some other
>     modifications).
>     This driver seems to support rev 1 (in sound/soc/amd/acp/acp-pci.c):
>
>     switch (pci->revision) {
> 	case 0x01:
> 		chip->name = "acp_asoc_renoir";
> 		chip->acp_rev = ACP3X_DEV;
> 		break;
>
>     Also from the module description it seems that these drivers are
>     meant only for chromebook support.


Recommended. Please add below code

	{
		.flags  =  FLAG_AMD_LEGACY,
		.device  =  ACP_PCI_DEV_ID,
		.dmi_table  =  (const  struct  dmi_system_id  [])  {
			{
				.matches  =  {
					DMI_MATCH(DMI_SYS_VENDOR,  ""),///change accordingly DMI_MATCH(DMI_PRODUCT_NAME, ""),///change 
accordingly
  },
			},


at 
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git/tree/sound/soc/amd/acp-config.c#n50

As you said add the   structure static struct acp_card_drvdata and also 
add the required dai_link of codec.



>
> 3. This seems like it would the best approach in theory, but the problem
>     is that the drivers inside only seem to add support for DMIC.
>
> 4. I tried to use SOF early when I started tinkering, but I always got a
>     timeout during init phase when loading the renoir firmware.

Could you please send  the error, we will check and let you know what is 
missing.


>
> So the reason for this email is to get some idea, on how to best add
> support for these laptops.

  parent reply	other threads:[~2023-01-07  6:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-06 18:47 [RFC] Sound support for Huawei line of AMD laptops using ACP and ES8336 codec Marian Postevca
2023-01-07  1:15 ` Pierre-Louis Bossart
2023-01-07  6:58 ` Reddy, V sujith kumar [this message]
2023-01-09 18:21   ` Limonciello, Mario
2023-01-10 12:27     ` Marian Postevca
2023-01-11  9:33       ` Reddy, V sujith kumar

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=598ca0a8-8aef-a030-7060-f76ba4700bbf@amd.com \
    --to=vsujithkumar.reddy@amd.com \
    --cc=Syed.SabaKareem@amd.com \
    --cc=Vijendar.Mukunda@amd.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mario.limonciello@amd.com \
    --cc=posteuca@mutex.one \
    --cc=tiwai@suse.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