This patch came from the commit
9d7fd21acb20 ("spi/s3c64xx: Fix doubled
clock disable on suspend") and the commit
4fcd9b9e06d4 ("spi: s3c64xx:
simplify suspend / resume handlers").
Fix doubled clock disable and unprepare during PM suspend which triggered
the warnings:
[ 24.258574] WARNING: CPU: 0 PID: 326 at drivers/clk/clk.c:1010 clk_core_disable+0x90/0x14c()
[ 24.258580] Modules linked in:
[ 24.258589] CPU: 0 PID: 326 Comm: deviced Not tainted 4.1.0-01299-g70114f2-dirty #26
[ 24.258592] Hardware name: Samsung TM2 board (DT)
[ 24.258595] Call trace:
[ 24.258605] [<
ffffffc000089f34>] dump_backtrace+0x0/0x124
[ 24.258610] [<
ffffffc00008a068>] show_stack+0x10/0x1c
[ 24.258618] [<
ffffffc000a36ed0>] dump_stack+0x78/0xbc
[ 24.258624] [<
ffffffc00009acc8>] warn_slowpath_common+0x9c/0xd4
[ 24.258628] [<
ffffffc00009adc0>] warn_slowpath_null+0x14/0x20
[ 24.258632] [<
ffffffc000748e80>] clk_core_disable+0x8c/0x14c
[ 24.258636] [<
ffffffc0007493ec>] clk_disable+0x28/0x40
[ 24.258644] [<
ffffffc000529164>] s3c64xx_spi_suspend+0x3c/0x70
[ 24.258652] [<
ffffffc0004d7938>] platform_pm_suspend+0x20/0x50
[ 24.258659] [<
ffffffc0004e1b10>] dpm_run_callback+0x4c/0x190
[ 24.258664] [<
ffffffc0004e2b34>] __device_suspend+0xf4/0x380
[ 24.258669] [<
ffffffc0004e4738>] dpm_suspend+0x128/0x35c
[ 24.258674] [<
ffffffc0004e4e74>] dpm_suspend_start+0x68/0x78
[ 24.258681] [<
ffffffc0000e269c>] suspend_devices_and_enter+0xb8/0x838
[ 24.258685] [<
ffffffc0000e319c>] pm_suspend+0x380/0x5d8
[ 24.258690] [<
ffffffc0000e16d4>] state_store+0x7c/0xf4
[ 24.258697] [<
ffffffc000376a74>] kobj_attr_store+0x10/0x24
[ 24.258705] [<
ffffffc0002164d4>] sysfs_kf_write+0x3c/0x50
[ 24.258710] [<
ffffffc00021596c>] kernfs_fop_write+0xbc/0x180
[ 24.258718] [<
ffffffc0001aa2e8>] __vfs_write+0x28/0x10c
[ 24.258722] [<
ffffffc0001aac00>] vfs_write+0x8c/0x16c
[ 24.258726] [<
ffffffc0001ab518>] SyS_write+0x40/0xa0
The clocks may be already disabled before suspending. Check PM runtime
suspend status and disable clocks only if device is not suspended.
During resume do not enable the clocks if device is runtime suspended.
Change-Id: I194a5d458744086998b82602146648d34ff7050a
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
{
struct spi_master *master = dev_get_drvdata(dev);
struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master);
+ int ret;
spi_master_suspend(master);
- /* Disable the clock */
- clk_disable_unprepare(sdd->src_clk);
- clk_disable_unprepare(sdd->clk);
+ ret = pm_runtime_force_suspend(dev);
+ if (ret < 0)
+ return ret;
sdd->cur_speed = 0; /* Output Clock is stopped */
struct spi_master *master = dev_get_drvdata(dev);
struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master);
struct s3c64xx_spi_info *sci = sdd->cntrlr_info;
+ int ret;
if (sci->cfg_gpio)
sci->cfg_gpio();
- /* Enable the clock */
- clk_prepare_enable(sdd->src_clk);
- clk_prepare_enable(sdd->clk);
+ ret = pm_runtime_force_resume(dev);
+ if (ret < 0)
+ return ret;
s3c64xx_spi_hwinit(sdd, sdd->port_id);