Skip to content

[Deepin-Kernel-SIG] [linux 6.6-y] [Deepin] config: deepin_arm64_desktop_defconfig: enable phytium drivers #803

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: linux-6.6.y
Choose a base branch
from

Conversation

opsiff
Copy link
Member

@opsiff opsiff commented May 15, 2025

CONFIG_MTD_PHYTIUM_LBC=m
CONFIG_SERIAL_PHYTIUM_UART_V2=m
CONFIG_I2C_V2_PLATFORM=m
CONFIG_SPI_PHYTIUM_PLAT_V2=m
CONFIG_SND_SOC_PHYTIUM_I2S_V2=m
CONFIG_SND_SOC_PHYTIUM_MACHINE_V2=m
CONFIG_SND_SOC_PHYTIUM_CODEC_V2=m
CONFIG_HID_UNIVERSAL_PIDFF=m
CONFIG_USB_PHYTIUM_PCI_V2=m
CONFIG_USB_PHYTIUM_V2=m
CONFIG_TYPEC_PHYTIUM_RS=m
CONFIG_PHYTIUM_GDMA=y
CONFIG_PHYTIUM_NPU=m
CONFIG_NPU_PLATFORM=m
CONFIG_PHYTIUM_NPU_PCI=m
CONFIG_SMMU_BYPASS_DEV=y

Summary by Sourcery

Build:

  • Enable Phytium MTD, serial, I²C, SPI, audio, USB, Type-C, NPU, PCI and GDMA drivers and enable SMMU bypass in deepin_arm64_desktop_defconfig

Copy link

sourcery-ai bot commented May 15, 2025

Reviewer's Guide

This PR updates the deepin_arm64_desktop_defconfig to enable a set of PHYTIUM platform, USB/Type-C, audio, and accelerator drivers (GDMA/NPU) along with SMMU bypass support.

File-Level Changes

Change Details Files
Enable PHYTIUM platform peripheral drivers
  • MTD PHYTIUM LBC driver as module
  • PHYTIUM UART v2 serial driver as module
  • I2C v2 platform driver as module
  • PHYTIUM v2 SPI platform driver as module
  • Universal HID force-feedback support
arch/arm64/configs/deepin_arm64_desktop_defconfig
Enable PHYTIUM USB and Type-C PHY drivers
  • PHYTIUM PCI USB PHY v2 as module
  • PHYTIUM USB PHY v2 as module
  • PHYTIUM Type-C port controller support as module
arch/arm64/configs/deepin_arm64_desktop_defconfig
Enable PHYTIUM sound subsystem drivers
  • PHYTIUM I2S v2 codec driver as module
  • PHYTIUM machine driver as module
  • PHYTIUM codec driver as module
arch/arm64/configs/deepin_arm64_desktop_defconfig
Enable PHYTIUM accelerator and SMMU bypass support
  • PHYTIUM GDMA driver built-in
  • PHYTIUM NPU driver as module
  • Generic NPU platform support as module
  • PHYTIUM NPU PCI interface as module
  • Enable SMMU bypass for devices
arch/arm64/configs/deepin_arm64_desktop_defconfig

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

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 @opsiff - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

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.

@Avenger-285714
Copy link
Collaborator

/lgtm

@deepin-ci-robot
Copy link

New changes are detected. LGTM label has been removed.

@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 avenger-285714. For more information see the Code Review Process.

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

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

drivers/spi/spi-phytium-common.c:333:7: error: variable 'ret' is uninitialized when used here [-Werror,-Wuninitialized]
   333 |                 if (ret) {
       |                     ^~~
   CC [M]  drivers/input/serio/pcips2.o
 drivers/spi/spi-phytium-common.c:325:9: note: initialize the variable 'ret' to silence this warning
   325 |         int ret;
       |                ^
       |                 = 0
1 error generated.

Signed-off-by: Wentao Guan <[email protected]>
@deepin-ci-robot
Copy link

deepin pr auto review

代码审查意见:

  1. spi-phytium-common.c文件中,spi_phytium_write函数的返回值被初始化为0,这可能会导致在某些情况下返回错误的值。建议在函数开始时不要初始化返回值,而是在需要时返回具体的错误码。

  2. phytium_usb_v2/pci.c文件中,phytium_pci_probe函数中存在两次检查phytium_usb是否为NULL的情况。第一次检查是在pci_is_enabled(pdev)之后,第二次检查是在kzalloc之后。第二次检查是多余的,因为如果phytium_usb不为NULL,则说明kzalloc已经成功分配了内存。

  3. phytium_usb_v2/pci.c文件中,phytium_pci_probe函数中的注释//otg resource init应该使用更正式的注释格式,例如/* OTG资源初始化 */,以提高代码的可读性。

  4. phytium_usb_v2/pci.c文件中,phytium_pci_probe函数中的phytium_usb指针在分配内存失败后没有释放,可能会导致内存泄漏。建议在kzalloc失败后,使用kfree释放已经分配的内存。

  5. phytium_usb_v2/pci.c文件中,phytium_pci_probe函数中的pci_set_master(pdev)调用应该在phytium_usb指针分配成功之后进行,以确保在分配失败时不会设置主设备。

  6. phytium_usb_v2/pci.c文件中,phytium_pci_probe函数中的pci_get_drvdata(pdev)调用应该在phytium_usb指针分配成功之后进行,以确保在分配失败时不会获取驱动程序数据。

  7. phytium_usb_v2/pci.c文件中,phytium_pci_probe函数中的phytium_usb指针在分配成功后没有设置到pci_devdriver_data字段中,这可能会导致在pci_dev被其他函数使用时出现问题。建议在phytium_usb指针分配成功后,使用pci_set_drvdata(pdev, phytium_usb)将指针设置到pci_devdriver_data字段中。

  8. phytium_usb_v2/pci.c文件中,phytium_pci_probe函数中的phytium_usb指针在分配成功后没有初始化,这可能会导致在使用指针时出现问题。建议在phytium_usb指针分配成功后,对指针进行初始化,以确保在使用指针时不会出现未定义的行为。

  9. phytium_usb_v2/pci.c文件中,phytium_pci_probe函数中的phytium_usb指针在分配成功后没有设置到pci_devdriver_data字段中,这可能会导致在pci_dev被其他函数使用时出现问题。建议在phytium_usb指针分配成功后,使用pci_set_drvdata(pdev, phytium_usb)将指针设置到pci_devdriver_data字段中。

  10. phytium_usb_v2/pci.c文件中,phytium_pci_probe函数中的phytium_usb指针在分配成功后没有初始化,这可能会导致在使用指针时出现问题。建议在phytium_usb指针分配成功后,对指针进行初始化,以确保在使用指针时不会出现未定义的行为。

@opsiff opsiff force-pushed the linux-6.6.y-2025-05-15-phytium-config branch 2 times, most recently from ee2b7d6 to 3bccbc0 Compare May 16, 2025 03:06
opsiff added 2 commits May 16, 2025 17:41
Log:
drivers/usb/phytium_usb_v2/pci.c:33:6: error: variable 'phytium_usb' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
    33 |         if (pci_is_enabled(pdev)) {
       |             ^~~~~~~~~~~~~~~~~~~~
drivers/usb/phytium_usb_v2/pci.c:45:2: note: uninitialized use occurs here
   45 |         phytium_usb->otg_res.start = pci_resource_start(pdev, 0);
      |         ^~~~~~~~~~~
drivers/usb/phytium_usb_v2/pci.c:33:2: note: remove the 'if' if its condition is always true
   33 |         if (pci_is_enabled(pdev)) {
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~
drivers/usb/phytium_usb_v2/pci.c:24:33: note: initialize the variable 'phytium_usb' to silence this warning
   24 |         struct phytium_usb *phytium_usb;
      |                                        ^
      |                                         = NULL
1 error generated.
similar to the following logic:
	pci_set_master(pdev);
	if (pci_is_enabled(func)) {
		cdnsp = pci_get_drvdata(func);
	} else {
		cdnsp = kzalloc(sizeof(*cdnsp), GFP_KERNEL);
		if (!cdnsp) {
			ret = -ENOMEM;
			goto disable_pci;
		}
	}

Signed-off-by: Wentao Guan <[email protected]>
CONFIG_MTD_PHYTIUM_LBC=m
CONFIG_SERIAL_PHYTIUM_UART_V2=m
CONFIG_I2C_V2_PLATFORM=m
CONFIG_SPI_PHYTIUM_PLAT_V2=m
CONFIG_SND_SOC_PHYTIUM_I2S_V2=m
CONFIG_SND_SOC_PHYTIUM_MACHINE_V2=m
CONFIG_SND_SOC_PHYTIUM_CODEC_V2=m
CONFIG_HID_UNIVERSAL_PIDFF=m
CONFIG_USB_PHYTIUM_PCI_V2=m
CONFIG_USB_PHYTIUM_V2=m
CONFIG_TYPEC_PHYTIUM_RS=m
CONFIG_PHYTIUM_GDMA=y
CONFIG_PHYTIUM_NPU=m
CONFIG_NPU_PLATFORM=m
CONFIG_PHYTIUM_NPU_PCI=m
CONFIG_SMMU_BYPASS_DEV=y

Signed-off-by: Wentao Guan <[email protected]>
@opsiff opsiff force-pushed the linux-6.6.y-2025-05-15-phytium-config branch from 3bccbc0 to c1a6ab3 Compare May 16, 2025 09:42
opsiff added 3 commits May 16, 2025 19:22
Log:
2025-05-16T12:01:20.8409093Z drivers/usb/phytium_usb_v2/gadget.c:1563:6: error: variable 'ret' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
2025-05-16T12:01:20.8411014Z  1563 |         if (!pdev->setup_buf)
2025-05-16T12:01:20.8411857Z       |             ^~~~~~~~~~~~~~~~
2025-05-16T12:01:20.8412989Z drivers/usb/phytium_usb_v2/gadget.c:1600:9: note: uninitialized use occurs here
2025-05-16T12:01:20.8414076Z  1600 |         return ret;
2025-05-16T12:01:20.8414775Z       |                ^~~
2025-05-16T12:01:20.8415931Z drivers/usb/phytium_usb_v2/gadget.c:1563:2: note: remove the 'if' if its condition is always false
2025-05-16T12:01:20.8417705Z  1563 |         if (!pdev->setup_buf)
2025-05-16T12:01:20.8418583Z       |         ^~~~~~~~~~~~~~~~~~~~~
2025-05-16T12:01:20.8419358Z  1564 |                 goto free_pdev;
2025-05-16T12:01:20.8420170Z       |                 ~~~~~~~~~~~~~~
2025-05-16T12:01:20.8421430Z drivers/usb/phytium_usb_v2/gadget.c:1525:9: note: initialize the variable 'ret' to silence this warning
2025-05-16T12:01:20.8422666Z  1525 |         int ret;
2025-05-16T12:01:20.8423346Z       |                ^
2025-05-16T12:01:20.8424036Z       |                 = 0
Signed-off-by: Wentao Guan <[email protected]>
Log:
2025-05-16T15:13:43.6129337Z drivers/staging/phytium-npu/phytium_npu_pci.c:82:16: error: variable 'reg_addr' is used uninitialized whenever 'for' loop exits because its condition is false [-Werror,-Wsometimes-uninitialized]
2025-05-16T15:13:43.6131548Z    82 |         for (bar = 0; bar < NUM_PCI_BARS; bar++) {
2025-05-16T15:13:43.6132195Z       |                       ^~~~~~~~~~~~~~~~~~
2025-05-16T15:13:43.6133127Z drivers/staging/phytium-npu/phytium_npu_pci.c:98:7: note: uninitialized use occurs here
2025-05-16T15:13:43.6134010Z    98 |         if (!reg_addr)
2025-05-16T15:13:43.6134457Z       |              ^~~~~~~~
2025-05-16T15:13:43.6135385Z drivers/staging/phytium-npu/phytium_npu_pci.c:82:16: note: remove the condition if it is always true
2025-05-16T15:13:43.6136692Z    82 |         for (bar = 0; bar < NUM_PCI_BARS; bar++) {
2025-05-16T15:13:43.6137381Z       |                       ^~~~~~~~~~~~~~~~~~
2025-05-16T15:13:43.6138490Z drivers/staging/phytium-npu/phytium_npu_pci.c:52:24: note: initialize the variable 'reg_addr' to silence this warning
2025-05-16T15:13:43.6139510Z    52 |         void __iomem *reg_addr;
2025-05-16T15:13:43.6140038Z       |                               ^
2025-05-16T15:13:43.6140541Z       |                                = NULL
2025-05-16T15:13:43.6141173Z 1 error generated.
Signed-off-by: Wentao Guan <[email protected]>
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.

3 participants