From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> To: Rob Clark <robdclark@gmail.com>, Sean Paul <sean@poorly.run>, Abhinav Kumar <quic_abhinavk@quicinc.com> Cc: Stephen Boyd <swboyd@chromium.org>, David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>, Bjorn Andersson <andersson@kernel.org>, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH] drm/msm/dsi: properly handle the case of empty OPP table in dsi_mgr_bridge_mode_valid Date: Tue, 24 Jan 2023 22:36:00 +0200 [thread overview] Message-ID: <20230124203600.3488766-1-dmitry.baryshkov@linaro.org> (raw) It was left unnoticed during the review that even if there is no OPP table in device tree, one will be created by a call to the function devm_pm_opp_set_clkname(). This leads to dsi_mgr_bridge_mode_valid() rejecting all modes if DT contains no OPP table for the DSI host. Rework dsi_mgr_bridge_mode_valid() to handle this case by actually checking that the table is populated with frequency entries before returning an error. Fixes: 8328041b8c82 ("drm/msm/dsi: implement opp table based check for dsi_mgr_bridge_mode_valid()") Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> --- drivers/gpu/drm/msm/dsi/dsi_manager.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/dsi/dsi_manager.c index b20fddb534a7..1bbac72dad35 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_manager.c +++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c @@ -456,18 +456,19 @@ static enum drm_mode_status dsi_mgr_bridge_mode_valid(struct drm_bridge *bridge, byte_clk_rate = dsi_byte_clk_get_rate(host, IS_BONDED_DSI(), mode); - /* - * fail all errors except -ENODEV as that could mean that opp - * table is not yet implemented - */ opp = dev_pm_opp_find_freq_ceil(&pdev->dev, &byte_clk_rate); - if (IS_ERR(opp)) { - if (PTR_ERR(opp) == -ERANGE) + if (!IS_ERR(opp)) { + dev_pm_opp_put(opp); + } else if (PTR_ERR(opp) == -ERANGE) { + /* + * An empty table is created by devm_pm_opp_set_clkname() even + * if there is none. Thus find_freq_ceil will still return + * -ERANGE in such case. + */ + if (dev_pm_opp_get_opp_count(&pdev->dev) != 0) return MODE_CLOCK_RANGE; - else if (PTR_ERR(opp) != -ENODEV) - return MODE_ERROR; } else { - dev_pm_opp_put(opp); + return MODE_ERROR; } return msm_dsi_host_check_dsc(host, mode); -- 2.39.0
WARNING: multiple messages have this Message-ID (diff)
From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> To: Rob Clark <robdclark@gmail.com>, Sean Paul <sean@poorly.run>, Abhinav Kumar <quic_abhinavk@quicinc.com> Cc: freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, Bjorn Andersson <andersson@kernel.org>, dri-devel@lists.freedesktop.org, Stephen Boyd <swboyd@chromium.org> Subject: [PATCH] drm/msm/dsi: properly handle the case of empty OPP table in dsi_mgr_bridge_mode_valid Date: Tue, 24 Jan 2023 22:36:00 +0200 [thread overview] Message-ID: <20230124203600.3488766-1-dmitry.baryshkov@linaro.org> (raw) It was left unnoticed during the review that even if there is no OPP table in device tree, one will be created by a call to the function devm_pm_opp_set_clkname(). This leads to dsi_mgr_bridge_mode_valid() rejecting all modes if DT contains no OPP table for the DSI host. Rework dsi_mgr_bridge_mode_valid() to handle this case by actually checking that the table is populated with frequency entries before returning an error. Fixes: 8328041b8c82 ("drm/msm/dsi: implement opp table based check for dsi_mgr_bridge_mode_valid()") Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> --- drivers/gpu/drm/msm/dsi/dsi_manager.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/dsi/dsi_manager.c index b20fddb534a7..1bbac72dad35 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_manager.c +++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c @@ -456,18 +456,19 @@ static enum drm_mode_status dsi_mgr_bridge_mode_valid(struct drm_bridge *bridge, byte_clk_rate = dsi_byte_clk_get_rate(host, IS_BONDED_DSI(), mode); - /* - * fail all errors except -ENODEV as that could mean that opp - * table is not yet implemented - */ opp = dev_pm_opp_find_freq_ceil(&pdev->dev, &byte_clk_rate); - if (IS_ERR(opp)) { - if (PTR_ERR(opp) == -ERANGE) + if (!IS_ERR(opp)) { + dev_pm_opp_put(opp); + } else if (PTR_ERR(opp) == -ERANGE) { + /* + * An empty table is created by devm_pm_opp_set_clkname() even + * if there is none. Thus find_freq_ceil will still return + * -ERANGE in such case. + */ + if (dev_pm_opp_get_opp_count(&pdev->dev) != 0) return MODE_CLOCK_RANGE; - else if (PTR_ERR(opp) != -ENODEV) - return MODE_ERROR; } else { - dev_pm_opp_put(opp); + return MODE_ERROR; } return msm_dsi_host_check_dsc(host, mode); -- 2.39.0
next reply other threads:[~2023-01-24 20:36 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-01-24 20:36 Dmitry Baryshkov [this message] 2023-01-24 20:36 ` [PATCH] drm/msm/dsi: properly handle the case of empty OPP table in dsi_mgr_bridge_mode_valid Dmitry Baryshkov 2023-01-24 20:49 ` Abhinav Kumar 2023-01-24 20:49 ` Abhinav Kumar 2023-01-26 19:00 ` Dmitry Baryshkov 2023-01-26 19:00 ` Dmitry Baryshkov
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20230124203600.3488766-1-dmitry.baryshkov@linaro.org \ --to=dmitry.baryshkov@linaro.org \ --cc=airlied@gmail.com \ --cc=andersson@kernel.org \ --cc=daniel@ffwll.ch \ --cc=dri-devel@lists.freedesktop.org \ --cc=freedreno@lists.freedesktop.org \ --cc=linux-arm-msm@vger.kernel.org \ --cc=quic_abhinavk@quicinc.com \ --cc=robdclark@gmail.com \ --cc=sean@poorly.run \ --cc=swboyd@chromium.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.