Thread (29 messages) 29 messages, 7 authors, 2018-03-02

Re: [PATCH v3 05/10] pwm: add PWM mode to pwm_config()

From: Claudiu Beznea <hidden>
Date: 2018-02-22 13:23:58
Also in: dri-devel, intel-gfx, linux-arm-kernel, linux-clk, linux-devicetree, linux-hwmon, linux-input, linux-leds, linux-media, linux-pwm, linux-samsung-soc, lkml


On 22.02.2018 15:01, Sean Young wrote:
On Thu, Feb 22, 2018 at 02:01:16PM +0200, Claudiu Beznea wrote:
quoted
Add PWM mode to pwm_config() function. The drivers which uses pwm_config()
were adapted to this change.

Signed-off-by: Claudiu Beznea <redacted>
---
-snip-
quoted
diff --git a/drivers/media/rc/ir-rx51.c b/drivers/media/rc/ir-rx51.c
index 49265f02e772..a971b02ea021 100644
--- a/drivers/media/rc/ir-rx51.c
+++ b/drivers/media/rc/ir-rx51.c
@@ -55,10 +55,13 @@ static int init_timing_params(struct ir_rx51 *ir_rx51)
 {
 	struct pwm_device *pwm = ir_rx51->pwm;
 	int duty, period = DIV_ROUND_CLOSEST(NSEC_PER_SEC, ir_rx51->freq);
+	struct pwm_caps caps = { };
 
 	duty = DIV_ROUND_CLOSEST(ir_rx51->duty_cycle * period, 100);
 
-	pwm_config(pwm, duty, period);
+	pwm_get_caps(pwm->chip, pwm, &caps);
+
+	pwm_config(pwm, duty, period, BIT(ffs(caps.modes) - 1));
 
 	return 0;
 }
diff --git a/drivers/media/rc/pwm-ir-tx.c b/drivers/media/rc/pwm-ir-tx.c
index 27d0f5837a76..c630e1b450a3 100644
--- a/drivers/media/rc/pwm-ir-tx.c
+++ b/drivers/media/rc/pwm-ir-tx.c
@@ -61,6 +61,7 @@ static int pwm_ir_tx(struct rc_dev *dev, unsigned int *txbuf,
 {
 	struct pwm_ir *pwm_ir = dev->priv;
 	struct pwm_device *pwm = pwm_ir->pwm;
+	struct pwm_caps caps = { };
 	int i, duty, period;
 	ktime_t edge;
 	long delta;
@@ -68,7 +69,9 @@ static int pwm_ir_tx(struct rc_dev *dev, unsigned int *txbuf,
 	period = DIV_ROUND_CLOSEST(NSEC_PER_SEC, pwm_ir->carrier);
 	duty = DIV_ROUND_CLOSEST(pwm_ir->duty_cycle * period, 100);
 
-	pwm_config(pwm, duty, period);
+	pwm_get_caps(pwm->chip, pwm, &caps);
+
+	pwm_config(pwm, duty, period, BIT(ffs(caps.modes) - 1));
 
 	edge = ktime_get();
 
The two PWM rc-core drivers need PWM_MODE(NORMAL), not the first available
mode that the device supports. If mode normal is not supported, then probe
should fail.
OK, thank you for your inputs. I will address this in next version.


Thank you,
Claudiu Beznea

Sean
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help