From patchwork Tue Sep 28 11:29:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 12522317 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6B47C433EF for ; Tue, 28 Sep 2021 11:31:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ABAC06120D for ; Tue, 28 Sep 2021 11:31:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240354AbhI1Lcp (ORCPT ); Tue, 28 Sep 2021 07:32:45 -0400 Received: from mo4-p01-ob.smtp.rzone.de ([85.215.255.50]:23935 "EHLO mo4-p01-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240355AbhI1Lcm (ORCPT ); Tue, 28 Sep 2021 07:32:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1632828655; s=strato-dkim-0002; d=gerhold.net; h=Message-Id:Date:Subject:Cc:To:From:Cc:Date:From:Subject:Sender; bh=qY3mbrX+1Mme37XGkKJNHUCNmq5BBHE84YApRenh6s8=; b=opp/PZ2PIWNA2em4W2QbM21CMV5CUZodxPNWFqIRmFt/PKbomxk8tvwBZgbO/ZKsQD 3pvOa5JrzcQnPfdK8KfAnyZxs0IidtAw5P00xLk6oO8lJ4NoR6tg9lSPg8uhIeB8KxTj ub43YoqoTsbbEJ3DNyQ5Wp3/pplX8it6ByjoxVpFuEodpxFaaIb3GPYSqsspn7UhAcLg vUXNb6YJkZ3zodqSFVYttvfY33h6kfZjFciEWBUZj9E0RSOY4Ybim5XrNcYIS1ws0jdT AH5S62u+XAs56v2zO53xPlWtfYBRZWY18GGbY4+/axA8mgMkFmBp+pX0E2i3MqP011ss u2Eg== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":P3gBZUipdd93FF5ZZvYFPugejmSTVR2nRPhVORvLd4SsytBXTbAOHjRHIhr3eFSKSxc=" X-RZG-CLASS-ID: mo00 Received: from droid.. by smtp.strato.de (RZmta 47.33.8 DYNA|AUTH) with ESMTPSA id 301038x8SBUskIr (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Tue, 28 Sep 2021 13:30:54 +0200 (CEST) From: Stephan Gerhold To: Bjorn Andersson Cc: Andy Gross , Stephen Boyd , Nikita Travkin , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, Stephan Gerhold Subject: [PATCH 1/3] arm64: dts: qcom: pm8916: Remove wrong reg-names for rtc@6000 Date: Tue, 28 Sep 2021 13:29:43 +0200 Message-Id: <20210928112945.25310-1-stephan@gerhold.net> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org 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 --- 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>; }; From patchwork Tue Sep 28 11:29:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 12522319 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A28D5C433FE for ; Tue, 28 Sep 2021 11:34:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8C11360F4F for ; Tue, 28 Sep 2021 11:34:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240364AbhI1Lfi (ORCPT ); Tue, 28 Sep 2021 07:35:38 -0400 Received: from mo4-p01-ob.smtp.rzone.de ([85.215.255.52]:17450 "EHLO mo4-p01-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240353AbhI1Lfi (ORCPT ); Tue, 28 Sep 2021 07:35:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1632828656; s=strato-dkim-0002; d=gerhold.net; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=DJ9Li0Jn+PEFHade/dtMX8uifwhfEBll3zWaq2035FE=; b=bIAwxlyP4GPhYFZLXu11CntS+BIlVBwWO9+wnrN3Wk99UBq8GSLTHVt7EA5mVUMGmu 8nkz0MpcAiIm1xWIbDBMeOwztNUyHvhL9jABxDmosvL8qrEhSHbYyHqyiY2M/NlLUsrE ue18QruAhiAuvIgVuDwNgaSmvY/gN1Lt5gq5k1x/e1JVVuHJqrGbkFf4IRdIGLbrk2Oo nINQpv8NPdN8DGiqIqJQiStRwrQ5hOMRezJfaaXzXw9kzs7doGXzluz0Lz6Lir0mEZhx GPDoZc/5Hgw/BuEJ+R5B74NUfcnXdGPY1tetUDh39oWXzaxRf76PWZQjlYTxUVPZdzfU veUg== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":P3gBZUipdd93FF5ZZvYFPugejmSTVR2nRPhVORvLd4SsytBXTbAOHjRHIhr3eFSKSxc=" X-RZG-CLASS-ID: mo00 Received: from droid.. by smtp.strato.de (RZmta 47.33.8 DYNA|AUTH) with ESMTPSA id 301038x8SBUtkIs (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Tue, 28 Sep 2021 13:30:55 +0200 (CEST) From: Stephan Gerhold To: Bjorn Andersson Cc: Andy Gross , Stephen Boyd , Nikita Travkin , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, Stephan Gerhold Subject: [PATCH 2/3] arm64: dts: qcom: pm8916: Add pm8941-misc extcon for USB detection Date: Tue, 28 Sep 2021 13:29:44 +0200 Message-Id: <20210928112945.25310-2-stephan@gerhold.net> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210928112945.25310-1-stephan@gerhold.net> References: <20210928112945.25310-1-stephan@gerhold.net> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org 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 --- 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>; From patchwork Tue Sep 28 11:29:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 12522321 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F3551C4332F for ; Tue, 28 Sep 2021 11:34:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DACB7611CC for ; Tue, 28 Sep 2021 11:34:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240366AbhI1Lfj (ORCPT ); Tue, 28 Sep 2021 07:35:39 -0400 Received: from mo4-p02-ob.smtp.rzone.de ([85.215.255.80]:14484 "EHLO mo4-p02-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240362AbhI1Lfi (ORCPT ); Tue, 28 Sep 2021 07:35:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1632828656; s=strato-dkim-0002; d=gerhold.net; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=7Z8MXWATCj/szKuUfPihFzKr7i2SIYu+UOVqTyNAk24=; b=lPXA93sdw81DcHCbEmP+N9elCplnPE+bkr+mPJsOGUkWNkc1lIq48yXftSWZsjNoqY hMqKVAa00NfTBHCSaNNzmatJway4Y6tHEMh8gI+9DZJR+aEAyCQhbRDZEP5QmRARljqp UXz2VHeKRx99JXsZDd6Ku29k1/qrjItZl8YMhdz1JgQ+uQj4oCnA35K7IJ3oAQx8pnZK Q/HdTns1L+si7DRDbxLHTMwYa+dlS2P/tt9WjTUd2b4G21MxYJx996gQg9r+nMcjnJGk ifPMMNV8rxpCpcqvTqMmufkSA3goTzXkk1sqKd1/A3pYn5V6GCQCysQtAba3sCJWOun4 +sMw== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":P3gBZUipdd93FF5ZZvYFPugejmSTVR2nRPhVORvLd4SsytBXTbAOHjRHIhr3eFSKSxc=" X-RZG-CLASS-ID: mo00 Received: from droid.. by smtp.strato.de (RZmta 47.33.8 DYNA|AUTH) with ESMTPSA id 301038x8SBUukIt (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Tue, 28 Sep 2021 13:30:56 +0200 (CEST) From: Stephan Gerhold To: Bjorn Andersson Cc: Andy Gross , Stephen Boyd , Nikita Travkin , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, Stephan Gerhold Subject: [PATCH 3/3] arm64: dts: qcom: msm8916-longcheer-l8150: Use &pm8916_usbin extcon Date: Tue, 28 Sep 2021 13:29:45 +0200 Message-Id: <20210928112945.25310-3-stephan@gerhold.net> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210928112945.25310-1-stephan@gerhold.net> References: <20210928112945.25310-1-stephan@gerhold.net> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org 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 --- .../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 = ; }; +&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; - }; };