From patchwork Thu Mar 19 20:50:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Guru Das Srinagesh X-Patchwork-Id: 11448037 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 992A5139A for ; Thu, 19 Mar 2020 20:50:30 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 77C4620774 for ; Thu, 19 Mar 2020 20:50:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="f+3tSKtd" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 77C4620774 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Message-Id:Date:Subject: To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=crUR3F6rOB4aQSuOXNfor8qJn+NhGSkYlMA336YIg0Y=; b=f+3tSKtdvBb89r db4scIAAjGZMxgP7ylSkQpzNeou1DsOfZs1zY4GLShhMjKV0GIN/IlrT8auO6yAxetNtx0bhdz1RR mdROjSrsOi1J71OabF5nt5q41Rdn27Q/2d625s+i+X5jaUzHtQEk8k9mrLfXbKHeg0x91ugMXjCd3 vF1wbfRAw/tQs9hYcnsnM/TjYMupJA3chChrOQPwCKJ9KhOCQtgtHPMaF6fkd/ekexLegtrfBZLkS J+7ZOBUFliGIVZUfPHqGdsgQAepP9FVdimiZtQQO5KX8/OESmFW82OAnXbypcfsIPYtN6l468JtVE qNjB/9BwRqTwYYjdKJzQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jF27V-00013v-JD; Thu, 19 Mar 2020 20:50:25 +0000 Received: from alexa-out-sd-01.qualcomm.com ([199.106.114.38]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jF27R-00012e-1t for linux-riscv@lists.infradead.org; Thu, 19 Mar 2020 20:50:23 +0000 Received: from unknown (HELO ironmsg04-sd.qualcomm.com) ([10.53.140.144]) by alexa-out-sd-01.qualcomm.com with ESMTP; 19 Mar 2020 13:50:19 -0700 Received: from gurus-linux.qualcomm.com ([10.46.162.81]) by ironmsg04-sd.qualcomm.com with ESMTP; 19 Mar 2020 13:50:18 -0700 Received: by gurus-linux.qualcomm.com (Postfix, from userid 383780) id 8C5064B82; Thu, 19 Mar 2020 13:50:18 -0700 (PDT) From: Guru Das Srinagesh To: linux-pwm@vger.kernel.org Subject: [PATCH v10 00/12] Convert PWM period and duty cycle to u64 Date: Thu, 19 Mar 2020 13:50:03 -0700 Message-Id: X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200319_135021_573606_7FDC6FEE X-CRM114-Status: GOOD ( 18.66 ) X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [199.106.114.38 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kate Stewart , Daniel Vetter , linux-fbdev@vger.kernel.org, David Airlie , "Wesley W. Terpstra" , Michael Turquette , Joonas Lahtinen , Kamil Debski , dri-devel@lists.freedesktop.org, Liam Girdwood , Atish Patra , Thierry Reding , Benjamin Gaignard , linux-riscv@lists.infradead.org, Lee Jones , linux-clk@vger.kernel.org, =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= , Alexandre Torgue , Guru Das Srinagesh , Daniel Thompson , Mauro Carvalho Chehab , Axel Lin , Arnd Bergmann , Alexander Shiyan , Fabio Estevam , Chen-Yu Tsai , NXP Linux Team , Mukesh Ojha , Gerald Baeza , intel-gfx@lists.freedesktop.org, Guenter Roeck , linux-media@vger.kernel.org, Jean Delvare , Maxime Coquelin , =?utf-8?q?Uwe_Kleine-K=C3=B6ni?= =?utf-8?q?g?= , Bartlomiej Zolnierkiewicz , Sascha Hauer , Maarten Lankhorst , Maxime Ripard , Rodrigo Vivi , Mark Brown , Jani Nikula , Paul Walmsley , Subbaraman Narayanamurthy , Thomas Gleixner , Fabrice Gasnier , Ding Xiang , Pengutronix Kernel Team , Allison Randal , linux-hwmon@vger.kernel.org, Chris Wilson , Anson Huang , Richard Fontana , Stephen Boyd , Jingoo Han , linux-kernel@vger.kernel.org, Yash Shah , Palmer Dabbelt , Dan Carpenter , Philipp Zabel , Shawn Guo Sender: "linux-riscv" Errors-To: linux-riscv-bounces+patchwork-linux-riscv=patchwork.kernel.org@lists.infradead.org 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. Consequently, applications desiring to set greater time periods via the PWM framework are not be able to do so - like, for instance, causing an LED to blink at an interval of 5 seconds. Redefining the period and duty cycle struct members in the core PWM framework structs as u64 values will enable larger time durations to be set and solve this problem. Such a change to the framework mandates that drivers using these struct members (and corresponding helper functions) also be modified correctly in order to prevent compilation errors. This patch series introduces the changes to all the drivers first, followed by the framework change at the very end so that when the latter is applied, all the drivers are in good shape and there are no compilation errors. Changes from v9: - Gathered the received "Reviewed-by: " tag - Added back the clk-pwm.c patch because kbuild test robot complained [3] and addressed received review comments. - clps711x: Addressed review comments. Changes from v8: - Gathered all received "Acked-by: " and "Reviewed-by: " tags - Dropped patch to clk-pwm.c for reasons mentiond in [2] - Expanded audience of unreviewed patches Changes from v7: - Changed commit messages of all patches to be brief and to the point. - Added explanation of change in cover letter. - Dropped change to pwm-sti.c as upon review it was unnecessary as struct pwm_capture is not being modified in the PWM core. Changes from v6: - Split out the driver changes out into separate patches, one patch per file for ease of reviewing. Changes from v5: - Dropped the conversion of struct pwm_capture to u64 for reasons mentioned in https://www.spinics.net/lists/linux-pwm/msg11541.html Changes from v4: - Split the patch into two: one for changes to the drivers, and the actual switch to u64 for ease of reverting should the need arise. - Re-examined the patch and made the following corrections: * intel_panel.c: DIV64_U64_ROUND_UP -> DIV_ROUND_UP_ULL (as only the numerator would be 64-bit in this case). * pwm-sti.c: do_div -> div_u64 (do_div is optimized only for x86 architectures, and div_u64's comment block suggests to use this as much as possible). Changes from v3: - Rebased to current tip of for-next. Changes from v2: - Fixed %u -> %llu in a dev_dbg in pwm-stm32-lp.c, thanks to kbuild test robot - Added a couple of fixes to pwm-imx-tpm.c and pwm-sifive.c Changes from v1: - Fixed compilation errors seen when compiling for different archs. v1: - Reworked the change pushed upstream earlier [1] so as to not add an extension to an obsolete API. With this change, pwm_ops->apply() can be used to set pwm_state parameters as usual. [1] https://lore.kernel.org/lkml/20190916140048.GB7488@ulmo/ [2] https://lore.kernel.org/lkml/20200312190859.GA19605@codeaurora.org/ [3] https://www.spinics.net/lists/linux-pwm/msg11906.html Guru Das Srinagesh (12): drm/i915: Use 64-bit division macro hwmon: pwm-fan: Use 64-bit division macro ir-rx51: Use 64-bit division macro pwm: clps711x: Cast period to u32 before use as divisor pwm: pwm-imx-tpm: Use 64-bit division macro pwm: imx27: Use 64-bit division macro and function pwm: sifive: Use 64-bit division macro pwm: stm32-lp: Use %llu format specifier for period pwm: sun4i: Use 64-bit division function backlight: pwm_bl: Use 64-bit division function clk: pwm: Assign u64 divisor to unsigned int before use pwm: core: Convert period and duty cycle to u64 drivers/clk/clk-pwm.c | 4 +++- drivers/gpu/drm/i915/display/intel_panel.c | 2 +- drivers/hwmon/pwm-fan.c | 2 +- drivers/media/rc/ir-rx51.c | 3 ++- drivers/pwm/core.c | 4 ++-- drivers/pwm/pwm-clps711x.c | 5 ++++- drivers/pwm/pwm-imx-tpm.c | 2 +- drivers/pwm/pwm-imx27.c | 5 ++--- drivers/pwm/pwm-sifive.c | 2 +- drivers/pwm/pwm-stm32-lp.c | 2 +- drivers/pwm/pwm-sun4i.c | 2 +- drivers/pwm/sysfs.c | 8 ++++---- drivers/video/backlight/pwm_bl.c | 3 ++- include/linux/pwm.h | 12 ++++++------ 14 files changed, 31 insertions(+), 25 deletions(-) Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han Cc: Bartlomiej Zolnierkiewicz Cc: linux-fbdev@vger.kernel.org Cc: Maxime Ripard Cc: Chen-Yu Tsai Cc: Philipp Zabel Cc: Fabrice Gasnier Cc: Maxime Coquelin Cc: Alexandre Torgue Cc: Palmer Dabbelt Cc: Paul Walmsley Cc: linux-riscv@lists.infradead.org Cc: Yash Shah Cc: Atish Patra Cc: Shawn Guo Cc: Sascha Hauer Cc: Pengutronix Kernel Team Cc: Fabio Estevam Cc: NXP Linux Team Cc: Sascha Hauer Cc: Pengutronix Kernel Team Cc: Fabio Estevam Cc: NXP Linux Team Cc: Alexander Shiyan Cc: Mauro Carvalho Chehab Cc: Richard Fontana Cc: Thomas Gleixner Cc: Kate Stewart Cc: Allison Randal Cc: linux-media@vger.kernel.org Cc: Kamil Debski Cc: Bartlomiej Zolnierkiewicz Cc: Jean Delvare Cc: Guenter Roeck Cc: Liam Girdwood Cc: Mark Brown Cc: linux-hwmon@vger.kernel.org Cc: Jani Nikula Cc: Joonas Lahtinen Cc: David Airlie Cc: Daniel Vetter Cc: Chris Wilson Cc: "Ville Syrjälä" Cc: intel-gfx@lists.freedesktop.org Cc: dri-devel@lists.freedesktop.org Cc: Michael Turquette Cc: Stephen Boyd Cc: linux-clk@vger.kernel.org Cc: Rodrigo Vivi Cc: Maarten Lankhorst Cc: Arnd Bergmann Cc: Mukesh Ojha Cc: Dan Carpenter Cc: Anson Huang Cc: Gerald Baeza Cc: Benjamin Gaignard Cc: Axel Lin Cc: Ding Xiang Cc: Wesley W. Terpstra