Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp615588ybh; Tue, 10 Mar 2020 05:11:42 -0700 (PDT) X-Google-Smtp-Source: ADFU+vt1WoQuAJZn23/hkcoXaHCJBkL1ctF+ut8gTKpW45Z90e/BsZDwX4B+v5Rx1ukQuQCkmoO0 X-Received: by 2002:aca:bfc6:: with SMTP id p189mr880802oif.21.1583842302573; Tue, 10 Mar 2020 05:11:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583842302; cv=none; d=google.com; s=arc-20160816; b=CJQ021q1kylbvZtDa+w7U85X6KFKiceRfIW8jXuQQBF2ByZgKGYh1jPUKAcsjhLTg+ gExeEXYKpRy+HDSxfax5viggRMUreRnH5R7PTwN2bAph7TY/+2J0gdzHGm+8uH9y6COk AA8/ovysyOXnsc5pCLHmKDpLiK+Md7iOfG4HU/CIL+/YrEfPTe6a6a/5s2lekxj264gb gqF3gYdTmx4QDywsnE+u1/4KVSDckMsSUoC0mDyHl1i+JByni977vHBOexH1DChOY/47 0yAYPfnPcbAtbdocuRuMgWAuYLL4I9yH4dsGXuQUfwBG1G/8cgJWeuwn3zeDLAmf9KDX Ghcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=AMXgI5ytB1fCLuz9d/uBLrEqIyELXTR3O5tkHmnA5qk=; b=Tpwucb4Lm6LrT/TKPHnm6aybzpHHyiXQDuBR/kz653CmYSIvZGZQrrJXbI6dt2sG+J +ieBm30yLxXGoIRvtaJ7nxmH66bZ1rS2RCt97BDGsFK82/J9jiJMjRrwlHAmVR5HUolc sLiD9x7q35cpDW97PZ+8PSdj0Ax3tGZPt6QnGdVaLfhMo2wAqlDcbH4Ofr+5PbuY7tfO Gd8axeQSit/+5PWBgWnAFf9gm0p3yv9LIvykAiBEFzT8gvNf2ngvwsMv+1RreorO8+So WOJjGNKl4BMwO/yveiDaRq7WyPzGpGua+OxjrAqvLblj3lAo9NfmO43H/OjMhaOrJqiL urGQ== 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 b68si6046101oii.117.2020.03.10.05.11.23; Tue, 10 Mar 2020 05:11:42 -0700 (PDT) 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 S1726483AbgCJMIi (ORCPT + 99 others); Tue, 10 Mar 2020 08:08:38 -0400 Received: from metis.ext.pengutronix.de ([85.220.165.71]:54059 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726205AbgCJMIh (ORCPT ); Tue, 10 Mar 2020 08:08:37 -0400 Received: from pty.hi.pengutronix.de ([2001:67c:670:100:1d::c5]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jBdgG-0008Dd-VG; Tue, 10 Mar 2020 13:08:16 +0100 Received: from ukl by pty.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1jBdgE-00032B-AO; Tue, 10 Mar 2020 13:08:14 +0100 Date: Tue, 10 Mar 2020 13:08:14 +0100 From: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= To: Guenter Roeck Cc: Guru Das Srinagesh , linux-pwm@vger.kernel.org, Thierry Reding , Subbaraman Narayanamurthy , linux-kernel@vger.kernel.org, Kamil Debski , Bartlomiej Zolnierkiewicz , Jean Delvare , Liam Girdwood , Mark Brown , linux-hwmon@vger.kernel.org Subject: Re: [PATCH v7 03/13] hwmon: pwm-fan: Use 64-bit division macros for period and duty cycle Message-ID: <20200310120814.4kjxmii3c7zxw55y@pengutronix.de> References: <20200309214822.GA19773@roeck-us.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200309214822.GA19773@roeck-us.net> User-Agent: NeoMutt/20170113 (1.7.2) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c5 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Guenter, On Mon, Mar 09, 2020 at 02:48:22PM -0700, Guenter Roeck wrote: > On Mon, Mar 09, 2020 at 12:35:06PM -0700, Guru Das Srinagesh wrote: > > Because period and duty cycle are defined in the PWM framework structs > > as ints with units of nanoseconds, the maximum time duration that can be > > set is limited to ~2.147 seconds. Redefining them as u64 values will > > enable larger time durations to be set. > > > > As a first step, prepare drivers to handle the switch to u64 period and > > duty_cycle by replacing division operations involving pwm period and duty cycle > > with their 64-bit equivalents as appropriate. The actual switch to u64 period > > and duty_cycle follows as a separate patch. > > > > Where the dividend is 64-bit but the divisor is 32-bit, use *_ULL > > macros: > > - DIV_ROUND_UP_ULL > > - DIV_ROUND_CLOSEST_ULL > > - div_u64 > > > > Where the divisor is 64-bit (dividend may be 32-bit or 64-bit), use > > DIV64_* macros: > > - DIV64_U64_ROUND_CLOSEST > > - div64_u64 > > There is no explanation why this is necessary. What is the use case ? > It is hard to imagine a real-world use case with a duty cycle of more > than 2 seconds. When my Laptop is in suspend there is an LED that blinks with a period of approximately 5 seconds. (To be fair, the brightness is more a sinus than a rectangle, but still.) Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | https://www.pengutronix.de/ |