Commit eaf82503 authored by Vijendar Mukunda's avatar Vijendar Mukunda Committed by Mark Brown

ASoC: amd: ps: refactor acp child platform device creation code

Refactor ACP child platform device creation code based on acp config.
Use common SoundWire manager functions for device probe and exit
sequences.
Signed-off-by: default avatarVijendar Mukunda <Vijendar.Mukunda@amd.com>
Link: https://msgid.link/r/20240214104014.1144668-2-Vijendar.Mukunda@amd.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 0386d765
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#define ACP_DEVICE_ID 0x15E2 #define ACP_DEVICE_ID 0x15E2
#define ACP63_REG_START 0x1240000 #define ACP63_REG_START 0x1240000
#define ACP63_REG_END 0x1250200 #define ACP63_REG_END 0x1250200
#define ACP63_DEVS 5
#define ACP_SOFT_RESET_SOFTRESET_AUDDONE_MASK 0x00010001 #define ACP_SOFT_RESET_SOFTRESET_AUDDONE_MASK 0x00010001
#define ACP_PGFSM_CNTL_POWER_ON_MASK 1 #define ACP_PGFSM_CNTL_POWER_ON_MASK 1
...@@ -56,32 +55,6 @@ ...@@ -56,32 +55,6 @@
#define ACP_DMIC_DEV 2 #define ACP_DMIC_DEV 2
/* ACP63_PDM_MODE_DEVS corresponds to platform devices count for ACP PDM configuration */
#define ACP63_PDM_MODE_DEVS 3
/*
* ACP63_SDW0_MODE_DEVS corresponds to platform devices count for
* SW0 SoundWire manager instance configuration
*/
#define ACP63_SDW0_MODE_DEVS 2
/*
* ACP63_SDW0_SDW1_MODE_DEVS corresponds to platform devices count for SW0 + SW1 SoundWire manager
* instances configuration
*/
#define ACP63_SDW0_SDW1_MODE_DEVS 3
/*
* ACP63_SDW0_PDM_MODE_DEVS corresponds to platform devices count for SW0 manager
* instance + ACP PDM controller configuration
*/
#define ACP63_SDW0_PDM_MODE_DEVS 4
/*
* ACP63_SDW0_SDW1_PDM_MODE_DEVS corresponds to platform devices count for
* SW0 + SW1 SoundWire manager instances + ACP PDM controller configuration
*/
#define ACP63_SDW0_SDW1_PDM_MODE_DEVS 5
#define ACP63_DMIC_ADDR 2 #define ACP63_DMIC_ADDR 2
#define ACP63_SDW_ADDR 5 #define ACP63_SDW_ADDR 5
#define AMD_SDW_MAX_MANAGERS 2 #define AMD_SDW_MAX_MANAGERS 2
...@@ -89,17 +62,6 @@ ...@@ -89,17 +62,6 @@
/* time in ms for acp timeout */ /* time in ms for acp timeout */
#define ACP_TIMEOUT 500 #define ACP_TIMEOUT 500
/* ACP63_PDM_DEV_CONFIG corresponds to platform device configuration for ACP PDM controller */
#define ACP63_PDM_DEV_CONFIG BIT(0)
/* ACP63_SDW_DEV_CONFIG corresponds to platform device configuration for SDW manager instances */
#define ACP63_SDW_DEV_CONFIG BIT(1)
/*
* ACP63_SDW_PDM_DEV_CONFIG corresponds to platform device configuration for ACP PDM + SoundWire
* manager instance combination.
*/
#define ACP63_SDW_PDM_DEV_CONFIG GENMASK(1, 0)
#define ACP_SDW0_STAT BIT(21) #define ACP_SDW0_STAT BIT(21)
#define ACP_SDW1_STAT BIT(2) #define ACP_SDW1_STAT BIT(2)
#define ACP_ERROR_IRQ BIT(29) #define ACP_ERROR_IRQ BIT(29)
...@@ -254,21 +216,18 @@ struct sdw_dma_ring_buf_reg { ...@@ -254,21 +216,18 @@ struct sdw_dma_ring_buf_reg {
* struct acp63_dev_data - acp pci driver context * struct acp63_dev_data - acp pci driver context
* @acp63_base: acp mmio base * @acp63_base: acp mmio base
* @res: resource * @res: resource
* @pdev: array of child platform device node structures * @pdm_dev: ACP PDM controller platform device
* @dmic_codec: platform device for DMIC Codec
* sdw_dma_dev: platform device for SoundWire DMA controller
* @acp_lock: used to protect acp common registers * @acp_lock: used to protect acp common registers
* @sdw_fw_node: SoundWire controller fw node handle
* @pdev_config: platform device configuration
* @pdev_count: platform devices count
* @pdm_dev_index: pdm platform device index
* @sdw_manager_count: SoundWire manager instance count
* @sdw0_dev_index: SoundWire Manager-0 platform device index
* @sdw1_dev_index: SoundWire Manager-1 platform device index
* @sdw_dma_dev_index: SoundWire DMA controller platform device index
* @info: SoundWire AMD information found in ACPI tables * @info: SoundWire AMD information found in ACPI tables
* @sdw: SoundWire context for all SoundWire manager instances
* @is_sdw_dev: flag set to true when any SoundWire manager instances are available * @is_sdw_dev: flag set to true when any SoundWire manager instances are available
* @is_pdm_dev: flag set to true when ACP PDM controller exists * @is_pdm_dev: flag set to true when ACP PDM controller exists
* @is_pdm_config: flat set to true when PDM configuration is selected from BIOS * @is_pdm_config: flat set to true when PDM configuration is selected from BIOS
* @is_sdw_config: flag set to true when SDW configuration is selected from BIOS * @is_sdw_config: flag set to true when SDW configuration is selected from BIOS
* @addr: pci ioremap address
* @reg_range: ACP reigister range
* @sdw0-dma_intr_stat: DMA interrupt status array for SoundWire manager-SW0 instance * @sdw0-dma_intr_stat: DMA interrupt status array for SoundWire manager-SW0 instance
* @sdw_dma_intr_stat: DMA interrupt status array for SoundWire manager-SW1 instance * @sdw_dma_intr_stat: DMA interrupt status array for SoundWire manager-SW1 instance
* @acp_reset: flag set to true when bus reset is applied across all * @acp_reset: flag set to true when bus reset is applied across all
...@@ -278,21 +237,19 @@ struct sdw_dma_ring_buf_reg { ...@@ -278,21 +237,19 @@ struct sdw_dma_ring_buf_reg {
struct acp63_dev_data { struct acp63_dev_data {
void __iomem *acp63_base; void __iomem *acp63_base;
struct resource *res; struct resource *res;
struct platform_device *pdev[ACP63_DEVS]; struct platform_device *pdm_dev;
struct platform_device *dmic_codec_dev;
struct platform_device *sdw_dma_dev;
struct mutex acp_lock; /* protect shared registers */ struct mutex acp_lock; /* protect shared registers */
struct fwnode_handle *sdw_fw_node;
u16 pdev_config;
u16 pdev_count;
u16 pdm_dev_index;
u8 sdw_manager_count;
u16 sdw0_dev_index;
u16 sdw1_dev_index;
u16 sdw_dma_dev_index;
struct sdw_amd_acpi_info info; struct sdw_amd_acpi_info info;
/* sdw context allocated by SoundWire driver */
struct sdw_amd_ctx *sdw;
bool is_sdw_dev; bool is_sdw_dev;
bool is_pdm_dev; bool is_pdm_dev;
bool is_pdm_config; bool is_pdm_config;
bool is_sdw_config; bool is_sdw_config;
u32 addr;
u32 reg_range;
u16 sdw0_dma_intr_stat[ACP63_SDW0_DMA_MAX_STREAMS]; u16 sdw0_dma_intr_stat[ACP63_SDW0_DMA_MAX_STREAMS];
u16 sdw1_dma_intr_stat[ACP63_SDW1_DMA_MAX_STREAMS]; u16 sdw1_dma_intr_stat[ACP63_SDW1_DMA_MAX_STREAMS];
bool acp_reset; bool acp_reset;
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment