提交 ae7f75cc 编写于 作者: B Brian Norris 提交者: Zheng Zengkai

drm/rockchip: dsi: Reconfigure hardware on resume()

stable inclusion
from stable-v5.10.94
commit 9ddfa1c19191671a8aafcc5cf9181c3d0351be43
bugzilla: https://gitee.com/openeuler/kernel/issues/I531X9

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=9ddfa1c19191671a8aafcc5cf9181c3d0351be43

--------------------------------

commit e584cdc1 upstream.

Since commit 43c2de10 ("drm/rockchip: dsi: move all lane config except
LCDC mux to bind()"), we perform most HW configuration in the bind()
function. This configuration may be lost on suspend/resume, so we
need to call it again. That may lead to errors like this after system
suspend/resume:

  dw-mipi-dsi-rockchip ff968000.mipi: failed to write command FIFO
  panel-kingdisplay-kd097d04 ff960000.mipi.0: failed write init cmds: -110

Tested on Acer Chromebook Tab 10 (RK3399 Gru-Scarlet).

Note that early mailing list versions of this driver borrowed Rockchip's
downstream/BSP solution, to do HW configuration in mode_set() (which
*is* called at the appropriate pre-enable() times), but that was
discarded along the way. I've avoided that still, because mode_set()
documentation doesn't suggest this kind of purpose as far as I can tell.

Fixes: 43c2de10 ("drm/rockchip: dsi: move all lane config except LCDC mux to bind()")
Cc: <stable@vger.kernel.org>
Signed-off-by: NBrian Norris <briannorris@chromium.org>
Reviewed-by: NChen-Yu Tsai <wenst@chromium.org>
Tested-by: NNícolas F. R. A. Prado <nfraprado@collabora.com>
Signed-off-by: NHeiko Stuebner <heiko@sntech.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20210928143413.v3.2.I4e9d93aadb00b1ffc7d506e3186a25492bf0b732@changeidSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
上级 3db6345e
...@@ -243,6 +243,8 @@ struct dw_mipi_dsi_rockchip { ...@@ -243,6 +243,8 @@ struct dw_mipi_dsi_rockchip {
struct dw_mipi_dsi *dmd; struct dw_mipi_dsi *dmd;
const struct rockchip_dw_dsi_chip_data *cdata; const struct rockchip_dw_dsi_chip_data *cdata;
struct dw_mipi_dsi_plat_data pdata; struct dw_mipi_dsi_plat_data pdata;
bool dsi_bound;
}; };
struct dphy_pll_parameter_map { struct dphy_pll_parameter_map {
...@@ -944,6 +946,8 @@ static int dw_mipi_dsi_rockchip_bind(struct device *dev, ...@@ -944,6 +946,8 @@ static int dw_mipi_dsi_rockchip_bind(struct device *dev,
goto out_pll_clk; goto out_pll_clk;
} }
dsi->dsi_bound = true;
return 0; return 0;
out_pll_clk: out_pll_clk:
...@@ -965,6 +969,8 @@ static void dw_mipi_dsi_rockchip_unbind(struct device *dev, ...@@ -965,6 +969,8 @@ static void dw_mipi_dsi_rockchip_unbind(struct device *dev,
if (dsi->is_slave) if (dsi->is_slave)
return; return;
dsi->dsi_bound = false;
dw_mipi_dsi_unbind(dsi->dmd); dw_mipi_dsi_unbind(dsi->dmd);
clk_disable_unprepare(dsi->pllref_clk); clk_disable_unprepare(dsi->pllref_clk);
...@@ -1029,6 +1035,36 @@ static const struct dw_mipi_dsi_host_ops dw_mipi_dsi_rockchip_host_ops = { ...@@ -1029,6 +1035,36 @@ static const struct dw_mipi_dsi_host_ops dw_mipi_dsi_rockchip_host_ops = {
.detach = dw_mipi_dsi_rockchip_host_detach, .detach = dw_mipi_dsi_rockchip_host_detach,
}; };
static int __maybe_unused dw_mipi_dsi_rockchip_resume(struct device *dev)
{
struct dw_mipi_dsi_rockchip *dsi = dev_get_drvdata(dev);
int ret;
/*
* Re-configure DSI state, if we were previously initialized. We need
* to do this before rockchip_drm_drv tries to re-enable() any panels.
*/
if (dsi->dsi_bound) {
ret = clk_prepare_enable(dsi->grf_clk);
if (ret) {
DRM_DEV_ERROR(dsi->dev, "Failed to enable grf_clk: %d\n", ret);
return ret;
}
dw_mipi_dsi_rockchip_config(dsi);
if (dsi->slave)
dw_mipi_dsi_rockchip_config(dsi->slave);
clk_disable_unprepare(dsi->grf_clk);
}
return 0;
}
static const struct dev_pm_ops dw_mipi_dsi_rockchip_pm_ops = {
SET_LATE_SYSTEM_SLEEP_PM_OPS(NULL, dw_mipi_dsi_rockchip_resume)
};
static int dw_mipi_dsi_rockchip_probe(struct platform_device *pdev) static int dw_mipi_dsi_rockchip_probe(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
...@@ -1248,6 +1284,7 @@ struct platform_driver dw_mipi_dsi_rockchip_driver = { ...@@ -1248,6 +1284,7 @@ struct platform_driver dw_mipi_dsi_rockchip_driver = {
.remove = dw_mipi_dsi_rockchip_remove, .remove = dw_mipi_dsi_rockchip_remove,
.driver = { .driver = {
.of_match_table = dw_mipi_dsi_rockchip_dt_ids, .of_match_table = dw_mipi_dsi_rockchip_dt_ids,
.pm = &dw_mipi_dsi_rockchip_pm_ops,
.name = "dw-mipi-dsi-rockchip", .name = "dw-mipi-dsi-rockchip",
}, },
}; };
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册