mirror of
https://github.com/torvalds/linux.git
synced 2026-06-03 12:03:54 +02:00
ASoC: amd: ps: add callback to read acp pin configuration
Add pci driver callback to read acp pin configuration for ACP6.3 platform. Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com> Link: https://patch.msgid.link/20250207062819.1527184-6-Vijendar.Mukunda@amd.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
4916283880
commit
6547577e94
|
|
@ -221,6 +221,7 @@ struct acp63_dev_data;
|
|||
* struct acp_hw_ops - ACP PCI driver platform specific ops
|
||||
* @acp_init: ACP initialization
|
||||
* @acp_deinit: ACP de-initialization
|
||||
* @acp_get_config: function to read the acp pin configuration
|
||||
* acp_suspend: ACP system level suspend callback
|
||||
* acp_resume: ACP system level resume callback
|
||||
* acp_suspend_runtime: ACP runtime suspend callback
|
||||
|
|
@ -229,6 +230,7 @@ struct acp63_dev_data;
|
|||
struct acp_hw_ops {
|
||||
int (*acp_init)(void __iomem *acp_base, struct device *dev);
|
||||
int (*acp_deinit)(void __iomem *acp_base, struct device *dev);
|
||||
void (*acp_get_config)(struct pci_dev *pci, struct acp63_dev_data *acp_data);
|
||||
int (*acp_suspend)(struct device *dev);
|
||||
int (*acp_resume)(struct device *dev);
|
||||
int (*acp_suspend_runtime)(struct device *dev);
|
||||
|
|
@ -303,6 +305,12 @@ static inline int acp_hw_deinit(struct acp63_dev_data *adata, struct device *dev
|
|||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
static inline void acp_hw_get_config(struct pci_dev *pci, struct acp63_dev_data *adata)
|
||||
{
|
||||
if (adata && adata->hw_ops && adata->hw_ops->acp_get_config)
|
||||
ACP_HW_OPS(adata, acp_get_config)(pci, adata);
|
||||
}
|
||||
|
||||
static inline int acp_hw_suspend(struct device *dev)
|
||||
{
|
||||
struct acp63_dev_data *adata = dev_get_drvdata(dev);
|
||||
|
|
|
|||
|
|
@ -299,7 +299,6 @@ static int get_acp63_device_config(struct pci_dev *pci, struct acp63_dev_data *a
|
|||
const union acpi_object *obj;
|
||||
acpi_handle handle;
|
||||
acpi_integer dmic_status;
|
||||
u32 config;
|
||||
bool is_dmic_dev = false;
|
||||
bool is_sdw_dev = false;
|
||||
bool wov_en, dmic_en;
|
||||
|
|
@ -309,30 +308,7 @@ static int get_acp63_device_config(struct pci_dev *pci, struct acp63_dev_data *a
|
|||
wov_en = true;
|
||||
dmic_en = false;
|
||||
|
||||
config = readl(acp_data->acp63_base + ACP_PIN_CONFIG);
|
||||
switch (config) {
|
||||
case ACP_CONFIG_4:
|
||||
case ACP_CONFIG_5:
|
||||
case ACP_CONFIG_10:
|
||||
case ACP_CONFIG_11:
|
||||
acp_data->is_pdm_config = true;
|
||||
break;
|
||||
case ACP_CONFIG_2:
|
||||
case ACP_CONFIG_3:
|
||||
acp_data->is_sdw_config = true;
|
||||
break;
|
||||
case ACP_CONFIG_6:
|
||||
case ACP_CONFIG_7:
|
||||
case ACP_CONFIG_12:
|
||||
case ACP_CONFIG_8:
|
||||
case ACP_CONFIG_13:
|
||||
case ACP_CONFIG_14:
|
||||
acp_data->is_pdm_config = true;
|
||||
acp_data->is_sdw_config = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
acp_hw_get_config(pci, acp_data);
|
||||
|
||||
if (acp_data->is_pdm_config) {
|
||||
pdm_dev = acpi_find_child_device(ACPI_COMPANION(&pci->dev), ACP63_DMIC_ADDR, 0);
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
#include <linux/export.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/iopoll.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
|
||||
|
|
@ -98,6 +99,37 @@ static int acp63_deinit(void __iomem *acp_base, struct device *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void acp63_get_config(struct pci_dev *pci, struct acp63_dev_data *acp_data)
|
||||
{
|
||||
u32 config;
|
||||
|
||||
config = readl(acp_data->acp63_base + ACP_PIN_CONFIG);
|
||||
dev_dbg(&pci->dev, "ACP config value: %d\n", config);
|
||||
switch (config) {
|
||||
case ACP_CONFIG_4:
|
||||
case ACP_CONFIG_5:
|
||||
case ACP_CONFIG_10:
|
||||
case ACP_CONFIG_11:
|
||||
acp_data->is_pdm_config = true;
|
||||
break;
|
||||
case ACP_CONFIG_2:
|
||||
case ACP_CONFIG_3:
|
||||
acp_data->is_sdw_config = true;
|
||||
break;
|
||||
case ACP_CONFIG_6:
|
||||
case ACP_CONFIG_7:
|
||||
case ACP_CONFIG_12:
|
||||
case ACP_CONFIG_8:
|
||||
case ACP_CONFIG_13:
|
||||
case ACP_CONFIG_14:
|
||||
acp_data->is_pdm_config = true;
|
||||
acp_data->is_sdw_config = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static bool check_acp_sdw_enable_status(struct acp63_dev_data *adata)
|
||||
{
|
||||
u32 sdw0_en, sdw1_en;
|
||||
|
|
@ -183,6 +215,7 @@ void acp63_hw_init_ops(struct acp_hw_ops *hw_ops)
|
|||
{
|
||||
hw_ops->acp_init = acp63_init;
|
||||
hw_ops->acp_deinit = acp63_deinit;
|
||||
hw_ops->acp_get_config = acp63_get_config;
|
||||
hw_ops->acp_suspend = snd_acp63_suspend;
|
||||
hw_ops->acp_resume = snd_acp63_resume;
|
||||
hw_ops->acp_suspend_runtime = snd_acp63_suspend;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user