2023-03-22 01:16:40

by Steev Klimaszewski

[permalink] [raw]
Subject: [PATCH v7 4/4] arm64: dts: qcom: sc8280xp-x13s: Add bluetooth

The Lenovo Thinkpad X13s has a WCN6855 Bluetooth controller on uart2,
add this.

Signed-off-by: Steev Klimaszewski <[email protected]>
---
Changes since v6:
* Remove allowed-modes as they aren't needed
* Remove regulator-allow-set-load
* Set regulator-always-on because the wifi chip also uses the regulator
* cts pin uses bias-bus-hold
* Alphabetize uart2 pins

Changes since v5:
* Update patch subject
* Specify initial mode (via guess) for vreg_s1c
* Drop uart17 definition
* Rename bt_en to bt_default because configuring more than one pin
* Correct (maybe) bias configurations
* Correct cts gpio
* Split rts-tx into two nodes
* Drop incorrect link in the commit message

Changes since v4:
* Address Konrad's review comments.

Changes since v3:
* Add vreg_s1c
* Add regulators and not dead code
* Fix commit message changelog

Changes since v2:
* Remove dead code and add TODO comment
* Make dtbs_check happy with the pin definitions
.../qcom/sc8280xp-lenovo-thinkpad-x13s.dts | 78 +++++++++++++++++++
1 file changed, 78 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts b/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
index 92d365519546..05e66505e5cc 100644
--- a/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
+++ b/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
@@ -24,6 +24,7 @@ / {
aliases {
i2c4 = &i2c4;
i2c21 = &i2c21;
+ serial1 = &uart2;
};

wcd938x: audio-codec {
@@ -431,6 +432,14 @@ regulators-1 {
qcom,pmic-id = "c";
vdd-bob-supply = <&vreg_vph_pwr>;

+ vreg_s1c: smps1 {
+ regulator-name = "vreg_s1c";
+ regulator-min-microvolt = <1880000>;
+ regulator-max-microvolt = <1900000>;
+ regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
+ regulator-always-on;
+ };
+
vreg_l1c: ldo1 {
regulator-name = "vreg_l1c";
regulator-min-microvolt = <1800000>;
@@ -918,6 +927,32 @@ &qup0 {
status = "okay";
};

+&uart2 {
+ pinctrl-0 = <&uart2_default>;
+ pinctrl-names = "default";
+
+ status = "okay";
+
+ bluetooth {
+ compatible = "qcom,wcn6855-bt";
+
+ vddio-supply = <&vreg_s10b>;
+ vddbtcxmx-supply = <&vreg_s12b>;
+ vddrfacmn-supply = <&vreg_s12b>;
+ vddrfa0p8-supply = <&vreg_s12b>;
+ vddrfa1p2-supply = <&vreg_s11b>;
+ vddrfa1p7-supply = <&vreg_s1c>;
+
+ max-speed = <3200000>;
+
+ enable-gpios = <&tlmm 133 GPIO_ACTIVE_HIGH>;
+ swctrl-gpios = <&tlmm 132 GPIO_ACTIVE_HIGH>;
+
+ pinctrl-0 = <&bt_default>;
+ pinctrl-names = "default";
+ };
+};
+
&qup1 {
status = "okay";
};
@@ -1192,6 +1227,21 @@ hastings_reg_en: hastings-reg-en-state {
&tlmm {
gpio-reserved-ranges = <70 2>, <74 6>, <83 4>, <125 2>, <128 2>, <154 7>;

+ bt_default: bt-default-state {
+ hstp-sw-ctrl-pins {
+ pins = "gpio132";
+ function = "gpio";
+ bias-pull-down;
+ };
+
+ hstp-bt-en-pins {
+ pins = "gpio133";
+ function = "gpio";
+ drive-strength = <16>;
+ bias-disable;
+ };
+ };
+
edp_reg_en: edp-reg-en-state {
pins = "gpio25";
function = "gpio";
@@ -1213,6 +1263,34 @@ i2c4_default: i2c4-default-state {
bias-disable;
};

+ uart2_default: uart2-default-state {
+ cts-pins {
+ pins = "gpio121";
+ function = "qup2";
+ bias-bus-hold;
+ };
+
+ rts-pins {
+ pins = "gpio122";
+ function = "qup2";
+ drive-strength = <2>;
+ bias-disable;
+ };
+
+ rx-pins {
+ pins = "gpio124";
+ function = "qup2";
+ bias-pull-up;
+ };
+
+ tx-pins {
+ pins = "gpio123";
+ function = "qup2";
+ drive-strength = <2>;
+ bias-disable;
+ };
+ };
+
i2c21_default: i2c21-default-state {
pins = "gpio81", "gpio82";
function = "qup21";
--
2.39.2


2023-03-22 02:56:06

by Bjorn Andersson

[permalink] [raw]
Subject: Re: [PATCH v7 4/4] arm64: dts: qcom: sc8280xp-x13s: Add bluetooth

On Tue, Mar 21, 2023 at 08:14:42PM -0500, Steev Klimaszewski wrote:
> The Lenovo Thinkpad X13s has a WCN6855 Bluetooth controller on uart2,
> add this.
>
> Signed-off-by: Steev Klimaszewski <[email protected]>

Reviewed-by: Bjorn Andersson <[email protected]>

Regards,
Bjorn

> ---
> Changes since v6:
> * Remove allowed-modes as they aren't needed
> * Remove regulator-allow-set-load
> * Set regulator-always-on because the wifi chip also uses the regulator
> * cts pin uses bias-bus-hold
> * Alphabetize uart2 pins
>
> Changes since v5:
> * Update patch subject
> * Specify initial mode (via guess) for vreg_s1c
> * Drop uart17 definition
> * Rename bt_en to bt_default because configuring more than one pin
> * Correct (maybe) bias configurations
> * Correct cts gpio
> * Split rts-tx into two nodes
> * Drop incorrect link in the commit message
>
> Changes since v4:
> * Address Konrad's review comments.
>
> Changes since v3:
> * Add vreg_s1c
> * Add regulators and not dead code
> * Fix commit message changelog
>
> Changes since v2:
> * Remove dead code and add TODO comment
> * Make dtbs_check happy with the pin definitions
> .../qcom/sc8280xp-lenovo-thinkpad-x13s.dts | 78 +++++++++++++++++++
> 1 file changed, 78 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts b/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
> index 92d365519546..05e66505e5cc 100644
> --- a/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
> +++ b/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
> @@ -24,6 +24,7 @@ / {
> aliases {
> i2c4 = &i2c4;
> i2c21 = &i2c21;
> + serial1 = &uart2;
> };
>
> wcd938x: audio-codec {
> @@ -431,6 +432,14 @@ regulators-1 {
> qcom,pmic-id = "c";
> vdd-bob-supply = <&vreg_vph_pwr>;
>
> + vreg_s1c: smps1 {
> + regulator-name = "vreg_s1c";
> + regulator-min-microvolt = <1880000>;
> + regulator-max-microvolt = <1900000>;
> + regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
> + regulator-always-on;
> + };
> +
> vreg_l1c: ldo1 {
> regulator-name = "vreg_l1c";
> regulator-min-microvolt = <1800000>;
> @@ -918,6 +927,32 @@ &qup0 {
> status = "okay";
> };
>
> +&uart2 {
> + pinctrl-0 = <&uart2_default>;
> + pinctrl-names = "default";
> +
> + status = "okay";
> +
> + bluetooth {
> + compatible = "qcom,wcn6855-bt";
> +
> + vddio-supply = <&vreg_s10b>;
> + vddbtcxmx-supply = <&vreg_s12b>;
> + vddrfacmn-supply = <&vreg_s12b>;
> + vddrfa0p8-supply = <&vreg_s12b>;
> + vddrfa1p2-supply = <&vreg_s11b>;
> + vddrfa1p7-supply = <&vreg_s1c>;
> +
> + max-speed = <3200000>;
> +
> + enable-gpios = <&tlmm 133 GPIO_ACTIVE_HIGH>;
> + swctrl-gpios = <&tlmm 132 GPIO_ACTIVE_HIGH>;
> +
> + pinctrl-0 = <&bt_default>;
> + pinctrl-names = "default";
> + };
> +};
> +
> &qup1 {
> status = "okay";
> };
> @@ -1192,6 +1227,21 @@ hastings_reg_en: hastings-reg-en-state {
> &tlmm {
> gpio-reserved-ranges = <70 2>, <74 6>, <83 4>, <125 2>, <128 2>, <154 7>;
>
> + bt_default: bt-default-state {
> + hstp-sw-ctrl-pins {
> + pins = "gpio132";
> + function = "gpio";
> + bias-pull-down;
> + };
> +
> + hstp-bt-en-pins {
> + pins = "gpio133";
> + function = "gpio";
> + drive-strength = <16>;
> + bias-disable;
> + };
> + };
> +
> edp_reg_en: edp-reg-en-state {
> pins = "gpio25";
> function = "gpio";
> @@ -1213,6 +1263,34 @@ i2c4_default: i2c4-default-state {
> bias-disable;
> };
>
> + uart2_default: uart2-default-state {
> + cts-pins {
> + pins = "gpio121";
> + function = "qup2";
> + bias-bus-hold;
> + };
> +
> + rts-pins {
> + pins = "gpio122";
> + function = "qup2";
> + drive-strength = <2>;
> + bias-disable;
> + };
> +
> + rx-pins {
> + pins = "gpio124";
> + function = "qup2";
> + bias-pull-up;
> + };
> +
> + tx-pins {
> + pins = "gpio123";
> + function = "qup2";
> + drive-strength = <2>;
> + bias-disable;
> + };
> + };
> +
> i2c21_default: i2c21-default-state {
> pins = "gpio81", "gpio82";
> function = "qup21";
> --
> 2.39.2
>

2023-03-22 11:44:41

by Johan Hovold

[permalink] [raw]
Subject: Re: [PATCH v7 4/4] arm64: dts: qcom: sc8280xp-x13s: Add bluetooth

On Tue, Mar 21, 2023 at 08:14:42PM -0500, Steev Klimaszewski wrote:
> The Lenovo Thinkpad X13s has a WCN6855 Bluetooth controller on uart2,
> add this.
>
> Signed-off-by: Steev Klimaszewski <[email protected]>
> ---
> Changes since v6:
> * Remove allowed-modes as they aren't needed
> * Remove regulator-allow-set-load
> * Set regulator-always-on because the wifi chip also uses the regulator
> * cts pin uses bias-bus-hold
> * Alphabetize uart2 pins
>
> Changes since v5:
> * Update patch subject
> * Specify initial mode (via guess) for vreg_s1c
> * Drop uart17 definition
> * Rename bt_en to bt_default because configuring more than one pin
> * Correct (maybe) bias configurations
> * Correct cts gpio
> * Split rts-tx into two nodes
> * Drop incorrect link in the commit message
>
> Changes since v4:
> * Address Konrad's review comments.
>
> Changes since v3:
> * Add vreg_s1c
> * Add regulators and not dead code
> * Fix commit message changelog
>
> Changes since v2:
> * Remove dead code and add TODO comment
> * Make dtbs_check happy with the pin definitions
> .../qcom/sc8280xp-lenovo-thinkpad-x13s.dts | 78 +++++++++++++++++++
> 1 file changed, 78 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts b/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
> index 92d365519546..05e66505e5cc 100644
> --- a/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
> +++ b/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
> @@ -24,6 +24,7 @@ / {
> aliases {
> i2c4 = &i2c4;
> i2c21 = &i2c21;
> + serial1 = &uart2;
> };
>
> wcd938x: audio-codec {
> @@ -431,6 +432,14 @@ regulators-1 {
> qcom,pmic-id = "c";
> vdd-bob-supply = <&vreg_vph_pwr>;
>
> + vreg_s1c: smps1 {
> + regulator-name = "vreg_s1c";
> + regulator-min-microvolt = <1880000>;
> + regulator-max-microvolt = <1900000>;
> + regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
> + regulator-always-on;
> + };

I went through the schematics to check for further problems with
consumers that are not yet described and found a few more bugs:

https://lore.kernel.org/lkml/[email protected]

Note that that series is now adding the s1c supply as it also used by
some of the pmics.

I'm assuming those fixes may get merged before this patch is, in which
case the above hunk should be dropped.

> +
> vreg_l1c: ldo1 {
> regulator-name = "vreg_l1c";
> regulator-min-microvolt = <1800000>;
> @@ -918,6 +927,32 @@ &qup0 {
> status = "okay";
> };
>
> +&uart2 {

This node in no longer in alphabetical order and needs to be moved
further down (above &usb_0).

> + pinctrl-0 = <&uart2_default>;
> + pinctrl-names = "default";
> +
> + status = "okay";
> +
> + bluetooth {
> + compatible = "qcom,wcn6855-bt";
> +
> + vddio-supply = <&vreg_s10b>;
> + vddbtcxmx-supply = <&vreg_s12b>;
> + vddrfacmn-supply = <&vreg_s12b>;
> + vddrfa0p8-supply = <&vreg_s12b>;
> + vddrfa1p2-supply = <&vreg_s11b>;
> + vddrfa1p7-supply = <&vreg_s1c>;
> +
> + max-speed = <3200000>;
> +
> + enable-gpios = <&tlmm 133 GPIO_ACTIVE_HIGH>;
> + swctrl-gpios = <&tlmm 132 GPIO_ACTIVE_HIGH>;
> +
> + pinctrl-0 = <&bt_default>;
> + pinctrl-names = "default";
> + };
> +};
> +
> &qup1 {
> status = "okay";
> };
> @@ -1192,6 +1227,21 @@ hastings_reg_en: hastings-reg-en-state {
> &tlmm {
> gpio-reserved-ranges = <70 2>, <74 6>, <83 4>, <125 2>, <128 2>, <154 7>;
>
> + bt_default: bt-default-state {
> + hstp-sw-ctrl-pins {
> + pins = "gpio132";
> + function = "gpio";
> + bias-pull-down;
> + };

Similarly, this one should go after hstp-bt-en-pins.

> +
> + hstp-bt-en-pins {
> + pins = "gpio133";
> + function = "gpio";
> + drive-strength = <16>;
> + bias-disable;
> + };
> + };
> +
> edp_reg_en: edp-reg-en-state {
> pins = "gpio25";
> function = "gpio";
> @@ -1213,6 +1263,34 @@ i2c4_default: i2c4-default-state {
> bias-disable;
> };
>
> + uart2_default: uart2-default-state {

And this one is also not ordered correctly.

> + };
> +
> i2c21_default: i2c21-default-state {
> pins = "gpio81", "gpio82";
> function = "qup21";

Johan

2023-03-22 15:43:05

by Steev Klimaszewski

[permalink] [raw]
Subject: Re: [PATCH v7 4/4] arm64: dts: qcom: sc8280xp-x13s: Add bluetooth

Hi Johan,

Thanks again for your time in reviewing things, it's greatly appreciated!

On Wed, Mar 22, 2023 at 6:41 AM Johan Hovold <[email protected]> wrote:
>
> On Tue, Mar 21, 2023 at 08:14:42PM -0500, Steev Klimaszewski wrote:
> > The Lenovo Thinkpad X13s has a WCN6855 Bluetooth controller on uart2,
> > add this.
> >
> > Signed-off-by: Steev Klimaszewski <[email protected]>
> > ---
> > Changes since v6:
> > * Remove allowed-modes as they aren't needed
> > * Remove regulator-allow-set-load
> > * Set regulator-always-on because the wifi chip also uses the regulator
> > * cts pin uses bias-bus-hold
> > * Alphabetize uart2 pins
> >
> > Changes since v5:
> > * Update patch subject
> > * Specify initial mode (via guess) for vreg_s1c
> > * Drop uart17 definition
> > * Rename bt_en to bt_default because configuring more than one pin
> > * Correct (maybe) bias configurations
> > * Correct cts gpio
> > * Split rts-tx into two nodes
> > * Drop incorrect link in the commit message
> >
> > Changes since v4:
> > * Address Konrad's review comments.
> >
> > Changes since v3:
> > * Add vreg_s1c
> > * Add regulators and not dead code
> > * Fix commit message changelog
> >
> > Changes since v2:
> > * Remove dead code and add TODO comment
> > * Make dtbs_check happy with the pin definitions
> > .../qcom/sc8280xp-lenovo-thinkpad-x13s.dts | 78 +++++++++++++++++++
> > 1 file changed, 78 insertions(+)
> >
> > diff --git a/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts b/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
> > index 92d365519546..05e66505e5cc 100644
> > --- a/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
> > +++ b/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
> > @@ -24,6 +24,7 @@ / {
> > aliases {
> > i2c4 = &i2c4;
> > i2c21 = &i2c21;
> > + serial1 = &uart2;
> > };
> >
> > wcd938x: audio-codec {
> > @@ -431,6 +432,14 @@ regulators-1 {
> > qcom,pmic-id = "c";
> > vdd-bob-supply = <&vreg_vph_pwr>;
> >
> > + vreg_s1c: smps1 {
> > + regulator-name = "vreg_s1c";
> > + regulator-min-microvolt = <1880000>;
> > + regulator-max-microvolt = <1900000>;
> > + regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
> > + regulator-always-on;
> > + };
>
> I went through the schematics to check for further problems with
> consumers that are not yet described and found a few more bugs:
>
> https://lore.kernel.org/lkml/[email protected]
>
> Note that that series is now adding the s1c supply as it also used by
> some of the pmics.
>
> I'm assuming those fixes may get merged before this patch is, in which
> case the above hunk should be dropped.
>

I can spin up v8 dropping this hunk and mention the dependency on that series.

> > +
> > vreg_l1c: ldo1 {
> > regulator-name = "vreg_l1c";
> > regulator-min-microvolt = <1800000>;
> > @@ -918,6 +927,32 @@ &qup0 {
> > status = "okay";
> > };
> >
> > +&uart2 {
>
> This node in no longer in alphabetical order and needs to be moved
> further down (above &usb_0).
>
Ack

> > + pinctrl-0 = <&uart2_default>;
> > + pinctrl-names = "default";
> > +
> > + status = "okay";
> > +
> > + bluetooth {
> > + compatible = "qcom,wcn6855-bt";
> > +
> > + vddio-supply = <&vreg_s10b>;
> > + vddbtcxmx-supply = <&vreg_s12b>;
> > + vddrfacmn-supply = <&vreg_s12b>;
> > + vddrfa0p8-supply = <&vreg_s12b>;
> > + vddrfa1p2-supply = <&vreg_s11b>;
> > + vddrfa1p7-supply = <&vreg_s1c>;
> > +
> > + max-speed = <3200000>;
> > +
> > + enable-gpios = <&tlmm 133 GPIO_ACTIVE_HIGH>;
> > + swctrl-gpios = <&tlmm 132 GPIO_ACTIVE_HIGH>;
> > +
> > + pinctrl-0 = <&bt_default>;
> > + pinctrl-names = "default";
> > + };
> > +};
> > +
> > &qup1 {
> > status = "okay";
> > };
> > @@ -1192,6 +1227,21 @@ hastings_reg_en: hastings-reg-en-state {
> > &tlmm {
> > gpio-reserved-ranges = <70 2>, <74 6>, <83 4>, <125 2>, <128 2>, <154 7>;
> >
> > + bt_default: bt-default-state {
> > + hstp-sw-ctrl-pins {
> > + pins = "gpio132";
> > + function = "gpio";
> > + bias-pull-down;
> > + };
>
> Similarly, this one should go after hstp-bt-en-pins.
>
Ack
> > +
> > + hstp-bt-en-pins {
> > + pins = "gpio133";
> > + function = "gpio";
> > + drive-strength = <16>;
> > + bias-disable;
> > + };
> > + };
> > +
> > edp_reg_en: edp-reg-en-state {
> > pins = "gpio25";
> > function = "gpio";
> > @@ -1213,6 +1263,34 @@ i2c4_default: i2c4-default-state {
> > bias-disable;
> > };
> >
> > + uart2_default: uart2-default-state {
>
> And this one is also not ordered correctly.
>
Ack
> > + };
> > +
> > i2c21_default: i2c21-default-state {
> > pins = "gpio81", "gpio82";
> > function = "qup21";
>
> Johan
-- steev

2023-03-22 16:06:04

by Johan Hovold

[permalink] [raw]
Subject: Re: [PATCH v7 4/4] arm64: dts: qcom: sc8280xp-x13s: Add bluetooth

On Wed, Mar 22, 2023 at 10:35:03AM -0500, Steev Klimaszewski wrote:
> On Wed, Mar 22, 2023 at 6:41 AM Johan Hovold <[email protected]> wrote:

> > I went through the schematics to check for further problems with
> > consumers that are not yet described and found a few more bugs:
> >
> > https://lore.kernel.org/lkml/[email protected]
> >
> > Note that that series is now adding the s1c supply as it also used by
> > some of the pmics.
> >
> > I'm assuming those fixes may get merged before this patch is, in which
> > case the above hunk should be dropped.
> >
>
> I can spin up v8 dropping this hunk and mention the dependency on that
> series.

Sounds good. Bjorn has even merged the above series now.

Johan