diff mbox series

[1/4] drm/i915/dsi/xelpd: Fix the bit mask for wakeup GB

Message ID 20211018065207.30587-2-vandita.kulkarni@intel.com (mailing list archive)
State New, archived
Headers show
Series Enable MIPI DSI video mode on ADLP | expand

Commit Message

Kulkarni, Vandita Oct. 18, 2021, 6:52 a.m. UTC
Fixes: f87c46c43175 ("drm/i915/dsi/xelpd: Add WA to program LP to HS wakeup guardband")
Signed-off-by: Vandita Kulkarni <vandita.kulkarni@intel.com>
---
 drivers/gpu/drm/i915/display/icl_dsi.c | 2 +-
 drivers/gpu/drm/i915/i915_reg.h        | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

Comments

Jani Nikula Oct. 19, 2021, 10:05 a.m. UTC | #1
On Mon, 18 Oct 2021, Vandita Kulkarni <vandita.kulkarni@intel.com> wrote:

Commit message goes here.

> Fixes: f87c46c43175 ("drm/i915/dsi/xelpd: Add WA to program LP to HS wakeup guardband")
> Signed-off-by: Vandita Kulkarni <vandita.kulkarni@intel.com>
> ---
>  drivers/gpu/drm/i915/display/icl_dsi.c | 2 +-
>  drivers/gpu/drm/i915/i915_reg.h        | 3 ++-
>  2 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/icl_dsi.c b/drivers/gpu/drm/i915/display/icl_dsi.c
> index 9ee62707ec72..8c166f92f8bd 100644
> --- a/drivers/gpu/drm/i915/display/icl_dsi.c
> +++ b/drivers/gpu/drm/i915/display/icl_dsi.c
> @@ -1271,7 +1271,7 @@ static void adlp_set_lp_hs_wakeup_gb(struct intel_encoder *encoder)
>  	if (DISPLAY_VER(i915) == 13) {
>  		for_each_dsi_port(port, intel_dsi->ports)
>  			intel_de_rmw(i915, TGL_DSI_CHKN_REG(port),
> -				     TGL_DSI_CHKN_LSHS_GB, 0x4);
> +				     TGL_DSI_CHKN_LSHS_GB_MASK, TGL_DSI_CHKN_LSHS_GB_MASK);

I think you mean the value should be TGL_DSI_CHKN_LSHS_GB.

BR,
Jani.

>  	}
>  }
>  
> diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> index a897f4abea0c..e4b1f80ca5eb 100644
> --- a/drivers/gpu/drm/i915/i915_reg.h
> +++ b/drivers/gpu/drm/i915/i915_reg.h
> @@ -11728,7 +11728,8 @@ enum skl_power_gate {
>  #define TGL_DSI_CHKN_REG(port)		_MMIO_PORT(port,	\
>  						    _TGL_DSI_CHKN_REG_0, \
>  						    _TGL_DSI_CHKN_REG_1)
> -#define TGL_DSI_CHKN_LSHS_GB			REG_GENMASK(15, 12)
> +#define TGL_DSI_CHKN_LSHS_GB_MASK		REG_GENMASK(15, 12)
> +#define TGL_DSI_CHKN_LSHS_GB			REG_FIELD_PREP(TGL_DSI_CHKN_LSHS_GB_MASK, 4)
>  
>  /* Display Stream Splitter Control */
>  #define DSS_CTL1				_MMIO(0x67400)
Ville Syrjala Oct. 19, 2021, 10:15 a.m. UTC | #2
On Tue, Oct 19, 2021 at 01:05:20PM +0300, Jani Nikula wrote:
> On Mon, 18 Oct 2021, Vandita Kulkarni <vandita.kulkarni@intel.com> wrote:
> 
> Commit message goes here.
> 
> > Fixes: f87c46c43175 ("drm/i915/dsi/xelpd: Add WA to program LP to HS wakeup guardband")
> > Signed-off-by: Vandita Kulkarni <vandita.kulkarni@intel.com>
> > ---
> >  drivers/gpu/drm/i915/display/icl_dsi.c | 2 +-
> >  drivers/gpu/drm/i915/i915_reg.h        | 3 ++-
> >  2 files changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/display/icl_dsi.c b/drivers/gpu/drm/i915/display/icl_dsi.c
> > index 9ee62707ec72..8c166f92f8bd 100644
> > --- a/drivers/gpu/drm/i915/display/icl_dsi.c
> > +++ b/drivers/gpu/drm/i915/display/icl_dsi.c
> > @@ -1271,7 +1271,7 @@ static void adlp_set_lp_hs_wakeup_gb(struct intel_encoder *encoder)
> >  	if (DISPLAY_VER(i915) == 13) {
> >  		for_each_dsi_port(port, intel_dsi->ports)
> >  			intel_de_rmw(i915, TGL_DSI_CHKN_REG(port),
> > -				     TGL_DSI_CHKN_LSHS_GB, 0x4);
> > +				     TGL_DSI_CHKN_LSHS_GB_MASK, TGL_DSI_CHKN_LSHS_GB_MASK);
> 
> I think you mean the value should be TGL_DSI_CHKN_LSHS_GB.

IMO the value should never be named that. It should be
TGL_DSI_CHKN_LSHS_GB_<something>.
Jani Nikula Oct. 19, 2021, 10:28 a.m. UTC | #3
On Tue, 19 Oct 2021, Ville Syrjälä <ville.syrjala@linux.intel.com> wrote:
> On Tue, Oct 19, 2021 at 01:05:20PM +0300, Jani Nikula wrote:
>> On Mon, 18 Oct 2021, Vandita Kulkarni <vandita.kulkarni@intel.com> wrote:
>> 
>> Commit message goes here.
>> 
>> > Fixes: f87c46c43175 ("drm/i915/dsi/xelpd: Add WA to program LP to HS wakeup guardband")
>> > Signed-off-by: Vandita Kulkarni <vandita.kulkarni@intel.com>
>> > ---
>> >  drivers/gpu/drm/i915/display/icl_dsi.c | 2 +-
>> >  drivers/gpu/drm/i915/i915_reg.h        | 3 ++-
>> >  2 files changed, 3 insertions(+), 2 deletions(-)
>> >
>> > diff --git a/drivers/gpu/drm/i915/display/icl_dsi.c b/drivers/gpu/drm/i915/display/icl_dsi.c
>> > index 9ee62707ec72..8c166f92f8bd 100644
>> > --- a/drivers/gpu/drm/i915/display/icl_dsi.c
>> > +++ b/drivers/gpu/drm/i915/display/icl_dsi.c
>> > @@ -1271,7 +1271,7 @@ static void adlp_set_lp_hs_wakeup_gb(struct intel_encoder *encoder)
>> >  	if (DISPLAY_VER(i915) == 13) {
>> >  		for_each_dsi_port(port, intel_dsi->ports)
>> >  			intel_de_rmw(i915, TGL_DSI_CHKN_REG(port),
>> > -				     TGL_DSI_CHKN_LSHS_GB, 0x4);
>> > +				     TGL_DSI_CHKN_LSHS_GB_MASK, TGL_DSI_CHKN_LSHS_GB_MASK);
>> 
>> I think you mean the value should be TGL_DSI_CHKN_LSHS_GB.
>
> IMO the value should never be named that. It should be
> TGL_DSI_CHKN_LSHS_GB_<something>.

Alternatively,

#define TGL_DSI_CHKN_LSHS_GB(byte_clocks)		REG_FIELD_PREP(TGL_DSI_CHKN_LSHS_GB_MASK, (byte_clocks))

and

intel_de_rmw(i915, TGL_DSI_CHKN_REG(port),
	     TGL_DSI_CHKN_LSHS_GB_MASK, TGL_DSI_CHKN_LSHS_GB(4));

?

We're using the value in a specific place that references a w/a, so the
magic 4 isn't too bad.

