From patchwork Sun Jul 30 17:26:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Svyatoslav Ryhel X-Patchwork-Id: 128256 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp1610729vqg; Sun, 30 Jul 2023 11:11:18 -0700 (PDT) X-Google-Smtp-Source: APBJJlGZAzUvm9iNERfRdWgrDLMz6uiL8TTl06yB/WoPGsPSyScaTyQcBi/p03HiM8Zv47fSO9fe X-Received: by 2002:a05:6a20:419:b0:121:fd18:4b51 with SMTP id a25-20020a056a20041900b00121fd184b51mr7241708pza.36.1690740677935; Sun, 30 Jul 2023 11:11:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690740677; cv=none; d=google.com; s=arc-20160816; b=Exzxtb1Amo9+/BzGJn3SzVA4A6WAXpuGw6+MC3ZV2f6fSjEyYgM1nhYPQkkVfZA1zX CAH5NUL5AG48acb7AdS9489ZnHTZP8Tk0g/1xJklFIwjmd0EB9mXWpv516cqnJ8aI9HO e0wZ8vJxBmCBy9BB1+G+x8QSTiRZE4hJCnaxRYbRRTTiDaN0PBNSBvGcX9WkhHItYwLl oHqSAGL6NIR53D7zYQ3G3fsNuYZ2ftvFSP6XPCSMh6zVj8W0EbyTl18fKrcZ8Rfrc06/ XnGioKcv+t2Ft86hiq9lP8DVI6n7EwDc+NhpjBoqoqH7gWbrB8Oue2WVa8Knyks1I9XA FnJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=JEyRUtIvngdn2xYibH+4khtHK+n4dlGEHPyQwJGcHe4=; fh=6EttwLj8TkcYgYcXwCN3+c7mDFZsrHr1IQ/n7Iq5Tzc=; b=cKyRHlPxq4mEUmdSgUfezdoeL5zx1ix5jH0SKWUB7ylMB1QyEaJrnvnYt/v9n1z1bq 3CJE2of/h8Q35Tts1MXlEW9zD49T8wpIA/6aGUGq9fAXAGY/LDjQHxjjQ1ip+pFJwDVk uYIXWx00XZr9GQeP3OR0G4NjDHArGbuBlSb22S7qrZ6fYC436I/ECw64pX1d2AlaExK1 AM4L6bRdKBHjWpJWnCLcYYZb+huisVFYpGihrlQEwBxfe7nx3yYKsWBjtxQ/2BaJj1LB aIfjoYn14OIbPNOwyEDgeNAdiD79YEiAya7drn57pvzFX3bPFUmAXudIgGkHvAbyoNmW QlWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=MHPsXj5q; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z19-20020a63e113000000b0056427788d96si3027108pgh.70.2023.07.30.11.11.05; Sun, 30 Jul 2023 11:11:17 -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=@gmail.com header.s=20221208 header.b=MHPsXj5q; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229820AbjG3R1X (ORCPT + 99 others); Sun, 30 Jul 2023 13:27:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229737AbjG3R1Q (ORCPT ); Sun, 30 Jul 2023 13:27:16 -0400 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7E4B10FE; Sun, 30 Jul 2023 10:27:15 -0700 (PDT) Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-4f954d7309fso4654922e87.1; Sun, 30 Jul 2023 10:27:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690738034; x=1691342834; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=JEyRUtIvngdn2xYibH+4khtHK+n4dlGEHPyQwJGcHe4=; b=MHPsXj5q7Idb/kmmujI2ZV/2M4sHrPu9zJOx6PwCeT7eaqPcQHn+SPHcBq5/yRfSIe 3OtRAhFMbcy5gNQ2T7NfvgDCuILi4bWmd4RylFN1Y0sfguKKRhG5DR52hiH+OzpAnzke uZaEKQw5ARL+zn82kODJwP7+99KVGByZfYozGG/ucOUgaE6xj8RXxB/QmrLNNJNZDiuA /lHaWuPSK4d0PCi20t08FaP819doG4qixUBaPq+tEB7tsSGr2bk3UJJXQkNP0tmzZO1m p7pnPcytzY892KOP5F8fLmr/4Q15xYUV45GV+6D6vA274kg8AjYSyPsRoizlrBlbupwZ joOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690738034; x=1691342834; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JEyRUtIvngdn2xYibH+4khtHK+n4dlGEHPyQwJGcHe4=; b=kIj3Eyg89lDmuPpaM2Of05RRT9WmNhjaBNBcg7TE5P2X4L95r7GSEo0yp+ACG1Mxfg 49Ds+3swO1b12rK6yvply1VOqMzAW7NRnzlKgoBXfva9hfJ4Vv/xjPqfK77tNj0rsA4y vRq6J2cpoDDhPxnbkXRcWFlgE/Vp5/SY1Ebt4D3OqR6shRa8iOdHJaHekAp0/wQyJbsW HfDXi4AAeOs84jtHnQOMU7ZflEyS+sY2XX0NBjQuDevyCjsStVbIzX8ocB1HwTJkO4k1 0m22zJIy1xRQxymKvORSjvpOHo7kf/rexRWb23Or+e+S4WX6q5+1wk2nmUsEnHcLWb7b Qgqw== X-Gm-Message-State: ABy/qLawD6sqyvNQSqWoEYiV1EZxCnf3Bqz42MJHPv3ZeMRowpmnugpP +GNEXP2A/Wba5rBhElQn9vE= X-Received: by 2002:a05:6512:ac8:b0:4fe:2b39:f3d6 with SMTP id n8-20020a0565120ac800b004fe2b39f3d6mr1070244lfu.34.1690738033849; Sun, 30 Jul 2023 10:27:13 -0700 (PDT) Received: from xeon.. ([188.163.112.48]) by smtp.gmail.com with ESMTPSA id x6-20020ac24886000000b004f8555f7aa1sm1737117lfc.52.2023.07.30.10.27.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Jul 2023 10:27:13 -0700 (PDT) From: Svyatoslav Ryhel To: Iskren Chernev , Krzysztof Kozlowski , Marek Szyprowski , Matheus Castello , Sebastian Reichel , Rob Herring , Conor Dooley , Svyatoslav Ryhel Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/3] power: max17040: pass status property from supplier Date: Sun, 30 Jul 2023 20:26:47 +0300 Message-Id: <20230730172648.71578-3-clamor95@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230730172648.71578-1-clamor95@gmail.com> References: <20230730172648.71578-1-clamor95@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772870097100765833 X-GMAIL-MSGID: 1772870097100765833 Optionally pass status property from supplier if has support for it. If cell is online assume it is present as well. Signed-off-by: Svyatoslav Ryhel --- drivers/power/supply/max17040_battery.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/power/supply/max17040_battery.c b/drivers/power/supply/max17040_battery.c index d1075959dd46..3301e8a4b16c 100644 --- a/drivers/power/supply/max17040_battery.c +++ b/drivers/power/supply/max17040_battery.c @@ -389,6 +389,7 @@ static int max17040_get_property(struct power_supply *psy, switch (psp) { case POWER_SUPPLY_PROP_ONLINE: + case POWER_SUPPLY_PROP_PRESENT: val->intval = max17040_get_online(chip); break; case POWER_SUPPLY_PROP_VOLTAGE_NOW: @@ -400,6 +401,9 @@ static int max17040_get_property(struct power_supply *psy, case POWER_SUPPLY_PROP_CAPACITY_ALERT_MIN: val->intval = chip->low_soc_alert; break; + case POWER_SUPPLY_PROP_STATUS: + power_supply_get_property_from_supplier(psy, psp, val); + break; default: return -EINVAL; } @@ -415,9 +419,11 @@ static const struct regmap_config max17040_regmap = { static enum power_supply_property max17040_battery_props[] = { POWER_SUPPLY_PROP_ONLINE, + POWER_SUPPLY_PROP_PRESENT, POWER_SUPPLY_PROP_VOLTAGE_NOW, POWER_SUPPLY_PROP_CAPACITY, POWER_SUPPLY_PROP_CAPACITY_ALERT_MIN, + POWER_SUPPLY_PROP_STATUS, }; static const struct power_supply_desc max17040_battery_desc = {