diff mbox series

[v4,2/2] drm/i915/display: Use struct intel_display instead of struct drm_i915_private

Message ID 20241101133924.245817-3-mika.kahola@intel.com (mailing list archive)
State New
Headers show
Series drm/i915/display: Power request asserting/deasserting | expand

Commit Message

Mika Kahola Nov. 1, 2024, 1:39 p.m. UTC
Let's start using struct intel_display instead of struct drm_i915_private
when introducing new code. No functional changes.

Signed-off-by: Mika Kahola <mika.kahola@intel.com>
---
 drivers/gpu/drm/i915/display/intel_tc.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

Comments

Jani Nikula Nov. 4, 2024, 10:32 a.m. UTC | #1
On Fri, 01 Nov 2024, Mika Kahola <mika.kahola@intel.com> wrote:
> Let's start using struct intel_display instead of struct drm_i915_private
> when introducing new code. No functional changes.
>
> Signed-off-by: Mika Kahola <mika.kahola@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_tc.c | 17 +++++++++++------
>  1 file changed, 11 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_tc.c b/drivers/gpu/drm/i915/display/intel_tc.c
> index e40d55f4c0c4..385c838ee996 100644
> --- a/drivers/gpu/drm/i915/display/intel_tc.c
> +++ b/drivers/gpu/drm/i915/display/intel_tc.c
> @@ -97,6 +97,11 @@ static struct drm_i915_private *tc_to_i915(struct intel_tc_port *tc)
>  	return to_i915(tc->dig_port->base.base.dev);
>  }
>  
> +static struct intel_display *tc_to_intel_display(struct intel_tc_port *tc)
> +{
> +	return to_intel_display(tc->dig_port->base.base.dev);
> +}
> +

to_intel_display(tc->dig_port) is sufficient here.

And that begs the question, do we need the helper? Maybe just use that
directly inline?

BR,
Jani.


