Software Component Block Diagram
RPM(Resource Power Manager)是高通MSM平台另外加的一块芯片,虽然与AP芯片打包在一起,但其是一个独立的ARM Core。之所以加这个东西,就是要控制整个电源相关的shared resources,比如ldo,clock。负责与SMP,MPM交互进入睡眠或者唤醒整个系统。
以下是高通文档中对各个功能模块的说明。
- Kernel – DALSys-based lightweight kernel
- RPM handler – RPM handler abstracts the RPM message protocol away
from other software - Drivers – Drivers for each of the resources supported by the RPM will
register with RPM handler to request notification when requests are
received for the resource which the driver controls - NPA – A driver may use the Node Power Architecture (NPA) to represent
resources controlled by the driver - Clock driver – RPM clock driver directly handles aggregating requests
from each of the masters for any of the systemwide clock resources
controlled by the RPM - Bus arbitration driver – RPM bus arbiter driver takes bus arbiter settings
as requests from the different masters in the system and aggregates them
to represent the frequency-independent system settings - PMIC – RPM PMIC driver directly aggregates requests from each of the
masters for any of the systemwide PMIC resources controlled by the RPM - Watch Dog driver – Watch Dog driver is a fail-safe for incorrect or stuck
code - MPM driver – Used to program the MPM hardware block during
systemwide sleep - RPM message driver – RPM message protocol driver abstracts the RPM
message protocol away from other subsystem software
Messaging Masters
与RPM通过shared memory region交互进行dynamic and static resource/power management的可以有很多种。
这个可以查看smd_type.h中的smd_channel_type。但目前看只有AP,MODEM,RIVA,TZ与RPM有交互,这个可以看message_ram_malloc()函数中的设置。
其实也可以间接从rpm_config.c文件中的SystempData temp_config_data这个变量中看出来到底有几个部分是与RPM进行交互的。
RPM Initialization
在main.c文件中会逐个调用init_fcns[]变量中的函数进行初始化。当然也包括上面的资源的初始化。
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- pm_init : LDO等资源的注册,然后接收rpm_message。接收rpm_message的部分高通代码没有给,所以看不到,但从rpm log来看,是有接收处理并反馈的过程的。
- 1
- 2
- 3
- 4
- 5
- 6
- 7
ldoa对应的resource type为RPM_LDO_A_REQ。这个在pm_rom_device_init()里的pm_rpm_ldo_register_resources(RPM_LDO_A_REQ, num_of_ldoa); 这里被注册,所以看进去最后xlate和apply最终都会被pm_rpm_ldo_translation()和pm_rpm_ldo_apply进行处理。pm_rpm_ldo_tranlation()读取kvp内容,pm_rpm_ldo_apply最终把request的内容设置上去。
kernel端在msm-pm8916-rpm-regulator.dtsi文件中定如下ldo内容
2. (init_fcn)Clock_Init:Clock资源的注册,这个过程和上面的也差不多
3. rpmserver_init:启动接收message的进程
比如要设置LDO3的电压和电流,kvp的内容如下: