Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mailbox: stm32-ipcc: Update wakeup management

The wakeup specific IRQ management is no more needed to wake up the
stm32 platform. A relationship has been established between the EXTI and
the RX IRQ, just need to declare the EXTI interrupt instead of the
IPCC RX IRQ.

Signed-off-by: Alexandre Torgue <alexandre.torgue@st.com>
Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>

authored by

Fabien Dessenne and committed by
Jassi Brar
69269446 41c94799

+7 -29
+7 -29
drivers/mailbox/stm32-ipcc.c
··· 52 52 struct clk *clk; 53 53 spinlock_t lock; /* protect access to IPCC registers */ 54 54 int irqs[IPCC_IRQ_NUM]; 55 - int wkp; 56 55 u32 proc_id; 57 56 u32 n_chans; 58 57 u32 xcr; ··· 281 282 282 283 /* wakeup */ 283 284 if (of_property_read_bool(np, "wakeup-source")) { 284 - ipcc->wkp = platform_get_irq_byname(pdev, "wakeup"); 285 - if (ipcc->wkp < 0) { 286 - if (ipcc->wkp != -EPROBE_DEFER) 287 - dev_err(dev, "could not get wakeup IRQ\n"); 288 - ret = ipcc->wkp; 289 - goto err_clk; 290 - } 291 - 292 285 device_set_wakeup_capable(dev, true); 293 - ret = dev_pm_set_dedicated_wake_irq(dev, ipcc->wkp); 286 + 287 + ret = dev_pm_set_wake_irq(dev, ipcc->irqs[IPCC_IRQ_RX]); 294 288 if (ret) { 295 289 dev_err(dev, "Failed to set wake up irq\n"); 296 290 goto err_init_wkp; ··· 326 334 return 0; 327 335 328 336 err_irq_wkp: 329 - if (ipcc->wkp) 337 + if (of_property_read_bool(np, "wakeup-source")) 330 338 dev_pm_clear_wake_irq(dev); 331 339 err_init_wkp: 332 - device_init_wakeup(dev, false); 340 + device_set_wakeup_capable(dev, false); 333 341 err_clk: 334 342 clk_disable_unprepare(ipcc->clk); 335 343 return ret; ··· 337 345 338 346 static int stm32_ipcc_remove(struct platform_device *pdev) 339 347 { 340 - struct stm32_ipcc *ipcc = platform_get_drvdata(pdev); 348 + struct device *dev = &pdev->dev; 341 349 342 - if (ipcc->wkp) 350 + if (of_property_read_bool(dev->of_node, "wakeup-source")) 343 351 dev_pm_clear_wake_irq(&pdev->dev); 344 352 345 - device_init_wakeup(&pdev->dev, false); 353 + device_set_wakeup_capable(dev, false); 346 354 347 355 return 0; 348 356 } 349 357 350 358 #ifdef CONFIG_PM_SLEEP 351 - static void stm32_ipcc_set_irq_wake(struct device *dev, bool enable) 352 - { 353 - struct stm32_ipcc *ipcc = dev_get_drvdata(dev); 354 - unsigned int i; 355 - 356 - if (device_may_wakeup(dev)) 357 - for (i = 0; i < IPCC_IRQ_NUM; i++) 358 - irq_set_irq_wake(ipcc->irqs[i], enable); 359 - } 360 - 361 359 static int stm32_ipcc_suspend(struct device *dev) 362 360 { 363 361 struct stm32_ipcc *ipcc = dev_get_drvdata(dev); ··· 355 373 ipcc->xmr = readl_relaxed(ipcc->reg_proc + IPCC_XMR); 356 374 ipcc->xcr = readl_relaxed(ipcc->reg_proc + IPCC_XCR); 357 375 358 - stm32_ipcc_set_irq_wake(dev, true); 359 - 360 376 return 0; 361 377 } 362 378 363 379 static int stm32_ipcc_resume(struct device *dev) 364 380 { 365 381 struct stm32_ipcc *ipcc = dev_get_drvdata(dev); 366 - 367 - stm32_ipcc_set_irq_wake(dev, false); 368 382 369 383 writel_relaxed(ipcc->xmr, ipcc->reg_proc + IPCC_XMR); 370 384 writel_relaxed(ipcc->xcr, ipcc->reg_proc + IPCC_XCR);