Skip to content
Snippets Groups Projects
Commit 3d7337de authored by Guoniu.Zhou's avatar Guoniu.Zhou Committed by Jason Liu
Browse files

MLK-16695-2: mipi_csi: Add pm suspend and resume support


Add power manager suspend and resume support for ISI

Reviewed-by: default avatarSandor Yu <sandor.yu@nxp.com>
Signed-off-by: default avatarGuoniu.Zhou <guoniu.zhou@nxp.com>
parent a03d33f3
No related merge requests found
......@@ -174,6 +174,8 @@ static int mxc_isi_probe(struct platform_device *pdev)
goto err_sclk;
}
mxc_isi->flags = MXC_ISI_PM_POWERED;
dev_dbg(dev, "mxc_isi.%d registered successfully\n", mxc_isi->id);
return 0;
......@@ -194,6 +196,39 @@ static int mxc_isi_remove(struct platform_device *pdev)
return 0;
}
static int mxc_isi_pm_suspend(struct device *dev)
{
struct mxc_isi_dev *mxc_isi = dev_get_drvdata(dev);
if (mxc_isi->flags & MXC_ISI_PM_SUSPENDED)
return 0;
clk_disable_unprepare(mxc_isi->clk);
mxc_isi->flags |= MXC_ISI_PM_SUSPENDED;
mxc_isi->flags &= ~MXC_ISI_PM_POWERED;
return 0;
}
static int mxc_isi_pm_resume(struct device *dev)
{
struct mxc_isi_dev *mxc_isi = dev_get_drvdata(dev);
int ret;
if (mxc_isi->flags & MXC_ISI_PM_POWERED)
return 0;
mxc_isi->flags |= MXC_ISI_PM_POWERED;
mxc_isi->flags &= ~MXC_ISI_PM_SUSPENDED;
ret = clk_prepare_enable(mxc_isi->clk);
return (ret) ? -EAGAIN : 0;
}
static const struct dev_pm_ops mxc_isi_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(mxc_isi_pm_suspend, mxc_isi_pm_resume)
};
static const struct of_device_id mxc_isi_of_match[] = {
{.compatible = "fsl,imx8-isi",},
{ /* sentinel */ },
......@@ -206,6 +241,7 @@ static struct platform_driver mxc_isi_driver = {
.driver = {
.of_match_table = mxc_isi_of_match,
.name = MXC_ISI_DRIVER_NAME,
.pm = &mxc_isi_pm_ops,
}
};
......
......@@ -153,6 +153,11 @@ enum mxc_isi_m2m_in_fmt {
MXC_ISI_M2M_IN_FMT_YUV422_1P10P,
};
enum mxc_isi_power_state {
MXC_ISI_PM_SUSPENDED = 0x01,
MXC_ISI_PM_POWERED = 0x02,
};
struct mxc_isi_fmt {
char *name;
u32 mbus_code;
......@@ -268,6 +273,7 @@ struct mxc_isi_dev {
struct clk *clk;
u32 interface[MAX_PORTS];
u32 flags;
/* scale factor */
u32 xfactor;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment