mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 10:58:48 +09:00
drm/rockchip: lvds: fix phy power_count may unbalance in resume and suspend
phy->ops->power_on will be called when current phy->power_count equal 0, and phy->ops->power_off will be called when current phy->power_count equal 1. but the .power_off and .power_on hook will never be called in suspend and resume process if phy->power_count is not initialized to 1 in loader_protect. Change-Id: Ib69f93ac02d396182ee08f55657c71d6cd907329 Signed-off-by: Guochun Huang <hero.huang@rock-chips.com>
This commit is contained in:
@@ -106,6 +106,7 @@ struct rockchip_lvds {
|
||||
enum lvds_format format;
|
||||
bool data_swap;
|
||||
bool dual_channel;
|
||||
bool phy_enabled;
|
||||
enum drm_lvds_dual_link_pixels pixel_order;
|
||||
|
||||
struct rockchip_lvds *primary;
|
||||
@@ -282,7 +283,10 @@ static void rockchip_lvds_enable(struct rockchip_lvds *lvds)
|
||||
return;
|
||||
}
|
||||
|
||||
phy_power_on(lvds->phy);
|
||||
if (lvds->phy && !lvds->phy_enabled) {
|
||||
phy_power_on(lvds->phy);
|
||||
lvds->phy_enabled = true;
|
||||
}
|
||||
|
||||
if (lvds->secondary)
|
||||
rockchip_lvds_enable(lvds->secondary);
|
||||
@@ -293,7 +297,10 @@ static void rockchip_lvds_disable(struct rockchip_lvds *lvds)
|
||||
if (lvds->funcs->disable)
|
||||
lvds->funcs->disable(lvds);
|
||||
|
||||
phy_power_off(lvds->phy);
|
||||
if (lvds->phy && lvds->phy_enabled) {
|
||||
phy_power_off(lvds->phy);
|
||||
lvds->phy_enabled = false;
|
||||
}
|
||||
|
||||
if (lvds->secondary)
|
||||
rockchip_lvds_disable(lvds->secondary);
|
||||
@@ -329,6 +336,21 @@ static int rockchip_lvds_encoder_loader_protect(struct drm_encoder *encoder,
|
||||
if (lvds->panel)
|
||||
panel_simple_loader_protect(lvds->panel);
|
||||
|
||||
|
||||
if (on) {
|
||||
phy_init(lvds->phy);
|
||||
if (lvds->phy) {
|
||||
lvds->phy->power_count++;
|
||||
lvds->phy_enabled = true;
|
||||
}
|
||||
} else {
|
||||
phy_exit(lvds->phy);
|
||||
if (lvds->phy) {
|
||||
lvds->phy->power_count--;
|
||||
lvds->phy_enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user