BR,
Jani.
Ville Syrjala Oct. 19, 2021, 10:41 a.m. UTC | #4
On Tue, Oct 19, 2021 at 01:28:10PM +0300, Jani Nikula wrote:
> On Tue, 19 Oct 2021, Ville Syrjälä <ville.syrjala@linux.intel.com> wrote:
> > On Tue, Oct 19, 2021 at 01:05:20PM +0300, Jani Nikula wrote:
> >> On Mon, 18 Oct 2021, Vandita Kulkarni <vandita.kulkarni@intel.com> wrote:
> >> 
> >> Commit message goes here.
> >> 
> >> > Fixes: f87c46c43175 ("drm/i915/dsi/xelpd: Add WA to program LP to HS wakeup guardband")
> >> > Signed-off-by: Vandita Kulkarni <vandita.kulkarni@intel.com>
> >> > ---
> >> >  drivers/gpu/drm/i915/display/icl_dsi.c | 2 +-
> >> >  drivers/gpu/drm/i915/i915_reg.h        | 3 ++-
> >> >  2 files changed, 3 insertions(+), 2 deletions(-)
> >> >
> >> > diff --git a/drivers/gpu/drm/i915/display/icl_dsi.c b/drivers/gpu/drm/i915/display/icl_dsi.c
> >> > index 9ee62707ec72..8c166f92f8bd 100644
> >> > --- a/drivers/gpu/drm/i915/display/icl_dsi.c
> >> > +++ b/drivers/gpu/drm/i915/display/icl_dsi.c
> >> > @@ -1271,7 +1271,7 @@ static void adlp_set_lp_hs_wakeup_gb(struct intel_encoder *encoder)
> >> >  	if (DISPLAY_VER(i915) == 13) {
> >> >  		for_each_dsi_port(port, intel_dsi->ports)
> >> >  			intel_de_rmw(i915, TGL_DSI_CHKN_REG(port),
> >> > -				     TGL_DSI_CHKN_LSHS_GB, 0x4);
> >> > +				     TGL_DSI_CHKN_LSHS_GB_MASK, TGL_DSI_CHKN_LSHS_GB_MASK);
> >> 
> >> I think you mean the value should be TGL_DSI_CHKN_LSHS_GB.
> >
> > IMO the value should never be named that. It should be
> > TGL_DSI_CHKN_LSHS_GB_<something>.
> 
> Alternatively,
> 
> #define TGL_DSI_CHKN_LSHS_GB(byte_clocks)		REG_FIELD_PREP(TGL_DSI_CHKN_LSHS_GB_MASK, (byte_clocks))
> 
> and
> 
> intel_de_rmw(i915, TGL_DSI_CHKN_REG(port),
> 	     TGL_DSI_CHKN_LSHS_GB_MASK, TGL_DSI_CHKN_LSHS_GB(4));
> 
> ?
> 
> We're using the value in a specific place that references a w/a, so the
> magic 4 isn't too bad.

