Skip to content

PM: phytium: update phytium PM controller driver support to 6.6.0.4 - #2241

Merged
opsiff merged 2 commits into
deepin-community:linux-6.6.yfrom
wangchenlu2236:pm-6.6.y
Nov 5, 2026
Merged

opsiff merged 2 commits into
deepin-community:linux-6.6.yfrom
wangchenlu2236:pm-6.6.y

Conversation

@wangchenlu2236

@wangchenlu2236 wangchenlu2236 commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

This patches updates the support for phytium PM controller driver.
1.PM: power: Add a standby system state on Phytium platforms

Summary by Sourcery

Support standby and memory suspend states for Phytium power-management controllers.

New Features:

  • Add standby system suspend support for Phytium PD2408 platforms.

Enhancements:

  • Select Phytium-specific suspend operations when supported while preserving the generic PSCI suspend path for other platforms.

@sourcery-ai

sourcery-ai Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Adds platform-specific standby suspend support for Phytium PD2408 by selecting custom PSCI SYSTEM_SUSPEND parameters and permitting both standby and memory suspend states, while preserving the existing generic PSCI behavior on other platforms.

Sequence diagram for Phytium PD2408 suspend selection

sequenceDiagram
    participant Kernel
    participant PSCI
    participant Firmware
    Kernel->>PSCI: psci_init_system_suspend()
    PSCI->>PSCI: is_pd2408()
    alt Phytium PD2408
        PSCI->>Kernel: suspend_set_ops(phytium_psci_suspend_ops)
        Kernel->>PSCI: phytium_psci_system_suspend_enter(state)
        PSCI->>PSCI: cpu_suspend(state, phytium_psci_system_suspend)
        alt PM_SUSPEND_STANDBY
            PSCI->>Firmware: SYSTEM_SUSPEND(pa_cpu_resume, 0x544600c2, 0)
        else PM_SUSPEND_MEM
            PSCI->>Firmware: SYSTEM_SUSPEND(pa_cpu_resume, 0, 0)
        end
    else Other platform
        PSCI->>Kernel: suspend_set_ops(psci_suspend_ops)
        Kernel->>Firmware: Generic SYSTEM_SUSPEND
    end
Loading

Flow diagram for Phytium suspend state validation

flowchart TD
    A[Requested suspend state] --> B{Phytium platform}
    B -->|No| C[Use generic suspend validation]
    B -->|Yes| D{State is PM_SUSPEND_STANDBY or PM_SUSPEND_MEM}
    D -->|Yes| E[Allow suspend]
    D -->|No| F[Reject state]
Loading

File-Level Changes

Change Details Files
Adds Phytium-specific PSCI suspend handling for standby and memory sleep states.
  • Introduces a Phytium PSCI SYSTEM_SUSPEND wrapper that passes a standby-specific context value.
  • Routes suspend entry through cpu_suspend and registers platform suspend operations for the affected platform.
  • Selects the Phytium suspend implementation only for PD2408, retaining the generic PSCI path elsewhere.
drivers/firmware/psci/psci.c
Extends suspend-state validation to allow standby on Phytium platforms.
  • Adds a Phytium-specific validation helper accepting PM_SUSPEND_MEM and PM_SUSPEND_STANDBY.
  • Exports the helper for use by the PSCI suspend operations.
include/linux/suspend.h
kernel/power/suspend.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
Copy Markdown

Hi @wangchenlu2236. Thanks for your PR.

I'm waiting for a deepin-community member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@deepin-ci-robot

Copy link
Copy Markdown

