Re: [Intel-gfx] [PATCH 01/13] drm/i915/pps: abstract panel power sequencer from intel_dp.c

2021-01-08 Thread Jani Nikula
On Mon, 04 Jan 2021, Jani Nikula  wrote:
> On Mon, 28 Dec 2020, "Gupta, Anshuman"  wrote:
>>> -Original Message-
>>> From: Intel-gfx  On Behalf Of Jani
>>> Nikula
>>> Sent: Tuesday, December 22, 2020 8:20 PM
>>> To: intel-gfx@lists.freedesktop.org
>>> Cc: Nikula, Jani 
>>> Subject: [Intel-gfx] [PATCH 01/13] drm/i915/pps: abstract panel power
>>> sequencer from intel_dp.c
>>> 
>>> In a long overdue refactoring, split out all panel sequencer code from
>>> intel_dp.c to new intel_pps.[ch].
>>> 
>>> The first part is mostly just code movement as-is, without cleanups.
>>> 
>>> We need to add a vlv_get_dpll() helper to get at the vlv/chv dpll from
>>> pps code.
>> IMHO functions intel_dp_init_panel_power_sequencer, 
>> intel_dp_init_panel_power_sequencer_registers,
>> intel_dp_pps_init suits a intel_edp_* prefix.
>
> This patch just moves code. The rename would be a separate change on
> top. Possibly with intel_pps prefix instead because they're not so much
> about dp or edp as about pps.

I've added some additional renames in v2.

BR,
Jani.


-- 
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 01/13] drm/i915/pps: abstract panel power sequencer from intel_dp.c

2021-01-04 Thread Jani Nikula
On Mon, 28 Dec 2020, "Gupta, Anshuman"  wrote:
>> -Original Message-
>> From: Intel-gfx  On Behalf Of Jani
>> Nikula
>> Sent: Tuesday, December 22, 2020 8:20 PM
>> To: intel-gfx@lists.freedesktop.org
>> Cc: Nikula, Jani 
>> Subject: [Intel-gfx] [PATCH 01/13] drm/i915/pps: abstract panel power
>> sequencer from intel_dp.c
>> 
>> In a long overdue refactoring, split out all panel sequencer code from
>> intel_dp.c to new intel_pps.[ch].
>> 
>> The first part is mostly just code movement as-is, without cleanups.
>> 
>> We need to add a vlv_get_dpll() helper to get at the vlv/chv dpll from
>> pps code.
> IMHO functions intel_dp_init_panel_power_sequencer, 
> intel_dp_init_panel_power_sequencer_registers,
> intel_dp_pps_init suits a intel_edp_* prefix.

This patch just moves code. The rename would be a separate change on
top. Possibly with intel_pps prefix instead because they're not so much
about dp or edp as about pps.

BR,
Jani.


-- 
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 01/13] drm/i915/pps: abstract panel power sequencer from intel_dp.c

2020-12-28 Thread Gupta, Anshuman


