Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 627D2EB64D9 for ; Wed, 14 Jun 2023 11:18:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235189AbjFNLSN (ORCPT ); Wed, 14 Jun 2023 07:18:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235751AbjFNLR7 (ORCPT ); Wed, 14 Jun 2023 07:17:59 -0400 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2E9D1FD0 for ; Wed, 14 Jun 2023 04:17:38 -0700 (PDT) Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-3f7378a75c0so5234215e9.3 for ; Wed, 14 Jun 2023 04:17:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1686741457; x=1689333457; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=ZqM7S8NVl5TgVH/SCkBnKovDNoLn6CHQRP6NUvEVbFA=; b=QOBvNJ4SK+SNbyk8XDYPoIiRQQGEReadorv2ByIf2r/Pgn2pEZzITLNMrdIZW4Uja1 FrPl+kL8JMgwnFvefo4gM4ADtDjXYBkoOJsodiAp/P4NWHr47LelPoqg5Z5eIZPbl5ed W+A/T2K2m6EepXPnoOFsFcNjYboMPE6S5vb039RIEtYnbJEHi+qcmJOuHNQ9Z4kyLIDn h3yI9XWwjJpwSdLsfp4+8K7SkLOYf7q8jLrVDRDO5cnHRdpbQS4PxIclh/2KWezLs+Pp AEPdwu44Gi7WPkNp8s+L3l6mY+YlZ+dvDnubAgTdRxAOQJHTLNoCdo+HmjJBvjqPeCYE jZmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686741457; x=1689333457; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ZqM7S8NVl5TgVH/SCkBnKovDNoLn6CHQRP6NUvEVbFA=; b=mFGsLJ0wPKt0ystFtUKvpecIaoKFGEptmAZh54dArDfJj9R0jYywsFnHeHwl9o0kiL TcEsN4Els/l97Pccj8Np+UkOqAh8etm+lSlN8lkdAmivw8DL7au+i2Or7gk75kVplqyn tcDWymhvbv7fWN3Rkamm44XuAIKB4WQnHNI0zeco8CUUz3mseANh+tKR6r24HObPYE8z L9L7Oe2gVqFzcCpUGGfGk9266ECMM0i2xQqS1TfMh8ephsgU3d2zJf6I9m9Y798TBshq YEfHvawWyJi4iuFP114bRPyMRy5UtUQcWxOcVFsAN0sxIxmxbg6N6gf2v35ZP2dlSoSp j9pA== X-Gm-Message-State: AC+VfDzA8ZfvjDMYKFwXf8fu6RAst3PN6NfmXEFfwvHfRWtDdJLmlArm UZLKX333y0292QTm1Tg84KieGA== X-Google-Smtp-Source: ACHHUZ4VV/u+wNY65vkMGqcqRpOJrnrIRBctK0IPefzUqdfJtG2Faq8wP4fbJml7xLdM6nEjARrruQ== X-Received: by 2002:a05:600c:2212:b0:3f7:865d:ce63 with SMTP id z18-20020a05600c221200b003f7865dce63mr10498832wml.21.1686741456811; Wed, 14 Jun 2023 04:17:36 -0700 (PDT) Received: from [10.35.6.111] ([167.98.27.226]) by smtp.gmail.com with ESMTPSA id x25-20020a05600c21d900b003f60faa4612sm17154520wmj.22.2023.06.14.04.17.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 14 Jun 2023 04:17:36 -0700 (PDT) Message-ID: Date: Wed, 14 Jun 2023 12:17:35 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH v7 10/10] pwm: dwc: use clock rate in hz to avoid rounding issues To: =?UTF-8?Q?Uwe_Kleine-K=c3=b6nig?= Cc: linux-pwm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Lee Jones , Thierry Reding , Krzysztof Kozlowski , Greentime Hu , jarkko.nikula@linux.intel.com, William Salmon , Jude Onyenegecha References: <20221223153820.404565-1-ben.dooks@sifive.com> <20221223153820.404565-11-ben.dooks@sifive.com> <20230216213927.r3lvjz6u7d62y4pb@pengutronix.de> Content-Language: en-GB From: Ben Dooks In-Reply-To: <20230216213927.r3lvjz6u7d62y4pb@pengutronix.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org On 16/02/2023 21:39, Uwe Kleine-König wrote: > On Fri, Dec 23, 2022 at 03:38:20PM +0000, Ben Dooks wrote: >> As noted, the clock-rate when not a nice multiple of ns is probably >> going to end up with inacurate caculations, as well as on a non pci > > Given that such a non-nice ca*l*culation only happens in the of case > that is introduced here, it would be nice to move this patch before the > introduction of the of-support. I've moved of support to the end of the series you >> system the rate may change (although we've not put a clock rate >> change notifier in this code yet) so we also add some quick checks >> of the rate when we do any calculations with it. > > If the clk rate changes while the PWM is on, this modifies the output. > This is unfortunate and so it justifies adding a call to > clk_rate_exclusive_get() when the PWM is on. I can't really test things any more as the hardware has been returned to the client and I'm technically off the project (and awaiting this email address to be closed down). Could this either be solved by the clk_rate_exclusive_get() or adding a clock change notifier? Either way I would prefer this to be work for another patch. I'll send v8 out later as it has had some re-works due to moving things around. Thank you for the review. -- Ben