dcdc1_reg: regulator@0{
reg = <0>;
regulator-compatible= "act_dcdc1";
+ regulator-always-on;
+ regulator-boot-on;
};
dcdc2_reg: regulator@1 {
reg = <1>;
regulator-compatible = "act_dcdc2";
- regulator-min-microvolt = <800000>;
- regulator-max-microvolt = <1500000>;
- regulator-initial-state = <3>;
- regulator-state-mem {
- regulator-state-enabled;
- regulator-state-uv = <1200000>;
- };
+ regulator-always-on;
+ regulator-boot-on;
};
dcdc3_reg: regulator@2 {
reg = <2>;
regulator-compatible = "act_dcdc3";
- regulator-min-microvolt = <800000>;
- regulator-max-microvolt = <1500000>;
- regulator-initial-state = <3>;
- regulator-state-mem {
- regulator-state-enabled;
- regulator-state-uv = <1200000>;
- };
+ regulator-always-on;
+ regulator-boot-on;
};
dcdc4_reg: regulator@3 {
reg = <3>;
regulator-compatible = "act_dcdc4";
- regulator-initial-state = <3>;
- regulator-state-mem {
- regulator-state-enabled;
- regulator-state-uv = <3300000>;
- };
+ regulator-always-on;
+ regulator-boot-on;
};
ldo1_reg: regulator@4 {
reg = <4>;
regulator-compatible= "act_ldo1";
- regulator-initial-state = <3>;
- regulator-state-mem {
- regulator-state-enabled;
- };
+ regulator-always-on;
+ regulator-boot-on;
};
ldo2_reg: regulator@5 {
reg = <5>;
regulator-compatible = "act_ldo2";
- regulator-initial-state = <3>;
- regulator-state-mem {
- regulator-state-enabled;
- };
+ regulator-always-on;
+ regulator-boot-on;
};
ldo3_reg: regulator@6 {
reg = <6>;
regulator-compatible = "act_ldo3";
- regulator-initial-state = <3>;
- regulator-state-mem {
- regulator-state-enabled;
- };
+ regulator-always-on;
+ regulator-boot-on;
};
ldo4_reg:regulator@7 {
reg = <7>;
regulator-compatible = "act_ldo4";
- regulator-initial-state = <3>;
- regulator-state-mem {
- regulator-state-enabled;
- };
+ regulator-always-on;
+ regulator-boot-on;
};
ldo5_reg: regulator@8 {
reg = <8>;
regulator-compatible= "act_ldo5";
- regulator-initial-state = <3>;
- regulator-state-mem {
- regulator-state-enabled;
- };
+ regulator-always-on;
+ regulator-boot-on;
};
ldo6_reg: regulator@9 {
reg = <9>;
regulator-compatible = "act_ldo6";
- regulator-initial-state = <3>;
- regulator-state-mem {
- regulator-state-enabled;
- };
+ regulator-always-on;
+ regulator-boot-on;
};
ldo7_reg: regulator@10 {
reg = <10>;
regulator-compatible = "act_ldo7";
- regulator-initial-state = <3>;
- regulator-state-mem {
- regulator-state-enabled;
- };
+ regulator-always-on;
+ regulator-boot-on;
};
ldo8_reg: regulator@11 {
reg = <11>;
regulator-compatible = "act_ldo8";
- regulator-initial-state = <3>;
- regulator-state-mem {
- regulator-state-enabled;
- };
+ regulator-always-on;
+ regulator-boot-on;
};
};
dcdc2_reg: regulator@1 {
regulator-name= "vdd_logic";
- regulator-always-on;
- regulator-boot-on;
+ regulator-min-microvolt = <700000>;
+ regulator-max-microvolt = <1500000>;
+ regulator-initial-state = <3>;
+ regulator-state-mem {
+ regulator-state-enabled;
+ regulator-state-uv = <1200000>;
+ };
};
dcdc3_reg: regulator@2 {
regulator-name= "vdd_arm";
- regulator-always-on;
- regulator-boot-on;
+ regulator-min-microvolt = <700000>;
+ regulator-max-microvolt = <1500000>;
+ regulator-initial-state = <3>;
+ regulator-state-mem {
+ regulator-state-enabled;
+ regulator-state-uv = <1200000>;
+ };
};
dcdc4_reg: regulator@3 {
regulator-name= "vccio";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <3300000>;
- regulator-always-on;
- regulator-boot-on;
+ regulator-initial-state = <3>;
+ regulator-state-mem {
+ regulator-state-enabled;
+ regulator-state-uv = <3300000>;
+ };
};
ldo1_reg: regulator@4 {
regulator-name= "act_ldo1";
regulator-min-microvolt = <1000000>;
regulator-max-microvolt = <1000000>;
- regulator-always-on;
- regulator-boot-on;
+
};
ldo2_reg: regulator@5 {
regulator-name= "act_ldo2";
regulator-min-microvolt = <1200000>;
regulator-max-microvolt = <1200000>;
- regulator-always-on;
- regulator-boot-on;
+
};
ldo3_reg: regulator@6 {
regulator-name= "act_ldo3";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
- regulator-always-on;
- regulator-boot-on;
+
};
ldo4_reg:regulator@7 {
regulator-name= "act_ldo4";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
- regulator-always-on;
- regulator-boot-on;
+
};
ldo5_reg: regulator@8 {
regulator-name= "act_ldo5";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
- regulator-always-on;
- regulator-boot-on;
+
};
ldo6_reg: regulator@9 {
regulator-name= "act_ldo6";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
- regulator-always-on;
- regulator-boot-on;
+
};
ldo7_reg: regulator@10 {
regulator-name= "act_ldo7";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
- regulator-always-on;
- regulator-boot-on;
+
};
ldo8_reg: regulator@11 {
regulator-name= "act_ldo8";
regulator-min-microvolt = <2800000>;
regulator-max-microvolt = <2800000>;
- regulator-always-on;
- regulator-boot-on;
+
};
};
};
};
};
};
+ act8846: act8846@5a {
+ reg = <0x5a>;
+ status = "okay";
+ };
ricoh619: ricoh619@32 {
reg = <0x32>;
auto-freq=<1>;
status="okay";
};
+/include/ "act8846.dtsi"
+&act8846 {
+ gpios =<&gpio7 GPIO_A1 GPIO_ACTIVE_LOW>,<&gpio0 GPIO_B2 GPIO_ACTIVE_HIGH>;
+
+ regulators {
+
+ dcdc1_reg: regulator@0{
+ regulator-name= "act_dcdc1";
+ regulator-min-microvolt = <1200000>;
+ regulator-max-microvolt = <1200000>;
+ regulator-always-on;
+ regulator-boot-on;
+ };
+
+ dcdc2_reg: regulator@1 {
+ regulator-name= "vccio";
+ regulator-min-microvolt = <3300000>;
+ regulator-max-microvolt = <3300000>;
+ regulator-initial-state = <3>;
+ regulator-state-mem {
+ regulator-state-enabled;
+ regulator-state-uv = <3300000>;
+ };
+ };
+
+ dcdc3_reg: regulator@2 {
+ regulator-name= "vdd_logic";
+ regulator-min-microvolt = <700000>;
+ regulator-max-microvolt = <1500000>;
+ regulator-initial-state = <3>;
+ regulator-state-mem {
+ regulator-state-enabled;
+ regulator-state-uv = <1200000>;
+ };
+
+ };
+
+ dcdc4_reg: regulator@3 {
+ regulator-name= "act_dcdc4";
+ regulator-min-microvolt = <2000000>;
+ regulator-max-microvolt = <2000000>;
+ regulator-initial-state = <3>;
+ regulator-state-mem {
+ regulator-state-enabled;
+ regulator-state-uv = <2000000>;
+ };
+ };
+
+ ldo1_reg: regulator@4 {
+ regulator-name= "vccio_sd";
+ regulator-min-microvolt = <3300000>;
+ regulator-max-microvolt = <3300000>;
+
+ };
+
+ ldo2_reg: regulator@5 {
+ regulator-name= "act_ldo2";
+ regulator-min-microvolt = <1000000>;
+ regulator-max-microvolt = <1000000>;
+
+ };
+
+ ldo3_reg: regulator@6 {
+ regulator-name= "act_ldo3";
+ regulator-min-microvolt = <1800000>;
+ regulator-max-microvolt = <1800000>;
+
+ };
+
+ ldo4_reg:regulator@7 {
+ regulator-name= "act_ldo4";
+ regulator-min-microvolt = <3300000>;
+ regulator-max-microvolt = <3300000>;
+
+ };
+
+ ldo5_reg: regulator@8 {
+ regulator-name= "act_ldo5";
+ regulator-min-microvolt = <3300000>;
+ regulator-max-microvolt = <3300000>;
+
+ };
+
+ ldo6_reg: regulator@9 {
+ regulator-name= "act_ldo6";
+ regulator-min-microvolt = <1000000>;
+ regulator-max-microvolt = <1000000>;
+ regulator-initial-state = <3>;
+ regulator-state-mem {
+ regulator-state-enabled;
+ };
+
+ };
+
+ ldo7_reg: regulator@10 {
+ regulator-name= "vcc_18";
+ regulator-min-microvolt = <1800000>;
+ regulator-max-microvolt = <1800000>;
+ regulator-initial-state = <3>;
+ regulator-state-mem {
+ regulator-state-enabled;
+ };
+
+ };
+
+ ldo8_reg: regulator@11 {
+ regulator-name= "act_ldo8";
+ regulator-min-microvolt = <1800000>;
+ regulator-max-microvolt = <1800000>;
+
+ };
+ };
+};
+
/include/ "rk808.dtsi"
&rk808 {
int irq_base;
int chip_irq;
int pmic_sleep_gpio; /* */
+ int pmic_hold_gpio; /* */
unsigned int dcdc_slp_voltage[3]; /* buckx_voltage in uV */
bool pmic_sleep;
struct regmap *regmap;
#else
ret = act8846_set_bits(act8846, act8846_BUCK_SET_VOL_REG(buck) ,BUCK_VOL_MASK, val);
#endif
+
+ if(ret < 0)
+ printk("##################:set voltage error!voltage set is %d mv\n",vol_map[val]);
return ret;
}
DBG("***run in %s %d msgs[1].buf = %d\n",__FUNCTION__,__LINE__,*(msgs[1].buf));
- return 0;
+ return ret;
}
static int act8846_i2c_write(struct i2c_client *i2c, char reg, int count, const u16 src)
static u8 act8846_reg_read(struct act8846 *act8846, u8 reg)
{
u16 val = 0;
+ int ret;
mutex_lock(&act8846->io_lock);
- act8846_i2c_read(act8846->i2c, reg, 1, &val);
+ ret = act8846_i2c_read(act8846->i2c, reg, 1, &val);
+ if(ret < 0){
+ mutex_unlock(&act8846->io_lock);
+ return ret;
+ }
DBG("reg read 0x%02x -> 0x%02x\n", (int)reg, (unsigned)val&0xff);
mutex_lock(&act8846->io_lock);
ret = act8846_i2c_read(act8846->i2c, reg, 1, &tmp);
+ if(ret < 0){
+ mutex_unlock(&act8846->io_lock);
+ return ret;
+ }
DBG("1 reg read 0x%02x -> 0x%02x\n", (int)reg, (unsigned)tmp&0xff);
tmp = (tmp & ~mask) | val;
- if (ret == 0) {
- ret = act8846_i2c_write(act8846->i2c, reg, 1, tmp);
- DBG("reg write 0x%02x -> 0x%02x\n", (int)reg, (unsigned)val&0xff);
+ ret = act8846_i2c_write(act8846->i2c, reg, 1, tmp);
+ if(ret < 0){
+ mutex_unlock(&act8846->io_lock);
+ return ret;
+ }
+ DBG("reg write 0x%02x -> 0x%02x\n", (int)reg, (unsigned)val&0xff);
+
+ ret = act8846_i2c_read(act8846->i2c, reg, 1, &tmp);
+ if(ret < 0){
+ mutex_unlock(&act8846->io_lock);
+ return ret;
}
- act8846_i2c_read(act8846->i2c, reg, 1, &tmp);
DBG("2 reg read 0x%02x -> 0x%02x\n", (int)reg, (unsigned)tmp&0xff);
mutex_unlock(&act8846->io_lock);
printk("invalid gpio: %d\n",gpio);
pdata->pmic_sleep_gpio = gpio;
pdata->pmic_sleep = true;
+
+ gpio = of_get_named_gpio(act8846_pmic_np,"gpios", 1);
+ if (!gpio_is_valid(gpio))
+ printk("invalid gpio: %d\n",gpio);
+ pdata->pmic_hold_gpio = gpio;
return pdata;
}
if (act8846->dev->of_node)
pdev = act8846_parse_dt(act8846);
+
+ #ifdef CONFIG_OF
+ act8846->pmic_hold_gpio = pdev->pmic_hold_gpio;
+ if (act8846->pmic_hold_gpio) {
+ ret = gpio_request(act8846->pmic_hold_gpio, "act8846_pmic_hold");
+ if (ret < 0) {
+ dev_err(act8846->dev,"Failed to request gpio %d with ret:""%d\n", act8846->pmic_hold_gpio, ret);
+ return IRQ_NONE;
+ }
+ gpio_direction_output(act8846->pmic_hold_gpio,1);
+ ret = gpio_get_value(act8846->pmic_hold_gpio);
+ gpio_free(act8846->pmic_hold_gpio);
+ printk("%s: act8846_pmic_hold=%x\n", __func__, ret);
+ }
+ #endif
/******************************set sleep vol & dcdc mode******************/
#ifdef CONFIG_OF
struct regulator_init_data *act8846_init_data[act8846_NUM_REGULATORS];
struct device_node *of_node[act8846_NUM_REGULATORS];
int pmic_sleep_gpio; /* */
+ int pmic_hold_gpio; /* */
unsigned int dcdc_slp_voltage[3]; /* buckx_voltage in uV */
unsigned int dcdc_mode[3]; /* buckx_voltage in uV */
bool pmic_sleep;