media: rockchip: cif: add pm ctrl in video node open function

Signed-off-by: Zefa Chen <zefa.chen@rock-chips.com>
Change-Id: Ide54139fabfe7a70d33b14b56b6524ca639a41de
This commit is contained in:
Zefa Chen
2021-12-08 17:42:29 +08:00
committed by Tao Huang
parent 52d9400791
commit 7b9b409079
4 changed files with 11 additions and 4 deletions

View File

@@ -4016,7 +4016,7 @@ int rkcif_do_start_stream(struct rkcif_stream *stream, unsigned int mode)
if (stream->cur_stream_mode == RKCIF_STREAM_MODE_NONE) {
/* enable clocks/power-domains */
ret = pm_runtime_get_sync(dev->dev);
ret = pm_runtime_resume_and_get(dev->dev);
if (ret < 0) {
v4l2_err(v4l2_dev, "Failed to get runtime pm, %d\n",
ret);
@@ -4425,6 +4425,12 @@ static int rkcif_fh_open(struct file *filp)
return ret;
}
ret = pm_runtime_resume_and_get(cifdev->dev);
if (ret < 0) {
v4l2_err(vdev, "Failed to get runtime pm, %d\n",
ret);
return ret;
}
/*
* Soft reset via CRU.
* Because CRU would reset iommu too, so there's not chance
@@ -4473,6 +4479,7 @@ static int rkcif_fh_release(struct file *filp)
atomic_set(&cifdev->fh_cnt, 0);
mutex_unlock(&cifdev->stream_lock);
pm_runtime_put_sync(cifdev->dev);
return ret;
}

View File

@@ -425,7 +425,7 @@ static int rkcif_scale_fh_open(struct file *file)
return ret;
}
ret = pm_runtime_get_sync(cifdev->dev);
ret = pm_runtime_resume_and_get(cifdev->dev);
if (ret < 0)
v4l2_err(&cifdev->v4l2_dev, "Failed to get runtime pm, %d\n",
ret);

View File

@@ -1857,7 +1857,7 @@ static int __maybe_unused rkcif_runtime_resume(struct device *dev)
if (atomic_inc_return(&cif_dev->hw_dev->power_cnt) > 1)
return 0;
mutex_lock(&cif_dev->hw_dev->dev_lock);
ret = pm_runtime_get_sync(cif_dev->hw_dev->dev);
ret = pm_runtime_resume_and_get(cif_dev->hw_dev->dev);
mutex_unlock(&cif_dev->hw_dev->dev_lock);
return (ret > 0) ? 0 : ret;
}

View File

@@ -470,7 +470,7 @@ static int sditf_s_power(struct v4l2_subdev *sd, int on)
"%s, toisp mode %d, hdr %d, set power %d\n",
__func__, priv->toisp_inf.link_mode, priv->hdr_cfg.hdr_mode, on);
if (on)
ret = pm_runtime_get_sync(cif_dev->dev);
ret = pm_runtime_resume_and_get(cif_dev->dev);
else
pm_runtime_put(cif_dev->dev);
}