Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Extended Wake Timeout
@ 2024-12-13  6:03 Suraj Kandpal
  2024-12-13  6:03 ` [PATCH 1/2] drm/dp: Add the DPCD register required for Extended wake timeout Suraj Kandpal
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Suraj Kandpal @ 2024-12-13  6:03 UTC (permalink / raw)
  To: intel-xe, intel-gfx, dri-devel; +Cc: uma.shankar, arun.r.murthy, Suraj Kandpal

Retimers in H/w usually takes 30 to 40ms to wake up all the devices. To
get this we use the Extended Wake Time feature in which the sink device
tells us the minimum amount of time it requires to wake up and we need
to do a write to grant this request else we need to wake up within 1ms
of low power state exit.

Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>

Suraj Kandpal (2):
  drm/dp: Add the DPCD register required for Extended wake timeout
  drm/i915/lttpr: Enable Extended Wake Timeout

 drivers/gpu/drm/i915/display/intel_ddi.c      |  2 +
 .../drm/i915/display/intel_dp_link_training.c | 46 +++++++++++++++++++
 .../drm/i915/display/intel_dp_link_training.h |  1 +
 include/drm/display/drm_dp.h                  | 14 ++++++
 4 files changed, 63 insertions(+)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 1/2] drm/dp: Add the DPCD register required for Extended wake timeout
  2024-12-13  6:03 [PATCH 0/2] Extended Wake Timeout Suraj Kandpal
@ 2024-12-13  6:03 ` Suraj Kandpal
  2024-12-13  6:03 ` [PATCH 2/2] drm/i915/lttpr: Enable Extended Wake Timeout Suraj Kandpal
  2024-12-13  6:38 ` ✗ Fi.CI.BUILD: failure for " Patchwork
  2 siblings, 0 replies; 12+ messages in thread
From: Suraj Kandpal @ 2024-12-13  6:03 UTC (permalink / raw)
  To: intel-xe, intel-gfx, dri-devel; +Cc: uma.shankar, arun.r.murthy, Suraj Kandpal

Add DPCD registers required to configure Extended Wake Timeout
for LTTPR.

Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
---
 include/drm/display/drm_dp.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/include/drm/display/drm_dp.h b/include/drm/display/drm_dp.h
index a6f8b098c56f..480370bba1de 100644
--- a/include/drm/display/drm_dp.h
+++ b/include/drm/display/drm_dp.h
@@ -696,6 +696,9 @@
 #define DP_UPSTREAM_DEVICE_DP_PWR_NEED	    0x118   /* 1.2 */
 # define DP_PWR_NOT_NEEDED		    (1 << 0)
 
+#define DP_EXTENDED_DPRX_SLEEP_WAKE_TIMEOUT_GRANT	    0x119   /* 1.4a */
+# define DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_GRANTED	    (1 << 0)
+
 #define DP_FEC_CONFIGURATION		    0x120    /* 1.4 */
 # define DP_FEC_READY			    (1 << 0)
 # define DP_FEC_ERR_COUNT_SEL_MASK	    (7 << 1)
@@ -1168,6 +1171,15 @@
 # define DP_VSC_EXT_CEA_SDP_SUPPORTED			(1 << 6)  /* DP 1.4 */
 # define DP_VSC_EXT_CEA_SDP_CHAINING_SUPPORTED		(1 << 7)  /* DP 1.4 */
 
+#define DP_EXTENDED_DPRX_SLEEP_WAKE_TIMEOUT_REQUEST	0x2211  /* 1.4a */
+# define DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_MASK		0xff
+# define DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_1_MS		0x00
+# define DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_20_MS	0x01
+# define DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_40_MS	0x02
+# define DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_60_MS	0x03
+# define DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_80_MS	0x04
+# define DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_100_MS	0x05
+
 #define DP_DPRX_FEATURE_ENUMERATION_LIST_CONT_1         0x2214 /* 2.0 E11 */
 # define DP_ADAPTIVE_SYNC_SDP_SUPPORTED    (1 << 0)
 # define DP_ADAPTIVE_SYNC_SDP_OPERATION_MODE		GENMASK(1, 0)
@@ -1473,6 +1485,8 @@
 #define DP_MAX_LANE_COUNT_PHY_REPEATER			    0xf0004 /* 1.4a */
 #define DP_Repeater_FEC_CAPABILITY			    0xf0004 /* 1.4 */
 #define DP_PHY_REPEATER_EXTENDED_WAIT_TIMEOUT		    0xf0005 /* 1.4a */
