本文主要是介绍MT6735 - battery相关笔记 (充电、电池状态、zvc、driver与service通信),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
充电
kernel-3.18/drivers/misc/mediatek/include/mt-plat/mt6735/include/mach/mt_charging.h#define AC_CHARGER_CURRENT CHARGE_CURRENT_800_00_MA //先跑这个kernel-3.18/arch/arm64/boot/dts/mt6735.dtsi //好像不是用这个啊,被重赋值了,是alps/kernel-3.18/arch/arm64/boot/dts/xxx_public_3565u.dtsac_charger_current = <80000 >; /* Unit: 0.01 mA */ //再通过dt跑这个,没这个dt就直接用上面那macro了/kernel-3.18/drivers/power/mediatek/battery_common.c__batt_init_cust_data_from_cust_header();#if defined(BATTERY_DTS_SUPPORT) && defined(CONFIG_OF)__batt_init_cust_data_from_dt();#endif什么是 wake charge state ???流程分析battery_probebatt_init_cust_data();//这里从dts读参数kthread_run(bat_thread_kthread, NULL, "bat_thread_kthread");charger_hv_detect_sw_workaround_init();//?bat_thread_kthread{while (1) {BAT_thread();//wait_event(bat_thread_wq, (bat_thread_timeout == KAL_TRUE));//等PMIC设置bat_thread_timeout}}BAT_thread{mt_battery_charger_detect_check();//[BAT_thread]Cable in, CHR_Type_num=4mt_battery_GetBatteryData //这个比较重要,会获取各个参数,电池电压,充电电流,电池温度,等mt_battery_thermal_check();//热敏电阻温度mt_battery_notify_check();//mt_battery_charging_algorithmBAT_ConstantCurrentModeAction//case CHR_CC: 恒流充电pchr_turn_on_charging //这里设置充电电流select_charging_current()battery_charging_control(CHARGING_CMD_SET_CV_VOLTAGE, &cv_voltage);// == charging_set_cv_voltage 设置 0x0E寄存器 CTRL_VBATcharging_full_check()//什么时候判断为full??battery_charging_control(CHARGING_CMD_GET_CHARGING_STATUS, &status);ncp1854_read_interface((unsigned char) (NCP1854_CON0)...)//0号寄存器返回值6 == chargeDone,5=charging/*这个寄存器什么时候置6 ? 看着好像是RO的* 电压升高到某个值(Vrechg),同时电流降低到某个值(Ieoc) * Vrechg 和 Vchg相关(97% ?), Vchg通过VBAT_SET bits CTRL_VBAT[5:0] //现在是0x2A 4.35v* Ieoc通过IBAT_SET - bits IEOC[2:0] 100~275 默认 150mA*//// DPP是什么/** 充电电流 IBAT_SET bit ICHG[3:0] and ICHG_HIGH* Iinlim* Iinlim_set Iinlim_TA* Input Voltage Based Automatic Charge Current -- ILIM! = 0 && ILIM2 = 1 (CTRL2 AICL_EN)* 温度也会影响Ichg,junction temperature management*/mt_battery_update_status();mt_kpoc_power_off_check();}do_jeita_state_machine //没用jeita ¥¥¥¥¥¥select_jeita_cv //根据温度选择充电电压battery_charging_control(CHARGING_CMD_SET_CV_VOLTAGE, &cv_voltage);pmic_thread_kthread //pmic中断 mediatek, pmic-eint === GPIO206 interrupts = <206 IRQ_TYPE_LEVEL_HIGH>;//但是在excel里,GPIO最大只有203 ???,dws EINT那一栏有206,而且配置好了while(1){pm
这篇关于MT6735 - battery相关笔记 (充电、电池状态、zvc、driver与service通信)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!