Revert "ASoC: amd: acp: Set gpio_spkr_en to None for max speaker amplifer in machine driver"
Subsystems (3)
PATCH 1/2 Revert "ASoC: amd: acp: Set gpio_spkr_en to None for max speaker amplifer in machine driver"
RT1019 codec has two ways of controlling the en_spkr.
one way is controlling through gpio pin method the another way is through codec register update.
Now Speaker enable/disable is controlled through register update in BIOS. So this patch reverse gpio logic, which is no longer in use.
This reverts commit 7fa5c33d043160eba3be9fb8e21588dff2a467c7.
--- sound/soc/amd/acp/acp-mach.h | 1 + sound/soc/amd/acp/acp-sof-mach.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-)
sound/soc/amd/acp/acp-mach.h +1 -0
@@ -21,6 +21,7 @@#include <linux/gpio/consumer.h> #define EN_SPKR_GPIO_GB 0x11F +#define EN_SPKR_GPIO_NK 0x146#define EN_SPKR_GPIO_NONE -EINVALenum be_id {
sound/soc/amd/acp/acp-sof-mach.c +2 -2
@@ -37,7 +37,7 @@ static struct acp_card_drvdata sof_rt5682_max_data = { .hs_codec_id = RT5682, .amp_codec_id = MAX98360A, .dmic_codec_id = DMIC, - .gpio_spkr_en = EN_SPKR_GPIO_NONE, + .gpio_spkr_en = EN_SPKR_GPIO_NK, };static struct acp_card_drvdata sof_rt5682s_rt1019_data = {
@@ -56,7 +56,7 @@ static struct acp_card_drvdata sof_rt5682s_max_data = { .hs_codec_id = RT5682S, .amp_codec_id = MAX98360A, .dmic_codec_id = DMIC, - .gpio_spkr_en = EN_SPKR_GPIO_NONE, + .gpio_spkr_en = EN_SPKR_GPIO_NK, };static const struct snd_kcontrol_new acp_controls[] = {
Signature · 1 line
2.25.1
PATCH 2/2 Revert "ASoC: amd: acp: Power on/off the speaker enable gpio pin based on DAPM callback."
RT1019 codec has two ways of controlling the en_spkr.
one way is controlling through gpio pin method the another way is through codec register update.
Now Speaker enable/disable is controlled through register update in BIOS. So this patch reverse gpio logic, which is no longer in use.
This reverts commit 5c5f08f7fc0bee9a1bc3fbdcb7a21cfd0648ab14.
--- sound/soc/amd/acp/Kconfig | 6 +++--- sound/soc/amd/acp/acp-legacy-mach.c | 21 +++------------------ sound/soc/amd/acp/acp-mach-common.c | 25 ------------------------- sound/soc/amd/acp/acp-mach.h | 10 +--------- sound/soc/amd/acp/acp-sof-mach.c | 21 +++------------------ 5 files changed, 10 insertions(+), 73 deletions(-)
sound/soc/amd/acp/Kconfig +3 -3
@@ -42,7 +42,7 @@ config SND_AMD_ASOC_RENOIR config SND_SOC_AMD_MACH_COMMON tristate - depends on X86 && PCI && I2C && GPIOLIB + depends on X86 && PCI && I2C select CLK_FIXED_FCH select SND_SOC_RT5682_I2C select SND_SOC_DMIC
@@ -54,14 +54,14 @@ config SND_SOC_AMD_MACH_COMMON config SND_SOC_AMD_LEGACY_MACH tristate "AMD Legacy Machine Driver Support" - depends on X86 && PCI && I2C && GPIOLIB + depends on X86 && PCI && I2C select SND_SOC_AMD_MACH_COMMON help This option enables legacy sound card support for ACP audio. config SND_SOC_AMD_SOF_MACH tristate "AMD SOF Machine Driver Support" - depends on X86 && PCI && I2C && GPIOLIB + depends on X86 && PCI && I2C select SND_SOC_AMD_MACH_COMMON help This option enables SOF sound card support for ACP audio.
sound/soc/amd/acp/acp-legacy-mach.c +3 -18
@@ -27,7 +27,6 @@ static struct acp_card_drvdata rt5682_rt1019_data = { .hs_codec_id = RT5682, .amp_codec_id = RT1019, .dmic_codec_id = DMIC, - .gpio_spkr_en = EN_SPKR_GPIO_GB, };static struct acp_card_drvdata rt5682s_max_data = {
@@ -37,7 +36,6 @@ static struct acp_card_drvdata rt5682s_max_data = { .hs_codec_id = RT5682S, .amp_codec_id = MAX98360A, .dmic_codec_id = DMIC, - .gpio_spkr_en = EN_SPKR_GPIO_NONE, };static struct acp_card_drvdata rt5682s_rt1019_data = {
@@ -47,7 +45,6 @@ static struct acp_card_drvdata rt5682s_rt1019_data = { .hs_codec_id = RT5682S, .amp_codec_id = RT1019, .dmic_codec_id = DMIC, - .gpio_spkr_en = EN_SPKR_GPIO_NONE, };static const struct snd_kcontrol_new acp_controls[] = {
@@ -62,16 +59,15 @@ static const struct snd_kcontrol_new acp_controls[] = {static const struct snd_soc_dapm_widget acp_widgets[] = {SND_SOC_DAPM_HP ("Headphone Jack" ,NULL ),SND_SOC_DAPM_MIC ("Headset Mic" ,NULL ), -SND_SOC_DAPM_SPK ("Spk" , event_spkr_handler), -SND_SOC_DAPM_SPK ("Left Spk" , event_spkr_handler), -SND_SOC_DAPM_SPK ("Right Spk" , event_spkr_handler), +SND_SOC_DAPM_SPK ("Spk" ,NULL ), +SND_SOC_DAPM_SPK ("Left Spk" ,NULL ), +SND_SOC_DAPM_SPK ("Right Spk" ,NULL ), };static int acp_asoc_probe (struct platform_device *pdev) {struct snd_soc_card *card =NULL ;struct device *dev = &pdev->dev; -unsigned int spkr_gpio;int ret;if (!pdev->id_entry)
@@ -89,20 +85,9 @@ static int acp_asoc_probe(struct platform_device *pdev) card->controls = acp_controls; card->num_controls =ARRAY_SIZE (acp_controls); card->drvdata = (struct acp_card_drvdata *)pdev->id_entry->driver_data; - spkr_gpio = ((struct acp_card_drvdata *)(card->drvdata))->gpio_spkr_en;acp_legacy_dai_links_create (card); -if (gpio_is_valid (spkr_gpio)) { - ret =devm_gpio_request (dev, spkr_gpio,"spkren" ); -if (ret) { -dev_err (dev,"(%s) gpio request failed: %d\n" , - __func__, ret); -return ret; - } -gpio_direction_output (spkr_gpio,0 ); - } - ret =devm_snd_soc_register_card (&pdev->dev, card);if (ret) { dev_err(&pdev->dev,
sound/soc/amd/acp/acp-mach-common.c +0 -25
@@ -71,31 +71,6 @@ static const struct snd_soc_dapm_route rt5682_map[] = { { "IN1P", NULL, "Headset Mic" }, }; -int event_spkr_handler (struct snd_soc_dapm_widget *w, -struct snd_kcontrol *k,int event) -{ -struct snd_soc_dapm_context *dapm = w->dapm; -struct snd_soc_card *card = dapm->card; -struct acp_card_drvdata *drvdata =snd_soc_card_get_drvdata (card); - -if (!gpio_is_valid (drvdata->gpio_spkr_en)) -return 0 ; - -switch (event) { -case SND_SOC_DAPM_POST_PMU : -gpio_set_value (drvdata->gpio_spkr_en,1 ); -break ; -case SND_SOC_DAPM_PRE_PMD : -gpio_set_value (drvdata->gpio_spkr_en,0 ); -break ; -default : -dev_warn (card->dev,"%s invalid setting\n" , __func__); -break ; - } -return 0 ; -} -EXPORT_SYMBOL_NS_GPL (event_spkr_handler,SND_SOC_AMD_MACH ); -/* Define card ops for RT5682 CODEC */ static int acp_card_rt5682_init (struct snd_soc_pcm_runtime *rtd) {
sound/soc/amd/acp/acp-mach.h +1 -9
@@ -17,12 +17,6 @@#include <linux/input.h> #include <linux/module.h> #include <sound/soc.h> -#include <linux/gpio.h> -#include <linux/gpio/consumer.h> - -#define EN_SPKR_GPIO_GB 0x11F -#define EN_SPKR_GPIO_NK 0x146 -#define EN_SPKR_GPIO_NONE -EINVALenum be_id {HEADSET_BE_ID =0 ,
@@ -55,11 +49,9 @@ struct acp_card_drvdata {unsigned int dai_fmt;struct clk *wclk; struct clk *bclk; - unsigned int gpio_spkr_en; };int acp_sofdsp_dai_links_create (struct snd_soc_card *card);int acp_legacy_dai_links_create (struct snd_soc_card *card); -int event_spkr_handler (struct snd_soc_dapm_widget *w, -struct snd_kcontrol *k,int event); +#endif
sound/soc/amd/acp/acp-sof-mach.c +3 -18
@@ -27,7 +27,6 @@ static struct acp_card_drvdata sof_rt5682_rt1019_data = { .hs_codec_id = RT5682, .amp_codec_id = RT1019, .dmic_codec_id = DMIC, - .gpio_spkr_en = EN_SPKR_GPIO_GB, };static struct acp_card_drvdata sof_rt5682_max_data = {
@@ -37,7 +36,6 @@ static struct acp_card_drvdata sof_rt5682_max_data = { .hs_codec_id = RT5682, .amp_codec_id = MAX98360A, .dmic_codec_id = DMIC, - .gpio_spkr_en = EN_SPKR_GPIO_NK, };static struct acp_card_drvdata sof_rt5682s_rt1019_data = {
@@ -56,7 +54,6 @@ static struct acp_card_drvdata sof_rt5682s_max_data = { .hs_codec_id = RT5682S, .amp_codec_id = MAX98360A, .dmic_codec_id = DMIC, - .gpio_spkr_en = EN_SPKR_GPIO_NK, };static const struct snd_kcontrol_new acp_controls[] = {
@@ -70,16 +67,15 @@ static const struct snd_kcontrol_new acp_controls[] = {static const struct snd_soc_dapm_widget acp_widgets[] = {SND_SOC_DAPM_HP ("Headphone Jack" ,NULL ),SND_SOC_DAPM_MIC ("Headset Mic" ,NULL ), -SND_SOC_DAPM_SPK ("Spk" , event_spkr_handler), -SND_SOC_DAPM_SPK ("Left Spk" , event_spkr_handler), -SND_SOC_DAPM_SPK ("Right Spk" , event_spkr_handler), +SND_SOC_DAPM_SPK ("Spk" ,NULL ), +SND_SOC_DAPM_SPK ("Left Spk" ,NULL ), +SND_SOC_DAPM_SPK ("Right Spk" ,NULL ), };static int acp_sof_probe (struct platform_device *pdev) {struct snd_soc_card *card =NULL ;struct device *dev = &pdev->dev; -unsigned int spkr_gpio;int ret;if (!pdev->id_entry)
@@ -97,20 +93,9 @@ static int acp_sof_probe(struct platform_device *pdev) card->controls = acp_controls; card->num_controls =ARRAY_SIZE (acp_controls); card->drvdata = (struct acp_card_drvdata *)pdev->id_entry->driver_data; - spkr_gpio = ((struct acp_card_drvdata *)(card->drvdata))->gpio_spkr_en;acp_sofdsp_dai_links_create (card); -if (gpio_is_valid (spkr_gpio)) { - ret =devm_gpio_request (dev, spkr_gpio,"spkren" ); -if (ret) { -dev_err (dev,"(%s) gpio request failed: %d\n" , - __func__, ret); -return ret; - } -gpio_direction_output (spkr_gpio,0 ); - } - ret =devm_snd_soc_register_card (&pdev->dev, card);if (ret) { dev_err(&pdev->dev,
Signature · 1 line
2.25.1
Mark Brown
maintainerQuoted 5 lines · V sujith kumar Reddy
RT1019 codec has two ways of controlling the
en_spkr.
one way is controlling through gpio pin method the another way is through codec register update.Now Speaker enable/disable is controlled through register update in BIOS. So this patch reverse gpio logic, which is no longer in use.
Surely this needs to be keyed off BIOS version otherwise we'll break things for systems where the user hasn't updated their BIOS?
Please submit patches using subject lines reflecting the style for the subsystem, this makes it easier for people to identify relevant patches. Look at what existing commits in the area you're changing are doing and make sure your subject lines visually resemble what they're doing. There's no need to resubmit to fix this alone.
Quoted 6 lines · Mark Brown
Quoted 5 lines · V sujith kumar Reddy
RT1019 codec has two ways of controlling the
en_spkr.
one way is controlling through gpio pin method the another way is through codec register update.Now Speaker enable/disable is controlled through register update in BIOS. So this patch reverse gpio logic, which is no longer in use.
Quoted 8 lines
Surely this needs to be keyed off BIOS version otherwise we'll break things for systems where the user hasn't updated their BIOS?
Please submit patches using subject lines reflecting the style for the subsystem, this makes it easier for people to identify relevant patches. Look at what existing commits in the area you're changing are doing and make sure your subject lines visually resemble what they're doing. There's no need to resubmit to fix this alone.
Hi Mark,
There is a mistake in commit message,Speaker enable and disable is controlled through rt1019 codec driver not through Bios.
Apologies for the inconvenience. We will update the commit message and resend.