RK3399 RK808 PMIC

电源管理芯片

Posted by LXG on October 28, 2022

概述

RK808 是一款高性能 PMIC,RK808 集成 4 个大电流 DCDC、8 个 LDO、2个开关SWITCH、1 个 RTC、可调上电时序等功能。

处理器通过I2C接口控制PMIC电压输出。

系统中各路电源总体分为两种:DCDC 和 LDO。两种电源的总体特性如下:

  1. DCDC:输入输出压差大时,效率高,但是存在纹波比较大的问题,成本高,所以大压差,大电流负载时使用。一般有两种工作模式。PWM 模式:纹波瞬态响应好,效率低;PFM 模式:效率高, 但是负载能力差。
  2. LDO:输入输出压差大时,效率低,成本低,为了提高 LDO 的转换效率,系统上会进行相关优化,如:LDO 输出电压为 1.1V,为了提高效率,其输入电压可以从 VCCIO_3.3V 的 DCDC 给出。所以电路上如果允许尽量将 LDO 接到 DCDC 输出回路,但是要注意上电时序。

功能

从使用者的角度看,RK808 的功能概况起来可以分为 4 个部分:

  1. regulator 功能:控制各路 DCDC、LDO 电源状态;
  2. rtc 功能:提供时钟计时、定时等功能;
  3. clk 功能:有两个32.768KHZ时钟输出,一个不可以控常开,一个是软件可控。

引脚图

rk808_pmic

原理图

Power Tree

rk808_power_tree

驱动配置

4.4内核驱动文件

drivers/mfd/rk808.c drivers/rtc/rtc-rk808.c drivers/regulator/rk808-regulator.c drivers/clk/clk-rk808.c

宏配置

./arch/arm64/configs/rockchip_defconfig

CONFIG_MFD_RK808 CONFIG_RTC_RK808 CONFIG_REGULATOR_RK808 CONFIG_COMMON_CLK_RK808

DTS

DTS 的配置包括:I2C 挂载、主体、regulator、rtc、poweroff 等部分

rk3399-evb-rev3.dtsi


