Skip to content

Commit

Permalink
drm/dp: add drm_dp_link_power_down() helper
Browse files Browse the repository at this point in the history
We had _power_up(), but drivers also need to be able to power down.

Signed-off-by: Rob Clark <[email protected]>
Reviewed-by: Thierry Reding <[email protected]>
Reviewed-by: Alex Deucher <[email protected]>
  • Loading branch information
robclark committed Feb 1, 2015
1 parent 9ec60ca commit d816f07
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
31 changes: 31 additions & 0 deletions drivers/gpu/drm/drm_dp_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,37 @@ int drm_dp_link_power_up(struct drm_dp_aux *aux, struct drm_dp_link *link)
}
EXPORT_SYMBOL(drm_dp_link_power_up);

/**
* drm_dp_link_power_down() - power down a DisplayPort link
* @aux: DisplayPort AUX channel
* @link: pointer to a structure containing the link configuration
*
* Returns 0 on success or a negative error code on failure.
*/
int drm_dp_link_power_down(struct drm_dp_aux *aux, struct drm_dp_link *link)
{
u8 value;
int err;

/* DP_SET_POWER register is only available on DPCD v1.1 and later */
if (link->revision < 0x11)
return 0;

err = drm_dp_dpcd_readb(aux, DP_SET_POWER, &value);
if (err < 0)
return err;

value &= ~DP_SET_POWER_MASK;
value |= DP_SET_POWER_D3;

err = drm_dp_dpcd_writeb(aux, DP_SET_POWER, value);
if (err < 0)
return err;

return 0;
}
EXPORT_SYMBOL(drm_dp_link_power_down);

/**
* drm_dp_link_configure() - configure a DisplayPort link
* @aux: DisplayPort AUX channel
Expand Down
1 change: 1 addition & 0 deletions include/drm/drm_dp_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,7 @@ struct drm_dp_link {

int drm_dp_link_probe(struct drm_dp_aux *aux, struct drm_dp_link *link);
int drm_dp_link_power_up(struct drm_dp_aux *aux, struct drm_dp_link *link);
int drm_dp_link_power_down(struct drm_dp_aux *aux, struct drm_dp_link *link);
int drm_dp_link_configure(struct drm_dp_aux *aux, struct drm_dp_link *link);

int drm_dp_aux_register(struct drm_dp_aux *aux);
Expand Down

0 comments on commit d816f07

Please sign in to comment.