Commit 1001cc11 authored by Maarten Zanders's avatar Maarten Zanders Committed by Miquel Raynal
Browse files

mtd: nand: raw: gpmi: fix clocks when CONFIG_PM=N



Commit f04ced6d ("mtd: nand: raw: gpmi: improve power management
handling") moved all clock handling into PM callbacks. With CONFIG_PM
disabled, those callbacks are missing, leaving the driver unusable.

Add clock init/teardown for !CONFIG_PM builds to restore basic operation.
Keeping the driver working without requiring CONFIG_PM is preferred over
adding a Kconfig dependency.

Fixes: f04ced6d ("mtd: nand: raw: gpmi: improve power management handling")
Signed-off-by: default avatarMaarten Zanders <maarten@zanders.be>
Cc: stable@vger.kernel.org
Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
parent fa1f26b4
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -145,6 +145,9 @@ static int __gpmi_enable_clk(struct gpmi_nand_data *this, bool v)
	return ret;
}

#define gpmi_enable_clk(x)	__gpmi_enable_clk(x, true)
#define gpmi_disable_clk(x)	__gpmi_enable_clk(x, false)

static int gpmi_init(struct gpmi_nand_data *this)
{
	struct resources *r = &this->resources;
@@ -2765,6 +2768,11 @@ static int gpmi_nand_probe(struct platform_device *pdev)
	pm_runtime_enable(&pdev->dev);
	pm_runtime_set_autosuspend_delay(&pdev->dev, 500);
	pm_runtime_use_autosuspend(&pdev->dev);
#ifndef CONFIG_PM
	ret = gpmi_enable_clk(this);
	if (ret)
		goto exit_acquire_resources;
#endif

	ret = gpmi_init(this);
	if (ret)
@@ -2800,6 +2808,9 @@ static void gpmi_nand_remove(struct platform_device *pdev)
	release_resources(this);
	pm_runtime_dont_use_autosuspend(&pdev->dev);
	pm_runtime_disable(&pdev->dev);
#ifndef CONFIG_PM
	gpmi_disable_clk(this);
#endif
}

static int gpmi_pm_suspend(struct device *dev)
@@ -2846,9 +2857,6 @@ static int gpmi_pm_resume(struct device *dev)
	return 0;
}

#define gpmi_enable_clk(x)	__gpmi_enable_clk(x, true)
#define gpmi_disable_clk(x)	__gpmi_enable_clk(x, false)

static int gpmi_runtime_suspend(struct device *dev)
{
	struct gpmi_nand_data *this = dev_get_drvdata(dev);