[Intel-gfx] [PATCH v3 2/8] drm/i915: Move aux_ch to intel_digital_port

Souza, Jose jose.souza at intel.com
Wed Oct 31 17:11:34 UTC 2018


On Wed, 2018-10-31 at 18:26 +0200, Imre Deak wrote:
> From ICL onwards all DDI/TypeC ports - even working in HDMI mode -
> need
> to know their corresponding AUX CH, so move the field to a common
> struct.
> 
> No functional change.
> 
> v3:
> - Add code comment about which ports aux_ch is used for. (Jose)
> 

Reviewed-by: José Roberto de Souza <jose.souza at intel.com>

> Cc: Paulo Zanoni <paulo.r.zanoni at intel.com>
> Cc: Ville Syrjälä <ville.syrjala at linux.intel.com>
> Cc: José Roberto de Souza <jose.souza at intel.com>
> Signed-off-by: Imre Deak <imre.deak at intel.com>
> ---
>  drivers/gpu/drm/i915/intel_ddi.c |  4 +++-
>  drivers/gpu/drm/i915/intel_dp.c  | 35 +++++++++++++++++++++++-------
> -----
>  drivers/gpu/drm/i915/intel_drv.h |  3 ++-
>  3 files changed, 28 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_ddi.c
> b/drivers/gpu/drm/i915/intel_ddi.c
> index e40a8c97d34b..32a080265d03 100644
> --- a/drivers/gpu/drm/i915/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/intel_ddi.c
> @@ -2084,6 +2084,8 @@ bool intel_ddi_get_hw_state(struct
> intel_encoder *encoder,
>  static inline enum intel_display_power_domain
>  intel_ddi_main_link_aux_domain(struct intel_dp *intel_dp)
>  {
> +	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
> +
>  	/* CNL+ HW requires corresponding AUX IOs to be powered up for
> PSR with
>  	 * DC states enabled at the same time, while for driver
> initiated AUX
>  	 * transfers we need the same AUX IOs to be powered but with DC
> states
> @@ -2096,7 +2098,7 @@ intel_ddi_main_link_aux_domain(struct intel_dp
> *intel_dp)
>  	 * Note that PSR is enabled only on Port A even though this
> function
>  	 * returns the correct domain for other ports too.
>  	 */
> -	return intel_dp->aux_ch == AUX_CH_A ? POWER_DOMAIN_AUX_IO_A :
> +	return dig_port->aux_ch == AUX_CH_A ? POWER_DOMAIN_AUX_IO_A :
>  					      intel_dp-
> >aux_power_domain;
>  }
>  
> diff --git a/drivers/gpu/drm/i915/intel_dp.c
> b/drivers/gpu/drm/i915/intel_dp.c
> index 2445897b8f6c..5530c604c694 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -1156,6 +1156,7 @@ static uint32_t
> g4x_get_aux_clock_divider(struct intel_dp *intel_dp, int index)
>  static uint32_t ilk_get_aux_clock_divider(struct intel_dp *intel_dp,
> int index)
>  {
>  	struct drm_i915_private *dev_priv = dp_to_i915(intel_dp);
> +	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
>  
>  	if (index)
>  		return 0;
> @@ -1165,7 +1166,7 @@ static uint32_t
> ilk_get_aux_clock_divider(struct intel_dp *intel_dp, int index)
>  	 * like to run at 2MHz.  So, take the cdclk or PCH rawclk value
> and
>  	 * divide by 2000 and use that
>  	 */
> -	if (intel_dp->aux_ch == AUX_CH_A)
> +	if (dig_port->aux_ch == AUX_CH_A)
>  		return DIV_ROUND_CLOSEST(dev_priv->cdclk.hw.cdclk,
> 2000);
>  	else
>  		return DIV_ROUND_CLOSEST(dev_priv->rawclk_freq, 2000);
> @@ -1174,8 +1175,9 @@ static uint32_t
> ilk_get_aux_clock_divider(struct intel_dp *intel_dp, int index)
>  static uint32_t hsw_get_aux_clock_divider(struct intel_dp *intel_dp,
> int index)
>  {
>  	struct drm_i915_private *dev_priv = dp_to_i915(intel_dp);
> +	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
>  
> -	if (intel_dp->aux_ch != AUX_CH_A && HAS_PCH_LPT_H(dev_priv)) {
> +	if (dig_port->aux_ch != AUX_CH_A && HAS_PCH_LPT_H(dev_priv)) {
>  		/* Workaround for non-ULT HSW */
>  		switch (index) {
>  		case 0: return 63;
> @@ -1506,7 +1508,9 @@ intel_dp_aux_transfer(struct drm_dp_aux *aux,
> struct drm_dp_aux_msg *msg)
>  static enum intel_display_power_domain
>  intel_aux_power_domain(struct intel_dp *intel_dp)
>  {
> -	switch (intel_dp->aux_ch) {
> +	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
> +
> +	switch (dig_port->aux_ch) {
>  	case AUX_CH_A:
>  		return POWER_DOMAIN_AUX_A;
>  	case AUX_CH_B:
> @@ -1520,7 +1524,7 @@ intel_aux_power_domain(struct intel_dp
> *intel_dp)
>  	case AUX_CH_F:
>  		return POWER_DOMAIN_AUX_F;
>  	default:
> -		MISSING_CASE(intel_dp->aux_ch);
> +		MISSING_CASE(dig_port->aux_ch);
>  		return POWER_DOMAIN_AUX_A;
>  	}
>  }
> @@ -1528,7 +1532,8 @@ intel_aux_power_domain(struct intel_dp
> *intel_dp)
>  static i915_reg_t g4x_aux_ctl_reg(struct intel_dp *intel_dp)
>  {
>  	struct drm_i915_private *dev_priv = dp_to_i915(intel_dp);
> -	enum aux_ch aux_ch = intel_dp->aux_ch;
> +	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
> +	enum aux_ch aux_ch = dig_port->aux_ch;
>  
>  	switch (aux_ch) {
>  	case AUX_CH_B:
> @@ -1544,7 +1549,8 @@ static i915_reg_t g4x_aux_ctl_reg(struct
> intel_dp *intel_dp)
>  static i915_reg_t g4x_aux_data_reg(struct intel_dp *intel_dp, int
> index)
>  {
>  	struct drm_i915_private *dev_priv = dp_to_i915(intel_dp);
> -	enum aux_ch aux_ch = intel_dp->aux_ch;
> +	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
> +	enum aux_ch aux_ch = dig_port->aux_ch;
>  
>  	switch (aux_ch) {
>  	case AUX_CH_B:
> @@ -1560,7 +1566,8 @@ static i915_reg_t g4x_aux_data_reg(struct
> intel_dp *intel_dp, int index)
>  static i915_reg_t ilk_aux_ctl_reg(struct intel_dp *intel_dp)
>  {
>  	struct drm_i915_private *dev_priv = dp_to_i915(intel_dp);
> -	enum aux_ch aux_ch = intel_dp->aux_ch;
> +	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
> +	enum aux_ch aux_ch = dig_port->aux_ch;
>  
>  	switch (aux_ch) {
>  	case AUX_CH_A:
> @@ -1578,7 +1585,8 @@ static i915_reg_t ilk_aux_ctl_reg(struct
> intel_dp *intel_dp)
>  static i915_reg_t ilk_aux_data_reg(struct intel_dp *intel_dp, int
> index)
>  {
>  	struct drm_i915_private *dev_priv = dp_to_i915(intel_dp);
> -	enum aux_ch aux_ch = intel_dp->aux_ch;
> +	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
> +	enum aux_ch aux_ch = dig_port->aux_ch;
>  
>  	switch (aux_ch) {
>  	case AUX_CH_A:
> @@ -1596,7 +1604,8 @@ static i915_reg_t ilk_aux_data_reg(struct
> intel_dp *intel_dp, int index)
>  static i915_reg_t skl_aux_ctl_reg(struct intel_dp *intel_dp)
>  {
>  	struct drm_i915_private *dev_priv = dp_to_i915(intel_dp);
> -	enum aux_ch aux_ch = intel_dp->aux_ch;
> +	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
> +	enum aux_ch aux_ch = dig_port->aux_ch;
>  
>  	switch (aux_ch) {
>  	case AUX_CH_A:
> @@ -1615,7 +1624,8 @@ static i915_reg_t skl_aux_ctl_reg(struct
> intel_dp *intel_dp)
>  static i915_reg_t skl_aux_data_reg(struct intel_dp *intel_dp, int
> index)
>  {
>  	struct drm_i915_private *dev_priv = dp_to_i915(intel_dp);
> -	enum aux_ch aux_ch = intel_dp->aux_ch;
> +	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
> +	enum aux_ch aux_ch = dig_port->aux_ch;
>  
>  	switch (aux_ch) {
>  	case AUX_CH_A:
> @@ -1641,9 +1651,10 @@ static void
>  intel_dp_aux_init(struct intel_dp *intel_dp)
>  {
>  	struct drm_i915_private *dev_priv = dp_to_i915(intel_dp);
> -	struct intel_encoder *encoder = &dp_to_dig_port(intel_dp)-
> >base;
> +	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
> +	struct intel_encoder *encoder = &dig_port->base;
>  
> -	intel_dp->aux_ch = intel_aux_ch(dev_priv, encoder->port);
> +	dig_port->aux_ch = intel_aux_ch(dev_priv, encoder->port);
>  	intel_dp->aux_power_domain = intel_aux_power_domain(intel_dp);
>  
>  	if (INTEL_GEN(dev_priv) >= 9) {
> diff --git a/drivers/gpu/drm/i915/intel_drv.h
> b/drivers/gpu/drm/i915/intel_drv.h
> index e4eaa40bd5f1..5bc7ba326111 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -1109,7 +1109,6 @@ struct intel_dp {
>  	bool link_trained;
>  	bool has_audio;
>  	bool reset_link_params;
> -	enum aux_ch aux_ch;
>  	uint8_t dpcd[DP_RECEIVER_CAP_SIZE];
>  	uint8_t psr_dpcd[EDP_PSR_RECEIVER_CAP_SIZE];
>  	uint8_t downstream_ports[DP_MAX_DOWNSTREAM_PORTS];
> @@ -1213,6 +1212,8 @@ struct intel_digital_port {
>  	enum irqreturn (*hpd_pulse)(struct intel_digital_port *, bool);
>  	bool release_cl2_override;
>  	uint8_t max_lanes;
> +	/* Used for DP and ICL+ TypeC/DP and TypeC/HDMI ports. */
> +	enum aux_ch aux_ch;
>  	enum intel_display_power_domain ddi_io_power_domain;
>  	enum tc_port_type tc_type;
>  


More information about the Intel-gfx mailing list