Yeah, for parametrized defines I think the "_<something>" is
not needed. Probably not even desired. The argument passed in
is the "_<something>" essentially.
Ville Syrjala Oct. 19, 2021, 10:50 a.m. UTC | #5
On Tue, Oct 19, 2021 at 01:41:50PM +0300, Ville Syrjälä wrote:
> On Tue, Oct 19, 2021 at 01:28:10PM +0300, Jani Nikula wrote:
> > On Tue, 19 Oct 2021, Ville Syrjälä <ville.syrjala@linux.intel.com> wrote:
> > > On Tue, Oct 19, 2021 at 01:05:20PM +0300, Jani Nikula wrote:
> > >> On Mon, 18 Oct 2021, Vandita Kulkarni <vandita.kulkarni@intel.com> wrote:
> > >> 
> > >> Commit message goes here.
> > >> 
> > >> > Fixes: f87c46c43175 ("drm/i915/dsi/xelpd: Add WA to program LP to HS wakeup guardband")
> > >> > Signed-off-by: Vandita Kulkarni <vandita.kulkarni@intel.com>
> > >> > ---
> > >> >  drivers/gpu/drm/i915/display/icl_dsi.c | 2 +-
> > >> >  drivers/gpu/drm/i915/i915_reg.h        | 3 ++-
> > >> >  2 files changed, 3 insertions(+), 2 deletions(-)
> > >> >
> > >> > diff --git a/drivers/gpu/drm/i915/display/icl_dsi.c b/drivers/gpu/drm/i915/display/icl_dsi.c
> > >> > index 9ee62707ec72..8c166f92f8bd 100644
> > >> > --- a/drivers/gpu/drm/i915/display/icl_dsi.c
> > >> > +++ b/drivers/gpu/drm/i915/display/icl_dsi.c
> > >> > @@ -1271,7 +1271,7 @@ static void adlp_set_lp_hs_wakeup_gb(struct intel_encoder *encoder)
> > >> >  	if (DISPLAY_VER(i915) == 13) {
> > >> >  		for_each_dsi_port(port, intel_dsi->ports)
> > >> >  			intel_de_rmw(i915, TGL_DSI_CHKN_REG(port),
> > >> > -				     TGL_DSI_CHKN_LSHS_GB, 0x4);
> > >> > +				     TGL_DSI_CHKN_LSHS_GB_MASK, TGL_DSI_CHKN_LSHS_GB_MASK);
> > >> 
> > >> I think you mean the value should be TGL_DSI_CHKN_LSHS_GB.
> > >
> > > IMO the value should never be named that. It should be
> > > TGL_DSI_CHKN_LSHS_GB_<something>.
> > 
> > Alternatively,
> > 
> > #define TGL_DSI_CHKN_LSHS_GB(byte_clocks)		REG_FIELD_PREP(TGL_DSI_CHKN_LSHS_GB_MASK, (byte_clocks))
> > 
> > and
> > 
> > intel_de_rmw(i915, TGL_DSI_CHKN_REG(port),
> > 	     TGL_DSI_CHKN_LSHS_GB_MASK, TGL_DSI_CHKN_LSHS_GB(4));
> > 
> > ?
> > 
> > We're using the value in a specific place that references a w/a, so the
> > magic 4 isn't too bad.
> 
> Yeah, for parametrized defines I think the "_<something>" is
> not needed. Probably not even desired. The argument passed in
> is the "_<something>" essentially.

