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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 0DF83C44512 for ; Thu, 16 Jul 2026 15:29:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=kyrnJ2HVNlROAH9IfoAcIDk9irdu02X3VrWYVuptvgM=; b=aS84H3pDQ45b8q7EbXe1yf1d+6 2QEPmv4uLJBOQQFbtrj0tF8YwNE6+tCcWesq77TyQe8qsVcRPrZKE2bmDgjmpE9q6H69UotsEKDIg zg7SPJigW/rG3fQ1+gmvrBbL22BTUFG+mHUe8bjmPEipjsN2zhdXddGxFk1bwSfDY3sO3aOuzw9h3 eesgucgIir1VWm4Q+nFHagaS5PvHP10fUcO4mLWx5j1/DclpzmcejFa986ZcBND1HATDExJhmKj/K c5Ln0jg7Iuw1fcz9alBPo1uzgHFBQNUOOcMmvNe+cdAjOUojTeqawqFAKAOtP3xyDlKhbLBXZs94F Wsr+shvg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wkO1t-000000003RH-3Su0; Thu, 16 Jul 2026 15:29:41 +0000 Received: from sea.source.kernel.org ([172.234.252.31]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1wkO1r-000000003QU-3Lh0 for linux-arm-kernel@lists.infradead.org; Thu, 16 Jul 2026 15:29:39 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with UTF8SMTP id 7EF0E42A95; Thu, 16 Jul 2026 15:29:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with UTF8SMTPSA id D48871F000E9; Thu, 16 Jul 2026 15:29:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1784215779; bh=kyrnJ2HVNlROAH9IfoAcIDk9irdu02X3VrWYVuptvgM=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=TzEcp0g4579s4xbXT2Rx/tV0OU5tUuMTvLn/8CYkJtvCTa6RRp5KkMNKul2lX9T6u lKA42fE6/hN7AJ6KxvWcgl7kr0dNbXmIEiZVyp8vr6gKzZwWglICVXvcuZ5q4LdDRt x6dtBYKBQhrqQvqs0CHWyeOqIoH459G3IBFjmmJge5mflzXtT9GKJxJSzbrjpPz3Xz vF00+v3WJNn8E0j72TGIkGxedS8BlXuo9DmGO/RO5Bvhe9J/ZTNvupzN/OvDHBRghx 2xnHRtZt4LmeofU8LT1l30VuYy5OMwlIY1uvnjhdhCL3Mxb/8QKRHSTPGxLy/3DOCS JvOWgqpkNzp+g== Date: Thu, 16 Jul 2026 17:29:37 +0200 From: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= To: Chi-Wen Weng Cc: robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, linux-arm-kernel@lists.infradead.org, linux-pwm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, cwweng@nuvoton.com, Trevor Gamblin Subject: Re: [PATCH v4 2/2] pwm: Add Nuvoton MA35D1 PWM controller support Message-ID: References: <20260617025925.2539334-1-cwweng.linux@gmail.com> <20260617025925.2539334-3-cwweng.linux@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="vnwt4hsu7dtmhebl" Content-Disposition: inline In-Reply-To: <20260617025925.2539334-3-cwweng.linux@gmail.com> X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --vnwt4hsu7dtmhebl Content-Type: text/plain; protected-headers=v1; charset=us-ascii Content-Disposition: inline Subject: Re: [PATCH v4 2/2] pwm: Add Nuvoton MA35D1 PWM controller support MIME-Version: 1.0 Hello, On Wed, Jun 17, 2026 at 10:59:25AM +0800, Chi-Wen Weng wrote: > +#include > +#include > +#include > +#include > +#include Please don't include that file, should pull in the things you need from that file. > +#include > +#include > +#include > + > +#define MA35D1_REG_PWM_CTL0 0x00 > +#define MA35D1_REG_PWM_CTL1 0x04 > +#define MA35D1_REG_PWM_CNTEN 0x20 > +#define MA35D1_REG_PWM_PERIOD(ch) (0x30 + 4 * (ch)) > +#define MA35D1_REG_PWM_CMPDAT(ch) (0x50 + 4 * (ch)) > +#define MA35D1_REG_PWM_WGCTL0 0xb0 > +#define MA35D1_REG_PWM_WGCTL1 0xb4 > +#define MA35D1_REG_PWM_POLCTL 0xd4 > +#define MA35D1_REG_PWM_POEN 0xd8 > + > +#define MA35D1_PWM_CTL1_CNTMODE_MASK(ch) BIT(16 + (ch)) > +#define MA35D1_PWM_CTL1_OUTMODE_MASK(ch) BIT(24 + ((ch) / 2)) > + > +#define MA35D1_PWM_WGCTL_ACTION_MASK 0x3 > +#define MA35D1_PWM_WGCTL_ACTION_LOW 1 > +#define MA35D1_PWM_WGCTL_ACTION_HIGH 2 If you make this: #define MA35D1_PWM_WGCTL_ACTION(ch) GENMASK(2 * (ch) + 2, 2 * (ch)) #define MA35D1_PWM_WGCTL_ACTION_LOW 1 #define MA35D1_PWM_WGCTL_ACTION_HIGH 2 you can drop the static inlines below. > + > +#define MA35D1_PWM_WGCTL_ZERO_HIGH(ch) \ > + (MA35D1_PWM_WGCTL_ACTION_HIGH << (2 * (ch))) > +#define MA35D1_PWM_WGCTL_CMP_UP_LOW(ch) \ > + (MA35D1_PWM_WGCTL_ACTION_LOW << (2 * (ch))) > + > +#define MA35D1_PWM_CNTEN_EN(ch) BIT(ch) > +#define MA35D1_PWM_POEN_EN(ch) BIT(ch) > +#define MA35D1_PWM_POLCTL_INV(ch) BIT(ch) > + > +#define MA35D1_PWM_MAX_CMPDAT 0xffff > +#define MA35D1_PWM_MAX_PERIOD 0xfffe > +#define MA35D1_PWM_MAX_PERIOD_CYCLES (MA35D1_PWM_MAX_PERIOD + 1) This is irritating with similar names and different values/semantic. > +#define MA35D1_PWM_NUM_CHANNELS 6 > + > [...] > +static int nuvoton_pwm_probe(struct platform_device *pdev) > +{ > [...] > + nuvoton_pwm_init(nvtpwm); This clobbers what the hardware is doing. The idea here is to not modify the hardware settings at probe time to keep e.g. a backlight configured as it was setup by the bootloader and only modify on explicit calls to .apply(). > + > + chip->ops = &nuvoton_pwm_ops; > + chip->atomic = true; > + > + ret = devm_pwmchip_add(dev, chip); > + if (ret) > + return dev_err_probe(dev, ret, "Unable to add PWM chip\n"); > + > + return 0; > +} Best regards Uwe --vnwt4hsu7dtmhebl Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEP4GsaTp6HlmJrf7Tj4D7WH0S/k4FAmpY+N4ACgkQj4D7WH0S /k6t2ggAheUc/ihnKZtwZNGhIC3uzj83mpSYNAZepbhHbkXa31Mzdnt+h/tT4sn1 mpELBZ65mL0V6g2fFCU7ADnE4B08y6LY0Joa7gnhwJvomVpCHGaxuUz9xrz2n8Be 77CF/uiA1qFQIJPNOSitR4XR1kUwRTJPdBCQhHbBL36a+RnLlV5+bTTQ5AEYwq5k ELPBKwALXAnGQE1djJ9B0o/mTAeDHtuBJTN7UTp6bOcw23cq76rjPV/PfwhhTDg8 c63oZ/aobLfuqE/7FuSibebXh/fdI/J+IJVk5YhN7RZlwK0cLlW95CFY5zT7PtT5 QdlmEEpZ3RU6ip0h1KUyJNiu3J4Qjg== =nrGB -----END PGP SIGNATURE----- --vnwt4hsu7dtmhebl--