> -Original Message-
> From: Intel-gfx  On Behalf Of Jani
> Nikula
> Sent: Tuesday, December 22, 2020 8:20 PM
> To: intel-gfx@lists.freedesktop.org
> Cc: Nikula, Jani 
> Subject: [Intel-gfx] [PATCH 01/13] drm/i915/pps: abstract panel power
> sequencer from intel_dp.c
> 
> In a long overdue refactoring, split out all panel sequencer code from
> intel_dp.c to new intel_pps.[ch].
> 
> The first part is mostly just code movement as-is, without cleanups.
> 
> We need to add a vlv_get_dpll() helper to get at the vlv/chv dpll from
> pps code.
IMHO functions intel_dp_init_panel_power_sequencer, 
intel_dp_init_panel_power_sequencer_registers,
intel_dp_pps_init suits a intel_edp_* prefix.
> 
> Signed-off-by: Jani Nikula 
> ---
>  drivers/gpu/drm/i915/Makefile |1 +
>  drivers/gpu/drm/i915/display/intel_ddi.c  |1 +
>  .../drm/i915/display/intel_display_power.c|2 +-
>  drivers/gpu/drm/i915/display/intel_dp.c   | 1442 +
>  drivers/gpu/drm/i915/display/intel_dp.h   |5 +-
>  drivers/gpu/drm/i915/display/intel_pps.c  | 1337 +++
>  drivers/gpu/drm/i915/display/intel_pps.h  |   53 +
>  7 files changed, 1447 insertions(+), 1394 deletions(-)
>  create mode 100644 drivers/gpu/drm/i915/display/intel_pps.c
>  create mode 100644 drivers/gpu/drm/i915/display/intel_pps.h
> 
> diff --git a/drivers/gpu/drm/i915/Makefile
> b/drivers/gpu/drm/i915/Makefile
> index 3a439b1d0496..1e26902a86e5 100644
> --- a/drivers/gpu/drm/i915/Makefile
> +++ b/drivers/gpu/drm/i915/Makefile
> @@ -250,6 +250,7 @@ i915-y += \
>   display/intel_lspcon.o \
>   display/intel_lvds.o \
>   display/intel_panel.o \
> + display/intel_pps.o \
>   display/intel_sdvo.o \
>   display/intel_tv.o \
>   display/intel_vdsc.o \
> diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c
> b/drivers/gpu/drm/i915/display/intel_ddi.c
> index 6863236df1d0..9ddbe8b8730b 100644
> --- a/drivers/gpu/drm/i915/display/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/display/intel_ddi.c
> @@ -46,6 +46,7 @@
>  #include "intel_hotplug.h"
>  #include "intel_lspcon.h"
>  #include "intel_panel.h"
> +#include "intel_pps.h"
>  #include "intel_psr.h"
>  #include "intel_sprite.h"
>  #include "intel_tc.h"
> diff --git a/drivers/gpu/drm/i915/display/intel_display_power.c
> b/drivers/gpu/drm/i915/display/intel_display_power.c
> index d52374f01316..a11bd8213df4 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_power.c
> +++ b/drivers/gpu/drm/i915/display/intel_display_power.c
> @@ -4,7 +4,6 @@
>   */
> 
>  #include "display/intel_crt.h"
> -#include "display/intel_dp.h"
> 
>  #include "i915_drv.h"
>  #include "i915_irq.h"
> @@ -16,6 +15,7 @@
>  #include "intel_dpio_phy.h"
>  #include "intel_hotplug.h"
>  #include "intel_pm.h"
> +#include "intel_pps.h"
>  #include "intel_sideband.h"
>  #include "intel_tc.h"
>  #include "intel_vga.h"
> diff --git a/drivers/gpu/drm/i915/display/intel_dp.c
> b/drivers/gpu/drm/i915/display/intel_dp.c
> index b2bc0c8c39c7..d4760c478653 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp.c
> @@ -58,6 +58,7 @@
>  #include "intel_lspcon.h"
>  #include "intel_lvds.h"
>  #include "intel_panel.h"
> +#include "intel_pps.h"
>  #include "intel_psr.h"
>  #include "intel_sideband.h"
>  #include "intel_tc.h"
> @@ -121,6 +122,11 @@ static const struct dp_link_dpll chv_dpll[] = {
>   { .p1 = 4, .p2 = 1, .n = 1, .m1 = 2, .m2 = 0x6c0 } },
>  };
> 
> +const struct dpll *vlv_get_dpll(struct drm_i915_private *i915)
> +{
> + return IS_CHERRYVIEW(i915) ? _dpll[0].dpll : _dpll[0].dpll;
> +}
> +
>  /* Constants for DP DSC configurations */
>  static const u8 valid_dsc_bpp[] = {6, 8, 10, 12, 15};
> 
> @@ -145,12 +151,6 @@ bool intel_dp_is_edp(struct intel_dp *intel_dp)
> 
>  static void intel_dp_link_down(struct intel_encoder *encoder,
>  const struct intel_crtc_state *old_crtc_state);
> -static bool edp_panel_vdd_on(struct intel_dp *intel_dp);
> -static void edp_panel_vdd_off(struct intel_dp *intel_dp, bool sync);
> -static void vlv_init_panel_power_sequencer(struct intel_encoder
> *encoder,
> -const struct intel_crtc_state
> *crtc_state);
> -static void vlv_steal_power_sequencer(struct drm_i915_private
> *dev_priv,
> -   enum p

[Intel-gfx] [PATCH 01/13] drm/i915/pps: abstract panel power sequencer from intel_dp.c

2020-12-22 Thread Jani Nikula
In a long overdue refactoring, split out all panel sequencer code from
intel_dp.c to new intel_pps.[ch].

The first part is mostly just code movement as-is, without cleanups.

We need to add a vlv_get_dpll() helper to get at the vlv/chv dpll from
pps code.

Signed-off-by: Jani Nikula 
---
 drivers/gpu/drm/i915/Makefile |1 +
 drivers/gpu/drm/i915/display/intel_ddi.c  |1 +
 .../drm/i915/display/intel_display_power.c|2 +-
 drivers/gpu/drm/i915/display/intel_dp.c   | 1442 +
 drivers/gpu/drm/i915/display/intel_dp.h   |5 +-
 drivers/gpu/drm/i915/display/intel_pps.c  | 1337 +++
 drivers/gpu/drm/i915/display/intel_pps.h  |   53 +
 7 files changed, 1447 insertions(+), 1394 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/display/intel_pps.c
 create mode 100644 drivers/gpu/drm/i915/display/intel_pps.h

diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
index 3a439b1d0496..1e26902a86e5 100644
--- a/drivers/gpu/drm/i915/Makefile
+++ b/drivers/gpu/drm/i915/Makefile
@@ -250,6 +250,7 @@ i915-y += \
display/intel_lspcon.o \
display/intel_lvds.o \
display/intel_panel.o \
+   display/intel_pps.o \
display/intel_sdvo.o \
display/intel_tv.o \
display/intel_vdsc.o \
diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c 
b/drivers/gpu/drm/i915/display/intel_ddi.c
index 6863236df1d0..9ddbe8b8730b 100644
--- a/drivers/gpu/drm/i915/display/intel_ddi.c
+++ b/drivers/gpu/drm/i915/display/intel_ddi.c
@@ -46,6 +46,7 @@
 #include "intel_hotplug.h"
 #include "intel_lspcon.h"
 #include "intel_panel.h"
+#include "intel_pps.h"
 #include "intel_psr.h"
 #include "intel_sprite.h"
 #include "intel_tc.h"
diff --git a/drivers/gpu/drm/i915/display/intel_display_power.c 
b/drivers/gpu/drm/i915/display/intel_display_power.c
index d52374f01316..a11bd8213df4 100644
--- a/drivers/gpu/drm/i915/display/intel_display_power.c
+++ b/drivers/gpu/drm/i915/display/intel_display_power.c
@@ -4,7 +4,6 @@
  */
 
 #include "display/intel_crt.h"
-#include "display/intel_dp.h"
 
 #include "i915_drv.h"
 #include "i915_irq.h"
@@ -16,6 +15,7 @@
 #include "intel_dpio_phy.h"
 #include "intel_hotplug.h"
 #include "intel_pm.h"
+#include "intel_pps.h"
 #include "intel_sideband.h"
 #include "intel_tc.h"
 #include "intel_vga.h"
diff --git a/drivers/gpu/drm/i915/display/intel_dp.c 
b/drivers/gpu/drm/i915/display/intel_dp.c
index b2bc0c8c39c7..d4760c478653 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -58,6 +58,7 @@
 #include "intel_lspcon.h"
 #include "intel_lvds.h"
 #include "intel_panel.h"
+#include "intel_pps.h"
 #include "intel_psr.h"
 #include "intel_sideband.h"
 #include "intel_tc.h"
@@ -121,6 +122,11 @@ static const struct dp_link_dpll chv_dpll[] = {
{ .p1 = 4, .p2 = 1, .n = 1, .m1 = 2, .m2 = 0x6c0 } },
 };
 
