Cypfq: dlkm: Add charger detection feature for ili9882a

- Add ILITEK_CHARGER for control if the charger detection
feature will be used.
- Get the charger status when bootup.

Change-Id: Id4990f4e26051c5e551eb998f2eae8b213513681
Signed-off-by: wengjun1 <wengjun1@motorola.com>
Reviewed-on: https://gerrit.mot.com/2032569
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
wengjun1 2021-08-04 17:11:40 +08:00 • committed by Jun Weng
commit 13f2a29179
4 changed files with 30 additions and 0 deletions

View file

@ -21,6 +21,10 @@ ifeq ($(ILITEK_FW_PANEL),true)
KERNEL_CFLAGS += CONFIG_ILITEK_FW_PANEL=y
endif
ifeq ($(ILITEK_CHARGER),true)
KERNEL_CFLAGS += CONFIG_ILITEK_CHARGER=y
endif
ifeq ($(ILITEK_ESD),true)
KERNEL_CFLAGS += CONFIG_ILITEK_ESD=y
endif

View file

@ -26,6 +26,9 @@ endif
ifneq ($(filter m y,$(CONFIG_ILITEK_FW_PANEL)),)
EXTRA_CFLAGS += -DILI_FW_PANEL
endif
ifneq ($(filter m y,$(CONFIG_ILITEK_CHARGER)),)
EXTRA_CFLAGS += -DILI_CONFIG_CHARGER
endif
ifneq ($(filter m y,$(CONFIG_ILITEK_ESD)),)
EXTRA_CFLAGS += -DILI_CONFIG_ESD
endif

View file

@ -156,7 +156,11 @@
#define BOOT_FW_UPDATE ENABLE
#define MP_INT_LEVEL DISABLE
#define PLL_CLK_WAKEUP_TP_RESUME DISABLE
#ifdef ILI_CONFIG_CHARGER
#define CHARGER_NOTIFIER_CALLBACK ENABLE
#else
#define CHARGER_NOTIFIER_CALLBACK DISABLE
#endif
/*if current interface is spi, must to hostdownload */
#if (TDDI_INTERFACE == BUS_SPI)

View file

@ -807,6 +807,9 @@ static void ilitek_update_charger(struct work_struct *work)
void ilitek_plat_charger_init(void)
{
int ret = 0;
struct power_supply *psy = NULL;
union power_supply_propval prop;
ilits->usb_plug_status = 2;
ilits->charger_notify_wq = create_singlethread_workqueue("ili_charger_wq");
if (!ilits->charger_notify_wq) {
@ -818,6 +821,22 @@ void ilitek_plat_charger_init(void)
ret = power_supply_reg_notifier(&ilits->notifier_charger);
if (ret < 0)
ILI_ERR("power_supply_reg_notifier failed\n");
/* if power supply supplier registered brfore TP
* ps_notify_callback will not receive PSY_EVENT_PROP_ADDED
* event, and will cause miss to set TP into charger state.
* So check PS state in probe.
*/
psy = power_supply_get_by_name("usb");
if (psy) {
ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_PRESENT, &prop);
if (ret < 0) {
ILI_ERR("Couldn't get POWER_SUPPLY_PROP_ONLINE rc=%d\n", ret);
} else {
ilits->usb_plug_status = prop.intval;
ILI_INFO("boot check usb_plug_status = %d\n", prop.intval);
}
}
}
/* add_for_charger_end */
#endif