* [PATCH v2 0/1] dmaengine: xilinx: xdma: Fix broken PM suspend/resume @ 2026-11-20 15:59 tumic 2026-11-20 15:59 ` [PATCH v2 1/1] " tumic 0 siblings, 1 reply; 5+ messages in thread From: tumic @ 2026-11-20 15:59 UTC (permalink / raw) To: Lizhi Hou, Brian Xu, Raj Kumar Rampelli, Vinod Koul, Frank Li, Michal Simek Cc: dmaengine, linux-arm-kernel, Martin Tůma From: Martin Tůma <martin.tuma@digiteqautomotive.com> Changes in v2: - Added missing user IRQs reconfiguration. - Prevent warnings when CONFIG_PM_SLEEP is disabled. - Fixed documentation/indent. Martin Tůma (1): dmaengine: xilinx: xdma: Fix broken PM suspend/resume drivers/dma/xilinx/xdma.c | 121 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) base-commit: 65e4fd942f72a9dba0e4e257290c4fa1aa756854 -- 2.56.1 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 1/1] dmaengine: xilinx: xdma: Fix broken PM suspend/resume 2026-11-20 15:59 [PATCH v2 0/1] dmaengine: xilinx: xdma: Fix broken PM suspend/resume tumic @ 2026-11-20 15:59 ` tumic 2026-11-20 16:13 ` sashiko-bot 2026-11-20 16:56 ` Frank Li 0 siblings, 2 replies; 5+ messages in thread From: tumic @ 2026-11-20 15:59 UTC (permalink / raw) To: Lizhi Hou, Brian Xu, Raj Kumar Rampelli, Vinod Koul, Frank Li, Michal Simek Cc: dmaengine, linux-arm-kernel, Martin Tůma From: Martin Tůma <martin.tuma@digiteqautomotive.com> Add the missing PM suspend/resume callbacks that properly reconfigure the XDMA HW on PCIe suspend/resume. Signed-off-by: Martin Tůma <martin.tuma@digiteqautomotive.com> --- drivers/dma/xilinx/xdma.c | 121 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) diff --git a/drivers/dma/xilinx/xdma.c b/drivers/dma/xilinx/xdma.c index 9d827c9a1267..fa006c9bae23 100644 --- a/drivers/dma/xilinx/xdma.c +++ b/drivers/dma/xilinx/xdma.c @@ -123,6 +123,7 @@ struct xdma_desc { * @irq_start: Start IRQ assigned to device * @irq_num: Number of IRQ assigned to device * @status: Initialization status + * @pm_usr_irq: User IRQ vector storage for PM suspend/resume */ struct xdma_device { struct platform_device *pdev; @@ -135,6 +136,7 @@ struct xdma_device { u32 irq_start; u32 irq_num; u32 status; + u32 pm_usr_irq; }; #define xdma_err(xdev, fmt, args...) \ @@ -398,6 +400,28 @@ static int xdma_xfer_stop(struct xdma_chan *xchan) CHAN_CTRL_RUN_STOP); } +/** + * xdma_reconfig_channels - Reconfigure DMA channels + * @xdev: DMA device pointer + * @chans: channels configuration + * @chan_num: number of channels + */ +static int xdma_reconfig_channels(struct xdma_device *xdev, + struct xdma_chan *chans, + u32 chan_num) +{ + int i, ret; + + for (i = 0; i < chan_num; i++) { + /* init channel hardware */ + ret = xdma_channel_init(&(chans[i])); + if (ret) + return ret; + } + + return 0; +} + /** * xdma_alloc_channels - Detect and allocate DMA channels * @xdev: DMA device pointer @@ -1018,6 +1042,53 @@ static int xdma_set_vector_reg(struct xdma_device *xdev, u32 vec_tbl_start, return 0; } +/** + * xdma_irq_reconfig - Reconfigure IRQs + * @xdev: DMA device pointer + */ +static int xdma_irq_reconfig(struct xdma_device *xdev) +{ + u32 user_irq_start; + int ret; + + /* reconfigure hardware IRQ registers */ + ret = xdma_set_vector_reg(xdev, XDMA_IRQ_CHAN_VEC_NUM, 0, + XDMA_CHAN_NUM(xdev)); + if (ret) { + xdma_err(xdev, "failed to reset channel vectors: %d", ret); + return ret; + } + + /* reconfigure user IRQ registers if needed */ + user_irq_start = XDMA_CHAN_NUM(xdev); + if (xdev->irq_num > user_irq_start) { + ret = xdma_set_vector_reg(xdev, XDMA_IRQ_USER_VEC_NUM, + user_irq_start, + xdev->irq_num - user_irq_start); + if (ret) { + xdma_err(xdev, "failed to reset user vectors: %d", ret); + return ret; + } + } + + /* reenable channels interrupts */ + ret = regmap_write(xdev->rmap, XDMA_IRQ_CHAN_INT_EN_W1S, ~0); + if (ret) { + xdma_err(xdev, "failed to reenable channel IRQs: %d", ret); + return ret; + } + + /* reenable user interrupts */ + ret = regmap_write(xdev->rmap, XDMA_IRQ_USER_INT_EN_W1S, + xdev->pm_usr_irq); + if (ret) { + xdma_err(xdev, "failed to reenable user IRQs: %d", ret); + return ret; + } + + return 0; +} + /** * xdma_irq_init - initialize IRQs * @xdev: DMA device pointer @@ -1297,15 +1368,65 @@ static int xdma_probe(struct platform_device *pdev) return ret; } +/** + * xdma_suspend - PM suspend callback + * @dev: XDMA device pointer + */ +static int xdma_suspend(struct device *dev) +{ + struct xdma_device *xdev = dev_get_drvdata(dev); + int ret; + + ret = regmap_read(xdev->rmap, XDMA_IRQ_USER_INT_EN, + &xdev->pm_usr_irq); + if (ret) { + xdma_err(xdev, "User IRQ vector backup failed: %d", ret); + return ret; + } + + ret = regmap_write(xdev->rmap, XDMA_IRQ_CHAN_INT_EN_W1C, ~0); + if (ret) + xdma_err(xdev, "DMA channels IRQ disable failed: %d", ret); + + return ret; +} + +/** + * xdma_resume - PM resume callback + * @dev: XDMA device pointer + */ +static int xdma_resume(struct device *dev) +{ + struct xdma_device *xdev = dev_get_drvdata(dev); + int ret; + + ret = xdma_reconfig_channels(xdev, xdev->h2c_chans, xdev->h2c_chan_num); + if (ret) { + xdma_err(xdev, "H2C channels reconfiguration failed: %d", ret); + return ret; + } + + ret = xdma_reconfig_channels(xdev, xdev->c2h_chans, xdev->c2h_chan_num); + if (ret) { + xdma_err(xdev, "C2H channels reconfiguration failed: %d", ret); + return ret; + } + + return xdma_irq_reconfig(xdev); +} + static const struct platform_device_id xdma_id_table[] = { { "xdma", 0}, { }, }; MODULE_DEVICE_TABLE(platform, xdma_id_table); +static DEFINE_NOIRQ_DEV_PM_OPS(xdma_dev_pm_ops, xdma_suspend, xdma_resume); + static struct platform_driver xdma_driver = { .driver = { .name = "xdma", + .pm = pm_sleep_ptr(&xdma_dev_pm_ops), }, .id_table = xdma_id_table, .probe = xdma_probe, -- 2.56.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2 1/1] dmaengine: xilinx: xdma: Fix broken PM suspend/resume 2026-11-20 15:59 ` [PATCH v2 1/1] " tumic @ 2026-11-20 16:13 ` sashiko-bot 2026-11-20 16:56 ` Frank Li 1 sibling, 0 replies; 5+ messages in thread From: sashiko-bot @ 2026-11-20 16:13 UTC (permalink / raw) To: tumic; +Cc: dmaengine, vkoul, Frank.Li Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] dmaengine: xilinx: xdma: duplicated IRQ setup in xdma_irq_reconfig() -- commit 704030a92f0e7711c7f9e1160147269d5766e4f9 Author: Martin Tůma <martin.tuma@digiteqautomotive.com> dmaengine: xilinx: xdma: Fix broken PM suspend/resume This commit adds noireq PM suspend and resume callbacks to save user IRQ settings, disable channel interrupts on suspend, and reconfigure DMA channels and interrupts on resume. > diff --git a/drivers/dma/xilinx/xdma.c b/drivers/dma/xilinx/xdma.c > index 9d827c9a12674..fa006c9bae23c 100644 > --- a/drivers/dma/xilinx/xdma.c > +++ b/drivers/dma/xilinx/xdma.c [ ... ] > @@ -398,6 +400,28 @@ static int xdma_xfer_stop(struct xdma_chan *xchan) > CHAN_CTRL_RUN_STOP); > } > > +/** > + * xdma_reconfig_channels - Reconfigure DMA channels > + * @xdev: DMA device pointer > + * @chans: channels configuration > + * @chan_num: number of channels > + */ > +static int xdma_reconfig_channels(struct xdma_device *xdev, > + struct xdma_chan *chans, > + u32 chan_num) > +{ > + int i, ret; > + > + for (i = 0; i < chan_num; i++) { > + /* init channel hardware */ > + ret = xdma_channel_init(&(chans[i])); > + if (ret) > + return ret; > + } > + > + return 0; > +} > + > /** > * xdma_alloc_channels - Detect and allocate DMA channels > * @xdev: DMA device pointer > @@ -1018,6 +1042,53 @@ static int xdma_set_vector_reg(struct xdma_device *xdev, u32 vec_tbl_start, > return 0; > } > > +/** > + * xdma_irq_reconfig - Reconfigure IRQs > + * @xdev: DMA device pointer > + */ > +static int xdma_irq_reconfig(struct xdma_device *xdev) > +{ > + u32 user_irq_start; > + int ret; > + > + /* reconfigure hardware IRQ registers */ > + ret = xdma_set_vector_reg(xdev, XDMA_IRQ_CHAN_VEC_NUM, 0, > + XDMA_CHAN_NUM(xdev)); > + if (ret) { > + xdma_err(xdev, "failed to reset channel vectors: %d", ret); > + return ret; > + } > + > + /* reconfigure user IRQ registers if needed */ > + user_irq_start = XDMA_CHAN_NUM(xdev); > + if (xdev->irq_num > user_irq_start) { > + ret = xdma_set_vector_reg(xdev, XDMA_IRQ_USER_VEC_NUM, > + user_irq_start, > + xdev->irq_num - user_irq_start); > + if (ret) { > + xdma_err(xdev, "failed to reset user vectors: %d", ret); > + return ret; > + } > + } > + > + /* reenable channels interrupts */ > + ret = regmap_write(xdev->rmap, XDMA_IRQ_CHAN_INT_EN_W1S, ~0); > + if (ret) { > + xdma_err(xdev, "failed to reenable channel IRQs: %d", ret); > + return ret; > + } > + > + /* reenable user interrupts */ > + ret = regmap_write(xdev->rmap, XDMA_IRQ_USER_INT_EN_W1S, > + xdev->pm_usr_irq); > + if (ret) { > + xdma_err(xdev, "failed to reenable user IRQs: %d", ret); > + return ret; > + } > + > + return 0; > +} [Severity: Low] This isn't a bug, but xdma_irq_reconfig() duplicates the IRQ vector and channel interrupt enable setup at the end of xdma_irq_init(): drivers/dma/xilinx/xdma.c:xdma_irq_init() { ... /* config hardware IRQ registers */ ret = xdma_set_vector_reg(xdev, XDMA_IRQ_CHAN_VEC_NUM, 0, XDMA_CHAN_NUM(xdev)); if (ret) { xdma_err(xdev, "failed to set channel vectors: %d", ret); goto failed_init_c2h; } /* config user IRQ registers if needed */ user_irq_start = XDMA_CHAN_NUM(xdev); if (xdev->irq_num > user_irq_start) { ret = xdma_set_vector_reg(xdev, XDMA_IRQ_USER_VEC_NUM, user_irq_start, xdev->irq_num - user_irq_start); if (ret) { xdma_err(xdev, "failed to set user vectors: %d", ret); goto failed_init_c2h; } } /* enable interrupt */ ret = regmap_write(xdev->rmap, XDMA_IRQ_CHAN_INT_EN_W1S, ~0); if (ret) goto failed_init_c2h; ... } Since xdev->pm_usr_irq is 0 during probe and XDMA_IRQ_USER_INT_EN_W1S is write-1-to-set, could xdma_irq_init() call xdma_irq_reconfig(xdev) instead of repeating this sequence? Also, the xdev argument to xdma_reconfig_channels() is unused. -- Sashiko AI review · https://sashiko.dev/#/patchset/20261120155924.5785-1-tumic@gpxsee.org?part=1 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 1/1] dmaengine: xilinx: xdma: Fix broken PM suspend/resume 2026-11-20 15:59 ` [PATCH v2 1/1] " tumic 2026-11-20 16:13 ` sashiko-bot @ 2026-11-20 16:56 ` Frank Li 2026-11-20 17:19 ` Martin Tůma 1 sibling, 1 reply; 5+ messages in thread From: Frank Li @ 2026-11-20 16:56 UTC (permalink / raw) To: tumic Cc: Lizhi Hou, Brian Xu, Raj Kumar Rampelli, Vinod Koul, Frank Li, Michal Simek, dmaengine, linux-arm-kernel, Martin Tůma On Fri, Nov 20, 2026 at 04:59:24PM +0100, tumic@gpxsee.org wrote: > [You don't often get email from tumic@gpxsee.org. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ] > > From: Martin Tůma <martin.tuma@digiteqautomotive.com> > > Add the missing PM suspend/resume callbacks that properly reconfigure > the XDMA HW on PCIe suspend/resume. why need reconfigure irq ? Frank > > Signed-off-by: Martin Tůma <martin.tuma@digiteqautomotive.com> > --- > drivers/dma/xilinx/xdma.c | 121 ++++++++++++++++++++++++++++++++++++++ > 1 file changed, 121 insertions(+) > > diff --git a/drivers/dma/xilinx/xdma.c b/drivers/dma/xilinx/xdma.c > index 9d827c9a1267..fa006c9bae23 100644 > --- a/drivers/dma/xilinx/xdma.c > +++ b/drivers/dma/xilinx/xdma.c > @@ -123,6 +123,7 @@ struct xdma_desc { > * @irq_start: Start IRQ assigned to device > * @irq_num: Number of IRQ assigned to device > * @status: Initialization status > + * @pm_usr_irq: User IRQ vector storage for PM suspend/resume > */ > struct xdma_device { > struct platform_device *pdev; > @@ -135,6 +136,7 @@ struct xdma_device { > u32 irq_start; > u32 irq_num; > u32 status; > + u32 pm_usr_irq; > }; > > #define xdma_err(xdev, fmt, args...) \ > @@ -398,6 +400,28 @@ static int xdma_xfer_stop(struct xdma_chan *xchan) > CHAN_CTRL_RUN_STOP); > } > > +/** > + * xdma_reconfig_channels - Reconfigure DMA channels > + * @xdev: DMA device pointer > + * @chans: channels configuration > + * @chan_num: number of channels > + */ > +static int xdma_reconfig_channels(struct xdma_device *xdev, > + struct xdma_chan *chans, > + u32 chan_num) > +{ > + int i, ret; > + > + for (i = 0; i < chan_num; i++) { > + /* init channel hardware */ > + ret = xdma_channel_init(&(chans[i])); > + if (ret) > + return ret; > + } > + > + return 0; > +} > + > /** > * xdma_alloc_channels - Detect and allocate DMA channels > * @xdev: DMA device pointer > @@ -1018,6 +1042,53 @@ static int xdma_set_vector_reg(struct xdma_device *xdev, u32 vec_tbl_start, > return 0; > } > > +/** > + * xdma_irq_reconfig - Reconfigure IRQs > + * @xdev: DMA device pointer > + */ > +static int xdma_irq_reconfig(struct xdma_device *xdev) > +{ > + u32 user_irq_start; > + int ret; > + > + /* reconfigure hardware IRQ registers */ > + ret = xdma_set_vector_reg(xdev, XDMA_IRQ_CHAN_VEC_NUM, 0, > + XDMA_CHAN_NUM(xdev)); > + if (ret) { > + xdma_err(xdev, "failed to reset channel vectors: %d", ret); > + return ret; > + } > + > + /* reconfigure user IRQ registers if needed */ > + user_irq_start = XDMA_CHAN_NUM(xdev); > + if (xdev->irq_num > user_irq_start) { > + ret = xdma_set_vector_reg(xdev, XDMA_IRQ_USER_VEC_NUM, > + user_irq_start, > + xdev->irq_num - user_irq_start); > + if (ret) { > + xdma_err(xdev, "failed to reset user vectors: %d", ret); > + return ret; > + } > + } > + > + /* reenable channels interrupts */ > + ret = regmap_write(xdev->rmap, XDMA_IRQ_CHAN_INT_EN_W1S, ~0); > + if (ret) { > + xdma_err(xdev, "failed to reenable channel IRQs: %d", ret); > + return ret; > + } > + > + /* reenable user interrupts */ > + ret = regmap_write(xdev->rmap, XDMA_IRQ_USER_INT_EN_W1S, > + xdev->pm_usr_irq); > + if (ret) { > + xdma_err(xdev, "failed to reenable user IRQs: %d", ret); > + return ret; > + } > + > + return 0; > +} > + > /** > * xdma_irq_init - initialize IRQs > * @xdev: DMA device pointer > @@ -1297,15 +1368,65 @@ static int xdma_probe(struct platform_device *pdev) > return ret; > } > > +/** > + * xdma_suspend - PM suspend callback > + * @dev: XDMA device pointer > + */ > +static int xdma_suspend(struct device *dev) > +{ > + struct xdma_device *xdev = dev_get_drvdata(dev); > + int ret; > + > + ret = regmap_read(xdev->rmap, XDMA_IRQ_USER_INT_EN, > + &xdev->pm_usr_irq); > + if (ret) { > + xdma_err(xdev, "User IRQ vector backup failed: %d", ret); > + return ret; > + } > + > + ret = regmap_write(xdev->rmap, XDMA_IRQ_CHAN_INT_EN_W1C, ~0); > + if (ret) > + xdma_err(xdev, "DMA channels IRQ disable failed: %d", ret); > + > + return ret; > +} > + > +/** > + * xdma_resume - PM resume callback > + * @dev: XDMA device pointer > + */ > +static int xdma_resume(struct device *dev) > +{ > + struct xdma_device *xdev = dev_get_drvdata(dev); > + int ret; > + > + ret = xdma_reconfig_channels(xdev, xdev->h2c_chans, xdev->h2c_chan_num); > + if (ret) { > + xdma_err(xdev, "H2C channels reconfiguration failed: %d", ret); > + return ret; > + } > + > + ret = xdma_reconfig_channels(xdev, xdev->c2h_chans, xdev->c2h_chan_num); > + if (ret) { > + xdma_err(xdev, "C2H channels reconfiguration failed: %d", ret); > + return ret; > + } > + > + return xdma_irq_reconfig(xdev); > +} > + > static const struct platform_device_id xdma_id_table[] = { > { "xdma", 0}, > { }, > }; > MODULE_DEVICE_TABLE(platform, xdma_id_table); > > +static DEFINE_NOIRQ_DEV_PM_OPS(xdma_dev_pm_ops, xdma_suspend, xdma_resume); > + > static struct platform_driver xdma_driver = { > .driver = { > .name = "xdma", > + .pm = pm_sleep_ptr(&xdma_dev_pm_ops), > }, > .id_table = xdma_id_table, > .probe = xdma_probe, > -- > 2.56.1 > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 1/1] dmaengine: xilinx: xdma: Fix broken PM suspend/resume 2026-11-20 16:56 ` Frank Li @ 2026-11-20 17:19 ` Martin Tůma 0 siblings, 0 replies; 5+ messages in thread From: Martin Tůma @ 2026-11-20 17:19 UTC (permalink / raw) To: Frank Li Cc: Lizhi Hou, Brian Xu, Raj Kumar Rampelli, Vinod Koul, Frank Li, Michal Simek, dmaengine, linux-arm-kernel, Martin Tůma On 11/20/26 5:56 PM, Frank Li wrote: > On Fri, Nov 20, 2026 at 04:59:24PM +0100, tumic@gpxsee.org wrote: >> [You don't often get email from tumic@gpxsee.org. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ] >> >> From: Martin Tůma <martin.tuma@digiteqautomotive.com> >> >> Add the missing PM suspend/resume callbacks that properly reconfigure >> the XDMA HW on PCIe suspend/resume. > > why need reconfigure irq ? Because the PCIe card looses power during suspend and all configured FPGA registers are gone (in fact the whole FPGA configuration/LUTs is gone, but that's the HW's job to reconfigure the FPGA when power is restored like it does it on boot. From the OS point of view only the register reconfiguration must be restored). M. > > Frank > >> >> Signed-off-by: Martin Tůma <martin.tuma@digiteqautomotive.com> >> --- >> drivers/dma/xilinx/xdma.c | 121 ++++++++++++++++++++++++++++++++++++++ >> 1 file changed, 121 insertions(+) >> >> diff --git a/drivers/dma/xilinx/xdma.c b/drivers/dma/xilinx/xdma.c >> index 9d827c9a1267..fa006c9bae23 100644 >> --- a/drivers/dma/xilinx/xdma.c >> +++ b/drivers/dma/xilinx/xdma.c >> @@ -123,6 +123,7 @@ struct xdma_desc { >> * @irq_start: Start IRQ assigned to device >> * @irq_num: Number of IRQ assigned to device >> * @status: Initialization status >> + * @pm_usr_irq: User IRQ vector storage for PM suspend/resume >> */ >> struct xdma_device { >> struct platform_device *pdev; >> @@ -135,6 +136,7 @@ struct xdma_device { >> u32 irq_start; >> u32 irq_num; >> u32 status; >> + u32 pm_usr_irq; >> }; >> >> #define xdma_err(xdev, fmt, args...) \ >> @@ -398,6 +400,28 @@ static int xdma_xfer_stop(struct xdma_chan *xchan) >> CHAN_CTRL_RUN_STOP); >> } >> >> +/** >> + * xdma_reconfig_channels - Reconfigure DMA channels >> + * @xdev: DMA device pointer >> + * @chans: channels configuration >> + * @chan_num: number of channels >> + */ >> +static int xdma_reconfig_channels(struct xdma_device *xdev, >> + struct xdma_chan *chans, >> + u32 chan_num) >> +{ >> + int i, ret; >> + >> + for (i = 0; i < chan_num; i++) { >> + /* init channel hardware */ >> + ret = xdma_channel_init(&(chans[i])); >> + if (ret) >> + return ret; >> + } >> + >> + return 0; >> +} >> + >> /** >> * xdma_alloc_channels - Detect and allocate DMA channels >> * @xdev: DMA device pointer >> @@ -1018,6 +1042,53 @@ static int xdma_set_vector_reg(struct xdma_device *xdev, u32 vec_tbl_start, >> return 0; >> } >> >> +/** >> + * xdma_irq_reconfig - Reconfigure IRQs >> + * @xdev: DMA device pointer >> + */ >> +static int xdma_irq_reconfig(struct xdma_device *xdev) >> +{ >> + u32 user_irq_start; >> + int ret; >> + >> + /* reconfigure hardware IRQ registers */ >> + ret = xdma_set_vector_reg(xdev, XDMA_IRQ_CHAN_VEC_NUM, 0, >> + XDMA_CHAN_NUM(xdev)); >> + if (ret) { >> + xdma_err(xdev, "failed to reset channel vectors: %d", ret); >> + return ret; >> + } >> + >> + /* reconfigure user IRQ registers if needed */ >> + user_irq_start = XDMA_CHAN_NUM(xdev); >> + if (xdev->irq_num > user_irq_start) { >> + ret = xdma_set_vector_reg(xdev, XDMA_IRQ_USER_VEC_NUM, >> + user_irq_start, >> + xdev->irq_num - user_irq_start); >> + if (ret) { >> + xdma_err(xdev, "failed to reset user vectors: %d", ret); >> + return ret; >> + } >> + } >> + >> + /* reenable channels interrupts */ >> + ret = regmap_write(xdev->rmap, XDMA_IRQ_CHAN_INT_EN_W1S, ~0); >> + if (ret) { >> + xdma_err(xdev, "failed to reenable channel IRQs: %d", ret); >> + return ret; >> + } >> + >> + /* reenable user interrupts */ >> + ret = regmap_write(xdev->rmap, XDMA_IRQ_USER_INT_EN_W1S, >> + xdev->pm_usr_irq); >> + if (ret) { >> + xdma_err(xdev, "failed to reenable user IRQs: %d", ret); >> + return ret; >> + } >> + >> + return 0; >> +} >> + >> /** >> * xdma_irq_init - initialize IRQs >> * @xdev: DMA device pointer >> @@ -1297,15 +1368,65 @@ static int xdma_probe(struct platform_device *pdev) >> return ret; >> } >> >> +/** >> + * xdma_suspend - PM suspend callback >> + * @dev: XDMA device pointer >> + */ >> +static int xdma_suspend(struct device *dev) >> +{ >> + struct xdma_device *xdev = dev_get_drvdata(dev); >> + int ret; >> + >> + ret = regmap_read(xdev->rmap, XDMA_IRQ_USER_INT_EN, >> + &xdev->pm_usr_irq); >> + if (ret) { >> + xdma_err(xdev, "User IRQ vector backup failed: %d", ret); >> + return ret; >> + } >> + >> + ret = regmap_write(xdev->rmap, XDMA_IRQ_CHAN_INT_EN_W1C, ~0); >> + if (ret) >> + xdma_err(xdev, "DMA channels IRQ disable failed: %d", ret); >> + >> + return ret; >> +} >> + >> +/** >> + * xdma_resume - PM resume callback >> + * @dev: XDMA device pointer >> + */ >> +static int xdma_resume(struct device *dev) >> +{ >> + struct xdma_device *xdev = dev_get_drvdata(dev); >> + int ret; >> + >> + ret = xdma_reconfig_channels(xdev, xdev->h2c_chans, xdev->h2c_chan_num); >> + if (ret) { >> + xdma_err(xdev, "H2C channels reconfiguration failed: %d", ret); >> + return ret; >> + } >> + >> + ret = xdma_reconfig_channels(xdev, xdev->c2h_chans, xdev->c2h_chan_num); >> + if (ret) { >> + xdma_err(xdev, "C2H channels reconfiguration failed: %d", ret); >> + return ret; >> + } >> + >> + return xdma_irq_reconfig(xdev); >> +} >> + >> static const struct platform_device_id xdma_id_table[] = { >> { "xdma", 0}, >> { }, >> }; >> MODULE_DEVICE_TABLE(platform, xdma_id_table); >> >> +static DEFINE_NOIRQ_DEV_PM_OPS(xdma_dev_pm_ops, xdma_suspend, xdma_resume); >> + >> static struct platform_driver xdma_driver = { >> .driver = { >> .name = "xdma", >> + .pm = pm_sleep_ptr(&xdma_dev_pm_ops), >> }, >> .id_table = xdma_id_table, >> .probe = xdma_probe, >> -- >> 2.56.1 >> > ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-11-20 17:19 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-11-20 15:59 [PATCH v2 0/1] dmaengine: xilinx: xdma: Fix broken PM suspend/resume tumic 2026-11-20 15:59 ` [PATCH v2 1/1] " tumic 2026-11-20 16:13 ` sashiko-bot 2026-11-20 16:56 ` Frank Li 2026-11-20 17:19 ` Martin Tůma
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox