[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8d0f25e6-3bbf-cbbc-7eef-abde0127f2bc@microchip.com>
Date: Thu, 22 Feb 2018 15:23:40 +0200
From: Claudiu Beznea <Claudiu.Beznea@...rochip.com>
To: Sean Young <sean@...s.org>
CC: <thierry.reding@...il.com>, <shc_work@...l.ru>, <kgene@...nel.org>,
<krzk@...nel.org>, <linux@...linux.org.uk>,
<mturquette@...libre.com>, <sboyd@...eaurora.org>,
<jani.nikula@...ux.intel.com>, <joonas.lahtinen@...ux.intel.com>,
<rodrigo.vivi@...el.com>, <airlied@...ux.ie>, <kamil@...as.org>,
<b.zolnierkie@...sung.com>, <jdelvare@...e.com>,
<linux@...ck-us.net>, <dmitry.torokhov@...il.com>,
<rpurdie@...ys.net>, <jacek.anaszewski@...il.com>, <pavel@....cz>,
<mchehab@...nel.org>, <lee.jones@...aro.org>,
<daniel.thompson@...aro.org>, <jingoohan1@...il.com>,
<milo.kim@...com>, <robh+dt@...nel.org>, <mark.rutland@....com>,
<corbet@....net>, <nicolas.ferre@...rochip.com>,
<alexandre.belloni@...e-electrons.com>,
<linux-pwm@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-samsung-soc@...r.kernel.org>, <linux-clk@...r.kernel.org>,
<intel-gfx@...ts.freedesktop.org>,
<dri-devel@...ts.freedesktop.org>, <linux-hwmon@...r.kernel.org>,
<linux-input@...r.kernel.org>, <linux-leds@...r.kernel.org>,
<linux-media@...r.kernel.org>, <linux-fbdev@...r.kernel.org>,
<devicetree@...r.kernel.org>, <linux-doc@...r.kernel.org>
Subject: Re: [PATCH v3 05/10] pwm: add PWM mode to pwm_config()
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@...rochip.com>
>> ---
>
> -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
>
Powered by blists - more mailing lists