On 22.02.2018 15:01, Sean Young wrote: > On Thu, Feb 22, 2018 at 02:01:16PM +0200, Claudiu Beznea wrote: >> Add PWM mode to pwm_config() function. The drivers which uses pwm_config() >> were adapted to this change. >> >> Signed-off-by: Claudiu Beznea <claudiu.beznea@xxxxxxxxxxxxx> >> --- > > -snip- > >> 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 > -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html