ASoC: amd: add logic to check dmic hardware runtime
Subsystems (3)
Vijendar Mukunda
maintainerPATCH 1/1 ASoC: amd: add logic to check dmic hardware runtime
Add logic to check DMIC hardware exists or not on
the platform at runtime.
Add module param for overriding DMIC hardware check at runtime.
--- sound/soc/amd/renoir/rn-pci-acp3x.c | 29 +++++++++++++++++++++++++++++ sound/soc/amd/renoir/rn_acp3x.h | 2 ++ 2 files changed, 31 insertions(+)
sound/soc/amd/renoir/rn-pci-acp3x.c +29 -0
@@ -5,6 +5,7 @@//Copyright 2020 Advanced Micro Devices, Inc. #include <linux/pci.h> +#include <linux/acpi.h> #include <linux/module.h> #include <linux/io.h> #include <linux/delay.h>
@@ -18,6 +19,16 @@ static int acp_power_gating;module_param (acp_power_gating, int,0644 );MODULE_PARM_DESC (acp_power_gating,"Enable acp power gating" ); +/** +* dmic_acpi_check = -1 - Checks ACPI method to know DMIC hardware status runtime +* = 0 - Skips the DMIC device creation and returns probe failure +* = 1 - Assumes that platform has DMIC support and skips ACPI +* method check +*/ +static int dmic_acpi_check =ACP_DMIC_AUTO ; +module_param (dmic_acpi_check, int,0644 ); +MODULE_PARM_DESC (dmic_acpi_check,"checks Dmic hardware runtime" ); +struct acp_dev_data {void __iomem *acp_base;struct resource *res;
@@ -157,6 +168,8 @@ static int snd_rn_acp_probe(struct pci_dev *pci, {struct acp_dev_data *adata;struct platform_device_info pdevinfo[ACP_DEVS ]; +acpi_handle handle; +acpi_integer dmic_status;unsigned int irqflags;int ret, index;u32 addr;
@@ -201,6 +214,22 @@ static int snd_rn_acp_probe(struct pci_dev *pci,if (ret) goto disable_msi; +if (!dmic_acpi_check) { + ret = -ENODEV ; + goto de_init; + }else if (dmic_acpi_check ==ACP_DMIC_AUTO ) { + handle =ACPI_HANDLE (&pci->dev); + ret =acpi_evaluate_integer (handle,"_WOV" ,NULL , &dmic_status); +if (ACPI_FAILURE (ret)) { + ret = -EINVAL ; + goto de_init; + } +if (!dmic_status) { + ret = -ENODEV ; + goto de_init; + } + } + adata->res =devm_kzalloc (&pci->dev,sizeof (struct resource ) *2 ,GFP_KERNEL );
sound/soc/amd/renoir/rn_acp3x.h +2 -0
@@ -55,6 +55,8 @@#define MAX_BUFFER (CAPTURE_MAX_PERIOD_SIZE * CAPTURE_MAX_NUM_PERIODS)#define MIN_BUFFER MAX_BUFFER +#define ACP_DMIC_AUTO -1 +struct pdm_dev_data {u32 pdm_irq;void __iomem *acp_base;
Signature · 1 line
2.7.4
[AMD Public Use]
Quoted 9 lines
-----Original Message-----
From: Vijendar Mukunda <[email protected]>
Sent: Tuesday, June 23, 2020 4:27 PM
To: [email protected]; [email protected]
Cc: Deucher, Alexander <[email protected]>; Arya, Virendra- Pratap <[email protected]>; [email protected]; Mukunda, Vijendar <[email protected]>
Subject: [PATCH] ASoC: amd: add logic to check dmic hardware runtime
Quoted 5 lines
Add logic to check DMIC hardware exists or not on the platform at runtime.
Add module param for overriding DMIC hardware check at runtime.
Signed-off-by Vijendar Mukunda <[email protected]>
Quoted 85 lines
--- sound/soc/amd/renoir/rn-pci-acp3x.c | 29 +++++++++++++++++++++++++++++ sound/soc/amd/renoir/rn_acp3x.h | 2 ++ 2 files changed, 31 insertions(+)sound/soc/amd/renoir/rn-pci-acp3x.c +3
-0@@ -5,6 +5,7 @@//Copyright 2020 Advanced Micro Devices, Inc. #include <linux/pci.h> +#include <linux/acpi.h> #include <linux/module.h> #include <linux/io.h> #include <linux/delay.h> @@ -18,6 +19,16 @@ static int acp_power_gating;module_param (acp_power_gating, int,0644 );MODULE_PARM_DESC (acp_power_gating,"Enable acp power gating" ); +/** +* dmic_acpi_check = -1 - Checks ACPI method to know DMIC hardware status runtime
+ * = 0 - Skips the DMIC device creation and returns probe failure
+ * = 1 - Assumes that platform has DMIC support and skips ACPI
+ * method check
+ */sound/soc/amd/renoir/rn-pci-acp3x.c +3
-0+static int dmic_acpi_check =ACP_DMIC_AUTO ; +module_param (dmic_acpi_check, int,0644 ); +MODULE_PARM_DESC(dmic_acpi_check, "checks Dmic hardwareruntime");
sound/soc/amd/renoir/rn-pci-acp3x.c +19
-0+struct acp_dev_data {void __iomem *acp_base;struct resource *res;@@ -157,6 +168,8 @@ static int snd_rn_acp_probe(struct pci_dev *pci, {struct acp_dev_data *adata;struct platform_device_info pdevinfo[ACP_DEVS ]; +acpi_handle handle; +acpi_integer dmic_status;unsigned int irqflags;int ret, index;u32 addr;@@ -201,6 +214,22 @@ static int snd_rn_acp_probe(struct pci_dev *pci,if (ret) goto disable_msi; +if (!dmic_acpi_check) { + ret = -ENODEV ; + goto de_init; + }else if (dmic_acpi_check ==ACP_DMIC_AUTO ) { + handle =ACPI_HANDLE (&pci->dev); + ret =acpi_evaluate_integer (handle,"_WOV" ,NULL , &dmic_status); +if (ACPI_FAILURE (ret)) { + ret = -EINVAL ; + goto de_init; + } +if (!dmic_status) { + ret = -ENODEV ; + goto de_init; + } + } + adata->res = devm_kzalloc(&pci->dev, sizeof(struct resource) * 2,sound/soc/amd/renoir/rn-pci-acp3x.c +0
-0GFP_KERNEL);(quoted diff) +0
-0
b/sound/soc/amd/renoir/rn_acp3x.hindex 75228e3..1462039 100644sound/soc/amd/renoir/rn_acp3x.h +0
-0@@ -55,6 +55,8 @@#define MAX_BUFFER (CAPTURE_MAX_PERIOD_SIZE *
CAPTURE_MAX_NUM_PERIODS) #defineMIN_BUFFERMAX_BUFFERsound/soc/amd/renoir/rn_acp3x.h +2
-1+#define ACP_DMIC_AUTO -1 +struct pdm_dev_data {u32 pdm_irq;void __iomem *acp_base; --2.7.4
Jaroslav Kysela
maintainerDne 23. 06. 20 v 22:27 Vijendar Mukunda napsal(a):
Quoted 26 lines
Add logic to check DMIC hardware exists or not on
the platform at runtime.Add module param for overriding DMIC hardware check at runtime.
Signed-off-by Vijendar Mukunda <[email protected]>--- sound/soc/amd/renoir/rn-pci-acp3x.c | 29 +++++++++++++++++++++++++++++ sound/soc/amd/renoir/rn_acp3x.h | 2 ++ 2 files changed, 31 insertions(+)sound/soc/amd/renoir/rn-pci-acp3x.c +1
-0@@ -5,6 +5,7 @@//Copyright 2020 Advanced Micro Devices, Inc. #include <linux/pci.h> +#include <linux/acpi.h> #include <linux/module.h> #include <linux/io.h> #include <linux/delay.h> @@ -18,6 +19,16 @@ static int acp_power_gating;module_param (acp_power_gating, int,0644 );
sound/soc/amd/renoir/rn-pci-acp3x.c static int acp_power_gating; · line 29
Quoted 10 lines
sound/soc/amd/renoir/rn-pci-acp3x.c +8
-0MODULE_PARM_DESC (acp_power_gating,"Enable acp power gating" ); +/** +* dmic_acpi_check = -1 - Checks ACPI method to know DMIC hardware status runtime +* = 0 - Skips the DMIC device creation and returns probe failure +* = 1 - Assumes that platform has DMIC support and skips ACPI +* method check +*/ +static int dmic_acpi_check =ACP_DMIC_AUTO ; +module_param (dmic_acpi_check, int,0644 );
I think that Takashi suggested the bint (boolean/integer type here):
module_param(dmic_acpi_check, bint, 0644);
Jaroslav
Signature · 2 lines
Jaroslav Kysela <[email protected]> Linux Sound Maintainer; ALSA Project; Red Hat, Inc.