Oh and, yes, I think having the magic number in the code is fine
for cases like this. I'd say I probably even prefer it that way.
As long as the whole register value isn't a single magic hex constant
that I have to decode by hand to see what bitfields are getting what
values.
Kulkarni, Vandita Oct. 19, 2021, 11:27 a.m. UTC | #6
> -----Original Message-----
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Sent: Tuesday, October 19, 2021 4:21 PM
> To: Nikula, Jani <jani.nikula@intel.com>
> Cc: Kulkarni, Vandita <vandita.kulkarni@intel.com>; intel-
> gfx@lists.freedesktop.org; Deak, Imre <imre.deak@intel.com>; Roper,
> Matthew D <matthew.d.roper@intel.com>
> Subject: Re: [Intel-gfx] [PATCH 1/4] drm/i915/dsi/xelpd: Fix the bit mask for
> wakeup GB
> 
> On Tue, Oct 19, 2021 at 01:41:50PM +0300, Ville Syrjälä wrote:
> > On Tue, Oct 19, 2021 at 01:28:10PM +0300, Jani Nikula wrote:
> > > On Tue, 19 Oct 2021, Ville Syrjälä <ville.syrjala@linux.intel.com> wrote:
> > > > On Tue, Oct 19, 2021 at 01:05:20PM +0300, Jani Nikula wrote:
> > > >> On Mon, 18 Oct 2021, Vandita Kulkarni <vandita.kulkarni@intel.com>
> wrote:
> > > >>
> > > >> Commit message goes here.
> > > >>
> > > >> > Fixes: f87c46c43175 ("drm/i915/dsi/xelpd: Add WA to program LP
> > > >> > to HS wakeup guardband")
> > > >> > Signed-off-by: Vandita Kulkarni <vandita.kulkarni@intel.com>
> > > >> > ---
> > > >> >  drivers/gpu/drm/i915/display/icl_dsi.c | 2 +-
> > > >> >  drivers/gpu/drm/i915/i915_reg.h        | 3 ++-
> > > >> >  2 files changed, 3 insertions(+), 2 deletions(-)
> > > >> >
> > > >> > diff --git a/drivers/gpu/drm/i915/display/icl_dsi.c
> > > >> > b/drivers/gpu/drm/i915/display/icl_dsi.c
> > > >> > index 9ee62707ec72..8c166f92f8bd 100644
> > > >> > --- a/drivers/gpu/drm/i915/display/icl_dsi.c
> > > >> > +++ b/drivers/gpu/drm/i915/display/icl_dsi.c
> > > >> > @@ -1271,7 +1271,7 @@ static void
> adlp_set_lp_hs_wakeup_gb(struct intel_encoder *encoder)
> > > >> >  	if (DISPLAY_VER(i915) == 13) {
> > > >> >  		for_each_dsi_port(port, intel_dsi->ports)
> > > >> >  			intel_de_rmw(i915,
> TGL_DSI_CHKN_REG(port),
> > > >> > -				     TGL_DSI_CHKN_LSHS_GB, 0x4);
> > > >> > +				     TGL_DSI_CHKN_LSHS_GB_MASK,
> > > >> > +TGL_DSI_CHKN_LSHS_GB_MASK);
> > > >>
> > > >> I think you mean the value should be TGL_DSI_CHKN_LSHS_GB.
Yes, my bad.
> > > >
> > > > IMO the value should never be named that. It should be
> > > > TGL_DSI_CHKN_LSHS_GB_<something>.
> > >
> > > Alternatively,
> > >
> > > #define TGL_DSI_CHKN_LSHS_GB(byte_clocks)
> 	REG_FIELD_PREP(TGL_DSI_CHKN_LSHS_GB_MASK, (byte_clocks))
> > >
> > > and
> > >
> > > intel_de_rmw(i915, TGL_DSI_CHKN_REG(port),
> > > 	     TGL_DSI_CHKN_LSHS_GB_MASK, TGL_DSI_CHKN_LSHS_GB(4));
> > >
> > > ?
> > >
> > > We're using the value in a specific place that references a w/a, so
> > > the magic 4 isn't too bad.

This seems more appropriate will make this change.
Thanks.
> >
> > Yeah, for parametrized defines I think the "_<something>" is not
> > needed. Probably not even desired. The argument passed in is the
> > "_<something>" essentially.
> 
> Oh and, yes, I think having the magic number in the code is fine for cases like
> this. I'd say I probably even prefer it that way.
> As long as the whole register value isn't a single magic hex constant that I
> have to decode by hand to see what bitfields are getting what values.

Thanks, will use the hardcoding in icl_dsi.
> 
> --
> Ville Syrjälä
> Intel
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/icl_dsi.c b/drivers/gpu/drm/i915/display/icl_dsi.c
index 9ee62707ec72..8c166f92f8bd 100644
--- a/drivers/gpu/drm/i915/display/icl_dsi.c
+++ b/drivers/gpu/drm/i915/display/icl_dsi.c
@@ -1271,7 +1271,7 @@  static void adlp_set_lp_hs_wakeup_gb(struct intel_encoder *encoder)
 	if (DISPLAY_VER(i915) == 13) {
 		for_each_dsi_port(port, intel_dsi->ports)
 			intel_de_rmw(i915, TGL_DSI_CHKN_REG(port),
-				     TGL_DSI_CHKN_LSHS_GB, 0x4);
+				     TGL_DSI_CHKN_LSHS_GB_MASK, TGL_DSI_CHKN_LSHS_GB_MASK);
 	}
 }
 
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index a897f4abea0c..e4b1f80ca5eb 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -11728,7 +11728,8 @@  enum skl_power_gate {
 #define TGL_DSI_CHKN_REG(port)		_MMIO_PORT(port,	\
 						    _TGL_DSI_CHKN_REG_0, \
 						    _TGL_DSI_CHKN_REG_1)
-#define TGL_DSI_CHKN_LSHS_GB			REG_GENMASK(15, 12)
+#define TGL_DSI_CHKN_LSHS_GB_MASK		REG_GENMASK(15, 12)
+#define TGL_DSI_CHKN_LSHS_GB			REG_FIELD_PREP(TGL_DSI_CHKN_LSHS_GB_MASK, 4)
 
 /* Display Stream Splitter Control */
 #define DSS_CTL1				_MMIO(0x67400)