From patchwork Tue Jul 30 10:10:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Tresidder X-Patchwork-Id: 11065521 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DF0E61823 for ; Tue, 30 Jul 2019 10:10:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CCA292879D for ; Tue, 30 Jul 2019 10:10:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C0B7A287A1; Tue, 30 Jul 2019 10:10:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 73020287A0 for ; Tue, 30 Jul 2019 10:10:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725209AbfG3KKJ (ORCPT ); Tue, 30 Jul 2019 06:10:09 -0400 Received: from icp-osb-irony-out1.external.iinet.net.au ([203.59.1.210]:44712 "EHLO icp-osb-irony-out1.external.iinet.net.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727360AbfG3KKJ (ORCPT ); Tue, 30 Jul 2019 06:10:09 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2BcBwDsFkBd/1/rO8tmHgEfBgeBTgKDUwwVEhcTjRqIHQGCQwGJLJEbCQEBAQEBAQEBARscAQGEOgQCAoJkNwYOAQMBAQEEAQEBAQUBbYRlRYVLBlYzPxJXBxKDIoF3E64KhAYBhHKBSIE0hwmEboFAP4ERg1CEAwobhV0iBJU6lUMJgSV3lBgZmBEtizeBWZloIoFYTR8ZgyeQT0Q1MIt0glIBAQ X-IPAS-Result: A2BcBwDsFkBd/1/rO8tmHgEfBgeBTgKDUwwVEhcTjRqIHQGCQwGJLJEbCQEBAQEBAQEBARscAQGEOgQCAoJkNwYOAQMBAQEEAQEBAQUBbYRlRYVLBlYzPxJXBxKDIoF3E64KhAYBhHKBSIE0hwmEboFAP4ERg1CEAwobhV0iBJU6lUMJgSV3lBgZmBEtizeBWZloIoFYTR8ZgyeQT0Q1MIt0glIBAQ X-IronPort-AV: E=Sophos;i="5.64,326,1559491200"; d="scan'208";a="229598849" Received: from 203-59-235-95.perm.iinet.net.au (HELO rtcentos7.electromag.com.au) ([203.59.235.95]) by icp-osb-irony-out1.iinet.net.au with ESMTP; 30 Jul 2019 18:10:06 +0800 From: Richard Tresidder To: sre@kernel.org, robh+dt@kernel.org, mark.rutland@arm.com, rtresidd@electromag.com.au, kstewart@linuxfoundation.org, gregkh@linuxfoundation.org, tglx@linutronix.de, rfontana@redhat.com, allison@lohutok.net, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RESEND v2 1/2] dt-binding docs: sbs_sbs-battery: Addition of force_load binding Date: Tue, 30 Jul 2019 18:10:03 +0800 Message-Id: <1564481404-39505-2-git-send-email-rtresidd@electromag.com.au> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1564481404-39505-1-git-send-email-rtresidd@electromag.com.au> References: <1564481404-39505-1-git-send-email-rtresidd@electromag.com.au> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add device tree binding documentation for addition of force_load boolean value to allow loading a battery during boot even if notpresent at that time. Signed-off-by: Richard Tresidder --- Documentation/devicetree/bindings/power/supply/sbs_sbs-battery.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/power/supply/sbs_sbs-battery.txt b/Documentation/devicetree/bindings/power/supply/sbs_sbs-battery.txt index 4e78e51..187d7bb 100644 --- a/Documentation/devicetree/bindings/power/supply/sbs_sbs-battery.txt +++ b/Documentation/devicetree/bindings/power/supply/sbs_sbs-battery.txt @@ -15,7 +15,8 @@ Optional properties : after an external change notification. - sbs,battery-detect-gpios : The gpio which signals battery detection and a flag specifying its polarity. - + - sbs,force-load : Allow loading of a hot-pluggable battery when there is no + GPIO detect available and the module is statically built. Example: battery@b { @@ -24,4 +25,5 @@ Example: sbs,i2c-retry-count = <2>; sbs,poll-retry-count = <10>; sbs,battery-detect-gpios = <&gpio-controller 122 1>; + sbs,force-load; } From patchwork Tue Jul 30 10:10:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Tresidder X-Patchwork-Id: 11065519 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 968661395 for ; Tue, 30 Jul 2019 10:10:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 881C82879D for ; Tue, 30 Jul 2019 10:10:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7A12F287A8; Tue, 30 Jul 2019 10:10:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 295042879D for ; Tue, 30 Jul 2019 10:10:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729719AbfG3KKL (ORCPT ); Tue, 30 Jul 2019 06:10:11 -0400 Received: from icp-osb-irony-out1.external.iinet.net.au ([203.59.1.210]:44702 "EHLO icp-osb-irony-out1.external.iinet.net.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729648AbfG3KKK (ORCPT ); Tue, 30 Jul 2019 06:10:10 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2AIBgDsFkBd/1/rO8tmghmDVSESFxONGogdAYJDAYkskRsJAQEBAQEBAQEBGxwBAYQ6BAICgmQ3Bg4BAwEBAQQBAQEBBQFthGVFhUsGJy8zPxJXBxKDIoF3E61XM4QGAYRygUiBNIcJhG6BQD+DdWyEAwobhX8ElTqVQwmBJXeUGBmYEYtkgVmZaCKBWE0fGYMngnmNVkQ1MIt0glIBAQ X-IPAS-Result: A2AIBgDsFkBd/1/rO8tmghmDVSESFxONGogdAYJDAYkskRsJAQEBAQEBAQEBGxwBAYQ6BAICgmQ3Bg4BAwEBAQQBAQEBBQFthGVFhUsGJy8zPxJXBxKDIoF3E61XM4QGAYRygUiBNIcJhG6BQD+DdWyEAwobhX8ElTqVQwmBJXeUGBmYEYtkgVmZaCKBWE0fGYMngnmNVkQ1MIt0glIBAQ X-IronPort-AV: E=Sophos;i="5.64,326,1559491200"; d="scan'208";a="229598851" Received: from 203-59-235-95.perm.iinet.net.au (HELO rtcentos7.electromag.com.au) ([203.59.235.95]) by icp-osb-irony-out1.iinet.net.au with ESMTP; 30 Jul 2019 18:10:07 +0800 From: Richard Tresidder To: sre@kernel.org, robh+dt@kernel.org, mark.rutland@arm.com, rtresidd@electromag.com.au, kstewart@linuxfoundation.org, gregkh@linuxfoundation.org, tglx@linutronix.de, rfontana@redhat.com, allison@lohutok.net, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RESEND v2 2/2] power/supply/sbs-battery: Add ability to force load a battery via the devicetree Date: Tue, 30 Jul 2019 18:10:04 +0800 Message-Id: <1564481404-39505-3-git-send-email-rtresidd@electromag.com.au> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1564481404-39505-1-git-send-email-rtresidd@electromag.com.au> References: <1564481404-39505-1-git-send-email-rtresidd@electromag.com.au> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add the ability to force load a hot pluggable battery during boot where there is no gpio detect method available and the module is statically built. Normal polling will then occur on that battery when it is inserted. Signed-off-by: Richard Tresidder --- drivers/power/supply/sbs-battery.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/power/supply/sbs-battery.c b/drivers/power/supply/sbs-battery.c index 048d205..b55721d 100644 --- a/drivers/power/supply/sbs-battery.c +++ b/drivers/power/supply/sbs-battery.c @@ -816,6 +816,7 @@ static int sbs_probe(struct i2c_client *client, struct power_supply_config psy_cfg = {}; int rc; int irq; + bool dt_force_load; sbs_desc = devm_kmemdup(&client->dev, &sbs_default_desc, sizeof(*sbs_desc), GFP_KERNEL); @@ -852,6 +853,9 @@ static int sbs_probe(struct i2c_client *client, if (rc) chip->poll_retry_count = 0; + dt_force_load = of_property_read_bool(client->dev.of_node, + "sbs,force-load"); + if (pdata) { chip->poll_retry_count = pdata->poll_retry_count; chip->i2c_retry_count = pdata->i2c_retry_count; @@ -890,7 +894,7 @@ static int sbs_probe(struct i2c_client *client, * Before we register, we might need to make sure we can actually talk * to the battery. */ - if (!(force_load || chip->gpio_detect)) { + if (!(force_load || chip->gpio_detect || dt_force_load)) { rc = sbs_read_word_data(client, sbs_data[REG_STATUS].addr); if (rc < 0) {