Message ID | 20221217100455.52593-1-marijn.suijten@somainline.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp1447324wrn; Sat, 17 Dec 2022 02:12:53 -0800 (PST) X-Google-Smtp-Source: AMrXdXvGUs4zZitCjUKjPMxfGaMELnUIfTEiUeiRXzz4baY0fAEqkDGLEeA0wH3vVMjmdqgApocq X-Received: by 2002:a17:907:6a1a:b0:7e9:db3d:6c60 with SMTP id rf26-20020a1709076a1a00b007e9db3d6c60mr5183688ejc.2.1671271973292; Sat, 17 Dec 2022 02:12:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671271973; cv=none; d=google.com; s=arc-20160816; b=B9N1JYdZIOhFpFy5tSVk7wpwvW8MfauLloaoioOHX9qqD7yiDK4E0t0n0fo6WUUDsP z45R6gLuZG98bwqNiO/1d6NmYJ9506mCseMjpU/Fcn8sAObkW/0ZWHk+f6/LBq9iyXDZ pgaGuXvSL3YCqlej71Jr4mTcuZrn6pRFr5HGirYTBiBhiHanoSq3JCWTD3Xkmm0j33cm pq6KPWXbCr0Qa6O48Bj+Iodgj1vLCAVmeQaM0y76WtdjSS+/QU6eTpuKPbvV5nCvoZ42 lXcg9/EXdi3A++cH/1VSUtX3aCgteC4IcA+IIsUzzT4Ni4041mazcZKLFcwamFBR2eXS 4SYQ== 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; bh=s7yQ9+Tch74BQxpjXEnrN5pyEksmUMO+uTgSqYZ9Oys=; b=HcEFW7fKQi1q5CtfxkGysvtF6wcwy8v0IaCgbMotWLWcM78ZwMMXHaXyvbuOd6RwS2 HakqVXfsDy9tYoe13exWrN4XCYgF5Ec1gXqs7xQsK2nuvroYWXck24jwzaLOwCAj3nYe VA0irIhZGOlIN9ar+tSAYE6YTrBeRifFS2rbTa5STVUB1OwQTbmSz7vpXaxoKpulY3zs utfvKnyWKkowFSvJMQ8YHoBdxUU+MsmRk6ZKLeg0zQS2KRzwpNjf8TeOq/afe2TPw8Jk wgG1ZuOK1/0yRaN4tNtwzB+7tZnhBD7BeI7dbvF/2ES674yRp3ZaJA6BOBRGMLeDl6ha H64g== ARC-Authentication-Results: i=1; mx.google.com; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gt12-20020a1709072d8c00b007c5182841dfsi5518166ejc.4.2022.12.17.02.12.30; Sat, 17 Dec 2022 02:12:53 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230324AbiLQKFP (ORCPT <rfc822;markus.c.watson@gmail.com> + 99 others); Sat, 17 Dec 2022 05:05:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230318AbiLQKFM (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sat, 17 Dec 2022 05:05:12 -0500 Received: from relay06.th.seeweb.it (relay06.th.seeweb.it [IPv6:2001:4b7a:2000:18::167]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53A7B60F4 for <linux-kernel@vger.kernel.org>; Sat, 17 Dec 2022 02:05:09 -0800 (PST) Received: from localhost.localdomain (94-209-172-39.cable.dynamic.v4.ziggo.nl [94.209.172.39]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by m-r2.th.seeweb.it (Postfix) with ESMTPSA id 6600D3F246; Sat, 17 Dec 2022 11:05:06 +0100 (CET) From: Marijn Suijten <marijn.suijten@somainline.org> To: phone-devel@vger.kernel.org Cc: ~postmarketos/upstreaming@lists.sr.ht, AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>, Konrad Dybcio <konrad.dybcio@somainline.org>, Martin Botka <martin.botka@somainline.org>, Jami Kettunen <jami.kettunen@somainline.org>, Marijn Suijten <marijn.suijten@somainline.org>, Andy Gross <agross@kernel.org>, Bjorn Andersson <andersson@kernel.org>, Konrad Dybcio <konrad.dybcio@linaro.org>, Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] arm64: dts: qcom: sm6125-seine: Clean up gpio-keys (volume down) Date: Sat, 17 Dec 2022 11:04:54 +0100 Message-Id: <20221217100455.52593-1-marijn.suijten@somainline.org> X-Mailer: git-send-email 2.39.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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 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?1752455680704309698?= X-GMAIL-MSGID: =?utf-8?q?1752455680704309698?= |
Series |
arm64: dts: qcom: sm6125-seine: Clean up gpio-keys (volume down)
|
|
Commit Message
Marijn Suijten
Dec. 17, 2022, 10:04 a.m. UTC
- Remove autorepeat (leave key repetition to userspace);
- Remove unneeded status = "okay" (this is the default);
- Allow the interrupt line for this button to be disabled;
- Use a full, descriptive node name;
- Set proper bias on the GPIO via pinctrl;
- Sort properties.
Fixes: 82e1783890b7 ("arm64: dts: qcom: sm6125: Add support for Sony Xperia 10II")
Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
---
.../qcom/sm6125-sony-xperia-seine-pdx201.dts | 20 ++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
Comments
On 17.12.2022 11:04, Marijn Suijten wrote: > - Remove autorepeat (leave key repetition to userspace); > - Remove unneeded status = "okay" (this is the default); > - Allow the interrupt line for this button to be disabled; > - Use a full, descriptive node name; > - Set proper bias on the GPIO via pinctrl; > - Sort properties. > > Fixes: 82e1783890b7 ("arm64: dts: qcom: sm6125: Add support for Sony Xperia 10II") > Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org> > --- > .../qcom/sm6125-sony-xperia-seine-pdx201.dts | 20 ++++++++++++++----- > 1 file changed, 15 insertions(+), 5 deletions(-) > > diff --git a/arch/arm64/boot/dts/qcom/sm6125-sony-xperia-seine-pdx201.dts b/arch/arm64/boot/dts/qcom/sm6125-sony-xperia-seine-pdx201.dts > index 1b9e40d3d269..8c7c9331fd21 100644 > --- a/arch/arm64/boot/dts/qcom/sm6125-sony-xperia-seine-pdx201.dts > +++ b/arch/arm64/boot/dts/qcom/sm6125-sony-xperia-seine-pdx201.dts > @@ -41,17 +41,17 @@ extcon_usb: extcon-usb { > }; > > gpio-keys { > - status = "okay"; > compatible = "gpio-keys"; > - autorepeat; > + pinctrl-0 = <&gpio_keys_state>; > + pinctrl-names = "default"; > > - key-vol-dn { > + key-volume-down { > label = "Volume Down"; > gpios = <&tlmm 47 GPIO_ACTIVE_LOW>; > - linux,input-type = <1>; > linux,code = <KEY_VOLUMEDOWN>; > - gpio-key,wakeup; > debounce-interval = <15>; > + linux,can-disable; > + gpio-key,wakeup; > }; > }; > > @@ -270,6 +270,16 @@ &sdhc_1 { > > &tlmm { > gpio-reserved-ranges = <22 2>, <28 6>; > + > + gpio_keys_state: gpio-keys-state { > + key-volume-down-pins { I see no need for defining a wrapper node. The other changes look good! Konrad > + pins = "gpio47"; > + function = "gpio"; > + drive-strength = <2>; > + bias-disable; > + input-enable; > + }; > + }; > }; > > &usb3 {
On 2022-12-17 16:04:17, Konrad Dybcio wrote: > On 17.12.2022 11:04, Marijn Suijten wrote: > > [..] > > @@ -270,6 +270,16 @@ &sdhc_1 { > > > > &tlmm { > > gpio-reserved-ranges = <22 2>, <28 6>; > > + > > + gpio_keys_state: gpio-keys-state { > > + key-volume-down-pins { > I see no need for defining a wrapper node. > The other changes look good! I did the same for sm6350-lena, which we should flatten out then too. For these uses I'm not sure when it's clearer/better to use: thing@x { pinctrl-0 = <&thing_state>; ... }; thing_state: thing-state { specific-pin { ... }; other-specific-pin ... ... }; Or separate out the pins with their own state and instead use: thing@x { pinctrl-0 = <&specific_pin1_state &specific_pin2_state>; ... }; If I had to guess the former groups related pins together (as we finally do now for SDC...) which should all be toggled at once. In this specific gpio-keys case, irrespective of whether it has one or more keys, the pins aren't related apart from representing keys, and should thus better be individual pinctrl nodes and individually referenced in pinctrl-X. Did I sympathize that correctly? (side-note: the SDC pinctrl groups typically get extended with a card-detect pin in board DTS or in some likely-erroneous cases directly in SoC DTSI. This may also count as unrelated pins being grouped together only because that is how the hardware/DTS node consumes them, but it is rather concise/readable/convenient though...) - Marijn
On 18.12.2022 11:18, Marijn Suijten wrote: > On 2022-12-17 16:04:17, Konrad Dybcio wrote: >> On 17.12.2022 11:04, Marijn Suijten wrote: >>> [..] >>> @@ -270,6 +270,16 @@ &sdhc_1 { >>> >>> &tlmm { >>> gpio-reserved-ranges = <22 2>, <28 6>; >>> + >>> + gpio_keys_state: gpio-keys-state { >>> + key-volume-down-pins { >> I see no need for defining a wrapper node. >> The other changes look good! > > I did the same for sm6350-lena, which we should flatten out then too. > > For these uses I'm not sure when it's clearer/better to use: > > thing@x { > pinctrl-0 = <&thing_state>; > ... > }; > > thing_state: thing-state { > specific-pin { > ... > }; > > other-specific-pin ... > ... > }; > > Or separate out the pins with their own state and instead use: > > thing@x { > pinctrl-0 = <&specific_pin1_state &specific_pin2_state>; > ... > }; > > If I had to guess the former groups related pins together (as we finally > do now for SDC...) which should all be toggled at once. In this > specific gpio-keys case, irrespective of whether it has one or more > keys, the pins aren't related apart from representing keys, and should > thus better be individual pinctrl nodes and individually referenced in > pinctrl-X. > > Did I sympathize that correctly? I think so. > > (side-note: the SDC pinctrl groups typically get extended with a > card-detect pin in board DTS or in some likely-erroneous cases directly > in SoC DTSI. This may also count as unrelated pins being grouped > together only because that is how the hardware/DTS node consumes them, > but it is rather concise/readable/convenient though...) 8450 has: pinctrl-0 = <&sdc2_default_state &sdc2_card_det_n>; which seems like a sane application of what you described. Konrad > > - Marijn
On 2022-12-19 11:00:10, Konrad Dybcio wrote: > > > On 18.12.2022 11:18, Marijn Suijten wrote: > > On 2022-12-17 16:04:17, Konrad Dybcio wrote: > >> On 17.12.2022 11:04, Marijn Suijten wrote: > >>> [..] > >>> @@ -270,6 +270,16 @@ &sdhc_1 { > >>> > >>> &tlmm { > >>> gpio-reserved-ranges = <22 2>, <28 6>; > >>> + > >>> + gpio_keys_state: gpio-keys-state { > >>> + key-volume-down-pins { > >> I see no need for defining a wrapper node. > >> The other changes look good! > > > > I did the same for sm6350-lena, which we should flatten out then too. > > > > For these uses I'm not sure when it's clearer/better to use: > > > > thing@x { > > pinctrl-0 = <&thing_state>; > > ... > > }; > > > > thing_state: thing-state { > > specific-pin { > > ... > > }; > > > > other-specific-pin ... > > ... > > }; > > > > Or separate out the pins with their own state and instead use: > > > > thing@x { > > pinctrl-0 = <&specific_pin1_state &specific_pin2_state>; > > ... > > }; > > > > If I had to guess the former groups related pins together (as we finally > > do now for SDC...) which should all be toggled at once. In this > > specific gpio-keys case, irrespective of whether it has one or more > > keys, the pins aren't related apart from representing keys, and should > > thus better be individual pinctrl nodes and individually referenced in > > pinctrl-X. > > > > Did I sympathize that correctly? > I think so. Ack, will respin like this for V2. > > (side-note: the SDC pinctrl groups typically get extended with a > > card-detect pin in board DTS or in some likely-erroneous cases directly > > in SoC DTSI. This may also count as unrelated pins being grouped > > together only because that is how the hardware/DTS node consumes them, > > but it is rather concise/readable/convenient though...) > 8450 has: > > pinctrl-0 = <&sdc2_default_state &sdc2_card_det_n>; > > which seems like a sane application of what you described. Glad to hear we (I and sm8450 dts writer(s)) came to the same conclusion independently. Not sure if it's worth retroactively cleaning up existing DTS, but feel free to. There are still DT's out there that define all pins individually, too... - Marijn
diff --git a/arch/arm64/boot/dts/qcom/sm6125-sony-xperia-seine-pdx201.dts b/arch/arm64/boot/dts/qcom/sm6125-sony-xperia-seine-pdx201.dts index 1b9e40d3d269..8c7c9331fd21 100644 --- a/arch/arm64/boot/dts/qcom/sm6125-sony-xperia-seine-pdx201.dts +++ b/arch/arm64/boot/dts/qcom/sm6125-sony-xperia-seine-pdx201.dts @@ -41,17 +41,17 @@ extcon_usb: extcon-usb { }; gpio-keys { - status = "okay"; compatible = "gpio-keys"; - autorepeat; + pinctrl-0 = <&gpio_keys_state>; + pinctrl-names = "default"; - key-vol-dn { + key-volume-down { label = "Volume Down"; gpios = <&tlmm 47 GPIO_ACTIVE_LOW>; - linux,input-type = <1>; linux,code = <KEY_VOLUMEDOWN>; - gpio-key,wakeup; debounce-interval = <15>; + linux,can-disable; + gpio-key,wakeup; }; }; @@ -270,6 +270,16 @@ &sdhc_1 { &tlmm { gpio-reserved-ranges = <22 2>, <28 6>; + + gpio_keys_state: gpio-keys-state { + key-volume-down-pins { + pins = "gpio47"; + function = "gpio"; + drive-strength = <2>; + bias-disable; + input-enable; + }; + }; }; &usb3 {