All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Souza, Jose" <jose.souza@intel.com>
To: "intel-gfx@lists.freedesktop.org"
	<intel-gfx@lists.freedesktop.org>,
	"Deak, Imre" <imre.deak@intel.com>
Cc: "Zanoni, Paulo R" <paulo.r.zanoni@intel.com>
Subject: Re: [PATCH 7/8] drm/i915: Configure AUX_CH_CTL when enabling the AUX power domain
Date: Tue, 30 Oct 2018 23:28:07 +0000	[thread overview]
Message-ID: <8867436b16165d420512318a1702b2eaae7c625a.camel@intel.com> (raw)
In-Reply-To: <20181030154051.30851-8-imre.deak@intel.com>

On Tue, 2018-10-30 at 17:40 +0200, Imre Deak wrote:
> Most of the AUX_CH_CTL flags are concerned with DP AUX transfer
> parameters. As opposed to this the flag specifying the thunderbolt
> vs.
> non-thunderbolt mode of the port is not related to AUX transfers at
> all
> (rather it's repurposed to enable either TBT or non-TBT PHY HW
> blocks).
> The programming has to be done before enabling the corresponding AUX
> power well, so make it part of the power well code.
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108548
> Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>

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

If respinning this patch please consider the comments bellow but nice
catch.

> Signed-off-by: Imre Deak <imre.deak@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_drv.h         |  1 +
>  drivers/gpu/drm/i915/intel_runtime_pm.c | 69
> +++++++++++++++++++++++++++++----
>  2 files changed, 62 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.h
> b/drivers/gpu/drm/i915/i915_drv.h
> index c57b701f72a7..dbf894835cb2 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -921,6 +921,7 @@ struct i915_power_well_desc {
>  			/* The pw is backing the VGA functionality */
>  			bool has_vga:1;
>  			bool has_fuses:1;
> +			bool is_tc_tbt;
>  		} hsw;
>  	};
>  	const struct i915_power_well_ops *ops;
> diff --git a/drivers/gpu/drm/i915/intel_runtime_pm.c
> b/drivers/gpu/drm/i915/intel_runtime_pm.c
> index 5f5416eb9644..eed17440a4a7 100644
> --- a/drivers/gpu/drm/i915/intel_runtime_pm.c
> +++ b/drivers/gpu/drm/i915/intel_runtime_pm.c
> @@ -465,6 +465,44 @@ icl_combo_phy_aux_power_well_disable(struct
> drm_i915_private *dev_priv,
>  	hsw_wait_for_power_well_disable(dev_priv, power_well);
>  }
>  
> +#define ICL_AUX_PW_TO_CH(pw_idx)	\
> +	((pw_idx) - ICL_PW_CTL_IDX_AUX_A + AUX_CH_A)
> +
> +static void
> +icl_tc_phy_aux_power_well_enable(struct drm_i915_private *dev_priv,
> +				 struct i915_power_well *power_well)
> +{
> +	const struct i915_power_well_regs *regs = power_well->desc-
> >hsw.regs;
> +	int pw_idx = power_well->desc->hsw.idx;
> +	enum aux_ch aux_ch = ICL_AUX_PW_TO_CH(pw_idx);
> +	u32 val;
> +
> +	val = I915_READ(DP_AUX_CH_CTL(aux_ch));
> +	val &= ~DP_AUX_CH_CTL_TBT_IO;
> +	if (power_well->desc->hsw.is_tc_tbt)
> +		val |= DP_AUX_CH_CTL_TBT_IO;
> +	I915_WRITE(DP_AUX_CH_CTL(aux_ch), val);
> +
> +	val = I915_READ(regs->driver);
> +	I915_WRITE(regs->driver, val | HSW_PWR_WELL_CTL_REQ(pw_idx));
> +
> +	hsw_wait_for_power_well_enable(dev_priv, power_well);

Minor but you could call hsw_power_well_enable() after write to
DP_AUX_CH_CTL instead of duplicate code.
 
> +}
> +
> +static void
> +icl_tc_phy_aux_power_well_disable(struct drm_i915_private *dev_priv,
> +				  struct i915_power_well *power_well)
> +{
> +	const struct i915_power_well_regs *regs = power_well->desc-
> >hsw.regs;
> +	int pw_idx = power_well->desc->hsw.idx;
> +	u32 val;
> +
> +	val = I915_READ(regs->driver);
> +	I915_WRITE(regs->driver, val & ~HSW_PWR_WELL_CTL_REQ(pw_idx));
> +
> +	hsw_wait_for_power_well_disable(dev_priv, power_well);
> +}

