sx933x: turn off sensing before flip updates

Turn off the sensing before updating for flip open/close.
It is possibly leading to random lockups.

Change-Id: I09b48a36adc7ca0d0514e9af4d8ef881c118d6b8
Signed-off-by: Ryan Lattrel <ryanl@motorola.com>
Reviewed-on: https://gerrit.mot.com/1568380
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Perry White <awhite6@motorola.com>
Reviewed-by: Konstantin Makariev <kmakariev@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
Ryan Lattrel 2020-05-20 09:55:17 -05:00
commit 51c7c1a3eb

View file

@ -1044,6 +1044,11 @@ static int ps_notify_callback(struct notifier_block *self,
static void write_flip_regs(int num_regs, struct smtc_reg_data *regs)
{
int i;
u32 temp = 0;
/* Disable if we are on */
sx933x_i2c_read_16bit(global_sx933x, SX933X_GNRLCTRL2_REG, &temp);
sx933x_i2c_write_16bit(global_sx933x, SX933X_GNRLCTRL2_REG, temp & 0xFFFFFFE0);
for(i=0; i < num_regs; i++)
{
@ -1053,6 +1058,14 @@ static void write_flip_regs(int num_regs, struct smtc_reg_data *regs)
sx933x_i2c_write_16bit(global_sx933x,
regs[i].reg, regs[i].val);
}
/* If one of the sensors is on, re-enable it */
for (i=0; i < ARRAY_SIZE(psmtcButtons); i++) {
if (psmtcButtons[i].enabled) {
sx933x_i2c_write_16bit(global_sx933x, SX933X_GNRLCTRL2_REG, temp | 0x0000001F);
break;
}
}
}
static void update_flip_regs(struct sx933x_platform_data *data, unsigned long state)