Skip to content

Commit 17e163f

Browse files
Manikanta Guntupallialexandrebelloni
authored andcommitted
i3c: dw: Add shutdown support to dw_i3c_master driver
Add shutdown handler to the Synopsys DesignWare I3C master driver, ensuring the device is gracefully disabled during system shutdown. The shutdown handler cancels any pending hot-join work and disables interrupts. Signed-off-by: Manikanta Guntupalli <manikanta.guntupalli@amd.com> Link: https://lore.kernel.org/r/20250730151207.4113708-1-manikanta.guntupalli@amd.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
1 parent bc7dd24 commit 17e163f

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

drivers/i3c/master/dw-i3c-master.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1737,6 +1737,28 @@ static const struct dev_pm_ops dw_i3c_pm_ops = {
17371737
SET_RUNTIME_PM_OPS(dw_i3c_master_runtime_suspend, dw_i3c_master_runtime_resume, NULL)
17381738
};
17391739

1740+
static void dw_i3c_shutdown(struct platform_device *pdev)
1741+
{
1742+
struct dw_i3c_master *master = platform_get_drvdata(pdev);
1743+
int ret;
1744+
1745+
ret = pm_runtime_resume_and_get(master->dev);
1746+
if (ret < 0) {
1747+
dev_err(master->dev,
1748+
"<%s> cannot resume i3c bus master, err: %d\n",
1749+
__func__, ret);
1750+
return;
1751+
}
1752+
1753+
cancel_work_sync(&master->hj_work);
1754+
1755+
/* Disable interrupts */
1756+
writel((u32)~INTR_ALL, master->regs + INTR_STATUS_EN);
1757+
writel((u32)~INTR_ALL, master->regs + INTR_SIGNAL_EN);
1758+
1759+
pm_runtime_put_autosuspend(master->dev);
1760+
}
1761+
17401762
static const struct of_device_id dw_i3c_master_of_match[] = {
17411763
{ .compatible = "snps,dw-i3c-master-1.00a", },
17421764
{},
@@ -1752,6 +1774,7 @@ MODULE_DEVICE_TABLE(acpi, amd_i3c_device_match);
17521774
static struct platform_driver dw_i3c_driver = {
17531775
.probe = dw_i3c_probe,
17541776
.remove = dw_i3c_remove,
1777+
.shutdown = dw_i3c_shutdown,
17551778
.driver = {
17561779
.name = "dw-i3c-master",
17571780
.of_match_table = dw_i3c_master_of_match,

0 commit comments

Comments
 (0)