Skip to content

Commit 77312ae

Browse files
Vathsala Nagarajujnikula
Vathsala Nagaraju
authored andcommitted
drm/i915/psr: vbt change for psr
For psr block #9, the vbt description has moved to options [0-3] for TP1,TP2,TP3 Wakeup time from decimal value without any change to vbt structure. Since spec does not mention from which VBT version this change was added to vbt.bsf file, we cannot depend on bdb->version check to change for all the platforms. There is RCR inplace for GOP team to provide the version number to make generic change. Since Kabylake with bdb version 209 is having this change, limiting this change to gen9_bc and version 209+ to unblock google. Tested on skl(bdb version 203,without options) and kabylake(bdb version 209,212) having new options. bspec 20131 v2: (Jani and Rodrigo) move the 165 version check to intel_bios.c v3: Jani Move the abstraction to intel_bios. v4: Jani Rename tp*_wakeup_time to have "us" suffix. For values outside range[0-3],default to max 2500us. Old decimal value was wake up time in multiples of 100us. v5: Jani and Rodrigo Handle option 2 in default condition. Print oustide range value. For negetive values default to 2500us. v6: Jani Handle default first and then fall through for case 2. v7: Rodrigo Apply this change for IS_GEN9_BC and vbt version > 209 v8: Puthik Add new function vbt_psr_to_us. v9: Jani Change to v7 version as it's more readable. DK add comment /*fall through*/ after case2. Cc: Rodrigo Vivi <[email protected]> Cc: Puthikorn Voravootivat <[email protected]> Cc: Dhinakaran Pandiyan <[email protected]> Cc: Jani Nikula <[email protected]> Cc: José Roberto de Souza <[email protected]> Signed-off-by: Maulik V Vaghela <[email protected]> Signed-off-by: Vathsala Nagaraju <[email protected]> Reviewed-by: Jani Nikula <[email protected]> Signed-off-by: Jani Nikula <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent fe864b7 commit 77312ae

File tree

4 files changed

+72
-27
lines changed

4 files changed

+72
-27
lines changed

drivers/gpu/drm/i915/i915_drv.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,8 +1077,8 @@ struct intel_vbt_data {
10771077
bool require_aux_wakeup;
10781078
int idle_frames;
10791079
enum psr_lines_to_wait lines_to_wait;
1080-
int tp1_wakeup_time;
1081-
int tp2_tp3_wakeup_time;
1080+
int tp1_wakeup_time_us;
1081+
int tp2_tp3_wakeup_time_us;
10821082
} psr;
10831083

10841084
struct {

drivers/gpu/drm/i915/i915_reg.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4092,10 +4092,10 @@ enum {
40924092
#define EDP_Y_COORDINATE_ENABLE (1<<25) /* GLK and CNL+ */
40934093
#define EDP_MAX_SU_DISABLE_TIME(t) ((t)<<20)
40944094
#define EDP_MAX_SU_DISABLE_TIME_MASK (0x1f<<20)
4095-
#define EDP_PSR2_TP2_TIME_500 (0<<8)
4096-
#define EDP_PSR2_TP2_TIME_100 (1<<8)
4097-
#define EDP_PSR2_TP2_TIME_2500 (2<<8)
4098-
#define EDP_PSR2_TP2_TIME_50 (3<<8)
4095+
#define EDP_PSR2_TP2_TIME_500us (0<<8)
4096+
#define EDP_PSR2_TP2_TIME_100us (1<<8)
4097+
#define EDP_PSR2_TP2_TIME_2500us (2<<8)
4098+
#define EDP_PSR2_TP2_TIME_50us (3<<8)
40994099
#define EDP_PSR2_TP2_TIME_MASK (3<<8)
41004100
#define EDP_PSR2_FRAME_BEFORE_SU_SHIFT 4
41014101
#define EDP_PSR2_FRAME_BEFORE_SU_MASK (0xf<<4)

drivers/gpu/drm/i915/intel_bios.c

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -684,8 +684,52 @@ parse_psr(struct drm_i915_private *dev_priv, const struct bdb_header *bdb)
684684
break;
685685
}
686686

687-
dev_priv->vbt.psr.tp1_wakeup_time = psr_table->tp1_wakeup_time;
688-
dev_priv->vbt.psr.tp2_tp3_wakeup_time = psr_table->tp2_tp3_wakeup_time;
687+
/*
688+
* New psr options 0=500us, 1=100us, 2=2500us, 3=0us
689+
* Old decimal value is wake up time in multiples of 100 us.
690+
*/
691+
if (bdb->version >= 209 && IS_GEN9_BC(dev_priv)) {
692+
switch (psr_table->tp1_wakeup_time) {
693+
case 0:
694+
dev_priv->vbt.psr.tp1_wakeup_time_us = 500;
695+
break;
696+
case 1:
697+
dev_priv->vbt.psr.tp1_wakeup_time_us = 100;
698+
break;
699+
case 3:
700+
dev_priv->vbt.psr.tp1_wakeup_time_us = 0;
701+
break;
702+
default:
703+
DRM_DEBUG_KMS("VBT tp1 wakeup time value %d is outside range[0-3], defaulting to max value 2500us\n",
704+
psr_table->tp1_wakeup_time);
705+
/* fallthrough */
706+
case 2:
707+
dev_priv->vbt.psr.tp1_wakeup_time_us = 2500;
708+
break;
709+
}
710+
711+
switch (psr_table->tp2_tp3_wakeup_time) {
712+
case 0:
713+
dev_priv->vbt.psr.tp2_tp3_wakeup_time_us = 500;
714+
break;
715+
case 1:
716+
dev_priv->vbt.psr.tp2_tp3_wakeup_time_us = 100;
717+
break;
718+
case 3:
719+
dev_priv->vbt.psr.tp1_wakeup_time_us = 0;
720+
break;
721+
default:
722+
DRM_DEBUG_KMS("VBT tp2_tp3 wakeup time value %d is outside range[0-3], defaulting to max value 2500us\n",
723+
psr_table->tp2_tp3_wakeup_time);
724+
/* fallthrough */
725+
case 2:
726+
dev_priv->vbt.psr.tp2_tp3_wakeup_time_us = 2500;
727+
break;
728+
}
729+
} else {
730+
dev_priv->vbt.psr.tp1_wakeup_time_us = psr_table->tp1_wakeup_time * 100;
731+
dev_priv->vbt.psr.tp2_tp3_wakeup_time_us = psr_table->tp2_tp3_wakeup_time * 100;
732+
}
689733
}
690734

