From patchwork Mon Nov 9 00:42:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoshihiro Shimoda X-Patchwork-Id: 7579841 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 69EF49F392 for ; Mon, 9 Nov 2015 00:42:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 823E82068E for ; Mon, 9 Nov 2015 00:42:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8E50F20687 for ; Mon, 9 Nov 2015 00:42:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752125AbbKIAmk (ORCPT ); Sun, 8 Nov 2015 19:42:40 -0500 Received: from relmlor4.renesas.com ([210.160.252.174]:36391 "EHLO relmlie3.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751845AbbKIAmi (ORCPT ); Sun, 8 Nov 2015 19:42:38 -0500 Received: from unknown (HELO relmlir4.idc.renesas.com) ([10.200.68.154]) by relmlie3.idc.renesas.com with ESMTP; 09 Nov 2015 09:42:36 +0900 Received: from relmlac1.idc.renesas.com (relmlac1.idc.renesas.com [10.200.69.21]) by relmlir4.idc.renesas.com (Postfix) with ESMTP id 4E00346D4E; Mon, 9 Nov 2015 09:42:36 +0900 (JST) Received: by relmlac1.idc.renesas.com (Postfix, from userid 0) id 25F918002D; Mon, 9 Nov 2015 09:42:36 +0900 (JST) Received: from relmlac1.idc.renesas.com (localhost [127.0.0.1]) by relmlac1.idc.renesas.com (Postfix) with ESMTP id 25C898002F; Mon, 9 Nov 2015 09:42:36 +0900 (JST) Received: from relmlii1.idc.renesas.com [10.200.68.65] by relmlac1.idc.renesas.com with ESMTP id KAV31710; Mon, 9 Nov 2015 09:42:36 +0900 X-IronPort-AV: E=Sophos;i="5.20,264,1444662000"; d="scan'";a="198113944" Received: from mail-sg2apc01lp0245.outbound.protection.outlook.com (HELO APC01-SG2-obe.outbound.protection.outlook.com) ([65.55.88.245]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA; 09 Nov 2015 09:42:35 +0900 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=<>; Received: from localhost (211.11.155.144) by TY1PR06MB0925.apcprd06.prod.outlook.com (10.164.99.151) with Microsoft SMTP Server (TLS) id 15.1.318.15; Mon, 9 Nov 2015 00:42:33 +0000 From: Yoshihiro Shimoda To: CC: , , , Yoshihiro Shimoda Subject: [PATCH] pwm: rcar: Improve accuracy of frequency division setting Date: Mon, 9 Nov 2015 09:42:25 +0900 Message-ID: <1447029745-3648-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> X-Mailer: git-send-email 1.9.4.msysgit.1 MIME-Version: 1.0 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: TY1PR06CA0040.apcprd06.prod.outlook.com (25.164.91.50) To TY1PR06MB0925.apcprd06.prod.outlook.com (25.164.99.151) X-Microsoft-Exchange-Diagnostics: 1; TY1PR06MB0925; 2:hXjdF1itfjLQPj44k8+lGrgxe2WHFetC7m33z3oZSbcurhU+g+o3Y9ILfCnOsl7g/Jw7ySQIjA8zuVOeXmWAHUZjr6sUnBBBhWMaQQIw7memkOYgVCDjgdTrWaXTiM0AMmYBLM/oLJ5vmo55nSqEQRPXeHcyQtn9UsYYu65Yvdw=; 3:0bOOqGNnvcgbHvsD0RrtmG8M8Q2vIfE9sGAFW1LQXh+z7G2AgYbPGVud8gITU5f3FA6h6yY1vi6kgH0t+dukcaAwR9uOJdzap+5uZ3q3EstSgXKFlH/idIX6mV7WDtsIOdgaVKbFLk7Tg1ekSJIOQQ==; 25:52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6OlPWpNjrdekKNqNqqy3535pPj0R+bnO10TPhxvc4wv4Pw4L364vfQvZJKpXSVKfkSBpTl4kXkT6QZPx+rLZKqGbfuALirlrZKhYfeXaix9GnvfZOq5o2IKp4ggfN6MPxnBRKRMxlSFdhh2+wJxpy+wrsJafEMbKeE8U3zIDyE/IRzI6dulrHwj+PtXKef X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(85106069007906); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(520078)(5005006)(8121501046)(10201501046)(3002001); SRVR:TY1PR06MB0925; BCL:0; PCL:0; RULEID:; SRVR:TY1PR06MB0925; X-Forefront-PRVS: 0755F54DD9 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6069001)(6009001)(199003)(189002)(105586002)(97736004)(122386002)(106356001)(40100003)(2351001)(101416001)(19580395003)(33646002)(66066001)(78352002)(42382002)(50986999)(47776003)(19580405001)(81156007)(50226001)(36756003)(189998001)(5003940100001)(229853001)(50466002)(110136002)(87976001)(107886002)(5004730100002)(92566002)(4001430100002)(5001960100002)(5007970100001)(48376002)(5008740100001)(76506005)(42186005)(77096005)(25903002); DIR:OUT; SFP:1102; SCL:1; SRVR:TY1PR06MB0925; H:localhost; FPR:; SPF:None; PTR:InfoNoRecords; A:0; MX:0; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; TY1PR06MB0925; 23:tlu40NdjP1hddkNWpfxFkMJHuB20lxi2eJyEGtNcu?= =?us-ascii?Q?suAhKT+u8P6ykZbEiYDbngjqu9mzPL+q8AVLqMTUY5+5AtVKZCjohWGhbGLY?= =?us-ascii?Q?RebHx3FV9jF8P8KHSxhR/ULBXWuGO0FzSwsuisnUDyJijKnWFyQ4ANuXPlim?= =?us-ascii?Q?dXPAO3P1CQ11C0DDJKH4zJPmAZNconbt0uTdrTM4h8qE++SFeZCuza8llMDy?= =?us-ascii?Q?9O3QZpbBdwEIl+/ZaR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oft-Exchange-Diagnostics: 1; TY1PR06MB0925; 5:WsDXaGreA2h67AOGBvNq+/jhkDHZ4Oc9ADwb9tCkTeUrMWIlFn7sowm7U73YcbV4BDqKGWgpeg5iEwmmDmWs1Z2v46Q5LT+zc564d7cZ4rr126A4S5G/81sJsdzJe+H7o0O4sk9hG+lDYOpAiAq5KQ==; 24:5l/qeBDZzvmT7ggdBy9WyZHZmbMMd9m486gfodXlpq65JIm+Ijn1SL34A87zGXtK/QAk5sYTrT65SuhBNxsng3zCfA3EiFPmUTRr3sq7pWs=; 20:zgCTDfuIMjHEY/ZzUpq6oijbow1AjxbxeN8ZaMYCy3q1NCuMDmA2Eopi16pJLcuY1Cnc28EXRlfT8J8MYGcQ1grXNm77LNkyK+TgRWU7NFaCQ6zbBJ7L/8jFhotw9g4AWKmR09IJ9jiWzqwi1fFAdyJGevvX1nni06yPWVTkzDg= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Nov 2015 00:42:33.5805 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY1PR06MB0925 Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=AXB_X_OUTLOOKPROT_ENVSDR, BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Ryo Kodama From: Ryo Kodama When period_ns is set to the same value of RCAR_PWM_MAX_CYCLE in rcar_pwm_get_clock_division(), this function should allow such value for improving accuracy of frequency division setting. Signed-off-by: Ryo Kodama Signed-off-by: Yoshihiro Shimoda --- drivers/pwm/pwm-rcar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pwm/pwm-rcar.c b/drivers/pwm/pwm-rcar.c index 6e99a63..7b8ac06 100644 --- a/drivers/pwm/pwm-rcar.c +++ b/drivers/pwm/pwm-rcar.c @@ -81,7 +81,7 @@ static int rcar_pwm_get_clock_division(struct rcar_pwm_chip *rp, int period_ns) max = (unsigned long long)NSEC_PER_SEC * RCAR_PWM_MAX_CYCLE * (1 << div); do_div(max, clk_rate); - if (period_ns < max) + if (period_ns <= max) break; }