drm/rockchip: lvds: add loader protect
authorWeiYong Bi <bivvy.bi@rock-chips.com>
Mon, 10 Jul 2017 08:30:02 +0000 (16:30 +0800)
committerHuang, Tao <huangtao@rock-chips.com>
Thu, 20 Jul 2017 06:34:43 +0000 (14:34 +0800)
Change-Id: Ia0866cb9125a98ffb4ce99be26be9e0ccd665765
Signed-off-by: WeiYong Bi <bivvy.bi@rock-chips.com>
drivers/gpu/drm/rockchip/rockchip_lvds.c

index 4accad3f2d5b376121b9cbc94bcd5b39dd49646a..245b773c18645ef7a9994d0ff4740464821c79a6 100644 (file)
@@ -427,11 +427,28 @@ static enum drm_mode_status rockchip_lvds_connector_mode_valid(
        return MODE_OK;
 }
 
+static int rockchip_lvds_loader_protect(struct drm_connector *connector,
+                                       bool on)
+{
+       struct rockchip_lvds *lvds = connector_to_lvds(connector);
+
+       if (lvds->panel)
+               drm_panel_loader_protect(lvds->panel, on);
+
+       if (on)
+               pm_runtime_get_sync(lvds->dev);
+       else
+               pm_runtime_put(lvds->dev);
+
+       return 0;
+}
+
 static
 struct drm_connector_helper_funcs rockchip_lvds_connector_helper_funcs = {
        .get_modes = rockchip_lvds_connector_get_modes,
        .mode_valid = rockchip_lvds_connector_mode_valid,
        .best_encoder = rockchip_lvds_connector_best_encoder,
+       .loader_protect = rockchip_lvds_loader_protect,
 };
 
 static void rockchip_lvds_encoder_dpms(struct drm_encoder *encoder, int mode)