From patchwork Fri Oct 28 16:52:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Finkelstein X-Patchwork-Id: 13024084 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 DE490C38A02 for ; Fri, 28 Oct 2022 16:54:54 +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:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=tfNutfytsLdHDcT82nFkHk4x6pMiLgLXpbcr//NDE5w=; b=oOwH0mhRwlBPXu dzwTccjvGxp1ybm01lon3HqdltBF5hEQVvrzuhEQ2plC011nCQodKpwxAGToOmvOq4sPqEG3EwM1u k0P1btURBtVrsBZvtWna3CNHuvPqwMWUN6TLaxgTV1pFrXD1Is6FBD+slGRgP2+77ABXrevFUARUa RgGH8rf2hR9Qhy6mFaEu4B1fJYuHo791wKlzjyQrHU+mColTnE2hiXA8gu/JbYO8heMzMSs70Hufx j+HII8q1flYRDmt0Q0t4UdLtNeZ9KXwdBW7JSPNHc218s6FE1eSFWi+MxV6Jx8G0qu4NWS8KetdfB /2J8LgDhrwE1K/ippZIg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ooSc3-0013Yr-Ui; Fri, 28 Oct 2022 16:53:45 +0000 Received: from mail-ed1-x532.google.com ([2a00:1450:4864:20::532]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ooSbt-0013RV-7i for linux-arm-kernel@lists.infradead.org; Fri, 28 Oct 2022 16:53:35 +0000 Received: by mail-ed1-x532.google.com with SMTP id y69so8728146ede.5 for ; Fri, 28 Oct 2022 09:53:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=C33seGVoVdC4qa6odCGMM1UoRMAEyPpQFpcRe9CmJUc=; b=ovzgyGUxkoVOneqlKtvwiYv658V+dDonx3OJ+SBev41qlLDg1NpzyH+GqBCCnE5/wv adSab9LjklbHjXr2q9nMNuRdXkNXuB2fnFCTEWPh+xrJVTgfyXf3s8qbhbhrf373AULi dnpRsp+VcGt8w0RhxPNVBx/ZjfqOBxgbXFuABBSweMNzZmHg5YBRtx4Rj+ozu4bJhiI3 B1X9dmEuc1tqAar4mMczvCBeEQ4W/aQx2njMj4QB2SodIrSm7s9C6wtJ22KYRAtH/4Jk VHPMotD+KziMDnWeFqOY3ADQhN5TcxjbT712+cPKrZ1c0PujS0Yj8VgRasDErFjMrXCv PBpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=C33seGVoVdC4qa6odCGMM1UoRMAEyPpQFpcRe9CmJUc=; b=Wt2hTyPHM/ZiSb2N47+OBV8yDuKDuZJSs6zbgAX23lqBA6LvylpshMNnBMm8vdYNUU HEDVGoBfYSehvQS06Yd4QQILwn325wfdW2uImLEMCIKMTgmmVBIl9FeLYqmv6C8EWiwF w5IYJmkl4vrdaZ9m1zRsCPeD0dkpXKtluehSDPa1cSYxCsLUjtvmOlduYeyCSAu96/am 6eqtjmSQ0xwUrp4S+OEwto7Pq+77/R8yITMUrvVdK5X8onS/TKWk2AUQOACzH/epFxWE Vyl2ORJBXGIAMyAk+wSU5Yusqu5nbqwRN8U3D0uex2S/F2ZrV3mEXNl32irgESKisR3k 8JaQ== X-Gm-Message-State: ACrzQf1t87OSMrxiR+rlHuWERz6pAAnsX9ez9lqxxDMCKWi2s7jJUQFC flybKI9psQ1WI45mcN75N+M= X-Google-Smtp-Source: AMsMyM7qjQeg/XqtG5uytmvtDH96ok5pg9w6JiGjPO1p1bwA9dri1+cSZQDgCvElbmA68t7nLMDJIg== X-Received: by 2002:a05:6402:5ca:b0:43b:6e01:482c with SMTP id n10-20020a05640205ca00b0043b6e01482cmr340391edx.189.1666976009647; Fri, 28 Oct 2022 09:53:29 -0700 (PDT) Received: from localhost ([88.227.58.131]) by smtp.gmail.com with UTF8SMTPSA id j22-20020a170906411600b0073d638a7a89sm2411522ejk.99.2022.10.28.09.53.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 28 Oct 2022 09:53:29 -0700 (PDT) From: Sasha Finkelstein To: thierry.reding@gmail.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org Cc: marcan@marcan.st, sven@svenpeter.dev, alyssa@rosenzweig.io, asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-pwm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Sasha Finkelstein Subject: [PATCH 1/4] dt-bindings: pwm: Add Apple PWM controller Date: Fri, 28 Oct 2022 19:52:13 +0300 Message-Id: <20221028165215.43662-2-fnkl.kernel@gmail.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: <20221028165215.43662-1-fnkl.kernel@gmail.com> References: <20221028165215.43662-1-fnkl.kernel@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221028_095333_412954_83188D21 X-CRM114-Status: GOOD ( 13.60 ) 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 Apple SoCs such as the M1 contain a PWM controller used among other things to control the keyboard backlight. Signed-off-by: Sasha Finkelstein --- .../devicetree/bindings/pwm/pwm-apple.yaml | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 Documentation/devicetree/bindings/pwm/pwm-apple.yaml diff --git a/Documentation/devicetree/bindings/pwm/pwm-apple.yaml b/Documentation/devicetree/bindings/pwm/pwm-apple.yaml new file mode 100644 index 000000000000..39dc32e00a3f --- /dev/null +++ b/Documentation/devicetree/bindings/pwm/pwm-apple.yaml @@ -0,0 +1,51 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/pwm/pwm-apple.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Apple FPWM controller + +maintainers: + - asahi@lists.linux.dev + - Sasha Finkelstein + +description: |+ + PWM controller used for keyboard backlight on ARM Macs + +properties: + compatible: + items: + - enum: + - apple,t8103-fpwm + - apple,t6000-fpwm + - apple,t8112-fpwm + - const: apple,s5l-fpwm + reg: + maxItems: 1 + + clocks: + maxItems: 1 + + power-domains: + maxItems: 1 + + "#pwm-cells": + const: 2 + +required: + - compatible + - reg + - clocks + +additionalProperties: false + +examples: + - | + pwm: fpwm@235044000 { + compatible = "apple,s5l-fpwm"; + reg = <0x2 0x35044000 0x0 0x4000>; + power-domains = <&ps_fpwm1>; + clocks = <&clkref>; + #pwm-cells = <2>; + }; From patchwork Fri Oct 28 16:52:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Finkelstein X-Patchwork-Id: 13024085 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 3E0F8C38A02 for ; Fri, 28 Oct 2022 16:55:56 +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:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=rGRZm1ty2F2iok2z3JpJs+2LDzRLLdT7aDVQE+AQii8=; b=juYISmJAmDBMXq 3+GY7p1XqDvCz0N6tSsNQuweZ6mZXc7iXdN1lPjdaPpC6tNS6oZ6t4cyf4AqoPg9b8k7TlHXgUL5g 4C/JyVpepdgIzbLr3xPru7ERv6HIn83d1NqD1dNujPNuw0cYMuh2vjwMRmk6j+LRepPaU9t8oFgbK apeip1hx+E5SrJf1PQYMyocvtB5nwp6XaU+BOtzDCkTyDbrkg1/yUc8U9Ogc3eBjt8vYEMsyryWjd /zhM/bNQRexibgvr2MyusvtyyEODYUmpeRmqu2dzkMwG+vqGQC1Ljz5MXynVFUlmyfJ3LNRXeqNnk fZUjhymPy0yPpakyJfzA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ooScp-0013v9-NS; Fri, 28 Oct 2022 16:54:32 +0000 Received: from mail-ed1-x52d.google.com ([2a00:1450:4864:20::52d]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ooScC-0013dA-OA for linux-arm-kernel@lists.infradead.org; Fri, 28 Oct 2022 16:53:54 +0000 Received: by mail-ed1-x52d.google.com with SMTP id a5so8695977edb.11 for ; Fri, 28 Oct 2022 09:53:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=T2JNSWKMPMcl8SDntvKymnSG5RXcFKKH/9/h36qTbJk=; b=NfOIQObmeUUmd5kyKTsOMM5SQW4HDExEwcC6UngYgjbFURggeAXn2mhKM18SongoQl yIHPR3/uC/SbYOSKHksblwlWPSNPjiAr2GG8gHgi2IrdW46yVuE7VqOxfgUO2z3v0ldV wXPNgP38lZr1jo36OMgyeIuug+bxwAPpsMDA9Ye3DHrrWrUEIPJ5EILP0WWbGjzdfpjH wHqTnaXxuq2Vv9LmIjxjI1Zo4SGJGEGmgNQLL4M9Qysjg/jJyRVu9yPD1WiWGQslsEYB mSSMN+WJAiAwTSBQYN6Q5dKt1UWB9aWfLIdlspXgw1U9YzJvnzLWTF6Dk1a38cJ9CV7G ox6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=T2JNSWKMPMcl8SDntvKymnSG5RXcFKKH/9/h36qTbJk=; b=h4pLTwfqiWKQ70DuQrlK6aZUPXRRv4DZMGxYaF5FfxUmNLZgTcgu3pTbA6G6M38fsl tvuwpReITD0nCgtCb1ssNy6BDTArpirTCWT70DXNWtrYlOj5IHbUe8M7LVu/N9xtCZIs U2uwqn4AD0sxy8s/YDxnO2fqJ6VHdZ5CuCo++vzAIigyVSvfdcLunKdO5T0zbX62xTuo 6/Vsq17tOTbJ/9OF7lMiFZ+nYo3jI3p5IcjOlAFvUFY3S3iyosaYpQmfyyGYdQYooPIh TU0hS8Rw3yqShjE2wow8IOhnYTKjFTRazUjCIkcIvSkVck8/M5E4SKs2M3Jdp+U/hQpU ogAg== X-Gm-Message-State: ACrzQf39ElMpvwb8CaEcp6Obd18qC2XUZ5TqVV70e5932Yvl4Xagp6oe JKf+CuX7v0c1lsXEU7QoG9Y= X-Google-Smtp-Source: AMsMyM5YdJ87bP+zIQvjAQl+rYHHGzVLuAsxI9PlvB5iRXrMZMUExp6NA4GXE0dpxodexsbZgEubzg== X-Received: by 2002:a05:6402:428f:b0:454:c988:4bb1 with SMTP id g15-20020a056402428f00b00454c9884bb1mr361047edc.196.1666976028172; Fri, 28 Oct 2022 09:53:48 -0700 (PDT) Received: from localhost ([88.227.58.131]) by smtp.gmail.com with UTF8SMTPSA id f30-20020a170906739e00b0078e05db7005sm2331200ejl.214.2022.10.28.09.53.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 28 Oct 2022 09:53:47 -0700 (PDT) From: Sasha Finkelstein To: thierry.reding@gmail.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org Cc: marcan@marcan.st, sven@svenpeter.dev, alyssa@rosenzweig.io, asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-pwm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Sasha Finkelstein Subject: [PATCH 2/4] pwm: Add Apple PWM controller Date: Fri, 28 Oct 2022 19:52:14 +0300 Message-Id: <20221028165215.43662-3-fnkl.kernel@gmail.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: <20221028165215.43662-1-fnkl.kernel@gmail.com> References: <20221028165215.43662-1-fnkl.kernel@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221028_095352_827066_959897D2 X-CRM114-Status: GOOD ( 23.05 ) 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 Adds the Apple PWM controller driver. Signed-off-by: Sasha Finkelstein --- drivers/pwm/Kconfig | 12 ++++ drivers/pwm/Makefile | 1 + drivers/pwm/pwm-apple.c | 124 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 137 insertions(+) create mode 100644 drivers/pwm/pwm-apple.c diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig index 60d13a949bc5..ec6acb368073 100644 --- a/drivers/pwm/Kconfig +++ b/drivers/pwm/Kconfig @@ -51,6 +51,18 @@ config PWM_AB8500 To compile this driver as a module, choose M here: the module will be called pwm-ab8500. +config PWM_APPLE + tristate "Apple SoC PWM support" + depends on ARCH_APPLE || (COMPILE_TEST && 64BIT) + help + Generic PWM framework driver for PWM controller present on + Apple SoCs + + Say Y here if you have an ARM Apple laptop, otherwise say N + + To compile this driver as a module, choose M here: the module + will be called pwm-apple. + config PWM_ATMEL tristate "Atmel PWM support" depends on ARCH_AT91 || COMPILE_TEST diff --git a/drivers/pwm/Makefile b/drivers/pwm/Makefile index 7bf1a29f02b8..19899b912e00 100644 --- a/drivers/pwm/Makefile +++ b/drivers/pwm/Makefile @@ -2,6 +2,7 @@ obj-$(CONFIG_PWM) += core.o obj-$(CONFIG_PWM_SYSFS) += sysfs.o obj-$(CONFIG_PWM_AB8500) += pwm-ab8500.o +obj-$(CONFIG_PWM_APPLE) += pwm-apple.o obj-$(CONFIG_PWM_ATMEL) += pwm-atmel.o obj-$(CONFIG_PWM_ATMEL_HLCDC_PWM) += pwm-atmel-hlcdc.o obj-$(CONFIG_PWM_ATMEL_TCB) += pwm-atmel-tcb.o diff --git a/drivers/pwm/pwm-apple.c b/drivers/pwm/pwm-apple.c new file mode 100644 index 000000000000..4cfa9bf435dc --- /dev/null +++ b/drivers/pwm/pwm-apple.c @@ -0,0 +1,124 @@ +// SPDX-License-Identifier: GPL-2.0 OR MIT +/* + * Driver for the Apple SoC PWM controller + * + * Copyright The Asahi Linux Contributors + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#define PWM_CONTROL 0x00 +#define PWM_ON_CYCLES 0x1c +#define PWM_OFF_CYCLES 0x18 + +#define CTRL_ENABLE BIT(0) +#define CTRL_MODE BIT(2) +#define CTRL_UPDATE BIT(5) +#define CTRL_TRIGGER BIT(9) +#define CTRL_INVERT BIT(10) +#define CTRL_OUTPUT_ENABLE BIT(14) + +struct apple_pwm { + struct pwm_chip chip; + void __iomem *base; + u64 clkrate; +}; + +static int apple_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, + const struct pwm_state *state) +{ + struct apple_pwm *fpwm; + u64 on_cycles, off_cycles; + + fpwm = container_of(chip, struct apple_pwm, chip); + if (state->enabled) { + on_cycles = fpwm->clkrate * state->duty_cycle / NSEC_PER_SEC; + off_cycles = (fpwm->clkrate * state->period / NSEC_PER_SEC) - on_cycles; + writel(on_cycles, fpwm->base + PWM_ON_CYCLES); + writel(off_cycles, fpwm->base + PWM_OFF_CYCLES); + writel(CTRL_ENABLE | CTRL_OUTPUT_ENABLE | CTRL_UPDATE, + fpwm->base + PWM_CONTROL); + } else { + writel(0, fpwm->base + PWM_CONTROL); + } + return 0; +} + +static void apple_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm, + struct pwm_state *state) +{ + struct apple_pwm *fpwm; + u32 on_cycles, off_cycles, ctrl; + + fpwm = container_of(chip, struct apple_pwm, chip); + + ctrl = readl(fpwm->base + PWM_CONTROL); + on_cycles = readl(fpwm->base + PWM_ON_CYCLES); + off_cycles = readl(fpwm->base + PWM_OFF_CYCLES); + + state->enabled = (ctrl & CTRL_ENABLE) && (ctrl & CTRL_OUTPUT_ENABLE); + state->polarity = PWM_POLARITY_NORMAL; + state->duty_cycle = on_cycles / fpwm->clkrate * NSEC_PER_SEC; + state->period = (off_cycles + on_cycles) / fpwm->clkrate * NSEC_PER_SEC; +} + +static const struct pwm_ops apple_pwm_ops = { + .apply = apple_pwm_apply, + .get_state = apple_pwm_get_state, + .owner = THIS_MODULE, +}; + +static int apple_pwm_probe(struct platform_device *pdev) +{ + struct apple_pwm *pwm; + struct clk *clk; + int ret; + + pwm = devm_kzalloc(&pdev->dev, sizeof(*pwm), GFP_KERNEL); + if (!pwm) + return -ENOMEM; + + pwm->base = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(pwm->base)) + return PTR_ERR(pwm->base); + + platform_set_drvdata(pdev, pwm); + + clk = devm_clk_get_enabled(&pdev->dev, NULL); + if (IS_ERR(clk)) + return PTR_ERR(clk); + + pwm->clkrate = clk_get_rate(clk); + pwm->chip.dev = &pdev->dev; + pwm->chip.npwm = 1; + pwm->chip.ops = &apple_pwm_ops; + + ret = devm_pwmchip_add(&pdev->dev, &pwm->chip); + return ret; +} + +static const struct of_device_id apple_pwm_of_match[] = { + { .compatible = "apple,s5l-fpwm" }, + {} +}; +MODULE_DEVICE_TABLE(of, apple_pwm_of_match); + +static struct platform_driver apple_pwm_driver = { + .probe = apple_pwm_probe, + .driver = { + .name = "apple-pwm", + .owner = THIS_MODULE, + .of_match_table = apple_pwm_of_match, + }, +}; +module_platform_driver(apple_pwm_driver); + +MODULE_DESCRIPTION("Apple SoC PWM driver"); +MODULE_LICENSE("Dual MIT/GPL"); From patchwork Fri Oct 28 16:52:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Finkelstein X-Patchwork-Id: 13024086 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 9CF92ECAAA1 for ; Fri, 28 Oct 2022 16:57:04 +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:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=HJ6XQuiI0FL8ozgaq7gj4mYnfrfWReHeT8acdSI9k/k=; b=Bh4rR8umuQpqkD 7Q2T2DAiZH2NYEKoNlcoA/TxBNKx5Qj84CJbCCcQ7idQ6WRatw9AeYnBq0gsVAI+SAnSFLH0B6LJu WttPD99ShodIm8rLOGmhfJV1J3R0HwuGuZwGlRZY6YnR9ziAkw3ib4N61h3VT7ra1Jy7cqwhEQnEo Br3fKbZogJTjH3eEDPTAW8gn7bkYv9e85dSBmYFcJ2dZmmsTaeziJTFSi8lhoGla8+PuX2JcXVgzF /33dWoWETgqlkvFmI8TdPQ146UhvEAbRqTyaOL7qpyuUOYbwBoE8ioYDH7+ZbdRV38CHx9VVb3D/a K2aKaxYdomFIFsxNn83w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ooSe1-0014Sd-Ki; Fri, 28 Oct 2022 16:55:47 +0000 Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ooScL-0013gP-BN for linux-arm-kernel@lists.infradead.org; Fri, 28 Oct 2022 16:54:02 +0000 Received: by mail-ej1-x635.google.com with SMTP id bj12so14234849ejb.13 for ; Fri, 28 Oct 2022 09:53:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tV6s01AbwYkQdjpJZBm9lXEp2eoEWm0Fi1fj3eRupAY=; b=Wn9mroTiWrsQWcPC2y9SPU+AWLR0J/+mQ9Z7st9E6665BwycRdVhkW9c5wyoUmNlvT zGJyuxLu8/mm32FU4tc1F+nXq7mbRR42aMuITUgi17Ss4IIRxkryRbaghfOkWZK78kiU YrsocUg5ylWvI3xeVofu8JYCH8/0n4K0YZave2QHsnuUoH5iLVaQwHHYKEQGlb7+TjTq M4Jkdx0QPfuEFWiLowDUzBgwzYzBMlI7Lu+ry8OwJ2ecg+RkJkHZoz63PF2rwfSCaPHe BpMpxTuw0Dno0bNBbf2wnuIe6L7rOLhSxMSmm1wKnDW1jooaGJYWaxfS3IPBkHWHhWMe c6KA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tV6s01AbwYkQdjpJZBm9lXEp2eoEWm0Fi1fj3eRupAY=; b=JUWpl9HT6lbP69XqH9ykJPqqW9mHeklRDwZ/lw6Lh3njg0IpEK4ARbEhLENj0c9nop lR7ofqxnTTsJzprErjX7L/yB9Mf8PHNoh9TtjmX03lxxPxLn3OaPJVsD9Fr7PI6c9xUw JwdeWll97tB4tG+vy1SKRIKCuQKxVylUd6L6uxSGNsyMG1D03xIGebexEBxtFKNeRp0H 3HQbsvA9Nlh4/0ovEpgY2Osj57YCX9xD+9szB9Lxvh0TScvT2krO/pzVOBGiWRdbBQOM Yeck3ctkzaw1bQzoF1pBY9mKA7uTlyxNNk0TDTirtABb8qrT8ZdqRwx7ja0mCb8jxZo9 s1VQ== X-Gm-Message-State: ACrzQf2bjxkndvOvQI5Mt18rTmZzc0W699sJE+DKaRfmsxUDaGV8Xn2L 8+/W3ad3h50WJ0relakGmJ0= X-Google-Smtp-Source: AMsMyM6GtYiFzraRR/zi84/PsPHqlixqpyeG+7KA8z9hAYWO5Xok23W+3VEy/yBLXAPw2n9IAdWgBA== X-Received: by 2002:a17:907:2719:b0:7ad:2da5:3ba7 with SMTP id w25-20020a170907271900b007ad2da53ba7mr258719ejk.340.1666976035297; Fri, 28 Oct 2022 09:53:55 -0700 (PDT) Received: from localhost ([88.227.58.131]) by smtp.gmail.com with UTF8SMTPSA id x12-20020a170906b08c00b0079800b81709sm2407440ejy.219.2022.10.28.09.53.54 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 28 Oct 2022 09:53:54 -0700 (PDT) From: Sasha Finkelstein To: thierry.reding@gmail.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org Cc: marcan@marcan.st, sven@svenpeter.dev, alyssa@rosenzweig.io, asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-pwm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Sasha Finkelstein Subject: [PATCH 3/4] arm64: dts: apple: t8103: Add PWM controller Date: Fri, 28 Oct 2022 19:52:15 +0300 Message-Id: <20221028165215.43662-4-fnkl.kernel@gmail.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: <20221028165215.43662-1-fnkl.kernel@gmail.com> References: <20221028165215.43662-1-fnkl.kernel@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221028_095401_432347_A88CC165 X-CRM114-Status: GOOD ( 11.83 ) 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 Adds PWM controller and keyboard backlight bindings for M1 MacBooks Signed-off-by: Sasha Finkelstein --- arch/arm64/boot/dts/apple/t8103-j293.dts | 20 ++++++++++++++++++++ arch/arm64/boot/dts/apple/t8103-j313.dts | 20 ++++++++++++++++++++ arch/arm64/boot/dts/apple/t8103.dtsi | 9 +++++++++ 3 files changed, 49 insertions(+) diff --git a/arch/arm64/boot/dts/apple/t8103-j293.dts b/arch/arm64/boot/dts/apple/t8103-j293.dts index ecb10d237a05..5652cd41730a 100644 --- a/arch/arm64/boot/dts/apple/t8103-j293.dts +++ b/arch/arm64/boot/dts/apple/t8103-j293.dts @@ -11,6 +11,7 @@ #include "t8103.dtsi" #include "t8103-jxxx.dtsi" +#include / { compatible = "apple,j293", "apple,t8103", "apple,arm-platform"; @@ -43,3 +44,22 @@ &i2c2 { &i2c4 { status = "okay"; }; + +/ { + pwmleds { + compatible = "pwm-leds"; + kbd-backlight { + pwms = <&fpwm1 0 40000>; + label = "kbd_backlight"; + function = LED_FUNCTION_KBD_BACKLIGHT; + color = ; + max-brightness = <255>; + default-state = "keep"; + pwm-names = "kbd-backlight"; + }; + }; +}; + +&fpwm1 { + status = "okay"; +}; diff --git a/arch/arm64/boot/dts/apple/t8103-j313.dts b/arch/arm64/boot/dts/apple/t8103-j313.dts index df741737b8e6..cff53f8770f3 100644 --- a/arch/arm64/boot/dts/apple/t8103-j313.dts +++ b/arch/arm64/boot/dts/apple/t8103-j313.dts @@ -11,6 +11,7 @@ #include "t8103.dtsi" #include "t8103-jxxx.dtsi" +#include / { compatible = "apple,j313", "apple,t8103", "apple,arm-platform"; @@ -35,3 +36,22 @@ &pcie0_dart_2 { /delete-node/ &port01; /delete-node/ &port02; + +/ { + pwmleds { + compatible = "pwm-leds"; + kbd-backlight { + pwms = <&fpwm1 0 40000>; + label = "kbd_backlight"; + function = LED_FUNCTION_KBD_BACKLIGHT; + color = ; + max-brightness = <255>; + default-state = "keep"; + pwm-names = "kbd-backlight"; + }; + }; +}; + +&fpwm1 { + status = "okay"; +}; diff --git a/arch/arm64/boot/dts/apple/t8103.dtsi b/arch/arm64/boot/dts/apple/t8103.dtsi index 51a63b29d404..a95dc482102e 100644 --- a/arch/arm64/boot/dts/apple/t8103.dtsi +++ b/arch/arm64/boot/dts/apple/t8103.dtsi @@ -191,6 +191,15 @@ i2c4: i2c@235020000 { status = "disabled"; /* only used in J293 */ }; + fpwm1: fpwm@235044000 { + compatible = "apple,t8103-fpwm", "apple,s5l-fpwm"; + reg = <0x2 0x35044000 0x0 0x4000>; + power-domains = <&ps_fpwm1>; + clocks = <&clkref>; + #pwm-cells = <2>; + status = "disabled"; + }; + serial0: serial@235200000 { compatible = "apple,s5l-uart"; reg = <0x2 0x35200000 0x0 0x1000>; From patchwork Fri Oct 28 16:52:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Finkelstein X-Patchwork-Id: 13024097 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 DE93EC38A02 for ; Fri, 28 Oct 2022 16:58:17 +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:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=UD6C6lpa+xfXRwRxmbvilKooIxAFDNfK9nfQ8XxJi0Q=; b=G/8hZ3K1OWv6Ij RwzuB67lCUK2J7e3o/FsAqTnnnYI4cqXm5HmlIZp+a/NlczdAZKurraPXyWbzRRM90RcnbtxGZhuw uV0DVvnozs5bI2oHloBhyTfjhOWD0nxPHiSVpOfzc8WAnAgnMkwzaGqNQVeOGradPzfBOs4EivEiS wglZGqusm4f9EhMs4yPicDFE8zEw6eSYRsWTGsm3MG6gSXwq73ZK5zMgob5aWdKuLs/4CVzSQjmqJ 3Rk816BvJIlg3AAtW0piYfLhhD+rtHruqwNuvZ+xQeUOnWVy+n7OUqw+0aBh39GGLjZUq8j22zRZM /oZBXfGk4dwXthZOIIAQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ooSf8-0014q4-Q6; Fri, 28 Oct 2022 16:56:56 +0000 Received: from mail-ej1-x62d.google.com ([2a00:1450:4864:20::62d]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ooScM-0013ig-Uy for linux-arm-kernel@lists.infradead.org; Fri, 28 Oct 2022 16:54:04 +0000 Received: by mail-ej1-x62d.google.com with SMTP id sc25so14267920ejc.12 for ; Fri, 28 Oct 2022 09:54:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9VlWXXhBJnoc4ngEOzP/zoEPXuNu3Pcb27/diH3nA+U=; b=LZzR4NF5aoNbliaJSdl30q2EeC7dveHrEZucBmr23Nlq4IrlxZQkMjIW7sDrxWvoN8 ZH+klDe6aAHzQATRGHz8yf+Fl2GXzKKKD+yilDoMpyjCqEnn4pX5MQ+o0mI8TeeQbmdW oKvLqfzKbhkewDLcdKdmr0Z7bIw6jwfZghXizSP5p1eELZwPrC+wmHoCRZwgd+PwCIN6 IzcAWNLUIJ6LJOjRm9brUnjpjrcAVWBhMX2HrZXFKVt79h9x1ktnCcRths+1BgWnv45P H8y96CMGIIHJv+U2qnkiyINb8a/MwbEuwLN0SjVV1OTnjP/xHtAH+tBcnBwsqKdtw/XC 037A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9VlWXXhBJnoc4ngEOzP/zoEPXuNu3Pcb27/diH3nA+U=; b=0EZgpJkTphOCvf2zL2lfIWvruGCjuK1oQglxIJ8a9ynLqlYDjSrTRJEc/8wjIxnK0m ELUnOCKT7wLuzFNNQ4sEPd6AuumvZrynZLO/v0dvyoK/j8UobFOD/6yWIa7PZbIq8SKm jo3+ZGeyWv56SRaRHdvl01SpS6Yf4tv9YAzp64uePrfxUS6XNTY8+9HXLrTupv+IOuIZ HtObMn9UWX0JPd78kdJZU9olgAz2B6OdYvXwdAlp6buQEJaCdNJIZOaDD0eaHX3TC3xe APr0QmXjZce4H62HZp9B7YTKcJH7/sLvaXgtIFJju8U+Zd9KUttZalJe/7WSZ8oI9xXU oSzQ== X-Gm-Message-State: ACrzQf2ocJO2m/7CZY1gqKjMVZwAP1wF/qBrqA89ogSLsAp6y4p47UHv wSYjqtEokAdA+d8jZSW88rc= X-Google-Smtp-Source: AMsMyM5cCSODkVuBwT/DJJYlpmYX8i7CSbA1kEFYW/4yDxRGIAM38PVcrW56Lv4bA3NjSchaBDai7Q== X-Received: by 2002:a17:907:6d84:b0:78d:f2b0:14c8 with SMTP id sb4-20020a1709076d8400b0078df2b014c8mr202721ejc.749.1666976041659; Fri, 28 Oct 2022 09:54:01 -0700 (PDT) Received: from localhost ([88.227.58.131]) by smtp.gmail.com with UTF8SMTPSA id p17-20020a17090653d100b0077826b92d99sm2417677ejo.12.2022.10.28.09.54.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 28 Oct 2022 09:54:01 -0700 (PDT) From: Sasha Finkelstein To: thierry.reding@gmail.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org Cc: marcan@marcan.st, sven@svenpeter.dev, alyssa@rosenzweig.io, asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-pwm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Sasha Finkelstein Subject: [PATCH 4/4] MAINTAINERS: Add entries for Apple PWM driver Date: Fri, 28 Oct 2022 19:52:16 +0300 Message-Id: <20221028165215.43662-5-fnkl.kernel@gmail.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: <20221028165215.43662-1-fnkl.kernel@gmail.com> References: <20221028165215.43662-1-fnkl.kernel@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221028_095403_050497_2F22EA52 X-CRM114-Status: GOOD ( 11.18 ) 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 Add the MAINTAINERS entries for the driver Signed-off-by: Sasha Finkelstein --- MAINTAINERS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index e04d944005ba..4c9719a2439a 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1908,6 +1908,7 @@ F: Documentation/devicetree/bindings/nvmem/apple,efuses.yaml F: Documentation/devicetree/bindings/pci/apple,pcie.yaml F: Documentation/devicetree/bindings/pinctrl/apple,pinctrl.yaml F: Documentation/devicetree/bindings/power/apple* +F: Documentation/devicetree/bindings/pwm/pwm-apple.yaml F: Documentation/devicetree/bindings/watchdog/apple,wdt.yaml F: arch/arm64/boot/dts/apple/ F: drivers/clk/clk-apple-nco.c @@ -1921,6 +1922,7 @@ F: drivers/mailbox/apple-mailbox.c F: drivers/nvme/host/apple.c F: drivers/nvmem/apple-efuses.c F: drivers/pinctrl/pinctrl-apple-gpio.c +F: drivers/pwm/pwm-apple.c F: drivers/soc/apple/* F: drivers/watchdog/apple_wdt.c F: include/dt-bindings/interrupt-controller/apple-aic.h