AXP803 Battery Charger Support
#8
So far I have found three places where battery parameters get defined:

In the devicetree (pine64.dts here from the current longsleep kernel):

Code:
pmu0@0 {
           compatible = "allwinner,pmu0";
           device_type = "pmu0";
           pmu_batdeten = <0x00000001>;
           pmu_init_chgend_rate = <0x00000014>;
           pmu_init_chg_enabled = <0x00000001>;
           pmu_init_adc_freq = <0x00000320>;
           pmu_init_adcts_freq = <0x00000320>;
           pmu_init_chg_pretime = <0x00000046>;
           pmu_init_chg_csttime = <0x000002d0>;
           pmu_batt_cap_correct = <0x00000001>;
           pmu_chg_end_on_en = <0x00000000>;
           pmu_pwroff_vol = <0x00000ce4>;
           pmu_pwron_vol = <0x00000a28>;
           pmu_powkey_off_delay_time = <0x00000000>;
           pmu_pwrok_time = <0x00000040>;
           pmu_reset_shutdown_en = <0x00000001>;
           pmu_restvol_adjust_time = <0x0000003c>;
           pmu_ocv_cou_adjust_time = <0x0000003c>;
           pmu_vbusen_func = <0x00000001>;
           pmu_reset = <0x00000000>;
           pmu_IRQ_wakeup = <0x00000001>;
           pmu_hot_shutdowm = <0x00000001>;
           pmu_inshort = <0x00000000>;
           pmu_bat_shutdown_ltf = <0x00000c80>;
           pmu_bat_shutdown_htf = <0x000000ed>;
           status = "okay";
           pmu_id = <0x00000006>;
           pmu_twi_addr = <0x00000034>;
           pmu_twi_id = <0x00000001>;
           pmu_irq_id = <0x00000040>;
           pmu_chg_ic_temp = <0x00000000>;
           pmu_battery_rdc = <0x00000058>;
           pmu_battery_cap = <0x000012c0>;
           pmu_runtime_chgcur = <0x000001c2>;
           pmu_suspend_chgcur = <0x000005dc>;
           pmu_shutdown_chgcur = <0x000005dc>;
           pmu_init_chgvol = <0x00001068>;
           pmu_ac_vol = <0x00000fa0>;
           pmu_ac_cur = <0x00000dac>;
           pmu_usbpc_vol = <0x00001130>;
           pmu_usbpc_cur = <0x000001f4>;
           pmu_battery_warning_level1 = <0x0000000f>;
           pmu_battery_warning_level2 = <0x00000000>;
           pmu_chgled_func = <0x00000000>;
           pmu_chgled_type = <0x00000000>;
           pmu_bat_para1 = <0x00000000>;
           pmu_bat_para2 = <0x00000000>;
           pmu_bat_para3 = <0x00000000>;
           pmu_bat_para4 = <0x00000000>;
           pmu_bat_para5 = <0x00000000>;
           pmu_bat_para6 = <0x00000000>;
           pmu_bat_para7 = <0x00000001>;
           pmu_bat_para8 = <0x00000001>;
           pmu_bat_para9 = <0x00000002>;
           pmu_bat_para10 = <0x00000003>;
           pmu_bat_para11 = <0x00000004>;
           pmu_bat_para12 = <0x0000000a>;
           pmu_bat_para13 = <0x00000011>;
           pmu_bat_para14 = <0x0000001a>;
           pmu_bat_para15 = <0x00000029>;
           pmu_bat_para16 = <0x0000002e>;
           pmu_bat_para17 = <0x00000033>;
           pmu_bat_para18 = <0x00000038>;
           pmu_bat_para19 = <0x0000003b>;
           pmu_bat_para20 = <0x00000041>;
           pmu_bat_para21 = <0x00000045>;
           pmu_bat_para22 = <0x0000004b>;
           pmu_bat_para23 = <0x0000004f>;
           pmu_bat_para24 = <0x00000053>;
           pmu_bat_para25 = <0x00000059>;
           pmu_bat_para26 = <0x0000005f>;
           pmu_bat_para27 = <0x00000062>;
           pmu_bat_para28 = <0x00000064>;
           pmu_bat_para29 = <0x00000064>;
           pmu_bat_para30 = <0x00000064>;
           pmu_bat_para31 = <0x00000064>;
           pmu_bat_para32 = <0x00000064>;
           pmu_bat_temp_enable = <0x00000001>;
           pmu_bat_charge_ltf = <0x000008d5>;
           pmu_bat_charge_htf = <0x00000184>;
           pmu_bat_temp_para1 = <0x00001d2a>;
           pmu_bat_temp_para2 = <0x00001180>;
           pmu_bat_temp_para3 = <0x00000dbe>;
           pmu_bat_temp_para4 = <0x00000ae2>;
           pmu_bat_temp_para5 = <0x000008af>;
           pmu_bat_temp_para6 = <0x000006fc>;
           pmu_bat_temp_para7 = <0x000005a8>;
           pmu_bat_temp_para8 = <0x000003c9>;
           pmu_bat_temp_para9 = <0x00000298>;
           pmu_bat_temp_para10 = <0x000001d2>;
           pmu_bat_temp_para11 = <0x00000189>;
           pmu_bat_temp_para12 = <0x0000014d>;
           pmu_bat_temp_para13 = <0x0000011b>;
           pmu_bat_temp_para14 = <0x000000f2>;
           pmu_bat_temp_para15 = <0x000000b3>;
           pmu_bat_temp_para16 = <0x00000086>;
           pmu_powkey_off_time = <0x00001770>;
           pmu_powkey_off_func = <0x00000000>;
           pmu_powkey_off_en = <0x00000001>;
           pmu_powkey_long_time = <0x000005dc>;
           pmu_powkey_on_time = <0x000003e8>;
           power_start = <0x00000000>;
       };
       regu@0 {
           compatible = "allwinner,pmu0_regu";
           regulator_count = <0x00000017>;
           status = "okay";
           device_type = "pmu0_regu";
           regulator1 = "axp81x_dcdc1 none vcc-nand vcc-emmc vcc-sdc vcc-usb-30 vcc-io vcc-pd";
           regulator2 = "axp81x_dcdc2 none vdd-cpua";
           regulator3 = "axp81x_dcdc3 none";
           regulator4 = "axp81x_dcdc4 none";
           regulator5 = "axp81x_dcdc5 none vcc-dram";
           regulator6 = "axp81x_dcdc6 none vdd-sys";
           regulator7 = "axp81x_dcdc7 none";
           regulator8 = "axp81x_rtc none";
           regulator9 = "axp81x_aldo1 none vdd-csi-led iovdd-csi vcc-pe";
           regulator10 = "axp81x_aldo2 none vcc-pl";
           regulator11 = "axp81x_aldo3 none vcc-avcc vcc-pll";
           regulator12 = "axp81x_dldo1 none vcc-hdmi-33";
           regulator13 = "axp81x_dldo2 none vcc-mipi";
           regulator14 = "axp81x_dldo3 none avdd-csi";
           regulator15 = "axp81x_dldo4 none vcc-deviceio";
           regulator16 = "axp81x_eldo1 none vcc-cpvdd vcc-wifi-io vcc-pc vcc-pg";
           regulator17 = "axp81x_eldo2 none vcc-lcd-0";
           regulator18 = "axp81x_eldo3 none dvdd-csi-18";
           regulator19 = "axp81x_fldo1 none vcc-hsic-12";
           regulator20 = "axp81x_fldo2 none vdd-cpus";
           regulator21 = "axp81x_gpio0ldo none vcc-ctp";
           regulator22 = "axp81x_gpio1ldo none";
           regulator23 = "axp81x_dc1sw none vcc-lvds vcc-dsi-33";
};

