[PATCH 1/6] ASoC: amd: Renaming snd-soc-card structure and fields.
As in future our machine driver supports multiple codecs So changing naming convention of snd_soc_card struct and its fields.
Signed-off-by: Ravulapati Vishnu vardhan rao Vishnuvardhanrao.Ravulapati@amd.com --- sound/soc/amd/acp3x-rt5682-max9836.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/sound/soc/amd/acp3x-rt5682-max9836.c b/sound/soc/amd/acp3x-rt5682-max9836.c index 6009e444b858..8b5af064864f 100644 --- a/sound/soc/amd/acp3x-rt5682-max9836.c +++ b/sound/soc/amd/acp3x-rt5682-max9836.c @@ -290,7 +290,7 @@ static const struct snd_kcontrol_new acp3x_dmic_mux_control = SOC_DAPM_ENUM_EXT("DMIC Select Mux", acp3x_dmic_enum, dmic_get, dmic_set);
-static const struct snd_soc_dapm_widget acp3x_widgets[] = { +static const struct snd_soc_dapm_widget acp3x_5682_widgets[] = { SND_SOC_DAPM_HP("Headphone Jack", NULL), SND_SOC_DAPM_SPK("Spk", NULL), SND_SOC_DAPM_MIC("Headset Mic", NULL), @@ -298,7 +298,7 @@ static const struct snd_soc_dapm_widget acp3x_widgets[] = { &acp3x_dmic_mux_control), };
-static const struct snd_soc_dapm_route acp3x_audio_route[] = { +static const struct snd_soc_dapm_route acp3x_5682_audio_route[] = { {"Headphone Jack", NULL, "HPOL"}, {"Headphone Jack", NULL, "HPOR"}, {"IN1P", NULL, "Headset Mic"}, @@ -307,23 +307,23 @@ static const struct snd_soc_dapm_route acp3x_audio_route[] = { {"Dmic Mux", "Rear Mic", "DMIC"}, };
-static const struct snd_kcontrol_new acp3x_mc_controls[] = { +static const struct snd_kcontrol_new acp3x_5682_mc_controls[] = { SOC_DAPM_PIN_SWITCH("Headphone Jack"), SOC_DAPM_PIN_SWITCH("Spk"), SOC_DAPM_PIN_SWITCH("Headset Mic"), };
-static struct snd_soc_card acp3x_card = { +static struct snd_soc_card acp3x_5682 = { .name = "acp3xalc5682m98357", .owner = THIS_MODULE, .dai_link = acp3x_dai_5682_98357, .num_links = ARRAY_SIZE(acp3x_dai_5682_98357), - .dapm_widgets = acp3x_widgets, - .num_dapm_widgets = ARRAY_SIZE(acp3x_widgets), - .dapm_routes = acp3x_audio_route, - .num_dapm_routes = ARRAY_SIZE(acp3x_audio_route), - .controls = acp3x_mc_controls, - .num_controls = ARRAY_SIZE(acp3x_mc_controls), + .dapm_widgets = acp3x_5682_widgets, + .num_dapm_widgets = ARRAY_SIZE(acp3x_5682_widgets), + .dapm_routes = acp3x_5682_audio_route, + .num_dapm_routes = ARRAY_SIZE(acp3x_5682_audio_route), + .controls = acp3x_5682_mc_controls, + .num_controls = ARRAY_SIZE(acp3x_5682_mc_controls), };
static int acp3x_probe(struct platform_device *pdev) @@ -336,8 +336,8 @@ static int acp3x_probe(struct platform_device *pdev) if (!machine) return -ENOMEM;
- card = &acp3x_card; - acp3x_card.dev = &pdev->dev; + card = &acp3x_5682; + acp3x_5682.dev = &pdev->dev; platform_set_drvdata(pdev, card); snd_soc_card_set_drvdata(card, machine);
@@ -348,11 +348,11 @@ static int acp3x_probe(struct platform_device *pdev) return PTR_ERR(dmic_sel); }
- ret = devm_snd_soc_register_card(&pdev->dev, &acp3x_card); + ret = devm_snd_soc_register_card(&pdev->dev, &acp3x_5682); if (ret) { dev_err(&pdev->dev, "devm_snd_soc_register_card(%s) failed: %d\n", - acp3x_card.name, ret); + acp3x_5682.name, ret); return ret; } return 0;
Passing specific snd_soc_card structure depending on the ACPI ID. In future we can add other IDs in the ACPI table and pass the structure.
Signed-off-by: Ravulapati Vishnu vardhan rao Vishnuvardhanrao.Ravulapati@amd.com --- sound/soc/amd/acp3x-rt5682-max9836.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-)
diff --git a/sound/soc/amd/acp3x-rt5682-max9836.c b/sound/soc/amd/acp3x-rt5682-max9836.c index 8b5af064864f..1e446e4bab25 100644 --- a/sound/soc/amd/acp3x-rt5682-max9836.c +++ b/sound/soc/amd/acp3x-rt5682-max9836.c @@ -326,18 +326,32 @@ static struct snd_soc_card acp3x_5682 = { .num_controls = ARRAY_SIZE(acp3x_5682_mc_controls), };
+void *soc_is_rltk_max(struct device *dev) +{ + const struct acpi_device_id *match; + + match = acpi_match_device(dev->driver->acpi_match_table, dev); + if (!match) + return NULL; + return (void *)match->driver_data; +} + static int acp3x_probe(struct platform_device *pdev) { int ret; struct snd_soc_card *card; struct acp3x_platform_info *machine; + struct device *dev = &pdev->dev; + + card = (struct snd_soc_card *)soc_is_rltk_max(dev); + if (!card) + return -ENODEV;
machine = devm_kzalloc(&pdev->dev, sizeof(*machine), GFP_KERNEL); if (!machine) return -ENOMEM;
- card = &acp3x_5682; - acp3x_5682.dev = &pdev->dev; + card->dev = &pdev->dev; platform_set_drvdata(pdev, card); snd_soc_card_set_drvdata(card, machine);
@@ -348,18 +362,18 @@ static int acp3x_probe(struct platform_device *pdev) return PTR_ERR(dmic_sel); }
- ret = devm_snd_soc_register_card(&pdev->dev, &acp3x_5682); + ret = devm_snd_soc_register_card(&pdev->dev, card); if (ret) { dev_err(&pdev->dev, "devm_snd_soc_register_card(%s) failed: %d\n", - acp3x_5682.name, ret); + card->name, ret); return ret; } return 0; }
static const struct acpi_device_id acp3x_audio_acpi_match[] = { - { "AMDI5682", 0 }, + { "AMDI5682", (unsigned long)&acp3x_5682}, {}, }; MODULE_DEVICE_TABLE(acpi, acp3x_audio_acpi_match);
Hi Ravulapati,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on asoc/for-next] [also build test WARNING on next-20200727] [cannot apply to v5.8-rc7] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Ravulapati-Vishnu-vardhan-rao/ASoC-... base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next config: x86_64-allyesconfig (attached as .config) compiler: gcc-9 (Debian 9.3.0-14) 9.3.0 reproduce (this is a W=1 build): # save the attached .config to linux build tree make W=1 ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot lkp@intel.com
All warnings (new ones prefixed by >>):
sound/soc/amd/acp3x-rt5682-max9836.c:329:7: warning: no previous prototype for 'soc_is_rltk_max' [-Wmissing-prototypes]
329 | void *soc_is_rltk_max(struct device *dev) | ^~~~~~~~~~~~~~~
vim +/soc_is_rltk_max +329 sound/soc/amd/acp3x-rt5682-max9836.c
328
329 void *soc_is_rltk_max(struct device *dev)
330 { 331 const struct acpi_device_id *match; 332 333 match = acpi_match_device(dev->driver->acpi_match_table, dev); 334 if (!match) 335 return NULL; 336 return (void *)match->driver_data; 337 } 338
--- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
changing SND_SOC_RT5682_I2C to SND_SOC_RT5682 because, This flag which was previously set as SND_SOC_RT5682 used to build rt5682 codec driver but by changing into SND_SOC_RT5682_I2C is preventing to build rt5682 codec driver and machine driver fails to probe.So Reverting the changes.
Signed-off-by: Ravulapati Vishnu vardhan rao Vishnuvardhanrao.Ravulapati@amd.com --- sound/soc/amd/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/amd/Kconfig b/sound/soc/amd/Kconfig index e37cf72f2bab..77ffdb41bee5 100644 --- a/sound/soc/amd/Kconfig +++ b/sound/soc/amd/Kconfig @@ -29,7 +29,7 @@ config SND_SOC_AMD_ACP3x
config SND_SOC_AMD_RV_RT5682_MACH tristate "AMD RV support for RT5682" - select SND_SOC_RT5682_I2C + select SND_SOC_RT5682 select SND_SOC_MAX98357A select SND_SOC_CROS_EC_CODEC select I2C_CROS_EC_TUNNEL
On 7/27/20 9:58 AM, Ravulapati Vishnu vardhan rao wrote:
changing SND_SOC_RT5682_I2C to SND_SOC_RT5682 because, This flag which was previously set as SND_SOC_RT5682 used to build rt5682 codec driver but by changing into SND_SOC_RT5682_I2C is preventing to build rt5682 codec driver and machine driver fails to probe.So Reverting the changes.
The split between I2C and SoundWire means you have to choose the I2C or SDW mode. Selecting the common part looks very strange.
see Intel machine drviers:
Kconfig: select SND_SOC_RT5682_I2C Kconfig: select SND_SOC_RT5682_I2C Kconfig: select SND_SOC_RT5682_I2C Kconfig: select SND_SOC_RT5682_SDW
Signed-off-by: Ravulapati Vishnu vardhan rao Vishnuvardhanrao.Ravulapati@amd.com
sound/soc/amd/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/amd/Kconfig b/sound/soc/amd/Kconfig index e37cf72f2bab..77ffdb41bee5 100644 --- a/sound/soc/amd/Kconfig +++ b/sound/soc/amd/Kconfig @@ -29,7 +29,7 @@ config SND_SOC_AMD_ACP3x
config SND_SOC_AMD_RV_RT5682_MACH tristate "AMD RV support for RT5682"
- select SND_SOC_RT5682_I2C
- select SND_SOC_RT5682 select SND_SOC_MAX98357A select SND_SOC_CROS_EC_CODEC select I2C_CROS_EC_TUNNEL
On Mon, Jul 27, 2020 at 10:31:24AM -0500, Pierre-Louis Bossart wrote:
On 7/27/20 9:58 AM, Ravulapati Vishnu vardhan rao wrote:
changing SND_SOC_RT5682_I2C to SND_SOC_RT5682 because, This flag which was previously set as SND_SOC_RT5682 used to build rt5682 codec driver but by changing into SND_SOC_RT5682_I2C is preventing to build rt5682 codec driver and machine driver fails to probe.So Reverting the changes.
The split between I2C and SoundWire means you have to choose the I2C or SDW mode. Selecting the common part looks very strange.
Right, and I can't understand the commit message at all. What's the actual issue here and how could this fix it - in what situation wouldn't you need one of the bus modules?
[AMD Official Use Only - Internal Distribution Only]
So Actually for rt5682 codec Now in 5.8 there are three flags : SND_SOC_RT5682 SND_SOC_RT5682_I2C SND_SOC_RT5682_SDW
But till 5.7.8 we have SND_SOC_RT5682 SND_SOC_RT5682_SDW
So in our design we were using SND_SOC_RT5682 which build snd_soc_rt5682.ko Creates the respective codec_dais as defined in that .ko
If we use SND_SOC_RT5682_I2C we get snd_soc_rt5682_I2c.ko , it is not creating the expected codec_dai links.
As there are three flags defined in codecs, I expect that previous one which we were using(SND_SOC_RT5682) is not a wrong flag and I expect to use SND_SOC_RT5682 as it is still available.
Thanks, Vishnu
-----Original Message----- From: Mark Brown broonie@kernel.org Sent: Monday, July 27, 2020 9:40 PM To: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com Cc: RAVULAPATI, VISHNU VARDHAN RAO Vishnuvardhanrao.Ravulapati@amd.com; moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM... alsa-devel@alsa-project.org; Arnd Bergmann arnd@arndb.de; open list linux-kernel@vger.kernel.org; YueHaibing yuehaibing@huawei.com; Takashi Iwai tiwai@suse.com; Enric Balletbo i Serra enric.balletbo@collabora.com; Liam Girdwood lgirdwood@gmail.com; Mukunda, Vijendar Vijendar.Mukunda@amd.com; Deucher, Alexander Alexander.Deucher@amd.com; Agrawal, Akshu Akshu.Agrawal@amd.com Subject: Re: [PATCH 3/6] ASoC: amd: SND_SOC_RT5682_I2C does not build rt5682
On Mon, Jul 27, 2020 at 10:31:24AM -0500, Pierre-Louis Bossart wrote:
On 7/27/20 9:58 AM, Ravulapati Vishnu vardhan rao wrote:
changing SND_SOC_RT5682_I2C to SND_SOC_RT5682 because, This flag which was previously set as SND_SOC_RT5682 used to build rt5682 codec driver but by changing into SND_SOC_RT5682_I2C is preventing to build rt5682 codec driver and machine driver fails to probe.So Reverting the changes.
The split between I2C and SoundWire means you have to choose the I2C or SDW mode. Selecting the common part looks very strange.
Right, and I can't understand the commit message at all. What's the actual issue here and how could this fix it - in what situation wouldn't you need one of the bus modules?
On Tue, Jul 28, 2020 at 06:59:50AM +0000, RAVULAPATI, VISHNU VARDHAN RAO wrote:
So Actually for rt5682 codec Now in 5.8 there are three flags : SND_SOC_RT5682 SND_SOC_RT5682_I2C SND_SOC_RT5682_SDW
But till 5.7.8 we have SND_SOC_RT5682 SND_SOC_RT5682_SDW
So in our design we were using SND_SOC_RT5682 which build snd_soc_rt5682.ko Creates the respective codec_dais as defined in that .ko
If we use SND_SOC_RT5682_I2C we get snd_soc_rt5682_I2c.ko , it is not creating the expected codec_dai links.
Could you be more specific about the way in which "it is not creating the expected codec_dai links" please? What are you expecting to happen and what happens instead? Do you see any error messages for example?
As there are three flags defined in codecs, I expect that previous one which we were using(SND_SOC_RT5682) is not a wrong flag and I expect to use SND_SOC_RT5682 as it is still available.
Given that the core module does not register with any bus it is difficult to see how that could possibly work - the core module doesn't contain a driver at all. Have you tested this change?
On 7/28/20 7:07 AM, Mark Brown wrote:
On Tue, Jul 28, 2020 at 06:59:50AM +0000, RAVULAPATI, VISHNU VARDHAN RAO wrote:
So Actually for rt5682 codec Now in 5.8 there are three flags : SND_SOC_RT5682 SND_SOC_RT5682_I2C SND_SOC_RT5682_SDW
But till 5.7.8 we have SND_SOC_RT5682 SND_SOC_RT5682_SDW
So in our design we were using SND_SOC_RT5682 which build snd_soc_rt5682.ko Creates the respective codec_dais as defined in that .ko
If we use SND_SOC_RT5682_I2C we get snd_soc_rt5682_I2c.ko , it is not creating the expected codec_dai links.
Could you be more specific about the way in which "it is not creating the expected codec_dai links" please? What are you expecting to happen and what happens instead? Do you see any error messages for example?
As there are three flags defined in codecs, I expect that previous one which we were using(SND_SOC_RT5682) is not a wrong flag and I expect to use SND_SOC_RT5682 as it is still available.
Given that the core module does not register with any bus it is difficult to see how that could possibly work - the core module doesn't contain a driver at all. Have you tested this change?
I share Mark's point. Have you tested this change on top of Mark's tree, or only on top of the stable kernel?
[AMD Official Use Only - Internal Distribution Only]
-----Original Message----- From: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com Sent: Tuesday, July 28, 2020 5:48 PM To: Mark Brown broonie@kernel.org; RAVULAPATI, VISHNU VARDHAN RAO Vishnuvardhanrao.Ravulapati@amd.com Cc: moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM... alsa-devel@alsa-project.org; Arnd Bergmann arnd@arndb.de; Liam Girdwood lgirdwood@gmail.com; open list linux-kernel@vger.kernel.org; YueHaibing yuehaibing@huawei.com; Takashi Iwai tiwai@suse.com; Deucher, Alexander Alexander.Deucher@amd.com; Mukunda, Vijendar Vijendar.Mukunda@amd.com; Enric Balletbo i Serra enric.balletbo@collabora.com; Agrawal, Akshu Akshu.Agrawal@amd.com Subject: Re: [PATCH 3/6] ASoC: amd: SND_SOC_RT5682_I2C does not build rt5682
On 7/28/20 7:07 AM, Mark Brown wrote:
On Tue, Jul 28, 2020 at 06:59:50AM +0000, RAVULAPATI, VISHNU VARDHAN RAO wrote:
So Actually for rt5682 codec Now in 5.8 there are three flags : SND_SOC_RT5682 SND_SOC_RT5682_I2C SND_SOC_RT5682_SDW
But till 5.7.8 we have SND_SOC_RT5682 SND_SOC_RT5682_SDW
So in our design we were using SND_SOC_RT5682 which build snd_soc_rt5682.ko Creates the respective codec_dais as defined in that .ko
If we use SND_SOC_RT5682_I2C we get snd_soc_rt5682_I2c.ko , it is not creating the expected codec_dai links.
Could you be more specific about the way in which "it is not creating the expected codec_dai links" please? What are you expecting to happen and what happens instead? Do you see any error messages for example?
As there are three flags defined in codecs, I expect that previous one which we were using(SND_SOC_RT5682) is not a wrong flag and I expect to use SND_SOC_RT5682 as it is still available.
Given that the core module does not register with any bus it is difficult to see how that could possibly work - the core module doesn't contain a driver at all. Have you tested this change?
I share Mark's point. Have you tested this change on top of Mark's tree, or only on top of the stable kernel? Ok. I will drop that patch and send the other series.
Thanks,
On Tue, Jul 28, 2020 at 03:24:42PM +0000, RAVULAPATI, VISHNU VARDHAN RAO wrote:
[AMD Official Use Only - Internal Distribution Only]
-----Original Message----- From: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com Sent: Tuesday, July 28, 2020 5:48 PM
I'm not seeing any new text in here?
To: Mark Brown broonie@kernel.org; RAVULAPATI, VISHNU VARDHAN RAO Vishnuvardhanrao.Ravulapati@amd.com Cc: moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM... alsa-devel@alsa-project.org; Arnd Bergmann arnd@arndb.de; Liam Girdwood lgirdwood@gmail.com; open list linux-kernel@vger.kernel.org; YueHaibing yuehaibing@huawei.com; Takashi Iwai tiwai@suse.com; Deucher, Alexander Alexander.Deucher@amd.com; Mukunda, Vijendar Vijendar.Mukunda@amd.com; Enric Balletbo i Serra enric.balletbo@collabora.com; Agrawal, Akshu Akshu.Agrawal@amd.com Subject: Re: [PATCH 3/6] ASoC: amd: SND_SOC_RT5682_I2C does not build rt5682
On 7/28/20 7:07 AM, Mark Brown wrote:
On Tue, Jul 28, 2020 at 06:59:50AM +0000, RAVULAPATI, VISHNU VARDHAN RAO wrote:
So Actually for rt5682 codec Now in 5.8 there are three flags : SND_SOC_RT5682 SND_SOC_RT5682_I2C SND_SOC_RT5682_SDW
But till 5.7.8 we have SND_SOC_RT5682 SND_SOC_RT5682_SDW
So in our design we were using SND_SOC_RT5682 which build snd_soc_rt5682.ko Creates the respective codec_dais as defined in that .ko
If we use SND_SOC_RT5682_I2C we get snd_soc_rt5682_I2c.ko , it is not creating the expected codec_dai links.
Could you be more specific about the way in which "it is not creating the expected codec_dai links" please? What are you expecting to happen and what happens instead? Do you see any error messages for example?
As there are three flags defined in codecs, I expect that previous one which we were using(SND_SOC_RT5682) is not a wrong flag and I expect to use SND_SOC_RT5682 as it is still available.
Given that the core module does not register with any bus it is difficult to see how that could possibly work - the core module doesn't contain a driver at all. Have you tested this change?
I share Mark's point. Have you tested this change on top of Mark's tree, or only on top of the stable kernel? Ok. I will drop that patch and send the other series.
Thanks,
I will drop this patch series and will send new series.
Thanks,
-----Original Message----- From: Mark Brown broonie@kernel.org Sent: Tuesday, July 28, 2020 9:06 PM To: RAVULAPATI, VISHNU VARDHAN RAO Vishnuvardhanrao.Ravulapati@amd.com Cc: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com; moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM... alsa-devel@alsa-project.org; Arnd Bergmann arnd@arndb.de; Liam Girdwood lgirdwood@gmail.com; open list linux-kernel@vger.kernel.org; YueHaibing yuehaibing@huawei.com; Takashi Iwai tiwai@suse.com; Deucher, Alexander Alexander.Deucher@amd.com; Mukunda, Vijendar Vijendar.Mukunda@amd.com; Enric Balletbo i Serra enric.balletbo@collabora.com; Agrawal, Akshu Akshu.Agrawal@amd.com Subject: Re: [PATCH 3/6] ASoC: amd: SND_SOC_RT5682_I2C does not build rt5682
On Tue, Jul 28, 2020 at 03:24:42PM +0000, RAVULAPATI, VISHNU VARDHAN RAO wrote:
[AMD Official Use Only - Internal Distribution Only]
-----Original Message----- From: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com Sent: Tuesday, July 28, 2020 5:48 PM
I'm not seeing any new text in here?
To: Mark Brown broonie@kernel.org; RAVULAPATI, VISHNU VARDHAN RAO Vishnuvardhanrao.Ravulapati@amd.com Cc: moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM... alsa-devel@alsa-project.org; Arnd Bergmann arnd@arndb.de; Liam Girdwood lgirdwood@gmail.com; open list linux-kernel@vger.kernel.org; YueHaibing yuehaibing@huawei.com; Takashi Iwai tiwai@suse.com; Deucher, Alexander Alexander.Deucher@amd.com; Mukunda, Vijendar Vijendar.Mukunda@amd.com; Enric Balletbo i Serra enric.balletbo@collabora.com; Agrawal, Akshu Akshu.Agrawal@amd.com Subject: Re: [PATCH 3/6] ASoC: amd: SND_SOC_RT5682_I2C does not build rt5682
On 7/28/20 7:07 AM, Mark Brown wrote:
On Tue, Jul 28, 2020 at 06:59:50AM +0000, RAVULAPATI, VISHNU VARDHAN RAO wrote:
So Actually for rt5682 codec Now in 5.8 there are three flags : SND_SOC_RT5682 SND_SOC_RT5682_I2C SND_SOC_RT5682_SDW
But till 5.7.8 we have SND_SOC_RT5682 SND_SOC_RT5682_SDW
So in our design we were using SND_SOC_RT5682 which build snd_soc_rt5682.ko Creates the respective codec_dais as defined in that .ko
If we use SND_SOC_RT5682_I2C we get snd_soc_rt5682_I2c.ko , it is not creating the expected codec_dai links.
Could you be more specific about the way in which "it is not creating the expected codec_dai links" please? What are you expecting to happen and what happens instead? Do you see any error messages for example?
As there are three flags defined in codecs, I expect that previous one which we were using(SND_SOC_RT5682) is not a wrong flag and I expect to use SND_SOC_RT5682 as it is still available.
Given that the core module does not register with any bus it is difficult to see how that could possibly work - the core module doesn't contain a driver at all. Have you tested this change?
I share Mark's point. Have you tested this change on top of Mark's tree, or only on top of the stable kernel? Ok. I will drop that patch and send the other series.
Thanks,
Adding support for ALC1015 RTK codec in machine driver. Passing specific card structure based on its ACPI ID.
Signed-off-by: Ravulapati Vishnu vardhan rao Vishnuvardhanrao.Ravulapati@amd.com --- sound/soc/amd/Kconfig | 1 + sound/soc/amd/acp3x-rt5682-max9836.c | 63 ++++++++++++++++++++++++++-- 2 files changed, 60 insertions(+), 4 deletions(-)
diff --git a/sound/soc/amd/Kconfig b/sound/soc/amd/Kconfig index 77ffdb41bee5..3e19995a74bc 100644 --- a/sound/soc/amd/Kconfig +++ b/sound/soc/amd/Kconfig @@ -30,6 +30,7 @@ config SND_SOC_AMD_ACP3x config SND_SOC_AMD_RV_RT5682_MACH tristate "AMD RV support for RT5682" select SND_SOC_RT5682 + select SND_SOC_RT1015 select SND_SOC_MAX98357A select SND_SOC_CROS_EC_CODEC select I2C_CROS_EC_TUNNEL diff --git a/sound/soc/amd/acp3x-rt5682-max9836.c b/sound/soc/amd/acp3x-rt5682-max9836.c index 1e446e4bab25..ac96ef70aafa 100644 --- a/sound/soc/amd/acp3x-rt5682-max9836.c +++ b/sound/soc/amd/acp3x-rt5682-max9836.c @@ -21,6 +21,7 @@
#include "raven/acp3x.h" #include "../codecs/rt5682.h" +#include "../codecs/rt1015.h"
#define PCO_PLAT_CLK 48000000 #define RT5682_PLL_FREQ (48000 * 512) @@ -246,7 +247,18 @@ SND_SOC_DAILINK_DEF(cros_ec, SND_SOC_DAILINK_DEF(platform, DAILINK_COMP_ARRAY(COMP_PLATFORM("acp3x_rv_i2s_dma.0")));
-static struct snd_soc_dai_link acp3x_dai_5682_98357[] = { +static struct snd_soc_codec_conf rt1015_conf[] = { + { + .dlc = COMP_CODEC_CONF("i2c-10EC1015:00"), + .name_prefix = "Left", + }, + { + .dlc = COMP_CODEC_CONF("i2c-10EC1015:01"), + .name_prefix = "Right", + }, +}; + +static struct snd_soc_dai_link acp3x_dai[] = { { .name = "acp3x-5682-play", .stream_name = "Playback", @@ -316,8 +328,8 @@ static const struct snd_kcontrol_new acp3x_5682_mc_controls[] = { static struct snd_soc_card acp3x_5682 = { .name = "acp3xalc5682m98357", .owner = THIS_MODULE, - .dai_link = acp3x_dai_5682_98357, - .num_links = ARRAY_SIZE(acp3x_dai_5682_98357), + .dai_link = acp3x_dai, + .num_links = ARRAY_SIZE(acp3x_dai), .dapm_widgets = acp3x_5682_widgets, .num_dapm_widgets = ARRAY_SIZE(acp3x_5682_widgets), .dapm_routes = acp3x_5682_audio_route, @@ -326,6 +338,47 @@ static struct snd_soc_card acp3x_5682 = { .num_controls = ARRAY_SIZE(acp3x_5682_mc_controls), };
+static const struct snd_soc_dapm_widget acp3x_1015_widgets[] = { + SND_SOC_DAPM_HP("Headphone Jack", NULL), + SND_SOC_DAPM_MIC("Headset Mic", NULL), + SND_SOC_DAPM_MUX("Dmic Mux", SND_SOC_NOPM, 0, 0, + &acp3x_dmic_mux_control), + SND_SOC_DAPM_SPK("Left Spk", NULL), + SND_SOC_DAPM_SPK("Right Spk", NULL), +}; + +static const struct snd_soc_dapm_route acp3x_1015_route[] = { + {"Headphone Jack", NULL, "HPOL"}, + {"Headphone Jack", NULL, "HPOR"}, + {"IN1P", NULL, "Headset Mic"}, + {"Dmic Mux", "Front Mic", "DMIC"}, + {"Dmic Mux", "Rear Mic", "DMIC"}, + {"Left Spk", NULL, "Left SPO"}, + {"Right Spk", NULL, "Right SPO"}, +}; + +static const struct snd_kcontrol_new acp3x_mc_1015_controls[] = { + SOC_DAPM_PIN_SWITCH("Headphone Jack"), + SOC_DAPM_PIN_SWITCH("Headset Mic"), + SOC_DAPM_PIN_SWITCH("Left Spk"), + SOC_DAPM_PIN_SWITCH("Right Spk"), +}; + +static struct snd_soc_card acp3x_1015 = { + .name = "acp3xalc56821015", + .owner = THIS_MODULE, + .dai_link = acp3x_dai, + .num_links = ARRAY_SIZE(acp3x_dai), + .dapm_widgets = acp3x_1015_widgets, + .num_dapm_widgets = ARRAY_SIZE(acp3x_1015_widgets), + .dapm_routes = acp3x_1015_route, + .num_dapm_routes = ARRAY_SIZE(acp3x_1015_route), + .codec_conf = rt1015_conf, + .num_configs = ARRAY_SIZE(rt1015_conf), + .controls = acp3x_mc_1015_controls, + .num_controls = ARRAY_SIZE(acp3x_mc_1015_controls), +}; + void *soc_is_rltk_max(struct device *dev) { const struct acpi_device_id *match; @@ -374,6 +427,7 @@ static int acp3x_probe(struct platform_device *pdev)
static const struct acpi_device_id acp3x_audio_acpi_match[] = { { "AMDI5682", (unsigned long)&acp3x_5682}, + { "AMDI1015", (unsigned long)&acp3x_1015}, {}, }; MODULE_DEVICE_TABLE(acpi, acp3x_audio_acpi_match); @@ -390,5 +444,6 @@ static struct platform_driver acp3x_audio = { module_platform_driver(acp3x_audio);
MODULE_AUTHOR("akshu.agrawal@amd.com"); -MODULE_DESCRIPTION("ALC5682 & MAX98357 audio support"); +MODULE_AUTHOR("Vishnuvardhanrao.Ravulapati@amd.com"); +MODULE_DESCRIPTION("ALC5682 ALC1015 & MAX98357 audio support"); MODULE_LICENSE("GPL v2");
DAI link support for RTK 1015 and providing the codec details depending on the snd_soc_card selected by ACPI ID.
Signed-off-by: Ravulapati Vishnu vardhan rao Vishnuvardhanrao.Ravulapati@amd.com --- sound/soc/amd/acp3x-rt5682-max9836.c | 35 ++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 5 deletions(-)
diff --git a/sound/soc/amd/acp3x-rt5682-max9836.c b/sound/soc/amd/acp3x-rt5682-max9836.c index ac96ef70aafa..607205cb3a98 100644 --- a/sound/soc/amd/acp3x-rt5682-max9836.c +++ b/sound/soc/amd/acp3x-rt5682-max9836.c @@ -32,6 +32,12 @@ static struct clk *rt5682_dai_wclk; static struct clk *rt5682_dai_bclk; static struct gpio_desc *dmic_sel;
+enum { + RT5682 = 0, + MAX, + EC, +}; + static int acp3x_5682_init(struct snd_soc_pcm_runtime *rtd) { int ret; @@ -241,6 +247,9 @@ SND_SOC_DAILINK_DEF(rt5682, DAILINK_COMP_ARRAY(COMP_CODEC("i2c-10EC5682:00", "rt5682-aif1"))); SND_SOC_DAILINK_DEF(max, DAILINK_COMP_ARRAY(COMP_CODEC("MX98357A:00", "HiFi"))); +SND_SOC_DAILINK_DEF(rt1015, + DAILINK_COMP_ARRAY(COMP_CODEC("i2c-10EC1015:00", "rt1015-aif"), + COMP_CODEC("i2c-10EC1015:01", "rt1015-aif"))); SND_SOC_DAILINK_DEF(cros_ec, DAILINK_COMP_ARRAY(COMP_CODEC("GOOG0013:00", "EC Codec I2S RX")));
@@ -259,7 +268,7 @@ static struct snd_soc_codec_conf rt1015_conf[] = { };
static struct snd_soc_dai_link acp3x_dai[] = { - { + [RT5682] = { .name = "acp3x-5682-play", .stream_name = "Playback", .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF @@ -270,16 +279,19 @@ static struct snd_soc_dai_link acp3x_dai[] = { .ops = &acp3x_5682_ops, SND_SOC_DAILINK_REG(acp3x_i2s, rt5682, platform), }, - { + [MAX] = { .name = "acp3x-max98357-play", .stream_name = "HiFi Playback", .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF - | SND_SOC_DAIFMT_CBM_CFM, + | SND_SOC_DAIFMT_CBS_CFS, .dpcm_playback = 1, .ops = &acp3x_max_play_ops, - SND_SOC_DAILINK_REG(acp3x_bt, max, platform), + .cpus = acp3x_bt, + .num_cpus = ARRAY_SIZE(acp3x_bt), + .platforms = platform, + .num_platforms = ARRAY_SIZE(platform), }, - { + [EC] = { .name = "acp3x-ec-dmic0-capture", .stream_name = "Capture DMIC0", .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF @@ -389,6 +401,18 @@ void *soc_is_rltk_max(struct device *dev) return (void *)match->driver_data; }
+static void card_spk_dai_link_present(struct snd_soc_dai_link *links, + const char *card_name) +{ + if (!strcmp(card_name, "acp3xalc56821015")) { + links[1].codecs = rt1015; + links[1].num_codecs = ARRAY_SIZE(rt1015); + } else { + links[1].codecs = max; + links[1].num_codecs = ARRAY_SIZE(max); + } +} + static int acp3x_probe(struct platform_device *pdev) { int ret; @@ -404,6 +428,7 @@ static int acp3x_probe(struct platform_device *pdev) if (!machine) return -ENOMEM;
+ card_spk_dai_link_present(card->dai_link, card->name); card->dev = &pdev->dev; platform_set_drvdata(pdev, card); snd_soc_card_set_drvdata(card, machine);
Adding rt1015 hw_params which set Bit-clock ratio PLL and appropriate sys clk specific with RTK1015.
Signed-off-by: Ravulapati Vishnu vardhan rao Vishnuvardhanrao.Ravulapati@amd.com --- sound/soc/amd/acp3x-rt5682-max9836.c | 39 ++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+)
diff --git a/sound/soc/amd/acp3x-rt5682-max9836.c b/sound/soc/amd/acp3x-rt5682-max9836.c index 607205cb3a98..bf635ae928ae 100644 --- a/sound/soc/amd/acp3x-rt5682-max9836.c +++ b/sound/soc/amd/acp3x-rt5682-max9836.c @@ -126,6 +126,44 @@ static int rt5682_clk_enable(struct snd_pcm_substream *substream) return ret; }
+static int acp3x_1015_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params) +{ + struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct snd_soc_dai *codec_dai; + int srate, i, ret; + + ret = 0; + srate = params_rate(params); + + for (i = 0; i < rtd->num_codecs; i++) { + if (strcmp(rtd->codec_dais[i]->name, "rt1015-aif")) + continue; + codec_dai = rtd->codec_dais[i]; + + ret = snd_soc_dai_set_bclk_ratio(codec_dai, 64); + if (ret < 0) { + dev_err(codec_dai->dev, + "codec_dai bclk ratio not set\n"); + return ret; + } + ret = snd_soc_dai_set_pll(codec_dai, 0, RT1015_PLL_S_BCLK, + 64 * srate, 256 * srate); + if (ret < 0) { + dev_err(codec_dai->dev, "codec_dai PLL not set\n"); + return ret; + } + ret = snd_soc_dai_set_sysclk(codec_dai, RT1015_SCLK_S_PLL, + 256 * srate, SND_SOC_CLOCK_IN); + if (ret < 0) { + dev_err(codec_dai->dev, + "codec_dai sys clock not set\n"); + return ret; + } + } + return ret; +} + static void rt5682_clk_disable(void) { clk_disable_unprepare(rt5682_dai_wclk); @@ -231,6 +269,7 @@ static const struct snd_soc_ops acp3x_5682_ops = { static const struct snd_soc_ops acp3x_max_play_ops = { .startup = acp3x_max_startup, .shutdown = rt5682_shutdown, + .hw_params = acp3x_1015_hw_params, };
static const struct snd_soc_ops acp3x_ec_cap0_ops = {
Hi Ravulapati,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on asoc/for-next] [also build test ERROR on next-20200727] [cannot apply to v5.8-rc7] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Ravulapati-Vishnu-vardhan-rao/ASoC-... base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next config: x86_64-allyesconfig (attached as .config) compiler: gcc-9 (Debian 9.3.0-14) 9.3.0 reproduce (this is a W=1 build): # save the attached .config to linux build tree make W=1 ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot lkp@intel.com
All errors (new ones prefixed by >>):
sound/soc/amd/acp3x-rt5682-max9836.c: In function 'acp3x_1015_hw_params':
sound/soc/amd/acp3x-rt5682-max9836.c:140:17: error: 'struct snd_soc_pcm_runtime' has no member named 'codec_dais'
140 | if (strcmp(rtd->codec_dais[i]->name, "rt1015-aif")) | ^~ sound/soc/amd/acp3x-rt5682-max9836.c:142:18: error: 'struct snd_soc_pcm_runtime' has no member named 'codec_dais' 142 | codec_dai = rtd->codec_dais[i]; | ^~ sound/soc/amd/acp3x-rt5682-max9836.c: At top level: sound/soc/amd/acp3x-rt5682-max9836.c:433:7: warning: no previous prototype for 'soc_is_rltk_max' [-Wmissing-prototypes] 433 | void *soc_is_rltk_max(struct device *dev) | ^~~~~~~~~~~~~~~
vim +140 sound/soc/amd/acp3x-rt5682-max9836.c
128 129 static int acp3x_1015_hw_params(struct snd_pcm_substream *substream, 130 struct snd_pcm_hw_params *params) 131 { 132 struct snd_soc_pcm_runtime *rtd = substream->private_data; 133 struct snd_soc_dai *codec_dai; 134 int srate, i, ret; 135 136 ret = 0; 137 srate = params_rate(params); 138 139 for (i = 0; i < rtd->num_codecs; i++) {
140 if (strcmp(rtd->codec_dais[i]->name, "rt1015-aif"))
141 continue; 142 codec_dai = rtd->codec_dais[i]; 143 144 ret = snd_soc_dai_set_bclk_ratio(codec_dai, 64); 145 if (ret < 0) { 146 dev_err(codec_dai->dev, 147 "codec_dai bclk ratio not set\n"); 148 return ret; 149 } 150 ret = snd_soc_dai_set_pll(codec_dai, 0, RT1015_PLL_S_BCLK, 151 64 * srate, 256 * srate); 152 if (ret < 0) { 153 dev_err(codec_dai->dev, "codec_dai PLL not set\n"); 154 return ret; 155 } 156 ret = snd_soc_dai_set_sysclk(codec_dai, RT1015_SCLK_S_PLL, 157 256 * srate, SND_SOC_CLOCK_IN); 158 if (ret < 0) { 159 dev_err(codec_dai->dev, 160 "codec_dai sys clock not set\n"); 161 return ret; 162 } 163 } 164 return ret; 165 } 166
--- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Hi Ravulapati
+static int acp3x_1015_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
+{
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct snd_soc_dai *codec_dai;
- int srate, i, ret;
- ret = 0;
- srate = params_rate(params);
- for (i = 0; i < rtd->num_codecs; i++) {
You can use for_each_rtd_codec_dais() here
if (strcmp(rtd->codec_dais[i]->name, "rt1015-aif"))
continue;
codec_dai = rtd->codec_dais[i];
ret = snd_soc_dai_set_bclk_ratio(codec_dai, 64);
if (ret < 0) {
dev_err(codec_dai->dev,
"codec_dai bclk ratio not set\n");
return ret;
}
ret = snd_soc_dai_set_pll(codec_dai, 0, RT1015_PLL_S_BCLK,
64 * srate, 256 * srate);
if (ret < 0) {
dev_err(codec_dai->dev, "codec_dai PLL not set\n");
return ret;
}
ret = snd_soc_dai_set_sysclk(codec_dai, RT1015_SCLK_S_PLL,
256 * srate, SND_SOC_CLOCK_IN);
if (ret < 0) {
dev_err(codec_dai->dev,
"codec_dai sys clock not set\n");
return ret;
}
You don't need to use dev_err() for snd_soc_dai_xxx(). Current snd_soc_dai_xxx() will indicate error message in such case.
Thank you for your help !!
Best regards --- Kuninori Morimoto
participants (6)
-
kernel test robot
-
Kuninori Morimoto
-
Mark Brown
-
Pierre-Louis Bossart
-
Ravulapati Vishnu vardhan rao
-
RAVULAPATI, VISHNU VARDHAN RAO