Received: by 2002:a05:7412:f589:b0:e2:908c:2ebd with SMTP id eh9csp167668rdb; Tue, 31 Oct 2023 04:20:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFaZxyAy1MU+cJaH9pQBNPpzspnpZmQCec/yuc8M4Om25cnHHBd2/yoNoJP6yo1bMQvJWvb X-Received: by 2002:a17:90b:1d03:b0:280:6cde:ecc2 with SMTP id on3-20020a17090b1d0300b002806cdeecc2mr3009823pjb.11.1698751257620; Tue, 31 Oct 2023 04:20:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698751257; cv=none; d=google.com; s=arc-20160816; b=vJ5WRiFXc7K/9sw1DYc0Dsaw2z0AsD4AqCRlq/V5eesBy3bSQEnVCR+wyxwPoyvgJc 5GUfLYwQj5JIGa7IIJD2Chs5fe7d0KyQ05jLZAWEMjrvQZCm1nZwVf1RooXnW6rDnZEU FMGgluv3L48HGYkCoGootH+k5QnqgaYdAZVkoBA5ni70gkGPQJA1QAAAu2wVFgQsswyf FM5ho9TbEMF2e+VU/B0fcqxFc0qhhxGtGLpmxy0iDf2PKFoW0HbpuHbMmaTBtmnLP2Gx 4Nlx/XSy6bncYHaeuWOlvnPK2cDCctedBrb2ck/m+2NpCaFvIRoIbf+0KSgjLadKt0id 7KZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:autocrypt :from:references:cc:to:content-language:subject:user-agent :mime-version:date:message-id:dkim-signature; bh=WaFOI0Gw6kDi9dU7QWDZ1HYnSrWAUkD+UDU2f1uDB0E=; fh=FAOgHUm8T3EQGxm3oUYN1/Q+NhjtB7jEi09/97IRS9w=; b=L0GwfrDuWEUKSKyOPlS4ZA/wJJqlGo5NLOGe2taWIn9dOkfWVq3boXjzBbO2oGxsVH JOESPieRfiaby9sTmpKdw0Fa40Yuok3+pMa9k5VVIHOJxh8IXspDKSZ1a+wcfqeGvFx1 9V2s/6EyIvfIMZIjOP+k5i/ErGgcL299gU862DgriEKQX888p/fXJZn5sPZ0u37hur56 Zouqwrr/bb3kL9a2m1KdxUoUQYXIZUnPt2dT1/9c4YB0wkzV6q1qWvgbKRpAqNpB+DwW 8U8kZkWx8u9Vv6FccrllMwhrinF3UY+SVRSNgv2oV8zV+SpNrJf+xU2bx3Oq1F7IOj1I VAYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Y9a7Ye6m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id v23-20020a17090ac91700b0027cf3fd376bsi827334pjt.28.2023.10.31.04.20.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 04:20:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Y9a7Ye6m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 8C5DA8070334; Tue, 31 Oct 2023 04:20:41 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235275AbjJaLUf (ORCPT + 99 others); Tue, 31 Oct 2023 07:20:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235240AbjJaLUb (ORCPT ); Tue, 31 Oct 2023 07:20:31 -0400 Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51819C1 for ; Tue, 31 Oct 2023 04:20:27 -0700 (PDT) Received: by mail-lj1-x232.google.com with SMTP id 38308e7fff4ca-2c6cb4a79deso16936071fa.1 for ; Tue, 31 Oct 2023 04:20:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698751225; x=1699356025; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=WaFOI0Gw6kDi9dU7QWDZ1HYnSrWAUkD+UDU2f1uDB0E=; b=Y9a7Ye6msWgIo/z4H7T0EYmnsttdZJSI5W/ykYdyGIqUPAFCJsv8whQAWyTyLWryBj wLyOfY1pvgwxu/9IIYXv7SqI+M7C9wPUFb1PqzMAfda3MdIP7nZkCp5lYMKilq/ttjmn FE+E7l+m9TKynMGvCV/DThlfwgSHIiE27YNK2xCgJIvUgcimBp21u3zvyExZb6zu4eBe 9pRdPjYZGw9vbBGykoPTr7hnlDaA5iJyRyhTv8FAc94VBY98DGBTghYviRmQyfSIZtZ0 mUhXbTDglkNxy7FGATBFe3dCnbxoI5kxN4rBUxXIyTv72s9B7FxUfjPK/eNFSpAKDcZb 7XBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698751225; x=1699356025; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=WaFOI0Gw6kDi9dU7QWDZ1HYnSrWAUkD+UDU2f1uDB0E=; b=lvY1k3ey+TskEG7abiKZfmXSaq7lrpTf5Ci4pXfpZQLMzzQASFo1BThCewIUD94zRV 29NynhPY6o1YLz2xqicoFd7T16ttwUqIPtq9Kcjzr+hSv6sjedzj7smeNjywItqrXRxq t1C3n25SskWlP3IH27eH+kJ7cEbB5JeVhiNTbdAJ2cefi2FIe3FGAdqW1hwarSW+svHg Cl3J75XFbx7oOE2zi5FtA+nw/2oXK90XGr1ciyiizIq/t1ZCAes/RNxz4H4OokmCsgKm gpePjpaI3w+wEChSOl8BjXmEkmRr/Dks4ir4Btao7dbawbkmTa2slWpk3h5MrA+ZVl23 Jfpg== X-Gm-Message-State: AOJu0Yxcew7KBTnneK8fZ6CAQER92xj66MVf3SjJZW4I3ad9/OqqilQM YYwjk1TPxL6PbiOmWbQKRgWuuQ== X-Received: by 2002:a05:651c:2211:b0:2c4:fe28:7b45 with SMTP id y17-20020a05651c221100b002c4fe287b45mr1114252ljq.8.1698751225431; Tue, 31 Oct 2023 04:20:25 -0700 (PDT) Received: from [192.168.143.96] (178235177091.dynamic-4-waw-k-1-1-0.vectranet.pl. [178.235.177.91]) by smtp.gmail.com with ESMTPSA id a11-20020a2eb54b000000b002c128e4524dsm166291ljn.116.2023.10.31.04.20.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 31 Oct 2023 04:20:25 -0700 (PDT) Message-ID: Date: Tue, 31 Oct 2023 12:20:23 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 2/3] arm64: dts: qcom: pm8916: Add BMS and charger Content-Language: en-US To: Nikita Travkin , Bjorn Andersson Cc: Stephan Gerhold , Andy Gross , 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 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> From: Konrad Dybcio Autocrypt: addr=konrad.dybcio@linaro.org; keydata= xsFNBF9ALYUBEADWAhxdTBWrwAgDQQzc1O/bJ5O7b6cXYxwbBd9xKP7MICh5YA0DcCjJSOum BB/OmIWU6X+LZW6P88ZmHe+KeyABLMP5s1tJNK1j4ntT7mECcWZDzafPWF4F6m4WJOG27kTJ HGWdmtO+RvadOVi6CoUDqALsmfS3MUG5Pj2Ne9+0jRg4hEnB92AyF9rW2G3qisFcwPgvatt7 TXD5E38mLyOPOUyXNj9XpDbt1hNwKQfiidmPh5e7VNAWRnW1iCMMoKqzM1Anzq7e5Afyeifz zRcQPLaqrPjnKqZGL2BKQSZDh6NkI5ZLRhhHQf61fkWcUpTp1oDC6jWVfT7hwRVIQLrrNj9G MpPzrlN4YuAqKeIer1FMt8cq64ifgTzxHzXsMcUdclzq2LTk2RXaPl6Jg/IXWqUClJHbamSk t1bfif3SnmhA6TiNvEpDKPiT3IDs42THU6ygslrBxyROQPWLI9IL1y8S6RtEh8H+NZQWZNzm UQ3imZirlPjxZtvz1BtnnBWS06e7x/UEAguj7VHCuymVgpl2Za17d1jj81YN5Rp5L9GXxkV1 aUEwONM3eCI3qcYm5JNc5X+JthZOWsbIPSC1Rhxz3JmWIwP1udr5E3oNRe9u2LIEq+wH/toH kpPDhTeMkvt4KfE5m5ercid9+ZXAqoaYLUL4HCEw+HW0DXcKDwARAQABzShLb25yYWQgRHli Y2lvIDxrb25yYWQuZHliY2lvQGxpbmFyby5vcmc+wsGOBBMBCAA4FiEEU24if9oCL2zdAAQV R4cBcg5dfFgFAmQ5bqwCGwMFCwkIBwIGFQoJCAsCBBYCAwECHgECF4AACgkQR4cBcg5dfFjO BQ//YQV6fkbqQCceYebGg6TiisWCy8LG77zV7DB0VMIWJv7Km7Sz0QQrHQVzhEr3trNenZrf yy+o2tQOF2bi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SxpzLc/0sT1eRJDEhI4XIQM4ClIzpsCIN5HnVF76UQXh3a9zpwh3dk8i bhN/URmCOTH+LHNJYN/MxY8wuukq877DWB7k86pBs5IDLAXmW8v3gIDWyIcgYqb2v8QO2Mqx YMqL7UZxVLul4/JbllsQB8F/fNI8AfttmAQL9cwo6C8yDTXKdho920W4WUR9k8NT/OBqWSyk bGqMHex48FVZhexNPYOd58EY9/7mL5u0sJmo+jTeb4JBgIbFPJCFyng4HwbniWgQJZ1WqaUC nas9J77uICis2WH7N8Bs9jy0wQYezNzqS+FxoNXmDQg2jetX8en4bO2Di7Pmx0jXA4TOb9TM izWDgYvmBE8= In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.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 (lipwig.vger.email [0.0.0.0]); Tue, 31 Oct 2023 04:20:41 -0700 (PDT) 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 >>>>>>> --- >>>>>>> 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