From patchwork Wed Feb 5 06:59:16 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Chen Wang X-Patchwork-Id: 13960639 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 32B5FC02192 for ; Wed, 5 Feb 2025 06:59:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=yifUXcP2X8XE4Dfu2keyzs/wVyDX02nPDc7GP3b4cZc=; b=bCjLTsikCKwveb OFOWa3If/O2aU2fbjda22+qWoEo8rV9DcfcdkzGp5u2100LrgfBKlT4vTiUNO6TDDfIdF+1Ltzbg9 K7/ZksGEa4PtTezrz311AR2PYd9tbTztjjMYgFi7GvBtWAF5ekms1anr9u/bplAxW0bU2Kj3d0HIH jIuKTRM35a1zLipmPsbYmGTHBLb1V1T+XdXpHak2gpDZTboyEfkJdk69dgb2EhwPYDZXvvyaHbNnu Kr61Z9yQtKN5jaBKJrO1yffvTVu6QikMHYI2PMbFQlvFchydsPxa8n6cfcX1MHwS00Y5cvs8N2W2q ANGuTVSTCeFONZyjvJ6g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tfZNq-00000002Sua-3n33; Wed, 05 Feb 2025 06:59:38 +0000 Received: from mail-ot1-x333.google.com ([2607:f8b0:4864:20::333]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tfZNo-00000002Sta-2mDb for linux-riscv@lists.infradead.org; Wed, 05 Feb 2025 06:59:37 +0000 Received: by mail-ot1-x333.google.com with SMTP id 46e09a7af769-724a5d04befso291095a34.1 for ; Tue, 04 Feb 2025 22:59:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1738738775; x=1739343575; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=UUFk6TgopSWQITCEbcE120wI7n+sBN7sqpPKgJ7PFf0=; b=HdvuLAzC3PTxXTMMADpxL4ByaKl6MJDZ2DD7wM9UrTMTbOI6Fb9yqK4LVkziPH5IIA C7fQXZp9W0nUPyblYM5pQ+UzXG3JZiuxPYXGf2S4nbQdLHUctoC3Ii84GfxW5WN8hUw6 mgkuDTh8cPHZHR6Ia2pKF6IwIIC1kzpi00VTeOc3gVNqGwuHF43feTGsal8rbtCmn2DZ VWZSepvSVwGibXDn/JTFU9tAK00dA2h6cGQYn8GgSdTIC70mjdgAbVzwHVTNKkYUJfx2 TNfN6JhnRpdBMKLBeVdSi5UXx7bnu/KFDQnJjCGqTlI5XJ885EN5Th69Au8e4hjbRtbO QYmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738738775; x=1739343575; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=UUFk6TgopSWQITCEbcE120wI7n+sBN7sqpPKgJ7PFf0=; b=NrU8VDrW6Gt07bhh9k2rTW3xCny7qju0lkjsGZS0zVDmcoputn9Bfy0WGxZIuL1W44 LJNw/9DVa9qEdypUTQUNEpvWiFCt088vsYhRmC3u0HQrxVtbxbgwmMorkd1L3TopXGi3 vUcQloDNuf0BMjJA46THjVt4KZ+KNRrEkJ+6Lr3R5ndyLlXKYVUEgvfrYGo7VPK04wQV zebpdsdRV6keQKgGVN40sPtB6WJAgmrHKVbw6cuHvf2g0Bm6w+lyDesVYts8eKXWfqry XUJnDvSC7mZ1+JNRHWr+p92B6vp+G+mdr4ApnWRgWJYGUGZlwk3//ote6GnJ37mo/at5 g5sQ== X-Forwarded-Encrypted: i=1; AJvYcCUj+0tWyvgyGKUb03xu7PubH97Ii7UY9J+/cdXco9eDMSnit3DV46kuPYM2DfrT3R/enAGuHQpklGGJEg==@lists.infradead.org X-Gm-Message-State: AOJu0YxNZDwbsITEAcliZJMewQVPV4aEbunR7+n0ou9gLoZVVVVchJaD kKv8nTSwqK3plGa9FvSZ3QivtRkAZUu+ug0b6imXlTHi8GtsTcA0 X-Gm-Gg: ASbGncuKSjhaxatKq/6K9E3C2WllYpAZZ0+QURcAD73l+hhIuLTifM9SIuc+bVjbl+l Mix5L3uJ46E6WUQs9GhZN9PJwoXuFS4j80o6723Quq3aTm06rXvdwXNHio5ahHkSLOm2vP2OSDg M7IV08E40pKvGsFynnl6cDBqA/HwThZlQ8EslF/m9FFIJb5JOIU/48p/BHV/TM1SUe3ryc0QAgI BMIGglmTrdCQ/SaCF7C/YRx4zuDS8j7XJZeO/AU1FgxgBsTV6NTj71e17qP+kj2Au1D8i+Yv3jW C4IKv+9YecASlp/2UsdNOv7v6g== X-Google-Smtp-Source: AGHT+IFG1SDTKozMPahzThei5PB6whL1v2BM+EVscsLeVPRgrXAkEdyUvEUjkRuufTiB8wtsfVoRXA== X-Received: by 2002:a05:6830:3204:b0:71d:efeb:7c78 with SMTP id 46e09a7af769-726976bd30cmr3273225a34.14.1738738774982; Tue, 04 Feb 2025 22:59:34 -0800 (PST) Received: from localhost.localdomain ([122.8.183.87]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-726617cba50sm3804291a34.16.2025.02.04.22.59.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Feb 2025 22:59:33 -0800 (PST) From: Chen Wang To: ukleinek@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, unicorn_wang@outlook.com, inochiama@outlook.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pwm@vger.kernel.org, linux-riscv@lists.infradead.org, chao.wei@sophgo.com, haijiao.liu@sophgo.com, xiaoguang.xing@sophgo.com, chunzhi.lin@sophgo.com Subject: [PATCH v7 0/3] pwm: Add pwm driver for Sophgo SG2042 Date: Wed, 5 Feb 2025 14:59:16 +0800 Message-Id: X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250204_225936_716425_D5BF0766 X-CRM114-Status: GOOD ( 13.01 ) X-BeenThere: linux-riscv@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-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org From: Chen Wang Add driver for pwm controller of Sophgo SG2042 SoC. Thanks, Chen --- Changes in v7: The patch series is based on v6.14-rc1. Fixed following issues as per comments from Uwe Kleine-König, thanks. - dt-bindings: change value of "#pwm-cells" from 2 to 3. - driver: rename variables period/hlperiod to period_ticks/hlperiod_ticks and improve coding of apply()/get_state(); use devm_reset_control_get_optional_shared_deasserted() instead of devm_reset_control_get_optional_shared() and reset_control_deassert(); add more comments and other miscellaneous code improvements. Changes in v6: Nothing major changes just rebased onto v6.13-rc1 and retested. You can simply review or test the patches at the link [6]. Changes in v5: The patch series is based on v6.12-rc1. You can simply review or test the patches at the link [5]. Updated driver to add resets property for pwm controller node as per suggestion from Inochi. Changes in v4: The patch series is based on v6.12-rc1. You can simply review or test the patches at the link [4]. Updated driver to set property atomic of pwm_chip to true as per suggestion from Sean. Changes in v3: The patch series is catched up with v6.12-rc1. You can simply review or test the patches at the link [3]. Add patch #3 for dts part change. Changes in v2: The patch series is based on v6.11-rc6. You can simply review or test the patches at the link [2]. Fixed following issues as per comments from Yixun Lan, Krzysztof Kozlowski and Uwe Kleine-König, thanks. - Some minor issues in dt-bindings. - driver issues, use macros with name prefix for registers access; add limitations comments; fixed potential calculation overflow problem; add .get_state() callback and other miscellaneous code improvements. Changes in v1: The patch series is based on v6.11-rc6. You can simply review or test the patches at the link [1]. Link: https://lore.kernel.org/linux-riscv/cover.1725536870.git.unicorn_wang@outlook.com/ [1] Link: https://lore.kernel.org/linux-riscv/cover.1725931796.git.unicorn_wang@outlook.com/ [2] Link: https://lore.kernel.org/linux-riscv/cover.1728355974.git.unicorn_wang@outlook.com/ [3] Link: https://lore.kernel.org/linux-riscv/cover.1729037302.git.unicorn_wang@outlook.com/ [4] Link: https://lore.kernel.org/linux-riscv/cover.1729843087.git.unicorn_wang@outlook.com/ [5] Link: https://lore.kernel.org/linux-riscv/cover.1733281657.git.unicorn_wang@outlook.com/ [6] --- Chen Wang (3): dt-bindings: pwm: sophgo: add PWM controller for SG2042 pwm: sophgo: add driver for Sophgo SG2042 PWM riscv: sophgo: dts: add pwm controller for SG2042 SoC .../bindings/pwm/sophgo,sg2042-pwm.yaml | 58 ++++++ arch/riscv/boot/dts/sophgo/sg2042.dtsi | 9 + drivers/pwm/Kconfig | 10 + drivers/pwm/Makefile | 1 + drivers/pwm/pwm-sophgo-sg2042.c | 196 ++++++++++++++++++ 5 files changed, 274 insertions(+) create mode 100644 Documentation/devicetree/bindings/pwm/sophgo,sg2042-pwm.yaml create mode 100644 drivers/pwm/pwm-sophgo-sg2042.c base-commit: 2014c95afecee3e76ca4a56956a936e23283f05b