Commit 2ec56b23 authored by Dmitry Baryshkov's avatar Dmitry Baryshkov

drm/msm/dsi: properly handle the case of empty OPP table in dsi_mgr_bridge_mode_valid

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: 8328041b ("drm/msm/dsi: implement opp table based check for dsi_mgr_bridge_mode_valid()")
Signed-off-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: default avatarAbhinav Kumar <quic_abhinavk@quicinc.com>
Patchwork: https://patchwork.freedesktop.org/patch/520076/
Link: https://lore.kernel.org/r/20230124203600.3488766-1-dmitry.baryshkov@linaro.orgSigned-off-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
parent a7efe60e
...@@ -456,18 +456,19 @@ static enum drm_mode_status dsi_mgr_bridge_mode_valid(struct drm_bridge *bridge, ...@@ -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); 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); opp = dev_pm_opp_find_freq_ceil(&pdev->dev, &byte_clk_rate);
if (IS_ERR(opp)) { if (!IS_ERR(opp)) {
if (PTR_ERR(opp) == -ERANGE) 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; return MODE_CLOCK_RANGE;
else if (PTR_ERR(opp) != -ENODEV)
return MODE_ERROR;
} else { } else {
dev_pm_opp_put(opp); return MODE_ERROR;
} }
return msm_dsi_host_check_dsc(host, mode); return msm_dsi_host_check_dsc(host, mode);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment