Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp4596622rwr; Mon, 8 May 2023 09:47:45 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7XZf6zxOU9JFiDnh/BWU1gv9YST31tw7rmgam9U5mUZCKvdOKigXawkvm7wPv0no8bWMTH X-Received: by 2002:a05:6a00:1492:b0:643:53b6:d841 with SMTP id v18-20020a056a00149200b0064353b6d841mr16336319pfu.2.1683564464441; Mon, 08 May 2023 09:47:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683564464; cv=none; d=google.com; s=arc-20160816; b=eABd+niUdeFz+hC1212pq1aRfec2DyRXfl2YzC/OvSA/Fh2PeRt2A6bx6LBZjlZTNB JYq5oreU//v3LDmjJtT4JAPCzlVJKhYOqbxJG0K3ZXCIyGTs2znGXIPO+qqAsE4QToOr B7mGL8FL7WRIJUaQvR/NyaJ7eld4AAoK1el582tBSUUUogAU9NGh7zjZXoxCCazs/JBH u1tEfsvpFBbT/oV5Dd/CqmpfzqBV9tOWi8U9sOmuvm+bLqSjTeJ9cyHs/teN9h4mylwh 4eZMYeTgOVaDuBZ6Sw57t+8TDWUROEryS6IMf3JS8Ipqkdx8U4B0gyM/jmXBdbO6DVv1 dJ4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=jNhW67wE4DQuoeW919gNYC+sz6GOGsXYF1dAg7dWSHg=; b=M4kI1/bkXp/LZxjNSsl10OXGn79pSln4q3BkA+JuEWUBxPY5US+7E2eVbpkCjqYRBc SLDxK1DqCj9QgnZjsdCPx2OU+hqQdR6gXNRCrCT9Pk2Et5LQK1tfJhJKpTqjuINKN4iX PLvk1LkYSaQviM4rn9wPGGEcWLHxHCPGuVbRPmcyg1jy3pBlvyKMfeWPBl8TRtyexMJ9 49qdfR90CDb0FCLrFkU4qc+iCgDKBxp+Vpl/18D0FwG/4pZghRnpSGjrA3JmavRMcGFa YEl+MOblndionVTdAdF0DvafsC9QPpIQbt7Nnj2x+b4DlMDnlU52i+F72olF6TtEqWob dqtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=Ftpf01dK; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a206-20020a621ad7000000b0063473a51539si206894pfa.398.2023.05.08.09.47.30; Mon, 08 May 2023 09:47:44 -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=@collabora.com header.s=mail header.b=Ftpf01dK; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234331AbjEHQiA (ORCPT + 99 others); Mon, 8 May 2023 12:38:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229616AbjEHQhk (ORCPT ); Mon, 8 May 2023 12:37:40 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D28A36A71; Mon, 8 May 2023 09:37:35 -0700 (PDT) Received: from mercury (195-23-45-170.net.novis.pt [195.23.45.170]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) (Authenticated sender: sre) by madras.collabora.co.uk (Postfix) with ESMTPSA id 7FD3E66056CE; Mon, 8 May 2023 17:37:32 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1683563852; bh=fO5izScTRyVHPTwMk7OYZEtF1VDwquhA8HkOV2kHXhc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Ftpf01dKkf7sbhbMyc2k9a9Mt2fNy1kkx9WJil8XtjzEuP4lHtiQk2a8VKW0DtZZb tcFIqaB5xLmyvY8uSFfoTiKfPsJ0spZ7g6LmDMltzX+yvkpf0zTyVj36xkrnv0MLFy YrsNRhVmTYgcxsZvCLbZLU4KMfNuMrMwTeYV+r9OzhB/78itYSZz5UEC6G5RJUizt9 AShnXFEfrXcKR4wrRaa6FrsCW860lfVKYgmWKqXE7FwBb+K4rntFX9Ga+pm0E4ID9W kXENeoe6A6GKengjGktbwjqORKGsyLTVmAo2kAMqlABHIGEqnCc0NquhW+oGkA+2a3 PKHpmMjn55ihg== Received: by mercury (Postfix, from userid 1000) id BF2471066FA0; Mon, 8 May 2023 13:35:18 +0200 (CEST) Date: Mon, 8 May 2023 13:35:18 +0200 From: Sebastian Reichel To: Jakob Hauser Cc: Lee Jones , Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Beomho Seo , Chanwoo Choi , Stephan Gerhold , Raymond Hackley , Pavel Machek , Axel Lin , ChiYuan Huang , Linus Walleij , Henrik Grimler , linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, phone-devel@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht Subject: Re: [PATCH v4 7/8] power: supply: rt5033_battery: Adopt status property from charger Message-ID: <20230508113518.nfwchl5wusmnkjp6@mercury.elektranox.org> References: <20230506155435.3005-1-jahau@rocketmail.com> <20230506155435.3005-8-jahau@rocketmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="62exsovixfg2cfix" Content-Disposition: inline In-Reply-To: <20230506155435.3005-8-jahau@rocketmail.com> X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_00,DATE_IN_PAST_03_06, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no 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 --62exsovixfg2cfix Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, On Sat, May 06, 2023 at 05:54:34PM +0200, Jakob Hauser wrote: > The rt5033-battery fuelgauge can't get a status by itself. The rt5033-cha= rger > can, let's get this value. >=20 > Tested-by: Raymond Hackley > Signed-off-by: Jakob Hauser > --- > drivers/power/supply/rt5033_battery.c | 24 ++++++++++++++++++++++++ > 1 file changed, 24 insertions(+) >=20 > 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 > =20 > +static int rt5033_battery_get_status(struct i2c_client *client) > +{ > + struct power_supply *charger; > + union power_supply_propval val; > + int ret; > + > + charger =3D power_supply_get_by_name("rt5033-charger"); > + if (!charger) > + return POWER_SUPPLY_STATUS_UNKNOWN; > + > + ret =3D power_supply_get_property(charger, POWER_SUPPLY_PROP_STATUS, &v= al); > + if (ret) { > + power_supply_put(charger); > + return POWER_SUPPLY_STATUS_UNKNOWN; > + } struct rt5033_battery *battery =3D i2c_get_clientdata(client); ret =3D power_supply_get_property_from_supplier(battery->psy, POWER_SUPPLY_= PROP_STATUS, &val); if (ret) val.intval =3D 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 =3D i2c_get_clientdata(client); > @@ -84,6 +104,9 @@ static int rt5033_battery_get_property(struct power_su= pply *psy, > case POWER_SUPPLY_PROP_CAPACITY: > val->intval =3D rt5033_battery_get_capacity(battery->client); > break; > + case POWER_SUPPLY_PROP_STATUS: > + val->intval =3D rt5033_battery_get_status(battery->client); > + break; > default: > return -EINVAL; > } > @@ -96,6 +119,7 @@ static enum power_supply_property rt5033_battery_props= [] =3D { > POWER_SUPPLY_PROP_VOLTAGE_OCV, > POWER_SUPPLY_PROP_PRESENT, > POWER_SUPPLY_PROP_CAPACITY, > + POWER_SUPPLY_PROP_STATUS, > }; > =20 > static const struct regmap_config rt5033_battery_regmap_config =3D { > --=20 > 2.39.2 >=20 Otherwise LGTM. -- Sebastian --62exsovixfg2cfix Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEE72YNB0Y/i3JqeVQT2O7X88g7+poFAmRY3nMACgkQ2O7X88g7 +ppbow/+Jb4FCPWzC6F8Q70mCz+KMOZJtpuJD1RsXNBzsnYaI5lcQjbBZJZbSbi2 ojoT8X2yOaqtpMejD9eAqjWO6xXUDge161AojcuiBo7c5Fs7v5WMU/+QrhWn3moG kSAGxS2FI+0YhduSXNqm++MuTVTmYvNVkLRcX2lDGtSOEbx8Wb9kYiKsqDFCf3Af JsorEUTCqB6HCPip3I3YfgOcYRps/DFKgcggeZIXNiNwYEpza+vcE5oHXLXzzk+R HBQcvg9HPC1iCbFYIb79wgtOzKd3t9qrVJDL579zy8620cfDytm/soIZcFBqQEZV GM8MtyL8VvMQk7qujXY7V9PDoFTNWhY5fAX41hJkw6LCvPIfgzSEMWSSlZgdR4bc m8yctkujP4rvSe1dsaZzwI+d4+Yer1e4ECYG6p8jOalkMzwjTZNUVmNdTUH+i4oO dfmi2uxIvdW3xl5Uhd4/Mnobzi+z8WEGkfkRhrOd4UKmyUFP3s6hZ0lIniZMiqnF iF5AlorDb3ExNVOH3hWNGUyKlmPr/JKCh0vgRinQ47IDFxyynMtOPU9NHwKarF9J uQGvwQaPnpyRwXw9fqWLyW42NjKtKdIn9H8A1aQqLq3LlYPGWOes38kgqW1+coaV WIB2J/rhlHiT8hHTbQ8tI0vDpryg8Q1RvTrF8LITUXGgEU+7tcA= =OyXU -----END PGP SIGNATURE----- --62exsovixfg2cfix--