android+5.q,MSM8909+Android5.1.1电池管理(2)--qpnp-linear-charger.txt驱动学习概要
MSM8909+Android5.1.1電池管理(2)--qpnp-linear-charger.txt驅(qū)動(dòng)學(xué)習(xí)概要
參考文件
\kernel\Documentation\power\qpnp-linear-charger.txt---下面是學(xué)習(xí)此文件
\kernel\Documentation\devicetree\bindings\power\qpnp-linear-charger.txt
1.?????簡介
The QPNP linear charger driver implementsinput and external peripheral power management for 8916 chipsets. The input canbe supplied to the device via USB path. Output paths is the VPH_PWR rail.
QPNP線性充電器驅(qū)動(dòng)實(shí)現(xiàn)8916芯片集(msm8916和pm8916)輸入和外部外圍電路管理,通過USB路徑輸入到設(shè)備和輸出路徑是VPH_PWR。
2.?????軟件描述
2.1???設(shè)計(jì)目標(biāo)
The qpnp-linear-charger driver interacts asa consumer and producer for
various input and output power information,as well as relaying information
to userspace.
qpnp-linear-charger驅(qū)動(dòng)作為一個(gè)消費(fèi)者和生產(chǎn)者交互各種輸入和輸出電源信息,而且轉(zhuǎn)發(fā)這些信息給用戶空間
Given the abundance of configurations fordifferent board designs it is important to distinguish between configurationswhich are required versus those available to be configured at compile and atrun time. The target of this design is to achieve this as follows:
為不同板設(shè)計(jì)給出豐富的配置,重要的是可區(qū)分編譯時(shí)需配置的配置和運(yùn)行時(shí)配置,這個(gè)設(shè)計(jì)目的可通過下面的內(nèi)容來達(dá)到:
(1)??編譯時(shí)選項(xiàng)在設(shè)備樹文件定義
參考Documentation/devicetree/bindings/power/qpnp-linear-charger.txt,對(duì)應(yīng)設(shè)備樹文件\kernel\arch\arm\boot\dts\qcom\msm-pm8909.dtsi下的設(shè)備節(jié)點(diǎn)
pm8909_chg: qcom,charger {
spmi-dev-container;
compatible= "qcom,qpnp-linear-charger";
#address-cells= <1>;
#size-cells= <1>;
…
};
(2)??運(yùn)行時(shí)配置通過power supply框架來實(shí)現(xiàn)
(3)??依賴芯片組的特性和工作區(qū)(workarounds)通過運(yùn)行時(shí)subtype檢測來配合,典型情況不需要改變
Chipset dependent features and workaroundsare configured via runtime subtype detection and are typically not changed.
2.2???Power supply屬性實(shí)現(xiàn)
While the power supply frameworkimplementation supplies basic definitions
of each property this documentation willdefine the ones used in more detail.
Power supply框架基于定義的每個(gè)輸定來實(shí)現(xiàn)supply,qpnp-linear-charger.txt文檔更詳細(xì)定義這些屬性的使用
The notification model in the power supplyframework is used to notify other
consumers of information conveyed by thecharger driver as outlined below.
Each notification is handled via the supplysupplicant relationship.
Whenever a supply is changed and thepower_supply_changed API is called the
external_power_supply_changed callback willbe invoked at the supplicant.
One can picture the notification as onedirectional.
Power supply框架的通知模型用于通知其他消費(fèi)者信息,這些信息是有充電器驅(qū)動(dòng)傳達(dá)的,通知模型如下圖,每個(gè)通知都會(huì)通過供應(yīng)者和請(qǐng)求者的關(guān)系來處理,只要是一個(gè)供應(yīng)者狀態(tài)改變且它調(diào)用了power_supply_changed(),請(qǐng)求者就會(huì)調(diào)用提供者的external_power_changed()回調(diào)函數(shù)
圖1
Registered supplies in qpnp-linear-charger:
*battery
Other supplies in other drivers:
*bms: registered in the Battery Management (BMS) qpnp-vm-bms.c driver.
*usb: registered in the corresponding dwc3 or msm_otg driver.
qpnp-linear-charger注冊(cè)為名為battery的供應(yīng)者,qpnp-vm-bms.c驅(qū)動(dòng)注冊(cè)為bms供應(yīng)者,phy-msm-usb.c驅(qū)動(dòng)注冊(cè)為usb的供應(yīng)者
Battery:
*supplicants: bms
*supplies: bms, usb
圖2
* writable properties(可寫屬性):
-POWER_SUPPLY_PROP_CHARGING_ENABLED
This bit allows to disable current from entering the battery
as well as disabling any current being drawn from external inputs.
此位允許禁用進(jìn)入電池的電流,也禁來之外部輸入的任何電流
-?POWER_SUPPLY_PROP_SYSTEM_TEMP_LEVEL
The temperature level is used by the thermal daemon to configure
the maximum battery current input limit to reduce heat produced
from the battery when charging.
當(dāng)充電時(shí),守護(hù)進(jìn)程使用溫度等級(jí)來配置最大電池電流輸入限制,從而降低電池產(chǎn)生的熱量。
-? POWER_SUPPLY_PROP_VOLTAGE_MIN
The minimum input voltage for a given input to the charger.
充電器最小輸入電壓
-? POWER_SUPPLY_PROP_COOL_TEMP
Allows to configure a cool threshold notification which is
configured via the ADC battery temperaturemonitoring API.
允許配置一個(gè)cool閾值通知,此閾值通過ADC電池溫度監(jiān)控API來配置
-? POWER_SUPPLY_PROP_WARM_TEMP
Allows to configure a warm threshold notification which is
configured via the ADC battery temperaturemonitoring API.
允許配置一個(gè)warm閾值通知,此閾值通過ADC電池溫度監(jiān)控API來配置
-? POWER_SUPPLY_PROP_STATUS
This property is set by BMS whenever BMSdetects end of charge
condition. Charger driver uses this to stopcharging.
當(dāng)BMS檢測到充電結(jié)束,BMS設(shè)置此屬性來通知充電器多功能停止充電
-? POWER_SUPPLY_PROP_CAPACITY
This property is set by the BMS supply whenever the capacity of the
battery is changed. If there is no BMS supplypresent a default
value is returned. This property can also bemanually overridden
from userspace to set a fake capacity. Thisfeature allows for test
environments to prevent certain userspacesfrom shutting down the
device.
當(dāng)電池容量改變,BMS設(shè)置此屬性,如果沒有BMS,默認(rèn)為50%。此屬性也可被用戶空間手動(dòng)修改來設(shè)置一個(gè)假的容量。此特征允許測試環(huán)境防止某些用戶空間關(guān)機(jī)。
*other notable properties:
-POWER_SUPPLY_PROP_PRESENT:
Indicates whether valid voltage has been detected on either
BATT_THERMor BATT_ID.
指示是否可以通過BATT_THERM或是BATT_ID檢測到有效的電壓,也就是電池是否存在
Note that the Battery Management (BMS)supply is a special case as there is
a circular notification requirement of theSTATUS (battery) and the CAPACITY
(bms) properties.
請(qǐng)注意,BMS是一個(gè)需要循環(huán)通知電池狀態(tài)和容量(bms)屬的特殊實(shí)例。
The battery power supply is also asupplicant to BMS because of userspace
not being aware of the BMS power supplytype. Thus the CAPACITY property needs
to be relayed through the appropriatebattery supply type.
battery電源供應(yīng)也是BMS的請(qǐng)求者,因?yàn)橛脩艨臻g不知道BMS電源供應(yīng)類型,所以電池容量屬性需要通過適當(dāng)?shù)碾娫垂?yīng)類型類傳達(dá)。
2.3???充電驅(qū)動(dòng)配置選項(xiàng)Configoptions
配置文件通過CONFIG_QPNP_LINEAR_CHARGER=y來使能QPNP充電器的支持
2.4???用戶空間工具User spaceutilities
The power supply framework sends ueventswhenever power_supply_changed is
invoked. Said event contains the name ofthe supply changed as well as all
implemented power supply properties.
當(dāng)調(diào)用了power_supply_changed(),power supply框架層發(fā)送uevents,所說的event包含改變的供應(yīng)者名稱(比如bms、battery、usb),也包含電源供應(yīng)者實(shí)現(xiàn)的屬性。
The qpnp-linear-charger driver takesadvantage of the framework to notify
userspace. There are a few userspaceapplications which take advantage of
this information to track things likebattery capacity, presence and health.
qpnp-linear-charger驅(qū)動(dòng)利用power supply框架通知用戶空間,有一些用戶空間應(yīng)用運(yùn)用這些信息來跟蹤電池容量(也是百分比)、電池是否存在和生命值(health,比如good)
總結(jié)
以上是生活随笔為你收集整理的android+5.q,MSM8909+Android5.1.1电池管理(2)--qpnp-linear-charger.txt驱动学习概要的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 解决/mnt中有hgfs无共享文件
- 下一篇: 红米android4.4.2,新版红米N