Message ID | 20160104182206.10852.47155.stgit@localhost (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Mon, Jan 04, 2016 at 07:22:06PM +0100, Martin Fuzzey wrote: > diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c > index 016e4be..16a551b 100644 > --- a/drivers/tty/serial/imx.c > +++ b/drivers/tty/serial/imx.c > @@ -2071,13 +2071,13 @@ static int imx_serial_port_suspend_noirq(struct device *dev) > struct imx_port *sport = platform_get_drvdata(pdev); > int ret; > > - ret = clk_enable(sport->clk_ipg); > + ret = clk_prepare_enable(sport->clk_ipg); > if (ret) > return ret; > > serial_imx_save_context(sport); > > - clk_disable(sport->clk_ipg); > + clk_disable_unprepare(sport->clk_ipg); NAK. If this is _noirq, then it's a context which can't sleep. Therefore, calling functions that do sleep is not permitted. > @@ -2088,13 +2088,13 @@ static int imx_serial_port_resume_noirq(struct device *dev) > struct imx_port *sport = platform_get_drvdata(pdev); > int ret; > > - ret = clk_enable(sport->clk_ipg); > + ret = clk_prepare_enable(sport->clk_ipg); > if (ret) > return ret; > > serial_imx_restore_context(sport); > > - clk_disable(sport->clk_ipg); > + clk_disable_unprepare(sport->clk_ipg); Ditto.
Hi Russell, On 01/04/2016 09:10 PM, Russell King - ARM Linux wrote: > On Mon, Jan 04, 2016 at 07:22:06PM +0100, Martin Fuzzey wrote: >> diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c >> index 016e4be..16a551b 100644 >> --- a/drivers/tty/serial/imx.c >> +++ b/drivers/tty/serial/imx.c >> @@ -2071,13 +2071,13 @@ static int imx_serial_port_suspend_noirq(struct device *dev) >> struct imx_port *sport = platform_get_drvdata(pdev); >> int ret; >> >> - ret = clk_enable(sport->clk_ipg); >> + ret = clk_prepare_enable(sport->clk_ipg); >> if (ret) >> return ret; >> >> serial_imx_save_context(sport); >> >> - clk_disable(sport->clk_ipg); >> + clk_disable_unprepare(sport->clk_ipg); > > NAK. If this is _noirq, then it's a context which can't sleep. Therefore, > calling functions that do sleep is not permitted. That's not not exactly correct. At suspend_noirq time only SPI(device's) IRQs are disabled while syscore (systimers, scheduler, main irq controllers, nonboot cpus) is still active.
Have you tried this patch: http://lists.infradead.org/pipermail/linux-arm-kernel/2016-January/397389.html
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 016e4be..16a551b 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -2071,13 +2071,13 @@ static int imx_serial_port_suspend_noirq(struct device *dev) struct imx_port *sport = platform_get_drvdata(pdev); int ret; - ret = clk_enable(sport->clk_ipg); + ret = clk_prepare_enable(sport->clk_ipg); if (ret) return ret; serial_imx_save_context(sport); - clk_disable(sport->clk_ipg); + clk_disable_unprepare(sport->clk_ipg); return 0; } @@ -2088,13 +2088,13 @@ static int imx_serial_port_resume_noirq(struct device *dev) struct imx_port *sport = platform_get_drvdata(pdev); int ret; - ret = clk_enable(sport->clk_ipg); + ret = clk_prepare_enable(sport->clk_ipg); if (ret) return ret; serial_imx_restore_context(sport); - clk_disable(sport->clk_ipg); + clk_disable_unprepare(sport->clk_ipg); return 0; }
Suspend fails due to unprepared clock: [ 638.794563] PM: Syncing filesystems ... done. [ 638.878902] Freezing user space processes ... (elapsed 0.002 seconds) done. [ 638.888454] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done. [ 638.996697] PM: suspend of devices complete after 97.200 msecs [ 639.002611] PM: suspend devices took 0.100 seconds [ 639.013020] PM: late suspend of devices complete after 2.288 msecs [ 639.021486] ------------[ cut here ]------------ [ 639.026147] WARNING: CPU: 0 PID: 488 at drivers/clk/clk.c:732 clk_core_enable+0xc0/0x12c() [ 639.034413] Modules linked in: [ 639.037490] CPU: 0 PID: 488 Comm: system_server Tainted: G W 4.4.0-rc5-pknbsp-svn2214-atag-v4.4-rc5-121-gebfd9cb #1304 [ 639.049312] Hardware name: Freescale i.MX53 (Device Tree Support) [ 639.055444] [<c0016d54>] (unwind_backtrace) from [<c00140f8>] (show_stack+0x20/0x24) [ 639.063199] [<c00140f8>] (show_stack) from [<c02c99a0>] (dump_stack+0x20/0x28) [ 639.070442] [<c02c99a0>] (dump_stack) from [<c0024ca8>] (warn_slowpath_common+0x88/0xc0) [ 639.078541] [<c0024ca8>] (warn_slowpath_common) from [<c0024d0c>] (warn_slowpath_null+0x2c/0x34) [ 639.087332] [<c0024d0c>] (warn_slowpath_null) from [<c05171e8>] (clk_core_enable+0xc0/0x12c) [ 639.095777] [<c05171e8>] (clk_core_enable) from [<c05172f8>] (clk_enable+0x2c/0x40) [ 639.103441] [<c05172f8>] (clk_enable) from [<c0349880>] (imx_serial_port_suspend_noirq+0x20/0xe0) [ 639.112336] [<c0349880>] (imx_serial_port_suspend_noirq) from [<c03a26a0>] (dpm_run_callback+0x68/0x16c) [ 639.121825] [<c03a26a0>] (dpm_run_callback) from [<c03a2898>] (__device_suspend_noirq+0xf4/0x22c) [ 639.130705] [<c03a2898>] (__device_suspend_noirq) from [<c03a4b0c>] (dpm_suspend_noirq+0x148/0x30c) [ 639.139764] [<c03a4b0c>] (dpm_suspend_noirq) from [<c00511d4>] (suspend_devices_and_enter+0x2e8/0x6a4) [ 639.149078] [<c00511d4>] (suspend_devices_and_enter) from [<c00518a0>] (pm_suspend+0x310/0x4b8) [ 639.157782] [<c00518a0>] (pm_suspend) from [<c00500ec>] (state_store+0x7c/0xcc) [ 639.165099] [<c00500ec>] (state_store) from [<c02cb6dc>] (kobj_attr_store+0x1c/0x28) [ 639.172858] [<c02cb6dc>] (kobj_attr_store) from [<c01633d4>] (sysfs_kf_write+0x54/0x58) [ 639.180871] [<c01633d4>] (sysfs_kf_write) from [<c01629b4>] (kernfs_fop_write+0x100/0x1c8) [ 639.189152] [<c01629b4>] (kernfs_fop_write) from [<c00fb8b8>] (__vfs_write+0x3c/0xe8) [ 639.196991] [<c00fb8b8>] (__vfs_write) from [<c00fc810>] (vfs_write+0xa4/0x160) [ 639.204307] [<c00fc810>] (vfs_write) from [<c00fcac4>] (SyS_write+0x4c/0x98) [ 639.211363] [<c00fcac4>] (SyS_write) from [<c0010760>] (ret_fast_syscall+0x0/0x3c) Signed-off-by: Martin Fuzzey <mfuzzey@parkeon.com> --- drivers/tty/serial/imx.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)