Message ID | 20231023-pm8916-dtsi-bms-lbc-v2-2-343e3dbf423e@trvn.ru |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce89:0:b0:403:3b70:6f57 with SMTP id p9csp1106005vqx; Sun, 22 Oct 2023 23:21:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHBWR+vX5J4GPxpMGocd75tPRLEB2YWe84u4JdI6gdYEiBFD73XCO+Rx3kwKl2jWU1YRLTG X-Received: by 2002:a17:90b:2786:b0:274:111c:c14d with SMTP id pw6-20020a17090b278600b00274111cc14dmr5331721pjb.13.1698042118579; Sun, 22 Oct 2023 23:21:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698042118; cv=none; d=google.com; s=arc-20160816; b=z7EBh+RqCgd/VdykES3x+MWQLU+OB/YV6yXPYQQ8d7TepymHWACmd8JCGH/LxDatkr RBBi/xj+1YDDitVMDDsXtBjrhkEhr6v/ShYysa0T6O+UVxkiBlFNUxZfqp1AxA9ya8k0 h3oOBzao6F9zCYFT7lzbG6aNjz+EoxYaiqOGym8yHcCY1tNC/Ae5huQLCXnELxXxKf/s zQ1r3JiGy1OlgtDjNKg6ubeMonRxSTqYTnEWxYIHtWNUGe7rN+LW91IZa/L2XNiG1+iE w3zSk8i1VFubKFvcPrWlgqXYDsDzbZNi4S1A8AWrD67pdfTYbmSi7jh+NREcAM0Eey88 yImw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=gKU2Hb5Ts8ACz6pXE/qz00/JtwGg1ALMTvmhW/lX6v4=; fh=WJZ0ZrB0e7K7PtDZrv0aOFDugF3kN5vtBdwtzw6+lXE=; b=OGGy57GCDdr3Hf144U+Csiv6wbyTjxB2CTBjJYJXQAjvEeJdk5ZgV/Sv4lePIBjgXD yeIOROsC9MSIJ31xU6zi5zrFFt2ybsfncEmKw3DKH0YHNrXK4NqUhGO0fsmSn8WQ6eg+ N6gFAU32BIYeNcoqbjgJCGAvQ/ZRMM+EBKoRlUwWGWSaNt8wsoIw81DBtQpnX+qW1jeD zqEJw887zhkHWX+vKeoOCovCk3BBpE0lP4D8QX0Do0gHmBpYeFNDsfBJYWkBFctjsx5e l8xRUTb4y1JEhefYks5V/dvx4+j1VeKGir4tD82efaj2I3t3kcVyY8QURuoMNLVID8S4 LFmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@trvn.ru header.s=mail header.b=ejXquwX3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=trvn.ru Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id p9-20020a17090a868900b002774c98054csi6102100pjn.116.2023.10.22.23.21.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Oct 2023 23:21:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@trvn.ru header.s=mail header.b=ejXquwX3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=trvn.ru Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 4D4C88068228; Sun, 22 Oct 2023 23:21:56 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233504AbjJWGVn (ORCPT <rfc822;a1648639935@gmail.com> + 26 others); Mon, 23 Oct 2023 02:21:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233491AbjJWGVg (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 23 Oct 2023 02:21:36 -0400 Received: from box.trvn.ru (box.trvn.ru [194.87.146.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EA1D10D5; Sun, 22 Oct 2023 23:21:31 -0700 (PDT) Received: from authenticated-user (box.trvn.ru [194.87.146.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by box.trvn.ru (Postfix) with ESMTPSA id 0BBE44C0CE; Mon, 23 Oct 2023 11:21:11 +0500 (+05) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=trvn.ru; s=mail; t=1698042071; bh=cGxQVt+NVbaQIsSjfqmJUKIMf/PR6FSgo/FLAfIdsik=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ejXquwX3PnnIL3dZ7rb01Fjajr9FkFcJAWX30feIVvRbMCbZ3rmgqCfQyl/IkBDoo GbeJgr7DIi8cARGXqSK6svS7dkF4TMu3CQEJs0c/q0IIcKiti2kWynIbBIZfvgRVvO tBOIcW/RRXbbx+9ODfvB6xgFSTukqiUiVOj2rh0ERPCJ8mn+4BHm0jiMX5ePw9UUOk 4QpzNk1zTtXMc/lhxbKmkY40nD9L3FrB2hOfSeKk0jObrsjUY1jmSk4A3QIGUw21Ax 9eml7e9Zd8YYREc+ks0ZRwXoNhf9zDEdIb62T8GPCuyAGJcJZGBoRUllgAeKUoF7jd WexgptyP2qxQA== From: Nikita Travkin <nikita@trvn.ru> Date: Mon, 23 Oct 2023 11:20:33 +0500 Subject: [PATCH v2 2/3] arm64: dts: qcom: pm8916: Add BMS and charger MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20231023-pm8916-dtsi-bms-lbc-v2-2-343e3dbf423e@trvn.ru> References: <20231023-pm8916-dtsi-bms-lbc-v2-0-343e3dbf423e@trvn.ru> In-Reply-To: <20231023-pm8916-dtsi-bms-lbc-v2-0-343e3dbf423e@trvn.ru> To: 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>, Conor Dooley <conor+dt@kernel.org>, Lee Jones <lee@kernel.org>, Stephen Boyd <sboyd@kernel.org> Cc: linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, Nikita Travkin <nikita@trvn.ru> X-Developer-Signature: v=1; a=openpgp-sha256; l=2360; i=nikita@trvn.ru; h=from:subject:message-id; bh=cGxQVt+NVbaQIsSjfqmJUKIMf/PR6FSgo/FLAfIdsik=; b=owEBbQKS/ZANAwAIAUMc7O4oGb91AcsmYgBlNhDRHM6Gt64pGbufSe8l9M5t5S0bp3svifn+y QLkTSjDZFiJAjMEAAEIAB0WIQTAhK9UUj+qg34uxUdDHOzuKBm/dQUCZTYQ0QAKCRBDHOzuKBm/ dUxWEACdupMPoHhHcJ6VkcR5ikUEQLdMOqy04PTeJ1Jv3dwSUXnsHHA69p6wmYwCASI6zEtDEAx mQK6Ao5Q4r31Q8s9CZzZW8PzJC70O9V275q8jd5+IlR8x8iArR1ToZ59hOk6lfp9Wruaf38f3kW bOSuEh/NpiGWe7F4ULq001IchM4AbHCdhzfOuoIZGbZDFtwbAGSPGx6I7uIKlVRIDpNRWQO2Jzw bBV3lUc04oRkJqaLeLc6eoJpBGyl20dFI57OPOp0JK3qtloWtymm+e73OZA+ynhtnPQiI8+8pcV Ix14alS3x1tu/G1HH8oioUhNTxE+JGCZpDGckiZYm1OnMgqtso4DCUqDLFybPPZavG6881oSuez 74pHrFo4g6Q6zYoM1o3K/z20NO6bZOiAlbdyulDAjZrs6ISgWQ/OrtSWJDyIqpAosofDhlclNq3 V/8vdcZ7ZgHs7Sz6WGej3wpvYs9BsEywKcY7H6i1rxhffhhCBz2LMBQY8jazQe/VorJfrLB2+Cw kRRllP5wnizvQWdWhnRob4k2RcM2Doynf8qe+KCVNP3N3/L65BpuAI/NobdNiolPteO9dqU047a wFMQjpT1nJU9vRPFUt7lz0kLwvakcjwLMvzcGVoaTimuVreiwqYmwob6/7BxGORMqI5xEfxVH+W GaVDiepL/8mTaIQ== X-Developer-Key: i=nikita@trvn.ru; a=openpgp; fpr=C084AF54523FAA837E2EC547431CECEE2819BF75 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, 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 groat.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Sun, 22 Oct 2023 23:21:56 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780526212122594591 X-GMAIL-MSGID: 1780526212122594591 |
Series |
pm8916: Add BMS and charger
|
|
Commit Message
Nikita Travkin
Oct. 23, 2023, 6:20 a.m. UTC
pm8916 contains some hardware blocks for battery powered devices:
- VM-BMS: Battery voltage monitoring block.
- LBC: Linear battery charger.
Add them to the pmic dtsi so the devices that make use of those blocks
can enable them.
Signed-off-by: Nikita Travkin <nikita@trvn.ru>
---
arch/arm64/boot/dts/qcom/pm8916.dtsi | 48 ++++++++++++++++++++++++++++++++++++
1 file changed, 48 insertions(+)
Comments
On 10/23/23 08:20, Nikita Travkin wrote: > pm8916 contains some hardware blocks for battery powered devices: > > - VM-BMS: Battery voltage monitoring block. > - LBC: Linear battery charger. > > Add them to the pmic dtsi so the devices that make use of those blocks > can enable them. > > Signed-off-by: Nikita Travkin <nikita@trvn.ru> > --- > arch/arm64/boot/dts/qcom/pm8916.dtsi | 48 ++++++++++++++++++++++++++++++++++++ > 1 file changed, 48 insertions(+) > > diff --git a/arch/arm64/boot/dts/qcom/pm8916.dtsi b/arch/arm64/boot/dts/qcom/pm8916.dtsi > index f4de86787743..4b2e8fb47d2d 100644 > --- a/arch/arm64/boot/dts/qcom/pm8916.dtsi > +++ b/arch/arm64/boot/dts/qcom/pm8916.dtsi > @@ -41,6 +41,35 @@ watchdog { > }; > }; > > + pm8916_charger: charger@1000 { > + compatible = "qcom,pm8916-lbc"; > + reg = <0x1000>, <0x1200>, <0x1300>, <0x1600>; > + reg-names = "chgr", "bat_if", "usb", "misc"; > + > + interrupts = <0x0 0x10 0 IRQ_TYPE_EDGE_BOTH>, > + <0x0 0x10 5 IRQ_TYPE_EDGE_BOTH>, > + <0x0 0x10 6 IRQ_TYPE_EDGE_BOTH>, > + <0x0 0x10 7 IRQ_TYPE_EDGE_BOTH>, > + <0x0 0x12 0 IRQ_TYPE_EDGE_BOTH>, > + <0x0 0x12 1 IRQ_TYPE_EDGE_BOTH>, > + <0x0 0x13 0 IRQ_TYPE_EDGE_BOTH>, > + <0x0 0x13 1 IRQ_TYPE_EDGE_BOTH>, > + <0x0 0x13 2 IRQ_TYPE_EDGE_BOTH>, > + <0x0 0x13 4 IRQ_TYPE_EDGE_BOTH>; > + interrupt-names = "vbat_det", > + "fast_chg", > + "chg_fail", > + "chg_done", > + "bat_pres", > + "temp_ok", > + "coarse_det", > + "usb_vbus", So, both the charger and the USBIN driver use the same irq? :/ Konrad
Konrad Dybcio писал(а) 24.10.2023 13:34: > On 10/23/23 08:20, Nikita Travkin wrote: >> pm8916 contains some hardware blocks for battery powered devices: >> >> - VM-BMS: Battery voltage monitoring block. >> - LBC: Linear battery charger. >> >> Add them to the pmic dtsi so the devices that make use of those blocks >> can enable them. >> >> Signed-off-by: Nikita Travkin <nikita@trvn.ru> >> --- >> arch/arm64/boot/dts/qcom/pm8916.dtsi | 48 ++++++++++++++++++++++++++++++++++++ >> 1 file changed, 48 insertions(+) >> >> diff --git a/arch/arm64/boot/dts/qcom/pm8916.dtsi b/arch/arm64/boot/dts/qcom/pm8916.dtsi >> index f4de86787743..4b2e8fb47d2d 100644 >> --- a/arch/arm64/boot/dts/qcom/pm8916.dtsi >> +++ b/arch/arm64/boot/dts/qcom/pm8916.dtsi >> @@ -41,6 +41,35 @@ watchdog { >> }; >> }; >> + pm8916_charger: charger@1000 { >> + compatible = "qcom,pm8916-lbc"; >> + reg = <0x1000>, <0x1200>, <0x1300>, <0x1600>; >> + reg-names = "chgr", "bat_if", "usb", "misc"; >> + >> + interrupts = <0x0 0x10 0 IRQ_TYPE_EDGE_BOTH>, >> + <0x0 0x10 5 IRQ_TYPE_EDGE_BOTH>, >> + <0x0 0x10 6 IRQ_TYPE_EDGE_BOTH>, >> + <0x0 0x10 7 IRQ_TYPE_EDGE_BOTH>, >> + <0x0 0x12 0 IRQ_TYPE_EDGE_BOTH>, >> + <0x0 0x12 1 IRQ_TYPE_EDGE_BOTH>, >> + <0x0 0x13 0 IRQ_TYPE_EDGE_BOTH>, >> + <0x0 0x13 1 IRQ_TYPE_EDGE_BOTH>, >> + <0x0 0x13 2 IRQ_TYPE_EDGE_BOTH>, >> + <0x0 0x13 4 IRQ_TYPE_EDGE_BOTH>; >> + interrupt-names = "vbat_det", >> + "fast_chg", >> + "chg_fail", >> + "chg_done", >> + "bat_pres", >> + "temp_ok", >> + "coarse_det", >> + "usb_vbus", > So, both the charger and the USBIN driver use the same irq? :/ > AFAIU the usbin extcon driver pretty much just tracks the state of the IRQ to report extcon. It happens to assume the same part of the pmic though, yes, which also means there will be no user that would enable both charger and vbus extcon, since charger driver provides this functionality as well. Nikita > Konrad
On 10/24/23 11:29, Nikita Travkin wrote: > Konrad Dybcio писал(а) 24.10.2023 13:34: >> On 10/23/23 08:20, Nikita Travkin wrote: >>> pm8916 contains some hardware blocks for battery powered devices: >>> >>> - VM-BMS: Battery voltage monitoring block. >>> - LBC: Linear battery charger. >>> >>> Add them to the pmic dtsi so the devices that make use of those blocks >>> can enable them. >>> >>> Signed-off-by: Nikita Travkin <nikita@trvn.ru> >>> --- >>> arch/arm64/boot/dts/qcom/pm8916.dtsi | 48 ++++++++++++++++++++++++++++++++++++ >>> 1 file changed, 48 insertions(+) >>> >>> diff --git a/arch/arm64/boot/dts/qcom/pm8916.dtsi b/arch/arm64/boot/dts/qcom/pm8916.dtsi >>> index f4de86787743..4b2e8fb47d2d 100644 >>> --- a/arch/arm64/boot/dts/qcom/pm8916.dtsi >>> +++ b/arch/arm64/boot/dts/qcom/pm8916.dtsi >>> @@ -41,6 +41,35 @@ watchdog { >>> }; >>> }; >>> + pm8916_charger: charger@1000 { >>> + compatible = "qcom,pm8916-lbc"; >>> + reg = <0x1000>, <0x1200>, <0x1300>, <0x1600>; >>> + reg-names = "chgr", "bat_if", "usb", "misc"; >>> + >>> + interrupts = <0x0 0x10 0 IRQ_TYPE_EDGE_BOTH>, >>> + <0x0 0x10 5 IRQ_TYPE_EDGE_BOTH>, >>> + <0x0 0x10 6 IRQ_TYPE_EDGE_BOTH>, >>> + <0x0 0x10 7 IRQ_TYPE_EDGE_BOTH>, >>> + <0x0 0x12 0 IRQ_TYPE_EDGE_BOTH>, >>> + <0x0 0x12 1 IRQ_TYPE_EDGE_BOTH>, >>> + <0x0 0x13 0 IRQ_TYPE_EDGE_BOTH>, >>> + <0x0 0x13 1 IRQ_TYPE_EDGE_BOTH>, >>> + <0x0 0x13 2 IRQ_TYPE_EDGE_BOTH>, >>> + <0x0 0x13 4 IRQ_TYPE_EDGE_BOTH>; >>> + interrupt-names = "vbat_det", >>> + "fast_chg", >>> + "chg_fail", >>> + "chg_done", >>> + "bat_pres", >>> + "temp_ok", >>> + "coarse_det", >>> + "usb_vbus", >> So, both the charger and the USBIN driver use the same irq? :/ >> > > AFAIU the usbin extcon driver pretty much just tracks the state > of the IRQ to report extcon. It happens to assume the same part > of the pmic though, yes, which also means there will be no user > that would enable both charger and vbus extcon, since charger > driver provides this functionality as well. So, should USBIN be removed from PM8916 dt since it's essentially a part of the charger block? Konrad
On Thu, Oct 26, 2023 at 08:54:00PM +0200, Konrad Dybcio wrote: > On 10/24/23 11:29, Nikita Travkin wrote: > > Konrad Dybcio писал(а) 24.10.2023 13:34: > > > On 10/23/23 08:20, Nikita Travkin wrote: > > > > pm8916 contains some hardware blocks for battery powered devices: > > > > > > > > - VM-BMS: Battery voltage monitoring block. > > > > - LBC: Linear battery charger. > > > > > > > > Add them to the pmic dtsi so the devices that make use of those blocks > > > > can enable them. > > > > > > > > Signed-off-by: Nikita Travkin <nikita@trvn.ru> > > > > --- > > > > arch/arm64/boot/dts/qcom/pm8916.dtsi | 48 ++++++++++++++++++++++++++++++++++++ > > > > 1 file changed, 48 insertions(+) > > > > > > > > diff --git a/arch/arm64/boot/dts/qcom/pm8916.dtsi b/arch/arm64/boot/dts/qcom/pm8916.dtsi > > > > index f4de86787743..4b2e8fb47d2d 100644 > > > > --- a/arch/arm64/boot/dts/qcom/pm8916.dtsi > > > > +++ b/arch/arm64/boot/dts/qcom/pm8916.dtsi > > > > @@ -41,6 +41,35 @@ watchdog { > > > > }; > > > > }; > > > > + pm8916_charger: charger@1000 { > > > > + compatible = "qcom,pm8916-lbc"; > > > > + reg = <0x1000>, <0x1200>, <0x1300>, <0x1600>; > > > > + reg-names = "chgr", "bat_if", "usb", "misc"; > > > > + > > > > + interrupts = <0x0 0x10 0 IRQ_TYPE_EDGE_BOTH>, > > > > + <0x0 0x10 5 IRQ_TYPE_EDGE_BOTH>, > > > > + <0x0 0x10 6 IRQ_TYPE_EDGE_BOTH>, > > > > + <0x0 0x10 7 IRQ_TYPE_EDGE_BOTH>, > > > > + <0x0 0x12 0 IRQ_TYPE_EDGE_BOTH>, > > > > + <0x0 0x12 1 IRQ_TYPE_EDGE_BOTH>, > > > > + <0x0 0x13 0 IRQ_TYPE_EDGE_BOTH>, > > > > + <0x0 0x13 1 IRQ_TYPE_EDGE_BOTH>, > > > > + <0x0 0x13 2 IRQ_TYPE_EDGE_BOTH>, > > > > + <0x0 0x13 4 IRQ_TYPE_EDGE_BOTH>; > > > > + interrupt-names = "vbat_det", > > > > + "fast_chg", > > > > + "chg_fail", > > > > + "chg_done", > > > > + "bat_pres", > > > > + "temp_ok", > > > > + "coarse_det", > > > > + "usb_vbus", > > > So, both the charger and the USBIN driver use the same irq? :/ > > > > > > > AFAIU the usbin extcon driver pretty much just tracks the state > > of the IRQ to report extcon. It happens to assume the same part > > of the pmic though, yes, which also means there will be no user > > that would enable both charger and vbus extcon, since charger > > driver provides this functionality as well. > So, should USBIN be removed from PM8916 dt since it's essentially > a part of the charger block? > The "USB_IN" pad of the PM8916 seems to be connected on pretty much all devices, even if they are using external chargers and the charging functionality of PM8916 is completely disabled. For those devices, the &pm8916_usbin device provides a convenient way to detect the USB state, even without a working charger driver. While we could modify the PM8916 charger driver and DT node to have some special mode where charging and battery monitoring is completely disabled and only the USBIN extcon is provided, I'm not sure if that would provide a significant advantage compared to just keeping the simple &pm8916_usbin node with the existing driver. Thanks, Stephan
On 10/26/23 21:17, Stephan Gerhold wrote: > On Thu, Oct 26, 2023 at 08:54:00PM +0200, Konrad Dybcio wrote: >> On 10/24/23 11:29, Nikita Travkin wrote: >>> Konrad Dybcio писал(а) 24.10.2023 13:34: >>>> On 10/23/23 08:20, Nikita Travkin wrote: >>>>> pm8916 contains some hardware blocks for battery powered devices: >>>>> >>>>> - VM-BMS: Battery voltage monitoring block. >>>>> - LBC: Linear battery charger. >>>>> >>>>> Add them to the pmic dtsi so the devices that make use of those blocks >>>>> can enable them. >>>>> >>>>> Signed-off-by: Nikita Travkin <nikita@trvn.ru> >>>>> --- >>>>> arch/arm64/boot/dts/qcom/pm8916.dtsi | 48 ++++++++++++++++++++++++++++++++++++ >>>>> 1 file changed, 48 insertions(+) >>>>> >>>>> diff --git a/arch/arm64/boot/dts/qcom/pm8916.dtsi b/arch/arm64/boot/dts/qcom/pm8916.dtsi >>>>> index f4de86787743..4b2e8fb47d2d 100644 >>>>> --- a/arch/arm64/boot/dts/qcom/pm8916.dtsi >>>>> +++ b/arch/arm64/boot/dts/qcom/pm8916.dtsi >>>>> @@ -41,6 +41,35 @@ watchdog { >>>>> }; >>>>> }; >>>>> + pm8916_charger: charger@1000 { >>>>> + compatible = "qcom,pm8916-lbc"; >>>>> + reg = <0x1000>, <0x1200>, <0x1300>, <0x1600>; >>>>> + reg-names = "chgr", "bat_if", "usb", "misc"; >>>>> + >>>>> + interrupts = <0x0 0x10 0 IRQ_TYPE_EDGE_BOTH>, >>>>> + <0x0 0x10 5 IRQ_TYPE_EDGE_BOTH>, >>>>> + <0x0 0x10 6 IRQ_TYPE_EDGE_BOTH>, >>>>> + <0x0 0x10 7 IRQ_TYPE_EDGE_BOTH>, >>>>> + <0x0 0x12 0 IRQ_TYPE_EDGE_BOTH>, >>>>> + <0x0 0x12 1 IRQ_TYPE_EDGE_BOTH>, >>>>> + <0x0 0x13 0 IRQ_TYPE_EDGE_BOTH>, >>>>> + <0x0 0x13 1 IRQ_TYPE_EDGE_BOTH>, >>>>> + <0x0 0x13 2 IRQ_TYPE_EDGE_BOTH>, >>>>> + <0x0 0x13 4 IRQ_TYPE_EDGE_BOTH>; >>>>> + interrupt-names = "vbat_det", >>>>> + "fast_chg", >>>>> + "chg_fail", >>>>> + "chg_done", >>>>> + "bat_pres", >>>>> + "temp_ok", >>>>> + "coarse_det", >>>>> + "usb_vbus", >>>> So, both the charger and the USBIN driver use the same irq? :/ >>>> >>> >>> AFAIU the usbin extcon driver pretty much just tracks the state >>> of the IRQ to report extcon. It happens to assume the same part >>> of the pmic though, yes, which also means there will be no user >>> that would enable both charger and vbus extcon, since charger >>> driver provides this functionality as well. >> So, should USBIN be removed from PM8916 dt since it's essentially >> a part of the charger block? >> > > The "USB_IN" pad of the PM8916 seems to be connected on pretty much all > devices, even if they are using external chargers and the charging > functionality of PM8916 is completely disabled. For those devices, the > &pm8916_usbin device provides a convenient way to detect the USB state, > even without a working charger driver. > > While we could modify the PM8916 charger driver and DT node to have some > special mode where charging and battery monitoring is completely > disabled and only the USBIN extcon is provided, I'm not sure if that > would provide a significant advantage compared to just keeping the > simple &pm8916_usbin node with the existing driver. Hmm okay I see.. Generally it's rather "no bueno" to have two DT nodes consuming the same register space.. What happens when you enable BMS on a device with a non-PM8916 charger? Does it correctly recognize "no battery" etc.? Konrad
Konrad Dybcio писал(а) 27.10.2023 01:03: > On 10/26/23 21:17, Stephan Gerhold wrote: >> On Thu, Oct 26, 2023 at 08:54:00PM +0200, Konrad Dybcio wrote: >>> On 10/24/23 11:29, Nikita Travkin wrote: >>>> Konrad Dybcio писал(а) 24.10.2023 13:34: >>>>> On 10/23/23 08:20, Nikita Travkin wrote: >>>>>> pm8916 contains some hardware blocks for battery powered devices: >>>>>> >>>>>> - VM-BMS: Battery voltage monitoring block. >>>>>> - LBC: Linear battery charger. >>>>>> >>>>>> Add them to the pmic dtsi so the devices that make use of those blocks >>>>>> can enable them. >>>>>> >>>>>> Signed-off-by: Nikita Travkin <nikita@trvn.ru> >>>>>> --- >>>>>> arch/arm64/boot/dts/qcom/pm8916.dtsi | 48 ++++++++++++++++++++++++++++++++++++ >>>>>> 1 file changed, 48 insertions(+) >>>>>> >>>>>> diff --git a/arch/arm64/boot/dts/qcom/pm8916.dtsi b/arch/arm64/boot/dts/qcom/pm8916.dtsi >>>>>> index f4de86787743..4b2e8fb47d2d 100644 >>>>>> --- a/arch/arm64/boot/dts/qcom/pm8916.dtsi >>>>>> +++ b/arch/arm64/boot/dts/qcom/pm8916.dtsi >>>>>> @@ -41,6 +41,35 @@ watchdog { >>>>>> }; >>>>>> }; >>>>>> + pm8916_charger: charger@1000 { >>>>>> + compatible = "qcom,pm8916-lbc"; >>>>>> + reg = <0x1000>, <0x1200>, <0x1300>, <0x1600>; >>>>>> + reg-names = "chgr", "bat_if", "usb", "misc"; >>>>>> + >>>>>> + interrupts = <0x0 0x10 0 IRQ_TYPE_EDGE_BOTH>, >>>>>> + <0x0 0x10 5 IRQ_TYPE_EDGE_BOTH>, >>>>>> + <0x0 0x10 6 IRQ_TYPE_EDGE_BOTH>, >>>>>> + <0x0 0x10 7 IRQ_TYPE_EDGE_BOTH>, >>>>>> + <0x0 0x12 0 IRQ_TYPE_EDGE_BOTH>, >>>>>> + <0x0 0x12 1 IRQ_TYPE_EDGE_BOTH>, >>>>>> + <0x0 0x13 0 IRQ_TYPE_EDGE_BOTH>, >>>>>> + <0x0 0x13 1 IRQ_TYPE_EDGE_BOTH>, >>>>>> + <0x0 0x13 2 IRQ_TYPE_EDGE_BOTH>, >>>>>> + <0x0 0x13 4 IRQ_TYPE_EDGE_BOTH>; >>>>>> + interrupt-names = "vbat_det", >>>>>> + "fast_chg", >>>>>> + "chg_fail", >>>>>> + "chg_done", >>>>>> + "bat_pres", >>>>>> + "temp_ok", >>>>>> + "coarse_det", >>>>>> + "usb_vbus", >>>>> So, both the charger and the USBIN driver use the same irq? :/ >>>>> >>>> >>>> AFAIU the usbin extcon driver pretty much just tracks the state >>>> of the IRQ to report extcon. It happens to assume the same part >>>> of the pmic though, yes, which also means there will be no user >>>> that would enable both charger and vbus extcon, since charger >>>> driver provides this functionality as well. >>> So, should USBIN be removed from PM8916 dt since it's essentially >>> a part of the charger block? >>> >> >> The "USB_IN" pad of the PM8916 seems to be connected on pretty much all >> devices, even if they are using external chargers and the charging >> functionality of PM8916 is completely disabled. For those devices, the >> &pm8916_usbin device provides a convenient way to detect the USB state, >> even without a working charger driver. >> >> While we could modify the PM8916 charger driver and DT node to have some >> special mode where charging and battery monitoring is completely >> disabled and only the USBIN extcon is provided, I'm not sure if that >> would provide a significant advantage compared to just keeping the >> simple &pm8916_usbin node with the existing driver. > Hmm okay I see.. > > Generally it's rather "no bueno" to have two DT nodes consuming the > same register space.. What happens when you enable BMS on a device > with a non-PM8916 charger? Does it correctly recognize "no battery" > etc.? > The _charger and _bms are separate and communicate in a generic manner via power-supplies and supply core (see 3/3) so giving a different charger to _bms can work. If an external charger is present in the device, qcom mandates "external charger" optional line of the pmic to be tied, and _charger is then disabled. The driver bails out in this case, but _usbin could still be used. > Konrad
On 27.10.2023 07:44, Nikita Travkin wrote: > Konrad Dybcio писал(а) 27.10.2023 01:03: >> On 10/26/23 21:17, Stephan Gerhold wrote: >>> On Thu, Oct 26, 2023 at 08:54:00PM +0200, Konrad Dybcio wrote: >>>> On 10/24/23 11:29, Nikita Travkin wrote: >>>>> Konrad Dybcio писал(а) 24.10.2023 13:34: >>>>>> On 10/23/23 08:20, Nikita Travkin wrote: >>>>>>> pm8916 contains some hardware blocks for battery powered devices: >>>>>>> >>>>>>> - VM-BMS: Battery voltage monitoring block. >>>>>>> - LBC: Linear battery charger. >>>>>>> >>>>>>> Add them to the pmic dtsi so the devices that make use of those blocks >>>>>>> can enable them. >>>>>>> >>>>>>> Signed-off-by: Nikita Travkin <nikita@trvn.ru> >>>>>>> --- >>>>>>> arch/arm64/boot/dts/qcom/pm8916.dtsi | 48 ++++++++++++++++++++++++++++++++++++ >>>>>>> 1 file changed, 48 insertions(+) >>>>>>> >>>>>>> diff --git a/arch/arm64/boot/dts/qcom/pm8916.dtsi b/arch/arm64/boot/dts/qcom/pm8916.dtsi >>>>>>> index f4de86787743..4b2e8fb47d2d 100644 >>>>>>> --- a/arch/arm64/boot/dts/qcom/pm8916.dtsi >>>>>>> +++ b/arch/arm64/boot/dts/qcom/pm8916.dtsi >>>>>>> @@ -41,6 +41,35 @@ watchdog { >>>>>>> }; >>>>>>> }; >>>>>>> + pm8916_charger: charger@1000 { >>>>>>> + compatible = "qcom,pm8916-lbc"; >>>>>>> + reg = <0x1000>, <0x1200>, <0x1300>, <0x1600>; >>>>>>> + reg-names = "chgr", "bat_if", "usb", "misc"; >>>>>>> + >>>>>>> + interrupts = <0x0 0x10 0 IRQ_TYPE_EDGE_BOTH>, >>>>>>> + <0x0 0x10 5 IRQ_TYPE_EDGE_BOTH>, >>>>>>> + <0x0 0x10 6 IRQ_TYPE_EDGE_BOTH>, >>>>>>> + <0x0 0x10 7 IRQ_TYPE_EDGE_BOTH>, >>>>>>> + <0x0 0x12 0 IRQ_TYPE_EDGE_BOTH>, >>>>>>> + <0x0 0x12 1 IRQ_TYPE_EDGE_BOTH>, >>>>>>> + <0x0 0x13 0 IRQ_TYPE_EDGE_BOTH>, >>>>>>> + <0x0 0x13 1 IRQ_TYPE_EDGE_BOTH>, >>>>>>> + <0x0 0x13 2 IRQ_TYPE_EDGE_BOTH>, >>>>>>> + <0x0 0x13 4 IRQ_TYPE_EDGE_BOTH>; >>>>>>> + interrupt-names = "vbat_det", >>>>>>> + "fast_chg", >>>>>>> + "chg_fail", >>>>>>> + "chg_done", >>>>>>> + "bat_pres", >>>>>>> + "temp_ok", >>>>>>> + "coarse_det", >>>>>>> + "usb_vbus", >>>>>> So, both the charger and the USBIN driver use the same irq? :/ >>>>>> >>>>> >>>>> AFAIU the usbin extcon driver pretty much just tracks the state >>>>> of the IRQ to report extcon. It happens to assume the same part >>>>> of the pmic though, yes, which also means there will be no user >>>>> that would enable both charger and vbus extcon, since charger >>>>> driver provides this functionality as well. >>>> So, should USBIN be removed from PM8916 dt since it's essentially >>>> a part of the charger block? >>>> >>> >>> The "USB_IN" pad of the PM8916 seems to be connected on pretty much all >>> devices, even if they are using external chargers and the charging >>> functionality of PM8916 is completely disabled. For those devices, the >>> &pm8916_usbin device provides a convenient way to detect the USB state, >>> even without a working charger driver. >>> >>> While we could modify the PM8916 charger driver and DT node to have some >>> special mode where charging and battery monitoring is completely >>> disabled and only the USBIN extcon is provided, I'm not sure if that >>> would provide a significant advantage compared to just keeping the >>> simple &pm8916_usbin node with the existing driver. >> Hmm okay I see.. >> >> Generally it's rather "no bueno" to have two DT nodes consuming the >> same register space.. What happens when you enable BMS on a device >> with a non-PM8916 charger? Does it correctly recognize "no battery" >> etc.? >> > > The _charger and _bms are separate and communicate in a generic > manner via power-supplies and supply core (see 3/3) so giving > a different charger to _bms can work. > > If an external charger is present in the device, qcom mandates > "external charger" optional line of the pmic to be tied, and > _charger is then disabled. The driver bails out in this case, > but _usbin could still be used. Meh.. I guess I'll reluctantly let it slide, unless Bjorn has some objections Konrad
diff --git a/arch/arm64/boot/dts/qcom/pm8916.dtsi b/arch/arm64/boot/dts/qcom/pm8916.dtsi index f4de86787743..4b2e8fb47d2d 100644 --- a/arch/arm64/boot/dts/qcom/pm8916.dtsi +++ b/arch/arm64/boot/dts/qcom/pm8916.dtsi @@ -41,6 +41,35 @@ watchdog { }; }; + pm8916_charger: charger@1000 { + compatible = "qcom,pm8916-lbc"; + reg = <0x1000>, <0x1200>, <0x1300>, <0x1600>; + reg-names = "chgr", "bat_if", "usb", "misc"; + + interrupts = <0x0 0x10 0 IRQ_TYPE_EDGE_BOTH>, + <0x0 0x10 5 IRQ_TYPE_EDGE_BOTH>, + <0x0 0x10 6 IRQ_TYPE_EDGE_BOTH>, + <0x0 0x10 7 IRQ_TYPE_EDGE_BOTH>, + <0x0 0x12 0 IRQ_TYPE_EDGE_BOTH>, + <0x0 0x12 1 IRQ_TYPE_EDGE_BOTH>, + <0x0 0x13 0 IRQ_TYPE_EDGE_BOTH>, + <0x0 0x13 1 IRQ_TYPE_EDGE_BOTH>, + <0x0 0x13 2 IRQ_TYPE_EDGE_BOTH>, + <0x0 0x13 4 IRQ_TYPE_EDGE_BOTH>; + interrupt-names = "vbat_det", + "fast_chg", + "chg_fail", + "chg_done", + "bat_pres", + "temp_ok", + "coarse_det", + "usb_vbus", + "chg_gone", + "overtemp"; + + status = "disabled"; + }; + pm8916_usbin: usb-detect@1300 { compatible = "qcom,pm8941-misc"; reg = <0x1300>; @@ -91,6 +120,25 @@ channel@f { }; }; + pm8916_bms: battery@4000 { + compatible = "qcom,pm8916-bms-vm"; + reg = <0x4000>; + interrupts = <0x0 0x40 0 IRQ_TYPE_EDGE_RISING>, + <0x0 0x40 1 IRQ_TYPE_EDGE_RISING>, + <0x0 0x40 2 IRQ_TYPE_EDGE_RISING>, + <0x0 0x40 3 IRQ_TYPE_EDGE_RISING>, + <0x0 0x40 4 IRQ_TYPE_EDGE_RISING>, + <0x0 0x40 5 IRQ_TYPE_EDGE_RISING>; + interrupt-names = "cv_leave", + "cv_enter", + "ocv_good", + "ocv_thr", + "fifo", + "state_chg"; + + status = "disabled"; + }; + rtc@6000 { compatible = "qcom,pm8941-rtc"; reg = <0x6000>, <0x6100>;