mako: Fix unbalanced disables for vibrator

[ 3101.348816] amp_enable: AMP_EN is set to 1
[ 3102.875995] ------------[ cut here ]------------
[ 3102.879749] WARNING: at android/kernel/drivers/regulator/core.c:1590 _reg
[ 3102.879779] unbalanced disables for 8921_l16
[ 3102.879779] Modules linked in:
[ 3102.879810] [<c0014380>] (unwind_backtrace+0x0/0x11c) from [<c007159c>] (
[ 3102.879810] [<c007159c>] (warn_slowpath_common+0x4c/0x64) from [<c0071634
[ 3102.879840] [<c0071634>] (warn_slowpath_fmt+0x2c/0x3c) from [<c02c5010>]
[ 3102.879871] [<c02c5010>] (_regulator_disable+0x30/0x23c) from [<c02c523c>
[ 3102.879871] [<c02c523c>] (regulator_disable+0x20/0x58) from [<c005bdcc>]
[ 3102.879901] [<c005bdcc>] (vibrator_power_set+0xfc/0x150) from [<c033fcb4>
[ 3102.879932] [<c033fcb4>] (android_vibrator_force_set+0x88/0x11c) from [<c

Change-Id: I54987c842384bd23b5daecddd6440d0ad0857523
This commit is contained in:
Devin Kim 2012-08-30 23:50:29 -07:00 committed by Iliyan Malchev
parent d6364a764d
commit cf89ad9f7b

View file

@ -93,48 +93,41 @@ static int vibrator_gpio_init(void)
}
static struct regulator *vreg_l16 = NULL;
static bool snddev_reg_8921_l16_status = false;
static int vibrator_enabled = 0;
static int vibrator_power_set(int enable)
{
int rc = -EINVAL;
if (NULL == vreg_l16) {
vreg_l16 = regulator_get(NULL, "vibrator"); //2.6 ~ 3V
pr_debug("%s: enable=%d\n", __func__, enable);
if (IS_ERR(vreg_l16)) {
pr_err("%s: regulator get of vibrator failed (%ld)\n"
, __func__, PTR_ERR(vreg_l16));
printk("woosock ERROR\n");
rc = PTR_ERR(vreg_l16);
pr_err("%s: regulator get of vibrator failed\n",
__func__);
return rc;
}
}
rc = regulator_set_voltage(vreg_l16, 2800000, 2800000);
if (enable == snddev_reg_8921_l16_status)
rc = regulator_set_voltage(vreg_l16, 2800000, 2800000);
if (rc < 0)
pr_err("%s: regulator_set_voltage failed\n", __func__);
if (enable == vibrator_enabled)
return 0;
vibrator_enabled = enable;
if (enable) {
rc = regulator_set_voltage(vreg_l16, 2800000, 2800000);
if (rc < 0)
pr_err("LGE: VIB %s: regulator_set_voltage(l1) failed (%d)\n",
__func__, rc);
rc = regulator_enable(vreg_l16);
if (rc < 0)
pr_err("LGE: VIB %s: regulator_enable(l1) failed (%d)\n", __func__, rc);
snddev_reg_8921_l16_status = true;
pr_err("%s: regulator_enable failed\n", __func__);
} else {
rc = regulator_disable(vreg_l16);
if (rc < 0)
pr_err("%s: regulator_disable(l1) failed (%d)\n", __func__, rc);
snddev_reg_8921_l16_status = false;
pr_err("%s: regulator_disable failed\n", __func__);
}
return 0;
return rc;
}
static int vibrator_pwm_set(int enable, int amp, int n_value)