@@ -1034,14 +1034,6 @@ static void ast_crtc_dpms(struct drm_crtc *crtc, int mode)
10341034 case DRM_MODE_DPMS_ON :
10351035 ast_set_index_reg_mask (ast , AST_IO_VGASRI , 0x01 , 0xdf , 0 );
10361036 ast_set_index_reg_mask (ast , AST_IO_VGACRI , 0xb6 , 0xfc , 0 );
1037- if (ast -> tx_chip_types & AST_TX_DP501_BIT )
1038- ast_set_dp501_video_output (crtc -> dev , 1 );
1039-
1040- if (ast -> tx_chip_types & AST_TX_ASTDP_BIT ) {
1041- ast_dp_power_on_off (crtc -> dev , AST_DP_POWER_ON );
1042- ast_wait_for_vretrace (ast );
1043- ast_dp_set_on_off (crtc -> dev , 1 );
1044- }
10451037
10461038 ast_state = to_ast_crtc_state (crtc -> state );
10471039 format = ast_state -> format ;
@@ -1061,14 +1053,6 @@ static void ast_crtc_dpms(struct drm_crtc *crtc, int mode)
10611053 case DRM_MODE_DPMS_SUSPEND :
10621054 case DRM_MODE_DPMS_OFF :
10631055 ch = mode ;
1064- if (ast -> tx_chip_types & AST_TX_DP501_BIT )
1065- ast_set_dp501_video_output (crtc -> dev , 0 );
1066-
1067- if (ast -> tx_chip_types & AST_TX_ASTDP_BIT ) {
1068- ast_dp_set_on_off (crtc -> dev , 0 );
1069- ast_dp_power_on_off (crtc -> dev , AST_DP_POWER_OFF );
1070- }
1071-
10721056 ast_set_index_reg_mask (ast , AST_IO_VGASRI , 0x01 , 0xdf , 0x20 );
10731057 ast_set_index_reg_mask (ast , AST_IO_VGACRI , 0xb6 , 0xfc , ch );
10741058 break ;
@@ -1521,6 +1505,27 @@ static const struct drm_encoder_funcs ast_dp501_encoder_funcs = {
15211505 .destroy = drm_encoder_cleanup ,
15221506};
15231507
1508+ static void ast_dp501_encoder_helper_atomic_enable (struct drm_encoder * encoder ,
1509+ struct drm_atomic_state * state )
1510+ {
1511+ struct drm_device * dev = encoder -> dev ;
1512+
1513+ ast_set_dp501_video_output (dev , 1 );
1514+ }
1515+
1516+ static void ast_dp501_encoder_helper_atomic_disable (struct drm_encoder * encoder ,
1517+ struct drm_atomic_state * state )
1518+ {
1519+ struct drm_device * dev = encoder -> dev ;
1520+
1521+ ast_set_dp501_video_output (dev , 0 );
1522+ }
1523+
1524+ static const struct drm_encoder_helper_funcs ast_dp501_encoder_helper_funcs = {
1525+ .atomic_enable = ast_dp501_encoder_helper_atomic_enable ,
1526+ .atomic_disable = ast_dp501_encoder_helper_atomic_disable ,
1527+ };
1528+
15241529/*
15251530 * DP501 Connector
15261531 */
@@ -1607,6 +1612,8 @@ static int ast_dp501_output_init(struct ast_device *ast)
16071612 DRM_MODE_ENCODER_TMDS , NULL );
16081613 if (ret )
16091614 return ret ;
1615+ drm_encoder_helper_add (encoder , & ast_dp501_encoder_helper_funcs );
1616+
16101617 encoder -> possible_crtcs = drm_crtc_mask (crtc );
16111618
16121619 ret = ast_dp501_connector_init (dev , connector );
@@ -1628,6 +1635,31 @@ static const struct drm_encoder_funcs ast_astdp_encoder_funcs = {
16281635 .destroy = drm_encoder_cleanup ,
16291636};
16301637
1638+ static void ast_astdp_encoder_helper_atomic_enable (struct drm_encoder * encoder ,
1639+ struct drm_atomic_state * state )
1640+ {
1641+ struct drm_device * dev = encoder -> dev ;
1642+ struct ast_device * ast = to_ast_device (dev );
1643+
1644+ ast_dp_power_on_off (dev , AST_DP_POWER_ON );
1645+ ast_wait_for_vretrace (ast );
1646+ ast_dp_set_on_off (dev , 1 );
1647+ }
1648+
1649+ static void ast_astdp_encoder_helper_atomic_disable (struct drm_encoder * encoder ,
1650+ struct drm_atomic_state * state )
1651+ {
1652+ struct drm_device * dev = encoder -> dev ;
1653+
1654+ ast_dp_set_on_off (dev , 0 );
1655+ ast_dp_power_on_off (dev , AST_DP_POWER_OFF );
1656+ }
1657+
1658+ static const struct drm_encoder_helper_funcs ast_astdp_encoder_helper_funcs = {
1659+ .atomic_enable = ast_astdp_encoder_helper_atomic_enable ,
1660+ .atomic_disable = ast_astdp_encoder_helper_atomic_disable ,
1661+ };
1662+
16311663/*
16321664 * ASPEED Display-Port Connector
16331665 */
@@ -1726,6 +1758,8 @@ static int ast_astdp_output_init(struct ast_device *ast)
17261758 DRM_MODE_ENCODER_TMDS , NULL );
17271759 if (ret )
17281760 return ret ;
1761+ drm_encoder_helper_add (encoder , & ast_astdp_encoder_helper_funcs );
1762+
17291763 encoder -> possible_crtcs = drm_crtc_mask (crtc );
17301764
17311765 ret = ast_astdp_connector_init (dev , connector );
0 commit comments