首页 > 其他分享 >Android Qcom USB Driver学习(八)

Android Qcom USB Driver学习(八)

时间:2024-08-23 14:26:09浏览次数:7  
标签:ENABLE battery Driver Qcom Android pm CONFIG sbl PM

因为要看usb charging的问题,所以需要补充一下battery的相关知识,算是入门吧

BAT SCH

(1)VBATT_VSNS_P

(2)BAT_THERM

(3)I2C_SDA

(4)I2C_SCL

(5)VBATT_VSNS_M

sbl1_hw_pre_ddr_init: (1)pm_device_init (2)pm_driver_init (3) pm_sbl_chg_init 

(1)
pm_device_init没有研究过,也是一些初始化
(2)
pm_sbl_boot_oem.c -> pm_driver_post_init  (通过write register的方法来配置jeita)
	err_flag |= pm_comm_write_byte(0x2 , 0x1094, 0x0F, 0x0); //warm 45
	err_flag |= pm_comm_write_byte(0x2 , 0x1095, 0xDC, 0x0); //warm 45
依据各项目ic pmic的datasheet找到对应寄存器进行修改
(3)
pm_config_target.c -> strcut sbl_schg_specific_data  (charger parameters chg_param_ptr)
包括usb输出电流(USBIN Input Current Limit),开机电压(bootup_battery_theshold_mv),jeita限制(Enable/Disable JEITA Hard Temp Limit Check in SBL)等等
pm_sbl_schg_specific_data_type
  sbl_schg_specific_data[1] =
  {
     {
        //Configuration Value,                             Enable config
        {PM_SCHG_BATIF_LOW_BATTERY_THRESH_3P2,             PM_DISABLE_CONFIG },  //Vlowbatt Threshold
        {PM_SCHG_BATIF_LOW_BATTERY_THRESH_2P8,             PM_ENABLE_CONFIG  },  //APSD rerun Vlowbatt Threshold
        {70,                                               PM_ENABLE_CONFIG  },  //Fg skin hot threshold: valid range is -30 to 97 degree C
        {80,                                               PM_ENABLE_CONFIG  },  //Fg skin too hot threshold: valid range is -30 to 97 degree C
        {80,                                               PM_ENABLE_CONFIG  },  //Fg charge hot threshold: valid range is -30 to 97 degree C
        {90,                                               PM_ENABLE_CONFIG  },  //Fg charge too hot threshold: valid range is -30 to 97 degree C
        {TRUE,                                             PM_DISABLE_CONFIG },  //Use BATID and/or THERM pin for battery missing detection
        {{TRUE, PM_SCHG_MISC_SNARL_WDOG_TMOUT_62P5MS, PM_SCHG_MISC_BARK_WDOG_TMOUT_128S, PM_SCHG_MISC_BITE_WDOG_TMOUT_8S}, PM_ENABLE_CONFIG },  //Enable/Disable and Timeout WDog Config
        {2000,                                             PM_ENABLE_CONFIG },  //FAST Charging Current
        {300,                                              PM_ENABLE_CONFIG },  //PRE Charge Current
        {4400,                                             PM_ENABLE_CONFIG },  //Float Voltage
        {2500,                                             PM_ENABLE_CONFIG  },  //USBIN Input Current Limit
        {1000,                                             PM_DISABLE_CONFIG },  //DCIN Input Current Limit
        {6750, 8250,                                       PM_ENABLE_CONFIG  },  //Fake battery detection range: Battery will be detected as fake battery if BATT ID in this range. unit: Ohms
        {2000, 14000},                                                           //Debug Board detect: BATT_ID PD Resistor ADC Min/Max Read Value range; unit: Ohms
        PM_BATT_ID_PU_30K,                                                       //battery ID pull up resistor value
        3300,                                                                    //bootup_battery_theshold_mv
        3300,                                                                    //wipowr bootup battery thesholdmv
        2800,                                                                    //apsd_reset_threshold_mv:  APSD reset only applicable if initial Vbatt level is less than this threshold
        2800,                                                                    //apsd_reset_theshold_no_uvlo_mv: Used if last reset reason is NOT UVLO
        3200,                                                                    //apsd_reset_theshold_uvlo_mv: Used if last reset reason is UVLO
        TRUE,                                                                    //Enable/Disable JEITA Hard Temp Limit Check in SBL
        TRUE,                                                                    //dbc_usb_500_mode
        TRUE,                                                                   //Verbose SBL CHG UART logging
  	  1,																	   //Pmic index of charger
     }
  };


pm_sbl_boot.c  -> pm_app_chgr.c -> pm_sbl_config_chg_parameters ↓↓↓
pm_sbl_boot.c  -> pm_app_chgr.c -> pm_sbl_chg_check_weak_battery_status
应用上述的chg_param_ptr, 在weak battery的状态下不会开机(即SBL Charging in progress....) + 闪红灯(Toggle Red LED)

XBL Core

QcomChargerConfig_VbattTh.cfg	
BootToHLOSThresholdInMv = 3300 
JeitaHardColdLimit = 0
JeitaSoftColdLimit = 10
JeitaSoftHotLimit  = 45
JeitaHardHotLimit  = 60


QcomChargerPlatform.c -> ChargerPlatform_ReadCfgParams -> ChargerPlatform_Init
if (CurrentBatteryStatus.BatteryVoltage >= gThresholdVbatt)
     *pActionType = EFI_QCOM_CHARGER_ACTION_GOOD_TO_BOOT;

Kernel

qcom,fastchg-current-ma = <2000>;          //最大快充电流
/* COOL = 10 degc, WARM = 40 degC*/        //jeita配置
qcom,jeita-soft-thresholds = <0x2ed8 0x1045>; <SOFT_COLD_ADC_CODE, SOFT_HOT_ADC_CODE>
/* COLD = 0 degC, HOT = 45 degC*/
qcom,jeita-hard-thresholds = <0x3e3d 0x0D85>; <HARD_COLD_ADC_CODE, HARD_HOT_ADC_CODE>
qcom,jeita-fcc-ranges = <                  //各jeita范围内电流
                        0 100 800000
                        101 400 2000000
                        401 450 2000000>;
qcom,jeita-fv-ranges = <                   //各jeita范围内电压
                        0 100 4180000
                        101 400 4350000
                        401 450 4350000>;

Charging phases

image

(1) Trickle-charge  < 2.1V 45mA
(2) Preconditioning(precharge) > 2.1V + PRE Charge Current
(3) Constant current(fast charge) < Float Voltage + Fast Charging Current
(4) Constatnt voltage(taper charge) = Float Voltage
Chargint phase的配置还是发生在SBL1/XBL阶段,在高通平台上除了(1)Trigckle_charge都是可配置的,配置可见上述sbl_schg_specific_data

pm_sbl_boot.c  -> pm_app_chgr.c -> pm_sbl_config_chg_parameters
                                       -> pm_schg_chgr_set_charge_current(PRE Charge Current(2))
									   -> pm_schg_chgr_set_charge_current(FAST Charging Current(3))
									   -> pm_schg_chgr_set_float_volt(Float Voltage(4))

标签:ENABLE,battery,Driver,Qcom,Android,pm,CONFIG,sbl,PM
From: https://www.cnblogs.com/linhaostudy/p/18375924

相关文章

  • Android Qcom USB Driver学习(七)
    最近遇到了USB插拔后,系统重启的问题,抓取串口log发现如下问题,log中查看trace分析就是空指针造成的panicUnabletohandlekernelreadfromunreadablememoryatvirtualaddress0000000000000000Memabortinfo:ESR=0x96000005Exceptionclass=DABT(currentEL),......
  • Android Qcom USB Driver学习(六)
    眼图基础知识与详解10分钟教会你看眼图USB2.0HUB眼图调试经验总结一篇文章教你如何全面了解眼图测试!预加重与去加重对眼图的影响关于USB通信阻抗匹配的问题硬件调试——眼图几个经典案例眼图常见问题分析包含双眼皮的情况PHYTunningdevicetree:qusb_phy0:qusb@1613......
  • 容器设置日志驱动程序 - docker --log-driver
    环境:在创建docker时候遇到该异常信息:docker:Errorresponsefromdaemon:logger:nologdrivernamed'local'isregistered.在linux系统下使用docker进行容器创建时候,一般情况下会对docekr的日志驱动做设置,以避免文件过大导致磁盘占满的情况,如下记录自己的一些经理,希望对朋......
  • 【Android笔记】Android APK编译打包流程
    前言本文将介绍Android从一个项目打包成APK的过程,其中涉及AndroidJava和Kotlin文件、资源文件、清单文件、依赖jar包和so库等在打包过程中处理。步骤总体的打包流程如下图,下面就介绍下详细的打包步骤。1、将aidl文件编译成java文件在构建过程中,Gradle会调用AIDL编......
  • Android逆向(七) 解密COCOS游戏lua脚本-第1篇
    目录一、系统环境二、详细分析前言:1.lua脚本是什么?2.为什么游戏开发要用lua脚本?正文:获取Lua脚本的几种方法:1.直接在assets目录提取2.在luaL_loadbuffer函数处获取3.在底层的reader函数处获取1.静态分析2.动态分析一、系统环境OS:Windows_NTx6410.0......
  • HTC 10 刷系统 LineageOS 19.1 Android 12
    解锁手机解锁会导致数据全部清除,注意保存Bootloader解锁,S-ON可以不用解锁(好像可以绕过解锁安装twrp,暂时没尝试)HTC官方UnlockBootloaderHTCDesire20pro可以不通过官方网站解锁adbrebootbootloader#进入bootloadersudofastbootflashingunlock#选择UNLOC......
  • 深入理解Android MTP之存储映射分析
    深入理解AndroidMTP之UsbService启动分析 分析了MTP的服务端的启动,本文来分析切换MTP模式后,存储中的数据(文件、目录)是如何映射到PC端的。首先你得知道如何切换MTP模式。当手机通过usb连接电脑时,会出现一个关于usb的通知,点击通知后,会出现一个类似如下的界面这个FileTransfe......
  • android调用h5代码步骤
    要在Android应用中调用H5代码,可以使用WebView来加载并执行H5代码。以下是一个简单的示例:首先,在你的Android项目中的布局文件中添加一个WebView组件:```xml<WebView  android:id="@+id/webview"  android:layout_width="match_parent"  android:layout_height="......
  • 免费【2024】springboot 基于Android的个人财务系统的设计与实现
    博主介绍:✌CSDN新星计划导师、Java领域优质创作者、掘金/华为云/阿里云/InfoQ等平台优质作者、专注于Java技术领域和学生毕业项目实战,高校老师/讲师/同行前辈交流✌技术范围:SpringBoot、Vue、SSM、HTML、Jsp、PHP、Nodejs、Python、爬虫、数据可视化、小程序、安卓app、大数......
  • 免费【2024】基于Android的房屋租赁App的设计与实现
    博主介绍:✌CSDN新星计划导师、Java领域优质创作者、掘金/华为云/阿里云/InfoQ等平台优质作者、专注于Java技术领域和学生毕业项目实战,高校老师/讲师/同行前辈交流✌技术范围:SpringBoot、Vue、SSM、HTML、Jsp、PHP、Nodejs、Python、爬虫、数据可视化、小程序、安卓app、大数......