Skip to content

Commit d1351c3

Browse files
vijendarmukundabroonie
authored andcommitted
ASoC: amd: ps: create platform devices based on acp config
Based on ACP pin configuration and scanning child devices under ACP pci device ACPI scope, platform device configuration (pdev_config) and platform device count(pdev_count) will be calculated. Using pdev_config and pdev_count values, ACP PCI driver will create platform devices for Pink Sardine platform. Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com> Link: https://lore.kernel.org/r/20230612095903.2113464-2-Vijendar.Mukunda@amd.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 0a08778 commit d1351c3

2 files changed

Lines changed: 323 additions & 21 deletions

File tree

sound/soc/amd/ps/acp63.h

Lines changed: 68 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#define ACP_DEVICE_ID 0x15E2
1111
#define ACP63_REG_START 0x1240000
1212
#define ACP63_REG_END 0x1250200
13-
#define ACP63_DEVS 3
13+
#define ACP63_DEVS 5
1414

1515
#define ACP_SOFT_RESET_SOFTRESET_AUDDONE_MASK 0x00010001
1616
#define ACP_PGFSM_CNTL_POWER_ON_MASK 1
@@ -53,14 +53,53 @@
5353
/* time in ms for runtime suspend delay */
5454
#define ACP_SUSPEND_DELAY_MS 2000
5555

56-
#define ACP63_DMIC_ADDR 2
57-
#define ACP63_PDM_MODE_DEVS 3
58-
#define ACP63_PDM_DEV_MASK 1
5956
#define ACP_DMIC_DEV 2
6057

58+
/* ACP63_PDM_MODE_DEVS corresponds to platform devices count for ACP PDM configuration */
59+
#define ACP63_PDM_MODE_DEVS 3
60+
61+
/*
62+
* ACP63_SDW0_MODE_DEVS corresponds to platform devices count for
63+
* SW0 SoundWire manager instance configuration
64+
*/
65+
#define ACP63_SDW0_MODE_DEVS 2
66+
67+
/*
68+
* ACP63_SDW0_SDW1_MODE_DEVS corresponds to platform devices count for SW0 + SW1 SoundWire manager
69+
* instances configuration
70+
*/
71+
#define ACP63_SDW0_SDW1_MODE_DEVS 3
72+
73+
/*
74+
* ACP63_SDW0_PDM_MODE_DEVS corresponds to platform devices count for SW0 manager
75+
* instance + ACP PDM controller configuration
76+
*/
77+
#define ACP63_SDW0_PDM_MODE_DEVS 4
78+
79+
/*
80+
* ACP63_SDW0_SDW1_PDM_MODE_DEVS corresponds to platform devices count for
81+
* SW0 + SW1 SoundWire manager instances + ACP PDM controller configuration
82+
*/
83+
#define ACP63_SDW0_SDW1_PDM_MODE_DEVS 5
84+
#define ACP63_DMIC_ADDR 2
85+
#define ACP63_SDW_ADDR 5
86+
#define AMD_SDW_MAX_MANAGERS 2
87+
6188
/* time in ms for acp timeout */
6289
#define ACP_TIMEOUT 500
6390

91+
/* ACP63_PDM_DEV_CONFIG corresponds to platform device configuration for ACP PDM controller */
92+
#define ACP63_PDM_DEV_CONFIG BIT(0)
93+
94+
/* ACP63_SDW_DEV_CONFIG corresponds to platform device configuration for SDW manager instances */
95+
#define ACP63_SDW_DEV_CONFIG BIT(1)
96+
97+
/*
98+
* ACP63_SDW_PDM_DEV_CONFIG corresponds to platform device configuration for ACP PDM + SoundWire
99+
* manager instance combination.
100+
*/
101+
#define ACP63_SDW_PDM_DEV_CONFIG GENMASK(1, 0)
102+
64103
enum acp_config {
65104
ACP_CONFIG_0 = 0,
66105
ACP_CONFIG_1,
@@ -95,14 +134,38 @@ struct pdm_dev_data {
95134
struct snd_pcm_substream *capture_stream;
96135
};
97136

137+
/**
138+
* struct acp63_dev_data - acp pci driver context
139+
* @acp63_base: acp mmio base
140+
* @res: resource
141+
* @pdev: array of child platform device node structures
142+
* @acp_lock: used to protect acp common registers
143+
* @sdw_fw_node: SoundWire controller fw node handle
144+
* @pdev_config: platform device configuration
145+
* @pdev_count: platform devices count
146+
* @pdm_dev_index: pdm platform device index
147+
* @sdw_manager_count: SoundWire manager instance count
148+
* @sdw0_dev_index: SoundWire Manager-0 platform device index
149+
* @sdw1_dev_index: SoundWire Manager-1 platform device index
150+
* @sdw_dma_dev_index: SoundWire DMA controller platform device index
151+
* @acp_reset: flag set to true when bus reset is applied across all
152+
* the active SoundWire manager instances
153+
*/
154+
98155
struct acp63_dev_data {
99156
void __iomem *acp63_base;
100157
struct resource *res;
101158
struct platform_device *pdev[ACP63_DEVS];
102159
struct mutex acp_lock; /* protect shared registers */
103-
u16 pdev_mask;
160+
struct fwnode_handle *sdw_fw_node;
161+
u16 pdev_config;
104162
u16 pdev_count;
105163
u16 pdm_dev_index;
164+
u8 sdw_manager_count;
165+
u16 sdw0_dev_index;
166+
u16 sdw1_dev_index;
167+
u16 sdw_dma_dev_index;
168+
bool acp_reset;
106169
};
107170

108171
int snd_amd_acp_find_config(struct pci_dev *pci);

0 commit comments

Comments
 (0)