Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2485257rdb; Wed, 4 Oct 2023 02:40:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFipiZRB/5F/q7wn0DCzaO6HHnJAt00NxTvpn+aU88MZsaM8UPgnPulqJoQA1IbMGRiv3tb X-Received: by 2002:a17:90a:7061:b0:279:e3a:1bd3 with SMTP id f88-20020a17090a706100b002790e3a1bd3mr7731079pjk.21.1696412444801; Wed, 04 Oct 2023 02:40:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696412444; cv=none; d=google.com; s=arc-20160816; b=SUOhBovNgatlwaCefToQr5X0njXjpvPMwvUV3uK08qP1oK0lc3U25kLB1/qxqY/dVD AX6RWjTyKfV43tCLd64oik1eSNNU+LoTjhz0MacvWRwN57GRBtccpfSVJV89xZrMk2Jy +s9HEPxAX9CEWx13HmJzybyVtGLufDlkTQ8U+CLeztI4ke6UO1oVXqOZ7idrRu9KjLPw apMsPbBXxTyjqKoYrr1lneTKo7fBzWtfgIO9OhaK/663tXAgYwD3LGmccqZhxEL66Pef /0H09yiAxqSWUUgR9HhuDjfLm4c19y8UkZ54lHW5CNoPb28HWWiBarrQcYuUh7bCLfZ2 5J5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=NS3482MbYtMUZxHvRdxuNgKq0sufiewSUSfVEUhp1Qc=; fh=l53NGSUWVwSFbDpxOdi+UhGzdVINQI32LnYbYIyTtx4=; b=FJn6gDh1hB9K6XAFyHFsKB9e99bzuim7WbM1tjIZbjmdCFdTxeMMqzBlHt0wPo7+XM JTBfqUAqJhaLjvH7Vps+9YOvnu0JCwLiKTsqnDUAbQ7SFRZcz4cM/72gSi5m2I/CRcXE 4BowIcA2PSTxHtdxJSv/qs5yzAMd6HGlBIRHi34G41lDC+ZXMyqTxH4mxqO3DYe1/pBE bx30xJCscv68sQRNU9Gh+8eiuxHpt1dXldZCzfDhVdM/dGaPv9cE716H24z+/vgyTrmV SlBzmN1KUg+AqhTuKtvM2SOFy/uwOZshURP+eNt4jtv24vwBlhAcs+OIV1mFRLiwEwL1 iDCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=j8Tr0MiZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id u18-20020a17090abb1200b002792c288cb7si1119842pjr.131.2023.10.04.02.40.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 02:40:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=j8Tr0MiZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 2A08881FDBA4; Wed, 4 Oct 2023 02:39:54 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242035AbjJDJjk (ORCPT + 99 others); Wed, 4 Oct 2023 05:39:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232956AbjJDJjj (ORCPT ); Wed, 4 Oct 2023 05:39:39 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E278A7; Wed, 4 Oct 2023 02:39:36 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E8B7C433C7; Wed, 4 Oct 2023 09:39:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696412376; bh=Mo9aBSue9VgCsnzG+WTcEHnQB+oqgaq0bf1pV4lpD7s=; h=From:To:Cc:Subject:Date:From; b=j8Tr0MiZaTgG2SgRnZTV7+1OuMwIoz8poMpoC5wZM+h+1Wp4gQhB4uJc1OrJl+iy5 BCr2XqZ4FzC8o71iWEgHlY+LnM2NJ/B65xYXFLwZsaDurmNYivr+ESxvNYTCt15on0 22gtaA35KcSe0zY1WSNEAfOGavpt0Kybof/3PViaXe0KKQARS5XTjO1z5mY/WacIb+ F8GNHTNlNPExRwrVtO6lMtuzaZJbGKeVcsNCD2lwMUFId/wUEIMzEkM+Zliflf57vk uYdwjXA3ljT6I2G0oxpzTqdY2qODHtv0meyVUVbnKQpVKvTyuY0s90QZe19scZvsuP 5AZ15FkVv8lGA== From: Jisheng Zhang To: Thierry Reding , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-pwm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org Subject: [PATCH v2 0/2] pwm: add driver for T-THEAD TH1520 SoC Date: Wed, 4 Oct 2023 17:27:29 +0800 Message-Id: <20231004092731.1362-1-jszhang@kernel.org> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Wed, 04 Oct 2023 02:39:54 -0700 (PDT) T-HEAD SoCs such as the TH1520 contain a PWM controller used to control the LCD backlight, fan and so on. Add the PWM driver support for it. Since the clk part isn't mainlined, so SoC dts(i) changes are not included in this series. However, it can be tested by using fixed-clock. since v1: - update commit msg and yaml filename to address Conor's comment - use devm_clk_get_enabled() and devm_pwmchip_add() - implement .get_state() - properly handle overflow - introduce thead_pwm_from_chip() inline function - document Limitations - address pm_runtime_get/put pingpong comment Jisheng Zhang (2): dt-bindings: pwm: Add T-HEAD PWM controller pwm: add T-HEAD PWM driver .../bindings/pwm/thead,th1520-pwm.yaml | 44 +++ MAINTAINERS | 1 + drivers/pwm/Kconfig | 11 + drivers/pwm/Makefile | 1 + drivers/pwm/pwm-thead.c | 274 ++++++++++++++++++ 5 files changed, 331 insertions(+) create mode 100644 Documentation/devicetree/bindings/pwm/thead,th1520-pwm.yaml create mode 100644 drivers/pwm/pwm-thead.c -- 2.40.1