struct hi6421_spmi_pmic *pmic;
u8 eco_mode_mask;
u32 eco_uA;
-};
-static DEFINE_MUTEX(enable_mutex);
+ /* Serialize regulator enable logic */
+ struct mutex enable_mutex;
+};
static const unsigned int ldo3_voltages[] = {
1500000, 1550000, 1600000, 1650000,
struct hi6421_spmi_pmic *pmic = sreg->pmic;
/* cannot enable more than one regulator at one time */
- mutex_lock(&enable_mutex);
+ mutex_lock(&sreg->enable_mutex);
usleep_range(HISI_REGS_ENA_PROTECT_TIME,
HISI_REGS_ENA_PROTECT_TIME + 1000);
rdev->desc->enable_mask,
rdev->desc->enable_mask);
- mutex_unlock(&enable_mutex);
+ mutex_unlock(&sreg->enable_mutex);
return 0;
}
return -ENOMEM;
sreg->pmic = pmic;
+ mutex_init(&sreg->enable_mutex);
for (i = 0; i < ARRAY_SIZE(regulator_info); i++) {
/* assign per-regulator data */