From: nickel@altlinux.org To: devel-kernel@lists.altlinux.org Subject: [d-kernel] [PATCH v2 9/9] ASoC: Intel: sof_es8336: add DMI info based pa-enable lookup quirk for CNL-LP models Date: Thu, 7 Apr 2022 14:15:17 +0300 Message-ID: <20220407111517.1567092-9-nickel@altlinux.org> (raw) In-Reply-To: <20220407111517.1567092-1-nickel@altlinux.org> From: Nikolai Kostrigin <nickel@altlinux.org> Some CNL-LP based laptops as Depo, ICL, Graviton have GPIO to control speaker power amplifier wich is not discoverable via standard or quirked ACPI methods. Use DMI quirk to address the issue. Based on driver by <zhuning@everest-semi.com> Link: https://github.com/thesofproject/linux/issues/3412 Signed-off-by: Nikolai Kostrigin <nickel@altlinux.org> --- sound/soc/intel/boards/sof_es8336.c | 73 +++++++++++++++++++++++++---- 1 file changed, 64 insertions(+), 9 deletions(-) diff --git a/sound/soc/intel/boards/sof_es8336.c b/sound/soc/intel/boards/sof_es8336.c index 65304e6d3b0e..373b8e7f7232 100644 --- a/sound/soc/intel/boards/sof_es8336.c +++ b/sound/soc/intel/boards/sof_es8336.c @@ -34,6 +34,8 @@ static int quirk_override = -1; module_param_named(quirk, quirk_override, int, 0444); MODULE_PARM_DESC(quirk, "Board-specific quirk override"); +static int quirk_pa_enable = -1; + /* jd-inv + terminating entry */ #define SOF_ES8336_PROPS_MAX 2 @@ -231,10 +233,25 @@ static int sof_es8336_quirk_cb(const struct dmi_system_id *id) if (quirk & SOF_ES8336_TGL_GPIO_QUIRK) gpio_mapping = quirk_acpi_es8336_gpios; + if (strcmp(id->ident, "pa-enable ACPI deviant") == 0) { + if (quirk_pa_enable < 0) quirk_pa_enable = 1; + else quirk_pa_enable++; + } + return 1; } static const struct dmi_system_id sof_es8336_quirk_table[] = { + { + .callback = sof_es8336_quirk_cb, + .ident = "pa-enable ACPI deviant", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "3Logic Group"), + DMI_MATCH(DMI_PRODUCT_NAME, "Graviton N15i-K2"), + }, + .driver_data = (void *)(SOF_ES8336_SSP_CODEC(0) | + SOF_ES8336_TGL_GPIO_QUIRK) + }, { .callback = sof_es8336_quirk_cb, .matches = { @@ -243,6 +260,16 @@ static const struct dmi_system_id sof_es8336_quirk_table[] = { }, .driver_data = (void *)SOF_ES8336_SSP_CODEC(2) }, + { + .callback = sof_es8336_quirk_cb, + .ident = "pa-enable ACPI deviant", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "DEPO Computers"), + DMI_MATCH(DMI_PRODUCT_NAME, "DPC156"), + }, + .driver_data = (void *)(SOF_ES8336_SSP_CODEC(0) | + SOF_ES8336_TGL_GPIO_QUIRK) + }, { .callback = sof_es8336_quirk_cb, .matches = { @@ -456,6 +483,18 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev, /* i2c-<HID>:00 with HID being 8 chars */ static char codec_name[SND_ACPI_I2C_ID_LEN]; +/* +* Using the ACPI device name is not very nice, but hopefully makes sense for now +*/ + +static struct gpiod_lookup_table cml_lp_based_gpios_table = { + /* .dev_id is set during probe */ + .table = { + GPIO_LOOKUP("INT34BB:00", 264, "PA_ENABLE", GPIO_ACTIVE_LOW), //cnl kb + { }, + }, +}; + static int sof_es8336_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -507,6 +546,9 @@ static int sof_es8336_probe(struct platform_device *pdev) "i2c-%s", acpi_dev_name(adev)); put_device(&adev->dev); dai_links[0].codecs->name = codec_name; + } else { + dev_err(dev, "Error cannot find '%s' dev\n", mach->id); + return -ENXIO; } ret = snd_soc_fixup_dai_links_platform_name(&sof_es8336_card, @@ -537,16 +579,29 @@ static int sof_es8336_probe(struct platform_device *pdev) } } - ret = devm_acpi_dev_add_driver_gpios(codec_dev, gpio_mapping); - if (ret) - dev_warn(codec_dev, "unable to add GPIO mapping table\n"); + if (quirk_pa_enable < 0) { + ret = devm_acpi_dev_add_driver_gpios(codec_dev, gpio_mapping); + if (ret) + dev_warn(codec_dev, "unable to add GPIO mapping table\n"); - priv->gpio_pa = gpiod_get(codec_dev, "pa-enable", GPIOD_OUT_LOW); - if (IS_ERR(priv->gpio_pa)) { - ret = PTR_ERR(priv->gpio_pa); - dev_err(codec_dev, "%s, could not get pa-enable: %d\n", - __func__, ret); - goto err; + priv->gpio_pa = gpiod_get_optional(codec_dev, "pa-enable", GPIOD_OUT_LOW); + if (IS_ERR(priv->gpio_pa)) { + ret = dev_err_probe(dev, PTR_ERR(priv->gpio_pa), + "could not get pa-enable GPIO\n"); + goto err; + } + } + else { + cml_lp_based_gpios_table.dev_id = dev_name(codec_dev); + gpiod_add_lookup_table(&cml_lp_based_gpios_table); + + priv->gpio_pa = devm_gpiod_get(codec_dev, "PA_ENABLE", GPIOD_OUT_LOW); + if (IS_ERR(priv->gpio_pa)) { + ret = PTR_ERR(priv->gpio_pa); + dev_err(codec_dev, "%s, could not get PA_ENABLE: %d\n", + __func__, ret); + goto err; + } } priv->codec_dev = codec_dev; -- 2.33.0
next prev parent reply other threads:[~2022-04-07 11:15 UTC|newest] Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-04-04 6:28 [d-kernel] [PATCH 0/9] *** backport support for ES83x6 codec in I2S mode for CML/CNL platforms to 5.15.x *** nickel 2022-04-04 6:28 ` [d-kernel] (no subject) nickel 2022-04-04 6:28 ` [d-kernel] [PATCH 1/9] commit 0b220578c2aab3d5ac6b693117e8c5d22e8c2b34 nickel 2022-04-04 14:48 ` Vitaly Chikunov 2022-04-04 15:16 ` Nikolai Kostrigin 2022-04-07 11:15 ` [d-kernel] [PATCH v2 1/9] ASoC: Intel: add machine driver for SOF+ES8336 nickel 2022-04-07 11:15 ` [d-kernel] [PATCH v2 2/9] ASoC: Intel: sof_es8336: Add quirk for inverted jack detect nickel 2022-04-07 11:15 ` [d-kernel] [PATCH v2 3/9] ASoC: es8316: Add power management nickel 2022-04-07 11:15 ` [d-kernel] [PATCH v2 4/9] ASoC: es8316: Use increased GPIO debounce time nickel 2022-04-07 11:15 ` [d-kernel] [PATCH v2 5/9] ASoC: codec: es8326: New codec driver nickel 2022-04-07 11:15 ` [d-kernel] [PATCH v2 6/9] ALSA: intel-dspconfig: add ES8336 support for CNL nickel 2022-04-07 11:15 ` [d-kernel] [PATCH v2 7/9] ASoC: Intel: soc-acpi: add ESSX8336 support on Cannon Lake machines nickel 2022-04-07 11:15 ` [d-kernel] [PATCH v2 8/9] config: CONFIG_SND_SOC_INTEL_SOF_ES8336_MACH=m nickel 2022-04-07 11:15 ` nickel [this message] 2022-04-07 19:32 ` [d-kernel] [PATCH v2 1/9] ASoC: Intel: add machine driver for SOF+ES8336 Vitaly Chikunov 2022-04-12 14:34 ` Nikolai Kostrigin 2022-04-14 8:43 ` Vitaly Chikunov 2022-04-14 8:48 ` Антон Мидюков 2022-04-14 8:52 ` Vitaly Chikunov 2022-04-14 8:55 ` Nikolai Kostrigin 2022-04-04 6:28 ` [d-kernel] [PATCH 2/9] commit 79b5808491cf152b808c51fecdafb221fa270cf1 nickel 2022-04-04 6:28 ` [d-kernel] [PATCH 3/9] commit 8143959d503dd6b3c8b9802cee0f1eba82e8d844 nickel 2022-04-04 6:28 ` [d-kernel] [PATCH 4/9] commit 796f9b0189299a221d4c822be216165dd2371852 nickel 2022-04-04 6:28 ` [d-kernel] [PATCH 5/9] commit f6a1611f744dcdd55c5adaf02f193083286dac34 nickel 2022-04-04 6:28 ` [d-kernel] [PATCH 6/9] ALSA: intel-dspconfig: add ES8336 support for CNL nickel 2022-04-04 6:28 ` [d-kernel] [PATCH 7/9] ASoC: Intel: soc-acpi: add ESSX8336 support on Cannon Lake machines nickel 2022-04-04 6:28 ` [d-kernel] [PATCH 8/9] config: CONFIG_SND_SOC_INTEL_SOF_ES8336_MACH=m nickel 2022-04-04 6:28 ` [d-kernel] [PATCH 9/9] ASoC: Intel: sof_es8336: add DMI info based pa-enable lookup quirk for CNL-LP models nickel
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=20220407111517.1567092-9-nickel@altlinux.org \ --to=nickel@altlinux.org \ --cc=devel-kernel@lists.altlinux.org \ /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
ALT Linux kernel packages development This inbox may be cloned and mirrored by anyone: git clone --mirror http://lore.altlinux.org/devel-kernel/0 devel-kernel/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 devel-kernel devel-kernel/ http://lore.altlinux.org/devel-kernel \ devel-kernel@altlinux.org devel-kernel@altlinux.ru devel-kernel@altlinux.com public-inbox-index devel-kernel Example config snippet for mirrors. Newsgroup available over NNTP: nntp://lore.altlinux.org/org.altlinux.lists.devel-kernel AGPL code for this site: git clone https://public-inbox.org/public-inbox.git