lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Wed, 6 Jul 2016 06:34:53 +0200
From:	Michael Haas <haas@...puterlinguist.org>
To:	icenowy@...c.xyz, "wens@...e.org" <wens@...e.org>,
	"maxime.ripard@...e-electrons.com" <maxime.ripard@...e-electrons.com>,
	"sre@...nel.org" <sre@...nel.org>,
	"dbaryshkov@...il.com" <dbaryshkov@...il.com>,
	"dwmw2@...radead.org" <dwmw2@...radead.org>
Cc:	"robh+dt@...nel.org" <robh+dt@...nel.org>,
	"mark.rutland@....com" <mark.rutland@....com>,
	"linux@...linux.org.uk" <linux@...linux.org.uk>,
	"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
	"linux-arm-kernel@...ts.infradead.org" 
	<linux-arm-kernel@...ts.infradead.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"linux-pm@...r.kernel.org" <linux-pm@...r.kernel.org>,
	"linux-sunxi@...glegroups.com" <linux-sunxi@...glegroups.com>
Subject: Re: [linux-sunxi] [PATCH 2/4] power: add axp20x-battery driver

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





Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