Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753228AbbDHIo1 (ORCPT ); Wed, 8 Apr 2015 04:44:27 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:23231 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750966AbbDHIoY (ORCPT ); Wed, 8 Apr 2015 04:44:24 -0400 X-AuditID: cbfee61b-f79536d000000f1f-e6-5524ea65d58f Date: Wed, 08 Apr 2015 10:44:15 +0200 From: Lukasz Majewski To: Anand Moon Cc: Eduardo Valentin , Sjoerd Simons , Russell King , Kukjin Kim , devicetree@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Guenter Roeck Subject: Re: [PATCH 6/6] hwmon: pwm-fan: Update the duty cycle inorder to control the pwm-fan Message-id: <20150408104415.07e1c821@amdc2363> In-reply-to: <1427387955-5129-7-git-send-email-linux.amoon@gmail.com> References: <1427387955-5129-1-git-send-email-linux.amoon@gmail.com> <1427387955-5129-7-git-send-email-linux.amoon@gmail.com> Organization: SPRC Poland X-Mailer: Claws Mail 3.8.1 (GTK+ 2.24.10; x86_64-pc-linux-gnu) MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpikeLIzCtJLcpLzFFi42I5/e+xgG7aK5VQg51trBbzj5wDEleusVr0 P37NbLHpMZB1edccNou7d1cxWsw4v4/JYt3GW+wWty/zWjxZeIbJYvrxt6wO3B4tzT1sHn+f X2fx2DnrLrvHplWdbB6bl9R77PzewO7xeZNcAHsUl01Kak5mWWqRvl0CV8axk1EFt7gr7jz+ z9TAOJGzi5GTQ0LAROLlxSdsELaYxIV768FsIYFFjBI/12l2MXIB2W8YJZbuOMMKkmARUJVY +P0tO4jNJqAn8fnuUyYQW0RATeLK0xWsIA3MAq+ZJP7OOQxWJCwQL/Hl1UqgBAcHL1DDk9sx IGFOAVeJt0d3Qy2rl7j06C8jiM0vICnR/u8HM8RBdhLnPm0AG8MrICjxY/I9FhCbWUBLYvO2 JlYIW15i85q3zBMYBWchKZuFpGwWkrIFjMyrGEVTC5ILipPSc430ihNzi0vz0vWS83M3MYJj 5pn0DsZVDRaHGAU4GJV4eAUWq4QKsSaWFVfmHmKU4GBWEuHd/gIoxJuSWFmVWpQfX1Sak1p8 iFGag0VJnHeOrlyokEB6YklqdmpqQWoRTJaJg1OqgVHd3Yzv9Yo3bhWzdLWtuhREn+inR9Ro rC03KfVZvuGarYuV2h12oYfrW07afN64Iqc5ONy3/Mxbk5PrQu42mFyvuMpxbP78lGjFPI2k 9GMn9tdHP13QI7jh5MN3YTvTeCOvPTi0KNun5Gnsx+ArCyeGTNzDJZx0dGuI6odzNWoV92N2 3H7rfUuJpTgj0VCLuag4EQBfpttWlQIAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1682 Lines: 66 Hi Anand, > Below changes depend on following patch. > https://patchwork.kernel.org/patch/5944061/ > > Update the pwm_config with duty then update the pwm_disable > to poweroff the cpu fan. > > Tested on OdroidXU3 board. > > Signed-off-by: Anand Moon > --- > drivers/hwmon/pwm-fan.c | 10 ++++------ > 1 file changed, 4 insertions(+), 6 deletions(-) > > diff --git a/drivers/hwmon/pwm-fan.c b/drivers/hwmon/pwm-fan.c > index 7c83dc4..f25c841 100644 > --- a/drivers/hwmon/pwm-fan.c > +++ b/drivers/hwmon/pwm-fan.c > @@ -44,26 +44,24 @@ static int __set_pwm(struct pwm_fan_ctx *ctx, > unsigned long pwm) int ret = 0; > > mutex_lock(&ctx->lock); > + > if (ctx->pwm_value == pwm) > goto exit_set_pwm_err; > > - if (pwm == 0) { > - pwm_disable(ctx->pwm); > - goto exit_set_pwm; > - } > - > duty = DIV_ROUND_UP(pwm * (ctx->pwm->period - 1), MAX_PWM); > ret = pwm_config(ctx->pwm, duty, ctx->pwm->period); > if (ret) > goto exit_set_pwm_err; > > + if (pwm == 0) > + pwm_disable(ctx->pwm); > + > if (ctx->pwm_value == 0) { > ret = pwm_enable(ctx->pwm); > if (ret) > goto exit_set_pwm_err; > } > > -exit_set_pwm: > ctx->pwm_value = pwm; > exit_set_pwm_err: > mutex_unlock(&ctx->lock); Reviewed-by: Lukasz Majewski BTW: I've added Guenter to CC. -- Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/