CV:Constant Voltage恒压

SMMB charger:Switch-ModeBattery Charger and Boost peripheral开关模式电池充电器和升压外围设备

OCV:Open circuitvoltage

EOC:End OfCharge充电结束

UUC:UnusableCapacity不可用电量

对应的源代码文件为\kernel\drivers\power\qpnp-vm-bms.c,高通QPNP电压模式的PMIC电池管理系统(Qualcomm'sQPNP Voltage-Mode(VM) PMIC Battery Management System),提供接口给客户端来读取电池相关属性,它的主要功能是基于周期性采样VBAT(vattery voltage)来计算SOC(state ofcharge)

下面学习kernel\Documentation\devicetree\bindings\power\qpnp-vm-bms.txt

父节点需要的属性如下

见kernel\arch\arm\boot\dts\qcom\msm-pm8909.dtsi文件的pm8909_bms: qcom,vmbms节点

- compatible : Must be "qcom,qpnp-vm-bms" for the BM driver.

- reg              :Offset and length of the PMIC peripheral register map.

比如reg = <0x4000 0x100>;


- interrupts   : The interrupt mappings.

                The format should be

                <slave-id peripheral-idinterrupt-number>.

比如

interrupts =       <0x0 0x40 0x0>,

                  <0x00x40 0x3>,

                  <0x00x40 0x4>,

                  <0x00x40 0x5>;

- interrupt-names : names for the mappedbms interrupt

              Thefollowing interrupts are required:

              0: leave CV state离开恒压状态

              1: enter CV state

              2: good ocv generated

              3: ocv_thr

              4: fifo update

              5: fsm state changed

比如

interrupt-names = "leave_cv",

                "ocv_thr",

                "fifo_update_done",

                "fsm_state_change";

此外,可选的子节点可包含:

- qcom,batt-pres-status : A subnode with aregister address for the SMBB

              batteryinterface's BATT_PRES_STATUS register. If this node is

              added,then the BMS will try to detect offmode battery removal

              viathe battery interface's offmode battery removal circuit.

这是带有一个关于SMMB电池接口寄存器BATT_PRES_STATUS地址的子节点,如果增加了此节点,BMS将会尝试通过电池接口的offmode电池接插电路检测offmode电池接插

例如

qcom,batt-pres-status@1208 {

    reg= <0x1208 0x1>;

};

电池曲线:

- qcom,battery-data : A phandle to a nodecontaining the available batterydata

  profiles.See the batterydata bindings documentation for more

  details.

此节点的值是一个phandle,它指向一个包含有效电池曲线数据的节点,详见kernel\Documentation\devicetree\bindings\batterydata\batterydata.txt

在kernel\arch\arm\boot\dts\qcom\msm8909-qrd-skue.dtsi中定义

/ {
qrd_batterydata:qcom,battery-data {
qcom,rpull-up-kohm= <0>; qcom,vref-batt-therm= <1800000>; #include"batterydata-qrd-skue-4v35-2000mah.dtsi" }; };
&pm8909_bms {
status= "okay";
qcom,resume-soc= <95>;
qcom,use-reported-soc;
qcom,force-bms-active-on-charger;
qcom,battery-data = <&qrd_batterydata>; };

父节点需要的属性

- qcom,v-cutoff-uv : cutoff voltage wherethe battery is considered dead in

                     micro-volts(微伏).

关机电压,用于计算SOC,如修改关机电压,除了修改这里,还需要修改电池曲线数据的qcom,v-cutoff-uv,其实最好是用电池曲线数据里的。

比如qcom,v-cutoff-uv = <3400000>;

- qcom,max-voltage-uv : maximum voltage forthe battery in micro-volts.

电池最大的电压,单位为毫伏,比如qcom,max-voltage-uv =<4200000>;

- qcom,r-conn-mohm : connector resistancein milli-ohms.

连接器电阻,如qcom,r-conn-mohm = <0>;

- qcom,shutdown-soc-valid-limit : If theocv upon restart is within this

                     distanceof the shutdown ocv, the BMS will try to force

                     thenew SoC to the old one to provide charge continuity.

                     Thatis to say,

                            if(abs(shutdown-soc - current-soc) < limit)

                            thenuse old SoC.

如qcom,shutdown-soc-valid-limit =<100>;

- qcom,low-soc-calculate-soc-threshold :The SoC threshold for when

                     theperiodic calculate_soc work speeds up. This ensures

                     SoCis updated in userspace constantly when we are near

                     shutdown.

当SOC低于此阈值,calculate_soc缩短工作周期,这样可以在接近关机的时候不断地更新用户空间的SOC。如qcom,low-soc-calculate-soc-threshold =<15>;

- qcom,low-voltage-threshold : The batteryvoltage threshold in micro-volts for

                     whenthe BMS tries to wake up and hold a wakelock to

                     ensurea clean shutdown.

低压阈值,用于关机,当达到此值BMS尝试唤醒和持有唤醒锁来保证一个干净的关机。如qcom,low-voltage-threshold = <3450000>;

  • qcom,low-voltage-calculate-soc-ms : Thetime period between subsequent

                   SoCrecalculations when the current voltage is below
    
                   qcom,low-voltagethreshold. This takes precedence over
    
                   qcom,low-soc-calculate-soc-ms.

当电池电压低于qcom,low-voltage threshold,随后重新计算soc的时间周期,者优先于qcom,low-soc-calculate-soc-ms,如qcom,low-voltage-calculate-soc-ms = <1000>;。

  • qcom,low-soc-calculate-soc-ms : The timeperiod between subsequent

                   SoCrecalculations when the current SoC is below
    
                   qcom,low-soc-calculate-soc-threshold.This takes
    
                   precedenceover qcom,calculate-soc-ms.

当前SOC低于qcom,low-soc-calculate-soc-threshold时,随后重新计算SOC的时间周期,这优先于qcom,calculate-soc-ms,如low-soc-calculate-soc-ms = <5000>;

  • qcom,calculate-soc-ms : The time periodbetween subsequent SoC

                   recalculationswhen the current SoC is above or equal
    
                   qcom,low-soc-calculate-soc-threshold.

当前SOC>= qcom,low-soc-calculate-soc-threshold时的计算soc的时间周期。如qcom,calculate-soc-ms =<20000>;

  • qcom,volatge-soc-timeout-ms : The timeoutperiod after which the module starts

                   reportingvolage based SOC and does not use the VMBMS
    
                   algorithmfor SOC calculation.

如果没有使用VMBMS算法来计算SOC,模块在此时间后基于SOC来报告电压。如qcom,volatge-soc-timeout-ms =<60000>;

  • qcom,bms-vadc: Corresponding VADCdevice's phandle.

相应的VADC设备的phandle,qcom,bms-vadc = <&pm8909_vadc>;

  • qcom,bms-adc_tm: Corresponding ADC_TMdevice's phandle to set recurring

                      measurements andreceive notifications for vbatt.

相应ADC_TM设备的phandle,用于设置循环测量和接受vbatt的通知。如qcom,bms-adc_tm =<&pm8909_adc_tm>;

  • qcom,pmic-revid : Phandle pointing to therevision peripheral node.

指向revision外围节点的phandle,如qcom,pmic-revid = <&pm8909_revid>;

Parent node Optional properties

父节点可选属性

  • qcom,s1-sample-interval-ms: The samplingrate in ms of the accumulator in state

                   S1.(i.e) the rate at which the accumulator is being
    
                   filledwith vbat samples. Minimum value = 0 and
    
                   Maximumvalue = 2550ms.
  • qcom,s2-sample-interval-ms: The samplingrate in ms of the accumulator in state

                   S2.(i.e) the rate at which the accumulator is being
    
                   filledwith vbat samples. Minimum value = 0 and
    
                   Maximumvalue = 2550ms.
  • qcom,s1-sample-count: The number ofsamples to be accululated for one FIFO in

                   stateS1. Possible values are - 0, 4, 8, 16, 32, 64, 128,
    
                   256.
  • qcom,s2-sample-count: The number ofsamples to be accululated for one FIFO in

                   stateS2. Possible values are - 0, 4, 8, 16, 32, 64, 128,
    
                   256.
  • qcom,s1-fifo-legth: Number of FIFO's to be filled in state S1, togenerate

                   thefifo_update_done interrupt. Possile values - 0 to 8
  • qcom,s2-fifo-legth: Number of FIFO's to be filled in state S2, togenerate

                   thefifo_update_done interrupt. Possible values- 0 to 8

上面几个可选属性没有用到就不描述了。

  • qcom,force-s3-on-suspend : Bool propertyto force the BMS into S3 (sleep) state

                   whileentering into system suspend.

如有此项,当系统休眠时此属性强迫BMS进入S3(sleep)状态。


- qcom,force-bms-active-on-charger: Boolproperty to keep BMS FSM active

                            ifcharger is present.

只要充电器在,保证BMS FSM激活状态。


- qcom,report-charger-eoc : Bool propertyto indicate if BMS needs to indicate

                     EOCto charger.

指示BMS需要通知EOC(充电结束)给充电器


- qcom,ignore-shutdown-soc: A boolean thatcontrols whether BMS will

                     tryto force the startup SoC to be the same as the

                     shutdownSoC. Defining it will make BMS ignore the

                     shutdownSoC.

控制BMS是否尝试去强迫启动时SOC和关机SOC一样,如果定义此项将使BMS忽略关机SOC,这意味着开机时不会用上次关机SOC,一般情况下都需要这样,所以没有采用此属性


- qcom,use-voltage-soc : A boolean thatcontrols whether BMS will use

                     voltage-basedSoC instead of a coulomb counter based

                     one.Voltage-based SoC will not guarantee linearity.

BMS根据此项的值来决定是否采用基于电压的SOC来替代基于库伦电量计的方式,基于电压的SOC不保证线性性。


- qcom,disable-bms : Bool property to disable the VMBMS hardware module.

                     Enablethis property if BMS is not supported or an external

                     fuelgauge is used.

此属性用于关闭VM BMS硬件模块,在不支持BMS或是使用一个外部电量计时使能此属性。


- qcom,s3-ocv-tolerence-uv : The S3 stateOCV tolerence threshold in uV. The

                     LSBvalue is 300uV and maximum value is 76500uV.

S3状态OCV相容阈值,最低值是300uV和最大值是76500uV。


- qcom,low-soc-fifo-length : The fifolength (of S2 STATE) to be used at lower

                     SOCs.If this value is not specified the system uses

                     defaultlenght.

低SOC时S2状态FIFO长度,如果没有指定则系统采用默认长度,这里为qcom,low-soc-fifo-length= <2>;


- qcom,resume-soc:    Capacity in percent at which charging should resume

                     whena fully charged battery drops below this level.

当充满的电池百分比低于此值,则重新开始充电。如qcom,resume-soc =<99>;


- qcom,low-temp-threshold : The temperaturethreshold below which the IBAT

                     averagingand UUC smoothening is disabled. This value

                     isin deci-degrees centigrade. If not specified it

                     defaultsto 0.

当温度阈值低于此值,禁用IBAT求取平均值和UUC(不可用电量)平滑功能,如没指定默认为0,我们这里没有指定。


- qcom,ibat-avg-samples : The number ofsamples to be averaged for IBAT

                     estimation.If not specified it defaults to 16.

                     Thepossible values are 1 to 16.

IBAT平均值估算的采用次数,如没有指定默认为16,有效值1~16,我们没有指定。

- qcom,batt-aging-comp : A boolean thatdefines if battery aging compensation

                     isenabled.

定义此项表示使能电池老化补偿,但我没有用到,建议使用。


- qcom,use-reported-soc : Bool property toenable the reported_soc logic. To

                     enablethis feature, qcom,resume-soc must be defined as

                     aproper value. The BMS is also required to control the

                     charging,discharging and recharging.

此项使能reported_soc逻辑,而且要定义qcom,resume-soc为一个合适的值,BMS也需要控制充电、停止充电和重新充电。高通给出的代码默认是定义qcom,use-reported-soc,但我们核心板厂家注释掉此项,并增加qcom,report-charger-eoc

qcom,batt-pres-status节点需要的属性值

- reg : offset and length of the PMIC LBCbattery interface BATT_PRES_STATUS

              register

qcom,batt-pres-status@1208 {

    reg= <0x1208 0x1>;

};

qcom,qpnp-chg-pres节点需要的属性

- reg : offset and length of the PMIC LBCcharger interafce CHARGER_OPTION

              register.

qcom,qpnp-chg-pres@1008 {

    reg= <0x1008 0x1>;

};

高通电池管理基于qpnp-vm-bms电压模式的更多相关文章

  1. 高通电源管理qpnp-vm-bms驱动

    1. compatible节点: qpnp-vm-bms.c使用来控制电池曲线的和BMS功能的,其compatible节点是"qcom,qpnp-vm-bms" 2. probe函 ...

  2. 高通电源管理函数的power_supply的调用关系

    以msm8909为例,高通的主要文件有几个: qpnp-linear-charger.c(线性充电器) qpnp-vm-bms.c(BMS管理) power_supply_core.c(power_s ...

  3. 高通方案的Android设备几种开机模式的进入与退出

    高通方案的Android设备主要有以下几种开机模式,Android.EDL.Fastboot.Recovery和FFBM,其进入及退出的方式如下表. 开机模式 屏幕显示 冷启动 热启动 按键退出 命令 ...

  4. Nubia Z5S(高通公司MSM8974) QHSUSB_BULK砖的方法节省模式(随着win7在恢复recovery分区案例)

    Nubia Z5S在某些异常情况或按组合键进入QHSUSB_BULK状态, 这种模式的现象, 猜想windows(实例win7)即使在数据线, 它会出现在计算机n载,甚至会提示要格式化某些分区(这里要 ...

  5. 高通ASOC中的codec驱动

    ASOC的出现是为了让codec独立于CPU,减少和CPU之间的耦合,这样同一个codec驱动就无需修改就可以匹配任何一款平台. 在Machine中已经知道,snd_soc_dai_link结构就指明 ...

  6. 高通8X16电池BMS算法(一)【转】

    本文转载自:http://www.voidcn.com/blog/yanleizhouqing/article/p-6037399.html 最近一直在搞电源管理相关内容,之前是8610的bms,现在 ...

  7. 针对高通BMS的研究 高通电量计

    点击打开链接 高通8064 8974 8926等pm芯片都集成了电量计,估计后续芯片都会一直存在,现在许多项目UI状态栏电池都有百分比显示,所以需要深入分析BMS有助于解决电量方面的BUG. 一: S ...

  8. Android图形合成和显示系统---基于高通MSM8k MDP4平台

    介绍了Android SurfaceFlinger层次以下的图形合成和显示系统,主要基于高通MSM8k MDP4x平台. 做为Android Display专题.SurfaceFlinger的详细介绍 ...

  9. Android上HDMI介绍(基于高通平台)

    本文重点针对HDMI在android上的应用,而比较相关的就是overlay机制.overlay在这里只是简单的介绍,后续会有文章再专门详述. 我没记错的话,高通从7X30开始,平台就可以支持HDMI ...

随机推荐

  1. ASP.NET Core on K8S深入学习(11)K8S网络知多少

    本篇已加入<.NET Core on K8S学习实践系列文章索引>,可以点击查看更多容器化技术相关系列文章. 一.Kubernetes网络模型 我们都知道Kubernetes作为容器编排引 ...

  2. swoole如何使php永久运行

    有需要学习交流的友人请加入交流群的咱们一起,有问题一起交流,一起进步!前提是你是学技术的.感谢阅读! 点此加入该群​jq.qq.com soole可以通过开启守护进程使PHP永久运行. 守护进程化.设 ...

  3. ES6 ... 展开&收集运算符

    ...展开&收集运算符,也就是说他可以干两件事情,展开和收集 一:收集,顾名思义把散列东西收集到一个地方,这个地方ES6规定收集在数组中 例如:下面函数fn将传递的参数收集在arg变量中,打印 ...

  4. latex 添加Bibtex 全解(使用TeXstudio)

    前提知识: 生成pdf的一般流程 在使用Latex之前,我们一般会借用已有的论文模板,在模板基础上加入我们自己的文章内容,随后编译成PDF文件,其基本流程就是:Latex->Bibtex-> ...

  5. [20191125]探究等待事件的本源.txt

    [20191125]探究等待事件的本源.txt --//当工作中遇到oracle的性能问题时,查看awr报表提供很好的解决问题途径.但是有时候很容易想当然.--//比如以前我一看到 log file ...

  6. 服务治理-Resilience4j(限流)

    Bulkhead Bulkhead一般用于服务调用客户端,用于限定对特定的服务的并发请求数量,起到一下作用:1.防⽌下游依赖被并发请求冲击2.防⽌发⽣连环故障 1.配置规则“order” //允许最大 ...

  7. diango中的MTV——FBV/CBV以及装饰器的复用问题解决

    MVC M: model 模型 与数据库交互 V: view 视图 HTML C:controller 控制器 流程 和 业务逻辑 MTV M:model ORM T:template 模板 HTML ...

  8. linux bash基础特性

    使用history命令,取得命令历史,当bash进程结束后,会把命令历史存放到文件中,下次开机还能看到命令历史. 定制history:通过设置环境变量,来定制history 环境变量$HISTSIZE ...

  9. qt 自定义控件窗口提升

  10. Yii2中$model->load($data)一直返回false问题

    上次使用$model->load()方法时一直返回false,数据添加不成功,这里记录一下: 出错代码: $data = [ 'name' => 'test', 'phone' => ...