Received: by 10.223.185.116 with SMTP id b49csp1918762wrg; Thu, 22 Feb 2018 05:25:01 -0800 (PST) X-Google-Smtp-Source: AH8x224v3VC9I4Hx4GFQCxuH/vrEcyeo2DsWiSXQeOB9JfYpSNUpHMUQ2uEf7zzuOtlXxM/XtXP0 X-Received: by 2002:a17:902:57db:: with SMTP id g27-v6mr4346362plj.75.1519305901377; Thu, 22 Feb 2018 05:25:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519305901; cv=none; d=google.com; s=arc-20160816; b=VqVruUy1mMaOSlu0/n9aCp/Iuo0JEtnQqW1+1BlMECJ3sc7+ea66FGHIuZDvauWY+I 7fmgKHceE2BO1wnHD3K1FMzkX/MUfYHPy23FvWY2ciKBjLvqvAFvo9/cD0T1Bzzt7bQW +fqvTm2LbYZFIhHd66d9CfD9FCoSpfmksSva0E4JUuqKZ41v1+Gd3dQkGfbbo1Dv7v6D MrII2PxPzzGXHz1zG/MPL5dUZtBpRbQvCuDKDIC8oCfUkNDY4Ll3xG1w45Dx3niy4KJe JVFf4r6lZ8XUjz+95aUG8xMWxWloLOGvZnVto7nvgk22CAwvCZ165sr0eNM3tpx5ullG mvZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=ecxmBesQNxhLPJZpc+WwFCAtkqb0S/Qzs4Uqsf1pQlg=; b=HR15qvbZ2rpZBb9cjFQYDgSJ0iHnebq5dUlD5UaK6LAFVIP7aazk3r6dd0OmtS5qmw TKz3kn8mcnmqEKiI/LKuEwf/fRMLRcw0TqYQISNhCIhKilwvOWwPUbJaeh4/CLOyeI7h j8QAXW3b8tpsHvBlOOrsYW/7NIDoouaVI3qh17IUQ/oPa07tZzoFTQlf2J7o3Tnj6Zul GnWV4zvyS15b3vFsJvA1ke8BcVnf0hKhxbyJF2JffhFA2qN7sN28VF3dJWLXF4A004ud nt6V7NahRH5f/yjrGSReYbznIs8kpHJL08Rg7gCdtasTNeoH90o7H1n6ASpTLoQDwbc1 nzow== 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 m12-v6si39977pls.703.2018.02.22.05.24.44; Thu, 22 Feb 2018 05:25:01 -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 S932557AbeBVNX5 (ORCPT + 99 others); Thu, 22 Feb 2018 08:23:57 -0500 Received: from esa4.microchip.iphmx.com ([68.232.154.123]:23799 "EHLO esa4.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753702AbeBVNXw (ORCPT ); Thu, 22 Feb 2018 08:23:52 -0500 X-IronPort-AV: E=Sophos;i="5.47,377,1515481200"; d="scan'208";a="11404966" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa4.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 22 Feb 2018 06:23:51 -0700 Received: from [10.145.6.79] (10.10.76.4) by chn-sv-exch07.mchp-main.com (10.10.76.108) with Microsoft SMTP Server id 14.3.352.0; Thu, 22 Feb 2018 06:23:50 -0700 Subject: Re: [PATCH v3 05/10] pwm: add PWM mode to pwm_config() To: Sean Young CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , References: <1519300881-8136-1-git-send-email-claudiu.beznea@microchip.com> <1519300881-8136-6-git-send-email-claudiu.beznea@microchip.com> <20180222130131.46fcuurp4h6dc7wb@gofer.mess.org> From: Claudiu Beznea Message-ID: <8d0f25e6-3bbf-cbbc-7eef-abde0127f2bc@microchip.com> Date: Thu, 22 Feb 2018 15:23:40 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180222130131.46fcuurp4h6dc7wb@gofer.mess.org> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >> --- > > -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 >