Message ID | 20230728-pm8916-bms-lbc-v1-1-56da32467487@trvn.ru |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp616430vqg; Fri, 28 Jul 2023 11:24:56 -0700 (PDT) X-Google-Smtp-Source: APBJJlEJ5Dmca4TB/f5NhjlPFxWCFZLek9nLYYSayh6VMXF4DjjFhMuNHou3yYVzLC6b5BqTgLRR X-Received: by 2002:a05:6a20:9146:b0:12f:90d8:9755 with SMTP id x6-20020a056a20914600b0012f90d89755mr2494637pzc.15.1690568696123; Fri, 28 Jul 2023 11:24:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690568696; cv=none; d=google.com; s=arc-20160816; b=t2+T0ZiD4DbVXjsJLdNtkFTumH61kpZpR8FbCZmiIvF3k/7bgNcu2soDJxq7vRtQr0 0q3gLy0ScrMBE68qgyzBbQUbCEMQ4D4K9/KvCHrQ00QuOqipLyFbi8kWPFKv2CXSxYWX fviXLeyqF4XwF+yyQzLLbtIol78gw6yoQrf6a96RxuAt4EXn8QU8yDD0xuuNnT+vOw0x Wj1nKyVUQnz20SOK1ZKBJWlDBnWl5V3S/PjqPk+7zEdwog0kxvfLMJQkyqTxVbfnhPe4 EMWruRoVw/MX/fRwYm4w886d+7jnt5hNkNicPmY0eGg58TcrVn6YWYpO0QzKOxjXeSBR sz+w== 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=SPr5+y18OZlmVnfsMYNRs+5gR9cayLp5HK1mnsiU9pk=; fh=DWfKZrqDT5uR0d7BPg516BB12nZg8AlVJgKxCaTggqo=; b=QQ+IqsWblOMhYEZsPeWNswipIqk965qAez/y9KJUs5u/j08Fj5UrTGg0kTsQzvfxBt UXUP4KOYmARlxjrqK2smSUtGOL2HmTXwUZanHj/t2ozwsxTmtBLYt9HRL1ZAzZEqT3gg 9k8J3xm+iaTzZQp7gn0i4NWPrZ+Hjpx39o1B+GvD5QkirO9ZIXKgdAF4KDQHJaP0eFc1 Ao0lOZ1j4Ax9KmqE8XgMbB1y7KLxA03DFNGiTisb6W7ZfJjUJhhrKMMNeyLi1WakAuww khA5di5nGyTB+NARbrgiarWsAbpSkvQ3RX1Gw6eYifFgxUgJbreMFxOXkb2IGyI1VkD0 aRYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@trvn.ru header.s=mail header.b=5FIPblkn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x12-20020a056a00188c00b00686ededb373si3540893pfh.89.2023.07.28.11.24.43; Fri, 28 Jul 2023 11:24:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@trvn.ru header.s=mail header.b=5FIPblkn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=trvn.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231166AbjG1R3h (ORCPT <rfc822;hanasaki@gmail.com> + 99 others); Fri, 28 Jul 2023 13:29:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229580AbjG1R3b (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 28 Jul 2023 13:29:31 -0400 Received: from box.trvn.ru (box.trvn.ru [194.87.146.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C9162D64; Fri, 28 Jul 2023 10:29:29 -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 DDB78423EC; Fri, 28 Jul 2023 22:20:25 +0500 (+05) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=trvn.ru; s=mail; t=1690564826; bh=BTHA7BOdnoILhyKJmbmntYs8hUmm5xyCV/Oj9i4ZnIU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=5FIPblknc31XzZdfMdV3Va13opX+qyIlbQq0hbjbrBsAQmGOHOFQ9XUEUqq8eXVWC Tmj4hERjnG/0K4rQwqXkFOolRCxMRS5VQAgURYNFo0hZQmnzfQzqUbW8uXgVnf/MlP M/zfSG5qIQsocXRlidm+ZpEzsMD5ptYsUK/wgjPb4CNZB77IYjvGPbqkGEf4Xp9IvM xMDaGjDSJ7RptiomelZzvOarjFcbCvv5LD9Nn2Ei2UZKK9AFKQhtYs/4mMPY6YBu2H qHcEpyNcXJnKQBy/K+IQKE+Y5UGpbEYhws/QbPa/ltXxsWctRpOsTvFDoWmj/xxBBj iNP25yosR28Pg== From: Nikita Travkin <nikita@trvn.ru> Date: Fri, 28 Jul 2023 22:19:30 +0500 Subject: [PATCH 1/4] dt-bindings: power: supply: Add pm8916 VM-BMS MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230728-pm8916-bms-lbc-v1-1-56da32467487@trvn.ru> References: <20230728-pm8916-bms-lbc-v1-0-56da32467487@trvn.ru> In-Reply-To: <20230728-pm8916-bms-lbc-v1-0-56da32467487@trvn.ru> To: Sebastian Reichel <sre@kernel.org>, Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Conor Dooley <conor+dt@kernel.org> Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Nikita Travkin <nikita@trvn.ru> X-Developer-Signature: v=1; a=openpgp-sha256; l=1993; i=nikita@trvn.ru; h=from:subject:message-id; bh=BTHA7BOdnoILhyKJmbmntYs8hUmm5xyCV/Oj9i4ZnIU=; b=owEBbQKS/ZANAwAIAUMc7O4oGb91AcsmYgBkw/jPMOUsqaC4ObMgf6S0TqkPHcUNiFvR8xQav AGDHO8BFviJAjMEAAEIAB0WIQTAhK9UUj+qg34uxUdDHOzuKBm/dQUCZMP4zwAKCRBDHOzuKBm/ dZg5D/4xlV1nucyc5nXkoL3EYNs4yha/xnMJWNd9KhG0CRPivb9r9JZthm8HmHOvIJXUc8FkkjI psMB9qA2DZqNB4WRN5ASjYRN5DAOrD1q7pMyv68GDV6/uYczFs5hsEiiNHKNyMadftRs9KVSNlF NzWRrWMtTf1u8ileHNrK06prL2f4mstfRWg373VlxpsIPALNUEZ0Rsu7MQxHfWmfhvq1i90Suza SIPRl29cUi7fgw6aeXmb+JG27SDd/PfRa5A3L7dKenhqK8c8/qqdDyMhG/clsTg6E1d2b/iHoFU Uclr5jf9tMu+7K/h0j0ib9eEu8JL1yJ15i4fojch81GuCWO85ivtN6YaMyp46gyB5ORbUFhWTa9 NZI1nOzPfC3fpCWbIDKVWLWHSfJkYN5XhYtbJLE9a22ptMykvvXoc0Sm3TmMewFCGMNYC5KkgTH pZ3PhIvle9aOIBMO8Sk1jDpaKbydykv1WPUSf8UbdYLKetj6hfLXEkVXRpr+wZ7xiYJOeU8TOLp DJZyD5WhS3NFZbqtz+2KZf/T3omD0Zt+vYU6zRi/wMB8xqLNO/X2riM9UyO1aJncIYJtxqQB89s tM1n0lIdQTOsMvH3Rn+3RYlXgy3XIoLUCcLBUE1wh8aL2iRGp2z5u9hitzmYwVsxNfV71UKhW0W dIbvZG+5HkigkFA== X-Developer-Key: i=nikita@trvn.ru; a=openpgp; fpr=C084AF54523FAA837E2EC547431CECEE2819BF75 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772689760869261157 X-GMAIL-MSGID: 1772689760869261157 |
Series |
Add pm8916 VM-BMS and LBC
|
|
Commit Message
Nikita Travkin
July 28, 2023, 5:19 p.m. UTC
Qualcomm Voltage Mode BMS is a battery monitoring block in PM8916 PMIC.
Document it's DT binding.
Signed-off-by: Nikita Travkin <nikita@trvn.ru>
---
.../bindings/power/supply/qcom,pm8916-bms-vm.yaml | 64 ++++++++++++++++++++++
1 file changed, 64 insertions(+)
Comments
On Fri, Jul 28, 2023 at 10:19:30PM +0500, Nikita Travkin wrote: > Qualcomm Voltage Mode BMS is a battery monitoring block in PM8916 PMIC. > Document it's DT binding. > > Signed-off-by: Nikita Travkin <nikita@trvn.ru> > --- > .../bindings/power/supply/qcom,pm8916-bms-vm.yaml | 64 ++++++++++++++++++++++ > 1 file changed, 64 insertions(+) > > diff --git a/Documentation/devicetree/bindings/power/supply/qcom,pm8916-bms-vm.yaml b/Documentation/devicetree/bindings/power/supply/qcom,pm8916-bms-vm.yaml > new file mode 100644 > index 000000000000..455973d46862 > --- /dev/null > +++ b/Documentation/devicetree/bindings/power/supply/qcom,pm8916-bms-vm.yaml > @@ -0,0 +1,64 @@ > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/power/supply/qcom,pm8916-bms-vm.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: Qualcomm Voltage Mode BMS > + > +maintainers: > + - Nikita Travkin <nikita@trvn.ru> > + > +description: > + Voltage Mode BMS is a hardware block found in some Qualcomm PMICs > + such as pm8916. This block performs battery voltage monitoring. > + > +allOf: > + - $ref: power-supply.yaml# > + > +properties: > + compatible: > + const: qcom,pm8916-bms-vm > + > + reg: > + maxItems: 1 > + > + interrupts: > + items: > + - description: FIFO update done You don't need items: here since you only have one - const: will do. > + interrupt-names: > + items: > + - const: fifo Same here, but do you really need a name, when you have only one interrupt? Thanks, Conor. > + > + monitored-battery: true > + > + power-supplies: true > + > + > +required: > + - compatible > + - reg > + - interrupts > + - interrupt-names > + - monitored-battery > + > +additionalProperties: false > + > +examples: > + - | > + #include <dt-bindings/interrupt-controller/irq.h> > + pmic { > + #address-cells = <1>; > + #size-cells = <0>; > + > + battery@4000 { > + compatible = "qcom,pm8916-bms-vm"; > + reg = <0x4000>; > + interrupts = <0x0 0x40 4 IRQ_TYPE_EDGE_RISING>; > + interrupt-names = "fifo"; > + > + monitored-battery = <&battery>; > + power-supplies = <&pm8916_charger>; > + }; > + }; > > -- > 2.41.0 >
Conor Dooley писал(а) 29.07.2023 15:03: > On Fri, Jul 28, 2023 at 10:19:30PM +0500, Nikita Travkin wrote: >> Qualcomm Voltage Mode BMS is a battery monitoring block in PM8916 PMIC. >> Document it's DT binding. >> >> Signed-off-by: Nikita Travkin <nikita@trvn.ru> >> --- >> .../bindings/power/supply/qcom,pm8916-bms-vm.yaml | 64 ++++++++++++++++++++++ >> 1 file changed, 64 insertions(+) >> >> diff --git a/Documentation/devicetree/bindings/power/supply/qcom,pm8916-bms-vm.yaml b/Documentation/devicetree/bindings/power/supply/qcom,pm8916-bms-vm.yaml >> new file mode 100644 >> index 000000000000..455973d46862 >> --- /dev/null >> +++ b/Documentation/devicetree/bindings/power/supply/qcom,pm8916-bms-vm.yaml >> @@ -0,0 +1,64 @@ >> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) >> +%YAML 1.2 >> +--- >> +$id: http://devicetree.org/schemas/power/supply/qcom,pm8916-bms-vm.yaml# >> +$schema: http://devicetree.org/meta-schemas/core.yaml# >> + >> +title: Qualcomm Voltage Mode BMS >> + >> +maintainers: >> + - Nikita Travkin <nikita@trvn.ru> >> + >> +description: >> + Voltage Mode BMS is a hardware block found in some Qualcomm PMICs >> + such as pm8916. This block performs battery voltage monitoring. >> + >> +allOf: >> + - $ref: power-supply.yaml# >> + >> +properties: >> + compatible: >> + const: qcom,pm8916-bms-vm >> + >> + reg: >> + maxItems: 1 >> + >> + interrupts: >> + items: >> + - description: FIFO update done > > You don't need items: here since you only have one - const: will do. > Ack. >> + interrupt-names: >> + items: >> + - const: fifo > > Same here, but do you really need a name, when you have only one > interrupt? > Hm, thinking of this more, the hardware actually has more than one interrupt, even though this one seems to be the only really useful one. Would a better way forward be to list all of them (and fix the driver to get the value by it's name) or it would be acceptable to leave the names here and extend the list at a later date when (if ever) other interrupts are needed? Thanks for the review! Nikita > Thanks, > Conor. > >> + >> + monitored-battery: true >> + >> + power-supplies: true >> + >> + >> +required: >> + - compatible >> + - reg >> + - interrupts >> + - interrupt-names >> + - monitored-battery >> + >> +additionalProperties: false >> + >> +examples: >> + - | >> + #include <dt-bindings/interrupt-controller/irq.h> >> + pmic { >> + #address-cells = <1>; >> + #size-cells = <0>; >> + >> + battery@4000 { >> + compatible = "qcom,pm8916-bms-vm"; >> + reg = <0x4000>; >> + interrupts = <0x0 0x40 4 IRQ_TYPE_EDGE_RISING>; >> + interrupt-names = "fifo"; >> + >> + monitored-battery = <&battery>; >> + power-supplies = <&pm8916_charger>; >> + }; >> + }; >> >> -- >> 2.41.0 >>
On Sat, Jul 29, 2023 at 05:06:14PM +0500, Nikita Travkin wrote: > Conor Dooley писал(а) 29.07.2023 15:03: > > On Fri, Jul 28, 2023 at 10:19:30PM +0500, Nikita Travkin wrote: > >> + interrupt-names: > >> + items: > >> + - const: fifo > > > > Same here, but do you really need a name, when you have only one > > interrupt? > > > > Hm, thinking of this more, the hardware actually has more than one > interrupt, even though this one seems to be the only really useful > one. Would a better way forward be to list all of them Yes. > (and fix > the driver to get the value by it's name) It's not a fix to do that, the order of the interrupts is not variable, so there's nothing wrong with using the indices. You can do it if you like. > or it would be > acceptable to leave the names here and extend the list at a later > date when (if ever) other interrupts are needed? If you know what they are, please describe them now, even if the driver does not use them (yet). Thanks, Conor.
Conor Dooley писал(а) 29.07.2023 17:10: > On Sat, Jul 29, 2023 at 05:06:14PM +0500, Nikita Travkin wrote: >> Conor Dooley писал(а) 29.07.2023 15:03: >> > On Fri, Jul 28, 2023 at 10:19:30PM +0500, Nikita Travkin wrote: > >> >> + interrupt-names: >> >> + items: >> >> + - const: fifo >> > >> > Same here, but do you really need a name, when you have only one >> > interrupt? >> > >> >> Hm, thinking of this more, the hardware actually has more than one >> interrupt, even though this one seems to be the only really useful >> one. Would a better way forward be to list all of them > > Yes. > >> (and fix >> the driver to get the value by it's name) > > It's not a fix to do that, the order of the interrupts is not variable, > so there's nothing wrong with using the indices. You can do it if you > like. > >> or it would be >> acceptable to leave the names here and extend the list at a later >> date when (if ever) other interrupts are needed? > > If you know what they are, please describe them now, even if the driver > does not use them (yet). > Thanks for the clarification! Will make sure both drivers have all interrupts described in v2 Nikita > Thanks, > Conor.
On Sat, Jul 29, 2023 at 05:15:06PM +0500, Nikita Travkin wrote: > Conor Dooley писал(а) 29.07.2023 17:10: > > On Sat, Jul 29, 2023 at 05:06:14PM +0500, Nikita Travkin wrote: > >> Conor Dooley писал(а) 29.07.2023 15:03: > >> > On Fri, Jul 28, 2023 at 10:19:30PM +0500, Nikita Travkin wrote: > > > >> >> + interrupt-names: > >> >> + items: > >> >> + - const: fifo > >> > > >> > Same here, but do you really need a name, when you have only one > >> > interrupt? > >> > > >> > >> Hm, thinking of this more, the hardware actually has more than one > >> interrupt, even though this one seems to be the only really useful > >> one. Would a better way forward be to list all of them > > > > Yes. > > > >> (and fix > >> the driver to get the value by it's name) > > > > It's not a fix to do that, the order of the interrupts is not variable, > > so there's nothing wrong with using the indices. You can do it if you > > like. > > > >> or it would be > >> acceptable to leave the names here and extend the list at a later > >> date when (if ever) other interrupts are needed? > > > > If you know what they are, please describe them now, even if the driver > > does not use them (yet). > > > > Thanks for the clarification! Will make sure both drivers have all > interrupts described in v2 Note that bindings describe hardware, not the driver. The driver need not touch the other interrupts if it does not use them, but make the hardware description (IOW the dt-binding) accurate & as complete as you can. Thanks, Conor.
diff --git a/Documentation/devicetree/bindings/power/supply/qcom,pm8916-bms-vm.yaml b/Documentation/devicetree/bindings/power/supply/qcom,pm8916-bms-vm.yaml new file mode 100644 index 000000000000..455973d46862 --- /dev/null +++ b/Documentation/devicetree/bindings/power/supply/qcom,pm8916-bms-vm.yaml @@ -0,0 +1,64 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/power/supply/qcom,pm8916-bms-vm.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Qualcomm Voltage Mode BMS + +maintainers: + - Nikita Travkin <nikita@trvn.ru> + +description: + Voltage Mode BMS is a hardware block found in some Qualcomm PMICs + such as pm8916. This block performs battery voltage monitoring. + +allOf: + - $ref: power-supply.yaml# + +properties: + compatible: + const: qcom,pm8916-bms-vm + + reg: + maxItems: 1 + + interrupts: + items: + - description: FIFO update done + + interrupt-names: + items: + - const: fifo + + monitored-battery: true + + power-supplies: true + + +required: + - compatible + - reg + - interrupts + - interrupt-names + - monitored-battery + +additionalProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/irq.h> + pmic { + #address-cells = <1>; + #size-cells = <0>; + + battery@4000 { + compatible = "qcom,pm8916-bms-vm"; + reg = <0x4000>; + interrupts = <0x0 0x40 4 IRQ_TYPE_EDGE_RISING>; + interrupt-names = "fifo"; + + monitored-battery = <&battery>; + power-supplies = <&pm8916_charger>; + }; + };