+# define DP_EXTENDED_WAKE_TIMEOUT_REQUEST_MASK		0x7f
+# define DP_EXTENDED_WAKE_TIMEOUT_GRANT			(1 << 7)
 #define DP_MAIN_LINK_CHANNEL_CODING_PHY_REPEATER	    0xf0006 /* 2.0 */
 # define DP_PHY_REPEATER_128B132B_SUPPORTED		    (1 << 0)
 /* See DP_128B132B_SUPPORTED_LINK_RATES for values */
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 2/2] drm/i915/lttpr: Enable Extended Wake Timeout
  2024-12-13  6:03 [PATCH 0/2] Extended Wake Timeout Suraj Kandpal
  2024-12-13  6:03 ` [PATCH 1/2] drm/dp: Add the DPCD register required for Extended wake timeout Suraj Kandpal
@ 2024-12-13  6:03 ` Suraj Kandpal
  2024-12-20 17:54   ` kernel test robot
                     ` (3 more replies)
  2024-12-13  6:38 ` ✗ Fi.CI.BUILD: failure for " Patchwork
  2 siblings, 4 replies; 12+ messages in thread
From: Suraj Kandpal @ 2024-12-13  6:03 UTC (permalink / raw)
  To: intel-xe, intel-gfx, dri-devel; +Cc: uma.shankar, arun.r.murthy, Suraj Kandpal

Usually retimers take around 30 to 40ms to exit all devices from
sleep state. Extended wake timeout request helps to give additional
time by reading the DPCD register through which sink requests the
minimal amount of time required to wake the sink up and giving the
same amount of wait requested by sink device.
Spec: DP v2.1 Section 3.6.12.3

Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
---
 drivers/gpu/drm/i915/display/intel_ddi.c      |  2 +
 .../drm/i915/display/intel_dp_link_training.c | 46 +++++++++++++++++++
 .../drm/i915/display/intel_dp_link_training.h |  1 +
 3 files changed, 49 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
index 4f9c50996446..d092c3ba0ccf 100644
--- a/drivers/gpu/drm/i915/display/intel_ddi.c
+++ b/drivers/gpu/drm/i915/display/intel_ddi.c
@@ -2624,6 +2624,8 @@ static void mtl_ddi_pre_enable_dp(struct intel_atomic_state *state,
 	if (!is_mst)
 		intel_dp_set_power(intel_dp, DP_SET_POWER_D0);
 
+	intel_dp_lttpr_wake_timeout_setup(intel_dp);
+
 	intel_dp_configure_protocol_converter(intel_dp, crtc_state);
 	if (!is_mst)
 		intel_dp_sink_enable_decompression(state,
diff --git a/drivers/gpu/drm/i915/display/intel_dp_link_training.c b/drivers/gpu/drm/i915/display/intel_dp_link_training.c
index ea9b4730a176..d0f0da78794e 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_link_training.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_link_training.c
@@ -134,6 +134,52 @@ static bool intel_dp_lttpr_transparent_mode_enabled(struct intel_dp *intel_dp)
 		DP_PHY_REPEATER_MODE_TRANSPARENT;
 }
 
+void intel_dp_lttpr_wake_timeout_setup(struct intel_dp *intel_dp)
+{
+	struct intel_display *display = to_intel_display(intel_dp);
+	u8 val = 1;
+	int ret;
+
+	if (intel_dp_lttpr_transparent_mode_enabled(intel_dp)) {
+		static const u8 timeout_mapping[] = {
+			[DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_1_MS] = 1,
+			[DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_20_MS] = 20,
+			[DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_40_MS] = 40,
+			[DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_20_MS] = 20,
+			[DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_80_MS] = 80,
+			[DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_100_MS] = 100,
+		};
+
+		ret = drm_dp_dpcd_readb(&intel_dp->aux,
+					DP_EXTENDED_DPRX_SLEEP_WAKE_TIMEOUT_REQUEST, &val);
+		if (ret != 1) {
+			drm_dbg_kms(display->drm,
+				    "Failed to read Extended sleep wake timeout request\n");
+			return;
+		}
+
+		val = (val < sizeof(timeout_mapping) && timeout_mapping[val]) ?
+			timeout_mapping[val] : 1;
+
+		drm_dp_dpcd_writeb(&intel_dp->aux, DP_EXTENDED_DPRX_SLEEP_WAKE_TIMEOUT_GRANT,
+				   DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_GRANTED);
+	} else {
+		ret = drm_dp_dpcd_readb(&intel_dp->aux,
+					DP_PHY_REPEATER_EXTENDED_WAIT_TIMEOUT, &val);
+		if (ret != 1) {
+			drm_dbg_kms(display->drm,
+				    "Failed to read Extended sleep wake timeout request\n");
+			return;
+		}
+
+		val = (val & DP_EXTENDED_WAKE_TIMEOUT_REQUEST_MASK) ?
+			(val & DP_EXTENDED_WAKE_TIMEOUT_REQUEST_MASK) * 10 : 1;
+
+		drm_dp_dpcd_writeb(&intel_dp->aux, DP_PHY_REPEATER_EXTENDED_WAIT_TIMEOUT,
+				   DP_EXTENDED_WAKE_TIMEOUT_GRANT);
+	}
+}
+
 /*
  * Read the LTTPR common capabilities and switch the LTTPR PHYs to
  * non-transparent mode if this is supported. Preserve the
diff --git a/drivers/gpu/drm/i915/display/intel_dp_link_training.h b/drivers/gpu/drm/i915/display/intel_dp_link_training.h
index 2066b9146762..cd4e0d6db6ed 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_link_training.h
+++ b/drivers/gpu/drm/i915/display/intel_dp_link_training.h
@@ -15,6 +15,7 @@ struct intel_dp;
 
 int intel_dp_read_dprx_caps(struct intel_dp *intel_dp, u8 dpcd[DP_RECEIVER_CAP_SIZE]);
 int intel_dp_init_lttpr_and_dprx_caps(struct intel_dp *intel_dp);
+void intel_dp_lttpr_wake_timeout_setup(struct intel_dp *intel_dp);
 
 void intel_dp_link_training_set_mode(struct intel_dp *intel_dp,
 				     int link_rate, bool is_vrr);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* ✗ Fi.CI.BUILD: failure for Extended Wake Timeout
  2024-12-13  6:03 [PATCH 0/2] Extended Wake Timeout Suraj Kandpal
  2024-12-13  6:03 ` [PATCH 1/2] drm/dp: Add the DPCD register required for Extended wake timeout Suraj Kandpal
  2024-12-13  6:03 ` [PATCH 2/2] drm/i915/lttpr: Enable Extended Wake Timeout Suraj Kandpal
@ 2024-12-13  6:38 ` Patchwork
  2 siblings, 0 replies; 12+ messages in thread
From: Patchwork @ 2024-12-13  6:38 UTC (permalink / raw)
  To: Suraj Kandpal; +Cc: intel-gfx

== Series Details ==

Series: Extended Wake Timeout
URL   : https://patchwork.freedesktop.org/series/142517/
State : failure

== Summary ==

Error: make failed
  CALL    scripts/checksyscalls.sh
  DESCEND objtool
  INSTALL libsubcmd_headers
  CC [M]  drivers/gpu/drm/i915/display/intel_dp_link_training.o
drivers/gpu/drm/i915/display/intel_dp_link_training.c: In function ‘intel_dp_lttpr_wake_timeout_setup’:
drivers/gpu/drm/i915/display/intel_dp_link_training.c:148:69: error: initialized field overwritten [-Werror=override-init]
  148 |                         [DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_20_MS] = 20,
      |                                                                     ^~
