mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-07 20:33:58 -04:00
sarsensor: fix usb_cal issue for a96t device
When the power state is changing, which causes the USB plug to be mistaken, and the sar sensor is calibrated. Change-Id: Ia844dd891bc1301c7fa2f73617db92ccbdb6a435 Signed-off-by: huangjq9 <huangjq9@motorola.com> Reviewed-on: https://gerrit.mot.com/1426418 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Jun Weng <wengjun1@motorola.com> Reviewed-by: Jiacheng Ou <oujc1@motorola.com> Reviewed-by: Huosheng Liao <liaohs@motorola.com> Submit-Approved: Jira Key
This commit is contained in:
parent
1b6602c55c
commit
4efcb687cd
1 changed files with 13 additions and 9 deletions
|
|
@ -35,6 +35,7 @@
|
|||
#include <asm/atomic.h>
|
||||
#include <linux/async.h>
|
||||
#include <linux/firmware.h>
|
||||
#include <linux/version.h>
|
||||
#define SLEEP(x) mdelay(x)
|
||||
|
||||
#define C_I2C_FIFO_SIZE 8
|
||||
|
|
@ -786,13 +787,13 @@ static int ps_get_state(struct power_supply *psy, bool *present)
|
|||
|
||||
retval = power_supply_get_property(psy, POWER_SUPPLY_PROP_PRESENT,
|
||||
&pval);
|
||||
/*if (retval) {
|
||||
LOG_DBG("%s psy get property failed\n", psy->name);
|
||||
if (retval) {
|
||||
LOG_DBG("%s psy get property failed\n", psy->desc->name);
|
||||
return retval;
|
||||
}*/
|
||||
}
|
||||
*present = (pval.intval) ? true : false;
|
||||
/*LOG_INFO("%s is %s\n", psy->name,
|
||||
(*present) ? "present" : "not present");*/
|
||||
LOG_INFO("%s is %s\n", psy->desc->name,
|
||||
(*present) ? "present" : "not present");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -804,10 +805,13 @@ static int ps_notify_callback(struct notifier_block *self,
|
|||
bool present;
|
||||
int retval;
|
||||
|
||||
/*if ((event == PSY_EVENT_PROP_ADDED || event == PSY_EVENT_PROP_CHANGED)
|
||||
&& psy && psy->get_property && psy->name &&
|
||||
!strncmp(psy->name, "usb", sizeof("usb"))) {*/
|
||||
if (event == PSY_EVENT_PROP_CHANGED) {
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,9,0)
|
||||
if (event == PSY_EVENT_PROP_CHANGED
|
||||
#else
|
||||
if ((event == PSY_EVENT_PROP_ADDED || event == PSY_EVENT_PROP_CHANGED)
|
||||
#endif
|
||||
&& psy && psy->desc->get_property && psy->desc->name &&
|
||||
!strncmp(psy->desc->name, "usb", sizeof("usb"))){
|
||||
LOG_INFO("ps notification: event = %lu\n", event);
|
||||
retval = ps_get_state(psy, &present);
|
||||
if (retval) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue