1 // SPDX-License-Identifier: GPL-2.0-only
3 * AMD Pink Sardine ACP PCI Driver
5 * Copyright 2022 Advanced Micro Devices, Inc.
9 #include <linux/bitops.h>
10 #include <linux/module.h>
12 #include <linux/delay.h>
13 #include <linux/platform_device.h>
14 #include <linux/acpi.h>
15 #include <linux/interrupt.h>
16 #include <sound/pcm_params.h>
17 #include <linux/pm_runtime.h>
18 #include <linux/iopoll.h>
19 #include <linux/soundwire/sdw_amd.h>
20 #include "../mach-config.h"
24 static int acp63_power_on(void __iomem
*acp_base
)
28 val
= readl(acp_base
+ ACP_PGFSM_STATUS
);
33 if ((val
& ACP_PGFSM_STATUS_MASK
) != ACP_POWER_ON_IN_PROGRESS
)
34 writel(ACP_PGFSM_CNTL_POWER_ON_MASK
, acp_base
+ ACP_PGFSM_CONTROL
);
36 return readl_poll_timeout(acp_base
+ ACP_PGFSM_STATUS
, val
, !val
, DELAY_US
, ACP_TIMEOUT
);
39 static int acp63_reset(void __iomem
*acp_base
)
44 writel(1, acp_base
+ ACP_SOFT_RESET
);
46 ret
= readl_poll_timeout(acp_base
+ ACP_SOFT_RESET
, val
,
47 val
& ACP_SOFT_RESET_SOFTRESET_AUDDONE_MASK
,
48 DELAY_US
, ACP_TIMEOUT
);
52 writel(0, acp_base
+ ACP_SOFT_RESET
);
54 return readl_poll_timeout(acp_base
+ ACP_SOFT_RESET
, val
, !val
, DELAY_US
, ACP_TIMEOUT
);
57 static void acp63_enable_interrupts(void __iomem
*acp_base
)
59 writel(1, acp_base
+ ACP_EXTERNAL_INTR_ENB
);
60 writel(ACP_ERROR_IRQ
, acp_base
+ ACP_EXTERNAL_INTR_CNTL
);
63 static void acp63_disable_interrupts(void __iomem
*acp_base
)
65 writel(ACP_EXT_INTR_STAT_CLEAR_MASK
, acp_base
+ ACP_EXTERNAL_INTR_STAT
);
66 writel(0, acp_base
+ ACP_EXTERNAL_INTR_CNTL
);
67 writel(0, acp_base
+ ACP_EXTERNAL_INTR_ENB
);
70 static int acp63_init(void __iomem
*acp_base
, struct device
*dev
)
74 ret
= acp63_power_on(acp_base
);
76 dev_err(dev
, "ACP power on failed\n");
79 writel(0x01, acp_base
+ ACP_CONTROL
);
80 ret
= acp63_reset(acp_base
);
82 dev_err(dev
, "ACP reset failed\n");
85 acp63_enable_interrupts(acp_base
);
89 static int acp63_deinit(void __iomem
*acp_base
, struct device
*dev
)
93 acp63_disable_interrupts(acp_base
);
94 ret
= acp63_reset(acp_base
);
96 dev_err(dev
, "ACP reset failed\n");
99 writel(0, acp_base
+ ACP_CONTROL
);
103 static irqreturn_t
acp63_irq_thread(int irq
, void *context
)
105 struct sdw_dma_dev_data
*sdw_dma_data
;
106 struct acp63_dev_data
*adata
= context
;
109 sdw_dma_data
= dev_get_drvdata(&adata
->sdw_dma_dev
->dev
);
111 for (stream_index
= 0; stream_index
< ACP63_SDW0_DMA_MAX_STREAMS
; stream_index
++) {
112 if (adata
->sdw0_dma_intr_stat
[stream_index
]) {
113 if (sdw_dma_data
->sdw0_dma_stream
[stream_index
])
114 snd_pcm_period_elapsed(sdw_dma_data
->sdw0_dma_stream
[stream_index
]);
115 adata
->sdw0_dma_intr_stat
[stream_index
] = 0;
118 for (stream_index
= 0; stream_index
< ACP63_SDW1_DMA_MAX_STREAMS
; stream_index
++) {
119 if (adata
->sdw1_dma_intr_stat
[stream_index
]) {
120 if (sdw_dma_data
->sdw1_dma_stream
[stream_index
])
121 snd_pcm_period_elapsed(sdw_dma_data
->sdw1_dma_stream
[stream_index
]);
122 adata
->sdw1_dma_intr_stat
[stream_index
] = 0;
128 static irqreturn_t
acp63_irq_handler(int irq
, void *dev_id
)
130 struct acp63_dev_data
*adata
;
131 struct pdm_dev_data
*ps_pdm_data
;
132 struct amd_sdw_manager
*amd_manager
;
133 u32 ext_intr_stat
, ext_intr_stat1
;
136 u16 sdw_dma_irq_flag
= 0;
142 /* ACP interrupts will be cleared by reading particular bit and writing
143 * same value to the status register. writing zero's doesn't have any
145 * Bit by bit checking of IRQ field is implemented.
147 ext_intr_stat
= readl(adata
->acp63_base
+ ACP_EXTERNAL_INTR_STAT
);
148 if (ext_intr_stat
& ACP_SDW0_STAT
) {
149 writel(ACP_SDW0_STAT
, adata
->acp63_base
+ ACP_EXTERNAL_INTR_STAT
);
150 amd_manager
= dev_get_drvdata(&adata
->sdw
->pdev
[0]->dev
);
152 schedule_work(&amd_manager
->amd_sdw_irq_thread
);
156 ext_intr_stat1
= readl(adata
->acp63_base
+ ACP_EXTERNAL_INTR_STAT1
);
157 if (ext_intr_stat1
& ACP_SDW1_STAT
) {
158 writel(ACP_SDW1_STAT
, adata
->acp63_base
+ ACP_EXTERNAL_INTR_STAT1
);
159 amd_manager
= dev_get_drvdata(&adata
->sdw
->pdev
[1]->dev
);
161 schedule_work(&amd_manager
->amd_sdw_irq_thread
);
165 if (ext_intr_stat
& ACP_ERROR_IRQ
) {
166 writel(ACP_ERROR_IRQ
, adata
->acp63_base
+ ACP_EXTERNAL_INTR_STAT
);
167 /* TODO: Report SoundWire Manager instance errors */
168 writel(0, adata
->acp63_base
+ ACP_SW0_I2S_ERROR_REASON
);
169 writel(0, adata
->acp63_base
+ ACP_SW1_I2S_ERROR_REASON
);
170 writel(0, adata
->acp63_base
+ ACP_ERROR_STATUS
);
174 if (ext_intr_stat
& BIT(PDM_DMA_STAT
)) {
175 ps_pdm_data
= dev_get_drvdata(&adata
->pdm_dev
->dev
);
176 writel(BIT(PDM_DMA_STAT
), adata
->acp63_base
+ ACP_EXTERNAL_INTR_STAT
);
177 if (ps_pdm_data
->capture_stream
)
178 snd_pcm_period_elapsed(ps_pdm_data
->capture_stream
);
181 if (ext_intr_stat
& ACP_SDW_DMA_IRQ_MASK
) {
182 for (index
= ACP_AUDIO2_RX_THRESHOLD
; index
<= ACP_AUDIO0_TX_THRESHOLD
; index
++) {
183 if (ext_intr_stat
& BIT(index
)) {
184 writel(BIT(index
), adata
->acp63_base
+ ACP_EXTERNAL_INTR_STAT
);
186 case ACP_AUDIO0_TX_THRESHOLD
:
187 stream_id
= ACP_SDW0_AUDIO0_TX
;
189 case ACP_AUDIO1_TX_THRESHOLD
:
190 stream_id
= ACP_SDW0_AUDIO1_TX
;
192 case ACP_AUDIO2_TX_THRESHOLD
:
193 stream_id
= ACP_SDW0_AUDIO2_TX
;
195 case ACP_AUDIO0_RX_THRESHOLD
:
196 stream_id
= ACP_SDW0_AUDIO0_RX
;
198 case ACP_AUDIO1_RX_THRESHOLD
:
199 stream_id
= ACP_SDW0_AUDIO1_RX
;
201 case ACP_AUDIO2_RX_THRESHOLD
:
202 stream_id
= ACP_SDW0_AUDIO2_RX
;
206 adata
->sdw0_dma_intr_stat
[stream_id
] = 1;
207 sdw_dma_irq_flag
= 1;
212 if (ext_intr_stat1
& ACP_P1_AUDIO1_RX_THRESHOLD
) {
213 writel(ACP_P1_AUDIO1_RX_THRESHOLD
,
214 adata
->acp63_base
+ ACP_EXTERNAL_INTR_STAT1
);
215 adata
->sdw1_dma_intr_stat
[ACP_SDW1_AUDIO1_RX
] = 1;
216 sdw_dma_irq_flag
= 1;
219 if (ext_intr_stat1
& ACP_P1_AUDIO1_TX_THRESHOLD
) {
220 writel(ACP_P1_AUDIO1_TX_THRESHOLD
,
221 adata
->acp63_base
+ ACP_EXTERNAL_INTR_STAT1
);
222 adata
->sdw1_dma_intr_stat
[ACP_SDW1_AUDIO1_TX
] = 1;
223 sdw_dma_irq_flag
= 1;
226 if (sdw_dma_irq_flag
)
227 return IRQ_WAKE_THREAD
;
235 #if IS_ENABLED(CONFIG_SND_SOC_AMD_SOUNDWIRE)
236 static int acp_scan_sdw_devices(struct device
*dev
, u64 addr
)
238 struct acpi_device
*sdw_dev
;
239 struct acp63_dev_data
*acp_data
;
241 acp_data
= dev_get_drvdata(dev
);
245 sdw_dev
= acpi_find_child_device(ACPI_COMPANION(dev
), addr
, 0);
249 acp_data
->info
.handle
= sdw_dev
->handle
;
250 acp_data
->info
.count
= AMD_SDW_MAX_MANAGERS
;
251 return amd_sdw_scan_controller(&acp_data
->info
);
254 static int amd_sdw_probe(struct device
*dev
)
256 struct acp63_dev_data
*acp_data
;
257 struct sdw_amd_res sdw_res
;
260 acp_data
= dev_get_drvdata(dev
);
261 memset(&sdw_res
, 0, sizeof(sdw_res
));
262 sdw_res
.addr
= acp_data
->addr
;
263 sdw_res
.reg_range
= acp_data
->reg_range
;
264 sdw_res
.handle
= acp_data
->info
.handle
;
265 sdw_res
.parent
= dev
;
267 sdw_res
.acp_lock
= &acp_data
->acp_lock
;
268 sdw_res
.count
= acp_data
->info
.count
;
269 sdw_res
.mmio_base
= acp_data
->acp63_base
;
270 sdw_res
.acp_rev
= acp_data
->acp_rev
;
271 sdw_res
.link_mask
= acp_data
->info
.link_mask
;
272 ret
= sdw_amd_probe(&sdw_res
, &acp_data
->sdw
);
274 dev_err(dev
, "error: SoundWire probe failed\n");
278 static int amd_sdw_exit(struct acp63_dev_data
*acp_data
)
281 sdw_amd_exit(acp_data
->sdw
);
282 acp_data
->sdw
= NULL
;
287 static struct snd_soc_acpi_mach
*acp63_sdw_machine_select(struct device
*dev
)
289 struct snd_soc_acpi_mach
*mach
;
290 const struct snd_soc_acpi_link_adr
*link
;
291 struct acp63_dev_data
*acp_data
= dev_get_drvdata(dev
);
294 if (acp_data
->info
.count
) {
295 ret
= sdw_amd_get_slave_info(acp_data
->sdw
);
297 dev_dbg(dev
, "failed to read slave information\n");
300 for (mach
= acp_data
->machines
; mach
; mach
++) {
304 for (i
= 0; i
< acp_data
->info
.count
&& link
->num_adr
; link
++, i
++) {
305 if (!snd_soc_acpi_sdw_link_slaves_found(dev
, link
,
306 acp_data
->sdw
->peripherals
))
309 if (i
== acp_data
->info
.count
|| !link
->num_adr
)
312 if (mach
&& mach
->link_mask
) {
313 mach
->mach_params
.links
= mach
->links
;
314 mach
->mach_params
.link_mask
= mach
->link_mask
;
318 dev_dbg(dev
, "No SoundWire machine driver found\n");
322 static int acp_scan_sdw_devices(struct device
*dev
, u64 addr
)
327 static int amd_sdw_probe(struct device
*dev
)
332 static int amd_sdw_exit(struct acp63_dev_data
*acp_data
)
337 static struct snd_soc_acpi_mach
*acp63_sdw_machine_select(struct device
*dev
)
343 static int acp63_machine_register(struct device
*dev
)
345 struct snd_soc_acpi_mach
*mach
;
346 struct acp63_dev_data
*adata
= dev_get_drvdata(dev
);
349 if (adata
->is_sdw_dev
&& adata
->is_sdw_config
) {
350 size
= sizeof(*adata
->machines
);
351 mach
= acp63_sdw_machine_select(dev
);
353 adata
->mach_dev
= platform_device_register_data(dev
, mach
->drv_name
,
354 PLATFORM_DEVID_NONE
, mach
,
356 if (IS_ERR(adata
->mach_dev
)) {
358 "cannot register Machine device for SoundWire Interface\n");
359 return PTR_ERR(adata
->mach_dev
);
363 } else if (adata
->is_pdm_dev
&& !adata
->is_sdw_dev
&& adata
->is_pdm_config
) {
364 adata
->mach_dev
= platform_device_register_data(dev
, "acp_ps_mach",
365 PLATFORM_DEVID_NONE
, NULL
, 0);
366 if (IS_ERR(adata
->mach_dev
)) {
367 dev_err(dev
, "cannot register amd_ps_mach device\n");
368 return PTR_ERR(adata
->mach_dev
);
374 static int get_acp63_device_config(struct pci_dev
*pci
, struct acp63_dev_data
*acp_data
)
376 struct acpi_device
*pdm_dev
;
377 const union acpi_object
*obj
;
379 bool is_dmic_dev
= false;
380 bool is_sdw_dev
= false;
383 config
= readl(acp_data
->acp63_base
+ ACP_PIN_CONFIG
);
389 acp_data
->is_pdm_config
= true;
393 acp_data
->is_sdw_config
= true;
401 acp_data
->is_pdm_config
= true;
402 acp_data
->is_sdw_config
= true;
408 if (acp_data
->is_pdm_config
) {
409 pdm_dev
= acpi_find_child_device(ACPI_COMPANION(&pci
->dev
), ACP63_DMIC_ADDR
, 0);
411 /* is_dmic_dev flag will be set when ACP PDM controller device exists */
412 if (!acpi_dev_get_property(pdm_dev
, "acp-audio-device-type",
413 ACPI_TYPE_INTEGER
, &obj
) &&
414 obj
->integer
.value
== ACP_DMIC_DEV
)
419 if (acp_data
->is_sdw_config
) {
420 ret
= acp_scan_sdw_devices(&pci
->dev
, ACP63_SDW_ADDR
);
421 if (!ret
&& acp_data
->info
.link_mask
)
425 acp_data
->is_pdm_dev
= is_dmic_dev
;
426 acp_data
->is_sdw_dev
= is_sdw_dev
;
427 if (!is_dmic_dev
&& !is_sdw_dev
) {
428 dev_dbg(&pci
->dev
, "No PDM or SoundWire manager devices found\n");
434 static void acp63_fill_platform_dev_info(struct platform_device_info
*pdevinfo
,
435 struct device
*parent
,
436 struct fwnode_handle
*fw_node
,
437 char *name
, unsigned int id
,
438 const struct resource
*res
,
439 unsigned int num_res
,
443 pdevinfo
->name
= name
;
445 pdevinfo
->parent
= parent
;
446 pdevinfo
->num_res
= num_res
;
448 pdevinfo
->data
= data
;
449 pdevinfo
->size_data
= size_data
;
450 pdevinfo
->fwnode
= fw_node
;
453 static int create_acp63_platform_devs(struct pci_dev
*pci
, struct acp63_dev_data
*adata
, u32 addr
)
455 struct platform_device_info pdevinfo
;
456 struct device
*parent
;
461 if (adata
->is_sdw_dev
|| adata
->is_pdm_dev
) {
462 adata
->res
= devm_kzalloc(&pci
->dev
, sizeof(struct resource
), GFP_KERNEL
);
467 adata
->res
->flags
= IORESOURCE_MEM
;
468 adata
->res
->start
= addr
;
469 adata
->res
->end
= addr
+ (ACP63_REG_END
- ACP63_REG_START
);
470 memset(&pdevinfo
, 0, sizeof(pdevinfo
));
473 if (adata
->is_pdm_dev
&& adata
->is_pdm_config
) {
474 acp63_fill_platform_dev_info(&pdevinfo
, parent
, NULL
, "acp_ps_pdm_dma",
475 0, adata
->res
, 1, NULL
, 0);
477 adata
->pdm_dev
= platform_device_register_full(&pdevinfo
);
478 if (IS_ERR(adata
->pdm_dev
)) {
480 "cannot register %s device\n", pdevinfo
.name
);
481 ret
= PTR_ERR(adata
->pdm_dev
);
484 memset(&pdevinfo
, 0, sizeof(pdevinfo
));
485 acp63_fill_platform_dev_info(&pdevinfo
, parent
, NULL
, "dmic-codec",
486 0, NULL
, 0, NULL
, 0);
487 adata
->dmic_codec_dev
= platform_device_register_full(&pdevinfo
);
488 if (IS_ERR(adata
->dmic_codec_dev
)) {
490 "cannot register %s device\n", pdevinfo
.name
);
491 ret
= PTR_ERR(adata
->dmic_codec_dev
);
492 goto unregister_pdm_dev
;
495 if (adata
->is_sdw_dev
&& adata
->is_sdw_config
) {
496 ret
= amd_sdw_probe(&pci
->dev
);
498 if (adata
->is_pdm_dev
)
499 goto unregister_dmic_codec_dev
;
503 memset(&pdevinfo
, 0, sizeof(pdevinfo
));
504 acp63_fill_platform_dev_info(&pdevinfo
, parent
, NULL
, "amd_ps_sdw_dma",
505 0, adata
->res
, 1, NULL
, 0);
507 adata
->sdw_dma_dev
= platform_device_register_full(&pdevinfo
);
508 if (IS_ERR(adata
->sdw_dma_dev
)) {
510 "cannot register %s device\n", pdevinfo
.name
);
511 ret
= PTR_ERR(adata
->sdw_dma_dev
);
512 if (adata
->is_pdm_dev
)
513 goto unregister_dmic_codec_dev
;
520 unregister_dmic_codec_dev
:
521 platform_device_unregister(adata
->dmic_codec_dev
);
523 platform_device_unregister(adata
->pdm_dev
);
525 if (acp63_deinit(adata
->acp63_base
, &pci
->dev
))
526 dev_err(&pci
->dev
, "ACP de-init failed\n");
530 static int snd_acp63_probe(struct pci_dev
*pci
,
531 const struct pci_device_id
*pci_id
)
533 struct acp63_dev_data
*adata
;
538 irqflags
= IRQF_SHARED
;
540 /* Return if acp config flag is defined */
541 flag
= snd_amd_acp_find_config(pci
);
545 /* Pink Sardine device check */
546 switch (pci
->revision
) {
550 dev_dbg(&pci
->dev
, "acp63 pci device not found\n");
553 if (pci_enable_device(pci
)) {
554 dev_err(&pci
->dev
, "pci_enable_device failed\n");
558 ret
= pci_request_regions(pci
, "AMD ACP6.2 audio");
560 dev_err(&pci
->dev
, "pci_request_regions failed\n");
563 adata
= devm_kzalloc(&pci
->dev
, sizeof(struct acp63_dev_data
),
567 goto release_regions
;
570 addr
= pci_resource_start(pci
, 0);
571 adata
->acp63_base
= devm_ioremap(&pci
->dev
, addr
,
572 pci_resource_len(pci
, 0));
573 if (!adata
->acp63_base
) {
575 goto release_regions
;
578 adata
->reg_range
= ACP63_REG_END
- ACP63_REG_START
;
579 adata
->acp_rev
= pci
->revision
;
581 pci_set_drvdata(pci
, adata
);
582 mutex_init(&adata
->acp_lock
);
583 ret
= acp63_init(adata
->acp63_base
, &pci
->dev
);
585 goto release_regions
;
586 ret
= devm_request_threaded_irq(&pci
->dev
, pci
->irq
, acp63_irq_handler
,
587 acp63_irq_thread
, irqflags
, "ACP_PCI_IRQ", adata
);
589 dev_err(&pci
->dev
, "ACP PCI IRQ request failed\n");
592 ret
= get_acp63_device_config(pci
, adata
);
593 /* ACP PCI driver probe should be continued even PDM or SoundWire Devices are not found */
595 dev_dbg(&pci
->dev
, "get acp device config failed:%d\n", ret
);
596 goto skip_pdev_creation
;
598 ret
= create_acp63_platform_devs(pci
, adata
, addr
);
600 dev_err(&pci
->dev
, "ACP platform devices creation failed\n");
603 adata
->machines
= snd_soc_acpi_amd_acp63_sdw_machines
;
604 ret
= acp63_machine_register(&pci
->dev
);
606 dev_err(&pci
->dev
, "ACP machine register failed\n");
610 device_set_wakeup_enable(&pci
->dev
, true);
611 pm_runtime_set_autosuspend_delay(&pci
->dev
, ACP_SUSPEND_DELAY_MS
);
612 pm_runtime_use_autosuspend(&pci
->dev
);
613 pm_runtime_put_noidle(&pci
->dev
);
614 pm_runtime_allow(&pci
->dev
);
617 if (acp63_deinit(adata
->acp63_base
, &pci
->dev
))
618 dev_err(&pci
->dev
, "ACP de-init failed\n");
620 pci_release_regions(pci
);
622 pci_disable_device(pci
);
627 static bool check_acp_sdw_enable_status(struct acp63_dev_data
*adata
)
629 u32 sdw0_en
, sdw1_en
;
631 sdw0_en
= readl(adata
->acp63_base
+ ACP_SW0_EN
);
632 sdw1_en
= readl(adata
->acp63_base
+ ACP_SW1_EN
);
633 return (sdw0_en
|| sdw1_en
);
636 static void handle_acp63_sdw_pme_event(struct acp63_dev_data
*adata
)
640 val
= readl(adata
->acp63_base
+ ACP_SW0_WAKE_EN
);
641 if (val
&& adata
->sdw
->pdev
[0])
642 pm_request_resume(&adata
->sdw
->pdev
[0]->dev
);
644 val
= readl(adata
->acp63_base
+ ACP_SW1_WAKE_EN
);
645 if (val
&& adata
->sdw
->pdev
[1])
646 pm_request_resume(&adata
->sdw
->pdev
[1]->dev
);
649 static int __maybe_unused
snd_acp63_suspend(struct device
*dev
)
651 struct acp63_dev_data
*adata
;
654 adata
= dev_get_drvdata(dev
);
655 if (adata
->is_sdw_dev
) {
656 adata
->sdw_en_stat
= check_acp_sdw_enable_status(adata
);
657 if (adata
->sdw_en_stat
)
660 ret
= acp63_deinit(adata
->acp63_base
, dev
);
662 dev_err(dev
, "ACP de-init failed\n");
667 static int __maybe_unused
snd_acp63_runtime_resume(struct device
*dev
)
669 struct acp63_dev_data
*adata
;
672 adata
= dev_get_drvdata(dev
);
673 if (adata
->sdw_en_stat
)
676 ret
= acp63_init(adata
->acp63_base
, dev
);
678 dev_err(dev
, "ACP init failed\n");
682 if (!adata
->sdw_en_stat
)
683 handle_acp63_sdw_pme_event(adata
);
687 static int __maybe_unused
snd_acp63_resume(struct device
*dev
)
689 struct acp63_dev_data
*adata
;
692 adata
= dev_get_drvdata(dev
);
693 if (adata
->sdw_en_stat
)
696 ret
= acp63_init(adata
->acp63_base
, dev
);
698 dev_err(dev
, "ACP init failed\n");
703 static const struct dev_pm_ops acp63_pm_ops
= {
704 SET_RUNTIME_PM_OPS(snd_acp63_suspend
, snd_acp63_runtime_resume
, NULL
)
705 SET_SYSTEM_SLEEP_PM_OPS(snd_acp63_suspend
, snd_acp63_resume
)
708 static void snd_acp63_remove(struct pci_dev
*pci
)
710 struct acp63_dev_data
*adata
;
713 adata
= pci_get_drvdata(pci
);
716 platform_device_unregister(adata
->sdw_dma_dev
);
718 if (adata
->is_pdm_dev
) {
719 platform_device_unregister(adata
->pdm_dev
);
720 platform_device_unregister(adata
->dmic_codec_dev
);
723 platform_device_unregister(adata
->mach_dev
);
724 ret
= acp63_deinit(adata
->acp63_base
, &pci
->dev
);
726 dev_err(&pci
->dev
, "ACP de-init failed\n");
727 pm_runtime_forbid(&pci
->dev
);
728 pm_runtime_get_noresume(&pci
->dev
);
729 pci_release_regions(pci
);
730 pci_disable_device(pci
);
733 static const struct pci_device_id snd_acp63_ids
[] = {
734 { PCI_DEVICE(PCI_VENDOR_ID_AMD
, ACP_DEVICE_ID
),
735 .class = PCI_CLASS_MULTIMEDIA_OTHER
<< 8,
736 .class_mask
= 0xffffff },
739 MODULE_DEVICE_TABLE(pci
, snd_acp63_ids
);
741 static struct pci_driver ps_acp63_driver
= {
742 .name
= KBUILD_MODNAME
,
743 .id_table
= snd_acp63_ids
,
744 .probe
= snd_acp63_probe
,
745 .remove
= snd_acp63_remove
,
751 module_pci_driver(ps_acp63_driver
);
753 MODULE_AUTHOR("Vijendar.Mukunda@amd.com");
754 MODULE_AUTHOR("Syed.SabaKareem@amd.com");
755 MODULE_DESCRIPTION("AMD ACP Pink Sardine PCI driver");
756 MODULE_IMPORT_NS("SOUNDWIRE_AMD_INIT");
757 MODULE_IMPORT_NS("SND_AMD_SOUNDWIRE_ACPI");
758 MODULE_LICENSE("GPL v2");