Minor too you could use the hsw_power_well_disable() instead of
duplicate code.

> +
>  /*
>   * We should only use the power well if we explicitly asked the
> hardware to
>   * enable it, so check if it's enabled and also check if we've
> requested it to
> @@ -2725,6 +2763,13 @@ static const struct i915_power_well_ops
> icl_combo_phy_aux_power_well_ops = {
>  	.is_enabled = hsw_power_well_enabled,
>  };
>  
> +static const struct i915_power_well_ops
> icl_tc_phy_aux_power_well_ops = {
> +	.sync_hw = hsw_power_well_sync_hw,
> +	.enable = icl_tc_phy_aux_power_well_enable,
> +	.disable = icl_tc_phy_aux_power_well_disable,
> +	.is_enabled = hsw_power_well_enabled,
> +};
> +
>  static const struct i915_power_well_regs icl_aux_power_well_regs = {
>  	.bios	= ICL_PWR_WELL_CTL_AUX1,
>  	.driver	= ICL_PWR_WELL_CTL_AUX2,
> @@ -2870,81 +2915,89 @@ static const struct i915_power_well_desc
> icl_power_wells[] = {
>  	{
>  		.name = "AUX C",
>  		.domains = ICL_AUX_C_IO_POWER_DOMAINS,
> -		.ops = &hsw_power_well_ops,
> +		.ops = &icl_tc_phy_aux_power_well_ops,
>  		.id = DISP_PW_ID_NONE,
>  		{
>  			.hsw.regs = &icl_aux_power_well_regs,
>  			.hsw.idx = ICL_PW_CTL_IDX_AUX_C,
> +			.hsw.is_tc_tbt = false,
>  		},
>  	},
>  	{
>  		.name = "AUX D",
>  		.domains = ICL_AUX_D_IO_POWER_DOMAINS,
> -		.ops = &hsw_power_well_ops,
> +		.ops = &icl_tc_phy_aux_power_well_ops,
>  		.id = DISP_PW_ID_NONE,
>  		{
>  			.hsw.regs = &icl_aux_power_well_regs,
>  			.hsw.idx = ICL_PW_CTL_IDX_AUX_D,
> +			.hsw.is_tc_tbt = false,
>  		},
>  	},
>  	{
>  		.name = "AUX E",
>  		.domains = ICL_AUX_E_IO_POWER_DOMAINS,
> -		.ops = &hsw_power_well_ops,
> +		.ops = &icl_tc_phy_aux_power_well_ops,
>  		.id = DISP_PW_ID_NONE,
>  		{
>  			.hsw.regs = &icl_aux_power_well_regs,
>  			.hsw.idx = ICL_PW_CTL_IDX_AUX_E,
> +			.hsw.is_tc_tbt = false,
>  		},
>  	},
>  	{
>  		.name = "AUX F",
>  		.domains = ICL_AUX_F_IO_POWER_DOMAINS,
> -		.ops = &hsw_power_well_ops,
> +		.ops = &icl_tc_phy_aux_power_well_ops,
>  		.id = DISP_PW_ID_NONE,
>  		{
>  			.hsw.regs = &icl_aux_power_well_regs,
>  			.hsw.idx = ICL_PW_CTL_IDX_AUX_F,
> +			.hsw.is_tc_tbt = false,
>  		},
>  	},
>  	{
>  		.name = "AUX TBT1",
>  		.domains = ICL_AUX_TBT1_IO_POWER_DOMAINS,
> -		.ops = &hsw_power_well_ops,
> +		.ops = &icl_tc_phy_aux_power_well_ops,
>  		.id = DISP_PW_ID_NONE,
>  		{
>  			.hsw.regs = &icl_aux_power_well_regs,
>  			.hsw.idx = ICL_PW_CTL_IDX_AUX_TBT1,
> +			.hsw.is_tc_tbt = true,
>  		},
>  	},
>  	{
>  		.name = "AUX TBT2",
>  		.domains = ICL_AUX_TBT2_IO_POWER_DOMAINS,
> -		.ops = &hsw_power_well_ops,
> +		.ops = &icl_tc_phy_aux_power_well_ops,
>  		.id = DISP_PW_ID_NONE,
>  		{
>  			.hsw.regs = &icl_aux_power_well_regs,
>  			.hsw.idx = ICL_PW_CTL_IDX_AUX_TBT2,
> +			.hsw.is_tc_tbt = true,
>  		},
>  	},
>  	{
>  		.name = "AUX TBT3",
>  		.domains = ICL_AUX_TBT3_IO_POWER_DOMAINS,
> -		.ops = &hsw_power_well_ops,
> +		.ops = &icl_tc_phy_aux_power_well_ops,
>  		.id = DISP_PW_ID_NONE,
>  		{
>  			.hsw.regs = &icl_aux_power_well_regs,
>  			.hsw.idx = ICL_PW_CTL_IDX_AUX_TBT3,
> +			.hsw.is_tc_tbt = true,
>  		},
>  	},
>  	{
>  		.name = "AUX TBT4",
>  		.domains = ICL_AUX_TBT4_IO_POWER_DOMAINS,
> -		.ops = &hsw_power_well_ops,
> +		.ops = &icl_tc_phy_aux_power_well_ops,
>  		.id = DISP_PW_ID_NONE,
>  		{
>  			.hsw.regs = &icl_aux_power_well_regs,
>  			.hsw.idx = ICL_PW_CTL_IDX_AUX_TBT4,
> +			.hsw.is_tc_tbt = true,
>  		},
>  	},
>  	{
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2018-10-30 23:28 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-30 15:40 [PATCH 0/8] drm/i915/icl: Fix HDMI on TypeC static ports Imre Deak
2018-10-30 15:40 ` [PATCH 1/8] drm/i915: Move intel_aux_ch() to intel_bios.c Imre Deak
2018-10-30 22:36   ` Souza, Jose
2018-10-30 15:40 ` [PATCH 2/8] drm/i915: Move aux_ch to intel_digital_port Imre Deak
2018-10-30 22:36   ` Souza, Jose
2018-10-31 13:36     ` Imre Deak
2018-10-30 15:40 ` [PATCH 3/8] drm/i915: Init aux_ch for HDMI ports too Imre Deak
2018-10-30 22:32   ` Souza, Jose
2018-10-30 22:38     ` Imre Deak
2018-10-31  0:03       ` Souza, Jose
2018-10-30 15:40 ` [PATCH 4/8] drm/i915: Use a helper to get the aux power domain Imre Deak
2018-10-30 21:16   ` Lucas De Marchi
2018-10-30 21:31     ` Imre Deak
2018-10-30 15:40 ` [PATCH 5/8] drm/i915: Enable AUX power earlier Imre Deak
2018-10-30 19:05   ` [PATCH v2 " Imre Deak
2018-10-30 21:55     ` Manasi Navare
2018-10-30 22:04       ` Imre Deak
2018-10-30 23:07   ` [PATCH " Souza, Jose
2018-10-30 23:12     ` Imre Deak
2018-10-30 23:18       ` Souza, Jose
2018-10-30 23:28         ` Imre Deak
2018-10-30 23:52           ` Souza, Jose
2018-10-31  0:04             ` Imre Deak
2018-10-31  0:17               ` Souza, Jose
2018-10-31  0:33                 ` Imre Deak
2018-10-31  0:40                   ` Souza, Jose
2018-10-30 15:40 ` [PATCH 6/8] drm/i915: Enable AUX power for HDMI DDI/TypeC main link too Imre Deak
2018-10-30 23:08   ` Souza, Jose
2018-10-30 15:40 ` [PATCH 7/8] drm/i915: Configure AUX_CH_CTL when enabling the AUX power domain Imre Deak
2018-10-30 21:57   ` Lucas De Marchi
2018-10-31 13:30     ` Imre Deak
2018-10-30 23:28   ` Souza, Jose [this message]
2018-10-31 13:34     ` Imre Deak
2018-10-30 15:40 ` [PATCH 8/8] drm/i915/icl+: Sanitize port to PLL mapping Imre Deak
2018-10-30 23:57   ` Souza, Jose
2018-10-30 16:09 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915/icl: Fix HDMI on TypeC static ports Patchwork
2018-10-30 16:13 ` ✗ Fi.CI.SPARSE: " Patchwork
2018-10-30 16:28 ` ✗ Fi.CI.BAT: failure " Patchwork
2018-10-30 19:32 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915/icl: Fix HDMI on TypeC static ports (rev2) Patchwork
2018-10-30 19:35 ` ✗ Fi.CI.SPARSE: " Patchwork
2018-10-30 19:50 ` ✓ Fi.CI.BAT: success " Patchwork
2018-10-31  0:36 ` ✓ Fi.CI.IGT: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8867436b16165d420512318a1702b2eaae7c625a.camel@intel.com \
    --to=jose.souza@intel.com \
    --cc=imre.deak@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=paulo.r.zanoni@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.