[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 assign lanlanxiyiji for approval. 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

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="drivers/firmware/psci/psci.c" line_range="506" />
<code_context>
+	phys_addr_t pa_cpu_resume = __pa_symbol(cpu_resume);
+
+	if (state == PM_SUSPEND_STANDBY)
+		return invoke_psci_fn(PSCI_FN_NATIVE(1_0, SYSTEM_SUSPEND),
+				pa_cpu_resume, 0x544600c2, 0);
+	else
</code_context>
<issue_to_address>
**Suspend failures report wrong errno**

When PSCI SYSTEM_SUSPEND returns an error for standby or memory suspend, `phytium_psci_system_suspend` returns the raw firmware status through `cpu_suspend()` to the PM core instead of translating it with `psci_to_linux_errno()`; for example, `PSCI_RET_DENIED` reaches callers as `-3` (`-ESRCH`) rather than `-EPERM`, so they see the wrong suspend failure reason.

Translate each `invoke_psci_fn()` result with `psci_to_linux_errno()` before returning it.

Also at `drivers/firmware/psci/psci.c:507-510`.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨

phys_addr_t pa_cpu_resume = __pa_symbol(cpu_resume);

if (state == PM_SUSPEND_STANDBY)
return invoke_psci_fn(PSCI_FN_NATIVE(1_0, SYSTEM_SUSPEND),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Medium · Suspend failures report wrong errno

When PSCI SYSTEM_SUSPEND returns an error for standby or memory suspend, phytium_psci_system_suspend returns the raw firmware status through cpu_suspend() to the PM core instead of translating it with psci_to_linux_errno(); for example, PSCI_RET_DENIED reaches callers as -3 (-ESRCH) rather than -EPERM, so they see the wrong suspend failure reason.

Translate each invoke_psci_fn() result with psci_to_linux_errno() before returning it.

Also at drivers/firmware/psci/psci.c:507-510.

Prompt for AI agents
In `drivers/firmware/psci/psci.c` at line 506:

**Suspend failures report wrong errno**

When PSCI SYSTEM_SUSPEND returns an error for standby or memory suspend, `phytium_psci_system_suspend` returns the raw firmware status through `cpu_suspend()` to the PM core instead of translating it with `psci_to_linux_errno()`; for example, `PSCI_RET_DENIED` reaches callers as `-3` (`-ESRCH`) rather than `-EPERM`, so they see the wrong suspend failure reason.

Translate each `invoke_psci_fn()` result with `psci_to_linux_errno()` before returning it.

Also at `drivers/firmware/psci/psci.c:507-510`.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Phytium builds are blocked by an unguarded suspend callback reference when CONFIG_SUSPEND=n and a dangling else treated as an error under CONFIG_WERROR.

3 open issues
What changed in this PR

Introduces PSCI-based standby support for Phytium PD2408 platforms while retaining generic suspend handling elsewhere.

Changes:

  • Add a Phytium validator accepting standby and memory suspend states.
  • Select PD2408-specific suspend operations and pass a firmware selector for standby.
File Description
kernel/​power/​suspend.c Adds and exports the Phytium suspend-state validator.
include/​linux/​suspend.h Declares the validator under CONFIG_ARCH_PHYTIUM.
drivers/​firmware/​psci/​psci.c Adds Phytium suspend callbacks and selects them for PD2408.

Review effort: Max



static const struct platform_suspend_ops phytium_psci_suspend_ops = {
.valid = phytium_suspend_valid_mem,
Comment on lines 564 to +572
if (ret != PSCI_RET_NOT_SUPPORTED)
#ifdef CONFIG_ARCH_PHYTIUM
if (is_pd2408())
suspend_set_ops(&phytium_psci_suspend_ops);
else
suspend_set_ops(&psci_suspend_ops);
#else
suspend_set_ops(&psci_suspend_ops);
#endif
Comment on lines +503 to +510
phys_addr_t pa_cpu_resume = __pa_symbol(cpu_resume);

if (state == PM_SUSPEND_STANDBY)
return invoke_psci_fn(PSCI_FN_NATIVE(1_0, SYSTEM_SUSPEND),
pa_cpu_resume, 0x544600c2, 0);
else
return invoke_psci_fn(PSCI_FN_NATIVE(1_0, SYSTEM_SUSPEND),
pa_cpu_resume, 0, 0);
This patch adds a "standby" system state on phytium SoCs, This state has
a power consumption level between S2idle and S3, but it provides
better system responsiveness.

Mainline: NA
Signed-off-by: Wang Xu <wangxu@phytium.com.cn>
Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
Signed-off-by: Wang Chenlu <wangchenlu2236@phytium.com.cn>
@opsiff
opsiff merged commit 57af456 into deepin-community:linux-6.6.y Nov 5, 2026
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants