Skip to content

Commit cd1aa3e

Browse files
hogandergregkh
authored andcommitted
drm/i915/psr: Check drm_dp_dpcd_read return value on PSR dpcd init
[ Upstream commit 9cc10041e9fe7f32c4817e3cdd806ff1986d266c ] Currently we are ignoriong drm_dp_dpcd_read return values when reading PSR and Panel Replay capability DPCD register. Rework intel_psr_dpcd a bit to take care of checking the return value. v2: use drm_dp_dpcd_read_data Signed-off-by: Jouni Högander <[email protected]> Reviewed-by: Jani Nikula <[email protected]> Link: https://lore.kernel.org/r/[email protected] Stable-dep-of: f2687d3cc9f9 ("drm/i915/dp_mst: Disable Panel Replay") Signed-off-by: Sasha Levin <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent abd29b6 commit cd1aa3e

1 file changed

Lines changed: 21 additions & 11 deletions

File tree

drivers/gpu/drm/i915/display/intel_psr.c

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,16 @@ static void intel_dp_get_su_granularity(struct intel_dp *intel_dp)
600600
static void _panel_replay_init_dpcd(struct intel_dp *intel_dp)
601601
{
602602
struct intel_display *display = to_intel_display(intel_dp);
603+
int ret;
604+
605+
ret = drm_dp_dpcd_read_data(&intel_dp->aux, DP_PANEL_REPLAY_CAP_SUPPORT,
606+
&intel_dp->pr_dpcd, sizeof(intel_dp->pr_dpcd));
607+
if (ret < 0)
608+
return;
609+
610+
if (!(intel_dp->pr_dpcd[INTEL_PR_DPCD_INDEX(DP_PANEL_REPLAY_CAP_SUPPORT)] &
611+
DP_PANEL_REPLAY_SUPPORT))
612+
return;
603613

604614
if (intel_dp_is_edp(intel_dp)) {
605615
if (!intel_alpm_aux_less_wake_supported(intel_dp)) {
@@ -631,6 +641,15 @@ static void _panel_replay_init_dpcd(struct intel_dp *intel_dp)
631641
static void _psr_init_dpcd(struct intel_dp *intel_dp)
632642
{
633643
struct intel_display *display = to_intel_display(intel_dp);
644+
int ret;
645+
646+
ret = drm_dp_dpcd_read_data(&intel_dp->aux, DP_PSR_SUPPORT, intel_dp->psr_dpcd,
647+
sizeof(intel_dp->psr_dpcd));
648+
if (ret < 0)
649+
return;
650+
651+
if (!intel_dp->psr_dpcd[0])
652+
return;
634653

635654
drm_dbg_kms(display->drm, "eDP panel supports PSR version %x\n",
636655
intel_dp->psr_dpcd[0]);
@@ -676,18 +695,9 @@ static void _psr_init_dpcd(struct intel_dp *intel_dp)
676695

677696
void intel_psr_init_dpcd(struct intel_dp *intel_dp)
678697
{
679-
drm_dp_dpcd_read(&intel_dp->aux, DP_PSR_SUPPORT, intel_dp->psr_dpcd,
680-
sizeof(intel_dp->psr_dpcd));
681-
682-
drm_dp_dpcd_read(&intel_dp->aux, DP_PANEL_REPLAY_CAP_SUPPORT,
683-
&intel_dp->pr_dpcd, sizeof(intel_dp->pr_dpcd));
684-
685-
if (intel_dp->pr_dpcd[INTEL_PR_DPCD_INDEX(DP_PANEL_REPLAY_CAP_SUPPORT)] &
686-
DP_PANEL_REPLAY_SUPPORT)
687-
_panel_replay_init_dpcd(intel_dp);
698+
_psr_init_dpcd(intel_dp);
688699

689-
if (intel_dp->psr_dpcd[0])
690-
_psr_init_dpcd(intel_dp);
700+
_panel_replay_init_dpcd(intel_dp);
691701

692702
if (intel_dp->psr.sink_psr2_support ||
693703
intel_dp->psr.sink_panel_replay_su_support)

0 commit comments

Comments
 (0)