&i2c0 {

rk808: pmic@1b {
                compatible = "rockchip,rk808";                               // 不可修改
                reg = <0x1b>;                                                // 基地址
                interrupt-parent = <&gpio1>;                                 // 中断GPIO地址 AP和PMIC相连
                interrupts = <21 IRQ_TYPE_LEVEL_LOW>;                        // PMIC_INT_L pmic_int 在 interrupt-parent 的 gpio 上的引脚索引编号和极性;
                pinctrl-names = "default";                                   // 不可修改
                pinctrl-0 = <&pmic_int_l &pmic_dvs2>;                        // 引用 pinctrl 里定义好的 pmic_int 引脚
                rockchip,system-power-controller;                            // 不可修改
                wakeup-source;                                               // 不可修改
                #clock-cells = <1>;
                clock-output-names = "rk808-clkout1", "rk808-clkout2";

                vcc1-supply = <&vcc3v3_sys>;
                vcc2-supply = <&vcc3v3_sys>;
                vcc3-supply = <&vcc3v3_sys>;
                vcc4-supply = <&vcc3v3_sys>;
                vcc6-supply = <&vcc3v3_sys>;
                vcc7-supply = <&vcc3v3_sys>;
                vcc8-supply = <&vcc3v3_sys>;
                vcc9-supply = <&vcc3v3_sys>;
                vcc10-supply = <&vcc3v3_sys>;
                vcc11-supply = <&vcc3v3_sys>;
                vcc12-supply = <&vcc3v3_sys>;
                vddio-supply = <&vcc1v8_pmu>;


                regulators {
                        vdd_log: DCDC_REG1 {
                                regulator-always-on;
                                regulator-boot-on;
                                regulator-min-microvolt = <750000>;                 // 运行时可以调节的最小电压
                                regulator-max-microvolt = <1350000>;                // 运行时可以调节的最大电压
                                regulator-ramp-delay = <6001>;
                                regulator-name = "vdd_log";                         // 电源的名字,建议和硬件图上保持一致,使用 regulator_get 接口时需要匹配这个名字
                                regulator-state-mem {
                                        regulator-on-in-suspend;
                                        regulator-suspend-microvolt = <900000>;
                                };
                        };

                        vdd_cpu_l: DCDC_REG2 {
                                regulator-always-on;
                                regulator-boot-on;
                                regulator-min-microvolt = <750000>;
                                regulator-max-microvolt = <1350000>;
                                regulator-ramp-delay = <6001>;
                                regulator-name = "vdd_cpu_l";
                                regulator-state-mem {
                                        regulator-off-in-suspend;
                                };
                        };

                        vcc_ddr: DCDC_REG3 {
                                regulator-always-on;
                                regulator-boot-on;
                                regulator-name = "vcc_ddr";
                                regulator-state-mem {
                                        regulator-on-in-suspend;
                                };
                        };

                        vcc_1v8: DCDC_REG4 {
                                regulator-always-on;
                                regulator-boot-on;
                                regulator-min-microvolt = <1800000>;
                                regulator-max-microvolt = <1800000>;
                                regulator-name = "vcc_1v8";
                                regulator-state-mem {
                                        regulator-on-in-suspend;
                                        regulator-suspend-microvolt = <1800000>;
                                };
                        };

                        vcc1v8_dvp: LDO_REG1 {
                                regulator-always-on;
                                regulator-boot-on;
                                regulator-min-microvolt = <1800000>;
                                regulator-max-microvolt = <1800000>;
                                regulator-name = "vcc1v8_dvp";
                                regulator-state-mem {
                                        regulator-off-in-suspend;
                                };
                        };

                        vcc3v0_tp: LDO_REG2 {
                                regulator-always-on;
                                regulator-boot-on;
                                regulator-min-microvolt = <3000000>;
                                regulator-max-microvolt = <3000000>;
                                regulator-name = "vcc3v0_tp";
                                regulator-state-mem {
                                        regulator-off-in-suspend;
                                };
                        };

                        vcc1v8_pmu: LDO_REG3 {
                                regulator-always-on;
                                regulator-boot-on;
                                regulator-min-microvolt = <1800000>;
                                regulator-max-microvolt = <1800000>;
                                regulator-name = "vcc1v8_pmu";
                                regulator-state-mem {
                                        regulator-on-in-suspend;
                                        regulator-suspend-microvolt = <1800000>;
                                };
                        };

                        vcc_sd: LDO_REG4 {
                                regulator-always-on;
                                regulator-boot-on;
                                regulator-min-microvolt = <1800000>;
                                regulator-max-microvolt = <3000000>;
                                regulator-name = "vcc_sd";
                                regulator-state-mem {
                                        regulator-on-in-suspend;
                                        regulator-suspend-microvolt = <3000000>;
                                };
                        };


                        vcca3v0_codec: LDO_REG5 {
                                regulator-always-on;
                                regulator-boot-on;
                                regulator-min-microvolt = <3000000>;
                                regulator-max-microvolt = <3000000>;
                                regulator-name = "vcca3v0_codec";
                                regulator-state-mem {
                                        regulator-off-in-suspend;
                                };
                        };

                        vcc_1v5: LDO_REG6 {
                                regulator-always-on;
                                regulator-boot-on;
                                regulator-min-microvolt = <1500000>;
                                regulator-max-microvolt = <1500000>;
                                regulator-name = "vcc_1v5";
                                regulator-state-mem {
                                        regulator-on-in-suspend;
                                        regulator-suspend-microvolt = <1500000>;
                                };
                        };

                        vcca1v8_codec: LDO_REG7 {
                                regulator-always-on;
                                regulator-boot-on;
                                regulator-min-microvolt = <1800000>;
                                regulator-max-microvolt = <1800000>;
                                regulator-name = "vcca1v8_codec";
                                regulator-state-mem {
                                        regulator-off-in-suspend;
                                };
                        };

                        vcc_3v0: LDO_REG8 {
                                regulator-always-on;
                                regulator-boot-on;
                                regulator-min-microvolt = <3000000>;
                                regulator-max-microvolt = <3000000>;
                                regulator-name = "vcc_3v0";
                                regulator-state-mem {
                                        regulator-on-in-suspend;
                                        regulator-suspend-microvolt = <3000000>;
                                };
                        };

                        vcc3v3_s3: SWITCH_REG1 {
                                regulator-always-on;
                                regulator-boot-on;
                                regulator-name = "vcc3v3_s3";
                                regulator-state-mem {
                                        regulator-on-in-suspend;
                                };
                        };

                        vcc3v3_s0: SWITCH_REG2 {
                                regulator-always-on;
                                regulator-boot-on;
                                regulator-name = "vcc3v3_s0";
                                regulator-state-mem {
                                        regulator-off-in-suspend;
                                };
                        };
                };
        };
};

  • regulator-compatible :驱动注册时需要匹配的名字,不能改动,否则会加载失败;
  • regulator-name :电源的名字,建议和硬件图上保持一致,使用 regulator_get 接口时需要匹配这个名字;
  • regulator-init-microvolt :u-boot阶段的初始化电压,kernel阶段无效;
  • regulator-min-microvolt :运行时可以调节的最小电压;
  • regulator-max-microvolt :运行时可以调节的最大电压;regulator-initial-mode :运行时 DCDC 的工作模式,一般配置为 1。 1:force pwm,2:auto pwm/pfm;
  • regulator-mode :休眠时 DCDC 的工作模式,一般配置为 2。1:force pwm, 2:autopwm/pfm;
  • regulator-initial-state :suspend 时的模式,必须配置成 3;
  • regulator-boot-on :存在这个属性时,在注册 regulator 的时候就会使能这路电源;
  • regulator-always-on :存在这个属性时,表示运行时不允许关闭这路电源且会在注册的时候使S能这路电源;
  • regulator-ramp-delay :DCDC 的电压上升时间,固定配置为 12500;
  • regulator-on-in-suspend :休眠时保持上电状态,想要关闭该路电源,则改成”regulator-off-in-suspend”;
  • regulator-suspend-microvolt :休眠不断电情况下的待机电压。

IO 电压域配置步骤

控制部分

  1. I2C
  2. 中断配置

rk808_i2c_int