drivers/gpu/drm/i915/display/intel_dp_link_training.c:148:69: note: (near initialization for ‘timeout_mapping[1]’)
cc1: all warnings being treated as errors
make[6]: *** [scripts/Makefile.build:194: drivers/gpu/drm/i915/display/intel_dp_link_training.o] Error 1
make[5]: *** [scripts/Makefile.build:440: drivers/gpu/drm/i915] Error 2
make[4]: *** [scripts/Makefile.build:440: drivers/gpu/drm] Error 2
make[3]: *** [scripts/Makefile.build:440: drivers/gpu] Error 2
make[2]: *** [scripts/Makefile.build:440: drivers] Error 2
make[1]: *** [/home/kbuild/kernel/Makefile:1989: .] Error 2
make: *** [Makefile:251: __sub-make] Error 2
Build failed, no error log produced



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/2] drm/i915/lttpr: Enable Extended Wake Timeout
  2024-12-13  6:03 ` [PATCH 2/2] drm/i915/lttpr: Enable Extended Wake Timeout Suraj Kandpal
@ 2024-12-20 17:54   ` kernel test robot
  2024-12-21  0:49   ` kernel test robot
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 12+ messages in thread
From: kernel test robot @ 2024-12-20 17:54 UTC (permalink / raw)
  To: Suraj Kandpal, intel-xe, intel-gfx, dri-devel
  Cc: oe-kbuild-all, uma.shankar, arun.r.murthy, Suraj Kandpal

Hi Suraj,

kernel test robot noticed the following build errors:

[auto build test ERROR on linus/master]
[also build test ERROR on drm-intel/for-linux-next drm-intel/for-linux-next-fixes drm-tip/drm-tip v6.13-rc3 next-20241220]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Suraj-Kandpal/drm-dp-Add-the-DPCD-register-required-for-Extended-wake-timeout/20241213-140525
base:   linus/master
patch link:    https://lore.kernel.org/r/20241213060317.2674290-3-suraj.kandpal%40intel.com
patch subject: [PATCH 2/2] drm/i915/lttpr: Enable Extended Wake Timeout
config: i386-randconfig-013-20241220 (https://download.01.org/0day-ci/archive/20241221/202412210137.vRBJlttZ-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241221/202412210137.vRBJlttZ-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202412210137.vRBJlttZ-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/gpu/drm/i915/display/intel_dp_link_training.c: In function 'intel_dp_lttpr_wake_timeout_setup':
>> drivers/gpu/drm/i915/display/intel_dp_link_training.c:148:69: error: initialized field overwritten [-Werror=override-init]
     148 |                         [DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_20_MS] = 20,
         |                                                                     ^~
   drivers/gpu/drm/i915/display/intel_dp_link_training.c:148:69: note: (near initialization for 'timeout_mapping[1]')
   cc1: all warnings being treated as errors


vim +148 drivers/gpu/drm/i915/display/intel_dp_link_training.c

   136	
   137	void intel_dp_lttpr_wake_timeout_setup(struct intel_dp *intel_dp)
   138	{
   139		struct intel_display *display = to_intel_display(intel_dp);
   140		u8 val = 1;
   141		int ret;
   142	
   143		if (intel_dp_lttpr_transparent_mode_enabled(intel_dp)) {
   144			static const u8 timeout_mapping[] = {
   145				[DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_1_MS] = 1,
   146				[DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_20_MS] = 20,
   147				[DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_40_MS] = 40,
 > 148				[DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_20_MS] = 20,
   149				[DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_80_MS] = 80,
   150				[DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_100_MS] = 100,
   151			};
   152	
   153			ret = drm_dp_dpcd_readb(&intel_dp->aux,
   154						DP_EXTENDED_DPRX_SLEEP_WAKE_TIMEOUT_REQUEST, &val);
   155			if (ret != 1) {
   156				drm_dbg_kms(display->drm,
   157					    "Failed to read Extended sleep wake timeout request\n");
   158				return;
   159			}
   160	
   161			val = (val < sizeof(timeout_mapping) && timeout_mapping[val]) ?
   162				timeout_mapping[val] : 1;
   163	
   164			drm_dp_dpcd_writeb(&intel_dp->aux, DP_EXTENDED_DPRX_SLEEP_WAKE_TIMEOUT_GRANT,
   165					   DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_GRANTED);
   166		} else {
   167			ret = drm_dp_dpcd_readb(&intel_dp->aux,
   168						DP_PHY_REPEATER_EXTENDED_WAIT_TIMEOUT, &val);
   169			if (ret != 1) {
   170				drm_dbg_kms(display->drm,
   171					    "Failed to read Extended sleep wake timeout request\n");
   172				return;
   173			}
   174	
   175			val = (val & DP_EXTENDED_WAKE_TIMEOUT_REQUEST_MASK) ?
   176				(val & DP_EXTENDED_WAKE_TIMEOUT_REQUEST_MASK) * 10 : 1;
   177	
   178			drm_dp_dpcd_writeb(&intel_dp->aux, DP_PHY_REPEATER_EXTENDED_WAIT_TIMEOUT,
   179					   DP_EXTENDED_WAKE_TIMEOUT_GRANT);
   180		}
   181	}
   182	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/2] drm/i915/lttpr: Enable Extended Wake Timeout
  2024-12-13  6:03 ` [PATCH 2/2] drm/i915/lttpr: Enable Extended Wake Timeout Suraj Kandpal
  2024-12-20 17:54   ` kernel test robot
@ 2024-12-21  0:49   ` kernel test robot
  2024-12-21  1:42   ` kernel test robot
  2024-12-31 12:22   ` Vodapalli, Ravi Kumar
  3 siblings, 0 replies; 12+ messages in thread
From: kernel test robot @ 2024-12-21  0:49 UTC (permalink / raw)
  To: Suraj Kandpal, intel-xe, intel-gfx, dri-devel
  Cc: llvm, oe-kbuild-all, uma.shankar, arun.r.murthy, Suraj Kandpal

Hi Suraj,

kernel test robot noticed the following build errors:

