pd: configurable tcpc timeout to detect charger type

Different devices require different settings for tcpc's max polling
count. Make this value configurable.

Change-Id: I10b3bc4f27d14e00c5ec2b4ca943c1f97b4eb14a
Reviewed-on: https://gerrit.mot.com/2610513
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Bruno Oliveira <brunosoe@motorola.com>
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Reviewed-by: Lu Chai <chailu1@motorola.com>
Submit-Approved: Jira Key
SME-Granted: SME Approvals Granted
This commit is contained in:
Rafael Ortolan 2023-05-16 19:32:04 -03:00
commit 69486e81af
3 changed files with 8 additions and 6 deletions

View file

@ -34,8 +34,9 @@ ifeq ($(USB_POWER_DELIVERY),true)
KERNEL_CFLAGS += CONFIG_USB_POWER_DELIVERY=y
endif
ifeq ($(TCPC_DEVON_POLLING_TIME),true)
KERNEL_CFLAGS += CONFIG_TCPC_DEVON_POLLING_TIME=y
TCPC_MAX_POLLING_COUNT := $(shell echo $(TCPC_MAX_POLLING_COUNT) | grep -o "[0-9]\+")
ifneq ($(TCPC_MAX_POLLING_COUNT),)
KERNEL_CFLAGS += CONFIG_TCPC_MAX_POLLING_COUNT=$(TCPC_MAX_POLLING_COUNT)
endif

View file

@ -23,8 +23,8 @@ ifneq ($(filter m y,$(CONFIG_TCPC_SGM7220)),)
obj-m += tcpc_sgm7220.o
endif
ifneq ($(filter m y,$(CONFIG_TCPC_DEVON_POLLING_TIME)),)
EXTRA_CFLAGS += -DCONFIG_TCPC_DEVON_POLLING_TIME
ifneq ($(CONFIG_TCPC_MAX_POLLING_COUNT),)
EXTRA_CFLAGS += -DCONFIG_TCPC_MAX_POLLING_COUNT=$(CONFIG_TCPC_MAX_POLLING_COUNT)
endif
tcpc_class-objs += tcpci_core.o tcpci_typec.o tcpci_timer.o \

View file

@ -31,8 +31,9 @@
#define PROBE_CNT_MAX 3
/* 10ms * 100 = 1000ms = 1s */
#define USB_TYPE_POLLING_INTERVAL 10
#ifdef CONFIG_TCPC_DEVON_POLLING_TIME
#define USB_TYPE_POLLING_CNT_MAX 130
#if defined(CONFIG_TCPC_MAX_POLLING_COUNT)
#define USB_TYPE_POLLING_CNT_MAX CONFIG_TCPC_MAX_POLLING_COUNT
#else
#define USB_TYPE_POLLING_CNT_MAX 100
#endif