linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] arm64: dts: qcom: pm8916: Remove wrong reg-names for rtc@6000
@ 2021-09-28 11:29 Stephan Gerhold
  2021-09-28 11:29 ` [PATCH 2/3] arm64: dts: qcom: pm8916: Add pm8941-misc extcon for USB detection Stephan Gerhold
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Stephan Gerhold @ 2021-09-28 11:29 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Andy Gross, Stephen Boyd, Nikita Travkin, linux-arm-msm,
	devicetree, ~postmarketos/upstreaming, Stephan Gerhold

While removing the size from the "reg" properties in pm8916.dtsi,
commit bd6429e81010 ("ARM64: dts: qcom: Remove size elements from
pmic reg properties") mistakenly also removed the second register
address for the rtc@6000 device. That one did not represent the size
of the register region but actually the address of the second "alarm"
register region of the rtc@6000 device.

Now there are "reg-names" for two "reg" elements, but there is actually
only one "reg" listed.

Since the DT schema for "qcom,pm8941-rtc" only expects one "reg"
element anyway, just drop the "reg-names" entirely to fix this.

Fixes: bd6429e81010 ("ARM64: dts: qcom: Remove size elements from pmic reg properties")
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
---
 arch/arm64/boot/dts/qcom/pm8916.dtsi | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm64/boot/dts/qcom/pm8916.dtsi b/arch/arm64/boot/dts/qcom/pm8916.dtsi
index f931cb0de231..42180f1b5dbb 100644
--- a/arch/arm64/boot/dts/qcom/pm8916.dtsi
+++ b/arch/arm64/boot/dts/qcom/pm8916.dtsi
@@ -86,7 +86,6 @@ adc-chan@f {
 		rtc@6000 {
 			compatible = "qcom,pm8941-rtc";
 			reg = <0x6000>;
-			reg-names = "rtc", "alarm";
 			interrupts = <0x0 0x61 0x1 IRQ_TYPE_EDGE_RISING>;
 		};
 
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/3] arm64: dts: qcom: pm8916: Add pm8941-misc extcon for USB detection
  2021-09-28 11:29 [PATCH 1/3] arm64: dts: qcom: pm8916: Remove wrong reg-names for rtc@6000 Stephan Gerhold
@ 2021-09-28 11:29 ` Stephan Gerhold
  2021-09-28 11:29 ` [PATCH 3/3] arm64: dts: qcom: msm8916-longcheer-l8150: Use &pm8916_usbin extcon Stephan Gerhold
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Stephan Gerhold @ 2021-09-28 11:29 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Andy Gross, Stephen Boyd, Nikita Travkin, linux-arm-msm,
	devicetree, ~postmarketos/upstreaming, Stephan Gerhold

At the moment, USB gadget mode on MSM8916 works only with an extcon
device that reports the correct USB mode. This might be because the
USB PHY needs to be configured appropriately.

Unfortunately there is currently no simple approach to get such an
extcon device during early bring-up. The extcon device for USB VBUS
(i.e. gadget/peripheral mode) is typically provided by the charging
driver which is almost always very complex to port.

On pretty much all devices with PM8916, the USB VBUS is also connected
to the PM8916 "USB_IN" pad, no matter if they use the linear charger
integrated into PM8916 or not. The state of this pad can be checked
with the "USBIN_VALID" interrupt of PM8916.

The "qcom,pm8941-misc" binding exists to expose an "usb_vbus" and/or
"usb_id" interrupt from the PMIC as an extcon device.

Add a &pm8916_usbin node to pm8916.dtsi which can be used as simple
extcon device for devices that are currently lacking a proper charger
driver.

Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
---
 arch/arm64/boot/dts/qcom/pm8916.dtsi | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/pm8916.dtsi b/arch/arm64/boot/dts/qcom/pm8916.dtsi
index 42180f1b5dbb..48c6c9cca53b 100644
--- a/arch/arm64/boot/dts/qcom/pm8916.dtsi
+++ b/arch/arm64/boot/dts/qcom/pm8916.dtsi
@@ -41,6 +41,14 @@ watchdog {
 			};
 		};
 
+		pm8916_usbin: extcon@1300 {
+			compatible = "qcom,pm8941-misc";
+			reg = <0x1300>;
+			interrupts = <0x0 0x13 1 IRQ_TYPE_EDGE_BOTH>;
+			interrupt-names = "usb_vbus";
+			status = "disabled";
+		};
+
 		pm8916_temp: temp-alarm@2400 {
 			compatible = "qcom,spmi-temp-alarm";
 			reg = <0x2400>;
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/3] arm64: dts: qcom: msm8916-longcheer-l8150: Use &pm8916_usbin extcon
  2021-09-28 11:29 [PATCH 1/3] arm64: dts: qcom: pm8916: Remove wrong reg-names for rtc@6000 Stephan Gerhold
  2021-09-28 11:29 ` [PATCH 2/3] arm64: dts: qcom: pm8916: Add pm8941-misc extcon for USB detection Stephan Gerhold
@ 2021-09-28 11:29 ` Stephan Gerhold
  2021-09-28 15:38 ` [PATCH 1/3] arm64: dts: qcom: pm8916: Remove wrong reg-names for rtc@6000 Bjorn Andersson
  2021-09-28 15:40 ` patchwork-bot+linux-arm-msm
  3 siblings, 0 replies; 5+ messages in thread
From: Stephan Gerhold @ 2021-09-28 11:29 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Andy Gross, Stephen Boyd, Nikita Travkin, linux-arm-msm,
	devicetree, ~postmarketos/upstreaming, Stephan Gerhold

At the moment, longcheer-l8150 is using a dummy extcon-usb-gpio device
that permanently enables USB gadget mode. This workaround allows USB
to work but is actually wrong and confusing. The "vbus-gpio" used there
refers to an unused (floating) GPIO that is pulled up to make
extcon-usb-gpio report USB gadget mode permanently.

Replace this with the new &pm8916_usbin extcon device that actually
reports if an USB cable is attached or not. This allows the USB PHY
to be turned off when there is no USB cable attached and is much
cleaner overall.

Fixes: 16e8e8072108 ("arm64: dts: qcom: Add device tree for Longcheer L8150")
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
---
 .../boot/dts/qcom/msm8916-longcheer-l8150.dts | 23 +++++--------------
 1 file changed, 6 insertions(+), 17 deletions(-)

diff --git a/arch/arm64/boot/dts/qcom/msm8916-longcheer-l8150.dts b/arch/arm64/boot/dts/qcom/msm8916-longcheer-l8150.dts
index 30716eb8fb2d..285102f0e04f 100644
--- a/arch/arm64/boot/dts/qcom/msm8916-longcheer-l8150.dts
+++ b/arch/arm64/boot/dts/qcom/msm8916-longcheer-l8150.dts
@@ -30,14 +30,6 @@ wcnss_mem: wcnss@8b600000 {
 		};
 	};
 
-	// FIXME: Use extcon device provided by charger driver when available
-	usb_vbus: usb-vbus {
-		compatible = "linux,extcon-usb-gpio";
-		vbus-gpio = <&msmgpio 62 GPIO_ACTIVE_HIGH>;
-		pinctrl-names = "default";
-		pinctrl-0 = <&usb_vbus_default>;
-	};
-
 	gpio-keys {
 		compatible = "gpio-keys";
 
@@ -215,6 +207,10 @@ &pm8916_resin {
 	linux,code = <KEY_VOLUMEDOWN>;
 };
 
+&pm8916_usbin {
+	status = "okay";
+};
+
 &pm8916_vib {
 	status = "okay";
 };
@@ -244,11 +240,11 @@ &sdhc_2 {
 &usb {
 	status = "okay";
 	dr_mode = "peripheral";
-	extcon = <&usb_vbus>;
+	extcon = <&pm8916_usbin>;
 };
 
 &usb_hs_phy {
-	extcon = <&usb_vbus>;
+	extcon = <&pm8916_usbin>;
 };
 
 &smd_rpm_regulators {
@@ -410,11 +406,4 @@ tp_int_default: tp-int-default {
 		drive-strength = <2>;
 		bias-disable;
 	};
-
-	usb_vbus_default: usb-vbus-default {
-		pins = "gpio62";
-		function = "gpio";
-
-		bias-pull-up;
-	};
 };
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/3] arm64: dts: qcom: pm8916: Remove wrong reg-names for rtc@6000
  2021-09-28 11:29 [PATCH 1/3] arm64: dts: qcom: pm8916: Remove wrong reg-names for rtc@6000 Stephan Gerhold
  2021-09-28 11:29 ` [PATCH 2/3] arm64: dts: qcom: pm8916: Add pm8941-misc extcon for USB detection Stephan Gerhold
  2021-09-28 11:29 ` [PATCH 3/3] arm64: dts: qcom: msm8916-longcheer-l8150: Use &pm8916_usbin extcon Stephan Gerhold
@ 2021-09-28 15:38 ` Bjorn Andersson
  2021-09-28 15:40 ` patchwork-bot+linux-arm-msm
  3 siblings, 0 replies; 5+ messages in thread
From: Bjorn Andersson @ 2021-09-28 15:38 UTC (permalink / raw)
  To: Stephan Gerhold
  Cc: Andy Gross, ~postmarketos/upstreaming, Stephen Boyd, devicetree,
	linux-arm-msm, Nikita Travkin

On Tue, 28 Sep 2021 13:29:43 +0200, Stephan Gerhold wrote:
> While removing the size from the "reg" properties in pm8916.dtsi,
> commit bd6429e81010 ("ARM64: dts: qcom: Remove size elements from
> pmic reg properties") mistakenly also removed the second register
> address for the rtc@6000 device. That one did not represent the size
> of the register region but actually the address of the second "alarm"
> register region of the rtc@6000 device.
> 
> [...]

Applied, thanks!

[1/3] arm64: dts: qcom: pm8916: Remove wrong reg-names for rtc@6000
      commit: 483de2b44cd3a168458f8f9ff237e78a434729bc
[2/3] arm64: dts: qcom: pm8916: Add pm8941-misc extcon for USB detection
      commit: f5d7bca55425c8611e6cfa3f236d1f56031920e8
[3/3] arm64: dts: qcom: msm8916-longcheer-l8150: Use &pm8916_usbin extcon
      commit: b30cad26d8030bddeb0ee2373b6d4c1440ffb1a3

Best regards,
-- 
Bjorn Andersson <bjorn.andersson@linaro.org>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/3] arm64: dts: qcom: pm8916: Remove wrong reg-names for rtc@6000
  2021-09-28 11:29 [PATCH 1/3] arm64: dts: qcom: pm8916: Remove wrong reg-names for rtc@6000 Stephan Gerhold
                   ` (2 preceding siblings ...)
  2021-09-28 15:38 ` [PATCH 1/3] arm64: dts: qcom: pm8916: Remove wrong reg-names for rtc@6000 Bjorn Andersson
@ 2021-09-28 15:40 ` patchwork-bot+linux-arm-msm
  3 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+linux-arm-msm @ 2021-09-28 15:40 UTC (permalink / raw)
  To: Stephan Gerhold; +Cc: linux-arm-msm

