Skip to content

Conversation

@opsiff
Copy link
Member

@opsiff opsiff commented Jan 27, 2026

mainline inclusion
from mainline-v6.8-rc6
category: bugfix

[Why]
The old asic only have 1 pwrseq hw.
We don't need to map the diginst to pwrseq inst in old asic.

[How]

  1. Only mapping dig to pwrseq for new asic.
  2. Move mapping function into dcn specific panel control component

Cc: Stable stable@vger.kernel.org # v6.6+
Cc: Mario Limonciello mario.limonciello@amd.com
Link: https://gitlab.freedesktop.org/drm/amd/-/issues/3122
Reviewed-by: Anthony Koo anthony.koo@amd.com
Acked-by: Rodrigo Siqueira rodrigo.siqueira@amd.com
Tested-by: Daniel Wheeler daniel.wheeler@amd.com
Signed-off-by: Lewis Huang lewis.huang@amd.com
Signed-off-by: Alex Deucher alexander.deucher@amd.com
(cherry picked from commit 4e73826)
Signed-off-by: Wentao Guan guanwentao@uniontech.com

Conflicts:
drivers/gpu/drm/amd/display/dc/link/link_factory.c

Summary by Sourcery

Scope panel power sequence handling to new DCN ASICs by moving DIG-to-power-sequence mapping into DCN-specific panel control code and simplifying legacy ASICs to use a fixed instance.

Bug Fixes:

  • Prevent incorrect DIG-to-power-sequence mappings on older ASICs by avoiding unnecessary mapping and centralizing it in DCN panel control initialization.

Enhancements:

  • Refine panel control initialization data to pass encoder IDs instead of precomputed power sequence instances, aligning responsibilities with DCN-specific panel control implementations.

mainline inclusion
from mainline-v6.8-rc6
category: bugfix

[Why]
The old asic only have 1 pwrseq hw.
We don't need to map the diginst to pwrseq inst in old asic.

[How]
1. Only mapping dig to pwrseq for new asic.
2. Move mapping function into dcn specific panel control component

Cc: Stable <stable@vger.kernel.org> # v6.6+
Cc: Mario Limonciello <mario.limonciello@amd.com>
Link: https://gitlab.freedesktop.org/drm/amd/-/issues/3122
Reviewed-by: Anthony Koo <anthony.koo@amd.com>
Acked-by: Rodrigo Siqueira <rodrigo.siqueira@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Lewis Huang <lewis.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 4e73826)
Signed-off-by: Wentao Guan <guanwentao@uniontech.com>

Conflicts:
	drivers/gpu/drm/amd/display/dc/link/link_factory.c
@sourcery-ai
Copy link

sourcery-ai bot commented Jan 27, 2026

Reviewer's Guide

Refactors eDP panel power sequence handling so that DIG engine to power sequence mapping is only applied for newer DCN ASICs within panel control components, while legacy DCE/DCN301 panels use a fixed pwrseq instance.

Sequence diagram for panel_cntl creation with ASIC-specific pwrseq mapping

sequenceDiagram
    participant LinkFactory
    participant ResPoolFuncs
    participant PanelCntl as panel_cntl
    participant Dcn31PanelCntl as dcn31_panel_cntl
    participant DcePanelCntl as dce_panel_cntl
    participant Dcn301PanelCntl as dcn301_panel_cntl

    LinkFactory->>LinkFactory: construct_phy(link, dc_ctx,...)
    Note over LinkFactory: panel_cntl_init_data.ctx = dc_ctx
    Note over LinkFactory: panel_cntl_init_data.inst = dc_edp_id_count
    Note over LinkFactory: panel_cntl_init_data.eng_id = link.eng_id

    LinkFactory->>ResPoolFuncs: panel_cntl_create(&panel_cntl_init_data)

    alt DCN31 new_asic
        ResPoolFuncs->>Dcn31PanelCntl: dcn31_panel_cntl_construct(dcn31_panel_cntl, init_data)
        Dcn31PanelCntl->>Dcn31PanelCntl: map eng_id to pwrseq_inst
        Dcn31PanelCntl->>PanelCntl: base.pwrseq_inst = pwrseq_inst
    else DCE legacy_asic
        ResPoolFuncs->>DcePanelCntl: dce_panel_cntl_construct(dce_panel_cntl, init_data)
        DcePanelCntl->>PanelCntl: base.pwrseq_inst = 0
    else DCN301 legacy_asic
        ResPoolFuncs->>Dcn301PanelCntl: dcn301_panel_cntl_construct(dcn301_panel_cntl, init_data)
        Dcn301PanelCntl->>PanelCntl: base.pwrseq_inst = 0
    end

    ResPoolFuncs-->>LinkFactory: panel_cntl pointer
Loading

Class diagram for updated panel_cntl initialization and ASIC-specific pwrseq mapping

