From: Maxime Ripard <maxime.ripard@free-electrons.com>
To: Icenowy Zheng <icenowy@aosc.xyz>
Cc: "Mark Rutland" <mark.rutland@arm.com>,
devicetree@vger.kernel.org, quentin@free-electrons.com,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
"Michael Haas" <haas@computerlinguist.org>,
"Russell King" <linux@armlinux.org.uk>,
"Chen-Yu Tsai" <wens@csie.org>,
"Rob Herring" <robh+dt@kernel.org>,
"Sebastian Reichel" <sre@kernel.org>,
"Bruno Prémont" <bonbons@linux-vserser.org>,
"Lee Jones" <lee.jones@linaro.org>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 2/4] power: add axp20x-battery driver
Date: Mon, 10 Oct 2016 15:12:05 +0200 [thread overview]
Message-ID: <20161010131205.GK3462@lukather> (raw)
In-Reply-To: <20161010125726.GJ3462@lukather>
[-- Attachment #1.1: Type: text/plain, Size: 1733 bytes --]
Adding the real Quentin address
On Mon, Oct 10, 2016 at 02:57:26PM +0200, Maxime Ripard wrote:
> Hi Icenowy,
>
> On Sun, Oct 09, 2016 at 02:27:12PM +0800, Icenowy Zheng wrote:
> > + case POWER_SUPPLY_PROP_CURRENT_NOW:
> > + ret = regmap_read(power->regmap, AXP20X_BATT_DISCHRG_I_H, &dh);
> > + if (ret)
> > + return ret;
> > + ret = regmap_read(power->regmap, AXP20X_BATT_DISCHRG_I_L, &dl);
> > + if (ret)
> > + return ret;
> > + /* it's a 12 bit integer, high 8-bit is stored in dh */
> > + val->intval = dh << 4 | dl >> 4;
> > + break;
> > + case POWER_SUPPLY_PROP_VOLTAGE_NOW:
> > + ret = regmap_read(power->regmap, AXP20X_BATT_V_H, &dh);
> > + if (ret)
> > + return ret;
> > + ret = regmap_read(power->regmap, AXP20X_BATT_V_L, &dl);
> > + if (ret)
> > + return ret;
> > + /* it's a 12 bit integer, high 8-bit is stored in dh */
> > + val->intval = dh << 4 | dl >> 4;
> > + /* The formula below is from axp22_vbat_to_mV function
> > + * of Allwinner 3.4 kernel.
> > + */
> > + val->intval = val->intval * 1100 / 1000;
> > + break;
>
> I really feel that this should be implemented through a IIO driver
> (like the AXP288). This is especially true for the AXP209 and its
> multiple GPIOs that can be muxed to a general purpose ADC, but it's
> also true for the AXP221 / 223 TS pin that can also be used as an ADC.
>
> Quentin has been working on this lately for the AXP209, feel free to
> sync with him to support the AXP22*
>
> Maxime
>
> --
> Maxime Ripard, Free Electrons
> Embedded Linux and Kernel engineering
> http://free-electrons.com
--
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2016-10-10 13:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-09 6:27 [PATCH v2 1/4] mfd: axp20x: add adc volatile ranges for axp22x Icenowy Zheng
2016-10-09 6:27 ` [PATCH v2 2/4] power: add axp20x-battery driver Icenowy Zheng
2016-10-10 12:57 ` Maxime Ripard
2016-10-10 13:12 ` Maxime Ripard [this message]
2016-10-09 6:27 ` [PATCH v2 3/4] ARM: dts: add battery node for axp20x/axp22x dtsi Icenowy Zheng
2016-10-09 6:27 ` [PATCH v2 4/4] ARM: sunxi: enable battery on reference design tablets Icenowy Zheng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161010131205.GK3462@lukather \
--to=maxime.ripard@free-electrons.com \
--cc=bonbons@linux-vserser.org \
--cc=devicetree@vger.kernel.org \
--cc=haas@computerlinguist.org \
--cc=icenowy@aosc.xyz \
--cc=lee.jones@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=mark.rutland@arm.com \
--cc=quentin@free-electrons.com \
--cc=robh+dt@kernel.org \
--cc=sre@kernel.org \
--cc=wens@csie.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).