diff --git a/drivers/misc/sx933x/sx933x_sar.c b/drivers/misc/sx933x/sx933x_sar.c index 02d2ddd8d746..7ecabe192ede 100644 --- a/drivers/misc/sx933x/sx933x_sar.c +++ b/drivers/misc/sx933x/sx933x_sar.c @@ -831,7 +831,15 @@ static int ps_notify_callback(struct notifier_block *self, && psy && psy->desc->get_property && psy->desc->name && !strncmp(psy->desc->name, "phone", sizeof("phone")) && data) { LOG_INFO("phone ps notification: event = %lu\n", event); - schedule_work(&data->ps_notify_work); + + retval = ps_get_state(psy, &present); + if (retval) + return retval; + + if (data->phone_is_present != present) { + data->phone_is_present = present; + schedule_work(&data->ps_notify_work); + } } #endif diff --git a/include/linux/input/sx933x.h b/include/linux/input/sx933x.h index a570f569aa4a..01f9745fba33 100644 --- a/include/linux/input/sx933x.h +++ b/include/linux/input/sx933x.h @@ -700,6 +700,9 @@ struct sx933x_platform_data struct work_struct ps_notify_work; struct notifier_block ps_notif; bool ps_is_present; +#ifdef CONFIG_CAPSENSE_ATTACH_CAL + bool phone_is_present; +#endif #endif pbuttonInformation_t pbuttonInformation;