sar: support sar reset after usb hot-plug

1. This driver is porting from MTK, however, on QC platform, the sys
   node is "usb" only.
2. modify the correct macro

Change-Id: Ib2a799ce28571a274c1432f2aef842bd9f1ecf32
Signed-off-by: zhangh12 <zhangh12@motorola.com>
Reviewed-on: https://gerrit.mot.com/2162018
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
zhangh12 2022-01-05 14:16:56 +08:00 • committed by Hong Zhang
commit 9320dafd36
3 changed files with 6 additions and 12 deletions

View file

@ -1,8 +1,8 @@
DLKM_DIR := motorola/kernel/modules
LOCAL_PATH := $(call my-dir)
ifeq ($(SX933X_USB_USE_ONLINE),true)
KBUILD_OPTIONS += CONFIG_SX933X_POWER_SUPPLY_ONLINE=y
ifeq ($(AW9610X_USB_USE_ONLINE),true)
KBUILD_OPTIONS += CONFIG_AW9610X_POWER_SUPPLY_ONLINE=y
endif
include $(CLEAR_VARS)

View file

@ -8,7 +8,7 @@ KERNEL_PLATFORM_PATH = $(shell find $(ANDROID_BUILD_TOP) -maxdepth 1 -name "kern
EXTRA_CFLAGS += -Wall
EXTRA_CFLAGS += -I$(ANDROID_BUILD_TOP)/motorola/kernel/modules/include
ifneq ($(filter m y,$(CONFIG_SX933X_POWER_SUPPLY_ONLINE)),)
ifneq ($(filter m y,$(CONFIG_AW9610X_POWER_SUPPLY_ONLINE)),)
EXTRA_CFLAGS += -DCONFIG_USE_POWER_SUPPLY_ONLINE
endif

View file

@ -42,12 +42,6 @@
#define AW9610X_I2C_NAME "aw9610x_sar"
#define AW9610X_DRIVER_VERSION "v0.1.9"
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,9,0)
#define USB_POWER_SUPPLY_NAME "charger"
#else
#define USB_POWER_SUPPLY_NAME "usb"
#endif
#define AW_READ_CHIPID_RETRIES (5)
#define AW_I2C_RETRIES (5)
#define AW9610X_SCAN_DEFAULT_TIME (10000)
@ -1580,10 +1574,10 @@ static int ps_notify_callback(struct notifier_block *self,
#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))
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_POWER_SUPPLY_NAME, sizeof(USB_POWER_SUPPLY_NAME))){
!strncmp(psy->desc->name, "usb", sizeof("usb"))){
LOG_INFO("ps notification: event = %lu\n", event);
retval = ps_get_state(psy, &present);
if (retval) {
@ -2135,7 +2129,7 @@ aw9610x_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *id)
power_supply_unreg_notifier(&aw9610x->ps_notif);
}
psy = power_supply_get_by_name(USB_POWER_SUPPLY_NAME);
psy = power_supply_get_by_name("usb");
if (psy) {
ret = ps_get_state(psy, &aw9610x->ps_is_present);
if (ret) {