From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C6DEC433E0 for ; Fri, 19 Jun 2020 13:45:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3B8AA206F7 for ; Fri, 19 Jun 2020 13:45:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592574327; bh=FTD3dv+bQcWVA6OdZg9MrtzMNmBbBogh78qql6Q7F4A=; h=Subject:To:Cc:From:Date:List-ID:From; b=oM6xa53ODV5N0GzrIhuPO/daeCrMBwnXghGtsjKajX440nb9alDR68LVilcLUkSFC lVPCMhOkVm6/A1GE5gm1qW/MfF8e/QuHztVJQVL9GbRHW8sCIBT9bKNF7Qs3DHvLi4 B/IysxctA8lghsIjVuk9WyM8hcCN5vJy1GNlYXfM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732796AbgFSNpZ (ORCPT ); Fri, 19 Jun 2020 09:45:25 -0400 Received: from forward5-smtp.messagingengine.com ([66.111.4.239]:54827 "EHLO forward5-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732611AbgFSNpW (ORCPT ); Fri, 19 Jun 2020 09:45:22 -0400 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailforward.nyi.internal (Postfix) with ESMTP id 02AAA1945750; Fri, 19 Jun 2020 09:45:21 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Fri, 19 Jun 2020 09:45:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=GON+N4 QAeEobRTJBs1TLghyBSj05S9cH3bkQ6dqWeVc=; b=nMXbeBEmix5y3qIzdD6GHj QEvisyacR9aHJM4jeUHtTlajoMh5isd39MpiuxNDpTwdmV7PEplmC6yGt56UNr2e Zlh/Ivk/Hlr94vNScaLXfokzSURsyRK4sPPgr/KMHJ/c5rBVsnyeQoHe2Blw9KgH gBG5J6nOqwyNxKUZjdP+Ahwxz+3SkIYKoDmsTJnbqBSluYJQDhMwnL0F/CQbJCpc BC45IWtQj8ZtSuayLPSMFXA5kleyG1stqCmEsr+5GwXSlDd0ZdWGck+BcSRIaXjM vQ2cNYaYhKLSmvys0ePeHHnmp1QOSWviCRUPjEzXCGNfmIf4/WN/TbEu3hIw9e4A == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudejiedgieelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefuvffhfffkgggtgfesthekredttd dtjeenucfhrhhomhepoehgrhgvghhkhheslhhinhhugihfohhunhgurghtihhonhdrohhr gheqnecuggftrfgrthhtvghrnhepheeggfeuvdehjeffieehheeuvdejfefhgeevgfegvd euudefveegffeuvdetleeunecukfhppeekfedrkeeirdekledruddtjeenucevlhhushht vghrufhiiigvpeefnecurfgrrhgrmhepmhgrihhlfhhrohhmpehgrhgvgheskhhrohgrhh drtghomh X-ME-Proxy: Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) by mail.messagingengine.com (Postfix) with ESMTPA id 8A09B3061856; Fri, 19 Jun 2020 09:45:20 -0400 (EDT) Subject: FAILED: patch "[PATCH] pwm: jz4740: Enhance precision in calculation of duty cycle" failed to apply to 4.4-stable tree To: paul@crapouillou.net, stable@vger.kernel.org, thierry.reding@gmail.com, u.kleine-koenig@pengutronix.de Cc: From: Date: Fri, 19 Jun 2020 15:45:13 +0200 Message-ID: <159257431379172@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The patch below does not apply to the 4.4-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 9017dc4fbd59c09463019ce494cfe36d654495a8 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Wed, 27 May 2020 13:52:23 +0200 Subject: [PATCH] pwm: jz4740: Enhance precision in calculation of duty cycle MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Calculating the hardware value for the duty from the hardware value of the period resulted in a precision loss versus calculating it from the clock rate directly. (Also remove a cast that doesn't really need to be here) Fixes: f6b8a5700057 ("pwm: Add Ingenic JZ4740 support") Cc: Suggested-by: Uwe Kleine-König Reviewed-by: Uwe Kleine-König Signed-off-by: Paul Cercueil Signed-off-by: Thierry Reding diff --git a/drivers/pwm/pwm-jz4740.c b/drivers/pwm/pwm-jz4740.c index 3cd5c054ad9a..4fe9d99ac9a9 100644 --- a/drivers/pwm/pwm-jz4740.c +++ b/drivers/pwm/pwm-jz4740.c @@ -158,11 +158,11 @@ static int jz4740_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, /* Calculate period value */ tmp = (unsigned long long)rate * state->period; do_div(tmp, NSEC_PER_SEC); - period = (unsigned long)tmp; + period = tmp; /* Calculate duty value */ - tmp = (unsigned long long)period * state->duty_cycle; - do_div(tmp, state->period); + tmp = (unsigned long long)rate * state->duty_cycle; + do_div(tmp, NSEC_PER_SEC); duty = period - tmp; if (duty >= period)