Commit Message
Paul Elder
June 14, 2022, 7:10 p.m. UTC
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com> There's no need to read the ID register every time streaming is started. Do it once, at probe time. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> --- drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c | 10 ++++++++++ drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c | 4 ---- 2 files changed, 10 insertions(+), 4 deletions(-)
Comments
On 15.06.2022 04:10, Paul Elder wrote: >From: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > >There's no need to read the ID register every time streaming is started. >Do it once, at probe time. > >Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by Dafna Hirschfeld <dafna@fastmail.com> >--- > drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c | 10 ++++++++++ > drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c | 4 ---- > 2 files changed, 10 insertions(+), 4 deletions(-) > >diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c >index 248f0172ca62..ba773c0784fb 100644 >--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c >+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c >@@ -467,6 +467,7 @@ static int rkisp1_probe(struct platform_device *pdev) > struct v4l2_device *v4l2_dev; > unsigned int i; > int ret, irq; >+ u32 cif_id; > > match_data = of_device_get_match_data(&pdev->dev); > if (!match_data) >@@ -509,6 +510,15 @@ static int rkisp1_probe(struct platform_device *pdev) > > pm_runtime_enable(&pdev->dev); > >+ ret = pm_runtime_resume_and_get(&pdev->dev); >+ if (ret) >+ goto err_pm_runtime_disable; >+ >+ cif_id = rkisp1_read(rkisp1, RKISP1_CIF_VI_ID); >+ dev_dbg(rkisp1->dev, "CIF_ID 0x%08x\n", cif_id); >+ >+ pm_runtime_put(&pdev->dev); >+ > rkisp1->media_dev.hw_revision = match_data->isp_ver; > strscpy(rkisp1->media_dev.model, RKISP1_DRIVER_NAME, > sizeof(rkisp1->media_dev.model)); >diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c >index 187d78075acb..02968656f3c0 100644 >--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c >+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c >@@ -473,12 +473,8 @@ static int rkisp1_config_path(struct rkisp1_device *rkisp1) > /* Hardware configure Entry */ > static int rkisp1_config_cif(struct rkisp1_device *rkisp1) > { >- u32 cif_id; > int ret; > >- cif_id = rkisp1_read(rkisp1, RKISP1_CIF_VI_ID); >- dev_dbg(rkisp1->dev, "CIF_ID 0x%08x\n", cif_id); >- > ret = rkisp1_config_isp(rkisp1); > if (ret) > return ret; >-- >2.30.2 >
diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c index 248f0172ca62..ba773c0784fb 100644 --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c @@ -467,6 +467,7 @@ static int rkisp1_probe(struct platform_device *pdev) struct v4l2_device *v4l2_dev; unsigned int i; int ret, irq; + u32 cif_id; match_data = of_device_get_match_data(&pdev->dev); if (!match_data) @@ -509,6 +510,15 @@ static int rkisp1_probe(struct platform_device *pdev) pm_runtime_enable(&pdev->dev); + ret = pm_runtime_resume_and_get(&pdev->dev); + if (ret) + goto err_pm_runtime_disable; + + cif_id = rkisp1_read(rkisp1, RKISP1_CIF_VI_ID); + dev_dbg(rkisp1->dev, "CIF_ID 0x%08x\n", cif_id); + + pm_runtime_put(&pdev->dev); + rkisp1->media_dev.hw_revision = match_data->isp_ver; strscpy(rkisp1->media_dev.model, RKISP1_DRIVER_NAME, sizeof(rkisp1->media_dev.model)); diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c index 187d78075acb..02968656f3c0 100644 --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c @@ -473,12 +473,8 @@ static int rkisp1_config_path(struct rkisp1_device *rkisp1) /* Hardware configure Entry */ static int rkisp1_config_cif(struct rkisp1_device *rkisp1) { - u32 cif_id; int ret; - cif_id = rkisp1_read(rkisp1, RKISP1_CIF_VI_ID); - dev_dbg(rkisp1->dev, "CIF_ID 0x%08x\n", cif_id); - ret = rkisp1_config_isp(rkisp1); if (ret) return ret;