Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp695825rdh; Thu, 26 Oct 2023 13:04:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFQmZmg4YkRtK3tdMvA5yocLAz+6T+U6ePYpmtH7k/avuqW/fWAuVE3aggR3pa+p4xIqESv X-Received: by 2002:ac8:598d:0:b0:417:cdc5:847a with SMTP id e13-20020ac8598d000000b00417cdc5847amr768005qte.39.1698350645126; Thu, 26 Oct 2023 13:04:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698350645; cv=none; d=google.com; s=arc-20160816; b=qdlUfMOOhYjJbYfXcL4FtIVCbc2tDc8JkKwqhNZPxDcrUdn8udcek2ItPsz+ycbK87 l0HoV9yppYlW0eUlcy4QojZ5SjJsR1b3RJJ2qu1JX898AcFCnjYUSEx7S6m25E4mx+h9 7kqBnn8wVjjdp9XPSvwOGCCmFBfZwziH8in95vt61EfRIjYvDURCXq+NNU7B+OFcpdPU I5Joh75A83u/sWfPwx906/kBRkRc+sQcPYUHPves6bnCt1PhE8X3xN6gkEND4itrzHLH 98YwjFYFW+WETaD4xtDUNLjVFRd6srY6oeGafvpLFGTvLODrm3ZeQxBe9URN/RGwyjYJ RCEg== 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:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=lyw5MHyHHlTKy6ei3+OUwIzekh8WpQwnC4wd1zyLdCI=; fh=8nrwz7kfB2JKrP3YYesPzrJ6/p7MvwRFpggX/xQzgOk=; b=XX9vDBNltCYksedEAvXQtV6/9NFJAgyTOLDZpehirVXAHh7C2Qxf5cwBWtT/GBUORz XB7qzzZFN9onFqBBwuKqWRXQcKcwhPHs36fvjaR7d7CvOBW5YPUh0pFmIKb/Hvvfx++O Icr/kUBykrbCWK9t5XvIJj4PUAc3KSihxDXVLk6GGIF2/vDSNPzOicMUaC8MWdzpecdv rMxYnIjgB/AUjAj/EOsAYb1PHEjfkMJONby4X4VFsIzhxdnJwkNeu86aqtZ84AXUP8cA VqkJbTxo9De5bkyohVRQloHau+7v8O581RDMchcnQGNkK4eGOuGOmND9xAD29W10Jwjm TZNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Kwq27T8W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id g15-20020ac87f4f000000b0041979165e21si55764qtk.69.2023.10.26.13.04.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 13:04:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Kwq27T8W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (Postfix) with ESMTP id 0334982DAFF1; Thu, 26 Oct 2023 13:04:02 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233234AbjJZUDw (ORCPT + 99 others); Thu, 26 Oct 2023 16:03:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231975AbjJZUDu (ORCPT ); Thu, 26 Oct 2023 16:03:50 -0400 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21E4A1B2 for ; Thu, 26 Oct 2023 13:03:47 -0700 (PDT) Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-507cd62472dso2825279e87.0 for ; Thu, 26 Oct 2023 13:03:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698350625; x=1698955425; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=lyw5MHyHHlTKy6ei3+OUwIzekh8WpQwnC4wd1zyLdCI=; b=Kwq27T8W1W+OaGoa62mYUgXjXnqd7/+7axB0JlvlYqRvWfk6wLVzW/x8ZWEXJK4Ssw B65FNDJ++zlzxUbz3+LhsWTTv70/+EuDZD7WWpnKwCNGri6QofI2NUVQsAHIfxEq2AhV vJPcZ0EXCeDL4NMEIGz6IAxc2k0/LkqN0sCQ+AAoaEvCRc1+peYhCbI/tDhiUyEhLGWs 0DzqD41GM18Tt7vlYa+aZjElzGWJKAARFHvN84kG4g/Amp4EMzAOM7HA4jXb1hp8Ova7 KABNwyFTmrtaqRyVEf8AY5eHHxtrL+1JcpUD2Keo/wtUOsZtjb1qbSnCty8axApcU7vC 7aiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698350625; x=1698955425; h=content-transfer-encoding:in-reply-to: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=lyw5MHyHHlTKy6ei3+OUwIzekh8WpQwnC4wd1zyLdCI=; b=O3lttN2DgezgSZRl0kJ9CvqFrDgCSCzf/WWd7R71kGhVmvSaXBUpjOTzo+WZ7DJzDB uOEcVLA0odm5PITOEIUWRAFyr7upAie6oZMLed76A7bvbrow+lwOk/Og7STWrpDPO/od fJCm4tvV4oI0nMDDyoq2iGwOY7/qVq2U44QnZtx1MtjsUmxS4XVgY2vyLSBmQfvbIWWc UOMhDPbdOrugG42PN24XelE1iEgXEngZEPSuHvbRqvUSWyngN+96HqY+3yY4Uf1tQ5e3 BMi4wV9whegbV4ZsPREUBz0Fx037cDIkwXUh+DiQQRuu1GByC3FR85aVxa5mmNdK0psi giLw== X-Gm-Message-State: AOJu0Yw7qdl376mVsipcpE6++4SpqlFjqURrnWLa6T/XvjXuk99hy+EC gNvwO27WjeAEJ+x+jdpl/kuBSQ== X-Received: by 2002:a05:6512:ad5:b0:4ff:839b:5355 with SMTP id n21-20020a0565120ad500b004ff839b5355mr1236216lfu.18.1698350625274; Thu, 26 Oct 2023 13:03:45 -0700 (PDT) Received: from [172.30.205.86] (UNUSED.212-182-62-129.lubman.net.pl. [212.182.62.129]) by smtp.gmail.com with ESMTPSA id s16-20020a056512203000b00500d1a72734sm3118696lfs.130.2023.10.26.13.03.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 26 Oct 2023 13:03:44 -0700 (PDT) Message-ID: Date: Thu, 26 Oct 2023 22:03:43 +0200 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: Stephan Gerhold Cc: Nikita Travkin , 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 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 In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed 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 fry.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 (fry.vger.email [0.0.0.0]); Thu, 26 Oct 2023 13:04:02 -0700 (PDT) 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.? Konrad