From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) (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 E55863C13FA for ; Thu, 23 Apr 2026 08:27:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776932850; cv=none; b=ZWppU3+utzZ/qNfOzPZUmA2M9GbCQnAy1k8iFARl4ldDn923tAbSY3F2NynCX1/mxk6RN7SWYrI/tBCfkJDkGWpHKx8dA+Zq60RJlU1bRqz0JECULMTOFCXwx8mQAxo3wcKVN3nrPYVWGA5u+s39f1yuxe43Lhb8mlDQgKE4yPs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776932850; c=relaxed/simple; bh=Sw7pGrtm03rFb4w9v39tqqiV52NCp2AS9QRYBO9QZEI=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=EUAjrVLc+o+dboYFDvAnhYIguF5O6QAF8KUkiLE1uWrukEdw24MqVk6eMbV0XReWCFkXoxOyqEI7fWlweoOnKnPxKQNe66pqT6KMM1RBOaCTuFzXCw3rgQ2LyesUkqhXPKjeBXxAbR0ROUywpW48B/gx+DL7YwkluLbI37fBfj4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=ESfXel+i; arc=none smtp.client-ip=209.85.221.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="ESfXel+i" Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-43d7650202fso4937432f8f.2 for ; Thu, 23 Apr 2026 01:27:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1776932847; x=1777537647; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=gZ9c/QPUCIYiqT/6G4zjKY9VFibIqgyzyOicvyBMlCE=; b=ESfXel+iXEhRu8or/8B/CHlG2qgtSM62kF7DGBx3hjExRqRl+WrXFfdZlPjzsaorKC JBfinXWjSlvnQGE2p7cC/YHkGoh7F08x1AwSkOq+hwRdkomRygM5qyp/H6m3Phcviyd4 px0HMJKigULib8w7RAO+A/zgSylw7rPBM+Y5E+hnEAuYWU/xdVjkA1Dy6MacGQTdlIHL mj3B3wsrlu5gHf+puzWtwVioG7XmZ6KsWbLvwkQ33yCyionpR2ExWm/HDoCDgow81nDb VdxzRl7SscSMFVLHI+Wb5MbhCMiw5H7IISwH6elm6rbkvUQ0lm3Qg66amYNTeJ0ubPHz vyNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776932847; x=1777537647; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=gZ9c/QPUCIYiqT/6G4zjKY9VFibIqgyzyOicvyBMlCE=; b=dWy/OG5/E3k75JWTPijQSNhg8JEfPY+8/kw6c+/vLqvHrNMqCv0jab/UoiSas9dyzW tNiDy9WocAbQHi3JdFYCj2hcRlGE3AGnTThy/V1VKn6e1SNEKVjiw5Z3aOC9WJ7l4/vN n/h0qJBH7v0d8JdsaNAHO+JYbYJh+YybMmHUTN5jQ/hm5sA+5rvxd2Ib1Gz7cphWbvJg norwKQT5JHGsGvQV6k8XzT3VIuD2lKmjCM0e9L2yFdxr7Z9Ld8TCNalpC9Xo51Ok7fhU OPibKJkgXuwY0TvkZWHH47IA8NeOtNJlCRzYfaa477nMxyR/di8PUiJz0OqY95LsfQhF Lehw== X-Forwarded-Encrypted: i=1; AFNElJ8yc0SaBhi2YlPFHVaMM43BorXC7o4bfqAtsYkR6DubIdOMidAiJHYoxQ82D/tJkCB7Z57iWdyxm4qud3E=@vger.kernel.org X-Gm-Message-State: AOJu0YzHdeNagC+zEdCOFnUvY1q12Jg/TLYg7VKHSchUoWRNYkh3WQWq Vjrzi699vqGdBAVFod4ek44/0gupreXMfZSzcE3KJ9jEcIqpKp9gmjageot4yxoZ76o= X-Gm-Gg: AeBDievOSuS6uvS8w0GiDKmlkZoN0qteaj9PBopqQJO7cCSHUHQAWrJLwzaPlMmlr6u 9u0mIKLS7weD6++QP5AfGYK6dQ48p1VllnaVv4j2HSJ7M9qvWgQDrniGfnO3K6LzQD1FSzOeW4k XHDViJKk7cTEZhDAWxsgWp+vvqVpkaXqABZew8cuzPNCS3yQTBVdbBIX+/tB3Urvug2Gzf/S6DW Hd2VYZb8a26QDhlOBiHAIXXMIyeo41owJPjZjnXEmlpkC7bkWxIhA6pD1PzZGFPqzIWWaSWL1Mo hChyFv8Nbq4DUQ4kYrm5KYHfxROH+LnveywLzRHF+7Bdd/Bakz24xZ6RFbGAYtczle2UP77GtiN Ao4/p0KESl6J/l5jqSJjlugmykdC0HjcfdyzkV9T//XuTq/wUmP95TlWPRJjmRuxfN1SwBG3E5J uz+OkXBBCfd8BvWYAtGUnKgHIoLPu4vvWd5NQpryjGwD6UY5JHm5F24UVhMjkRh7O/OnIDFKJt3 5l/1RzfEukhTHd9qA== X-Received: by 2002:a05:6000:4313:b0:441:2ba8:79f with SMTP id ffacd0b85a97d-4412ba807bamr4088356f8f.37.1776932846520; Thu, 23 Apr 2026 01:27:26 -0700 (PDT) Received: from localhost (host-79-33-140-232.retail.telecomitalia.it. [79.33.140.232]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43fe4cb1176sm52641843f8f.3.2026.04.23.01.27.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2026 01:27:26 -0700 (PDT) From: Andrea della Porta To: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , linux-pwm@vger.kernel.org, Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Broadcom internal kernel review list , Andrea della Porta , devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Naushir Patuck , Stanimir Varbanov , mbrugger@suse.com Subject: [PATCH v3 0/3] Add RP1 PWM controller support Date: Thu, 23 Apr 2026 10:30:18 +0200 Message-ID: X-Mailer: git-send-email 2.51.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit This patchset adds support for the PWM controller found on the Raspberry Pi RP1 southbridge. This is necessary to operate the cooling fan connected to one of the PWM channels. The tachometer pin for the fan speed is managed by the firmware running on the RP1's M-core. It uses the PHASE2 register to report the RPM, which is then exported by this driver via syscon registers. A subsequent patch will add a new device and driver to read the RPM and export this value via hwmon. Subsequent patches will also add the CPU thermal zone, which acts as a consumer of the PWM device. Best regards, Andrea CHANGES in V3: - Refactored all the register macros. They now have RP1_PWM_ prefix and follow the register name. - Dropped the tab alignment in front of struct declarations (use a space instead). - Added a check in tohw() to test (and bail out quickly) in case that period_length_ns is zero. - Probing now returns an error if clk_rate > 1 GHz. - Added a check on minimum period ticks. Return 1 to signal round-up. - Fixed inverted polarity detection on edge cases. - Fixed rounding errors (in both tohwi() and fromhw()) in inverted polarity calculations. - Dropped a redundant check on period >= duty. - Replaced memset by inline struct init. - Disabling a channel now is faster, skipping the duty/period/polarity setup. - Fixed an error string (s/Fail/Failed) - Used %pe to signal error string instead of an integer. - Added several new sections to the Limitations paragraph to better explain what will happen on edge cases. - Maximum period is now U32_MAX-1 to allow 100% duty cycle on all selectable periods. - The hw period register now takes into account for the extra tick at the end of the period (subtracted one to wfhw->period_ticks in tohw and added 1 in fromhw). - Added .remove() callback to free resources even if the driver is not unbindable/unloadable, to avoid accumulating tech debt. Naushir Patuck (2): dt-bindings: pwm: Add Raspberry Pi RP1 PWM controller pwm: rp1: Add RP1 PWM controller driver Stanimir Varbanov (1): arm64: dts: broadcom: rpi-5: Add RP1 PWM node .../bindings/pwm/raspberrypi,rp1-pwm.yaml | 54 +++ .../boot/dts/broadcom/bcm2712-rpi-5-b.dts | 12 + arch/arm64/boot/dts/broadcom/rp1-common.dtsi | 10 + drivers/pwm/Kconfig | 9 + drivers/pwm/Makefile | 1 + drivers/pwm/pwm-rp1.c | 414 ++++++++++++++++++ 6 files changed, 500 insertions(+) create mode 100644 Documentation/devicetree/bindings/pwm/raspberrypi,rp1-pwm.yaml create mode 100644 drivers/pwm/pwm-rp1.c -- 2.35.3