mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 03:40:35 +09:00
drm/bridge: analogix_dp: Set link power state
Signed-off-by: Wyon bi <bivvy.bi@rock-chips.com> Change-Id: I4f651cb18231c87a1d5848d16308876e49d13b4f
This commit is contained in:
@@ -984,6 +984,52 @@ static int analogix_dp_fast_link_train_detection(struct analogix_dp_device *dp)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int analogix_dp_link_power_up(struct analogix_dp_device *dp)
|
||||
{
|
||||
u8 value;
|
||||
int ret;
|
||||
|
||||
if (dp->dpcd[DP_DPCD_REV] < 0x11)
|
||||
return 0;
|
||||
|
||||
ret = drm_dp_dpcd_readb(&dp->aux, DP_SET_POWER, &value);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
value &= ~DP_SET_POWER_MASK;
|
||||
value |= DP_SET_POWER_D0;
|
||||
|
||||
ret = drm_dp_dpcd_writeb(&dp->aux, DP_SET_POWER, value);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
usleep_range(1000, 2000);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int analogix_dp_link_power_down(struct analogix_dp_device *dp)
|
||||
{
|
||||
u8 value;
|
||||
int ret;
|
||||
|
||||
if (dp->dpcd[DP_DPCD_REV] < 0x11)
|
||||
return 0;
|
||||
|
||||
ret = drm_dp_dpcd_readb(&dp->aux, DP_SET_POWER, &value);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
value &= ~DP_SET_POWER_MASK;
|
||||
value |= DP_SET_POWER_D3;
|
||||
|
||||
ret = drm_dp_dpcd_writeb(&dp->aux, DP_SET_POWER, value);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int analogix_dp_commit(struct analogix_dp_device *dp)
|
||||
{
|
||||
struct video_info *video = &dp->video_info;
|
||||
@@ -995,6 +1041,12 @@ static int analogix_dp_commit(struct analogix_dp_device *dp)
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = analogix_dp_link_power_up(dp);
|
||||
if (ret) {
|
||||
dev_err(dp->dev, "failed to power up link: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (device_property_read_bool(dp->dev, "panel-self-test"))
|
||||
return drm_dp_dpcd_writeb(&dp->aux, DP_EDP_CONFIGURATION_SET,
|
||||
DP_PANEL_SELF_TEST_ENABLE);
|
||||
@@ -1445,6 +1497,9 @@ static void analogix_dp_bridge_disable(struct drm_bridge *bridge)
|
||||
}
|
||||
}
|
||||
|
||||
if (!analogix_dp_get_plug_in_status(dp))
|
||||
analogix_dp_link_power_down(dp);
|
||||
|
||||
disable_irq(dp->irq);
|
||||
|
||||
if (dp->plat_data->power_off)
|
||||
|
||||
Reference in New Issue
Block a user