From patchwork Fri Oct 19 10:53:11 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: 10648989 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 89F4115E2 for ; Fri, 19 Oct 2018 10:54:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7A12928A3F for ; Fri, 19 Oct 2018 10:54:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6EA1E28A8B; Fri, 19 Oct 2018 10:54:08 +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 1AF0928A3F for ; Fri, 19 Oct 2018 10:54:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727365AbeJSS7j (ORCPT ); Fri, 19 Oct 2018 14:59:39 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:43264 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727039AbeJSS7J (ORCPT ); Fri, 19 Oct 2018 14:59:09 -0400 Received: by mail-pg1-f196.google.com with SMTP id d8-v6so4402129pgv.10 for ; Fri, 19 Oct 2018 03:53:37 -0700 (PDT) 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=iqKD9byHso6OMx8L+zAYM7NHKckUL6NGilBoDBaqk1Y=; b=UnHMeEeq5DgBn1FBAnCUVHjVAQ3cCPpbV2op4fk/HIXIw0+1RzpNUfolS7d8PK5jN5 IGH6HUMRsn34E4vn/bAfWLblkzE0bZ+9QJ4G36bIUpM6YFxNV65fAunw3AEIOCi7etb6 1PEnP3GkQTvWwkc/inwzmM2p9P3M6LRCW7DtU= 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=iqKD9byHso6OMx8L+zAYM7NHKckUL6NGilBoDBaqk1Y=; b=JFumErLEYK5mEIZNXqRi+uC9Sx+4XnJJ6MChyyZnHt5wKQqoToH5TZ2/Xfgr5UWf3Y kcvkhoo/6V3KGshCvza6WD3F0MtOfQ9vldfhUg+YjVI+SxIKUdShSWMkw3XXLaiZN0e7 Fc/BnhMVuevlSWPXGxDg9668nXt6fzomZlG1mt3aYrRg3tk/ufzzQ0tLZU+hKvShjVBp 9FGDOL4nsoTrnkiZQu7/LlIXkDYfaa2V0F+mTl2KOWOTET8QJlGmPgasWiP3NQvUEsIT qTxkTkfy2rjbE4kNyUgaMRq85GyjfG7+YwJkzinInpielCONF9eJRMbRRjX5pRChFm0K Fgdw== X-Gm-Message-State: ABuFfogiAiKmSjPTSdxr85opfxgINXyn982sUIkfpnAQ4Aqr5R2+4xqQ ldqQNMX9YEqdhHMaI6ba4szTOw== X-Google-Smtp-Source: ACcGV62Am2lsPpsnG0Iu0GwhNgThjpQG3bRhAvEahZTp1lygHgBnIqGTWL0NbHmkHJ5NcJdLXBKTjw== X-Received: by 2002:a63:1f05:: with SMTP id f5-v6mr1341281pgf.313.1539946416809; Fri, 19 Oct 2018 03:53:36 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id m67-v6sm54918pfm.13.2018.10.19.03.53.32 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 19 Oct 2018 03:53:35 -0700 (PDT) From: Baolin Wang To: sre@kernel.org, robh+dt@kernel.org, mark.rutland@arm.com Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, yuanjiang.yu@unisoc.com, baolin.wang@linaro.org, broonie@kernel.org, ctatlor97@gmail.com, linus.walleij@linaro.org Subject: [PATCH v5 2/6] power: supply: core: Add one field to present the battery internal resistance Date: Fri, 19 Oct 2018 18:53:11 +0800 Message-Id: X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: In-Reply-To: References: 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 one field for 'struct power_supply_battery_info' to present the battery factory internal resistance. Signed-off-by: Baolin Wang Reviewed-by: Linus Walleij --- Changes from v4: - None. Changes from v3: - New patch in v3, which splits code into one separate patch. - Add Linusw reviewed tag. --- drivers/power/supply/power_supply_core.c | 3 +++ include/linux/power_supply.h | 1 + 2 files changed, 4 insertions(+) diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c index e853618..307e0995 100644 --- a/drivers/power/supply/power_supply_core.c +++ b/drivers/power/supply/power_supply_core.c @@ -579,6 +579,7 @@ int power_supply_get_battery_info(struct power_supply *psy, info->charge_term_current_ua = -EINVAL; info->constant_charge_current_max_ua = -EINVAL; info->constant_charge_voltage_max_uv = -EINVAL; + info->factory_internal_resistance_uohm = -EINVAL; if (!psy->of_node) { dev_warn(&psy->dev, "%s currently only supports devicetree\n", @@ -616,6 +617,8 @@ int power_supply_get_battery_info(struct power_supply *psy, &info->constant_charge_current_max_ua); of_property_read_u32(battery_np, "constant_charge_voltage_max_microvolt", &info->constant_charge_voltage_max_uv); + of_property_read_u32(battery_np, "factory-internal-resistance-micro-ohms", + &info->factory_internal_resistance_uohm); return 0; } diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h index f807691..d089566 100644 --- a/include/linux/power_supply.h +++ b/include/linux/power_supply.h @@ -326,6 +326,7 @@ struct power_supply_battery_info { int charge_term_current_ua; /* microAmps */ int constant_charge_current_max_ua; /* microAmps */ int constant_charge_voltage_max_uv; /* microVolts */ + int factory_internal_resistance_uohm; /* microOhms */ }; extern struct atomic_notifier_head power_supply_notifier;