From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5A89413777E for ; Wed, 17 Jun 2026 02:59:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781665173; cv=none; b=ftDkSvgU+SgoIgx4OWFrYThsu/AjcnV7r40KqQpOgApHeTJKIECpeHrq5Lh9SmvjmFb31FXGQrfxG0MwwEWOnxfINEEX1XotQTSAeEipQ+4tkHSUr+i2Y+BN4Z9XPku+aki3O0zCuziTXwDHCbJyJwWMin6EvcWqjouBp6dDjPE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781665173; c=relaxed/simple; bh=mkBhvigEenoV7hVsKrScF2k37dBKNOTTn+0E9rJ/vAY=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=Tdo8HHcRmvXT7ei/zVPt1xhO3pupWfCQYNq1txEfP0AVaiu3ZhSFMfmSZ2Nm48fek+4kOn1SVb4NSy1K4bodNp11JWhUPmGvyuagD+ehKMjbnSnvqT45o0UeW+bpQ0MeEVVonCyDcjMCbrIEDL49QDAr0ZC3urmHnztxSKC8NuI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=hNudawiI; arc=none smtp.client-ip=209.85.210.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hNudawiI" Received: by mail-pf1-f178.google.com with SMTP id d2e1a72fcca58-842307472d4so2010731b3a.0 for ; Tue, 16 Jun 2026 19:59:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1781665172; x=1782269972; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=TBin7H0Wt7Oi8P0z8wsZgQQjqhBwvW2vxMHjxdsEcyI=; b=hNudawiICVnvIJbq7BFPLhcs2D6VhH0mROmU56PWBB4gUjIg3/1cluK7wFZPmGQRAK jGRfq1tY+tPaBSw4s3ZTA6Oor3yjsMvtmpMdPiFRYW5jm2ZHx2ncGB1AhPaj2eAuy4aD M0YRGV0A/d6AKwWgEjp+HeduDSUCFsXfJFxQ7P+0/2YlfB2IjsZFX1BPBlhkwPB2A4dH e8hbybM0cHps52NsoDXs57jyFSQ6/bVjjSy9EJLMbTNsc7V4OOL14yaPN+ZmUYcPqhpL LiuGiv34FnQ9VTt8iPstP9kHMK9uRJAwEA7VJRrnVHb53RBZ1uSF2imQAwznLdfyAFSp m84Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781665172; x=1782269972; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=TBin7H0Wt7Oi8P0z8wsZgQQjqhBwvW2vxMHjxdsEcyI=; b=DkgVTOJK1busmaeWfNtzkJKN4ZpRe0qmh3LPhemxyVqM6dhQ8q7dA9RzGObm929oTT tL1Uenp8snC7F62M/Xw/+5wldESUCMgzAaaOM4HOgyAlo4MMAEKm2YbTnqUkgH3Y29sJ cYIMsFILhfCrk1HlTtyvaeYEWT5stk6LkCeb0TmS/W5zWJsUI3HsWLdpWaBLLlBg9KQX VxhA6utaDpKAlVIl28HO61Y09m3taylk08C4lLJTZ9RpJ8cHZnkUXdwikN6L6AHQpA64 Y2M6FMxXGseR0Q9lYertNiHGd6eWicJrB1jrQqQAIhL6/vkDuAW60159rQ94NKzjc9e8 n3ww== X-Forwarded-Encrypted: i=1; AFNElJ9BKt8UAFX0fwnRQWOal4FE9akyMxyYl/Kyxnw37UgsQSFmHMeidsJAxpdDJ1sif5WPUlF+RKp4FJc8t2k=@vger.kernel.org X-Gm-Message-State: AOJu0YwVZU1BphIEHBF3dSCOe4TwaLOEyo7kKxkhtBr1xNu/MQNbUlkT QuDLWa1/kHSeJG5cg8DThenIXty51JrCMk+tvQHYlGpiT3Mgtplqh2ku X-Gm-Gg: Acq92OGX0muLGAIMrbxj860+uDGhkmj+6AqCuGq6wIxFN/hyLfwLp+//4ebyD0iH0hA Fwmd+6+1svu9Sw0iatudlPRuqOt7atnO1sF2U2Qro4Kz5v9Mjo6HbjcCpog5tXPkZkzH1Aui3Qb gSnU65wkK8c8wmPYa7RWRYMdLZOciSdArxuciYOBKMsd7gd+NUkMmFHjKbkeK4AKl9sIv7r1gQe xn2fQY/IimPolbdBbF+VLMH56ZGt7MeAIB5b1xHLsdX4xRBgnQGVBDRJOxSqb+apT90CoZWVa8l dWUIhmQFcPBkcuhA+VnTzfEnHK34oQ6UIlSRo7oArxvtQPidef5JLVjY0MFE4k6Hxv5tHJNmHSc tJLGwyM3jV8zycIIh+Rp9SB8v5jpJ7J1gwwS1OYoP8S4Kq9TlWAP6pVbRIk7TyioR+i3XS501hw umbUb0XgDfKhh/5/f1zMDk0N7aotgxPS+OkvgMr2bB8Zqk3N8OH3BAkOto8x+kl2Mof/KBGHrTN W4= X-Received: by 2002:a05:6a00:2987:b0:836:3f6a:3e7a with SMTP id d2e1a72fcca58-8452454cd35mr1655165b3a.26.1781665171696; Tue, 16 Jun 2026 19:59:31 -0700 (PDT) Received: from localhost.localdomain (60-250-196-139.hinet-ip.hinet.net. [60.250.196.139]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-8434afc825csm14212821b3a.36.2026.06.16.19.59.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jun 2026 19:59:31 -0700 (PDT) From: Chi-Wen Weng To: ukleinek@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-pwm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, cwweng@nuvoton.com, cwweng.linux@gmail.com Subject: [PATCH v4 0/2] pwm: Add Nuvoton MA35D1 PWM controller support Date: Wed, 17 Jun 2026 10:59:23 +0800 Message-Id: <20260617025925.2539334-1-cwweng.linux@gmail.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Chi-Wen Weng This series adds support for the Nuvoton MA35D1 PWM controller. The MA35D1 PWM controller provides 6 PWM channels. The hardware supports several counter types and output modes. This driver configures the controller to use up-counting mode, auto-reload mode and independent output mode. The waveform generator is configured to drive the output high at the zero point and low at the compare-up point. For the up-counting mode used by this driver, the counter counts from 0 to PERIOD inclusive. Therefore, the programmed period is PERIOD + 1 cycles. The hardware can generate 0% duty cycle with CMPDAT = 0 and 100% duty cycle with CMPDAT > PERIOD. To keep 100% duty cycle representable, the driver limits the maximum PERIOD value to 0xfffe and reserves CMPDAT = 0xffff for the full-duty case. The hardware buffers PERIOD and CMPDAT updates when IMMLDENn is disabled. The driver keeps IMMLDENn disabled, so period and duty cycle updates take effect at the end of the current period. Polarity and waveform-control changes are applied directly and may cause transient output changes if the PWM is running. When the PWM output is disabled by clearing POENn, the output pin is put into tri-state according to the MA35D1 reference manual. Changes in v4: - Add a Limitations section to describe the hardware capabilities and driver limitations. - Add a link to the MA35D1 reference manual. - Replace register address macros containing the base pointer with register offset macros. - Add readl/writel/rmw helper functions. - Rename TOTAL_CHANNELS to NUM_CHANNELS. - Use unsigned long for the cached clock rate. - Use devm_clk_rate_exclusive_get(). - Configure polarity before enabling the counter and output. - Add controller initialization for up-counting, auto-reload and independent output mode. - Configure the waveform generator for zero-point-high and compare-up-low output. - Fix the period conversion because the hardware period is PERIOD + 1 cycles. - Limit the maximum PERIOD value to 0xfffe so that CMPDAT = 0xffff can be used to generate 100% duty cycle. - Use CNTEN and POEN bits to report the enabled state in .get_state(). - Disable the PWM by clearing POENn and CNTENn. - Fix error message capitalization and trailing newlines. - Fix coding style issues reported by review/checkpatch-style tools. Changes in v3: - Update nuvoton,ma35d1-pwm.yaml - Add maintainers entry - Increse "#pwm-cells" to 3 - Update ma35d1 pwm driver - Make include header and macros definitions organized alphabetically - Rename macros REG_PWM_XXXX to MA35D1_REG_PWM_XXXX - Add macros for register address v2 resend: - Remove wrong 'Reviewed-by' tags. Changes in v2: - Update nuvoton,ma35d1-pwm.yaml - Fix 'maxItems' of 'reg' to 1. - Remove unused label - Update ma35d1 pwm driver - Remove MODULE_ALIAS() - Add chip->atomic = true Chi-Wen Weng (2): dt-bindings: pwm: Add Nuvoton MA35D1 PWM controller pwm: Add Nuvoton MA35D1 PWM controller support .../bindings/pwm/nuvoton,ma35d1-pwm.yaml | 45 +++ drivers/pwm/Kconfig | 9 + drivers/pwm/Makefile | 1 + drivers/pwm/pwm-ma35d1.c | 344 ++++++++++++++++++ 4 files changed, 399 insertions(+) create mode 100644 Documentation/devicetree/bindings/pwm/nuvoton,ma35d1-pwm.yaml create mode 100644 drivers/pwm/pwm-ma35d1.c -- 2.25.1