static int d2041_regulator_get_voltage(struct regulator_dev *rdev) { struct d2041 *d2041 = rdev_get_drvdata(rdev); unsigned int reg_num, regulator_id = rdev_get_id(rdev); int ret; u8 val; dlg_info("[[%s]], regulator_id[%d]\n", __func__, regulator_id); reg_num = get_regulator_reg(regulator_id); ret = d2041_reg_read(d2041, reg_num, &val); val &= D2041_MAX_VSEL; ret = mV_to_uV(d2041_regulator_val_to_mvolts(val, regulator_id, rdev)); return ret; }
}, { .constraints = { .name = "HVINN", .min_uV = V_to_uV(-22), .max_uV = V_to_uV(-22), }, }, { .constraints = { .name = "HVINP", .min_uV = V_to_uV(20), .max_uV = V_to_uV(20), }, }, { .constraints = { .name = "VCOM", .min_uV = mV_to_uV(-4325), .max_uV = mV_to_uV(-500), .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS, }, .num_consumer_supplies = ARRAY_SIZE(vcom_consumers), .consumer_supplies = vcom_consumers, }, { .constraints = { .name = "VNEG", .min_uV = V_to_uV(-15), .max_uV = V_to_uV(-15), }, }, { .constraints = { .name = "VPOS",
.supply = "VDDA", .dev_name = "1-000a", }, { /* sgtl5000 */ .supply = "VDDIO", .dev_name = "1-000a", }, }; struct mc13892; static struct regulator_init_data sw1_init = { .constraints = { .name = "SW1", .min_uV = mV_to_uV(600), .max_uV = mV_to_uV(1375), .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE, .valid_modes_mask = 0, .always_on = 1, .boot_on = 1, .initial_state = PM_SUSPEND_MEM, .state_mem = { .uV = 850000, .mode = REGULATOR_MODE_NORMAL, .enabled = 1, }, }, .num_consumer_supplies = ARRAY_SIZE(sw1_consumers), .consumer_supplies = sw1_consumers, };
ret = d2041_reg_write(d2041, mctl_reg, reg_val); dlg_info("[REGULATOR] %s. reg_val = 0x%X\n", __func__, reg_val); return ret; } static int d2041_register_regulator(struct d2041 *d2041, int reg, struct regulator_init_data *initdata); static struct regulator_init_data d2041_regulators_init_data[D2041_NUMBER_OF_REGULATORS] = { [D2041_BUCK_1] = { .constraints = { .min_uV = mV_to_uV(D2041_BUCK12_VOLT_LOWER), .max_uV = mV_to_uV(D2041_BUCK12_VOLT_UPPER), .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_MODE, .valid_modes_mask = REGULATOR_MODE_NORMAL, .always_on = 1, }, }, [D2041_BUCK_2] = { .constraints = { .min_uV = mV_to_uV(D2041_BUCK12_VOLT_LOWER), .max_uV = mV_to_uV(D2041_BUCK12_VOLT_UPPER), .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_MODE, .valid_modes_mask = REGULATOR_MODE_NORMAL, .always_on = 1,
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE, .always_on = 1, .boot_on = 1, .initial_state = PM_SUSPEND_MEM, .state_mem = { .uV = 950000, .mode = REGULATOR_MODE_NORMAL, .enabled = 1, }, } }; static struct regulator_init_data sw4a_init = { .constraints = { .name = "SW4A", .min_uV = mV_to_uV(1200), .max_uV = mV_to_uV(3300), .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE, .always_on = 1, .boot_on = 1, } }; static struct regulator_init_data sw4b_init = { .constraints = { .name = "SW4B", .min_uV = mV_to_uV(1200), .max_uV = mV_to_uV(3300), .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE, .always_on = 1, .boot_on = 1,
WM8350_LDO_HIB_MODE_IMAGE, WM8350_LDO_HIB_SIG_REG); wm8350_ldo_set_image_voltage(pmic, WM8350_LDO_4, 2500, WM8350_LDO_HIB_MODE_IMAGE, WM8350_LDO_HIB_MODE_DIS); return 0; } #endif struct regulation_constraints led_regulation_constraints = { .min_uA = 0, .max_uA = 230000, .valid_ops_mask = REGULATOR_CHANGE_CURRENT, }; struct regulation_constraints dcdc1_regulation_constraints = { .min_uV = mV_to_uV(850), .max_uV = mV_to_uV(1000), .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_MODE, }; struct regulation_constraints dcdc4_regulation_constraints = { .min_uV = mV_to_uV(1000), .max_uV = mV_to_uV(1200), .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_MODE, }; static void set_regulator_constraints(struct wm8350 *wm8350) { regulator_set_platform_constraints("DCDC1", &dcdc1_regulation_constraints); regulator_set_platform_constraints("DCDC4", &dcdc4_regulation_constraints);
}, }; static struct regulator_consumer_supply rddr_consumers[] = { { /* sgtl5000 */ .supply = "VDDIO", .dev_name = "0-000a", }, }; static struct regulator_init_data rbklt_init = { .constraints = { .name = "REG1_BKLT", .min_uV = mV_to_uV(REG1_V_MV * (1000 + REG1_DVS_MIN_PCT * 10) / 1000), .max_uV = mV_to_uV(REG1_V_MV * (1000 + REG1_DVS_MAX_PCT * 10) / 1000), .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE, } }; static struct regulator_init_data rcpu_init = { .constraints = { .name = "REG2_CPU", .min_uV = mV_to_uV(REG2_V_MV * (1000 + REG2_DVS_MIN_PCT * 10) / 1000), .max_uV = mV_to_uV(REG2_V_MV * (1000 + REG2_DVS_MAX_PCT * 10) /