classDiagram
    class panel_cntl_init_data {
        +dc_context* ctx
        +uint32_t inst
        +uint32_t eng_id
    }

    class panel_cntl {
        +panel_cntl_funcs* funcs
        +dc_context* ctx
        +uint32_t inst
        +uint32_t pwrseq_inst
    }

    class dcn31_panel_cntl {
        +panel_cntl base
        +void dcn31_panel_cntl_construct(dcn31_panel_cntl* dcn31_panel_cntl, panel_cntl_init_data* init_data)
    }

    class dce_panel_cntl {
        +panel_cntl base
        +void dce_panel_cntl_construct(dce_panel_cntl* dce_panel_cntl, panel_cntl_init_data* init_data)
    }

    class dcn301_panel_cntl {
        +panel_cntl base
        +void dcn301_panel_cntl_construct(dcn301_panel_cntl* dcn301_panel_cntl, panel_cntl_init_data* init_data)
    }

    dcn31_panel_cntl --|> panel_cntl
    dce_panel_cntl --|> panel_cntl
    dcn301_panel_cntl --|> panel_cntl

    panel_cntl_init_data --> dcn31_panel_cntl : used by
    panel_cntl_init_data --> dce_panel_cntl : used by
    panel_cntl_init_data --> dcn301_panel_cntl : used by
Loading

File-Level Changes

Change Details Files
Move DIG-to-power-sequence mapping from link_factory into DCN31 panel control and pass engine ID instead of precomputed pwrseq instance.
  • Remove translate_dig_inst_to_pwrseq_inst helper from link_factory and its use in PHY construction.
  • Change panel_cntl_init_data to carry eng_id instead of pwrseq_inst when constructing panel controllers.
  • Implement DIGA/DIGB-to-pwrseq mapping inside dcn31_panel_cntl_construct based on init_data->eng_id and assign the resulting pwrseq_inst to the base panel controller.
drivers/gpu/drm/amd/display/dc/link/link_factory.c
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_panel_cntl.c
drivers/gpu/drm/amd/display/dc/inc/hw/panel_cntl.h
Ensure legacy DCE and DCN301 panel controllers always use a fixed power sequence instance instead of DIG-based mapping.
  • Set base.pwrseq_inst to 0 in dce_panel_cntl_construct to reflect single pwrseq hardware on older ASICs.
  • Set base.pwrseq_inst to 0 in dcn301_panel_cntl_construct for the same legacy behavior.
drivers/gpu/drm/amd/display/dc/dce/dce_panel_cntl.c
drivers/gpu/drm/amd/display/dc/dcn301/dcn301_panel_cntl.c

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from opsiff. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • The new DIGA/DIGB-to-power-sequence mapping logic in dcn31_panel_cntl_construct() duplicates the old helper you removed from link_factory; consider centralizing this mapping in a DCN-specific helper to avoid future divergence if the mapping needs to change.
  • In the DCE and DCN301 panel constructors, the hard-coded pwrseq_inst = 0 for legacy ASICs is a bit implicit; a named constant or brief comment explaining why only instance 0 is valid there would make the intent clearer.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new DIGA/DIGB-to-power-sequence mapping logic in dcn31_panel_cntl_construct() duplicates the old helper you removed from link_factory; consider centralizing this mapping in a DCN-specific helper to avoid future divergence if the mapping needs to change.
- In the DCE and DCN301 panel constructors, the hard-coded `pwrseq_inst = 0` for legacy ASICs is a bit implicit; a named constant or brief comment explaining why only instance 0 is valid there would make the intent clearer.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a bug where old ASICs with only one power sequence hardware instance were incorrectly attempting to map DIG engine IDs to power sequence instances. The fix moves the mapping logic from common code to DCN31-specific panel control initialization, allowing old ASICs to simply use a fixed power sequence instance of 0.

Changes:

  • Removed the translate_dig_inst_to_pwrseq_inst() function from common link factory code
  • Changed the panel control initialization API to pass eng_id instead of pre-calculated pwrseq_inst
  • Implemented DIG-to-pwrseq mapping in DCN31+ panel control constructors for new ASICs with multiple power sequences
  • Configured old ASICs (DCE, DCN301) to use a fixed pwrseq_inst value of 0

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
drivers/gpu/drm/amd/display/dc/link/link_factory.c Removed the translate_dig_inst_to_pwrseq_inst() function and changed to pass eng_id instead of pwrseq_inst to panel control initialization
drivers/gpu/drm/amd/display/dc/inc/hw/panel_cntl.h Changed panel_cntl_init_data structure to use eng_id field instead of pwrseq_inst
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_panel_cntl.c Added DIG-to-pwrseq mapping logic for new ASICs with multiple power sequence hardware instances
drivers/gpu/drm/amd/display/dc/dcn301/dcn301_panel_cntl.c Configured to use fixed pwrseq_inst = 0 for old ASIC with single power sequence
drivers/gpu/drm/amd/display/dc/dce/dce_panel_cntl.c Configured to use fixed pwrseq_inst = 0 for old ASIC with single power sequence

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants