media: rockchip: isp1: add suspend/resume to detach/attach isp iommu

when system goto suspend, isp will be powered off,
isp iommu will be disabled, need to attach on resume,
detach on suspend.

Change-Id: I2b5e775b44d2b72df4ddcf2db12b54518c3e1f2e
Signed-off-by: Cai YiWei <cyw@rock-chips.com>
This commit is contained in:
Cai YiWei 2018-08-02 16:02:01 +08:00 committed by Tao Huang
parent 466bcfab4f
commit b628af5d2f

View File

@ -697,6 +697,27 @@ static int rkisp1_plat_remove(struct platform_device *pdev)
return 0;
}
static int __maybe_unused rkisp1_suspend(struct device *dev)
{
struct rkisp1_device *isp_dev = dev_get_drvdata(dev);
if (isp_dev->domain)
iommu_detach_device(isp_dev->domain, isp_dev->dev);
return 0;
}
static int __maybe_unused rkisp1_resume(struct device *dev)
{
struct rkisp1_device *isp_dev = dev_get_drvdata(dev);
int ret = 0;
if (isp_dev->domain)
ret = iommu_attach_device(isp_dev->domain, isp_dev->dev);
return ret;
}
static int __maybe_unused rkisp1_runtime_suspend(struct device *dev)
{
struct rkisp1_device *isp_dev = dev_get_drvdata(dev);
@ -719,8 +740,7 @@ static int __maybe_unused rkisp1_runtime_resume(struct device *dev)
}
static const struct dev_pm_ops rkisp1_plat_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
pm_runtime_force_resume)
SET_SYSTEM_SLEEP_PM_OPS(rkisp1_suspend, rkisp1_resume)
SET_RUNTIME_PM_OPS(rkisp1_runtime_suspend, rkisp1_runtime_resume, NULL)
};