Hello:

This series was applied to qcom/linux.git (refs/heads/for-next):

On Tue, 28 Sep 2021 13:29:43 +0200 you wrote:
> While removing the size from the "reg" properties in pm8916.dtsi,
> commit bd6429e81010 ("ARM64: dts: qcom: Remove size elements from
> pmic reg properties") mistakenly also removed the second register
> address for the rtc@6000 device. That one did not represent the size
> of the register region but actually the address of the second "alarm"
> register region of the rtc@6000 device.
> 
> [...]

Here is the summary with links:
  - [1/3] arm64: dts: qcom: pm8916: Remove wrong reg-names for rtc@6000
    https://git.kernel.org/qcom/c/483de2b44cd3
  - [2/3] arm64: dts: qcom: pm8916: Add pm8941-misc extcon for USB detection
    https://git.kernel.org/qcom/c/f5d7bca55425
  - [3/3] arm64: dts: qcom: msm8916-longcheer-l8150: Use &pm8916_usbin extcon
    https://git.kernel.org/qcom/c/b30cad26d803

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-09-28 15:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-28 11:29 [PATCH 1/3] arm64: dts: qcom: pm8916: Remove wrong reg-names for rtc@6000 Stephan Gerhold
2021-09-28 11:29 ` [PATCH 2/3] arm64: dts: qcom: pm8916: Add pm8941-misc extcon for USB detection Stephan Gerhold
2021-09-28 11:29 ` [PATCH 3/3] arm64: dts: qcom: msm8916-longcheer-l8150: Use &pm8916_usbin extcon Stephan Gerhold
2021-09-28 15:38 ` [PATCH 1/3] arm64: dts: qcom: pm8916: Remove wrong reg-names for rtc@6000 Bjorn Andersson
2021-09-28 15:40 ` patchwork-bot+linux-arm-msm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).