Skip to content

Commit e584cdc

Browse files
computersforpeacemmind
authored andcommitted
drm/rockchip: dsi: Reconfigure hardware on resume()
Since commit 43c2de1 ("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: 43c2de1 ("drm/rockchip: dsi: move all lane config except LCDC mux to bind()") Cc: <stable@vger.kernel.org> Signed-off-by: Brian Norris <briannorris@chromium.org> Reviewed-by: Chen-Yu Tsai <wenst@chromium.org> Tested-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> Signed-off-by: Heiko Stuebner <heiko@sntech.de> Link: https://patchwork.freedesktop.org/patch/msgid/20210928143413.v3.2.I4e9d93aadb00b1ffc7d506e3186a25492bf0b732@changeid
1 parent 514db87 commit e584cdc

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

‎drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,8 @@ struct dw_mipi_dsi_rockchip {
267267
struct dw_mipi_dsi *dmd;
268268
const struct rockchip_dw_dsi_chip_data *cdata;
269269
struct dw_mipi_dsi_plat_data pdata;
270+
271+
bool dsi_bound;
270272
};
271273

272274
struct dphy_pll_parameter_map {
@@ -963,6 +965,8 @@ static int dw_mipi_dsi_rockchip_bind(struct device *dev,
963965
goto out_pm_runtime;
964966
}
965967

968+
dsi->dsi_bound = true;
969+
966970
return 0;
967971

968972
out_pm_runtime:
@@ -982,6 +986,8 @@ static void dw_mipi_dsi_rockchip_unbind(struct device *dev,
982986
if (dsi->is_slave)
983987
return;
984988

989+
dsi->dsi_bound = false;
990+
985991
dw_mipi_dsi_unbind(dsi->dmd);
986992

987993
clk_disable_unprepare(dsi->pllref_clk);
@@ -1276,6 +1282,36 @@ static const struct phy_ops dw_mipi_dsi_dphy_ops = {
12761282
.exit = dw_mipi_dsi_dphy_exit,
12771283
};
12781284

1285+
static int __maybe_unused dw_mipi_dsi_rockchip_resume(struct device *dev)
1286+
{
1287+
struct dw_mipi_dsi_rockchip *dsi = dev_get_drvdata(dev);
1288+
int ret;
1289+
1290+
/*
1291+
* Re-configure DSI state, if we were previously initialized. We need
1292+
* to do this before rockchip_drm_drv tries to re-enable() any panels.
1293+
*/
1294+
if (dsi->dsi_bound) {
1295+
ret = clk_prepare_enable(dsi->grf_clk);
1296+
if (ret) {
1297+
DRM_DEV_ERROR(dsi->dev, "Failed to enable grf_clk: %d\n", ret);
1298+
return ret;
1299+
}
1300+
1301+
dw_mipi_dsi_rockchip_config(dsi);
1302+
if (dsi->slave)
1303+
dw_mipi_dsi_rockchip_config(dsi->slave);
1304+
1305+
clk_disable_unprepare(dsi->grf_clk);
1306+
}
1307+
1308+
return 0;
1309+
}
1310+
1311+
static const struct dev_pm_ops dw_mipi_dsi_rockchip_pm_ops = {
1312+
SET_LATE_SYSTEM_SLEEP_PM_OPS(NULL, dw_mipi_dsi_rockchip_resume)
1313+
};
1314+
12791315
static int dw_mipi_dsi_rockchip_probe(struct platform_device *pdev)
12801316
{
12811317
struct device *dev = &pdev->dev;
@@ -1593,6 +1629,7 @@ struct platform_driver dw_mipi_dsi_rockchip_driver = {
15931629
.remove = dw_mipi_dsi_rockchip_remove,
15941630
.driver = {
15951631
.of_match_table = dw_mipi_dsi_rockchip_dt_ids,
1632+
.pm = &dw_mipi_dsi_rockchip_pm_ops,
15961633
.name = "dw-mipi-dsi-rockchip",
15971634
},
15981635
};

0 commit comments

Comments
 (0)