android+5.q,MSM8909+Android5.1.1电池管理(2)--qpnp-linear-charger.txt驱动学习概要
MSM8909+Android5.1.1電池管理(2)--qpnp-linear-charger.txt驅動學習概要
參考文件
\kernel\Documentation\power\qpnp-linear-charger.txt---下面是學習此文件
\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線性充電器驅動實現8916芯片集(msm8916和pm8916)輸入和外部外圍電路管理,通過USB路徑輸入到設備和輸出路徑是VPH_PWR。
2.?????軟件描述
2.1???設計目標
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驅動作為一個消費者和生產者交互各種輸入和輸出電源信息,而且轉發這些信息給用戶空間
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:
為不同板設計給出豐富的配置,重要的是可區分編譯時需配置的配置和運行時配置,這個設計目的可通過下面的內容來達到:
(1)??編譯時選項在設備樹文件定義
參考Documentation/devicetree/bindings/power/qpnp-linear-charger.txt,對應設備樹文件\kernel\arch\arm\boot\dts\qcom\msm-pm8909.dtsi下的設備節點
pm8909_chg: qcom,charger {
spmi-dev-container;
compatible= "qcom,qpnp-linear-charger";
#address-cells= <1>;
#size-cells= <1>;
…
};
(2)??運行時配置通過power supply框架來實現
(3)??依賴芯片組的特性和工作區(workarounds)通過運行時subtype檢測來配合,典型情況不需要改變
Chipset dependent features and workaroundsare configured via runtime subtype detection and are typically not changed.
2.2???Power supply屬性實現
While the power supply frameworkimplementation supplies basic definitions
of each property this documentation willdefine the ones used in more detail.
Power supply框架基于定義的每個輸定來實現supply,qpnp-linear-charger.txt文檔更詳細定義這些屬性的使用
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框架的通知模型用于通知其他消費者信息,這些信息是有充電器驅動傳達的,通知模型如下圖,每個通知都會通過供應者和請求者的關系來處理,只要是一個供應者狀態改變且它調用了power_supply_changed(),請求者就會調用提供者的external_power_changed()回調函數
圖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注冊為名為battery的供應者,qpnp-vm-bms.c驅動注冊為bms供應者,phy-msm-usb.c驅動注冊為usb的供應者
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.
此位允許禁用進入電池的電流,也禁來之外部輸入的任何電流
-?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.
當充電時,守護進程使用溫度等級來配置最大電池電流輸入限制,從而降低電池產生的熱量。
-? 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.
允許配置一個cool閾值通知,此閾值通過ADC電池溫度監控API來配置
-? POWER_SUPPLY_PROP_WARM_TEMP
Allows to configure a warm threshold notification which is
configured via the ADC battery temperaturemonitoring API.
允許配置一個warm閾值通知,此閾值通過ADC電池溫度監控API來配置
-? POWER_SUPPLY_PROP_STATUS
This property is set by BMS whenever BMSdetects end of charge
condition. Charger driver uses this to stopcharging.
當BMS檢測到充電結束,BMS設置此屬性來通知充電器多功能停止充電
-? 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.
當電池容量改變,BMS設置此屬性,如果沒有BMS,默認為50%。此屬性也可被用戶空間手動修改來設置一個假的容量。此特征允許測試環境防止某些用戶空間關機。
*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.
請注意,BMS是一個需要循環通知電池狀態和容量(bms)屬的特殊實例。
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電源供應也是BMS的請求者,因為用戶空間不知道BMS電源供應類型,所以電池容量屬性需要通過適當的電源供應類型類傳達。
2.3???充電驅動配置選項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.
當調用了power_supply_changed(),power supply框架層發送uevents,所說的event包含改變的供應者名稱(比如bms、battery、usb),也包含電源供應者實現的屬性。
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驅動利用power supply框架通知用戶空間,有一些用戶空間應用運用這些信息來跟蹤電池容量(也是百分比)、電池是否存在和生命值(health,比如good)
總結
以上是生活随笔為你收集整理的android+5.q,MSM8909+Android5.1.1电池管理(2)--qpnp-linear-charger.txt驱动学习概要的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 解决/mnt中有hgfs无共享文件
- 下一篇: android sina oauth2.