drivers/firmware/mtk-adsp-ipc.c

Source file repositories/reference/linux-study-clean/drivers/firmware/mtk-adsp-ipc.c

File Facts

System
Linux kernel
Corpus path
drivers/firmware/mtk-adsp-ipc.c
Extension
.c
Size
3431 bytes
Lines
142
Domain
Driver Families
Bucket
drivers/firmware
Inferred role
Driver Families: exported/initcall integration point
Status
integration implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

if (IS_ERR(adsp_chan->ch)) {
			ret = dev_err_probe(dev, PTR_ERR(adsp_chan->ch),
					    "Failed to request mbox channel %s\n",
					    adsp_mbox_ch_names[i]);

			for (j = 0; j < i; j++) {
				adsp_chan = &adsp_ipc->chans[j];
				mbox_free_channel(adsp_chan->ch);
			}

			return ret;
		}
	}

	adsp_ipc->dev = dev;
	dev_set_drvdata(dev, adsp_ipc);
	dev_dbg(dev, "MTK ADSP IPC initialized\n");

	return 0;
}

static void mtk_adsp_ipc_remove(struct platform_device *pdev)
{
	struct mtk_adsp_ipc *adsp_ipc = dev_get_drvdata(&pdev->dev);
	struct mtk_adsp_chan *adsp_chan;
	int i;

	for (i = 0; i < MTK_ADSP_MBOX_NUM; i++) {
		adsp_chan = &adsp_ipc->chans[i];
		mbox_free_channel(adsp_chan->ch);
	}
}

static struct platform_driver mtk_adsp_ipc_driver = {
	.driver = {
		.name = "mtk-adsp-ipc",
	},
	.probe = mtk_adsp_ipc_probe,
	.remove = mtk_adsp_ipc_remove,
};
builtin_platform_driver(mtk_adsp_ipc_driver);

MODULE_AUTHOR("Allen-KH Cheng <allen-kh.cheng@mediatek.com>");
MODULE_DESCRIPTION("MTK ADSP IPC Driver");
MODULE_LICENSE("GPL");

Annotation

Implementation Notes