[RK3288][Android6.0] PMIC之RK818配置说明

Platform: ROCKCHIP
OS: Android 6.0
Kernel: 3.10.92

对应dts文件是 rk3288/kernel/arch/arm/boot/dts/rk818.dtsi
&rk818 {
    compatible = "rockchip,rk818";
    regulators {
        #address-cells = <1>;
        #size-cells = <0>;   
        rk818_dcdc1_reg: regulator@0 {
            reg = <0>;
            regulator-compatible = "rk818_dcdc1";
            regulator-always-on;
            regulator-boot-on;
        };
......
        rk818_dcdc4_reg: regulator@3 {
            reg = <3>;
            regulator-compatible = "rk818_dcdc4";
            regulator-always-on;
            regulator-boot-on;    
        };
      rk818_ldo1_reg: regulator@4 {
            reg = <4>;
            regulator-compatible = "rk818_ldo1";
            regulator-always-on;
            regulator-boot-on;
        };
......
        rk818_ldo10_reg: regulator@13{
            reg = <13>;
            regulator-compatible = "rk818_ldo10";
            regulator-always-on;
            regulator-boot-on;
        };
    };
};


文件是按照标准regulator定义配置,参见
kernel/Documentation/devicetree/bindings/regulator/regulator.txt
新添加的property可参考
kernel/Documentation/devicetree/bindings/mfd/rk808.txt (没有对应的rk818.txt)
文件内容是基于硬件(上一篇已提过)的各个电源定义的.

compatible: 匹配驱动用.
regulator-compatible: 每个电源的名称,用于代码中匹配.
regulator-always-on: 常开,不能关闭.
regulator-boot-on: 默认boot时就打开,不需要其他子模块(如lcd要用ldo)再去操作.

因为每个平台项目使用的配置都不太一样,所以还有一部分定义是放在了主dts中, 例如:
rk3288/kernel/arch/arm/boot/dts/rk3288-vr.dtsi
rk818的i2c接口配置.
&i2c0 {
    status = "okay";
    rk818: rk818@1c {
        reg = <0x1c>;
        status = "okay";
     };
}
;

regulator节点另外一部分配置:
&rk818 {
    gpios = <&gpio0 GPIO_A4 GPIO_ACTIVE_HIGH>,
        <&gpio0 GPIO_A0 GPIO_ACTIVE_LOW>;
    rk818,system-power-controller;
    regulators {
        rk818_dcdc1_reg: regulator@0{
            regulator-name= "vdd_logic";
            regulator-min-microvolt = <700000>;
            regulator-max-microvolt = <1500000>;
            regulator-initial-mode = <0x2>;
            regulator-initial-state = <3>;
            regulator-boot-on-volt = <1150000>;
            regulator-state-mem {
                regulator-state-mode = <0x2>;
                regulator-state-enabled;
                regulator-state-uv = <1000000>;
            };
        };
    ......
        rk818_ldo1_reg: regulator@4 {
            regulator-name= "rk818_ldo1";
            regulator-min-microvolt = <3300000>;
            regulator-max-microvolt = <3300000>;
            regulator-initial-state = <3>;
            regulator-state-mem {
                regulator-state-enabled;
                regulator-state-uv = <3300000>;
            };
        };
......
};


gpios: 前者是RK818的INT脚到cpu对应GPIO, 后者是SLEEP引脚对应GPIO.功能在上一篇文章已提过.
rk818,system-power-controller: 是否支持关机,支持则会在代码中赋值关机函数.
regulator-name: 每个电源的名称会因用途不同而变化,比如系统rk818_dcdc1_reg用在其他项目可能是作为vdd_ddr,然后代码会通过regulator-name寻找对应的regulator.因此不能重名.
regulator-min-microvolt/regulator-max-microvolt: 电压设置范围,两者值一致并且regulator-boot-on时会在uboot中enable起来.
regulator-initial-mode/regulator-state-mode: 
    REGULATOR_MODE_FAST            0x1        
    REGULATOR_MODE_NORMAL        0x2
    REGULATOR_MODE_IDLE            0x4
    REGULATOR_MODE_STANDBY        0x8

regulator-initial-state: suspend初始状态设置. 值定义在suspend.h中
#define PM_SUSPEND_ON        ((__force suspend_state_t) 0)
#define PM_SUSPEND_FREEZE    ((__force suspend_state_t) 1)
#define PM_SUSPEND_STANDBY    ((__force suspend_state_t) 2)
#define PM_SUSPEND_MEM        ((__force suspend_state_t) 3)
#define PM_SUSPEND_MIN        PM_SUSPEND_FREEZE
#define PM_SUSPEND_MAX        ((__force suspend_state_t) 4)

regulator-state-mem: suspend下的节点设置.

主dts中还有个pwm_regulator节点,当使用外接DCDC时,通过PWM来控制(控制方式上篇有提到过了),这里不需要.

你可能感兴趣的:(子类__PMU)