+const struct dpll *vlv_get_dpll(struct drm_i915_private *i915)
+{
+   return IS_CHERRYVIEW(i915) ? _dpll[0].dpll : _dpll[0].dpll;
+}
+
 /* Constants for DP DSC configurations */
 static const u8 valid_dsc_bpp[] = {6, 8, 10, 12, 15};
 
@@ -145,12 +151,6 @@ bool intel_dp_is_edp(struct intel_dp *intel_dp)
 
 static void intel_dp_link_down(struct intel_encoder *encoder,
   const struct intel_crtc_state *old_crtc_state);
-static bool edp_panel_vdd_on(struct intel_dp *intel_dp);
-static void edp_panel_vdd_off(struct intel_dp *intel_dp, bool sync);
-static void vlv_init_panel_power_sequencer(struct intel_encoder *encoder,
-  const struct intel_crtc_state 
*crtc_state);
-static void vlv_steal_power_sequencer(struct drm_i915_private *dev_priv,
- enum pipe pipe);
 static void intel_dp_unset_edid(struct intel_dp *intel_dp);
 
 /* update sink rates from dpcd */
@@ -854,451 +854,6 @@ static void intel_dp_unpack_aux(u32 src, u8 *dst, int 
dst_bytes)
dst[i] = src >> ((3-i) * 8);
 }
 
-static void
-intel_dp_init_panel_power_sequencer(struct intel_dp *intel_dp);
-static void
-intel_dp_init_panel_power_sequencer_registers(struct intel_dp *intel_dp,
- bool force_disable_vdd);
-static void
-intel_dp_pps_init(struct intel_dp *intel_dp);
-
-static intel_wakeref_t
-pps_lock(struct intel_dp *intel_dp)
-{
-   struct drm_i915_private *dev_priv = dp_to_i915(intel_dp);
-   intel_wakeref_t wakeref;
-
-   /*
-* See intel_power_sequencer_reset() why we need
-* a power domain reference here.
-*/
-   wakeref = intel_display_power_get(dev_priv,
- 
intel_aux_power_domain(dp_to_dig_port(intel_dp)));
-
-   mutex_lock(_priv->pps_mutex);
-
-   return wakeref;
-}
-
-static intel_wakeref_t
-pps_unlock(struct intel_dp *intel_dp, intel_wakeref_t wakeref)
-{
-   struct drm_i915_private *dev_priv =