Skip to content

Commit 890a408

Browse files
plbossartbroonie
authored andcommitted
ASoC: Intel: sof_es8336: simplify speaker gpio naming
In preparation for the support of an additional gpio for headphone control, rename GPIOs to make explicit references to speakers and gpio0 or gpio1. No functionality change. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org> Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/3008c576ca45d5cc99ad4a18d1d30de45a0aff80.1649357263.git.mchehab@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent fcd1e39 commit 890a408

1 file changed

Lines changed: 21 additions & 21 deletions

File tree

sound/soc/intel/boards/sof_es8336.c

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#define SOF_ES8336_SSP_CODEC(quirk) ((quirk) & GENMASK(3, 0))
2828
#define SOF_ES8336_SSP_CODEC_MASK (GENMASK(3, 0))
2929

30-
#define SOF_ES8336_TGL_GPIO_QUIRK BIT(4)
30+
#define SOF_ES8336_SPEAKERS_EN_GPIO1_QUIRK BIT(4)
3131
#define SOF_ES8336_ENABLE_DMIC BIT(5)
3232
#define SOF_ES8336_JD_INVERTED BIT(6)
3333

@@ -39,7 +39,7 @@ MODULE_PARM_DESC(quirk, "Board-specific quirk override");
3939

4040
struct sof_es8336_private {
4141
struct device *codec_dev;
42-
struct gpio_desc *gpio_pa;
42+
struct gpio_desc *gpio_speakers;
4343
struct snd_soc_jack jack;
4444
struct list_head hdmi_pcm_list;
4545
bool speaker_en;
@@ -51,28 +51,28 @@ struct sof_hdmi_pcm {
5151
int device;
5252
};
5353

54-
static const struct acpi_gpio_params pa_enable_gpio = { 0, 0, true };
55-
static const struct acpi_gpio_mapping acpi_es8336_gpios[] = {
56-
{ "pa-enable-gpios", &pa_enable_gpio, 1 },
54+
static const struct acpi_gpio_params speakers_enable_gpio0 = { 0, 0, true };
55+
static const struct acpi_gpio_mapping acpi_speakers_enable_gpio0[] = {
56+
{ "speakers-enable-gpios", &speakers_enable_gpio0, 1 },
5757
{ }
5858
};
5959

60-
static const struct acpi_gpio_params quirk_pa_enable_gpio = { 1, 0, true };
61-
static const struct acpi_gpio_mapping quirk_acpi_es8336_gpios[] = {
62-
{ "pa-enable-gpios", &quirk_pa_enable_gpio, 1 },
60+
static const struct acpi_gpio_params speakers_enable_gpio1 = { 1, 0, true };
61+
static const struct acpi_gpio_mapping acpi_speakers_enable_gpio1[] = {
62+
{ "speakers-enable-gpios", &speakers_enable_gpio1, 1 },
6363
{ }
6464
};
6565

66-
static const struct acpi_gpio_mapping *gpio_mapping = acpi_es8336_gpios;
66+
static const struct acpi_gpio_mapping *gpio_mapping = acpi_speakers_enable_gpio0;
6767

6868
static void log_quirks(struct device *dev)
6969
{
7070
dev_info(dev, "quirk mask %#lx\n", quirk);
7171
dev_info(dev, "quirk SSP%ld\n", SOF_ES8336_SSP_CODEC(quirk));
7272
if (quirk & SOF_ES8336_ENABLE_DMIC)
7373
dev_info(dev, "quirk DMIC enabled\n");
74-
if (quirk & SOF_ES8336_TGL_GPIO_QUIRK)
75-
dev_info(dev, "quirk TGL GPIO enabled\n");
74+
if (quirk & SOF_ES8336_SPEAKERS_EN_GPIO1_QUIRK)
75+
dev_info(dev, "Speakers GPIO1 quirk enabled\n");
7676
if (quirk & SOF_ES8336_JD_INVERTED)
7777
dev_info(dev, "quirk JD inverted enabled\n");
7878
}
@@ -88,7 +88,7 @@ static int sof_es8316_speaker_power_event(struct snd_soc_dapm_widget *w,
8888
else
8989
priv->speaker_en = true;
9090

91-
gpiod_set_value_cansleep(priv->gpio_pa, priv->speaker_en);
91+
gpiod_set_value_cansleep(priv->gpio_speakers, priv->speaker_en);
9292

9393
return 0;
9494
}
@@ -233,8 +233,8 @@ static int sof_es8336_quirk_cb(const struct dmi_system_id *id)
233233
{
234234
quirk = (unsigned long)id->driver_data;
235235

236-
if (quirk & SOF_ES8336_TGL_GPIO_QUIRK)
237-
gpio_mapping = quirk_acpi_es8336_gpios;
236+
if (quirk & SOF_ES8336_SPEAKERS_EN_GPIO1_QUIRK)
237+
gpio_mapping = acpi_speakers_enable_gpio1;
238238

239239
return 1;
240240
}
@@ -257,7 +257,7 @@ static const struct dmi_system_id sof_es8336_quirk_table[] = {
257257
DMI_MATCH(DMI_SYS_VENDOR, "IP3 tech"),
258258
DMI_MATCH(DMI_BOARD_NAME, "WN1"),
259259
},
260-
.driver_data = (void *)(SOF_ES8336_TGL_GPIO_QUIRK)
260+
.driver_data = (void *)(SOF_ES8336_SPEAKERS_EN_GPIO1_QUIRK)
261261
},
262262
{}
263263
};
@@ -585,10 +585,10 @@ static int sof_es8336_probe(struct platform_device *pdev)
585585
if (ret)
586586
dev_warn(codec_dev, "unable to add GPIO mapping table\n");
587587

588-
priv->gpio_pa = gpiod_get_optional(codec_dev, "pa-enable", GPIOD_OUT_LOW);
589-
if (IS_ERR(priv->gpio_pa)) {
590-
ret = dev_err_probe(dev, PTR_ERR(priv->gpio_pa),
591-
"could not get pa-enable GPIO\n");
588+
priv->gpio_speakers = gpiod_get_optional(codec_dev, "speakers-enable", GPIOD_OUT_LOW);
589+
if (IS_ERR(priv->gpio_speakers)) {
590+
ret = dev_err_probe(dev, PTR_ERR(priv->gpio_speakers),
591+
"could not get speakers-enable GPIO\n");
592592
goto err_put_codec;
593593
}
594594

@@ -604,7 +604,7 @@ static int sof_es8336_probe(struct platform_device *pdev)
604604

605605
ret = devm_snd_soc_register_card(dev, card);
606606
if (ret) {
607-
gpiod_put(priv->gpio_pa);
607+
gpiod_put(priv->gpio_speakers);
608608
dev_err(dev, "snd_soc_register_card failed: %d\n", ret);
609609
goto err_put_codec;
610610
}
@@ -622,7 +622,7 @@ static int sof_es8336_remove(struct platform_device *pdev)
622622
struct snd_soc_card *card = platform_get_drvdata(pdev);
623623
struct sof_es8336_private *priv = snd_soc_card_get_drvdata(card);
624624

625-
gpiod_put(priv->gpio_pa);
625+
gpiod_put(priv->gpio_speakers);
626626
device_remove_software_node(priv->codec_dev);
627627
put_device(priv->codec_dev);
628628

0 commit comments

Comments
 (0)