[auto build test ERROR on linus/master]
[also build test ERROR on v6.13-rc3 next-20241220]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Suraj-Kandpal/drm-dp-Add-the-DPCD-register-required-for-Extended-wake-timeout/20241213-140525
base:   linus/master
patch link:    https://lore.kernel.org/r/20241213060317.2674290-3-suraj.kandpal%40intel.com
patch subject: [PATCH 2/2] drm/i915/lttpr: Enable Extended Wake Timeout
config: powerpc-randconfig-001-20241220 (https://download.01.org/0day-ci/archive/20241221/202412210826.fD0cAxev-lkp@intel.com/config)
compiler: clang version 15.0.7 (https://github.com/llvm/llvm-project 8dfdcc7b7bf66834a761bd8de445840ef68e4d1a)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241221/202412210826.fD0cAxev-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202412210826.fD0cAxev-lkp@intel.com/

All errors (new ones prefixed by >>):

>> drivers/gpu/drm/i915/display/intel_dp_link_training.c:148:48: error: initializer overrides prior initialization of this subobject [-Werror,-Winitializer-overrides]
                           [DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_20_MS] = 20,
                                                                       ^~
   drivers/gpu/drm/i915/display/intel_dp_link_training.c:146:48: note: previous initialization is here
                           [DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_20_MS] = 20,
                                                                       ^~
   1 error generated.


vim +148 drivers/gpu/drm/i915/display/intel_dp_link_training.c

   136	
   137	void intel_dp_lttpr_wake_timeout_setup(struct intel_dp *intel_dp)
   138	{
   139		struct intel_display *display = to_intel_display(intel_dp);
   140		u8 val = 1;
   141		int ret;
   142	
   143		if (intel_dp_lttpr_transparent_mode_enabled(intel_dp)) {
   144			static const u8 timeout_mapping[] = {
   145				[DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_1_MS] = 1,
   146				[DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_20_MS] = 20,
   147				[DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_40_MS] = 40,
 > 148				[DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_20_MS] = 20,
   149				[DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_80_MS] = 80,
   150				[DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_100_MS] = 100,
   151			};
   152	
   153			ret = drm_dp_dpcd_readb(&intel_dp->aux,
   154						DP_EXTENDED_DPRX_SLEEP_WAKE_TIMEOUT_REQUEST, &val);
   155			if (ret != 1) {
   156				drm_dbg_kms(display->drm,
   157					    "Failed to read Extended sleep wake timeout request\n");
   158				return;
   159			}
   160	
   161			val = (val < sizeof(timeout_mapping) && timeout_mapping[val]) ?
   162				timeout_mapping[val] : 1;
   163	
   164			drm_dp_dpcd_writeb(&intel_dp->aux, DP_EXTENDED_DPRX_SLEEP_WAKE_TIMEOUT_GRANT,
   165					   DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_GRANTED);
   166		} else {
   167			ret = drm_dp_dpcd_readb(&intel_dp->aux,
   168						DP_PHY_REPEATER_EXTENDED_WAIT_TIMEOUT, &val);
   169			if (ret != 1) {
   170				drm_dbg_kms(display->drm,
   171					    "Failed to read Extended sleep wake timeout request\n");
   172				return;
   173			}
   174	
   175			val = (val & DP_EXTENDED_WAKE_TIMEOUT_REQUEST_MASK) ?
   176				(val & DP_EXTENDED_WAKE_TIMEOUT_REQUEST_MASK) * 10 : 1;
   177	
   178			drm_dp_dpcd_writeb(&intel_dp->aux, DP_PHY_REPEATER_EXTENDED_WAIT_TIMEOUT,
   179					   DP_EXTENDED_WAKE_TIMEOUT_GRANT);
   180		}
   181	}
   182	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/2] drm/i915/lttpr: Enable Extended Wake Timeout
  2024-12-13  6:03 ` [PATCH 2/2] drm/i915/lttpr: Enable Extended Wake Timeout Suraj Kandpal
  2024-12-20 17:54   ` kernel test robot
  2024-12-21  0:49   ` kernel test robot
@ 2024-12-21  1:42   ` kernel test robot
  2024-12-31 12:22   ` Vodapalli, Ravi Kumar
  3 siblings, 0 replies; 12+ messages in thread
From: kernel test robot @ 2024-12-21  1:42 UTC (permalink / raw)
  To: Suraj Kandpal, intel-xe, intel-gfx, dri-devel
  Cc: oe-kbuild-all, uma.shankar, arun.r.murthy, Suraj Kandpal

Hi Suraj,

kernel test robot noticed the following build warnings:

[auto build test WARNING on linus/master]
[also build test WARNING on drm-intel/for-linux-next drm-intel/for-linux-next-fixes drm-tip/drm-tip v6.13-rc3 next-20241220]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Suraj-Kandpal/drm-dp-Add-the-DPCD-register-required-for-Extended-wake-timeout/20241213-140525
base:   linus/master
patch link:    https://lore.kernel.org/r/20241213060317.2674290-3-suraj.kandpal%40intel.com
patch subject: [PATCH 2/2] drm/i915/lttpr: Enable Extended Wake Timeout
config: x86_64-randconfig-r121-20241220 (https://download.01.org/0day-ci/archive/20241221/202412210956.FV7RWpOY-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241221/202412210956.FV7RWpOY-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202412210956.FV7RWpOY-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> drivers/gpu/drm/i915/display/intel_dp_link_training.c:146:26: sparse: sparse: Initializer entry defined twice
   drivers/gpu/drm/i915/display/intel_dp_link_training.c:148:26: sparse:   also defined here

vim +146 drivers/gpu/drm/i915/display/intel_dp_link_training.c

   136	
   137	void intel_dp_lttpr_wake_timeout_setup(struct intel_dp *intel_dp)
   138	{
   139		struct intel_display *display = to_intel_display(intel_dp);
   140		u8 val = 1;
   141		int ret;
   142	
   143		if (intel_dp_lttpr_transparent_mode_enabled(intel_dp)) {
   144			static const u8 timeout_mapping[] = {
   145				[DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_1_MS] = 1,
 > 146				[DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_20_MS] = 20,
   147				[DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_40_MS] = 40,
   148				[DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_20_MS] = 20,
   149				[DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_80_MS] = 80,
   150				[DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_100_MS] = 100,
   151			};
   152	
   153			ret = drm_dp_dpcd_readb(&intel_dp->aux,
   154						DP_EXTENDED_DPRX_SLEEP_WAKE_TIMEOUT_REQUEST, &val);
   155			if (ret != 1) {
   156				drm_dbg_kms(display->drm,
   157					    "Failed to read Extended sleep wake timeout request\n");
   158				return;
   159			}
   160	
   161			val = (val < sizeof(timeout_mapping) && timeout_mapping[val]) ?
   162				timeout_mapping[val] : 1;
   163	
   164			drm_dp_dpcd_writeb(&intel_dp->aux, DP_EXTENDED_DPRX_SLEEP_WAKE_TIMEOUT_GRANT,
   165					   DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_GRANTED);
   166		} else {
   167			ret = drm_dp_dpcd_readb(&intel_dp->aux,
   168						DP_PHY_REPEATER_EXTENDED_WAIT_TIMEOUT, &val);
   169			if (ret != 1) {
   170				drm_dbg_kms(display->drm,
   171					    "Failed to read Extended sleep wake timeout request\n");
   172				return;
   173			}
   174	
   175			val = (val & DP_EXTENDED_WAKE_TIMEOUT_REQUEST_MASK) ?
   176				(val & DP_EXTENDED_WAKE_TIMEOUT_REQUEST_MASK) * 10 : 1;
   177	
   178			drm_dp_dpcd_writeb(&intel_dp->aux, DP_PHY_REPEATER_EXTENDED_WAIT_TIMEOUT,
   179					   DP_EXTENDED_WAKE_TIMEOUT_GRANT);
   180		}
   181	}
   182	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/2] drm/i915/lttpr: Enable Extended Wake Timeout
  2024-12-13  6:03 ` [PATCH 2/2] drm/i915/lttpr: Enable Extended Wake Timeout Suraj Kandpal
                     ` (2 preceding siblings ...)
  2024-12-21  1:42   ` kernel test robot
@ 2024-12-31 12:22   ` Vodapalli, Ravi Kumar
  2024-12-31 13:54     ` Jani Nikula
  3 siblings, 1 reply; 12+ messages in thread
From: Vodapalli, Ravi Kumar @ 2024-12-31 12:22 UTC (permalink / raw)
  To: intel-gfx




On 12/13/2024 11:33 AM, Suraj Kandpal wrote:
> Usually retimers take around 30 to 40ms to exit all devices from
> sleep state. Extended wake timeout request helps to give additional
> time by reading the DPCD register through which sink requests the
> minimal amount of time required to wake the sink up and giving the
> same amount of wait requested by sink device.
> Spec: DP v2.1 Section 3.6.12.3
>
> Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
> ---
>   drivers/gpu/drm/i915/display/intel_ddi.c      |  2 +
>   .../drm/i915/display/intel_dp_link_training.c | 46 +++++++++++++++++++
>   .../drm/i915/display/intel_dp_link_training.h |  1 +
>   3 files changed, 49 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
> index 4f9c50996446..d092c3ba0ccf 100644
> --- a/drivers/gpu/drm/i915/display/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/display/intel_ddi.c
> @@ -2624,6 +2624,8 @@ static void mtl_ddi_pre_enable_dp(struct intel_atomic_state *state,
>   	if (!is_mst)
>   		intel_dp_set_power(intel_dp, DP_SET_POWER_D0);
>   
> +	intel_dp_lttpr_wake_timeout_setup(intel_dp);
> +
>   	intel_dp_configure_protocol_converter(intel_dp, crtc_state);
>   	if (!is_mst)
>   		intel_dp_sink_enable_decompression(state,
> diff --git a/drivers/gpu/drm/i915/display/intel_dp_link_training.c b/drivers/gpu/drm/i915/display/intel_dp_link_training.c
> index ea9b4730a176..d0f0da78794e 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp_link_training.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp_link_training.c
> @@ -134,6 +134,52 @@ static bool intel_dp_lttpr_transparent_mode_enabled(struct intel_dp *intel_dp)
>   		DP_PHY_REPEATER_MODE_TRANSPARENT;
>   }
>   
> +void intel_dp_lttpr_wake_timeout_setup(struct intel_dp *intel_dp)
> +{
> +	struct intel_display *display = to_intel_display(intel_dp);
> +	u8 val = 1;
> +	int ret;
> +
> +	if (intel_dp_lttpr_transparent_mode_enabled(intel_dp)) {
> +		static const u8 timeout_mapping[] = {
> +			[DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_1_MS] = 1,
> +			[DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_20_MS] = 20,
> +			[DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_40_MS] = 40,
> +			[DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_20_MS] = 20,
> +			[DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_80_MS] = 80,
> +			[DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_100_MS] = 100,
> +		};
> +
> +		ret = drm_dp_dpcd_readb(&intel_dp->aux,
> +					DP_EXTENDED_DPRX_SLEEP_WAKE_TIMEOUT_REQUEST, &val);
> +		if (ret != 1) {
> +			drm_dbg_kms(display->drm,
> +				    "Failed to read Extended sleep wake timeout request\n");
> +			return;

Returning from function without return type, better to declare int in 
place of void and return the error  value.

int intel_dp_lttpr_wake_timeout_setup(struct intel_dp *intel_dp)


Regards,
Ravi Kumar V
> +		}
> +
> +		val = (val < sizeof(timeout_mapping) && timeout_mapping[val]) ?
> +			timeout_mapping[val] : 1;
> +
> +		drm_dp_dpcd_writeb(&intel_dp->aux, DP_EXTENDED_DPRX_SLEEP_WAKE_TIMEOUT_GRANT,
> +				   DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_GRANTED);
> +	} else {
> +		ret = drm_dp_dpcd_readb(&intel_dp->aux,
> +					DP_PHY_REPEATER_EXTENDED_WAIT_TIMEOUT, &val);
> +		if (ret != 1) {
> +			drm_dbg_kms(display->drm,
> +				    "Failed to read Extended sleep wake timeout request\n");
> +			return;
> +		}
> +
> +		val = (val & DP_EXTENDED_WAKE_TIMEOUT_REQUEST_MASK) ?
> +			(val & DP_EXTENDED_WAKE_TIMEOUT_REQUEST_MASK) * 10 : 1;
> +
> +		drm_dp_dpcd_writeb(&intel_dp->aux, DP_PHY_REPEATER_EXTENDED_WAIT_TIMEOUT,
> +				   DP_EXTENDED_WAKE_TIMEOUT_GRANT);
> +	}
> +}
> +
>   /*
>    * Read the LTTPR common capabilities and switch the LTTPR PHYs to
>    * non-transparent mode if this is supported. Preserve the
> diff --git a/drivers/gpu/drm/i915/display/intel_dp_link_training.h b/drivers/gpu/drm/i915/display/intel_dp_link_training.h
> index 2066b9146762..cd4e0d6db6ed 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp_link_training.h
> +++ b/drivers/gpu/drm/i915/display/intel_dp_link_training.h
> @@ -15,6 +15,7 @@ struct intel_dp;
>   
>   int intel_dp_read_dprx_caps(struct intel_dp *intel_dp, u8 dpcd[DP_RECEIVER_CAP_SIZE]);
>   int intel_dp_init_lttpr_and_dprx_caps(struct intel_dp *intel_dp);
> +void intel_dp_lttpr_wake_timeout_setup(struct intel_dp *intel_dp);
>   
>   void intel_dp_link_training_set_mode(struct intel_dp *intel_dp,
>   				     int link_rate, bool is_vrr);


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/2] drm/i915/lttpr: Enable Extended Wake Timeout
  2024-12-31 12:22   ` Vodapalli, Ravi Kumar
@ 2024-12-31 13:54     ` Jani Nikula
  0 siblings, 0 replies; 12+ messages in thread
From: Jani Nikula @ 2024-12-31 13:54 UTC (permalink / raw)
  To: Vodapalli, Ravi Kumar, intel-gfx

On Tue, 31 Dec 2024, "Vodapalli, Ravi Kumar" <ravi.kumar.vodapalli@intel.com> wrote:
> On 12/13/2024 11:33 AM, Suraj Kandpal wrote:
>> Usually retimers take around 30 to 40ms to exit all devices from
>> sleep state. Extended wake timeout request helps to give additional
>> time by reading the DPCD register through which sink requests the
>> minimal amount of time required to wake the sink up and giving the
>> same amount of wait requested by sink device.
>> Spec: DP v2.1 Section 3.6.12.3
>>
>> Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
>> ---
>>   drivers/gpu/drm/i915/display/intel_ddi.c      |  2 +
>>   .../drm/i915/display/intel_dp_link_training.c | 46 +++++++++++++++++++
>>   .../drm/i915/display/intel_dp_link_training.h |  1 +
>>   3 files changed, 49 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
>> index 4f9c50996446..d092c3ba0ccf 100644
>> --- a/drivers/gpu/drm/i915/display/intel_ddi.c
>> +++ b/drivers/gpu/drm/i915/display/intel_ddi.c
>> @@ -2624,6 +2624,8 @@ static void mtl_ddi_pre_enable_dp(struct intel_atomic_state *state,
>>   	if (!is_mst)
>>   		intel_dp_set_power(intel_dp, DP_SET_POWER_D0);
>>   
>> +	intel_dp_lttpr_wake_timeout_setup(intel_dp);
>> +
>>   	intel_dp_configure_protocol_converter(intel_dp, crtc_state);
>>   	if (!is_mst)
>>   		intel_dp_sink_enable_decompression(state,
>> diff --git a/drivers/gpu/drm/i915/display/intel_dp_link_training.c b/drivers/gpu/drm/i915/display/intel_dp_link_training.c
>> index ea9b4730a176..d0f0da78794e 100644
>> --- a/drivers/gpu/drm/i915/display/intel_dp_link_training.c
>> +++ b/drivers/gpu/drm/i915/display/intel_dp_link_training.c
>> @@ -134,6 +134,52 @@ static bool intel_dp_lttpr_transparent_mode_enabled(struct intel_dp *intel_dp)
>>   		DP_PHY_REPEATER_MODE_TRANSPARENT;
>>   }
>>   
>> +void intel_dp_lttpr_wake_timeout_setup(struct intel_dp *intel_dp)
>> +{
>> +	struct intel_display *display = to_intel_display(intel_dp);
>> +	u8 val = 1;
>> +	int ret;
>> +
>> +	if (intel_dp_lttpr_transparent_mode_enabled(intel_dp)) {
>> +		static const u8 timeout_mapping[] = {
>> +			[DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_1_MS] = 1,
>> +			[DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_20_MS] = 20,
>> +			[DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_40_MS] = 40,
>> +			[DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_20_MS] = 20,
>> +			[DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_80_MS] = 80,
>> +			[DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_100_MS] = 100,
>> +		};

Btw this kind of stuff totally belongs in generic DP helpers instead of
our driver.

>> +
>> +		ret = drm_dp_dpcd_readb(&intel_dp->aux,
>> +					DP_EXTENDED_DPRX_SLEEP_WAKE_TIMEOUT_REQUEST, &val);
>> +		if (ret != 1) {
>> +			drm_dbg_kms(display->drm,
>> +				    "Failed to read Extended sleep wake timeout request\n");
>> +			return;
>
> Returning from function without return type, better to declare int in 
> place of void and return the error  value.

That depends on what you're going to do with that error value. We're not
going to check it anyway, are we?

>
> int intel_dp_lttpr_wake_timeout_setup(struct intel_dp *intel_dp)
>
>
> Regards,
> Ravi Kumar V
>> +		}
>> +
>> +		val = (val < sizeof(timeout_mapping) && timeout_mapping[val]) ?
>> +			timeout_mapping[val] : 1;

What's the point with this? We don't do anything with val?

BR,
Jani.

>> +
>> +		drm_dp_dpcd_writeb(&intel_dp->aux, DP_EXTENDED_DPRX_SLEEP_WAKE_TIMEOUT_GRANT,
>> +				   DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_GRANTED);
>> +	} else {
>> +		ret = drm_dp_dpcd_readb(&intel_dp->aux,
>> +					DP_PHY_REPEATER_EXTENDED_WAIT_TIMEOUT, &val);
>> +		if (ret != 1) {
>> +			drm_dbg_kms(display->drm,
>> +				    "Failed to read Extended sleep wake timeout request\n");
>> +			return;
>> +		}
>> +
>> +		val = (val & DP_EXTENDED_WAKE_TIMEOUT_REQUEST_MASK) ?
>> +			(val & DP_EXTENDED_WAKE_TIMEOUT_REQUEST_MASK) * 10 : 1;
>> +
>> +		drm_dp_dpcd_writeb(&intel_dp->aux, DP_PHY_REPEATER_EXTENDED_WAIT_TIMEOUT,
>> +				   DP_EXTENDED_WAKE_TIMEOUT_GRANT);
>> +	}
>> +}
>> +
>>   /*
>>    * Read the LTTPR common capabilities and switch the LTTPR PHYs to
>>    * non-transparent mode if this is supported. Preserve the
>> diff --git a/drivers/gpu/drm/i915/display/intel_dp_link_training.h b/drivers/gpu/drm/i915/display/intel_dp_link_training.h
>> index 2066b9146762..cd4e0d6db6ed 100644
>> --- a/drivers/gpu/drm/i915/display/intel_dp_link_training.h
>> +++ b/drivers/gpu/drm/i915/display/intel_dp_link_training.h
>> @@ -15,6 +15,7 @@ struct intel_dp;
>>   
>>   int intel_dp_read_dprx_caps(struct intel_dp *intel_dp, u8 dpcd[DP_RECEIVER_CAP_SIZE]);
>>   int intel_dp_init_lttpr_and_dprx_caps(struct intel_dp *intel_dp);
>> +void intel_dp_lttpr_wake_timeout_setup(struct intel_dp *intel_dp);
>>   
>>   void intel_dp_link_training_set_mode(struct intel_dp *intel_dp,
>>   				     int link_rate, bool is_vrr);
>

-- 
Jani Nikula, Intel

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 2/2] drm/i915/lttpr: Enable Extended Wake Timeout
  2025-01-17  5:48 [PATCH 0/2] " Suraj Kandpal
@ 2025-01-17  5:48 ` Suraj Kandpal
  2025-01-17  6:19   ` Dmitry Baryshkov
  0 siblings, 1 reply; 12+ messages in thread
From: Suraj Kandpal @ 2025-01-17  5:48 UTC (permalink / raw)
  To: intel-xe, intel-gfx, dri-devel; +Cc: arun.r.murthy, Suraj Kandpal

Usually retimers take around 30 to 40ms to exit all devices from
sleep state. Extended wake timeout request helps to give additional
time by reading the DPCD register through which sink requests the
minimal amount of time required to wake the sink up.
Source  device shall keep retying  the AUX tansaction till the extended
timeout that is being granted for LTTPRs from the sink device

--v2
-Grant the requested time only if greater than 1ms [Arun]
-Reframe commit message [Arun]

Spec: DP v2.1 Section 3.6.12.3
Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
---
 drivers/gpu/drm/i915/display/intel_ddi.c      |  2 +
 .../drm/i915/display/intel_dp_link_training.c | 49 +++++++++++++++++++
 .../drm/i915/display/intel_dp_link_training.h |  1 +
 3 files changed, 52 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
index acb986bc1f33..96cabe618678 100644
--- a/drivers/gpu/drm/i915/display/intel_ddi.c
+++ b/drivers/gpu/drm/i915/display/intel_ddi.c
@@ -2645,6 +2645,8 @@ static void mtl_ddi_pre_enable_dp(struct intel_atomic_state *state,
 	if (!is_mst)
 		intel_dp_set_power(intel_dp, DP_SET_POWER_D0);
 
+	intel_dp_lttpr_wake_timeout_setup(intel_dp);
+
 	intel_dp_configure_protocol_converter(intel_dp, crtc_state);
 	if (!is_mst)
 		intel_dp_sink_enable_decompression(state,
diff --git a/drivers/gpu/drm/i915/display/intel_dp_link_training.c b/drivers/gpu/drm/i915/display/intel_dp_link_training.c
index 8b1977cfec50..c113b0be259e 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_link_training.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_link_training.c
@@ -135,6 +135,55 @@ static bool intel_dp_lttpr_transparent_mode_enabled(struct intel_dp *intel_dp)
 		DP_PHY_REPEATER_MODE_TRANSPARENT;
 }
 
+void intel_dp_lttpr_wake_timeout_setup(struct intel_dp *intel_dp)
+{
+	struct intel_display *display = to_intel_display(intel_dp);
+	u8 val = 1;
+	int ret;
+
+	if (intel_dp_lttpr_transparent_mode_enabled(intel_dp)) {
+		static const u8 timeout_mapping[] = {
+			[DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_1_MS] = 1,
+			[DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_20_MS] = 20,
+			[DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_40_MS] = 40,
+			[DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_20_MS] = 20,
+			[DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_80_MS] = 80,
+			[DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_100_MS] = 100,
+		};
+
+		ret = drm_dp_dpcd_readb(&intel_dp->aux,
+					DP_EXTENDED_DPRX_SLEEP_WAKE_TIMEOUT_REQUEST, &val);
+		if (ret != 1) {
+			drm_dbg_kms(display->drm,
+				    "Failed to read Extended sleep wake timeout request\n");
+			return;
+		}
+
+		val = (val < sizeof(timeout_mapping) && timeout_mapping[val]) ?
+			timeout_mapping[val] : 1;
+
+		if (val > 1)
+			drm_dp_dpcd_writeb(&intel_dp->aux,
+					   DP_EXTENDED_DPRX_SLEEP_WAKE_TIMEOUT_GRANT,
+					   DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_GRANTED);
+	} else {
+		ret = drm_dp_dpcd_readb(&intel_dp->aux,
+					DP_PHY_REPEATER_EXTENDED_WAIT_TIMEOUT, &val);
+		if (ret != 1) {
+			drm_dbg_kms(display->drm,
+				    "Failed to read Extended sleep wake timeout request\n");
+			return;
+		}
+
+		val = (val & DP_EXTENDED_WAKE_TIMEOUT_REQUEST_MASK) ?
+			(val & DP_EXTENDED_WAKE_TIMEOUT_REQUEST_MASK) * 10 : 1;
+
+		if (val > 1)
+			drm_dp_dpcd_writeb(&intel_dp->aux, DP_PHY_REPEATER_EXTENDED_WAIT_TIMEOUT,
+					   DP_EXTENDED_WAKE_TIMEOUT_GRANT);
+	}
+}
+
 /*
  * Read the LTTPR common capabilities and switch the LTTPR PHYs to
  * non-transparent mode if this is supported. Preserve the
diff --git a/drivers/gpu/drm/i915/display/intel_dp_link_training.h b/drivers/gpu/drm/i915/display/intel_dp_link_training.h
index 2066b9146762..cd4e0d6db6ed 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_link_training.h
+++ b/drivers/gpu/drm/i915/display/intel_dp_link_training.h
@@ -15,6 +15,7 @@ struct intel_dp;
 
 int intel_dp_read_dprx_caps(struct intel_dp *intel_dp, u8 dpcd[DP_RECEIVER_CAP_SIZE]);
 int intel_dp_init_lttpr_and_dprx_caps(struct intel_dp *intel_dp);
+void intel_dp_lttpr_wake_timeout_setup(struct intel_dp *intel_dp);
 
 void intel_dp_link_training_set_mode(struct intel_dp *intel_dp,
 				     int link_rate, bool is_vrr);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/2] drm/i915/lttpr: Enable Extended Wake Timeout
  2025-01-17  5:48 ` [PATCH 2/2] drm/i915/lttpr: Enable " Suraj Kandpal
@ 2025-01-17  6:19   ` Dmitry Baryshkov
  2025-01-21  4:44     ` Kandpal, Suraj
  0 siblings, 1 reply; 12+ messages in thread
From: Dmitry Baryshkov @ 2025-01-17  6:19 UTC (permalink / raw)
  To: Suraj Kandpal; +Cc: intel-xe, intel-gfx, dri-devel, arun.r.murthy

On Fri, Jan 17, 2025 at 11:18:50AM +0530, Suraj Kandpal wrote:
> Usually retimers take around 30 to 40ms to exit all devices from
> sleep state. Extended wake timeout request helps to give additional
> time by reading the DPCD register through which sink requests the
> minimal amount of time required to wake the sink up.
> Source  device shall keep retying  the AUX tansaction till the extended
> timeout that is being granted for LTTPRs from the sink device
> 
> --v2
> -Grant the requested time only if greater than 1ms [Arun]
> -Reframe commit message [Arun]
> 
> Spec: DP v2.1 Section 3.6.12.3
> Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_ddi.c      |  2 +
>  .../drm/i915/display/intel_dp_link_training.c | 49 +++++++++++++++++++
>  .../drm/i915/display/intel_dp_link_training.h |  1 +
>  3 files changed, 52 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
> index acb986bc1f33..96cabe618678 100644
> --- a/drivers/gpu/drm/i915/display/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/display/intel_ddi.c
> @@ -2645,6 +2645,8 @@ static void mtl_ddi_pre_enable_dp(struct intel_atomic_state *state,
>  	if (!is_mst)
>  		intel_dp_set_power(intel_dp, DP_SET_POWER_D0);
>  
> +	intel_dp_lttpr_wake_timeout_setup(intel_dp);
> +
>  	intel_dp_configure_protocol_converter(intel_dp, crtc_state);
>  	if (!is_mst)
>  		intel_dp_sink_enable_decompression(state,
> diff --git a/drivers/gpu/drm/i915/display/intel_dp_link_training.c b/drivers/gpu/drm/i915/display/intel_dp_link_training.c
> index 8b1977cfec50..c113b0be259e 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp_link_training.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp_link_training.c
> @@ -135,6 +135,55 @@ static bool intel_dp_lttpr_transparent_mode_enabled(struct intel_dp *intel_dp)
>  		DP_PHY_REPEATER_MODE_TRANSPARENT;
>  }
>  
> +void intel_dp_lttpr_wake_timeout_setup(struct intel_dp *intel_dp)

Please move this function to drivers/gpu/drm/display/drm_dp_helper.c
Except for the intel_dp_lttpr_transparent_mode_enabled() call there is
nothing Intel-specific there.

> +{
> +	struct intel_display *display = to_intel_display(intel_dp);
> +	u8 val = 1;
> +	int ret;
> +
> +	if (intel_dp_lttpr_transparent_mode_enabled(intel_dp)) {
> +		static const u8 timeout_mapping[] = {
> +			[DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_1_MS] = 1,
> +			[DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_20_MS] = 20,
> +			[DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_40_MS] = 40,
> +			[DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_20_MS] = 20,
> +			[DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_80_MS] = 80,
> +			[DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_100_MS] = 100,
> +		};
> +
> +		ret = drm_dp_dpcd_readb(&intel_dp->aux,
> +					DP_EXTENDED_DPRX_SLEEP_WAKE_TIMEOUT_REQUEST, &val);
> +		if (ret != 1) {
> +			drm_dbg_kms(display->drm,
> +				    "Failed to read Extended sleep wake timeout request\n");
> +			return;
> +		}
> +
> +		val = (val < sizeof(timeout_mapping) && timeout_mapping[val]) ?
> +			timeout_mapping[val] : 1;
> +
> +		if (val > 1)
> +			drm_dp_dpcd_writeb(&intel_dp->aux,
> +					   DP_EXTENDED_DPRX_SLEEP_WAKE_TIMEOUT_GRANT,
> +					   DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_GRANTED);
> +	} else {
> +		ret = drm_dp_dpcd_readb(&intel_dp->aux,
> +					DP_PHY_REPEATER_EXTENDED_WAIT_TIMEOUT, &val);
> +		if (ret != 1) {
> +			drm_dbg_kms(display->drm,
> +				    "Failed to read Extended sleep wake timeout request\n");
> +			return;
> +		}
> +
> +		val = (val & DP_EXTENDED_WAKE_TIMEOUT_REQUEST_MASK) ?
> +			(val & DP_EXTENDED_WAKE_TIMEOUT_REQUEST_MASK) * 10 : 1;
> +
> +		if (val > 1)
> +			drm_dp_dpcd_writeb(&intel_dp->aux, DP_PHY_REPEATER_EXTENDED_WAIT_TIMEOUT,
> +					   DP_EXTENDED_WAKE_TIMEOUT_GRANT);
> +	}
> +}
> +
>  /*
>   * Read the LTTPR common capabilities and switch the LTTPR PHYs to
>   * non-transparent mode if this is supported. Preserve the
> diff --git a/drivers/gpu/drm/i915/display/intel_dp_link_training.h b/drivers/gpu/drm/i915/display/intel_dp_link_training.h
> index 2066b9146762..cd4e0d6db6ed 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp_link_training.h
> +++ b/drivers/gpu/drm/i915/display/intel_dp_link_training.h
> @@ -15,6 +15,7 @@ struct intel_dp;
>  
>  int intel_dp_read_dprx_caps(struct intel_dp *intel_dp, u8 dpcd[DP_RECEIVER_CAP_SIZE]);
>  int intel_dp_init_lttpr_and_dprx_caps(struct intel_dp *intel_dp);
> +void intel_dp_lttpr_wake_timeout_setup(struct intel_dp *intel_dp);
>  
>  void intel_dp_link_training_set_mode(struct intel_dp *intel_dp,
>  				     int link_rate, bool is_vrr);
> -- 
> 2.34.1
> 

-- 
With best wishes
Dmitry

^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: [PATCH 2/2] drm/i915/lttpr: Enable Extended Wake Timeout
  2025-01-17  6:19   ` Dmitry Baryshkov
@ 2025-01-21  4:44     ` Kandpal, Suraj
  0 siblings, 0 replies; 12+ messages in thread
From: Kandpal, Suraj @ 2025-01-21  4:44 UTC (permalink / raw)
  To: Dmitry Baryshkov
  Cc: intel-xe@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org, Murthy,  Arun R



> -----Original Message-----
> From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> Sent: Friday, January 17, 2025 11:50 AM
> To: Kandpal, Suraj <suraj.kandpal@intel.com>
> Cc: intel-xe@lists.freedesktop.org; intel-gfx@lists.freedesktop.org; dri-
> devel@lists.freedesktop.org; Murthy, Arun R <arun.r.murthy@intel.com>
> Subject: Re: [PATCH 2/2] drm/i915/lttpr: Enable Extended Wake Timeout
> 
> On Fri, Jan 17, 2025 at 11:18:50AM +0530, Suraj Kandpal wrote:
> > Usually retimers take around 30 to 40ms to exit all devices from sleep
> > state. Extended wake timeout request helps to give additional time by
> > reading the DPCD register through which sink requests the minimal
> > amount of time required to wake the sink up.
> > Source  device shall keep retying  the AUX tansaction till the
> > extended timeout that is being granted for LTTPRs from the sink device
> >
> > --v2
> > -Grant the requested time only if greater than 1ms [Arun] -Reframe
> > commit message [Arun]
> >
> > Spec: DP v2.1 Section 3.6.12.3
> > Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
> > ---
> >  drivers/gpu/drm/i915/display/intel_ddi.c      |  2 +
> >  .../drm/i915/display/intel_dp_link_training.c | 49
> > +++++++++++++++++++  .../drm/i915/display/intel_dp_link_training.h |
> > 1 +
> >  3 files changed, 52 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c
> > b/drivers/gpu/drm/i915/display/intel_ddi.c
> > index acb986bc1f33..96cabe618678 100644
> > --- a/drivers/gpu/drm/i915/display/intel_ddi.c
> > +++ b/drivers/gpu/drm/i915/display/intel_ddi.c
> > @@ -2645,6 +2645,8 @@ static void mtl_ddi_pre_enable_dp(struct
> intel_atomic_state *state,
> >  	if (!is_mst)
> >  		intel_dp_set_power(intel_dp, DP_SET_POWER_D0);
> >
> > +	intel_dp_lttpr_wake_timeout_setup(intel_dp);
> > +
> >  	intel_dp_configure_protocol_converter(intel_dp, crtc_state);
> >  	if (!is_mst)
> >  		intel_dp_sink_enable_decompression(state,
> > diff --git a/drivers/gpu/drm/i915/display/intel_dp_link_training.c
> > b/drivers/gpu/drm/i915/display/intel_dp_link_training.c
> > index 8b1977cfec50..c113b0be259e 100644
> > --- a/drivers/gpu/drm/i915/display/intel_dp_link_training.c
> > +++ b/drivers/gpu/drm/i915/display/intel_dp_link_training.c
> > @@ -135,6 +135,55 @@ static bool
> intel_dp_lttpr_transparent_mode_enabled(struct intel_dp *intel_dp)
> >  		DP_PHY_REPEATER_MODE_TRANSPARENT;
> >  }
> >
> > +void intel_dp_lttpr_wake_timeout_setup(struct intel_dp *intel_dp)
> 
> Please move this function to drivers/gpu/drm/display/drm_dp_helper.c
> Except for the intel_dp_lttpr_transparent_mode_enabled() call there is
> nothing Intel-specific there.
> 

Sure will do.

Regards,
Suraj Kandpal
> > +{
> > +	struct intel_display *display = to_intel_display(intel_dp);
> > +	u8 val = 1;
> > +	int ret;
> > +
> > +	if (intel_dp_lttpr_transparent_mode_enabled(intel_dp)) {
> > +		static const u8 timeout_mapping[] = {
> > +			[DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_1_MS] =
> 1,
> > +			[DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_20_MS]
> = 20,
> > +			[DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_40_MS]
> = 40,
> > +			[DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_20_MS]
> = 20,
> > +			[DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_80_MS]
> = 80,
> > +			[DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_100_MS]
> = 100,
> > +		};
> > +
> > +		ret = drm_dp_dpcd_readb(&intel_dp->aux,
> > +
> 	DP_EXTENDED_DPRX_SLEEP_WAKE_TIMEOUT_REQUEST, &val);
> > +		if (ret != 1) {
> > +			drm_dbg_kms(display->drm,
> > +				    "Failed to read Extended sleep wake
> timeout request\n");
> > +			return;
> > +		}
> > +
> > +		val = (val < sizeof(timeout_mapping) &&
> timeout_mapping[val]) ?
> > +			timeout_mapping[val] : 1;
> > +
> > +		if (val > 1)
> > +			drm_dp_dpcd_writeb(&intel_dp->aux,
> > +
> DP_EXTENDED_DPRX_SLEEP_WAKE_TIMEOUT_GRANT,
> > +
> DP_DPRX_SLEEP_WAKE_TIMEOUT_PERIOD_GRANTED);
> > +	} else {
> > +		ret = drm_dp_dpcd_readb(&intel_dp->aux,
> > +
> 	DP_PHY_REPEATER_EXTENDED_WAIT_TIMEOUT, &val);
> > +		if (ret != 1) {
> > +			drm_dbg_kms(display->drm,
> > +				    "Failed to read Extended sleep wake
> timeout request\n");
> > +			return;
> > +		}
> > +
> > +		val = (val &
> DP_EXTENDED_WAKE_TIMEOUT_REQUEST_MASK) ?
> > +			(val &
> DP_EXTENDED_WAKE_TIMEOUT_REQUEST_MASK) * 10 : 1;
> > +
> > +		if (val > 1)
> > +			drm_dp_dpcd_writeb(&intel_dp->aux,
> DP_PHY_REPEATER_EXTENDED_WAIT_TIMEOUT,
> > +
> DP_EXTENDED_WAKE_TIMEOUT_GRANT);
> > +	}
> > +}
> > +
> >  /*
> >   * Read the LTTPR common capabilities and switch the LTTPR PHYs to
> >   * non-transparent mode if this is supported. Preserve the diff --git
> > a/drivers/gpu/drm/i915/display/intel_dp_link_training.h
> > b/drivers/gpu/drm/i915/display/intel_dp_link_training.h
> > index 2066b9146762..cd4e0d6db6ed 100644
> > --- a/drivers/gpu/drm/i915/display/intel_dp_link_training.h
> > +++ b/drivers/gpu/drm/i915/display/intel_dp_link_training.h
> > @@ -15,6 +15,7 @@ struct intel_dp;
> >
> >  int intel_dp_read_dprx_caps(struct intel_dp *intel_dp, u8
> > dpcd[DP_RECEIVER_CAP_SIZE]);  int
> > intel_dp_init_lttpr_and_dprx_caps(struct intel_dp *intel_dp);
> > +void intel_dp_lttpr_wake_timeout_setup(struct intel_dp *intel_dp);
> >
> >  void intel_dp_link_training_set_mode(struct intel_dp *intel_dp,
> >  				     int link_rate, bool is_vrr);
> > --
> > 2.34.1
> >
> 
> --
> With best wishes
> Dmitry

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2025-01-21  4:45 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-13  6:03 [PATCH 0/2] Extended Wake Timeout Suraj Kandpal
2024-12-13  6:03 ` [PATCH 1/2] drm/dp: Add the DPCD register required for Extended wake timeout Suraj Kandpal
2024-12-13  6:03 ` [PATCH 2/2] drm/i915/lttpr: Enable Extended Wake Timeout Suraj Kandpal
2024-12-20 17:54   ` kernel test robot
2024-12-21  0:49   ` kernel test robot
2024-12-21  1:42   ` kernel test robot
2024-12-31 12:22   ` Vodapalli, Ravi Kumar
2024-12-31 13:54     ` Jani Nikula
2024-12-13  6:38 ` ✗ Fi.CI.BUILD: failure for " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2025-01-17  5:48 [PATCH 0/2] " Suraj Kandpal
2025-01-17  5:48 ` [PATCH 2/2] drm/i915/lttpr: Enable " Suraj Kandpal
2025-01-17  6:19   ` Dmitry Baryshkov
2025-01-21  4:44     ` Kandpal, Suraj

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox