Skip to content

[PW_SID:955350] Change PWM-controlled LED pin active mode and algorithm#320

Closed
linux-riscv-bot wants to merge 5 commits into
workflow__riscv__fixesfrom
pw955350
Closed

[PW_SID:955350] Change PWM-controlled LED pin active mode and algorithm#320
linux-riscv-bot wants to merge 5 commits into
workflow__riscv__fixesfrom
pw955350

Conversation

@linux-riscv-bot
Copy link
Copy Markdown

PR for series 955350 applied to workflow__riscv__fixes

Name: Change PWM-controlled LED pin active mode and algorithm
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=955350
Version: 11

nylon7 added 5 commits April 21, 2025 13:37
…active-low properties

This removes the active-low properties of the PWM-controlled LEDs in
the HiFive Unmatched device tree.

The reference is hifive-unleashed-a00.pdf[0] and hifive-unmatched-schematics-v3.pdf[1].

Link: https://sifive.cdn.prismic.io/sifive/c52a8e32-05ce-4aaf-95c8-7bf8453f8698_hifive-unleashed-a00-schematics-1.pdf [0]
Link: https://sifive.cdn.prismic.io/sifive/6a06d6c0-6e66-49b5-8e9e-e68ce76f4192_hifive-unmatched-schematics-v3.pdf [1]

Acked-by: Conor Dooley <conor.dooley@microchip.com>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Vincent Chen <vincent.chen@sifive.com>
Signed-off-by: Nylon Chen <nylon.chen@sifive.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
The `frac` variable represents the pulse inactive time, and the result
of this algorithm is the pulse active time. Therefore, we must reverse the result.

The reference is SiFive FU740-C000 Manual[0]

Link: https://sifive.cdn.prismic.io/sifive/1a82e600-1f93-4f41-b2d8-86ed8b16acba_fu740-c000-manual-v1p6.pdf [0]

Co-developed-by: Zong Li <zong.li@sifive.com>
Signed-off-by: Zong Li <zong.li@sifive.com>
Co-developed-by: Vincent Chen <vincent.chen@sifive.com>
Signed-off-by: Vincent Chen <vincent.chen@sifive.com>
Signed-off-by: Nylon Chen <nylon.chen@sifive.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
…y_state_debug function

Round the result to the nearest whole number. This ensures that real_period
is always a reasonable integer that is not lower than the actual value.

e.g.
$ echo 110 > /sys/devices/platform/led-controller-1/leds/d12/brightness
$ .apply is not idempotent (ena=1 pol=0 1739692/4032985) -> (ena=1 pol=0
1739630/4032985)

Co-developed-by: Zong Li <zong.li@sifive.com>
Signed-off-by: Zong Li <zong.li@sifive.com>
Signed-off-by: Nylon Chen <nylon.chen@sifive.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Fix PWM apply and get_state rounding to ensure consistency between
setting and reading values

This fixes the reported errors:
pwm-sifive 10021000.pwm: .apply is supposed to round down
duty_cycle (requested: 360/504000, applied: 361/504124)
pwm-sifive 10021000.pwm: .apply is supposed to round down
period (requested: 504000, applied: 504124)

Co-developed-by: Zong Li <zong.li@sifive.com>
Signed-off-by: Zong Li <zong.li@sifive.com>
Signed-off-by: Nylon Chen <nylon.chen@sifive.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
The FU740‑C000 manual says “pwms ≥ pwmcmpX -> HIGH”, but in Figure 29 pwmcmpXcenter
is forced to 0 via an XOR, so hardware actually outputs HIGH when pwms < pwmcmpX.
Thus pwmcmp holds the off‑period count, and the driver must invert it
to expose a normal active‑high interface.

