Thread (30 messages) 30 messages, 3 authors, 2019-04-05
STALE2663d REVIEWED: 2 (0M)

[PATCH v11 15/27] pwm: jz4740: Allow selection of PWM channels 0 and 1

From: Paul Cercueil <paul@crapouillou.net>
Date: 2019-03-27 23:18:59
Also in: linux-clk, linux-doc, linux-mips, linux-pwm, linux-watchdog, lkml
Subsystem: ingenic jz47xx socs, pwm subsystem, the rest · Maintainers: Paul Cercueil, Uwe Kleine-König, Linus Torvalds

The TCU channels 0 and 1 were previously reserved for system tasks, and
thus unavailable for PWM.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Tested-by: Mathieu Malaterre <redacted>
Tested-by: Artur Rojek <redacted>
---
 drivers/pwm/pwm-jz4740.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/pwm/pwm-jz4740.c b/drivers/pwm/pwm-jz4740.c
index b55ee879e23d..c874a387c1d9 100644
--- a/drivers/pwm/pwm-jz4740.c
+++ b/drivers/pwm/pwm-jz4740.c
@@ -42,11 +42,7 @@ static int jz4740_pwm_request(struct pwm_chip *chip, struct pwm_device *pwm)
 	char clk_name[16];
 	int ret;
 
-	/*
-	 * Timers 0 and 1 are used for system tasks, so they are unavailable
-	 * for use as PWMs.
-	 */
-	if (pwm->hwpwm < 2)
+	if (!ingenic_tcu_pwm_can_use_chn(chip->dev, pwm->hwpwm))
 		return -EBUSY;
 
 	snprintf(clk_name, sizeof(clk_name), "timer%u", pwm->hwpwm);
-- 
2.11.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help