MLK-19017-4 gpu: imx: lcdif: add rpm status check for suspend/resume
authorFancy Fang <chen.fang@nxp.com>
Wed, 25 Jul 2018 07:25:37 +0000 (15:25 +0800)
committerLeonard Crestez <leonard.crestez@nxp.com>
Wed, 17 Apr 2019 23:51:34 +0000 (02:51 +0300)
commit63427170a9d7afc4a53e9b97eb591dc8a1b34725
tree9e6cc7bb1a907c737100c8774afe0858f7fd9471
parent30bce3986cd54f127808073936def8c8aa63ff71
MLK-19017-4 gpu: imx: lcdif: add rpm status check for suspend/resume

Add runtime PM status check during runtime suspend and resume
to avoid unnecessary jobs if it is already in that state which
can avoid below kernel warnings during system suspend if it is
alreay in runtime suspended state:

[   21.772969] ------------[ cut here ]------------
[   21.772982] WARNING: CPU: 3 PID: 3328 at drivers/clk/clk.c:594 clk_core_disable+0x80/0x88
[   21.772986] Modules linked in:
[   21.772988]
[   21.772993] CPU: 3 PID: 3328 Comm: rtcwakeup.out Not tainted 4.9.88-05410-g9fa23e9ada2a #135
[   21.772995] Hardware name: FSL i.MX8MM EVK board (DT)
[   21.772997] task: ffff800074358c80 task.stack: ffff80007b40c000
[   21.773000] PC is at clk_core_disable+0x80/0x88
[   21.773003] LR is at clk_core_disable_lock+0x20/0x34
[   21.773005] pc : [<ffff0000084e1430>] lr : [<ffff0000084e1a5c>] pstate: 800001c5
[   21.773007] sp : ffff80007b40fa90
[   21.773010] x29: ffff80007b40fa90 x28: 0000000000000000
[   21.773014] x27: 0000000000000002 x26: ffff000009395000
[   21.773017] x25: ffff00000863473c x24: ffff0000092de3d0
[   21.773021] x23: ffff80007a53f870 x22: 0000000000000000
[   21.773024] x21: ffff00000862877c x20: ffff80007a049400
[   21.773027] x19: 0000000000000140 x18: 0000000000000002
[   21.773031] x17: 0000ffff93824858 x16: ffff00000822a200
[   21.773034] x15: 0000463fe3000000 x14: 0000000000000000
[   21.773037] x13: 0000000000000000 x12: 0000000000000000
[   21.773040] x11: 0000000000000000 x10: 0000000000000000
[   21.773044] x9 : 0000000040000000 x8 : 0000000000210d00
[   21.773047] x7 : 0000000000000000 x6 : 0010ed7f00000000
[   21.773051] x5 : ffff80007a53f9a8 x4 : 0000000000000000
[   21.773054] x3 : 0000000010c110c0 x2 : 0000000000000000
[   21.773057] x1 : 0000000000000000 x0 : ffff80007a049400
[   21.773058]
[   21.773060] ---[ end trace 4a8e187491f145ed ]---
[   21.773062] Call trace:
[   21.773065] Exception stack(0xffff80007b40f8b0 to 0xffff80007b40f9e0)
[   21.773068] f8a0:                                   0000000000000140 0000ffffffffffff
[   21.773071] f8c0: ffff80007b40fa90 ffff0000084e1430 00000000800001c5 000000000000003d
[   21.773074] f8e0: ffff80007b475c00 ffff80007b40c000 ffff80007b40c000 000000018020001e
[   21.773077] f900: ffff000008c53cec ffff80007b40c000 ffff80007b40f950 ffff0000085d3b9c
[   21.773081] f920: ffff80007b40f9b0 ffff0000085f3728 ffff80007b475c00 ffff80007b475c00
[   21.773084] f940: ffff80007b40f990 ffff0000085f2430 ffff80007b475c00 ffff80007abf8800
[   21.773087] f960: ffff80007a049400 0000000000000000 0000000000000000 0000000010c110c0
[   21.773090] f980: 0000000000000000 ffff80007a53f9a8 0010ed7f00000000 0000000000000000
[   21.773092] f9a0: 0000000000210d00 0000000040000000 0000000000000000 0000000000000000
[   21.773095] f9c0: 0000000000000000 0000000000000000 0000000000000000 0000463fe3000000
[   21.773098] [<ffff0000084e1430>] clk_core_disable+0x80/0x88
[   21.773101] [<ffff0000084e1a5c>] clk_core_disable_lock+0x20/0x34
[   21.773104] [<ffff0000084e1a8c>] clk_disable+0x1c/0x24
[   21.773110] [<ffff0000085c73a0>] lcdif_disable_clocks+0x1c/0x60
[   21.773113] [<ffff0000085c7718>] imx_lcdif_suspend+0x10/0x24
[   21.773118] [<ffff0000086287a0>] platform_pm_suspend+0x24/0x50
[   21.773123] [<ffff000008633b58>] dpm_run_callback.isra.12+0x30/0x8c
[   21.773126] [<ffff0000086345d4>] __device_suspend+0x110/0x278
[   21.773129] [<ffff000008635800>] dpm_suspend+0x114/0x240
[   21.773132] [<ffff000008635bfc>] dpm_suspend_start+0x6c/0x78
[   21.773137] [<ffff000008104e28>] suspend_devices_and_enter+0xbc/0x534
[   21.773139] [<ffff0000081054f8>] pm_suspend+0x258/0x2f4
[   21.773142] [<ffff000008104030>] state_store+0x80/0xf4
[   21.773147] [<ffff0000083e7ce8>] kobj_attr_store+0x14/0x24
[   21.773153] [<ffff00000825d974>] sysfs_kf_write+0x40/0x48
[   21.773156] [<ffff00000825cd48>] kernfs_fop_write+0xb8/0x1cc
[   21.773160] [<ffff0000081e2d00>] __vfs_write+0x28/0x110
[   21.773163] [<ffff0000081e3ae4>] vfs_write+0xa8/0x1a8
[   21.773166] [<ffff0000081e4ea0>] SyS_write+0x44/0xa0
[   21.773170] [<ffff0000080838d8>] __sys_trace_return+0x0/0x4
[   21.773184] ------------[ cut here ]------------
[   21.773188] WARNING: CPU: 3 PID: 3328 at drivers/clk/clk.c:476 clk_core_unprepare+0x88/0x98
[   21.773190] Modules linked in:
[   21.773192]
[   21.773195] CPU: 3 PID: 3328 Comm: rtcwakeup.out Tainted: G        W       4.9.88-05410-g9fa23e9ada2a #135
[   21.773196] Hardware name: FSL i.MX8MM EVK board (DT)
[   21.773198] task: ffff800074358c80 task.stack: ffff80007b40c000
[   21.773201] PC is at clk_core_unprepare+0x88/0x98
[   21.773204] LR is at clk_unprepare+0x28/0x34
[   21.773206] pc : [<ffff0000084e1320>] lr : [<ffff0000084e3130>] pstate: 60000145
[   21.773208] sp : ffff80007b40faa0
[   21.773211] x29: ffff80007b40faa0 x28: 0000000000000000
[   21.773215] x27: 0000000000000002 x26: ffff000009395000
[   21.773218] x25: ffff00000863473c x24: ffff0000092de3d0
[   21.773221] x23: ffff80007a53f870 x22: 0000000000000000
[   21.773225] x21: ffff00000862877c x20: ffff80007aafbf80
[   21.773228] x19: ffff80007aafb298 x18: 0000000000000002
[   21.773232] x17: 0000ffff93824858 x16: ffff00000822a200
[   21.773235] x15: 0000463fe3000000 x14: 0000000000000000
[   21.773238] x13: 0000000000000000 x12: 0000000000000000
[   21.773241] x11: 0000000000000000 x10: 0000000000000000
[   21.773245] x9 : 0000000040000000 x8 : 0000000000210d00
[   21.773248] x7 : 0000000000000000 x6 : 0010ed7f00000000
[   21.773251] x5 : ffff80007a53f9a8 x4 : ffff00000944b000
[   21.773255] x3 : 0000000000000000 x2 : ffff800074358c80
[   21.773258] x1 : 0000000000000000 x0 : ffff80007a049400
[   21.773259]
[   21.773260] ---[ end trace 4a8e187491f145ee ]---
[   21.773262] Call trace:
[   21.773264] Exception stack(0xffff80007b40f8c0 to 0xffff80007b40f9f0)
[   21.773267] f8c0: ffff80007aafb298 0000ffffffffffff ffff80007b40faa0 ffff0000084e1320
[   21.773270] f8e0: 0000000060000145 000000000000003d ffff80007b40c000 000000018020001e
[   21.773273] f900: ffff000008c53cec ffff80007b40c000 ffff80007b40f950 ffff0000085d3b9c
[   21.773276] f920: ffff80007b40f9b0 ffff0000085f3728 ffff80007b475c00 ffff80007b475c00
[   21.773279] f940: ffff80007b40f990 ffff0000085f2430 ffff80007b475c00 ffff80007abf8800
[   21.773282] f960: ffff80007a049400 0000000000000000 ffff80007a049400 0000000000000000
[   21.773285] f980: ffff800074358c80 0000000000000000 ffff00000944b000 ffff80007a53f9a8
[   21.773288] f9a0: 0010ed7f00000000 0000000000000000 0000000000210d00 0000000040000000
[   21.773291] f9c0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[   21.773293] f9e0: 0000000000000000 0000463fe3000000
[   21.773296] [<ffff0000084e1320>] clk_core_unprepare+0x88/0x98
[   21.773299] [<ffff0000084e3130>] clk_unprepare+0x28/0x34
[   21.773303] [<ffff0000085c73a8>] lcdif_disable_clocks+0x24/0x60
[   21.773306] [<ffff0000085c7718>] imx_lcdif_suspend+0x10/0x24
[   21.773309] [<ffff0000086287a0>] platform_pm_suspend+0x24/0x50
[   21.773312] [<ffff000008633b58>] dpm_run_callback.isra.12+0x30/0x8c
[   21.773315] [<ffff0000086345d4>] __device_suspend+0x110/0x278
[   21.773318] [<ffff000008635800>] dpm_suspend+0x114/0x240
[   21.773321] [<ffff000008635bfc>] dpm_suspend_start+0x6c/0x78
[   21.773324] [<ffff000008104e28>] suspend_devices_and_enter+0xbc/0x534
[   21.773327] [<ffff0000081054f8>] pm_suspend+0x258/0x2f4
[   21.773329] [<ffff000008104030>] state_store+0x80/0xf4
[   21.773332] [<ffff0000083e7ce8>] kobj_attr_store+0x14/0x24
[   21.773336] [<ffff00000825d974>] sysfs_kf_write+0x40/0x48
[   21.773339] [<ffff00000825cd48>] kernfs_fop_write+0xb8/0x1cc
[   21.773342] [<ffff0000081e2d00>] __vfs_write+0x28/0x110
[   21.773345] [<ffff0000081e3ae4>] vfs_write+0xa8/0x1a8
[   21.773347] [<ffff0000081e4ea0>] SyS_write+0x44/0xa0
[   21.773350] [<ffff0000080838d8>] __sys_trace_return+0x0/0x4

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit a6bac9bdebbdecf56575f6e361ad8f54e5263b95)
(cherry picked from commit defd91c3c0e6d237391027fc3e89c52f656357a1)
drivers/gpu/imx/lcdif/lcdif-common.c