Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1346111rwr; Thu, 27 Apr 2023 16:38:26 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4QCaib2fMJDWz6DkUKZ1uhpThC2WzdjixKc/FkELGvmEntWPekxNpluyZe13MPC9ZI4vio X-Received: by 2002:a17:90b:188a:b0:247:48a1:3fb2 with SMTP id mn10-20020a17090b188a00b0024748a13fb2mr3593556pjb.19.1682638705949; Thu, 27 Apr 2023 16:38:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682638705; cv=none; d=google.com; s=arc-20160816; b=PcGS7gEpYunyyIpAMNozZ+fsGOqMihgHxGZCTVrQI6HQ/X3v7Cl3+psTd8fENXwaxS zCReS0wLD1h6BK/fwqH5mFYt6IJJ6usuk19eMRYs2fNIxEmuh/Jl+c3/9RXV4f3Vakh9 PYODGdj2+8d/cTyIZMgixH6EmAtkyVT9hG7+895trIdt125VQrvN8pMd/5wMVpnFreni gisw40pIvfnpayWNRHnYlg9iZ53Z2kBA0bG+BrdnGhBfeLIOOH5fkTKiNKNW9kV3Cfpq wiWf3Kfj97NSmdnlUXN6EvCyoSTV4JvRvFBLKe5F+AXVRtN76K6fsN76Whxa+LltlmPn A2bg== 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=TVyy9/b03N8nbazd1B41Q2wdYfTHpwuv2C4n1t0mm1Q=; b=UbiuAfNVLWIC8qVBF1xV3Cji0yMgy+8BAevsyHpMSkS3Fs2dVsHDvF+/GNOgPlF/Ao xL1q4iCkfQqasnHL9YEILUuzBrrvmW7wbIIbgWBSpDVSxPz1BYsnjI0A6GZT3RrTHASb ERgPJQge4ae0L5Kujs3JxjutFjKJYDNDMSP4bxokPxKxWKlubbLtLEzVUo6AY24JIgS2 fIxAeEhryzEJjKq6u08K5tut32a8OBOkqsY8vxdJCFMIMegPb9C0fcwF7XhzSjCcSVHW UIxFriAop24CZmptQWaz9rO15j/oVLh8NaLhhwx0Ocg4cegxfAOn3vPOYmwJAf6KxvZF FcVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rocketmail.com header.s=s2048 header.b="EaLOn+/X"; 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=REJECT sp=REJECT dis=NONE) header.from=rocketmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c2-20020a17090a108200b0024799a3324dsi18056568pja.162.2023.04.27.16.38.12; Thu, 27 Apr 2023 16:38:25 -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=@rocketmail.com header.s=s2048 header.b="EaLOn+/X"; 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=REJECT sp=REJECT dis=NONE) header.from=rocketmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344411AbjD0XgV (ORCPT + 99 others); Thu, 27 Apr 2023 19:36:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344295AbjD0XgN (ORCPT ); Thu, 27 Apr 2023 19:36:13 -0400 Received: from sonic301-22.consmr.mail.ir2.yahoo.com (sonic301-22.consmr.mail.ir2.yahoo.com [77.238.176.99]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9BE03A9D for ; Thu, 27 Apr 2023 16:36:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rocketmail.com; s=s2048; t=1682638568; bh=TVyy9/b03N8nbazd1B41Q2wdYfTHpwuv2C4n1t0mm1Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Subject:Reply-To; b=EaLOn+/XmXNN5NFCL8n1L944a6/vsnMqagPbWxd3/nPRBB0Sr+FBxCNoUpDKFCSlol+8tmPnk8R1wmRhUHTcm61YbSuez31WXeKWNbqr8ys7iavHwydNKplNoJeR3cNFCuh9Ga+bh2e4U0C1ySK9iJUBQpluNExPZPHFv1an3WGHCggPiWfFPBn8E+0Lgr0S2NuRNCPi52/DfVCtJNzC+KEVdFdRKCmMifeKBxSEIMI7fgIlCXIplnuyjPMdDvf4GBgVDdSz0mOTrvVJFWmKG35ShCDv6eM+HrqQ9Q5FzrHOcOjQOsNjucDIVgg+Sht754s54geGZRtQY3zKzusTSA== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1682638568; bh=H6QAeUAfPU8qA9SFl4JWKCkwkojo3613EmzTYADDT/f=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=i2P8RaevaCe+BjtX/tY7kyCt6QvD65fNG5WjQ4wW7SPdcYhVZkEa1UlSyRRgOL7truX53tZA5XI+mpr8x/AYwsQaCqqt1YiCGhGPEu5Y26lEe0aZq8jntWgrmuWWoKySz/xj8lawjprmMYGENWhBILiN/Di1JzkADLzdJLxieRbJUMowbtElV9AssxTzySCKYs31YdOyd05xqMrup+Sep3hLt8UXC7RG/dFqHFyvByviYfHwPhnLgyGHND9UE1NaYyvgox6u09gZ2anCpyspZOaTulErtjS1vXNnaO84egpIEMOTX7exjJJ1JmlKx7mzFlqqPyHCvK8IB+hiK5JpQQ== X-YMail-OSG: GxSgUtUVM1mDps3zNb2GewA1aDRc7SuXvavYTqd8fqOfd3pmslChq0hsY4SAgPZ szi1nfGO89PxaeJDdmcuco7XrLzn_vb6fQUWyMfYu5Jp04RvNb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uvwPvesl.mlp9dzBtWsK1qPof98O X7lSM8Cy2v9be_ALe1Xl9S.0ckFyJKkUYXCmq_eDdY56UGVuA_7wSYcCSGmhMIQ_B_9ngqbqaibD etHGEMGkrvGf4cc2bG16a7R97.6Aq X-Sonic-MF: X-Sonic-ID: 8394d146-4d61-4725-9ab6-e269909a2dbd Received: from sonic.gate.mail.ne1.yahoo.com by sonic301.consmr.mail.ir2.yahoo.com with HTTP; Thu, 27 Apr 2023 23:36:08 +0000 Received: by hermes--production-ir2-74cd8fc864-d5c78 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID b559be960ee93a958c6ba15207aea559; Thu, 27 Apr 2023 23:36:03 +0000 (UTC) From: Jakob Hauser To: Sebastian Reichel , Lee Jones , Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski Cc: Beomho Seo , Chanwoo Choi , Stephan Gerhold , Raymond Hackley , Pavel Machek , Axel Lin , ChiYuan Huang , Linus Walleij , linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, phone-devel@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, Jakob Hauser Subject: [PATCH v3 7/8] power: supply: rt5033_battery: Adopt status property from charger Date: Fri, 28 Apr 2023 01:30:10 +0200 Message-Id: X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 The rt5033-battery fuelgauge can't get a status by itself. The rt5033-charger can, let's get this value. Tested-by: Raymond Hackley Signed-off-by: Jakob Hauser --- drivers/power/supply/rt5033_battery.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/power/supply/rt5033_battery.c b/drivers/power/supply/rt5033_battery.c index 5c04cf305219..a6520716d813 100644 --- a/drivers/power/supply/rt5033_battery.c +++ b/drivers/power/supply/rt5033_battery.c @@ -12,6 +12,26 @@ #include #include +static int rt5033_battery_get_status(struct i2c_client *client) +{ + struct power_supply *charger; + union power_supply_propval val; + int ret; + + charger = power_supply_get_by_name("rt5033-charger"); + if (!charger) + return POWER_SUPPLY_STATUS_UNKNOWN; + + ret = power_supply_get_property(charger, POWER_SUPPLY_PROP_STATUS, &val); + if (ret) { + power_supply_put(charger); + return POWER_SUPPLY_STATUS_UNKNOWN; + } + + power_supply_put(charger); + return val.intval; +} + static int rt5033_battery_get_capacity(struct i2c_client *client) { struct rt5033_battery *battery = i2c_get_clientdata(client); @@ -84,6 +104,9 @@ static int rt5033_battery_get_property(struct power_supply *psy, case POWER_SUPPLY_PROP_CAPACITY: val->intval = rt5033_battery_get_capacity(battery->client); break; + case POWER_SUPPLY_PROP_STATUS: + val->intval = rt5033_battery_get_status(battery->client); + break; default: return -EINVAL; } @@ -96,6 +119,7 @@ static enum power_supply_property rt5033_battery_props[] = { POWER_SUPPLY_PROP_VOLTAGE_OCV, POWER_SUPPLY_PROP_PRESENT, POWER_SUPPLY_PROP_CAPACITY, + POWER_SUPPLY_PROP_STATUS, }; static const struct regmap_config rt5033_battery_regmap_config = { -- 2.39.2