In the AXP driver in the linux kernel:  /drivers/power/axp_power/axp-cfg.h

Code:
...
#define INTCHGCUR        300000        //set initial charging current limite
#define SUSCHGCUR        1000000        //set suspend charging current limite
#define RESCHGCUR        INTCHGCUR    //set resume charging current limite
#define CLSCHGCUR        SUSCHGCUR    //set shutdown charging current limite
#define INTCHGVOL        4200000        //set initial charing target voltage
#define INTCHGENDRATE        10        //set initial charing end current rate
#define INTCHGENABLED        1        //set initial charing enabled
#define INTADCFREQ        25        //set initial adc frequency
#define INTADCFREQC        100        //set initial coulomb adc coufrequency
#define INTCHGPRETIME        50        //set initial pre-charging time
#define INTCHGCSTTIME        480        //set initial pre-charging time
#define BATMAXVOL        4200000        //set battery max design volatge
#define BATMINVOL            3500000            //set battery min design volatge
...



There is also in the AXP driver:  /drivers/power/axp_power/axp-board.c


Code:
...
static struct power_supply_info battery_data ={
    .name ="PTI PL336078",
    .technology = POWER_SUPPLY_TECHNOLOGY_LiFe,
    .voltage_max_design = 4200000,
    .voltage_min_design = 3500000,
    .use_for_apm = 1,
};