Co-developed-by: Zong Li <zong.li@sifive.com>
Signed-off-by: Zong Li <zong.li@sifive.com>
Signed-off-by: Nylon Chen <nylon.chen@sifive.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v11,1/5] riscv: dts: sifive: unleashed/unmatched: Remove PWM controlled LED's active-low properties"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 101.11 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v11,1/5] riscv: dts: sifive: unleashed/unmatched: Remove PWM controlled LED's active-low properties"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 898.28 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v11,1/5] riscv: dts: sifive: unleashed/unmatched: Remove PWM controlled LED's active-low properties"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1185.61 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v11,1/5] riscv: dts: sifive: unleashed/unmatched: Remove PWM controlled LED's active-low properties"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 19.58 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v11,1/5] riscv: dts: sifive: unleashed/unmatched: Remove PWM controlled LED's active-low properties"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 21.01 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v11,1/5] riscv: dts: sifive: unleashed/unmatched: Remove PWM controlled LED's active-low properties"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 0.84 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v11,1/5] riscv: dts: sifive: unleashed/unmatched: Remove PWM controlled LED's active-low properties"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 38.45 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v11,1/5] riscv: dts: sifive: unleashed/unmatched: Remove PWM controlled LED's active-low properties"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.22 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v11,1/5] riscv: dts: sifive: unleashed/unmatched: Remove PWM controlled LED's active-low properties"
kdoc
Desc: Detects for kdoc errors
Duration: 0.95 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v11,1/5] riscv: dts: sifive: unleashed/unmatched: Remove PWM controlled LED's active-low properties"
module-param
Desc: Detect module_param changes
Duration: 0.23 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v11,1/5] riscv: dts: sifive: unleashed/unmatched: Remove PWM controlled LED's active-low properties"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.21 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v11,1/5] riscv: dts: sifive: unleashed/unmatched: Remove PWM controlled LED's active-low properties"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.29 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v11,2/5] pwm: sifive: change the PWM algorithm"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 101.42 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v11,2/5] pwm: sifive: change the PWM algorithm"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 876.59 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v11,2/5] pwm: sifive: change the PWM algorithm"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1170.04 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v11,2/5] pwm: sifive: change the PWM algorithm"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 19.80 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v11,2/5] pwm: sifive: change the PWM algorithm"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 20.76 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v11,2/5] pwm: sifive: change the PWM algorithm"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 0.65 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v11,2/5] pwm: sifive: change the PWM algorithm"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 38.17 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v11,2/5] pwm: sifive: change the PWM algorithm"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.22 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v11,2/5] pwm: sifive: change the PWM algorithm"
kdoc
Desc: Detects for kdoc errors
Duration: 0.82 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v11,2/5] pwm: sifive: change the PWM algorithm"
module-param
Desc: Detect module_param changes
Duration: 0.24 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v11,2/5] pwm: sifive: change the PWM algorithm"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.21 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 2: "[v11,2/5] pwm: sifive: change the PWM algorithm"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.28 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[v11,3/5] pwm: sifive: Fix the error in the idempotent test within the pwm_apply_state_debug function"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 100.11 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[v11,3/5] pwm: sifive: Fix the error in the idempotent test within the pwm_apply_state_debug function"
module-param
Desc: Detect module_param changes
Duration: 0.24 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[v11,3/5] pwm: sifive: Fix the error in the idempotent test within the pwm_apply_state_debug function"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.21 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 3: "[v11,3/5] pwm: sifive: Fix the error in the idempotent test within the pwm_apply_state_debug function"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.52 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 4: "[v11,4/5] pwm: sifive: Fix rounding issues in apply and get_state functions"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 101.51 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 4: "[v11,4/5] pwm: sifive: Fix rounding issues in apply and get_state functions"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 878.58 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 4: "[v11,4/5] pwm: sifive: Fix rounding issues in apply and get_state functions"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1169.20 seconds
Result: PASS

1 similar comment
@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 4: "[v11,4/5] pwm: sifive: Fix rounding issues in apply and get_state functions"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1169.20 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 4: "[v11,4/5] pwm: sifive: Fix rounding issues in apply and get_state functions"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 19.95 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 4: "[v11,4/5] pwm: sifive: Fix rounding issues in apply and get_state functions"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 21.16 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 4: "[v11,4/5] pwm: sifive: Fix rounding issues in apply and get_state functions"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 0.70 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 4: "[v11,4/5] pwm: sifive: Fix rounding issues in apply and get_state functions"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 38.10 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 4: "[v11,4/5] pwm: sifive: Fix rounding issues in apply and get_state functions"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.22 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 4: "[v11,4/5] pwm: sifive: Fix rounding issues in apply and get_state functions"
kdoc
Desc: Detects for kdoc errors
Duration: 0.83 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 4: "[v11,4/5] pwm: sifive: Fix rounding issues in apply and get_state functions"
module-param
Desc: Detect module_param changes
Duration: 0.23 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 4: "[v11,4/5] pwm: sifive: Fix rounding issues in apply and get_state functions"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.21 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 4: "[v11,4/5] pwm: sifive: Fix rounding issues in apply and get_state functions"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.28 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 5: "[v11,5/5] pwm: sifive: clarify inverted compare logic in comments"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 101.33 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 5: "[v11,5/5] pwm: sifive: clarify inverted compare logic in comments"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 878.90 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 5: "[v11,5/5] pwm: sifive: clarify inverted compare logic in comments"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1170.37 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 5: "[v11,5/5] pwm: sifive: clarify inverted compare logic in comments"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 19.76 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 5: "[v11,5/5] pwm: sifive: clarify inverted compare logic in comments"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 20.71 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 5: "[v11,5/5] pwm: sifive: clarify inverted compare logic in comments"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 1.59 seconds
Result: WARNING
Output:

WARNING: Block comments use a trailing */ on a separate line
#61: FILE: drivers/pwm/pwm-sifive.c:134:
+	 * Here, 'inactive' is the low time and we compute duty as max_count - inactive. */

total: 0 errors, 1 warnings, 0 checks, 44 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

Commit 8d8538f59a7a ("pwm: sifive: clarify inverted compare logic in comments") has style problems, please review.

NOTE: Ignored message types: ALLOC_SIZEOF_STRUCT CAMELCASE COMMIT_LOG_LONG_LINE GIT_COMMIT_ID MACRO_ARG_REUSE NO_AUTHOR_SIGN_OFF

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.
total: 0 errors, 1 warnings, 0 checks, 44 lines checked
WARNING: Block comments use a trailing */ on a separate line


@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 5: "[v11,5/5] pwm: sifive: clarify inverted compare logic in comments"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 38.69 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 5: "[v11,5/5] pwm: sifive: clarify inverted compare logic in comments"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.22 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 5: "[v11,5/5] pwm: sifive: clarify inverted compare logic in comments"
kdoc
Desc: Detects for kdoc errors
Duration: 0.87 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 5: "[v11,5/5] pwm: sifive: clarify inverted compare logic in comments"
module-param
Desc: Detect module_param changes
Duration: 0.23 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 5: "[v11,5/5] pwm: sifive: clarify inverted compare logic in comments"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.21 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 5: "[v11,5/5] pwm: sifive: clarify inverted compare logic in comments"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.28 seconds
Result: PASS

@linux-riscv-bot linux-riscv-bot deleted the pw955350 branch April 23, 2025 02:32
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