Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp932282rdh; Thu, 26 Oct 2023 22:46:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGW5QU/pzSIvik+FCtDvjbbwjblWkOywhdhqNGWhuqTHpjk4wnKVPCuYppbBhIt+ZkBF695 X-Received: by 2002:a05:620a:2a03:b0:774:389f:8358 with SMTP id o3-20020a05620a2a0300b00774389f8358mr1805891qkp.52.1698385608458; Thu, 26 Oct 2023 22:46:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698385608; cv=none; d=google.com; s=arc-20160816; b=RlN5UW6jGq9XiyeE73FGeFDhDdCZUWCjBPxETOmb4JcHr+f0Y0yc6oDkYVN8HSeu0L j2GBU3zQYORHHUbuTFZcKnBzyQx1/PwClYfSIIlK9uw5E5JskZfva18uHc00AgZTKXDq H/RlYrMr6wi0iAyG6PgZe/xHEgyCTLSE73MvGluH6Fe9stQ+86tzjdxcXeIjcwnuD50v u0PzLEMV9btyBUscf5saCTg/O/G8VhzTqrZ9Bn8Q9+J/7xdEaaV9SczxhMWSDgmyy/78 MWAva6mpBLhSwJqoqnEEqlvnA3EUctiNOOIyYEGTR+aoDXcLIpdM+rGRib1BtXl6hwtD Z/dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:message-id:references :in-reply-to:subject:cc:to:from:date:mime-version:dkim-signature; bh=GpwMDG2B0z9rMk4yMOjArATfkLsqg3x/Zmscq7y4EqM=; fh=wrjA2T28NuM9SUph3YhzmxRJtAcaY8rTZBYPBc70NOg=; b=SfykihgrzkXYm4VBH9mLi3t90qE9rsv7hKhPCzJkM+dEAGXVI8Ax3UJU1rhbCenVjq vFL3ga+awxBVSXGCnxoNtDfXM/laKPaLcVGptj4C9rs4tJen9H0YnbRkAfUAIPTLT1SC z2amhgM5XTb3x9Du3JyMS95G3muc+HbQqodxOabbRIBVUdp8N3M91kux8K0U1ltFifSL Nu3OaHBYv0f7i9XSfjgl0QZNzWcnZlqi7p4uzy3+iTma+FmqqCD2IiW6mtPbw6HRzPhU qDDrXLuRefbxiAF6rURCrAeDngTsgH+5dy2De/KCRgh/M+lohmJifoaj+LvFgKtHLzsi iI0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@trvn.ru header.s=mail header.b="B/6zyogF"; 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 Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id e16-20020a25d310000000b00d9c7221acfasi1627920ybf.325.2023.10.26.22.46.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 22:46:48 -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="B/6zyogF"; 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 970388078CA1; Thu, 26 Oct 2023 22:45:11 -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 S1345167AbjJ0For (ORCPT + 99 others); Fri, 27 Oct 2023 01:44:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231295AbjJ0Foq (ORCPT ); Fri, 27 Oct 2023 01:44:46 -0400 Received: from box.trvn.ru (box.trvn.ru [194.87.146.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 312761B2; Thu, 26 Oct 2023 22:44:42 -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 6873440474; Fri, 27 Oct 2023 10:44:37 +0500 (+05) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=trvn.ru; s=mail; t=1698385477; bh=Rpor7KoZoeEC/K2ptmWwufpCeaKiSvUOZItVny41+Ac=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=B/6zyogFsrhzuWczOZs3MmESEPTb3PCgT2sWxAfoqTSJJyxp4HXnxto3oFHi/jpf8 iPzibrD8x4P1pUnYFPGSz+0VVXUSMi7GB5siNPwOqxRxasoLxURIOOh26Wu1qLXpo2 S3VLEQJ+NlEjmRsgxcm18Q3llP109inVS7Ce+jYUMbMEloG/wFpQSmL7PqSt9chYMQ oC347ahewIswR+aQXn1j/AMdFk0vlTdFHbPJ8tsbLCDJHyi2WP2oyavbrpTEURv8Qb yEY0NzJQPSmpQ5+qRoXZjRb5NldEiBCc0Vep7lACcqPQM6xPh1Kz48W42TRdYL+uTX jhCVrtzcOzQdA== MIME-Version: 1.0 Date: Fri, 27 Oct 2023 10:44:34 +0500 From: Nikita Travkin To: Konrad Dybcio Cc: Stephan Gerhold , Andy Gross , Bjorn Andersson , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Lee Jones , Stephen Boyd , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht Subject: Re: [PATCH v2 2/3] arm64: dts: qcom: pm8916: Add BMS and charger In-Reply-To: References: <20231023-pm8916-dtsi-bms-lbc-v2-0-343e3dbf423e@trvn.ru> <20231023-pm8916-dtsi-bms-lbc-v2-2-343e3dbf423e@trvn.ru> <3dff444b-c439-4c40-9d21-1e390f449840@linaro.org> Message-ID: X-Sender: nikita@trvn.ru Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: 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]); Thu, 26 Oct 2023 22:45:11 -0700 (PDT) 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 >>>>>> --- >>>>>> 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