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.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no 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 A165FC4361A for ; Fri, 4 Dec 2020 09:00:03 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 327F5222B6 for ; Fri, 4 Dec 2020 09:00:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 327F5222B6 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=mess.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=NtD796FRdgLO49iL3ABSzfK08fUB1pfOE2imQE9275Q=; b=x0C7dYDZszWxwxE6SgxNMO3qs Cl79xhhq5VmJSfvPI3CNdvfB2l/429lLxE5+AqSeVpywHBnEjpUXK78dLWhwjqUmKW95XHijBuT0p 54W4Hf65GC2uJFsryFPCmCp8ji7DivFxi0jJwvNVlIXBkcp5yYJBj4Wxy/1oJnA1wufBsDzlgzabF U5BFNSl0yJuZYBH76i888E3XxH952j2cNF5Ay3/jKMPy11mNylT75AkJSsGWbh/cu22uPRh9bhCQT J9BRxtAeDW13N58aARezs5RqS3zZyRCPzPOQN1t2sCd+AoQHgnfWa+0E5eddjzmGdN9s2M9gSj0d5 gbgbh9hDQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kl6vR-0002gM-IV; Fri, 04 Dec 2020 08:58:51 +0000 Received: from gofer.mess.org ([88.97.38.141]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kl6vK-0002ct-In; Fri, 04 Dec 2020 08:58:45 +0000 Received: by gofer.mess.org (Postfix, from userid 1000) id 1B564C64ED; Fri, 4 Dec 2020 08:58:40 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mess.org; s=2020; t=1607072320; bh=IYTDk70WNSCDc8naxwChw+wSsEIU4zlAqni7tyI0unw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ihKetByfzidaMAodbQR7qA5lRB5aSIswT9ByE+cmiUj8Ldr56Xt1LDZl4IZurk2Fy VQhoc6sfplVCAm3H+52TVtdIxFnlG5/5l2kerZxbCxcSKqv3xnQMCPknbZAydDcAJa ttNfX9/MPXKipeNadJ0dWE2uNl/vvA7wokFLYD/uXOqJGACSNIfGa7P7HArQ+O08Ff xZ4xz9v4633agJJIeqpOrZF/OHR8WWNYm1m66vNckXPArxIwdT4lSZel77TU8tD9BY bKF9c46hXf5B/3D7TnYtO9+JTZJhojeQkhrnCxaVnIf5K6saNBGVlxCHpr/K0xyRyR eZ6OHqXPuhALw== Date: Fri, 4 Dec 2020 08:58:39 +0000 From: Sean Young To: Lino Sanfilippo Subject: Re: [PATCH v2] pwm: bcm2835: Support apply function for atomic configuration Message-ID: <20201204085839.GA2937@gofer.mess.org> References: <202011281128.54eLfMWr-lkp@intel.com> <1606564926-19555-1-git-send-email-LinoSanfilippo@gmx.de> <20201129181050.p6rkif5vjoumvafm@pengutronix.de> <4683237c-7b40-11ab-b3c0-f94a5dd39b4d@gmx.de> <20201204084417.GA2154@gofer.mess.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20201204084417.GA2154@gofer.mess.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201204_035842_836933_D4D9F3CA X-CRM114-Status: GOOD ( 17.34 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, linux-pwm@vger.kernel.org, f.fainelli@gmail.com, sbranden@broadcom.com, rjui@broadcom.com, linux-kernel@vger.kernel.org, thierry.reding@gmail.com, bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= , lee.jones@linaro.org, nsaenzjulienne@suse.de Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Dec 04, 2020 at 08:44:17AM +0000, Sean Young wrote: > On Fri, Dec 04, 2020 at 12:42:15AM +0100, Lino Sanfilippo wrote: > > According to commit 11fc4edc4 rounding to the closest integer has been introduced > > to improve precision in case that the pwm controller is used by the pwm-ir-tx driver. > > I dont know how strong the requirement is to round down the period in apply(), but I > > can imagine that this may be a good reason to deviate from this rule. > > (CCing Sean Young who introduced DIV_ROUND_CLOSEST) > > There was a problem where the carrier is incorrect for some IR hardware > which uses a carrier of 455kHz. With periods that small, rounding errors > do really matter and rounding down might cause problems. > > A policy of rounding down the carrier is not the right thing to do > for pwm-ir-tx, and such a change will probably break pwm-ir-tx in some > edge cases. Let me rephrase that. Changing the division to rounding down will exactly revert the fix I made in commit 11fc4edc483bea8bf0efa0cc726886d2342f6fa6. So in the case described in that commit, the requested frequency was 455kHz, but rounding down resulted in a frequency of 476kHz. That's totally broken and a bad idea. Sean _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel