devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Haas <haas-bdq14YP6qtSV9CzYT+GlPGD2FQJk+8+b@public.gmane.org>
To: icenowy-ymACFijhrKM@public.gmane.org,
	"wens-jdAy2FN1RRM@public.gmane.org"
	<wens-jdAy2FN1RRM@public.gmane.org>,
	"maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org"
	<maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
	"sre-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org"
	<sre-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	"dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org"
	<dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	"dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org"
	<dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
Cc: "robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org"
	<robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	"mark.rutland-5wv7dgnIgG8@public.gmane.org"
	<mark.rutland-5wv7dgnIgG8@public.gmane.org>,
	"linux-I+IVW8TIWO2tmTQ+vhA3Yw@public.gmane.org"
	<linux-I+IVW8TIWO2tmTQ+vhA3Yw@public.gmane.org>,
	"devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org"
	<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
	"linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org"
	<linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: Re: [PATCH 2/4] power: add axp20x-battery driver
Date: Wed, 6 Jul 2016 06:34:53 +0200	[thread overview]
Message-ID: <577C8A6D.8000409@computerlinguist.org> (raw)
In-Reply-To: <4101467707611-tvSLaYVQeptuio3avFS2gg@public.gmane.org>

Hi There,

On 05.07.2016 10:33, Icenowy Zheng wrote:
> On 01.07.2016 11:29, Icenowy Zheng wrote:

>>>   +
>>>   +static enum power_supply_property axp22x_battery_properties[] = {
>>>   + POWER_SUPPLY_PROP_CAPACITY,
>>>   + POWER_SUPPLY_PROP_HEALTH,
>>>   + POWER_SUPPLY_PROP_PRESENT,
>>>   + POWER_SUPPLY_PROP_STATUS,
>>>   + POWER_SUPPLY_PROP_CURRENT_NOW,
>>>   + POWER_SUPPLY_PROP_VOLTAGE_NOW,
>>>   +};

Here's what Bruno's driver supports:

static enum power_supply_property axp20x_battery_power_properties[] = {
     POWER_SUPPLY_PROP_PRESENT,
     POWER_SUPPLY_PROP_ONLINE,
     POWER_SUPPLY_PROP_STATUS,
     POWER_SUPPLY_PROP_VOLTAGE_NOW,
     POWER_SUPPLY_PROP_CURRENT_NOW,
     POWER_SUPPLY_PROP_CURRENT_MAX,
     POWER_SUPPLY_PROP_HEALTH,
     POWER_SUPPLY_PROP_TECHNOLOGY,
     POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN,
     POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN,
     /* POWER_SUPPLY_PROP_POWER_NOW, */
     POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
     /* POWER_SUPPLY_PROP_CHARGE_NOW, */
     POWER_SUPPLY_PROP_CAPACITY,
     POWER_SUPPLY_PROP_TEMP,
     POWER_SUPPLY_PROP_TEMP_ALERT_MIN,
     POWER_SUPPLY_PROP_TEMP_ALERT_MAX,
};

>>>   +
>>>   +static int axp20x_battery_probe(struct platform_device *pdev)
>>>   +{
>>>   + struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent);
>>>   + struct power_supply_config psy_cfg = {};
>>>   + struct axp20x_battery *power;
>>>   + static const char * const axp22x_irq_names[] = {
>>>   + "BATT_PLUGIN", "BATT_REMOVAL", "BATT_ENT_ACT_MODE",
>>>   + "BATT_EXIT_ACT_MODE", "CHARG", "CHARG_DONE", NULL };


And here are the interrupts handled:

static const char * const irq_names[] = { "BATT_HOT", "BATT_COLD",
         "BATT_PLUGIN", "BATT_REMOVAL", "BATT_ACTIVATE",
         "BATT_ACTIVATED", "BATT_CHARGING", "BATT_CHARGED",
         "BATT_CHG_CURR_LOW", "BATT_POWER_LOW_WARN",
         "BATT_POWER_LOW_CRIT" };



There are a couple of issues with the version of Bruno's driver that I have:

* power management is disabled (in the driver, not in the charger) - 
think suspend/resume
* the temperature sensor data is not turned into a temperature value 
correctly
* the IRQ handlers need to be cleaned up (remove logging)
* device tree binding documentation is missing

Other than that, it's basically working and I have been using it at 
least for some testing.

The device tree bindings support:
* OCV curve support
* battery resistance
* battery capacity
* temp sensor settings

You can find my copy of Bruno's driver here:
https://github.com/mhaas/linux-sunxi/blob/axp209-charger/drivers/power/axp20x_fuel_gauge.c

Thanks,

Michael

  parent reply	other threads:[~2016-07-06  4:34 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-01  9:29 [PATCH 1/4] mfd: axp20x: add adc volatile ranges for axp22x Icenowy Zheng
     [not found] ` <20160701092926.32005-1-icenowy-ymACFijhrKM@public.gmane.org>
2016-07-01  9:29   ` [PATCH 2/4] power: add axp20x-battery driver Icenowy Zheng
     [not found]     ` <20160701092926.32005-2-icenowy-ymACFijhrKM@public.gmane.org>
2016-07-05  5:26       ` Michael Haas
     [not found]         ` <577B44FD.6040404-cl+VPiYnx/1AfugRpC6u6w@public.gmane.org>
2016-07-05  8:33           ` Icenowy Zheng
     [not found]             ` <4101467707611-tvSLaYVQeptuio3avFS2gg@public.gmane.org>
2016-07-05  9:25               ` maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8
2016-07-05 10:09                 ` Icenowy Zheng
2016-07-05 12:45                 ` Bruno Prémont
2016-07-06  4:34               ` Michael Haas [this message]
     [not found]                 ` <577C8A6D.8000409-bdq14YP6qtSV9CzYT+GlPGD2FQJk+8+b@public.gmane.org>
2016-07-06  7:48                   ` Icenowy Zheng
2016-07-05  8:47           ` Icenowy Zheng
     [not found]             ` <112861467708458-tvSLaYVQeptuio3avFS2gg@public.gmane.org>
2016-07-05 12:43               ` Bruno Prémont
2016-07-01  9:29   ` [PATCH 3/4] ARM: sun8i: add axp20x-battery node for axp22x Icenowy Zheng
2016-07-01  9:29   ` [PATCH 4/4] ARM: sun8i: enable axp22x-battery on A23/33 Q8 tablets Icenowy Zheng
2016-08-05  7:46   ` [PATCH 1/4] mfd: axp20x: add adc volatile ranges for axp22x Lee Jones

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=577C8A6D.8000409@computerlinguist.org \
    --to=haas-bdq14yp6qtsv9czyt+glpgd2fqjk+8+b@public.gmane.org \
    --cc=dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
    --cc=icenowy-ymACFijhrKM@public.gmane.org \
    --cc=linux-I+IVW8TIWO2tmTQ+vhA3Yw@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    --cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
    --cc=maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=sre-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=wens-jdAy2FN1RRM@public.gmane.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).