691735
static void parse_dsi_backlight_ports(struct drm_i915_private *dev_priv,

drivers/gpu/drm/i915/intel_psr.c

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -461,23 +461,23 @@ static void hsw_activate_psr1(struct intel_dp *intel_dp)
461461
if (dev_priv->psr.link_standby)
462462
val |= EDP_PSR_LINK_STANDBY;
463463

464-
if (dev_priv->vbt.psr.tp1_wakeup_time > 5)
465-
val |= EDP_PSR_TP1_TIME_2500us;
466-
else if (dev_priv->vbt.psr.tp1_wakeup_time > 1)
467-
val |= EDP_PSR_TP1_TIME_500us;
468-
else if (dev_priv->vbt.psr.tp1_wakeup_time > 0)
464+
if (dev_priv->vbt.psr.tp1_wakeup_time_us == 0)
465+
val |= EDP_PSR_TP1_TIME_0us;
466+
else if (dev_priv->vbt.psr.tp1_wakeup_time_us <= 100)
469467
val |= EDP_PSR_TP1_TIME_100us;
468+
else if (dev_priv->vbt.psr.tp1_wakeup_time_us <= 500)
469+
val |= EDP_PSR_TP1_TIME_500us;
470470
else
471-
val |= EDP_PSR_TP1_TIME_0us;
471+
val |= EDP_PSR_TP1_TIME_2500us;
472472

473-
if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 5)
474-
val |= EDP_PSR_TP2_TP3_TIME_2500us;
475-
else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 1)
476-
val |= EDP_PSR_TP2_TP3_TIME_500us;
477-
else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 0)
473+
if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us == 0)
474+
val |= EDP_PSR_TP2_TP3_TIME_0us;
475+
else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us <= 100)
478476
val |= EDP_PSR_TP2_TP3_TIME_100us;
477+
else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us <= 500)
478+
val |= EDP_PSR_TP2_TP3_TIME_500us;
479479
else
480-
val |= EDP_PSR_TP2_TP3_TIME_0us;
480+
val |= EDP_PSR_TP2_TP3_TIME_2500us;
481481

482482
if (intel_dp_source_supports_hbr2(intel_dp) &&
483483
drm_dp_tps3_supported(intel_dp->dpcd))
@@ -513,14 +513,15 @@ static void hsw_activate_psr2(struct intel_dp *intel_dp)
513513

514514
val |= EDP_PSR2_FRAME_BEFORE_SU(dev_priv->psr.sink_sync_latency + 1);
515515

516-
if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 5)
517-
val |= EDP_PSR2_TP2_TIME_2500;
518-
else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 1)
519-
val |= EDP_PSR2_TP2_TIME_500;
520-
else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 0)
521-
val |= EDP_PSR2_TP2_TIME_100;
516+
if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us >= 0 &&
517+
dev_priv->vbt.psr.tp2_tp3_wakeup_time_us <= 50)
518+
val |= EDP_PSR2_TP2_TIME_50us;
519+
else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us <= 100)
520+
val |= EDP_PSR2_TP2_TIME_100us;
521+
else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us <= 500)
522+
val |= EDP_PSR2_TP2_TIME_500us;
522523
else
523-
val |= EDP_PSR2_TP2_TIME_50;
524+
val |= EDP_PSR2_TP2_TIME_2500us;
524525

525526
I915_WRITE(EDP_PSR2_CTL, val);
526527
}

0 commit comments

Comments
 (0)