diff options
Diffstat (limited to 'drivers/gpu/drm/msm/dp/dp_ctrl.c')
| -rw-r--r-- | drivers/gpu/drm/msm/dp/dp_ctrl.c | 104 | 
1 files changed, 47 insertions, 57 deletions
| diff --git a/drivers/gpu/drm/msm/dp/dp_ctrl.c b/drivers/gpu/drm/msm/dp/dp_ctrl.c index c724cb0bde9d..53568567e05b 100644 --- a/drivers/gpu/drm/msm/dp/dp_ctrl.c +++ b/drivers/gpu/drm/msm/dp/dp_ctrl.c @@ -12,7 +12,7 @@  #include <linux/phy/phy-dp.h>  #include <linux/pm_opp.h>  #include <drm/drm_fixed.h> -#include <drm/drm_dp_helper.h> +#include <drm/dp/drm_dp_helper.h>  #include <drm/drm_print.h>  #include "dp_reg.h" @@ -1083,7 +1083,7 @@ static int dp_ctrl_link_train_1(struct dp_ctrl_private *ctrl,  	*training_step = DP_TRAINING_1; -	ret = dp_catalog_ctrl_set_pattern(ctrl->catalog, DP_TRAINING_PATTERN_1); +	ret = dp_catalog_ctrl_set_pattern_state_bit(ctrl->catalog, 1);  	if (ret)  		return ret;  	dp_ctrl_train_pattern_set(ctrl, DP_TRAINING_PATTERN_1 | @@ -1181,7 +1181,8 @@ static int dp_ctrl_link_train_2(struct dp_ctrl_private *ctrl,  			int *training_step)  {  	int tries = 0, ret = 0; -	char pattern; +	u8 pattern; +	u32 state_ctrl_bit;  	int const maximum_retries = 5;  	u8 link_status[DP_LINK_STATUS_SIZE]; @@ -1189,12 +1190,18 @@ static int dp_ctrl_link_train_2(struct dp_ctrl_private *ctrl,  	*training_step = DP_TRAINING_2; -	if (drm_dp_tps3_supported(ctrl->panel->dpcd)) +	if (drm_dp_tps4_supported(ctrl->panel->dpcd)) { +		pattern = DP_TRAINING_PATTERN_4; +		state_ctrl_bit = 4; +	} else if (drm_dp_tps3_supported(ctrl->panel->dpcd)) {  		pattern = DP_TRAINING_PATTERN_3; -	else +		state_ctrl_bit = 3; +	} else {  		pattern = DP_TRAINING_PATTERN_2; +		state_ctrl_bit = 2; +	} -	ret = dp_catalog_ctrl_set_pattern(ctrl->catalog, pattern); +	ret = dp_catalog_ctrl_set_pattern_state_bit(ctrl->catalog, state_ctrl_bit);  	if (ret)  		return ret; @@ -1365,60 +1372,48 @@ static int dp_ctrl_enable_stream_clocks(struct dp_ctrl_private *ctrl)  	return ret;  } -int dp_ctrl_host_init(struct dp_ctrl *dp_ctrl, bool flip, bool reset) +void dp_ctrl_reset_irq_ctrl(struct dp_ctrl *dp_ctrl, bool enable) +{ +	struct dp_ctrl_private *ctrl; + +	ctrl = container_of(dp_ctrl, struct dp_ctrl_private, dp_ctrl); + +	dp_catalog_ctrl_reset(ctrl->catalog); + +	if (enable) +		dp_catalog_ctrl_enable_irq(ctrl->catalog, enable); +} + +void dp_ctrl_phy_init(struct dp_ctrl *dp_ctrl)  {  	struct dp_ctrl_private *ctrl;  	struct dp_io *dp_io;  	struct phy *phy; -	if (!dp_ctrl) { -		DRM_ERROR("Invalid input data\n"); -		return -EINVAL; -	} -  	ctrl = container_of(dp_ctrl, struct dp_ctrl_private, dp_ctrl);  	dp_io = &ctrl->parser->io;  	phy = dp_io->phy; -	ctrl->dp_ctrl.orientation = flip; - -	if (reset) -		dp_catalog_ctrl_reset(ctrl->catalog); - -	DRM_DEBUG_DP("flip=%d\n", flip);  	dp_catalog_ctrl_phy_reset(ctrl->catalog);  	phy_init(phy); -	dp_catalog_ctrl_enable_irq(ctrl->catalog, true); - -	return 0; +	DRM_DEBUG_DP("phy=%p init=%d power_on=%d\n", +			phy, phy->init_count, phy->power_count);  } -/** - * dp_ctrl_host_deinit() - Uninitialize DP controller - * @dp_ctrl: Display Port Driver data - * - * Perform required steps to uninitialize DP controller - * and its resources. - */ -void dp_ctrl_host_deinit(struct dp_ctrl *dp_ctrl) +void dp_ctrl_phy_exit(struct dp_ctrl *dp_ctrl)  {  	struct dp_ctrl_private *ctrl;  	struct dp_io *dp_io;  	struct phy *phy; -	if (!dp_ctrl) { -		DRM_ERROR("Invalid input data\n"); -		return; -	} -  	ctrl = container_of(dp_ctrl, struct dp_ctrl_private, dp_ctrl);  	dp_io = &ctrl->parser->io;  	phy = dp_io->phy; -	dp_catalog_ctrl_enable_irq(ctrl->catalog, false); +	dp_catalog_ctrl_phy_reset(ctrl->catalog);  	phy_exit(phy); - -	DRM_DEBUG_DP("Host deinitialized successfully\n"); +	DRM_DEBUG_DP("phy=%p init=%d power_on=%d\n", +			phy, phy->init_count, phy->power_count);  }  static bool dp_ctrl_use_fixed_nvid(struct dp_ctrl_private *ctrl) @@ -1488,8 +1483,13 @@ static int dp_ctrl_deinitialize_mainlink(struct dp_ctrl_private *ctrl)  	}  	phy_power_off(phy); + +	/* aux channel down, reinit phy */  	phy_exit(phy); +	phy_init(phy); +	DRM_DEBUG_DP("phy=%p init=%d power_on=%d\n", +			phy, phy->init_count, phy->power_count);  	return 0;  } @@ -1761,6 +1761,9 @@ int dp_ctrl_on_link(struct dp_ctrl *dp_ctrl)  				/* end with failure */  				break; /* lane == 1 already */  			} + +			/* stop link training before start re training  */ +			dp_ctrl_clear_training_pattern(ctrl);  		}  	} @@ -1893,33 +1896,20 @@ int dp_ctrl_off_link_stream(struct dp_ctrl *dp_ctrl)  		return ret;  	} +	DRM_DEBUG_DP("Before, phy=%x init_count=%d power_on=%d\n", +		(u32)(uintptr_t)phy, phy->init_count, phy->power_count); +  	phy_power_off(phy);  	/* aux channel down, reinit phy */  	phy_exit(phy);  	phy_init(phy); -	DRM_DEBUG_DP("DP off link/stream done\n"); +	DRM_DEBUG_DP("phy=%p init=%d power_on=%d\n", +			phy, phy->init_count, phy->power_count);  	return ret;  } -void dp_ctrl_off_phy(struct dp_ctrl *dp_ctrl) -{ -	struct dp_ctrl_private *ctrl; -	struct dp_io *dp_io; -	struct phy *phy; - -	ctrl = container_of(dp_ctrl, struct dp_ctrl_private, dp_ctrl); -	dp_io = &ctrl->parser->io; -	phy = dp_io->phy; - -	dp_catalog_ctrl_reset(ctrl->catalog); - -	phy_exit(phy); - -	DRM_DEBUG_DP("DP off phy done\n"); -} -  int dp_ctrl_off(struct dp_ctrl *dp_ctrl)  {  	struct dp_ctrl_private *ctrl; @@ -1948,9 +1938,9 @@ int dp_ctrl_off(struct dp_ctrl *dp_ctrl)  	}  	phy_power_off(phy); -	phy_exit(phy); +	DRM_DEBUG_DP("phy=%p init=%d power_on=%d\n", +			phy, phy->init_count, phy->power_count); -	DRM_DEBUG_DP("DP off done\n");  	return ret;  } | 
