Re: [Intel-gfx] [PATCH] drm/i915/display/tgl: Implement Wa_14013120569

2021-12-01 Thread Tolakanahalli Pradeep, Madhumitha
@Jani @Manasi

Bump.

On Mon, 2021-11-08 at 15:52 -0800, Navare, Manasi wrote:
> On Mon, Nov 01, 2021 at 12:25:21PM +0200, Jani Nikula wrote:
> > On Mon, 28 Jun 2021, Madhumitha Tolakanahalli Pradeep
> >  wrote:
> > > PCH display HPD IRQ is not detected with default filter value.
> > > So, PP_CONTROL is manually reprogrammed.
> > 
> > Returning to this workaround.
> > 
> > You're not supposed to enable the workaround when there's eDP
> > connected. This is also crucial in avoiding issues with eDP PPS.
> > 
> > The workaround is specific to Tiger Lake PCH, so you need to check
> > against the PCH, not the GPU.
> > 
> > Also see comments inline.
> > 
> > > 
> > > Signed-off-by: Madhumitha Tolakanahalli Pradeep
> > > 
> > > ---
> > >  .../gpu/drm/i915/display/intel_display_power.c   |  8 
> > >  drivers/gpu/drm/i915/display/intel_hotplug.c | 16
> > > 
> > >  2 files changed, 24 insertions(+)
> > > 
> > > diff --git a/drivers/gpu/drm/i915/display/intel_display_power.c
> > > b/drivers/gpu/drm/i915/display/intel_display_power.c
> > > index 285380079aab..e44323cc76f5 100644
> > > --- a/drivers/gpu/drm/i915/display/intel_display_power.c
> > > +++ b/drivers/gpu/drm/i915/display/intel_display_power.c
> > > @@ -6385,8 +6385,16 @@ static void
> > > intel_power_domains_verify_state(struct drm_i915_private *i915)
> > >  
> > >  void intel_display_power_suspend_late(struct drm_i915_private
> > > *i915)
> > >  {
> > > +    struct drm_i915_private *dev_priv = i915;
> > > +    u32 val;
> > > if (DISPLAY_VER(i915) >= 11 || IS_GEMINILAKE(i915) ||
> > >     IS_BROXTON(i915)) {
> > > +   val = intel_de_read(dev_priv, PP_CONTROL(0));
> > > +   /* Wa_14013120569:tgl */
> > > +   if (IS_TIGERLAKE(i915)) {
> > > +   val &= ~PANEL_POWER_ON;
> > > +   intel_de_write(dev_priv, PP_CONTROL(0),
> > > val);
> > > +   }
> > 
> > As José said, how do you enable the workaround after resume if
> > external
> > displays are still connected?
> > 
> > > bxt_enable_dc9(i915);
> > > /* Tweaked Wa_14010685332:icp,jsp,mcc */
> > > if (INTEL_PCH_TYPE(i915) >= PCH_ICP &&
> > > INTEL_PCH_TYPE(i915) <= PCH_MCC)
> > > diff --git a/drivers/gpu/drm/i915/display/intel_hotplug.c
> > > b/drivers/gpu/drm/i915/display/intel_hotplug.c
> > > index 47c85ac97c87..8e3f84100daf 100644
> > > --- a/drivers/gpu/drm/i915/display/intel_hotplug.c
> > > +++ b/drivers/gpu/drm/i915/display/intel_hotplug.c
> > > @@ -26,6 +26,7 @@
> > >  #include "i915_drv.h"
> > >  #include "intel_display_types.h"
> > >  #include "intel_hotplug.h"
> > > +#include "intel_de.h"
> > >  
> > >  /**
> > >   * DOC: Hotplug
> > > @@ -266,7 +267,9 @@ intel_encoder_hotplug(struct intel_encoder
> > > *encoder,
> > >   struct intel_connector *connector)
> > >  {
> > > struct drm_device *dev = connector->base.dev;
> > > +   struct drm_i915_private *dev_priv = to_i915(dev);
> > > enum drm_connector_status old_status;
> > > +   u32 val;
> > > u64 old_epoch_counter;
> > > bool ret = false;
> > >  
> > > @@ -288,6 +291,19 @@ intel_encoder_hotplug(struct intel_encoder
> > > *encoder,
> > >  
> > > drm_get_connector_status_name(connector->base.status),
> > >   old_epoch_counter,
> > >   connector->base.epoch_counter);
> > > +
> > > +   /* Wa_14013120569:tgl */
> > > +   if (IS_TIGERLAKE(dev_priv)) {
> > > +   val = intel_de_read(dev_priv,
> > > PP_CONTROL(0));
> > > +   if (connector->base.status ==
> > > connector_status_connected) {
> > > +   val |= PANEL_POWER_ON;
> > > +   intel_de_write(dev_priv,
> > > PP_CONTROL(0), val);
> > > +   }
> > > +   else if (connector->base.status ==
> > > connector_status_disconnected) {
> > > +   val &= ~PANEL_POWER_ON;
> > > +   intel_de_write(dev_priv,
> > > PP_CONTROL(0), val);
> > > +   }
> > > +   }
> > 
> > First off, usually if you have a clean, generic, high level
> > function,
> > it's a hint you shouldn't stick low level register access there.
> > 
> > If you plug in two external displays and then unplug one of them,
> > you
> > end up disabling the workaround, while it's supposed to remain
> > enabled
> > if there's an external display connected. This is likely the most
> > annoying part about the workaround.
> > 
> > This does not seem like a trivial workaround to implement.
> > 
> 
> Yes I agree, not a trivial W/A to implement. I think few main things
> to figure out:
> - Right place to enable/disable the W/A at connect/disconnect and for
> the connectors already connected on boot - Probably in
> 

Re: [Intel-gfx] [PATCH] drm/i915/display/tgl: Implement Wa_14013120569

2021-11-08 Thread Navare, Manasi
On Mon, Nov 01, 2021 at 12:25:21PM +0200, Jani Nikula wrote:
> On Mon, 28 Jun 2021, Madhumitha Tolakanahalli Pradeep 
>  wrote:
> > PCH display HPD IRQ is not detected with default filter value.
> > So, PP_CONTROL is manually reprogrammed.
> 
> Returning to this workaround.
> 
> You're not supposed to enable the workaround when there's eDP
> connected. This is also crucial in avoiding issues with eDP PPS.
> 
> The workaround is specific to Tiger Lake PCH, so you need to check
> against the PCH, not the GPU.
> 
> Also see comments inline.
> 
> >
> > Signed-off-by: Madhumitha Tolakanahalli Pradeep 
> > 
> > ---
> >  .../gpu/drm/i915/display/intel_display_power.c   |  8 
> >  drivers/gpu/drm/i915/display/intel_hotplug.c | 16 
> >  2 files changed, 24 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/i915/display/intel_display_power.c 
> > b/drivers/gpu/drm/i915/display/intel_display_power.c
> > index 285380079aab..e44323cc76f5 100644
> > --- a/drivers/gpu/drm/i915/display/intel_display_power.c
> > +++ b/drivers/gpu/drm/i915/display/intel_display_power.c
> > @@ -6385,8 +6385,16 @@ static void intel_power_domains_verify_state(struct 
> > drm_i915_private *i915)
> >  
> >  void intel_display_power_suspend_late(struct drm_i915_private *i915)
> >  {
> > +struct drm_i915_private *dev_priv = i915;
> > +u32 val;
> > if (DISPLAY_VER(i915) >= 11 || IS_GEMINILAKE(i915) ||
> > IS_BROXTON(i915)) {
> > +   val = intel_de_read(dev_priv, PP_CONTROL(0));
> > +   /* Wa_14013120569:tgl */
> > +   if (IS_TIGERLAKE(i915)) {
> > +   val &= ~PANEL_POWER_ON;
> > +   intel_de_write(dev_priv, PP_CONTROL(0), val);
> > +   }
> 
> As José said, how do you enable the workaround after resume if external
> displays are still connected?
> 
> > bxt_enable_dc9(i915);
> > /* Tweaked Wa_14010685332:icp,jsp,mcc */
> > if (INTEL_PCH_TYPE(i915) >= PCH_ICP && INTEL_PCH_TYPE(i915) <= 
> > PCH_MCC)
> > diff --git a/drivers/gpu/drm/i915/display/intel_hotplug.c 
> > b/drivers/gpu/drm/i915/display/intel_hotplug.c
> > index 47c85ac97c87..8e3f84100daf 100644
> > --- a/drivers/gpu/drm/i915/display/intel_hotplug.c
> > +++ b/drivers/gpu/drm/i915/display/intel_hotplug.c
> > @@ -26,6 +26,7 @@
> >  #include "i915_drv.h"
> >  #include "intel_display_types.h"
> >  #include "intel_hotplug.h"
> > +#include "intel_de.h"
> >  
> >  /**
> >   * DOC: Hotplug
> > @@ -266,7 +267,9 @@ intel_encoder_hotplug(struct intel_encoder *encoder,
> >   struct intel_connector *connector)
> >  {
> > struct drm_device *dev = connector->base.dev;
> > +   struct drm_i915_private *dev_priv = to_i915(dev);
> > enum drm_connector_status old_status;
> > +   u32 val;
> > u64 old_epoch_counter;
> > bool ret = false;
> >  
> > @@ -288,6 +291,19 @@ intel_encoder_hotplug(struct intel_encoder *encoder,
> >   
> > drm_get_connector_status_name(connector->base.status),
> >   old_epoch_counter,
> >   connector->base.epoch_counter);
> > +
> > +   /* Wa_14013120569:tgl */
> > +   if (IS_TIGERLAKE(dev_priv)) {
> > +   val = intel_de_read(dev_priv, PP_CONTROL(0));
> > +   if (connector->base.status == 
> > connector_status_connected) {
> > +   val |= PANEL_POWER_ON;
> > +   intel_de_write(dev_priv, PP_CONTROL(0), val);
> > +   }
> > +   else if (connector->base.status == 
> > connector_status_disconnected) {
> > +   val &= ~PANEL_POWER_ON;
> > +   intel_de_write(dev_priv, PP_CONTROL(0), val);
> > +   }
> > +   }
> 
> First off, usually if you have a clean, generic, high level function,
> it's a hint you shouldn't stick low level register access there.
> 
> If you plug in two external displays and then unplug one of them, you
> end up disabling the workaround, while it's supposed to remain enabled
> if there's an external display connected. This is likely the most
> annoying part about the workaround.
> 
> This does not seem like a trivial workaround to implement.
>

Yes I agree, not a trivial W/A to implement. I think few main things to figure 
out:
- Right place to enable/disable the W/A at connect/disconnect and for the 
connectors already connected on boot - Probably in hdmi_init_connector() and 
dp_init_connector() for the connected conns
on boot and then intel_encoder_hptplug() at the time of ext display 
hotplug/unplug

@Jani having this W/A in above 2 places you think is good?
- The other thing like Jani pointed out is that we should enable/disable only 
if !edp - so add this check for init_connector functions before setting/ 
clearing the W/A

- Third thing is the wrapper function to be defined in intel_pps.c something 
like below:

intel_pps_wa_enable(struct 

Re: [Intel-gfx] [PATCH] drm/i915/display/tgl: Implement Wa_14013120569

2021-11-01 Thread Jani Nikula
On Mon, 28 Jun 2021, Madhumitha Tolakanahalli Pradeep 
 wrote:
> PCH display HPD IRQ is not detected with default filter value.
> So, PP_CONTROL is manually reprogrammed.

Returning to this workaround.

You're not supposed to enable the workaround when there's eDP
connected. This is also crucial in avoiding issues with eDP PPS.

The workaround is specific to Tiger Lake PCH, so you need to check
against the PCH, not the GPU.

Also see comments inline.

>
> Signed-off-by: Madhumitha Tolakanahalli Pradeep 
> 
> ---
>  .../gpu/drm/i915/display/intel_display_power.c   |  8 
>  drivers/gpu/drm/i915/display/intel_hotplug.c | 16 
>  2 files changed, 24 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_display_power.c 
> b/drivers/gpu/drm/i915/display/intel_display_power.c
> index 285380079aab..e44323cc76f5 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_power.c
> +++ b/drivers/gpu/drm/i915/display/intel_display_power.c
> @@ -6385,8 +6385,16 @@ static void intel_power_domains_verify_state(struct 
> drm_i915_private *i915)
>  
>  void intel_display_power_suspend_late(struct drm_i915_private *i915)
>  {
> +struct drm_i915_private *dev_priv = i915;
> +u32 val;
>   if (DISPLAY_VER(i915) >= 11 || IS_GEMINILAKE(i915) ||
>   IS_BROXTON(i915)) {
> + val = intel_de_read(dev_priv, PP_CONTROL(0));
> + /* Wa_14013120569:tgl */
> + if (IS_TIGERLAKE(i915)) {
> + val &= ~PANEL_POWER_ON;
> + intel_de_write(dev_priv, PP_CONTROL(0), val);
> + }

As José said, how do you enable the workaround after resume if external
displays are still connected?

>   bxt_enable_dc9(i915);
>   /* Tweaked Wa_14010685332:icp,jsp,mcc */
>   if (INTEL_PCH_TYPE(i915) >= PCH_ICP && INTEL_PCH_TYPE(i915) <= 
> PCH_MCC)
> diff --git a/drivers/gpu/drm/i915/display/intel_hotplug.c 
> b/drivers/gpu/drm/i915/display/intel_hotplug.c
> index 47c85ac97c87..8e3f84100daf 100644
> --- a/drivers/gpu/drm/i915/display/intel_hotplug.c
> +++ b/drivers/gpu/drm/i915/display/intel_hotplug.c
> @@ -26,6 +26,7 @@
>  #include "i915_drv.h"
>  #include "intel_display_types.h"
>  #include "intel_hotplug.h"
> +#include "intel_de.h"
>  
>  /**
>   * DOC: Hotplug
> @@ -266,7 +267,9 @@ intel_encoder_hotplug(struct intel_encoder *encoder,
> struct intel_connector *connector)
>  {
>   struct drm_device *dev = connector->base.dev;
> + struct drm_i915_private *dev_priv = to_i915(dev);
>   enum drm_connector_status old_status;
> + u32 val;
>   u64 old_epoch_counter;
>   bool ret = false;
>  
> @@ -288,6 +291,19 @@ intel_encoder_hotplug(struct intel_encoder *encoder,
> 
> drm_get_connector_status_name(connector->base.status),
> old_epoch_counter,
> connector->base.epoch_counter);
> +
> + /* Wa_14013120569:tgl */
> + if (IS_TIGERLAKE(dev_priv)) {
> + val = intel_de_read(dev_priv, PP_CONTROL(0));
> + if (connector->base.status == 
> connector_status_connected) {
> + val |= PANEL_POWER_ON;
> + intel_de_write(dev_priv, PP_CONTROL(0), val);
> + }
> + else if (connector->base.status == 
> connector_status_disconnected) {
> + val &= ~PANEL_POWER_ON;
> + intel_de_write(dev_priv, PP_CONTROL(0), val);
> + }
> + }

First off, usually if you have a clean, generic, high level function,
it's a hint you shouldn't stick low level register access there.

If you plug in two external displays and then unplug one of them, you
end up disabling the workaround, while it's supposed to remain enabled
if there's an external display connected. This is likely the most
annoying part about the workaround.

This does not seem like a trivial workaround to implement.


BR,
Jani.


>   return INTEL_HOTPLUG_CHANGED;
>   }
>   return INTEL_HOTPLUG_UNCHANGED;

-- 
Jani Nikula, Intel Open Source Graphics Center


Re: [Intel-gfx] [PATCH] drm/i915/display/tgl: Implement Wa_14013120569

2021-10-29 Thread Tolakanahalli Pradeep, Madhumitha
On Wed, 2021-10-27 at 17:55 +0300, Jani Nikula wrote:
> On Wed, 27 Oct 2021, "Tolakanahalli Pradeep, Madhumitha"  <
> madhumitha.tolakanahalli.prad...@intel.com> wrote:
> > On Mon, 2021-07-05 at 13:28 +0300, Jani Nikula wrote:
> > > On Tue, 29 Jun 2021, "Souza, Jose" 
> > > wrote:
> > > > On Mon, 2021-06-28 at 16:50 -0700, Madhumitha Tolakanahalli
> > > > Pradeep
> > > > wrote:
> > > > > PCH display HPD IRQ is not detected with default filter
> > > > > value.
> > > > > So, PP_CONTROL is manually reprogrammed.
> > > > > 
> > > > > Signed-off-by: Madhumitha Tolakanahalli Pradeep <
> > > > > madhumitha.tolakanahalli.pradeep at intel.com>
> > > > > ---
> > > > >  .../gpu/drm/i915/display/intel_display_power.c   |  8
> > > > > 
> > > > >  drivers/gpu/drm/i915/display/intel_hotplug.c | 16
> > > > > 
> > > > >  2 files changed, 24 insertions(+)
> > > > > 
> > > > > diff --git
> > > > > a/drivers/gpu/drm/i915/display/intel_display_power.c
> > > > > b/drivers/gpu/drm/i915/display/intel_display_power.c
> > > > > index 285380079aab..e44323cc76f5 100644
> > > > > --- a/drivers/gpu/drm/i915/display/intel_display_power.c
> > > > > +++ b/drivers/gpu/drm/i915/display/intel_display_power.c
> > > > > @@ -6385,8 +6385,16 @@ static void
> > > > > intel_power_domains_verify_state(struct drm_i915_private
> > > > > *i915)
> > > > > 
> > > > >  void intel_display_power_suspend_late(struct
> > > > > drm_i915_private
> > > > > *i915)
> > > > >  {
> > > > > +struct drm_i915_private *dev_priv = i915;
> > > > > +u32 val;
> > > > >   if (DISPLAY_VER(i915) >= 11 || IS_GEMINILAKE(i915) ||
> > > > >   IS_BROXTON(i915)) {
> > > > > + val = intel_de_read(dev_priv, PP_CONTROL(0));
> > > > > + /* Wa_14013120569:tgl */
> > > > > + if (IS_TIGERLAKE(i915)) {
> > > > > + val &= ~PANEL_POWER_ON;
> > > > > + intel_de_write(dev_priv, PP_CONTROL(0),
> > > > > val);
> > > > > + }
> > > > 
> > > > Code style is all wrong, please fix it and run "dim checkpatch"
> > > > to
> > > > validate it before sending patches.
> > > > Also PP_CONTROL(0) don't point to the same register that the
> > > > workaround is talking about, between generations register
> > > > address
> > > > change that might be
> > > > the case for this one.
> > > 
> > > In general, I've put a bunch of effort into moving most PPS stuff
> > > and
> > > PP_CONTROL reg access into intel_pps.c, not least because you
> > > must
> > > hold
> > > appropriate locks and power domain references to poke at this.
> > > You
> > > can't
> > > just mess with it nilly willy. I don't want these abstractions
> > > bypassed.
> > > 
> > > BR,
> > > Jani.
> > 
> > I see that intel_pps_get_registers(),  populates the regs-
> > > pp_ctrl  correctly. That is what I would want to access and set
> > > the
> > bits for this W/A. However as is I cannot call pps_get_registers()
> > in
> > intel_dp or intel_display.c for the external connector  at
> > connect/disconnect time. Do you recommend making this function non
> > static and calling it for this W/A or is there a way I can access
> > the
> > populated i915_reg_t pp_ctrl  to set the W/A?
> > 
> > Or are you wanting to  define another helper for enable/disable of
> > this
> > W/A in intel_pps.c that would then call pps_init_registers or
> > similar
> > function ?
> 
> Basically don't access any of the PPS registers outside of
> intel_pps.c. Any access like that is probably going to get the
> locking
> and timeout rules wrong, as well as make the software and hardware
> states go out of sync. Things like these need to be abstracted
> better. Bottom line, you can't just go poke at the registers in
> random
> places, no matter what the W/A says, and expect it to work out fine.
> 
> The commit message also doesn't properly explain what is going on,
> and
> *why* this change is needed. Especially when you're adding special
> cases, you need to take extra care to explain the rationale. People
> are
> going to look at git log and git blame literally years from now, and
> wonder what this is about.
> 
> BR,
> Jani.
> 
> 

Wa_14013120569 requires PP_CONTROL bit #0 to be set to 1 when external 
display is plugged or resume after sleep. Bit #0 is to be cleared when
external display is unplugged or before going to sleep. W/A isnt
enabled when eDP is connected. 

I shall add these details in v2, thank you for pointing that out.

As this W/A is required in a non-eDP scenario, I wouldn't be able to
use abstractions like intel_pps_on and intel_pps_off.

So would I need to create new wrapper functions in intel_pps.c for
setting and clearing the bits in PP_CONTROL with proper locks held,
and call these wrapper functions in intel_display.c/intel_dp.c? 

> PS. Please try to ensure your mail client handles thread replies
> properly. This should have been in reply to:
> 
> https://lore.kernel.org/r/54fada5eea99c1b5d7af300bcd6697711c3c5705.ca...@intel.com
> 

Sorry about that, fixed it.


Re: [Intel-gfx] [PATCH] drm/i915/display/tgl: Implement Wa_14013120569

2021-10-27 Thread Jani Nikula
On Wed, 27 Oct 2021, "Tolakanahalli Pradeep, Madhumitha"
 wrote:
> On Mon, 2021-07-05 at 13:28 +0300, Jani Nikula wrote:
>> On Tue, 29 Jun 2021, "Souza, Jose"  wrote:
>> > On Mon, 2021-06-28 at 16:50 -0700, Madhumitha Tolakanahalli Pradeep
>> > wrote:
>> > > PCH display HPD IRQ is not detected with default filter value.
>> > > So, PP_CONTROL is manually reprogrammed.
>> > >
>> > > Signed-off-by: Madhumitha Tolakanahalli Pradeep <
>> > > madhumitha.tolakanahalli.pradeep at intel.com>
>> > > ---
>> > >  .../gpu/drm/i915/display/intel_display_power.c   |  8 
>> > >  drivers/gpu/drm/i915/display/intel_hotplug.c | 16
>> > > 
>> > >  2 files changed, 24 insertions(+)
>> > >
>> > > diff --git a/drivers/gpu/drm/i915/display/intel_display_power.c
>> > > b/drivers/gpu/drm/i915/display/intel_display_power.c
>> > > index 285380079aab..e44323cc76f5 100644
>> > > --- a/drivers/gpu/drm/i915/display/intel_display_power.c
>> > > +++ b/drivers/gpu/drm/i915/display/intel_display_power.c
>> > > @@ -6385,8 +6385,16 @@ static void
>> > > intel_power_domains_verify_state(struct drm_i915_private *i915)
>> > >
>> > >  void intel_display_power_suspend_late(struct drm_i915_private
>> > > *i915)
>> > >  {
>> > > +struct drm_i915_private *dev_priv = i915;
>> > > +u32 val;
>> > >   if (DISPLAY_VER(i915) >= 11 || IS_GEMINILAKE(i915) ||
>> > >   IS_BROXTON(i915)) {
>> > > + val = intel_de_read(dev_priv, PP_CONTROL(0));
>> > > + /* Wa_14013120569:tgl */
>> > > + if (IS_TIGERLAKE(i915)) {
>> > > + val &= ~PANEL_POWER_ON;
>> > > + intel_de_write(dev_priv, PP_CONTROL(0), val);
>> > > + }
>> >
>> > Code style is all wrong, please fix it and run "dim checkpatch" to
>> > validate it before sending patches.
>> > Also PP_CONTROL(0) don't point to the same register that the
>> > workaround is talking about, between generations register address
>> > change that might be
>> > the case for this one.
>>
>> In general, I've put a bunch of effort into moving most PPS stuff and
>> PP_CONTROL reg access into intel_pps.c, not least because you must
>> hold
>> appropriate locks and power domain references to poke at this. You
>> can't
>> just mess with it nilly willy. I don't want these abstractions
>> bypassed.
>>
>> BR,
>> Jani.
>
> I see that intel_pps_get_registers(),  populates the regs-
> >pp_ctrl  correctly. That is what I would want to access and set the
> bits for this W/A. However as is I cannot call pps_get_registers() in
> intel_dp or intel_display.c for the external connector  at
> connect/disconnect time. Do you recommend making this function non
> static and calling it for this W/A or is there a way I can access the
> populated i915_reg_t pp_ctrl  to set the W/A?
>
> Or are you wanting to  define another helper for enable/disable of this
> W/A in intel_pps.c that would then call pps_init_registers or similar
> function ?

Basically don't access any of the PPS registers outside of
intel_pps.c. Any access like that is probably going to get the locking
and timeout rules wrong, as well as make the software and hardware
states go out of sync. Things like these need to be abstracted
better. Bottom line, you can't just go poke at the registers in random
places, no matter what the W/A says, and expect it to work out fine.

The commit message also doesn't properly explain what is going on, and
*why* this change is needed. Especially when you're adding special
cases, you need to take extra care to explain the rationale. People are
going to look at git log and git blame literally years from now, and
wonder what this is about.

BR,
Jani.



PS. Please try to ensure your mail client handles thread replies
properly. This should have been in reply to:
https://lore.kernel.org/r/54fada5eea99c1b5d7af300bcd6697711c3c5705.ca...@intel.com


>
> - Madhumitha
>
>>
>> > This satisfy the "before going into sleep to allow CS entry" but it
>> > do not restore the workaround after waking up from suspend.
>> > Also you could improve the code, you are reading the register even
>> > for platforms that don't need the wa, also check intel_de_rmw() it
>> > is better suited
>> > to this case.
>> >
>> > >   bxt_enable_dc9(i915);
>> > >   /* Tweaked Wa_14010685332:icp,jsp,mcc */
>> > >   if (INTEL_PCH_TYPE(i915) >= PCH_ICP &&
>> > > INTEL_PCH_TYPE(i915) <= PCH_MCC)
>> > > diff --git a/drivers/gpu/drm/i915/display/intel_hotplug.c
>> > > b/drivers/gpu/drm/i915/display/intel_hotplug.c
>> > > index 47c85ac97c87..8e3f84100daf 100644
>> > > --- a/drivers/gpu/drm/i915/display/intel_hotplug.c
>> > > +++ b/drivers/gpu/drm/i915/display/intel_hotplug.c
>> > > @@ -26,6 +26,7 @@
>> > >  #include "i915_drv.h"
>> > >  #include "intel_display_types.h"
>> > >  #include "intel_hotplug.h"
>> > > +#include "intel_de.h"
>> > >
>> > >  /**
>> > >   * DOC: Hotplug
>> > > @@ -266,7 +267,9 @@ intel_encoder_hotplug(struct intel_encoder
>> > > *encoder,
>> > > 

Re: [Intel-gfx] [PATCH] drm/i915/display/tgl: Implement Wa_14013120569

2021-10-26 Thread Tolakanahalli Pradeep, Madhumitha
On Mon, 2021-07-05 at 13:28 +0300, Jani Nikula wrote:
> On Tue, 29 Jun 2021, "Souza, Jose"  wrote:
> > On Mon, 2021-06-28 at 16:50 -0700, Madhumitha Tolakanahalli Pradeep
> > wrote:
> > > PCH display HPD IRQ is not detected with default filter value.
> > > So, PP_CONTROL is manually reprogrammed.
> > > 
> > > Signed-off-by: Madhumitha Tolakanahalli Pradeep <
> > > madhumitha.tolakanahalli.pradeep at intel.com>
> > > ---
> > >  .../gpu/drm/i915/display/intel_display_power.c   |  8 
> > >  drivers/gpu/drm/i915/display/intel_hotplug.c | 16
> > > 
> > >  2 files changed, 24 insertions(+)
> > > 
> > > diff --git a/drivers/gpu/drm/i915/display/intel_display_power.c
> > > b/drivers/gpu/drm/i915/display/intel_display_power.c
> > > index 285380079aab..e44323cc76f5 100644
> > > --- a/drivers/gpu/drm/i915/display/intel_display_power.c
> > > +++ b/drivers/gpu/drm/i915/display/intel_display_power.c
> > > @@ -6385,8 +6385,16 @@ static void
> > > intel_power_domains_verify_state(struct drm_i915_private *i915)
> > >  
> > >  void intel_display_power_suspend_late(struct drm_i915_private
> > > *i915)
> > >  {
> > > +struct drm_i915_private *dev_priv = i915;
> > > +u32 val;
> > >   if (DISPLAY_VER(i915) >= 11 || IS_GEMINILAKE(i915) ||
> > >   IS_BROXTON(i915)) {
> > > + val = intel_de_read(dev_priv, PP_CONTROL(0));
> > > + /* Wa_14013120569:tgl */
> > > + if (IS_TIGERLAKE(i915)) {
> > > + val &= ~PANEL_POWER_ON;
> > > + intel_de_write(dev_priv, PP_CONTROL(0), val);
> > > + }
> > 
> > Code style is all wrong, please fix it and run "dim checkpatch" to
> > validate it before sending patches.
> > Also PP_CONTROL(0) don't point to the same register that the
> > workaround is talking about, between generations register address
> > change that might be
> > the case for this one.
> 
> In general, I've put a bunch of effort into moving most PPS stuff and
> PP_CONTROL reg access into intel_pps.c, not least because you must
> hold
> appropriate locks and power domain references to poke at this. You
> can't
> just mess with it nilly willy. I don't want these abstractions
> bypassed.
> 
> BR,
> Jani.

I see that intel_pps_get_registers(),  populates the regs-
>pp_ctrl  correctly. That is what I would want to access and set the
bits for this W/A. However as is I cannot call pps_get_registers() in
intel_dp or intel_display.c for the external connector  at
connect/disconnect time. Do you recommend making this function non
static and calling it for this W/A or is there a way I can access the
populated i915_reg_t pp_ctrl  to set the W/A?

Or are you wanting to  define another helper for enable/disable of this
W/A in intel_pps.c that would then call pps_init_registers or similar
function ?

- Madhumitha

> 
> > This satisfy the "before going into sleep to allow CS entry" but it
> > do not restore the workaround after waking up from suspend.
> > Also you could improve the code, you are reading the register even
> > for platforms that don't need the wa, also check intel_de_rmw() it
> > is better suited
> > to this case.
> > 
> > >   bxt_enable_dc9(i915);
> > >   /* Tweaked Wa_14010685332:icp,jsp,mcc */
> > >   if (INTEL_PCH_TYPE(i915) >= PCH_ICP &&
> > > INTEL_PCH_TYPE(i915) <= PCH_MCC)
> > > diff --git a/drivers/gpu/drm/i915/display/intel_hotplug.c
> > > b/drivers/gpu/drm/i915/display/intel_hotplug.c
> > > index 47c85ac97c87..8e3f84100daf 100644
> > > --- a/drivers/gpu/drm/i915/display/intel_hotplug.c
> > > +++ b/drivers/gpu/drm/i915/display/intel_hotplug.c
> > > @@ -26,6 +26,7 @@
> > >  #include "i915_drv.h"
> > >  #include "intel_display_types.h"
> > >  #include "intel_hotplug.h"
> > > +#include "intel_de.h"
> > >  
> > >  /**
> > >   * DOC: Hotplug
> > > @@ -266,7 +267,9 @@ intel_encoder_hotplug(struct intel_encoder
> > > *encoder,
> > > struct intel_connector *connector)
> > >  {
> > >   struct drm_device *dev = connector->base.dev;
> > > + struct drm_i915_private *dev_priv = to_i915(dev);
> > >   enum drm_connector_status old_status;
> > > + u32 val;
> > >   u64 old_epoch_counter;
> > >   bool ret = false;
> > >  
> > > @@ -288,6 +291,19 @@ intel_encoder_hotplug(struct intel_encoder
> > > *encoder,
> > > drm_get_connector_status_name(connector-
> > > >base.status),
> > > old_epoch_counter,
> > > connector->base.epoch_counter);
> > > +
> > > + /* Wa_14013120569:tgl */
> > > + if (IS_TIGERLAKE(dev_priv)) {
> > > + val = intel_de_read(dev_priv, PP_CONTROL(0));
> > > + if (connector->base.status ==
> > > connector_status_connected) {
> > > + val |= PANEL_POWER_ON;
> > > + intel_de_write(dev_priv, PP_CONTROL(0),
> > > val);
> > > + }
> > > + else if (connector->base.status ==
> > > connector_status_disconnected) {

Re: [Intel-gfx] [PATCH] drm/i915/display/tgl: Implement Wa_14013120569

2021-07-07 Thread Tolakanahalli Pradeep, Madhumitha
On Mon, 2021-07-05 at 13:28 +0300, Jani Nikula wrote:
> On Tue, 29 Jun 2021, "Souza, Jose"  wrote:
> > On Mon, 2021-06-28 at 16:50 -0700, Madhumitha Tolakanahalli Pradeep
> > wrote:
> > > PCH display HPD IRQ is not detected with default filter value.
> > > So, PP_CONTROL is manually reprogrammed.
> > > 
> > > Signed-off-by: Madhumitha Tolakanahalli Pradeep <
> > > madhumitha.tolakanahalli.prad...@intel.com>
> > > ---
> > >  .../gpu/drm/i915/display/intel_display_power.c   |  8 
> > >  drivers/gpu/drm/i915/display/intel_hotplug.c | 16
> > > 
> > >  2 files changed, 24 insertions(+)
> > > 
> > > diff --git a/drivers/gpu/drm/i915/display/intel_display_power.c
> > > b/drivers/gpu/drm/i915/display/intel_display_power.c
> > > index 285380079aab..e44323cc76f5 100644
> > > --- a/drivers/gpu/drm/i915/display/intel_display_power.c
> > > +++ b/drivers/gpu/drm/i915/display/intel_display_power.c
> > > @@ -6385,8 +6385,16 @@ static void
> > > intel_power_domains_verify_state(struct drm_i915_private *i915)
> > >  
> > >  void intel_display_power_suspend_late(struct drm_i915_private
> > > *i915)
> > >  {
> > > +struct drm_i915_private *dev_priv = i915;
> > > +u32 val;
> > >   if (DISPLAY_VER(i915) >= 11 || IS_GEMINILAKE(i915) ||
> > >   IS_BROXTON(i915)) {
> > > + val = intel_de_read(dev_priv, PP_CONTROL(0));
> > > + /* Wa_14013120569:tgl */
> > > + if (IS_TIGERLAKE(i915)) {
> > > + val &= ~PANEL_POWER_ON;
> > > + intel_de_write(dev_priv, PP_CONTROL(0), val);
> > > + }
> > 
> > Code style is all wrong, please fix it and run "dim checkpatch" to
> > validate it before sending patches.
> > Also PP_CONTROL(0) don't point to the same register that the
> > workaround is talking about, between generations register address
> > change that might be
> > the case for this one.
> 
> In general, I've put a bunch of effort into moving most PPS stuff and
> PP_CONTROL reg access into intel_pps.c, not least because you must
> hold
> appropriate locks and power domain references to poke at this. You
> can't
> just mess with it nilly willy. I don't want these abstractions
> bypassed.
> 
> BR,
> Jani.

Thank you for pointing that out, I will fix this in the next version.

- Madhumitha
> 
> > This satisfy the "before going into sleep to allow CS entry" but it
> > do not restore the workaround after waking up from suspend.
> > Also you could improve the code, you are reading the register even
> > for platforms that don't need the wa, also check intel_de_rmw() it
> > is better suited
> > to this case.
> > 
> > >   bxt_enable_dc9(i915);
> > >   /* Tweaked Wa_14010685332:icp,jsp,mcc */
> > >   if (INTEL_PCH_TYPE(i915) >= PCH_ICP &&
> > > INTEL_PCH_TYPE(i915) <= PCH_MCC)
> > > diff --git a/drivers/gpu/drm/i915/display/intel_hotplug.c
> > > b/drivers/gpu/drm/i915/display/intel_hotplug.c
> > > index 47c85ac97c87..8e3f84100daf 100644
> > > --- a/drivers/gpu/drm/i915/display/intel_hotplug.c
> > > +++ b/drivers/gpu/drm/i915/display/intel_hotplug.c
> > > @@ -26,6 +26,7 @@
> > >  #include "i915_drv.h"
> > >  #include "intel_display_types.h"
> > >  #include "intel_hotplug.h"
> > > +#include "intel_de.h"
> > >  
> > >  /**
> > >   * DOC: Hotplug
> > > @@ -266,7 +267,9 @@ intel_encoder_hotplug(struct intel_encoder
> > > *encoder,
> > > struct intel_connector *connector)
> > >  {
> > >   struct drm_device *dev = connector->base.dev;
> > > + struct drm_i915_private *dev_priv = to_i915(dev);
> > >   enum drm_connector_status old_status;
> > > + u32 val;
> > >   u64 old_epoch_counter;
> > >   bool ret = false;
> > >  
> > > @@ -288,6 +291,19 @@ intel_encoder_hotplug(struct intel_encoder
> > > *encoder,
> > > drm_get_connector_status_name(connector-
> > > >base.status),
> > > old_epoch_counter,
> > > connector->base.epoch_counter);
> > > +
> > > + /* Wa_14013120569:tgl */
> > > + if (IS_TIGERLAKE(dev_priv)) {
> > > + val = intel_de_read(dev_priv, PP_CONTROL(0));
> > > + if (connector->base.status ==
> > > connector_status_connected) {
> > > + val |= PANEL_POWER_ON;
> > > + intel_de_write(dev_priv, PP_CONTROL(0),
> > > val);
> > > + }
> > > + else if (connector->base.status ==
> > > connector_status_disconnected) {
> > > + val &= ~PANEL_POWER_ON;
> > > + intel_de_write(dev_priv, PP_CONTROL(0),
> > > val);
> > > + }
> > > + }
> > 
> > Not sure if this is the best place but anyways it is missing handle
> > the case were tigerlake boots with the external display connected.
> > No hotplug will happen and workaround will never be enabled.
> > 
> > >   return INTEL_HOTPLUG_CHANGED;
> > >   }
> > >   return INTEL_HOTPLUG_UNCHANGED;
> > 
> > 

Re: [Intel-gfx] [PATCH] drm/i915/display/tgl: Implement Wa_14013120569

2021-07-07 Thread Tolakanahalli Pradeep, Madhumitha
On Tue, 2021-06-29 at 22:25 +, Souza, Jose wrote:
> On Mon, 2021-06-28 at 16:50 -0700, Madhumitha Tolakanahalli Pradeep
> wrote:
> > PCH display HPD IRQ is not detected with default filter value.
> > So, PP_CONTROL is manually reprogrammed.
> > 
> > Signed-off-by: Madhumitha Tolakanahalli Pradeep <
> > madhumitha.tolakanahalli.prad...@intel.com>
> > ---
> >  .../gpu/drm/i915/display/intel_display_power.c   |  8 
> >  drivers/gpu/drm/i915/display/intel_hotplug.c | 16
> > 
> >  2 files changed, 24 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/i915/display/intel_display_power.c
> > b/drivers/gpu/drm/i915/display/intel_display_power.c
> > index 285380079aab..e44323cc76f5 100644
> > --- a/drivers/gpu/drm/i915/display/intel_display_power.c
> > +++ b/drivers/gpu/drm/i915/display/intel_display_power.c
> > @@ -6385,8 +6385,16 @@ static void
> > intel_power_domains_verify_state(struct drm_i915_private *i915)
> > 
> >  void intel_display_power_suspend_late(struct drm_i915_private
> > *i915)
> >  {
> > +struct drm_i915_private *dev_priv = i915;
> > +u32 val;
> >  if (DISPLAY_VER(i915) >= 11 || IS_GEMINILAKE(i915) ||
> >  IS_BROXTON(i915)) {
> > +val = intel_de_read(dev_priv, PP_CONTROL(0));
> > +/* Wa_14013120569:tgl */
> > +if (IS_TIGERLAKE(i915)) {
> > +val &= ~PANEL_POWER_ON;
> > +intel_de_write(dev_priv, PP_CONTROL(0), val);
> > +}
> 
> Code style is all wrong, please fix it and run "dim checkpatch" to
> validate it before sending patches.

Thanks for pointing that out, I will fix it in the next version.

> Also PP_CONTROL(0) don't point to the same register that the
> workaround is talking about, between generations register address
> change that might be
> the case for this one.

Could you point me to the right register that I need to be
programming for this WA?

> This satisfy the "before going into sleep to allow CS entry" but it
> do not restore the workaround after waking up from suspend.
> do not restore the workaround after waking up from suspend.

Ah, I missed that point, will fix it in v2.

> Also you could improve the code, you are reading the register even
> for platforms that don't need the wa, also check intel_de_rmw() it is
> better suited
> to this case.

You're right, I will move that code under IS_TIGERLAKE().
> 
> >  bxt_enable_dc9(i915);
> >  /* Tweaked Wa_14010685332:icp,jsp,mcc */
> >  if (INTEL_PCH_TYPE(i915) >= PCH_ICP && INTEL_PCH_TYPE(i915) <=
> > PCH_MCC)
> > diff --git a/drivers/gpu/drm/i915/display/intel_hotplug.c
> > b/drivers/gpu/drm/i915/display/intel_hotplug.c
> > index 47c85ac97c87..8e3f84100daf 100644
> > --- a/drivers/gpu/drm/i915/display/intel_hotplug.c
> > +++ b/drivers/gpu/drm/i915/display/intel_hotplug.c
> > @@ -26,6 +26,7 @@
> >  #include "i915_drv.h"
> >  #include "intel_display_types.h"
> >  #include "intel_hotplug.h"
> > +#include "intel_de.h"
> > 
> >  /**
> >   * DOC: Hotplug
> > @@ -266,7 +267,9 @@ intel_encoder_hotplug(struct intel_encoder
> > *encoder,
> >struct intel_connector *connector)
> >  {
> >  struct drm_device *dev = connector->base.dev;
> > +struct drm_i915_private *dev_priv = to_i915(dev);
> >  enum drm_connector_status old_status;
> > +u32 val;
> >  u64 old_epoch_counter;
> >  bool ret = false;
> > 
> > @@ -288,6 +291,19 @@ intel_encoder_hotplug(struct intel_encoder
> > *encoder,
> >drm_get_connector_status_name(connector->base.status),
> >old_epoch_counter,
> >connector->base.epoch_counter);
> > +
> > +/* Wa_14013120569:tgl */
> > +if (IS_TIGERLAKE(dev_priv)) {
> > +val = intel_de_read(dev_priv, PP_CONTROL(0));
> > +if (connector->base.status == connector_status_connected) {
> > +val |= PANEL_POWER_ON;
> > +intel_de_write(dev_priv, PP_CONTROL(0), val);
> > +}
> > +else if (connector->base.status == connector_status_disconnected)
> > {
> > +val &= ~PANEL_POWER_ON;
> > +intel_de_write(dev_priv, PP_CONTROL(0), val);
> > +}
> > +}
> 
> Not sure if this is the best place but anyways it is missing handle
> the case were tigerlake boots with the external display connected.
> No hotplug will happen and workaround will never be enabled.

Could you suggest a better place to add this WA?

I will add the check for TGL booting with external display connected
in v2.

> 
> >  return INTEL_HOTPLUG_CHANGED;
> >  }
> >  return INTEL_HOTPLUG_UNCHANGED;
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH] drm/i915/display/tgl: Implement Wa_14013120569

2021-07-05 Thread Jani Nikula
On Tue, 29 Jun 2021, "Souza, Jose"  wrote:
> On Mon, 2021-06-28 at 16:50 -0700, Madhumitha Tolakanahalli Pradeep wrote:
>> PCH display HPD IRQ is not detected with default filter value.
>> So, PP_CONTROL is manually reprogrammed.
>> 
>> Signed-off-by: Madhumitha Tolakanahalli Pradeep 
>> 
>> ---
>>  .../gpu/drm/i915/display/intel_display_power.c   |  8 
>>  drivers/gpu/drm/i915/display/intel_hotplug.c | 16 
>>  2 files changed, 24 insertions(+)
>> 
>> diff --git a/drivers/gpu/drm/i915/display/intel_display_power.c 
>> b/drivers/gpu/drm/i915/display/intel_display_power.c
>> index 285380079aab..e44323cc76f5 100644
>> --- a/drivers/gpu/drm/i915/display/intel_display_power.c
>> +++ b/drivers/gpu/drm/i915/display/intel_display_power.c
>> @@ -6385,8 +6385,16 @@ static void intel_power_domains_verify_state(struct 
>> drm_i915_private *i915)
>>  
>>  void intel_display_power_suspend_late(struct drm_i915_private *i915)
>>  {
>> +struct drm_i915_private *dev_priv = i915;
>> +u32 val;
>>  if (DISPLAY_VER(i915) >= 11 || IS_GEMINILAKE(i915) ||
>>  IS_BROXTON(i915)) {
>> +val = intel_de_read(dev_priv, PP_CONTROL(0));
>> +/* Wa_14013120569:tgl */
>> +if (IS_TIGERLAKE(i915)) {
>> +val &= ~PANEL_POWER_ON;
>> +intel_de_write(dev_priv, PP_CONTROL(0), val);
>> +}
>
> Code style is all wrong, please fix it and run "dim checkpatch" to validate 
> it before sending patches.
> Also PP_CONTROL(0) don't point to the same register that the workaround is 
> talking about, between generations register address change that might be
> the case for this one.

In general, I've put a bunch of effort into moving most PPS stuff and
PP_CONTROL reg access into intel_pps.c, not least because you must hold
appropriate locks and power domain references to poke at this. You can't
just mess with it nilly willy. I don't want these abstractions bypassed.

BR,
Jani.

>
> This satisfy the "before going into sleep to allow CS entry" but it do not 
> restore the workaround after waking up from suspend.
> Also you could improve the code, you are reading the register even for 
> platforms that don't need the wa, also check intel_de_rmw() it is better 
> suited
> to this case.
>
>>  bxt_enable_dc9(i915);
>>  /* Tweaked Wa_14010685332:icp,jsp,mcc */
>>  if (INTEL_PCH_TYPE(i915) >= PCH_ICP && INTEL_PCH_TYPE(i915) <= 
>> PCH_MCC)
>> diff --git a/drivers/gpu/drm/i915/display/intel_hotplug.c 
>> b/drivers/gpu/drm/i915/display/intel_hotplug.c
>> index 47c85ac97c87..8e3f84100daf 100644
>> --- a/drivers/gpu/drm/i915/display/intel_hotplug.c
>> +++ b/drivers/gpu/drm/i915/display/intel_hotplug.c
>> @@ -26,6 +26,7 @@
>>  #include "i915_drv.h"
>>  #include "intel_display_types.h"
>>  #include "intel_hotplug.h"
>> +#include "intel_de.h"
>>  
>>  /**
>>   * DOC: Hotplug
>> @@ -266,7 +267,9 @@ intel_encoder_hotplug(struct intel_encoder *encoder,
>>struct intel_connector *connector)
>>  {
>>  struct drm_device *dev = connector->base.dev;
>> +struct drm_i915_private *dev_priv = to_i915(dev);
>>  enum drm_connector_status old_status;
>> +u32 val;
>>  u64 old_epoch_counter;
>>  bool ret = false;
>>  
>> @@ -288,6 +291,19 @@ intel_encoder_hotplug(struct intel_encoder *encoder,
>>
>> drm_get_connector_status_name(connector->base.status),
>>old_epoch_counter,
>>connector->base.epoch_counter);
>> +
>> +/* Wa_14013120569:tgl */
>> +if (IS_TIGERLAKE(dev_priv)) {
>> +val = intel_de_read(dev_priv, PP_CONTROL(0));
>> +if (connector->base.status == 
>> connector_status_connected) {
>> +val |= PANEL_POWER_ON;
>> +intel_de_write(dev_priv, PP_CONTROL(0), val);
>> +}
>> +else if (connector->base.status == 
>> connector_status_disconnected) {
>> +val &= ~PANEL_POWER_ON;
>> +intel_de_write(dev_priv, PP_CONTROL(0), val);
>> +}
>> +}
>
> Not sure if this is the best place but anyways it is missing handle the case 
> were tigerlake boots with the external display connected.
> No hotplug will happen and workaround will never be enabled.
>
>>  return INTEL_HOTPLUG_CHANGED;
>>  }
>>  return INTEL_HOTPLUG_UNCHANGED;
>
> ___
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Jani Nikula, Intel Open Source Graphics Center
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH] drm/i915/display/tgl: Implement Wa_14013120569

2021-06-29 Thread Souza, Jose
On Mon, 2021-06-28 at 16:50 -0700, Madhumitha Tolakanahalli Pradeep wrote:
> PCH display HPD IRQ is not detected with default filter value.
> So, PP_CONTROL is manually reprogrammed.
> 
> Signed-off-by: Madhumitha Tolakanahalli Pradeep 
> 
> ---
>  .../gpu/drm/i915/display/intel_display_power.c   |  8 
>  drivers/gpu/drm/i915/display/intel_hotplug.c | 16 
>  2 files changed, 24 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display_power.c 
> b/drivers/gpu/drm/i915/display/intel_display_power.c
> index 285380079aab..e44323cc76f5 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_power.c
> +++ b/drivers/gpu/drm/i915/display/intel_display_power.c
> @@ -6385,8 +6385,16 @@ static void intel_power_domains_verify_state(struct 
> drm_i915_private *i915)
>  
>  void intel_display_power_suspend_late(struct drm_i915_private *i915)
>  {
> +struct drm_i915_private *dev_priv = i915;
> +u32 val;
>   if (DISPLAY_VER(i915) >= 11 || IS_GEMINILAKE(i915) ||
>   IS_BROXTON(i915)) {
> + val = intel_de_read(dev_priv, PP_CONTROL(0));
> + /* Wa_14013120569:tgl */
> + if (IS_TIGERLAKE(i915)) {
> + val &= ~PANEL_POWER_ON;
> + intel_de_write(dev_priv, PP_CONTROL(0), val);
> + }

Code style is all wrong, please fix it and run "dim checkpatch" to validate it 
before sending patches.
Also PP_CONTROL(0) don't point to the same register that the workaround is 
talking about, between generations register address change that might be
the case for this one.

This satisfy the "before going into sleep to allow CS entry" but it do not 
restore the workaround after waking up from suspend.
Also you could improve the code, you are reading the register even for 
platforms that don't need the wa, also check intel_de_rmw() it is better suited
to this case.

>   bxt_enable_dc9(i915);
>   /* Tweaked Wa_14010685332:icp,jsp,mcc */
>   if (INTEL_PCH_TYPE(i915) >= PCH_ICP && INTEL_PCH_TYPE(i915) <= 
> PCH_MCC)
> diff --git a/drivers/gpu/drm/i915/display/intel_hotplug.c 
> b/drivers/gpu/drm/i915/display/intel_hotplug.c
> index 47c85ac97c87..8e3f84100daf 100644
> --- a/drivers/gpu/drm/i915/display/intel_hotplug.c
> +++ b/drivers/gpu/drm/i915/display/intel_hotplug.c
> @@ -26,6 +26,7 @@
>  #include "i915_drv.h"
>  #include "intel_display_types.h"
>  #include "intel_hotplug.h"
> +#include "intel_de.h"
>  
>  /**
>   * DOC: Hotplug
> @@ -266,7 +267,9 @@ intel_encoder_hotplug(struct intel_encoder *encoder,
> struct intel_connector *connector)
>  {
>   struct drm_device *dev = connector->base.dev;
> + struct drm_i915_private *dev_priv = to_i915(dev);
>   enum drm_connector_status old_status;
> + u32 val;
>   u64 old_epoch_counter;
>   bool ret = false;
>  
> @@ -288,6 +291,19 @@ intel_encoder_hotplug(struct intel_encoder *encoder,
> 
> drm_get_connector_status_name(connector->base.status),
> old_epoch_counter,
> connector->base.epoch_counter);
> +
> + /* Wa_14013120569:tgl */
> + if (IS_TIGERLAKE(dev_priv)) {
> + val = intel_de_read(dev_priv, PP_CONTROL(0));
> + if (connector->base.status == 
> connector_status_connected) {
> + val |= PANEL_POWER_ON;
> + intel_de_write(dev_priv, PP_CONTROL(0), val);
> + }
> + else if (connector->base.status == 
> connector_status_disconnected) {
> + val &= ~PANEL_POWER_ON;
> + intel_de_write(dev_priv, PP_CONTROL(0), val);
> + }
> + }

Not sure if this is the best place but anyways it is missing handle the case 
were tigerlake boots with the external display connected.
No hotplug will happen and workaround will never be enabled.

>   return INTEL_HOTPLUG_CHANGED;
>   }
>   return INTEL_HOTPLUG_UNCHANGED;

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH] drm/i915/display/tgl: Implement Wa_14013120569

2021-06-28 Thread Madhumitha Tolakanahalli Pradeep
PCH display HPD IRQ is not detected with default filter value.
So, PP_CONTROL is manually reprogrammed.

Signed-off-by: Madhumitha Tolakanahalli Pradeep 

---
 .../gpu/drm/i915/display/intel_display_power.c   |  8 
 drivers/gpu/drm/i915/display/intel_hotplug.c | 16 
 2 files changed, 24 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_display_power.c 
b/drivers/gpu/drm/i915/display/intel_display_power.c
index 285380079aab..e44323cc76f5 100644
--- a/drivers/gpu/drm/i915/display/intel_display_power.c
+++ b/drivers/gpu/drm/i915/display/intel_display_power.c
@@ -6385,8 +6385,16 @@ static void intel_power_domains_verify_state(struct 
drm_i915_private *i915)
 
 void intel_display_power_suspend_late(struct drm_i915_private *i915)
 {
+struct drm_i915_private *dev_priv = i915;
+u32 val;
if (DISPLAY_VER(i915) >= 11 || IS_GEMINILAKE(i915) ||
IS_BROXTON(i915)) {
+   val = intel_de_read(dev_priv, PP_CONTROL(0));
+   /* Wa_14013120569:tgl */
+   if (IS_TIGERLAKE(i915)) {
+   val &= ~PANEL_POWER_ON;
+   intel_de_write(dev_priv, PP_CONTROL(0), val);
+   }
bxt_enable_dc9(i915);
/* Tweaked Wa_14010685332:icp,jsp,mcc */
if (INTEL_PCH_TYPE(i915) >= PCH_ICP && INTEL_PCH_TYPE(i915) <= 
PCH_MCC)
diff --git a/drivers/gpu/drm/i915/display/intel_hotplug.c 
b/drivers/gpu/drm/i915/display/intel_hotplug.c
index 47c85ac97c87..8e3f84100daf 100644
--- a/drivers/gpu/drm/i915/display/intel_hotplug.c
+++ b/drivers/gpu/drm/i915/display/intel_hotplug.c
@@ -26,6 +26,7 @@
 #include "i915_drv.h"
 #include "intel_display_types.h"
 #include "intel_hotplug.h"
+#include "intel_de.h"
 
 /**
  * DOC: Hotplug
@@ -266,7 +267,9 @@ intel_encoder_hotplug(struct intel_encoder *encoder,
  struct intel_connector *connector)
 {
struct drm_device *dev = connector->base.dev;
+   struct drm_i915_private *dev_priv = to_i915(dev);
enum drm_connector_status old_status;
+   u32 val;
u64 old_epoch_counter;
bool ret = false;
 
@@ -288,6 +291,19 @@ intel_encoder_hotplug(struct intel_encoder *encoder,
  
drm_get_connector_status_name(connector->base.status),
  old_epoch_counter,
  connector->base.epoch_counter);
+
+   /* Wa_14013120569:tgl */
+   if (IS_TIGERLAKE(dev_priv)) {
+   val = intel_de_read(dev_priv, PP_CONTROL(0));
+   if (connector->base.status == 
connector_status_connected) {
+   val |= PANEL_POWER_ON;
+   intel_de_write(dev_priv, PP_CONTROL(0), val);
+   }
+   else if (connector->base.status == 
connector_status_disconnected) {
+   val &= ~PANEL_POWER_ON;
+   intel_de_write(dev_priv, PP_CONTROL(0), val);
+   }
+   }
return INTEL_HOTPLUG_CHANGED;
}
return INTEL_HOTPLUG_UNCHANGED;
-- 
2.26.2

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx