Received: by 10.223.185.116 with SMTP id b49csp1903781wrg; Thu, 22 Feb 2018 05:10:31 -0800 (PST) X-Google-Smtp-Source: AH8x227tG+8u3AxEn1JhqqUTxpM+P3vt8oKrcPA9BuApltfvvConGlqTmOLGmSpeBEl9BH0tp1LB X-Received: by 2002:a17:902:b185:: with SMTP id s5-v6mr1940008plr.109.1519305031000; Thu, 22 Feb 2018 05:10:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519305030; cv=none; d=google.com; s=arc-20160816; b=hpx+8OjGekEMIOP/BDRDVOiZQ2ulqT/WM07pYwkG71HNRzIqucsSrAIi/IC8MO2qp4 SgBwlJC+d7VD+Xf1G1ZG0+JJsekc7XPLRsMyRx3bkc63/n5gFD13H3Smmqtvw8/2N7tA nvHe39xaIKuc1P5hcitNXDTsps1C1NUzKhW/ARVaXHaq0lIMaJjfhvMNAxrQ33iuytqF bf3/zn+m3m4d2H3xFxugOMHUwoR1wnAwTa6TH7HEze2iADy3KVDw7HEqAJLgfbLjPGvt 0cl6GCS4IJQ3HzT+cA7z0bcDVM9LHGqgQaGfEangE3JZiJ42fnUZnzMJGK/NLh5NFrnO +R/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=hxJ3F+BtUEETST0XVz9GyaNIP7JffqcNhN2BZ5GjWWY=; b=zVPawoniYA3aos8RoECcZgD0qEJJ8tCtk89CCdPdxdJA+arbEnkMNN5nOHzgCLlR6I JKz2MPC/mcCBs1JZVxxn6O5VvSL78oGA8vnXsRRm/4WjK2yCmST8Zy2AURIjSPvse1Xi 73N5dEEKIGWVSmkFkWHhnejSy3Kxt19hCY4IEVRkoiB2WEEYiqVhFLKJtFXubsXi1VBp U3uoKeHCSdrbruNNWUH3hXrk4EWbJmvouskGm4mbNj2qrST30gtEtHbGfZOJ3HOhXJa0 VFYs3w7uQ5ewUwzS7GFhhvISuu20RT/bTBKw2cvLJ9KwgrSzUBmAJHdiceM9+mKPzB7I 0pcA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a64si14674pfb.405.2018.02.22.05.10.16; Thu, 22 Feb 2018 05:10:30 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932544AbeBVNIx (ORCPT + 99 others); Thu, 22 Feb 2018 08:08:53 -0500 Received: from gofer.mess.org ([88.97.38.141]:37577 "EHLO gofer.mess.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932505AbeBVNIp (ORCPT ); Thu, 22 Feb 2018 08:08:45 -0500 X-Greylist: delayed 427 seconds by postgrey-1.27 at vger.kernel.org; Thu, 22 Feb 2018 08:08:42 EST Received: by gofer.mess.org (Postfix, from userid 1000) id 9367E6026F; Thu, 22 Feb 2018 13:01:31 +0000 (GMT) Date: Thu, 22 Feb 2018 13:01:31 +0000 From: Sean Young To: Claudiu Beznea Cc: thierry.reding@gmail.com, shc_work@mail.ru, kgene@kernel.org, krzk@kernel.org, linux@armlinux.org.uk, mturquette@baylibre.com, sboyd@codeaurora.org, jani.nikula@linux.intel.com, joonas.lahtinen@linux.intel.com, rodrigo.vivi@intel.com, airlied@linux.ie, kamil@wypas.org, b.zolnierkie@samsung.com, jdelvare@suse.com, linux@roeck-us.net, dmitry.torokhov@gmail.com, rpurdie@rpsys.net, jacek.anaszewski@gmail.com, pavel@ucw.cz, mchehab@kernel.org, lee.jones@linaro.org, daniel.thompson@linaro.org, jingoohan1@gmail.com, milo.kim@ti.com, robh+dt@kernel.org, mark.rutland@arm.com, corbet@lwn.net, nicolas.ferre@microchip.com, alexandre.belloni@free-electrons.com, linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-clk@vger.kernel.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-hwmon@vger.kernel.org, linux-input@vger.kernel.org, linux-leds@vger.kernel.org, linux-media@vger.kernel.org, linux-fbdev@vger.kernel.org, devicetree@vger.kernel.org, linux-doc@vger.kernel.org Subject: Re: [PATCH v3 05/10] pwm: add PWM mode to pwm_config() Message-ID: <20180222130131.46fcuurp4h6dc7wb@gofer.mess.org> References: <1519300881-8136-1-git-send-email-claudiu.beznea@microchip.com> <1519300881-8136-6-git-send-email-claudiu.beznea@microchip.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1519300881-8136-6-git-send-email-claudiu.beznea@microchip.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- -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. Sean