+ if (act8846->dev->of_node)
+ pdev = act8846_parse_dt(act8846);
+
+ /******************************set sleep vol & dcdc mode******************/
+ #ifdef CONFIG_OF
+ act8846->pmic_sleep_gpio = pdev->pmic_sleep_gpio;
+ if (act8846->pmic_sleep_gpio) {
+ ret = gpio_request(act8846->pmic_sleep_gpio, "act8846_pmic_sleep");
+ if (ret < 0) {
+ dev_err(act8846->dev,"Failed to request gpio %d with ret:""%d\n", act8846->pmic_sleep_gpio, ret);
+ return IRQ_NONE;
+ }
+ gpio_direction_input(act8846->pmic_sleep_gpio);
+ ret = gpio_get_value(act8846->pmic_sleep_gpio);
+ gpio_free(act8846->pmic_sleep_gpio);
+ printk("%s: act8846_pmic_sleep=%x\n", __func__, ret);
+ }
+ for (i = 0;i <4 ; i ++){
+ act8846->dcdc_slp_voltage[i] = pdev->dcdc_slp_voltage[i];
+ if (act8846->dcdc_slp_voltage[i]){
+ if (i ==0)
+ continue;
+
+ #ifdef CONFIG_ACT8846_SUPPORT_RESET
+ ret = act8846_set_bits(act8846, act8846_BUCK_SET_VOL_REG(i) ,BUCK_VOL_MASK, act8846_dcdc_sleep_voltage_get_val(act8846->dcdc_slp_voltage[i],i));
+ #else
+ ret = act8846_set_bits(act8846, (act8846_BUCK_SET_VOL_REG(i) +0x01),BUCK_VOL_MASK, act8846_dcdc_sleep_voltage_get_val(act8846->dcdc_slp_voltage[i],i));
+ #endif
+ }
+ }
+ #endif
+
+ if (pdev) {
+ act8846->num_regulators = act8846_NUM_REGULATORS;
+ act8846->rdev = kcalloc(act8846_NUM_REGULATORS,sizeof(struct regulator_dev *), GFP_KERNEL);
+ if (!act8846->rdev) {
+ return -ENOMEM;
+ }
+ /* Instantiate the regulators */
+ for (i = 0; i < act8846_NUM_REGULATORS; i++) {
+ reg_data = pdev->act8846_init_data[i];
+ if (!reg_data)
+ continue;
+ config.dev = act8846->dev;
+ config.driver_data = act8846;
+ config.regmap = act8846->regmap;
+ if (act8846->dev->of_node)
+ config.of_node = pdev->of_node[i];
+
+ if (reg_data && reg_data->constraints.name)
+ rail_name = reg_data->constraints.name;
+ else
+ rail_name = regulators[i].name;
+ reg_data->supply_regulator = rail_name;
+
+ config.init_data =reg_data;
+
+ act_rdev = regulator_register(®ulators[i],&config);
+ if (IS_ERR(act_rdev)) {
+ printk("failed to register %d regulator\n",i);
+ goto err;
+ }
+ act8846->rdev[i] = act_rdev;
+ }
+ }
+