static struct axp_supply_init_data axp_sply_init_data = {
    .battery_info = &battery_data,
    .chgcur = 1500000,
    .chgvol = 4200000,
    .chgend = 10,
    .chgen = 1,
    .sample_time = 800,
    .chgpretime = 50,
    .chgcsttime = 720,
};
...

Those two structures are also what one gets from sysfs from userspace, so my money is on those entries to be the actual values used by the battery charger code in the driver, but I have to do more reading to verify that.

/sys/class/power_supply/battery/uevent:

Code:
ubuntu@pine64:/sys/class/power_supply/battery$ cat uevent
POWER_SUPPLY_NAME=battery
POWER_SUPPLY_MODEL_NAME=battery
POWER_SUPPLY_STATUS=Full
POWER_SUPPLY_PRESENT=0
POWER_SUPPLY_ONLINE=0
POWER_SUPPLY_HEALTH=Good
POWER_SUPPLY_TECHNOLOGY=LiFe
POWER_SUPPLY_VOLTAGE_MAX_DESIGN=4200000
POWER_SUPPLY_VOLTAGE_MIN_DESIGN=3300
POWER_SUPPLY_VOLTAGE_NOW=0
POWER_SUPPLY_CURRENT_NOW=0
POWER_SUPPLY_ENERGY_FULL_DESIGN=4800
POWER_SUPPLY_CAPACITY=100
POWER_SUPPLY_TEMP=300

I have a question for the real kernel hackers:

The devicetree has two entries, one for
Code:
...
pmu0@0 {
           compatible = "allwinner,pmu0";
...


and one for


Code:
...
 regu@0 {
           compatible = "allwinner,pmu0_regu";
...

I only find


Code:
drivers/power/axp_power/axp-mem-device.c:       { .compatible = "allwinner,pmu0_regu", },


referenced when I search through the sources, no reference for the entry with

Code:
 compatible = "allwinner,pmu0";

Does that mean that entry does not get read anywhere and so the battery definiton from the dts does not get used at all atm?


Attached Files
.pdf   A64-SOPine-0V02.pdf (Size: 56.07 KB / Downloads: 549)
Come have a chat in the Pine IRC channel >>


Messages In This Thread
AXP803 Battery Charger Support - by xalius - 06-18-2016, 03:28 AM
RE: AXP803 Battery Charger Support - by tllim - 06-18-2016, 04:16 PM
RE: AXP803 Battery Charger Support - by pfeerick - 06-18-2016, 09:59 PM
RE: AXP803 Battery Charger Support - by xalius - 06-19-2016, 06:19 AM
RE: AXP803 Battery Charger Support - by pfeerick - 06-19-2016, 07:22 PM
RE: AXP803 Battery Charger Support - by tllim - 06-20-2016, 07:38 AM
RE: AXP803 Battery Charger Support - by xalius - 06-19-2016, 07:31 PM
RE: AXP803 Battery Charger Support - by xalius - 06-20-2016, 02:55 PM
RE: AXP803 Battery Charger Support - by longsleep - 06-20-2016, 04:25 PM
RE: AXP803 Battery Charger Support - by drid - 12-03-2017, 02:24 PM
RE: AXP803 Battery Charger Support - by xalius - 12-03-2017, 03:56 PM
RE: AXP803 Battery Charger Support - by xalius - 12-22-2017, 05:23 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Programming languages support under PINE64 baryluk 6 12,287 09-23-2020, 11:46 PM
Last Post: Phillip Bell
Wink Pine64 Will support Freenas or openmediavault ? joe 1 4,960 04-13-2017, 07:44 AM
Last Post: xalius
  Remote Desktop Support? Rochambeaux 20 29,201 10-01-2016, 05:08 PM
Last Post: HayseedGeek
  Binfmt_misc support cztian 1 3,693 08-17-2016, 11:49 PM
Last Post: longsleep
Question Joystick/Gamepad support Drakuwa 3 5,967 08-10-2016, 10:12 AM
Last Post: xalius
Big Grin Funny ! Support Intel x86 linux applications on ARM-based ( PINE64 ) not freeware joe 10 16,357 08-09-2016, 05:59 PM
Last Post: dkryder
  Camera support - Ubuntu Xenial 16.04 LTS @lex 3 5,200 08-07-2016, 03:47 AM
Last Post: romansavrulin
  Virtualization Support soccercheng 12 17,385 07-14-2016, 11:04 AM
Last Post: mont3z
  distro with kernel support for DVB-T dongles? mkaut 2 4,608 07-02-2016, 02:36 PM
Last Post: mkaut
  XFS Support? utdrmac 2 3,342 06-30-2016, 01:44 AM
Last Post: longsleep

Forum Jump:


Users browsing this thread: 1 Guest(s)