>  static bool intel_tc_port_in_mode(struct intel_digital_port *dig_port,
>  				  enum tc_port_mode mode)
>  {
> @@ -1039,9 +1044,9 @@ static void wa_14020908590(struct intel_display *display, bool enable)
>  
>  static void __xelpdp_tc_phy_enable_tcss_power(struct intel_tc_port *tc, bool enable)
>  {
> -	struct drm_i915_private *i915 = tc_to_i915(tc);
> +	struct intel_display *display = tc_to_intel_display(tc);
>  	enum port port = tc->dig_port->base.port;
> -	i915_reg_t reg = XELPDP_PORT_BUF_CTL1(i915, port);
> +	i915_reg_t reg = XELPDP_PORT_BUF_CTL1(display, port);
>  	u32 val;
>  
>  	assert_tc_cold_blocked(tc);
> @@ -1050,15 +1055,15 @@ static void __xelpdp_tc_phy_enable_tcss_power(struct intel_tc_port *tc, bool ena
>  	 * Gfx driver WA 14020908590 for PTL tcss_rxdetect_clkswb_req/ack
>  	 * handshake violation when pwwreq= 0->1 during TC7/10 entry
>  	 */
> -	if (DISPLAY_VER(i915) == 30)
> -		wa_14020908590(&i915->display, enable);
> +	if (DISPLAY_VER(display) == 30)
> +		wa_14020908590(display, enable);
>  
> -	val = intel_de_read(i915, reg);
> +	val = intel_de_read(display, reg);
>  	if (enable)
>  		val |= XELPDP_TCSS_POWER_REQUEST;
>  	else
>  		val &= ~XELPDP_TCSS_POWER_REQUEST;
> -	intel_de_write(i915, reg, val);
> +	intel_de_write(display, reg, val);
>  }
>  
>  static bool xelpdp_tc_phy_enable_tcss_power(struct intel_tc_port *tc, bool enable)
Mika Kahola Nov. 4, 2024, 12:44 p.m. UTC | #2
> -----Original Message-----
> From: Jani Nikula <jani.nikula@linux.intel.com>
> Sent: Monday, 4 November 2024 12.33
> To: Kahola, Mika <mika.kahola@intel.com>; intel-gfx@lists.freedesktop.org
> Cc: Sousa, Gustavo <gustavo.sousa@intel.com>; Jadav, Raag
> <raag.jadav@intel.com>; Kahola, Mika <mika.kahola@intel.com>
> Subject: Re: [PATCH v4 2/2] drm/i915/display: Use struct intel_display instead of
> struct drm_i915_private
> 
> On Fri, 01 Nov 2024, Mika Kahola <mika.kahola@intel.com> wrote:
> > Let's start using struct intel_display instead of struct
> > drm_i915_private when introducing new code. No functional changes.
> >
> > Signed-off-by: Mika Kahola <mika.kahola@intel.com>
> > ---
> >  drivers/gpu/drm/i915/display/intel_tc.c | 17 +++++++++++------
> >  1 file changed, 11 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/display/intel_tc.c
> > b/drivers/gpu/drm/i915/display/intel_tc.c
> > index e40d55f4c0c4..385c838ee996 100644
> > --- a/drivers/gpu/drm/i915/display/intel_tc.c
> > +++ b/drivers/gpu/drm/i915/display/intel_tc.c
> > @@ -97,6 +97,11 @@ static struct drm_i915_private *tc_to_i915(struct
> intel_tc_port *tc)
> >  	return to_i915(tc->dig_port->base.base.dev);
> >  }
> >
> > +static struct intel_display *tc_to_intel_display(struct intel_tc_port
> > +*tc) {
> > +	return to_intel_display(tc->dig_port->base.base.dev);
> > +}
> > +
> 
> to_intel_display(tc->dig_port) is sufficient here.
> 
> And that begs the question, do we need the helper? Maybe just use that directly
> inline?
> 

We have this helper for tc_to_i915() so I thought why not for tc_to_intel_display().

Since the helper really is only one liner, I can drop.

Thanks!
Mika  

> BR,
> Jani.
> 
> 
> >  static bool intel_tc_port_in_mode(struct intel_digital_port *dig_port,
> >  				  enum tc_port_mode mode)
> >  {
> > @@ -1039,9 +1044,9 @@ static void wa_14020908590(struct intel_display
> > *display, bool enable)
> >
> >  static void __xelpdp_tc_phy_enable_tcss_power(struct intel_tc_port
> > *tc, bool enable)  {
> > -	struct drm_i915_private *i915 = tc_to_i915(tc);
> > +	struct intel_display *display = tc_to_intel_display(tc);
> >  	enum port port = tc->dig_port->base.port;
> > -	i915_reg_t reg = XELPDP_PORT_BUF_CTL1(i915, port);
> > +	i915_reg_t reg = XELPDP_PORT_BUF_CTL1(display, port);
> >  	u32 val;
> >
> >  	assert_tc_cold_blocked(tc);
> > @@ -1050,15 +1055,15 @@ static void
> __xelpdp_tc_phy_enable_tcss_power(struct intel_tc_port *tc, bool ena
> >  	 * Gfx driver WA 14020908590 for PTL tcss_rxdetect_clkswb_req/ack
> >  	 * handshake violation when pwwreq= 0->1 during TC7/10 entry
> >  	 */
> > -	if (DISPLAY_VER(i915) == 30)
> > -		wa_14020908590(&i915->display, enable);
> > +	if (DISPLAY_VER(display) == 30)
> > +		wa_14020908590(display, enable);
> >
> > -	val = intel_de_read(i915, reg);
> > +	val = intel_de_read(display, reg);
> >  	if (enable)
> >  		val |= XELPDP_TCSS_POWER_REQUEST;
> >  	else
> >  		val &= ~XELPDP_TCSS_POWER_REQUEST;
> > -	intel_de_write(i915, reg, val);
> > +	intel_de_write(display, reg, val);
> >  }
> >
> >  static bool xelpdp_tc_phy_enable_tcss_power(struct intel_tc_port *tc,
> > bool enable)
> 
> --
> Jani Nikula, Intel
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_tc.c b/drivers/gpu/drm/i915/display/intel_tc.c
index e40d55f4c0c4..385c838ee996 100644
--- a/drivers/gpu/drm/i915/display/intel_tc.c
+++ b/drivers/gpu/drm/i915/display/intel_tc.c
@@ -97,6 +97,11 @@  static struct drm_i915_private *tc_to_i915(struct intel_tc_port *tc)
 	return to_i915(tc->dig_port->base.base.dev);
 }
 
+static struct intel_display *tc_to_intel_display(struct intel_tc_port *tc)
+{
+	return to_intel_display(tc->dig_port->base.base.dev);
+}
+
 static bool intel_tc_port_in_mode(struct intel_digital_port *dig_port,
 				  enum tc_port_mode mode)
 {
@@ -1039,9 +1044,9 @@  static void wa_14020908590(struct intel_display *display, bool enable)
 
 static void __xelpdp_tc_phy_enable_tcss_power(struct intel_tc_port *tc, bool enable)
 {
-	struct drm_i915_private *i915 = tc_to_i915(tc);
+	struct intel_display *display = tc_to_intel_display(tc);
 	enum port port = tc->dig_port->base.port;
-	i915_reg_t reg = XELPDP_PORT_BUF_CTL1(i915, port);
+	i915_reg_t reg = XELPDP_PORT_BUF_CTL1(display, port);
 	u32 val;
 
 	assert_tc_cold_blocked(tc);
@@ -1050,15 +1055,15 @@  static void __xelpdp_tc_phy_enable_tcss_power(struct intel_tc_port *tc, bool ena
 	 * Gfx driver WA 14020908590 for PTL tcss_rxdetect_clkswb_req/ack
 	 * handshake violation when pwwreq= 0->1 during TC7/10 entry
 	 */
-	if (DISPLAY_VER(i915) == 30)
-		wa_14020908590(&i915->display, enable);
+	if (DISPLAY_VER(display) == 30)
+		wa_14020908590(display, enable);
 
-	val = intel_de_read(i915, reg);
+	val = intel_de_read(display, reg);
 	if (enable)
 		val |= XELPDP_TCSS_POWER_REQUEST;
 	else
 		val &= ~XELPDP_TCSS_POWER_REQUEST;
-	intel_de_write(i915, reg, val);
+	intel_de_write(display, reg, val);
 }
 
 static bool xelpdp_tc_phy_enable_tcss_power(struct intel_tc_port *tc, bool enable)