mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 12:17:12 +09:00
ARM64: dt: rk3368: add driver support for rk818
Support rk818 pmic, patch is from zhangqing@rock-chips.com. Signed-off-by: Zhangqing <zhangqing@rock-chips.com> Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
This commit is contained in:
@@ -205,6 +205,9 @@
|
||||
pmu-supply = <&ldo5_reg>; /*PMUIO_VDD*/
|
||||
vop-supply = <&ldo5_reg>; /*LCDC_VDD*/
|
||||
};
|
||||
test-power{
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -405,7 +408,7 @@
|
||||
regulator-max-microvolt = <1500000>;
|
||||
regulator-always-on;
|
||||
regulator-boot-on;
|
||||
regulator-initial-mode = <0x1>;
|
||||
regulator-initial-mode = <0x2>;
|
||||
regulator-initial-state = <3>;
|
||||
regulator-state-mem {
|
||||
regulator-state-mode = <0x2>;
|
||||
@@ -418,7 +421,7 @@
|
||||
syr828: syr828@41 {
|
||||
compatible = "silergy,syr82x";
|
||||
reg = <0x41>;
|
||||
status = "okay";
|
||||
status = "disabled";
|
||||
regulators {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
@@ -445,6 +448,11 @@
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
rk818: rk818@1c {
|
||||
reg = <0x1c>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
CW2015@62 {
|
||||
compatible = "cw201x";
|
||||
reg = <0x62>;
|
||||
@@ -859,6 +867,189 @@
|
||||
};
|
||||
};
|
||||
|
||||
/include/ "../../../arm/boot/dts/rk818.dtsi"
|
||||
&rk818 {
|
||||
gpios =<&gpio0 GPIO_A1 GPIO_ACTIVE_HIGH>,<&gpio0 GPIO_A0 GPIO_ACTIVE_LOW>;
|
||||
rk818,system-power-controller;
|
||||
|
||||
rk818,support_dc_chg = <1>;/*1:dc chg; 0:usb chg*/
|
||||
regulators {
|
||||
|
||||
rk818_dcdc1_reg: regulator@0{
|
||||
regulator-name= "vdd_logic";/*vcc arm*/
|
||||
regulator-min-microvolt = <700000>;/*<725000>;*/
|
||||
regulator-max-microvolt = <1500000>;
|
||||
regulator-initial-mode = <0x2>;
|
||||
regulator-initial-state = <3>;
|
||||
regulator-state-mem {
|
||||
regulator-state-mode = <0x2>;
|
||||
regulator-state-enabled;
|
||||
regulator-state-uv =<1100000>;
|
||||
};
|
||||
};
|
||||
|
||||
rk818_dcdc2_reg: regulator@1 {
|
||||
regulator-name= "rk818_dcdc2";/*vcc gpu*/
|
||||
regulator-min-microvolt = <700000>;
|
||||
regulator-max-microvolt = <1200000>;
|
||||
regulator-initial-mode = <0x2>;
|
||||
regulator-initial-state = <3>;
|
||||
regulator-state-mem {
|
||||
regulator-state-mode = <0x2>;
|
||||
regulator-state-enabled;
|
||||
regulator-state-uv = <1200000>;
|
||||
};
|
||||
};
|
||||
|
||||
rk818_dcdc3_reg: regulator@2 {
|
||||
regulator-name= "rk818_dcdc3";
|
||||
regulator-min-microvolt = <1200000>;
|
||||
regulator-max-microvolt = <1200000>;
|
||||
regulator-initial-mode = <0x2>;
|
||||
regulator-initial-state = <3>;
|
||||
regulator-state-mem {
|
||||
regulator-state-mode = <0x2>;
|
||||
regulator-state-enabled;
|
||||
regulator-state-uv = <1200000>;
|
||||
};
|
||||
};
|
||||
|
||||
rk818_dcdc4_reg: regulator@3 {
|
||||
regulator-name= "vccio";
|
||||
regulator-min-microvolt = <3000000>;
|
||||
regulator-max-microvolt = <3000000>;
|
||||
regulator-initial-mode = <0x2>;
|
||||
regulator-initial-state = <3>;
|
||||
regulator-state-mem {
|
||||
regulator-state-mode = <0x2>;
|
||||
regulator-state-enabled;
|
||||
regulator-state-uv = <3000000>;
|
||||
};
|
||||
};
|
||||
|
||||
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>;
|
||||
};
|
||||
};
|
||||
|
||||
rk818_ldo2_reg: regulator@5 {
|
||||
regulator-name= "rk818_ldo2";
|
||||
regulator-min-microvolt = <3000000>;
|
||||
regulator-max-microvolt = <3000000>;
|
||||
regulator-initial-state = <3>;
|
||||
regulator-state-mem {
|
||||
regulator-state-enabled;
|
||||
regulator-state-uv = <3000000>;
|
||||
};
|
||||
};
|
||||
|
||||
rk818_ldo3_reg: regulator@6 {
|
||||
regulator-name= "rk818_ldo3";
|
||||
regulator-min-microvolt = <1000000>;
|
||||
regulator-max-microvolt = <1000000>;
|
||||
regulator-initial-state = <3>;
|
||||
regulator-state-mem {
|
||||
regulator-state-enabled;
|
||||
regulator-state-uv = <1000000>;
|
||||
};
|
||||
};
|
||||
|
||||
rk818_ldo4_reg:regulator@7 {
|
||||
regulator-name= "rk818_ldo4";
|
||||
regulator-min-microvolt = <1800000>;
|
||||
regulator-max-microvolt = <1800000>;
|
||||
regulator-initial-state = <3>;
|
||||
regulator-state-mem {
|
||||
regulator-state-disabled;
|
||||
regulator-state-uv = <1800000>;
|
||||
};
|
||||
};
|
||||
|
||||
rk818_ldo5_reg: regulator@8 {
|
||||
regulator-name= "rk818_ldo5";
|
||||
regulator-min-microvolt = <1800000>;
|
||||
regulator-max-microvolt = <1800000>;
|
||||
regulator-initial-state = <3>;
|
||||
regulator-state-mem {
|
||||
regulator-state-enabled;
|
||||
regulator-state-uv = <1800000>;
|
||||
};
|
||||
};
|
||||
|
||||
rk818_ldo6_reg: regulator@9 {
|
||||
regulator-name= "rk818_ldo6";
|
||||
regulator-min-microvolt = <1000000>;
|
||||
regulator-max-microvolt = <1000000>;
|
||||
regulator-initial-state = <3>;
|
||||
regulator-state-mem {
|
||||
regulator-state-disabled;
|
||||
regulator-state-uv = <1000000>;
|
||||
};
|
||||
};
|
||||
|
||||
rk818_ldo7_reg: regulator@10 {
|
||||
regulator-name= "rk818_ldo7";
|
||||
regulator-min-microvolt = <1800000>;
|
||||
regulator-max-microvolt = <1800000>;
|
||||
regulator-initial-state = <3>;
|
||||
regulator-state-mem {
|
||||
regulator-state-enabled;
|
||||
regulator-state-uv = <1800000>;
|
||||
};
|
||||
};
|
||||
|
||||
rk818_ldo8_reg: regulator@11 {
|
||||
regulator-name= "rk818_ldo8";
|
||||
regulator-min-microvolt = <1800000>;
|
||||
regulator-max-microvolt = <1800000>;
|
||||
regulator-initial-state = <3>;
|
||||
regulator-state-mem {
|
||||
regulator-state-enabled;
|
||||
regulator-state-uv = <1800000>;
|
||||
};
|
||||
};
|
||||
|
||||
rk818_ldo9_reg: regulator@12 {
|
||||
regulator-name= "vccio_sd";
|
||||
regulator-min-microvolt = <1800000>;
|
||||
regulator-max-microvolt = <3300000>;
|
||||
regulator-initial-state = <3>;
|
||||
regulator-state-mem {
|
||||
regulator-state-enabled;
|
||||
regulator-state-uv = <3300000>;
|
||||
};
|
||||
};
|
||||
|
||||
rk818_ldo10_reg: regulator@13 {
|
||||
regulator-name= "rk818_ldo10";
|
||||
regulator-state-mem {
|
||||
regulator-state-disabled;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
battery {
|
||||
ocv_table = <3350 3677 3693 3719 3752
|
||||
3770 3775 3778 3785 3796
|
||||
3812 3839 3881 3907 3933
|
||||
3958 3978 4033 4087 4123
|
||||
4174 >;
|
||||
design_capacity = <2100>;
|
||||
design_qmax = <2200>;
|
||||
max_overcharge = <100>;
|
||||
max_charge_currentma = <1500>;
|
||||
max_charge_voltagemv = <4260>;
|
||||
max_bat_voltagemv = <4200>;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
&ion_cma {
|
||||
reg = <0x00000000 0x28000000>; /* 640MB */
|
||||
};
|
||||
|
||||
@@ -1088,52 +1088,53 @@ static int rk818_resume(struct i2c_client *i2c)
|
||||
static int rk818_pre_init(struct rk818 *rk818)
|
||||
{
|
||||
int ret,val;
|
||||
printk("%s,line=%d\n", __func__,__LINE__);
|
||||
printk("%s,line=%d\n", __func__,__LINE__);
|
||||
|
||||
ret = rk818_set_bits(rk818, 0xa1, (0xF<<0),(0x7));
|
||||
ret = rk818_set_bits(rk818, 0xa1,(0x7<<4),(0x7<<4)); //close charger when usb low then 3.4V
|
||||
ret = rk818_set_bits(rk818, 0x52,(0x1<<1),(0x1<<1)); //no action when vref
|
||||
ret = rk818_set_bits(rk818, 0x52,(0x1<<0),(0x1<<0)); //enable HDMI 5V
|
||||
ret = rk818_set_bits(rk818, 0x52,(0x1<<1),(0x1<<1)); //no action when vref
|
||||
ret = rk818_set_bits(rk818, 0x52,(0x1<<0),(0x1<<0)); //enable HDMI 5V
|
||||
|
||||
/*******enable switch and boost***********/
|
||||
val = rk818_reg_read(rk818,RK818_DCDC_EN_REG);
|
||||
val |= (0x3 << 5); //enable switch1/2
|
||||
val |= (0x3 << 5); //enable switch1/2
|
||||
val |= (0x1 << 4); //enable boost
|
||||
ret = rk818_reg_write(rk818,RK818_DCDC_EN_REG,val);
|
||||
if (ret <0) {
|
||||
printk(KERN_ERR "Unable to write RK818_DCDC_EN_REG reg\n");
|
||||
return ret;
|
||||
ret = rk818_reg_write(rk818,RK818_DCDC_EN_REG,val);
|
||||
if (ret <0) {
|
||||
printk(KERN_ERR "Unable to write RK818_DCDC_EN_REG reg\n");
|
||||
return ret;
|
||||
}
|
||||
/****************************************/
|
||||
|
||||
|
||||
/****************set vbat low **********/
|
||||
val = rk818_reg_read(rk818,RK818_VB_MON_REG);
|
||||
val &=(~(VBAT_LOW_VOL_MASK | VBAT_LOW_ACT_MASK));
|
||||
val |= (RK818_VBAT_LOW_3V5 | EN_VBAT_LOW_IRQ);
|
||||
ret = rk818_reg_write(rk818,RK818_VB_MON_REG,val);
|
||||
if (ret <0) {
|
||||
printk(KERN_ERR "Unable to write RK818_VB_MON_REG reg\n");
|
||||
return ret;
|
||||
}
|
||||
val &=(~(VBAT_LOW_VOL_MASK | VBAT_LOW_ACT_MASK));
|
||||
val |= (RK818_VBAT_LOW_3V5 | EN_VBAT_LOW_IRQ);
|
||||
ret = rk818_reg_write(rk818,RK818_VB_MON_REG,val);
|
||||
if (ret <0) {
|
||||
printk(KERN_ERR "Unable to write RK818_VB_MON_REG reg\n");
|
||||
return ret;
|
||||
}
|
||||
/**************************************/
|
||||
|
||||
|
||||
/**********mask int****************/
|
||||
val = rk818_reg_read(rk818,RK818_INT_STS_MSK_REG1);
|
||||
val |= (0x1<<0); //mask vout_lo_int
|
||||
ret = rk818_reg_write(rk818,RK818_INT_STS_MSK_REG1,val);
|
||||
if (ret <0) {
|
||||
printk(KERN_ERR "Unable to write RK818_INT_STS_MSK_REG1 reg\n");
|
||||
return ret;
|
||||
}
|
||||
val = rk818_reg_read(rk818,RK818_INT_STS_MSK_REG1);
|
||||
val |= (0x1<<0); //mask vout_lo_int
|
||||
ret = rk818_reg_write(rk818,RK818_INT_STS_MSK_REG1,val);
|
||||
if (ret <0) {
|
||||
printk(KERN_ERR "Unable to write RK818_INT_STS_MSK_REG1 reg\n");
|
||||
return ret;
|
||||
}
|
||||
/**********************************/
|
||||
/**********enable clkout2****************/
|
||||
ret = rk818_reg_write(rk818,RK818_CLK32OUT_REG,0x01);
|
||||
if (ret <0) {
|
||||
printk(KERN_ERR "Unable to write RK818_CLK32OUT_REG reg\n");
|
||||
return ret;
|
||||
}
|
||||
ret = rk818_reg_write(rk818,RK818_CLK32OUT_REG,0x01);
|
||||
if (ret <0) {
|
||||
printk(KERN_ERR "Unable to write RK818_CLK32OUT_REG reg\n");
|
||||
return ret;
|
||||
}
|
||||
/**********************************/
|
||||
ret = rk818_clear_bits(rk818, RK818_INT_STS_MSK_REG1,(0x3<<5)); //open rtc int when power on
|
||||
ret = rk818_set_bits(rk818, RK818_RTC_INT_REG,(0x1<<3),(0x1<<3)); //open rtc int when power on
|
||||
ret = rk818_set_bits(rk818, RK818_RTC_INT_REG,(0x1<<3),(0x1<<3)); //open rtc int when power on
|
||||
|
||||
/*****disable otg and boost when in sleep mode****/
|
||||
val = rk818_reg_read(rk818, RK818_SLEEP_SET_OFF_REG1);
|
||||
|
||||
Reference in New Issue
Block a user