mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 03:40:35 +09:00
media: rockchip: cif: fix pm runtime error
at a high frame rate (120fps), the fast switch test has a higher probability of the following errors: Failed to get runtime pm, -22 Signed-off-by: Yiqing Zeng <zack.zeng@rock-chips.com> Change-Id: I6d9fdd86cc69368ba340ab7e43d2b6030a72ce8c
This commit is contained in:
@@ -2479,7 +2479,7 @@ static void rkcif_stop_streaming(struct vb2_queue *queue)
|
||||
dev->can_be_reset = false;
|
||||
dev->reset_work_cancel = true;
|
||||
}
|
||||
pm_runtime_put(dev->dev);
|
||||
pm_runtime_put_sync(dev->dev);
|
||||
|
||||
if (!atomic_read(&dev->pipe.stream_cnt) && dev->dummy_buf.vaddr)
|
||||
rkcif_destroy_dummy_buf(stream);
|
||||
@@ -3177,7 +3177,7 @@ stop_stream:
|
||||
pipe_stream_off:
|
||||
dev->pipe.set_stream(&dev->pipe, false);
|
||||
runtime_put:
|
||||
pm_runtime_put(dev->dev);
|
||||
pm_runtime_put_sync(dev->dev);
|
||||
destroy_buf:
|
||||
if (stream->next_buf)
|
||||
vb2_buffer_done(&stream->next_buf->vb.vb2_buf,
|
||||
|
||||
@@ -1309,21 +1309,28 @@ static int rkcif_plat_remove(struct platform_device *pdev)
|
||||
static int __maybe_unused rkcif_runtime_suspend(struct device *dev)
|
||||
{
|
||||
struct rkcif_device *cif_dev = dev_get_drvdata(dev);
|
||||
int ret = 0;
|
||||
|
||||
if (atomic_dec_return(&cif_dev->hw_dev->power_cnt))
|
||||
return 0;
|
||||
|
||||
return pm_runtime_put(cif_dev->hw_dev->dev);
|
||||
mutex_lock(&cif_dev->hw_dev->dev_lock);
|
||||
ret = pm_runtime_put_sync(cif_dev->hw_dev->dev);
|
||||
mutex_unlock(&cif_dev->hw_dev->dev_lock);
|
||||
return (ret > 0) ? 0 : ret;
|
||||
}
|
||||
|
||||
static int __maybe_unused rkcif_runtime_resume(struct device *dev)
|
||||
{
|
||||
struct rkcif_device *cif_dev = dev_get_drvdata(dev);
|
||||
int ret = 0;
|
||||
|
||||
if (atomic_inc_return(&cif_dev->hw_dev->power_cnt) > 1)
|
||||
return 0;
|
||||
|
||||
return pm_runtime_get_sync(cif_dev->hw_dev->dev);
|
||||
mutex_lock(&cif_dev->hw_dev->dev_lock);
|
||||
ret = pm_runtime_get_sync(cif_dev->hw_dev->dev);
|
||||
mutex_unlock(&cif_dev->hw_dev->dev_lock);
|
||||
return (ret > 0) ? 0 : ret;
|
||||
}
|
||||
|
||||
static int __maybe_unused __rkcif_clr_unready_dev(void)
|
||||
|
||||
@@ -958,6 +958,8 @@ static int rkcif_plat_hw_probe(struct platform_device *pdev)
|
||||
|
||||
rkcif_hw_soft_reset(cif_hw, true);
|
||||
|
||||
mutex_init(&cif_hw->dev_lock);
|
||||
|
||||
pm_runtime_enable(&pdev->dev);
|
||||
|
||||
if (data->chip_id == CHIP_RK1808_CIF ||
|
||||
@@ -978,6 +980,7 @@ static int rkcif_plat_remove(struct platform_device *pdev)
|
||||
if (cif_hw->iommu_en)
|
||||
rkcif_iommu_cleanup(cif_hw);
|
||||
|
||||
mutex_destroy(&cif_hw->dev_lock);
|
||||
if (cif_hw->chip_id != CHIP_RK1808_CIF &&
|
||||
cif_hw->chip_id != CHIP_RV1126_CIF &&
|
||||
cif_hw->chip_id != CHIP_RV1126_CIF_LITE &&
|
||||
|
||||
@@ -84,6 +84,7 @@ struct rkcif_hw {
|
||||
|
||||
atomic_t power_cnt;
|
||||
const struct rkcif_hw_match_data *match_data;
|
||||
struct mutex dev_lock;
|
||||
};
|
||||
|
||||
void rkcif_hw_soft_reset(struct rkcif_hw *cif_hw, bool is_rst_iommu);
|
||||
|
||||
Reference in New Issue
Block a user