Message ID | 20221028165215.43662-1-fnkl.kernel@gmail.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp938509wru; Fri, 28 Oct 2022 09:59:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM46l5w24qqXWGqDBoIW92r+LEVZVPrciweIrlwpU/7TMT9mC8IoVGL4tzTGdbshAibofjCA X-Received: by 2002:a05:6402:501a:b0:457:f093:cadb with SMTP id p26-20020a056402501a00b00457f093cadbmr355657eda.143.1666976341211; Fri, 28 Oct 2022 09:59:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666976341; cv=none; d=google.com; s=arc-20160816; b=uNy7dmhzsdbfGvuL6Ic1f+PHnt9e/Eob3dBCHlnNrzrfyeeDYh8YIvTTBxF+4CqQ3J qPj1xrkfPxwnpJLKWv/qeaRTzXdsV733+Bk/KRw0F7JDxzpEsW9ogknLdE8YXxhsaTNX j7BWdEE1I8qTgB1PUpb1XD45Yqg5KBVdP/jH0bmGcZvXWEjCP444KJezmeQVSFacTxvw 9txQ/RciEkWhIlrnkeimiIqW4fCYOfRbKsbsKOo15ovKs/Z40r+wcSW81/DoSYMkPEFx 3c39Rbf+L0bnWE4r2zbFZVfAI9zw5SCNBlUHxwll4CaM1P58CO6KTL1ep3a8JypnEHFX xGTg== 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=TRbtjzgGY79KT/za/x8o0WGQEAKstEUc6+ZUvLa/3WE=; b=Kh5LO+wKzPWiRWDP4P9zP4mMQGsJVLn3ssvbi/3Q/lK6pDpU58PamNZv0FFsAmf3hY CNz6AUdcOmjeCz5Ga6MnhIL6WwdiD8g7uimK4PaSzVWcBz1juqAu31AGn2G1cOqZZETp b8r56MEYx3pu9E3ZF71w0T85GR6OfSXXGqqrLoUi31WN59Xc7gESAMH+7HH1DRMMWE4T OQA2NrBwVc3W5yeZE9LPbGM17+N2uB6PLz/i/lrWu6cO7tjtCGJNvmVIyseTCndgBnIc v23+WDGH2CVz/izbVnLLvm81zWdSvDZYpASIIfSgFkwQBkopDOUgMpTlZ7NusITNqRtr ew+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Rm1QgOjA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f17-20020aa7d851000000b00461d9b36740si4876798eds.240.2022.10.28.09.58.37; Fri, 28 Oct 2022 09:59:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Rm1QgOjA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229455AbiJ1QxI (ORCPT <rfc822;norden.jeffspam@gmail.com> + 99 others); Fri, 28 Oct 2022 12:53:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229802AbiJ1Qwz (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 28 Oct 2022 12:52:55 -0400 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D9461ABA08; Fri, 28 Oct 2022 09:52:54 -0700 (PDT) Received: by mail-ej1-x629.google.com with SMTP id kt23so14261520ejc.7; Fri, 28 Oct 2022 09:52:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=TRbtjzgGY79KT/za/x8o0WGQEAKstEUc6+ZUvLa/3WE=; b=Rm1QgOjAFiI7XmFUhmPEZeVtIvOd4SWpfjF8UQiJEDSDLZL7F2M6r9ByqbGV/JByp4 Gv+fkWsQJ88UVp2YtPZeQqKxuaVRxYmvpr30scl035igGDXPVadrzYMtHmEdSv4lgSnq vm1cQURGqu5jG05rh321S9jyPgK1mI/l2VZM9FPwNqay2EfePWJDExQClNkSqrI6KBQp +hVA6dgfE2iRfo3JkqkWF9HBGcLA2Qm+v6n3eJLHLuWfuttfiILkbnPESeUi+fZwJtno SvVb60STbZAD5X2utynPoFPNFvBtl2VmtWBDWcD/7tARz8FbcSVwSnt+I2dVgP4qUxg1 WZRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=TRbtjzgGY79KT/za/x8o0WGQEAKstEUc6+ZUvLa/3WE=; b=7OjOERQa65WheDdsT4Yw9DlSexjYyBGzZnjIOhqlRzrAcjWOdpQywfH9zWkoym5PWj AZ83YxmHQhYdjc9UuXr7JIKOf5wgZk5P0VNqapYNgECCi0lpqAMO0q7bNAX0sQzhgIL7 XaC+ypQUpSx9l2QmcuimTq2depsrDZ170kbwjOXDcH4CdxqatKiMadb1RaGVtuGul0V7 ax35klmkzw/SWwHHqdJrldAUHDGxht4++j9M30ZF99GII0csXt+/1ADYLE2bTip0NgzV kcIDJ418fwnNSNDIxvADpR76MOwwkMP3ItA1pmpSUNpX+B4ktVgAboDBH00YUyFjVtXB WcVA== X-Gm-Message-State: ACrzQf0rbg/r8DC7FplbVeQH2SQny0105QAcyBeEPlg76AHXkG6jewQI NfKIF9XmkhUn7jTQxacAd+7HgCd8JO/lAA== X-Received: by 2002:a17:906:3111:b0:7ad:a7fc:f3e8 with SMTP id 17-20020a170906311100b007ada7fcf3e8mr243112ejx.518.1666975972737; Fri, 28 Oct 2022 09:52:52 -0700 (PDT) Received: from localhost ([88.227.58.131]) by smtp.gmail.com with UTF8SMTPSA id x9-20020a056402414900b004589da5e5cesm2952990eda.41.2022.10.28.09.52.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 28 Oct 2022 09:52:52 -0700 (PDT) From: Sasha Finkelstein <fnkl.kernel@gmail.com> 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 Subject: [PATCH 0/4] PWM and keyboard backlight driver for ARM Macs Date: Fri, 28 Oct 2022 19:52:11 +0300 Message-Id: <20221028165215.43662-1-fnkl.kernel@gmail.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=1.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747951383952055882?= X-GMAIL-MSGID: =?utf-8?q?1747951383952055882?= |
Series |
PWM and keyboard backlight driver for ARM Macs
|
|
Message
Sasha Finkelstein
Oct. 28, 2022, 4:52 p.m. UTC
Hi, This series adds support for the PWM controller present on ARM Macs and used among other things for the keyboard backlight on those laptops. The included device tree patch also hooks up the keyboard backlight using the pwm-leds binding. Best Regards. Sasha Finkelstein (4): dt-bindings: pwm: Add Apple PWM controller pwm: Add Apple PWM controller arm64: dts: apple: t8103: Add PWM controller MAINTAINERS: Add entries for Apple PWM driver Documentation/devicetree/bindings/pwm/pwm-apple.yaml | 51 +++++++++++++ MAINTAINERS | 2 ++ 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 ++++ drivers/pwm/Kconfig | 12 ++++ drivers/pwm/Makefile | 1 + drivers/pwm/pwm-apple.c | 124 +++++++++++++++++++ 8 files changed, 239 insertions(+) create mode 100644 Documentation/devicetree/bindings/pwm/pwm-apple.yaml create mode 100644 drivers/pwm/pwm-apple.c
Comments
On 28/10/2022 12:52, Sasha Finkelstein wrote: > Adds the Apple PWM controller driver. > > Signed-off-by: Sasha Finkelstein <fnkl.kernel@gmail.com> > --- > 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) Why this code cannot be build on 32-bit? > + help > + Generic PWM framework driver for PWM controller present on > + Apple SoCs > + Best regards, Krzysztof
On Fri, 28 Oct 2022 at 20:54, Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote: > > On 28/10/2022 12:52, Sasha Finkelstein wrote: > > +config PWM_APPLE > > + tristate "Apple SoC PWM support" > > + depends on ARCH_APPLE || (COMPILE_TEST && 64BIT) > > Why this code cannot be build on 32-bit? It uses 64-bit divisions, which causes it to fail to build on 32-bit mips. It should not be a problem, since this hardware is only present on 64-bit SoCs.
On 28/10/2022 14:51, Sasha Finkelstein wrote: > On Fri, 28 Oct 2022 at 20:54, Krzysztof Kozlowski > <krzysztof.kozlowski@linaro.org> wrote: >> >> On 28/10/2022 12:52, Sasha Finkelstein wrote: >>> +config PWM_APPLE >>> + tristate "Apple SoC PWM support" >>> + depends on ARCH_APPLE || (COMPILE_TEST && 64BIT) >> >> Why this code cannot be build on 32-bit? > It uses 64-bit divisions, which causes it to fail to build on 32-bit > mips. It should not be a > problem, since this hardware is only present on 64-bit SoCs. Does not matter, code should be portable and buildable on 32-bit. If it does not build then your code is not correct. You need to investigate the failure. Maybe using do_div would solve (or other macros from div64.h) Best regards, Krzysztof
On 29/10/2022 04.49, Krzysztof Kozlowski wrote: > On 28/10/2022 14:51, Sasha Finkelstein wrote: >> On Fri, 28 Oct 2022 at 20:54, Krzysztof Kozlowski >> <krzysztof.kozlowski@linaro.org> wrote: >>> >>> On 28/10/2022 12:52, Sasha Finkelstein wrote: >>>> +config PWM_APPLE >>>> + tristate "Apple SoC PWM support" >>>> + depends on ARCH_APPLE || (COMPILE_TEST && 64BIT) >>> >>> Why this code cannot be build on 32-bit? >> It uses 64-bit divisions, which causes it to fail to build on 32-bit >> mips. It should not be a >> problem, since this hardware is only present on 64-bit SoCs. > > Does not matter, code should be portable and buildable on 32-bit. If it > does not build then your code is not correct. This statement does not apply in general. There are plenty of drivers which cannot reasonably build for 32-bit, and make no sense because no 32-bit hardware exists that could use them. Examples include anything that accesses 64-bit registers on 64-bit SoCs the normal way, and further anything that touches CPU stuff like system registers. In *this* case, if the only issue is some 64-bit math, then yes, it should be made to build on 32-bit (especially since this is likely to also work for older 32-bit Apple SoCs). But the (COMPILE_TEST && 64BIT) pattern is definitely valid in other cases, and I've been adding it lately to shut up the kernel test bot since it makes no sense to compile test a whole pile of our drivers on 32-bit architectures - they fundamentally can't compile without adding pointless hypothetical broken fluff to the driver like split MMIO accesses (which often can't work on real hardware), and it serves no purpose. - Hector