summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2026-04-16 00:13:31 +0300
committerLinus Torvalds <torvalds@linux-foundation.org>2026-04-16 00:13:31 +0300
commitb9962335d4c6dee152e95dce9f0dd32048735a6d (patch)
treec31208c773c2099d0e94a879e0e3bd8749886ac0 /drivers
parent5af6e08ae74ef4c9e59873c7265ca4894205c636 (diff)
parentaa8f35172ab66c57d4355a8c4e28d05b44c938e3 (diff)
downloadlinux-b9962335d4c6dee152e95dce9f0dd32048735a6d.tar.xz
Merge tag 'pwm/for-7.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux
Pull pwm updates from Uwe Kleine-König: "Just two minor fixes, a device tree binding addition to support a few more SoCs (without the need for driver adaptions), a driver include cleanup and the addition of the #linux-pwm irc channel to MAINTAINERS" * tag 'pwm/for-7.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux: pwm: th1520: fix `CLIPPY=1` warning pwm: jz4740: Drop unused include MAINTAINERS: Add #linux-pwm irc channel to pwm entry dt-bindings: pwm: amlogic: Document A4 A5 and T7 PWM pwm: imx-tpm: Count the number of enabled channels in probe
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pwm/pwm-imx-tpm.c9
-rw-r--r--drivers/pwm/pwm-jz4740.c1
-rw-r--r--drivers/pwm/pwm_th1520.rs5
3 files changed, 9 insertions, 6 deletions
diff --git a/drivers/pwm/pwm-imx-tpm.c b/drivers/pwm/pwm-imx-tpm.c
index 5b399de16d60..80fdb3303400 100644
--- a/drivers/pwm/pwm-imx-tpm.c
+++ b/drivers/pwm/pwm-imx-tpm.c
@@ -352,7 +352,7 @@ static int pwm_imx_tpm_probe(struct platform_device *pdev)
struct clk *clk;
void __iomem *base;
int ret;
- unsigned int npwm;
+ unsigned int i, npwm;
u32 val;
base = devm_platform_ioremap_resource(pdev, 0);
@@ -382,6 +382,13 @@ static int pwm_imx_tpm_probe(struct platform_device *pdev)
mutex_init(&tpm->lock);
+ /* count the enabled channels */
+ for (i = 0; i < npwm; ++i) {
+ val = readl(base + PWM_IMX_TPM_CnSC(i));
+ if (FIELD_GET(PWM_IMX_TPM_CnSC_ELS, val))
+ ++tpm->enable_count;
+ }
+
ret = devm_pwmchip_add(&pdev->dev, chip);
if (ret)
return dev_err_probe(&pdev->dev, ret, "failed to add PWM chip\n");
diff --git a/drivers/pwm/pwm-jz4740.c b/drivers/pwm/pwm-jz4740.c
index 6bdb01619380..e0b5966fc7fe 100644
--- a/drivers/pwm/pwm-jz4740.c
+++ b/drivers/pwm/pwm-jz4740.c
@@ -10,7 +10,6 @@
#include <linux/clk.h>
#include <linux/err.h>
-#include <linux/gpio.h>
#include <linux/kernel.h>
#include <linux/mfd/ingenic-tcu.h>
#include <linux/mfd/syscon.h>
diff --git a/drivers/pwm/pwm_th1520.rs b/drivers/pwm/pwm_th1520.rs
index 6cd6fa3d2984..ddd44a5ce497 100644
--- a/drivers/pwm/pwm_th1520.rs
+++ b/drivers/pwm/pwm_th1520.rs
@@ -64,10 +64,7 @@ const TH1520_PWM_REG_SIZE: usize = 0xB0;
fn ns_to_cycles(ns: u64, rate_hz: u64) -> u64 {
const NSEC_PER_SEC_U64: u64 = time::NSEC_PER_SEC as u64;
- (match ns.checked_mul(rate_hz) {
- Some(product) => product,
- None => u64::MAX,
- }) / NSEC_PER_SEC_U64
+ ns.saturating_mul(rate_hz) / NSEC_PER_SEC_U64
}
fn cycles_to_ns(cycles: u64, rate_hz: u64) -> u64 {