From patchwork Mon Nov 12 10:52:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "(Exiting) Baolin Wang" X-Patchwork-Id: 10678493 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 9F21013B5 for ; Mon, 12 Nov 2018 10:53:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8AF3D29E25 for ; Mon, 12 Nov 2018 10:53:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7C7A329EFE; Mon, 12 Nov 2018 10:53:09 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 20A7D29E25 for ; Mon, 12 Nov 2018 10:53:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728109AbeKLUpu (ORCPT ); Mon, 12 Nov 2018 15:45:50 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:45946 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728054AbeKLUpu (ORCPT ); Mon, 12 Nov 2018 15:45:50 -0500 Received: by mail-pl1-f195.google.com with SMTP id r3-v6so3438592pls.12 for ; Mon, 12 Nov 2018 02:53:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=qSBEaLMQTxoif/rlC/sHjfIRGMZsmwAJJs2wQVE+B5U=; b=jYcr/3u07sWgDbtZaVIrHOPZfwRdtlpfIZM2SabGLo+mGy7P+dEEfHMDmySwtUP/UZ jpcPrA/+nb1fFWwA1fn0PepmONaa+iPuplJivD/hWDOSRDphPkH8iMDS7sWLMCPkokR0 hHUHxrfWsiKTsKrXMdRpUcIogFNcso6MJ6tY4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=qSBEaLMQTxoif/rlC/sHjfIRGMZsmwAJJs2wQVE+B5U=; b=DS1r8ZXfK632cuyc9gzkSXxxX51maQL3w0ACJKyaw1Ww424hDQWXpGeuNwQ72SFGqX IZg9e5O75Vgg+94YR2rxB6ynNqLxFQchaqbDXsZwK3n++NGRLJoYhOy+FH3y8974jc6z NlfsigFGXNtbgTJbkdGwV7KD4DuKEzSGtkiUSqEljfJrj+L/1iy+g0SxkMs0Ja+ciUY3 Y2M4uqdE2snAKXWFpSyc55kKe/p7RMvO17wrG+tl+OgAXEBMryZSb1vVffKmg+kvquOu 8zsBnw81cmoiGZ28lxIRWkgenS1FMscE4qW9ElEeO9ipvOZF8lbYlHuX/va965emCa7w TJKQ== X-Gm-Message-State: AGRZ1gLYXVMHjyY3CnDoXLFeUUhB79Qy49qN8zb5Y6OsoxCQ3zZZ8iFA jw0Wv1Yxr+ruiK/Lx4xfgpEO2g== X-Google-Smtp-Source: AJdET5dXGrxqHznxKj+Ur9lD39xH3tO6eMJUOYpQotI0eBtdGZbm378+O9zGlFYSzYa0gagpVuKUTA== X-Received: by 2002:a17:902:1122:: with SMTP id d31-v6mr439172pla.259.1542019987406; Mon, 12 Nov 2018 02:53:07 -0800 (PST) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id 186-v6sm17545705pfe.39.2018.11.12.02.53.04 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 12 Nov 2018 02:53:06 -0800 (PST) From: Baolin Wang To: sre@kernel.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, yuanjiang.yu@unisoc.com, baolin.wang@linaro.org, broonie@kernel.org Subject: [PATCH 1/4] power: supply: sc2731_charger: Add one work to charge/discharge Date: Mon, 12 Nov 2018 18:52:35 +0800 Message-Id: <5d096dec07f6808a70edcfaad6e8f77039f21a9b.1542019800.git.baolin.wang@linaro.org> X-Mailer: git-send-email 1.7.9.5 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 Since the USB notifier context is atomic, we can not start or stop charging in atomic context. Thus this patch adds one work to help to charge or discharge. Signed-off-by: Baolin Wang --- drivers/power/supply/sc2731_charger.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/drivers/power/supply/sc2731_charger.c b/drivers/power/supply/sc2731_charger.c index 525a820..393ba98 100644 --- a/drivers/power/supply/sc2731_charger.c +++ b/drivers/power/supply/sc2731_charger.c @@ -57,9 +57,11 @@ struct sc2731_charger_info { struct usb_phy *usb_phy; struct notifier_block usb_notify; struct power_supply *psy_usb; + struct work_struct work; struct mutex lock; bool charging; u32 base; + u32 limit; }; static void sc2731_charger_stop_charge(struct sc2731_charger_info *info) @@ -318,22 +320,21 @@ static int sc2731_charger_property_is_writeable(struct power_supply *psy, .property_is_writeable = sc2731_charger_property_is_writeable, }; -static int sc2731_charger_usb_change(struct notifier_block *nb, - unsigned long limit, void *data) +static void sc2731_charger_work(struct work_struct *data) { struct sc2731_charger_info *info = - container_of(nb, struct sc2731_charger_info, usb_notify); - int ret = 0; + container_of(data, struct sc2731_charger_info, work); + int ret; mutex_lock(&info->lock); - if (limit > 0) { + if (info->limit > 0) { /* set current limitation and start to charge */ - ret = sc2731_charger_set_current_limit(info, limit); + ret = sc2731_charger_set_current_limit(info, info->limit); if (ret) goto out; - ret = sc2731_charger_set_current(info, limit); + ret = sc2731_charger_set_current(info, info->limit); if (ret) goto out; @@ -350,7 +351,19 @@ static int sc2731_charger_usb_change(struct notifier_block *nb, out: mutex_unlock(&info->lock); - return ret; +} + +static int sc2731_charger_usb_change(struct notifier_block *nb, + unsigned long limit, void *data) +{ + struct sc2731_charger_info *info = + container_of(nb, struct sc2731_charger_info, usb_notify); + + info->limit = limit; + + schedule_work(&info->work); + + return NOTIFY_OK; } static int sc2731_charger_hw_init(struct sc2731_charger_info *info) @@ -432,6 +445,7 @@ static int sc2731_charger_probe(struct platform_device *pdev) mutex_init(&info->lock); info->dev = &pdev->dev; + INIT_WORK(&info->work, sc2731_charger_work); info->regmap = dev_get_regmap(pdev->dev.parent, NULL); if (!info->regmap) { From patchwork Mon Nov 12 10:52:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "(Exiting) Baolin Wang" X-Patchwork-Id: 10678499 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 9FB821759 for ; Mon, 12 Nov 2018 10:53:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8ED5E29E25 for ; Mon, 12 Nov 2018 10:53:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 830A529EFE; Mon, 12 Nov 2018 10:53:30 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 3049F29E25 for ; Mon, 12 Nov 2018 10:53:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729212AbeKLUqL (ORCPT ); Mon, 12 Nov 2018 15:46:11 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:46334 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728302AbeKLUpx (ORCPT ); Mon, 12 Nov 2018 15:45:53 -0500 Received: by mail-pl1-f196.google.com with SMTP id t13so1211918ply.13 for ; Mon, 12 Nov 2018 02:53:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=HOXqfssWr+GA/FOx7jvb56dSFIWUhT4eEupIEdpFDGI=; b=fXAOav+mraP+N9dy7FR2kkWZYlok0XTd5+E2fxqdoMQvs77zlJ9gRC6qQ9jeo7Q5U2 7MuqGCZ5JB3AIGJBYk5UBxA7OZv3rKkogdtwNc3kHUzZyAzFcIMxFjtdbC8kteEw9NBI yKpfd7rWYpxyaacoVwpPdteKIPC1RHXcFPB6M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=HOXqfssWr+GA/FOx7jvb56dSFIWUhT4eEupIEdpFDGI=; b=m8LrDFROutuwbmuvCtncDIXWgHrBUS8Cn9T+u6sHACTeJeAA4Zyl2UGT6sJ/BgWR8V rtv6IkZo0nOKWeObon1WNKxQ6aAMDWb0T1vPztTvnU/pPLfaVWFpkGsZjI6or1QW6xZK wx24IudtjtTFOHKm8cQLfqLXtim0ZmNFEXPhbKeUYLKlsfl0V3Io0muLClWoCIakoiuy FW9+gmzz9a/iCGrnNN8btUx/8/yJ2fzllXNnxdu9XaCdKe4XryLFD2T0FxIJhY/n0iWr ZahdveT0MiXelkqyhTwzQff7YdZ93Bs1KNDRKuzap0o8XhJn5TJuPp1V4uICiojJtrPc vOEQ== X-Gm-Message-State: AGRZ1gJdjmO4Jr9d7Co8Lysg/mOQteCONfE402Fz2QnsHZ23EyiUS4yO cimbu7HTjoPcKvOYHp6hOCAqZg== X-Google-Smtp-Source: AJdET5dLTa5+Mx7PHRpgLQqOLJdRyHOhk6Zws1uTzN0sgcEU8pBmO+WVn69Ev5EIf3pgktk0Bkt1Cg== X-Received: by 2002:a17:902:622:: with SMTP id 31-v6mr459108plg.310.1542019990064; Mon, 12 Nov 2018 02:53:10 -0800 (PST) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id 186-v6sm17545705pfe.39.2018.11.12.02.53.07 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 12 Nov 2018 02:53:09 -0800 (PST) From: Baolin Wang To: sre@kernel.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, yuanjiang.yu@unisoc.com, baolin.wang@linaro.org, broonie@kernel.org Subject: [PATCH 2/4] power: supply: sc2731_charger: Add charger status detection Date: Mon, 12 Nov 2018 18:52:36 +0800 Message-Id: <7fa4e3191a6be72b5a90d0ee73b70457a699f9bd.1542019800.git.baolin.wang@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <5d096dec07f6808a70edcfaad6e8f77039f21a9b.1542019800.git.baolin.wang@linaro.org> References: <5d096dec07f6808a70edcfaad6e8f77039f21a9b.1542019800.git.baolin.wang@linaro.org> In-Reply-To: <5d096dec07f6808a70edcfaad6e8f77039f21a9b.1542019800.git.baolin.wang@linaro.org> References: <5d096dec07f6808a70edcfaad6e8f77039f21a9b.1542019800.git.baolin.wang@linaro.org> 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 The USB charger status can be notified before the charger driver registers the USB phy notifier, so we should check the charger status in probe() in case we missed the USB charger notification. Signed-off-by: Baolin Wang --- drivers/power/supply/sc2731_charger.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/power/supply/sc2731_charger.c b/drivers/power/supply/sc2731_charger.c index 393ba98..a012d6c 100644 --- a/drivers/power/supply/sc2731_charger.c +++ b/drivers/power/supply/sc2731_charger.c @@ -432,6 +432,24 @@ static int sc2731_charger_hw_init(struct sc2731_charger_info *info) return ret; } +static void sc2731_charger_detect_status(struct sc2731_charger_info *info) +{ + unsigned int min, max; + + /* + * If the USB charger status has been USB_CHARGER_PRESENT before + * registering the notifier, we should start to charge with getting + * the charge current. + */ + if (info->usb_phy->chg_state != USB_CHARGER_PRESENT) + return; + + usb_phy_get_charger_current(info->usb_phy, &min, &max); + info->limit = min; + + schedule_work(&info->work); +} + static int sc2731_charger_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; @@ -486,6 +504,8 @@ static int sc2731_charger_probe(struct platform_device *pdev) return ret; } + sc2731_charger_detect_status(info); + return 0; } From patchwork Mon Nov 12 10:52:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "(Exiting) Baolin Wang" X-Patchwork-Id: 10678497 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 EE8691759 for ; Mon, 12 Nov 2018 10:53:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DDBCF29E25 for ; Mon, 12 Nov 2018 10:53:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D160929EFE; Mon, 12 Nov 2018 10:53:27 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 874EE29E25 for ; Mon, 12 Nov 2018 10:53:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729228AbeKLUp4 (ORCPT ); Mon, 12 Nov 2018 15:45:56 -0500 Received: from mail-pg1-f194.google.com ([209.85.215.194]:44364 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727361AbeKLUpz (ORCPT ); Mon, 12 Nov 2018 15:45:55 -0500 Received: by mail-pg1-f194.google.com with SMTP id w3-v6so3897724pgs.11 for ; Mon, 12 Nov 2018 02:53:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=WRUiqIUtLnq5Kt3BfAdxw6WClpYGJFwMdYAB6FisGEA=; b=h1xsJXjtr4KUX4hiAU3XjR0GvBQ+IQqpczfSDmxf4WmzGS3osEcUSguvicWvWXCOpz ApGW2bVX4eJeWM0ZQ6M0IVBl6jyucT3Lx0cEZIA815UrCpBAsIfAHdQWtW8+kKwQFxzx cHAeJAWFXMgR5VVfVuq/uazUpolpjm5ig2DQ8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=WRUiqIUtLnq5Kt3BfAdxw6WClpYGJFwMdYAB6FisGEA=; b=m4mTh3vrVS1jCGdf3v8C/zKdcHEG/gBNfEbmSzHY1lJCzFG95Fv978HASKFaqThrCd GhIGRW5auQMz9vY/2UFMFes2ZbpMSZNMQfdb8jkClKHHrb/KTozbef0AW6JPbQ+jZyBG 23C2X+YzysfBFayc6VPHjXjETprP+a9ghcVKb3Cvv6Od0RTctFPWrUipxhn8RTMYskpc GOtxJLLBST4X+1RUb9sG7jBSIK3VDAjlYLX6WxwOy8D5aN0IdM8kjkR+g1mopWjA/fi5 bWAcGLizeamQv/Lo6poDxf50n27pC1jk+V3hYkyAtWkp1DJ9B0naV8orvkLb4JJ7nYuM P3Hw== X-Gm-Message-State: AGRZ1gLZNYN9A1UIzCY5aHf9hHkvvbdf8eKVgVEosAidKzWkhS8FXzSk s3tF5vLAejJ2pRsef5L0F4dojlZu5YWQ42ps X-Google-Smtp-Source: AJdET5fi/0hkuSZLQv8DVN2iuIPkYkSADaMyZQJk/RZq8RPhUhPll42FhDRjETyssTZDEjmOZ+/b+w== X-Received: by 2002:a63:eb0e:: with SMTP id t14mr378059pgh.445.1542019992697; Mon, 12 Nov 2018 02:53:12 -0800 (PST) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id 186-v6sm17545705pfe.39.2018.11.12.02.53.10 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 12 Nov 2018 02:53:12 -0800 (PST) From: Baolin Wang To: sre@kernel.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, yuanjiang.yu@unisoc.com, baolin.wang@linaro.org, broonie@kernel.org Subject: [PATCH 3/4] power: supply: sc2731_charger: Avoid repeated charge/discharge Date: Mon, 12 Nov 2018 18:52:37 +0800 Message-Id: <2298d92a4156f331f9e317d6bc6eed0ff88677bb.1542019800.git.baolin.wang@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <5d096dec07f6808a70edcfaad6e8f77039f21a9b.1542019800.git.baolin.wang@linaro.org> References: <5d096dec07f6808a70edcfaad6e8f77039f21a9b.1542019800.git.baolin.wang@linaro.org> In-Reply-To: <5d096dec07f6808a70edcfaad6e8f77039f21a9b.1542019800.git.baolin.wang@linaro.org> References: <5d096dec07f6808a70edcfaad6e8f77039f21a9b.1542019800.git.baolin.wang@linaro.org> 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 info->charging validation to avoid repeated charge or discharge operation. Signed-off-by: Baolin Wang --- drivers/power/supply/sc2731_charger.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/power/supply/sc2731_charger.c b/drivers/power/supply/sc2731_charger.c index a012d6c..49b3f0c 100644 --- a/drivers/power/supply/sc2731_charger.c +++ b/drivers/power/supply/sc2731_charger.c @@ -328,7 +328,7 @@ static void sc2731_charger_work(struct work_struct *data) mutex_lock(&info->lock); - if (info->limit > 0) { + if (info->limit > 0 && !info->charging) { /* set current limitation and start to charge */ ret = sc2731_charger_set_current_limit(info, info->limit); if (ret) @@ -343,7 +343,7 @@ static void sc2731_charger_work(struct work_struct *data) goto out; info->charging = true; - } else { + } else if (!info->limit && info->charging) { /* Stop charging */ info->charging = false; sc2731_charger_stop_charge(info); From patchwork Mon Nov 12 10:52:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "(Exiting) Baolin Wang" X-Patchwork-Id: 10678495 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 A508313B5 for ; Mon, 12 Nov 2018 10:53:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9482529E25 for ; Mon, 12 Nov 2018 10:53:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8820B29EFE; Mon, 12 Nov 2018 10:53:24 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 3AFFB29E25 for ; Mon, 12 Nov 2018 10:53:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729295AbeKLUp7 (ORCPT ); Mon, 12 Nov 2018 15:45:59 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:45255 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729281AbeKLUp6 (ORCPT ); Mon, 12 Nov 2018 15:45:58 -0500 Received: by mail-pg1-f196.google.com with SMTP id y4so3897312pgc.12 for ; Mon, 12 Nov 2018 02:53:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=FwjO0MD8IjFvB0k6XnXwl4d6sfbxSCkhEER4jXSCxHs=; b=VJXf+H8jSteGTRTA3h1R6PCMsuMqpxwracH6HnMorGhA7ANZROK/7P0lQr5KXQlAmC nUpKF6EzXeTfLXCkD2rMAeirWVg5Deujwh4csS4URC12mu9yRWakMkSJbYVo7y4bik4G jXVyLvEskXCkNYENtjk6RuzoTWx8Rd14vshG8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=FwjO0MD8IjFvB0k6XnXwl4d6sfbxSCkhEER4jXSCxHs=; b=PZE8VTc17X0AcDaCfdOQuEL+IygK3K8aWqBE1IfbL5oeKKfkMq2L9N8HHD+HEuVNDw NuJLJZPryRvZGbial7LLYHzJmnhWokTMKBNXJ+2jKbZNgo/V0mmPMTP4AMPNQw+fFDhq c9PCXc7holxLqZlTK0/spswuYP1wgiWBAQNTY3zF3pyzTyFb/sR0HThwa69TjBdvSv5n xIdcoaRZNUMokQrC5AF0YM7dJXYmmWeBkoILcZy4/BkMEsv75qV3OQRxJ8eEUfC/kvZ/ NVKzBDTTNa+jrpNXtIG1x7DMnizKUdN+iOU+gbb5T3UJ1GsDRWshvXv5eJh4URLbC+Zo ZSNw== X-Gm-Message-State: AGRZ1gKhKlpxpxD+eofnsusTKoOPEA3SVsrNdffekWanljL5U9eLf73I asVHrWPFF+jU9RSfPQt+dFfWFw== X-Google-Smtp-Source: AJdET5e7ViAl/kTVAsa2ImwcosG9aOkE3Gme8rhQ4rEaAT19JPeIkydmx2wcpL1lnwa14DymwfpKEw== X-Received: by 2002:a63:1a4b:: with SMTP id a11mr404110pgm.254.1542019995522; Mon, 12 Nov 2018 02:53:15 -0800 (PST) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id 186-v6sm17545705pfe.39.2018.11.12.02.53.12 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 12 Nov 2018 02:53:14 -0800 (PST) From: Baolin Wang To: sre@kernel.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, yuanjiang.yu@unisoc.com, baolin.wang@linaro.org, broonie@kernel.org Subject: [PATCH 4/4] power: supply: sc2731_charger: Free battery information Date: Mon, 12 Nov 2018 18:52:38 +0800 Message-Id: X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <5d096dec07f6808a70edcfaad6e8f77039f21a9b.1542019800.git.baolin.wang@linaro.org> References: <5d096dec07f6808a70edcfaad6e8f77039f21a9b.1542019800.git.baolin.wang@linaro.org> In-Reply-To: <5d096dec07f6808a70edcfaad6e8f77039f21a9b.1542019800.git.baolin.wang@linaro.org> References: <5d096dec07f6808a70edcfaad6e8f77039f21a9b.1542019800.git.baolin.wang@linaro.org> 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 Free battery information in case of adding battery OCV tables. Signed-off-by: Baolin Wang --- drivers/power/supply/sc2731_charger.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/power/supply/sc2731_charger.c b/drivers/power/supply/sc2731_charger.c index 49b3f0c..335cb85 100644 --- a/drivers/power/supply/sc2731_charger.c +++ b/drivers/power/supply/sc2731_charger.c @@ -408,6 +408,8 @@ static int sc2731_charger_hw_init(struct sc2731_charger_info *info) vol_val = (term_voltage - 4200) / 100; else vol_val = 0; + + power_supply_put_battery_info(info->psy_usb, &bat_info); } /* Set charge termination current */