基于android7.1+msm8937充电学习---概述(1)
Pmi8937驱动指qpnp-smbcharger.c,usb驱动指phy-msm-usb.c
1. 硬件方案
其中D+和D-也会连接到CPU msm8937的USB端口。
The PM8937 and PMi8937 chips interface withthe MSM8937 chipsets
through the System Power ManagementInterface (SPMI) bus and provide
features such as Analog-to-DigitalConversion (ADC), charger, fuel gauge,
LED, and Pulse Width Modulation (PWM).
1.1 pmi8937充电部分相关引脚
1.2 VBUS和USB_ID只连接到PMI8937,没有连接到MSM8937
由pmi8937对应的充电器驱动通知USB软件关于VBUS和USB_ID事件。
1.3 充电器类型有pmi8937检测
由Pmi8937驱动,然后通知到usb驱动,当然,也可以使用USB驱动来替代pmi8937检测USB充电器,下面是相关说明:
Question:Many customers want to use USBbased charger detection instead of PMIC, because of the problem of PMIC, orcustomer do not adopt QC PMIC component in hardware design, How to use USB to do charger detectioninstead of PMIC?
Answer:
On platforms like 8939,8916, USB sideSW&HW have support for charger detection. If customer want to use USB PHYto do charger detection, need to call below in charger driver to activate USB.
power_supply_set_supply_type(chip->usb_psy,POWER_SUPPLY_TYPE_UNKNOWN);
power_supply_set_present(chip->usb_psy, TRUE);
If the charger type set to unknown, USBwill start charger detection.
Please note on new platforms like 9x40, wedo not support USB charger detection.
1.4 充电器的检测:APSD
APSD是基于D+和D-信号来检测识别USB充电器的
2. 软件部分
2.1 pmi8937部分
The PMi8937 charger driver acts toconfigure charger parameters for the
hardware finite state-machine to regulatethe charging current.
Charger driver source –kernel/drivers/power/qpnp-smbcharger.c
DTS –kernel/arch/arm/boot/dts/qcom/msm-pmi8937.dtsi
DTSI documentation –kernel/Documentation/devicetree/bindings/
power/qpnp-smbcharger.txt
2.2 Usb
Usb驱动---kernel\msm-3.18\drivers\usb\phy\phy-msm-usb.c
设备树--- kernel/arch/arm/boot/dts/qcom/msm8937.dtsi