[V2,1/4] ASoC: amd: ps: implement api to retrieve acp device config
Commit Message
Implement API to retrieve acp device config and calculate platform
device count and dev mask for platform device node creation.
Currently for DMIC configuration, mask and dev count are calculated.
Same api will be used to extend support for different ACP device
configurations.
Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
---
since v1:
- fixed below build error
sound/soc/amd/ps/pci-ps.c:231:60: error: use of undeclared identifier
'ACP_DMIC_ADDR'
- fixed below kernel warning
>> sound/soc/amd/ps/pci-ps.c:135:6: warning: no previous prototype for
>> function 'get_acp63_device_config' [-Wmissing-prototypes]
sound/soc/amd/ps/acp63.h | 7 +++++++
sound/soc/amd/ps/pci-ps.c | 38 ++++++++++++++++++++++++++++++++++++--
2 files changed, 43 insertions(+), 2 deletions(-)
Comments
On Wed, 21 Dec 2022 22:58:48 +0530, Vijendar Mukunda wrote:
> Implement API to retrieve acp device config and calculate platform
> device count and dev mask for platform device node creation.
>
> Currently for DMIC configuration, mask and dev count are calculated.
> Same api will be used to extend support for different ACP device
> configurations.
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/4] ASoC: amd: ps: implement api to retrieve acp device config
commit: 2cdabbde0c24bb76978d57856cba958b85584c32
[2/4] ASoC: amd: ps: refactor platform device creation logic
commit: 1d325cdaf7a2747df42b43eed8b3de2e2d6c69bb
[3/4] ASoC: amd: ps: update dev index value in irq handler
commit: 9d327a4443bffe8d48acc6a31c0198f251fca08b
[4/4] ASoC: amd: ps: move irq handler registration
commit: 966ef755d3b66853be4f15c698f5210115c15d23
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
@@ -54,6 +54,11 @@
/* time in ms for runtime suspend delay */
#define ACP_SUSPEND_DELAY_MS 2000
+#define ACP63_DMIC_ADDR 2
+#define ACP63_PDM_MODE_DEVS 3
+#define ACP63_PDM_DEV_MASK 1
+#define ACP_DMIC_DEV 2
+
enum acp_config {
ACP_CONFIG_0 = 0,
ACP_CONFIG_1,
@@ -102,4 +107,6 @@ struct acp63_dev_data {
struct resource *res;
bool acp63_audio_mode;
struct platform_device *pdev[ACP63_DEVS];
+ u16 pdev_mask;
+ u16 pdev_count;
};
@@ -132,6 +132,39 @@ static irqreturn_t acp63_irq_handler(int irq, void *dev_id)
return IRQ_NONE;
}
+static void get_acp63_device_config(u32 config, struct pci_dev *pci,
+ struct acp63_dev_data *acp_data)
+{
+ struct acpi_device *dmic_dev;
+ const union acpi_object *obj;
+ bool is_dmic_dev = false;
+
+ dmic_dev = acpi_find_child_device(ACPI_COMPANION(&pci->dev), ACP63_DMIC_ADDR, 0);
+ if (dmic_dev) {
+ if (!acpi_dev_get_property(dmic_dev, "acp-audio-device-type",
+ ACPI_TYPE_INTEGER, &obj) &&
+ obj->integer.value == ACP_DMIC_DEV)
+ is_dmic_dev = true;
+ }
+
+ switch (config) {
+ case ACP_CONFIG_0:
+ case ACP_CONFIG_1:
+ case ACP_CONFIG_2:
+ case ACP_CONFIG_3:
+ case ACP_CONFIG_9:
+ case ACP_CONFIG_15:
+ dev_dbg(&pci->dev, "Audio Mode %d\n", config);
+ break;
+ default:
+ if (is_dmic_dev) {
+ acp_data->pdev_mask = ACP63_PDM_DEV_MASK;
+ acp_data->pdev_count = ACP63_PDM_MODE_DEVS;
+ }
+ break;
+ }
+}
+
static int snd_acp63_probe(struct pci_dev *pci,
const struct pci_device_id *pci_id)
{
@@ -183,6 +216,7 @@ static int snd_acp63_probe(struct pci_dev *pci,
if (ret)
goto release_regions;
val = acp63_readl(adata->acp63_base + ACP_PIN_CONFIG);
+ get_acp63_device_config(val, pci, adata);
switch (val) {
case ACP_CONFIG_0:
case ACP_CONFIG_1:
@@ -195,14 +229,14 @@ static int snd_acp63_probe(struct pci_dev *pci,
default:
/* Checking DMIC hardware*/
- adev = acpi_find_child_device(ACPI_COMPANION(&pci->dev), 0x02, 0);
+ adev = acpi_find_child_device(ACPI_COMPANION(&pci->dev), ACP63_DMIC_ADDR, 0);
if (!adev)
break;
if (!acpi_dev_get_property(adev, "acp-audio-device-type",
ACPI_TYPE_INTEGER, &obj) &&
- obj->integer.value == 2) {
+ obj->integer.value == ACP_DMIC_DEV) {
adata->res = devm_kzalloc(&pci->dev, sizeof(struct resource), GFP_KERNEL);
if (!adata->res) {
ret = -ENOMEM;