mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-08 12:58:12 -04:00
charger motorola module kernel-5.15 compatible design.
fogo charger bring up motorola module part. Kernel-5.15 have different compile makefile requirement. Compatible 5.15 and previous kernel version. Change-Id: Ibf1a28578de068b550d8ccabf8c0dec15bed7295 Signed-off-by: xuwei9 <xuwei9@lenovo.com> Reviewed-on: https://gerrit.mot.com/2618261 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Submit-Approved: Jira Key Tested-by: Jira Key Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com> Signed-off-by: xuwei9 <xuwei9@lenovo.com> Reviewed-on: https://gerrit.mot.com/2658446
This commit is contained in:
parent
62eb97b360
commit
45cbdfc07e
20 changed files with 301 additions and 34 deletions
|
|
@ -9,6 +9,7 @@ LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
|
|||
LOCAL_ADDITIONAL_DEPENDENCIES := $(KERNEL_MODULES_OUT)/adapter_class.ko
|
||||
LOCAL_ADDITIONAL_DEPENDENCIES := $(KERNEL_MODULES_OUT)/mmi_charger.ko
|
||||
KBUILD_OPTIONS_GKI += GKI_OBJ_MODULE_DIR=gki
|
||||
KBUILD_OPTIONS += MODULE_KERNEL_VERSION=$(TARGET_KERNEL_VERSION)
|
||||
include $(DLKM_DIR)/AndroidKernelModule.mk
|
||||
|
||||
|
||||
|
|
@ -16,4 +17,5 @@ include $(CLEAR_VARS)
|
|||
LOCAL_MODULE := mmi_discrete_charger_class.ko
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
|
||||
KBUILD_OPTIONS += MODULE_KERNEL_VERSION=$(TARGET_KERNEL_VERSION)
|
||||
include $(DLKM_DIR)/AndroidKernelModule.mk
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
# add -Wall to try to catch everything we can.
|
||||
EXTRA_CFLAGS += -Wall
|
||||
EXTRA_CFLAGS += -I$(ANDROID_BUILD_TOP)/motorola/kernel/modules/include \
|
||||
-I$(ANDROID_BUILD_TOP)/motorola/kernel/modules/drivers/power/mmi_charger \
|
||||
-I$(ANDROID_BUILD_TOP)/motorola/kernel/modules/drivers/power/mmi_discrete_charger
|
||||
EXTRA_CFLAGS += -I$(ANDROID_BUILD_TOP)/motorola/kernel/modules/include
|
||||
EXTRA_CFLAGS += -I$(ANDROID_BUILD_TOP)/motorola/kernel/modules/drivers/power/mmi_charger
|
||||
EXTRA_CFLAGS += -I$(ANDROID_BUILD_TOP)/motorola/kernel/modules/drivers/power/mmi_discrete_charger
|
||||
|
||||
obj-m += mmi_discrete_charger.o
|
||||
mmi_discrete_charger-objs += mmi_discrete_charger_core.o
|
||||
|
|
@ -13,5 +13,4 @@ mmi_discrete_charger-objs += mmi_discrete_factory_tcmd.o
|
|||
KBUILD_EXTRA_SYMBOLS += $(CURDIR)/$(KBUILD_EXTMOD)/../../usb/typec/adapter_class/$(GKI_OBJ_MODULE_DIR)/Module.symvers
|
||||
KBUILD_EXTRA_SYMBOLS += $(CURDIR)/$(KBUILD_EXTMOD)/../mmi_charger/$(GKI_OBJ_MODULE_DIR)/Module.symvers
|
||||
|
||||
|
||||
obj-m += mmi_discrete_charger_class.o
|
||||
|
|
|
|||
|
|
@ -1,3 +1,25 @@
|
|||
ifeq ($(strip $(MODULE_KERNEL_VERSION)), 5.15)
|
||||
|
||||
all: modules
|
||||
|
||||
modules:
|
||||
$(MAKE) -C $(KERNEL_SRC) M=$(M) modules $(KBUILD_OPTIONS)
|
||||
|
||||
modules_install:
|
||||
$(MAKE) INSTALL_MOD_STRIP=1 -C $(KERNEL_SRC) M=$(M) modules_install
|
||||
|
||||
%:
|
||||
$(MAKE) -C $(KERNEL_SRC) M=$(M) $@ $(KBUILD_OPTIONS)
|
||||
|
||||
clean:
|
||||
rm -f *.o *.ko *.mod.c *.mod.o *~ .*.cmd Module.symvers
|
||||
rm -rf .tmp_versions
|
||||
|
||||
KBUILD_EXTRA_SYMBOLS += $(CURDIR)/$(KBUILD_EXTMOD)/../../usb/typec/adapter_class/$(GKI_OBJ_MODULE_DIR)/Module.symvers
|
||||
KBUILD_EXTRA_SYMBOLS += $(CURDIR)/$(KBUILD_EXTMOD)/../mmi_charger/$(GKI_OBJ_MODULE_DIR)/Module.symvers
|
||||
|
||||
else
|
||||
|
||||
KERNEL_SRC ?= /lib/modules/$(shell uname -r)/build
|
||||
|
||||
all:
|
||||
|
|
@ -9,3 +31,4 @@ modules_install:
|
|||
clean:
|
||||
$(MAKE) -C $(KERNEL_SRC) M=$(PWD) clean
|
||||
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -29,13 +29,17 @@
|
|||
#include <linux/gpio.h>
|
||||
#include <linux/of_gpio.h>
|
||||
#include <linux/thermal.h>
|
||||
|
||||
#include <linux/version.h>
|
||||
#include "mmi_discrete_charger_core.h"
|
||||
#include "mmi_discrete_voter.h"
|
||||
#include "mmi_discrete_charger_iio.h"
|
||||
#include "mmi_discrete_factory_tcmd.h"
|
||||
#include <linux/mmi_discrete_charger_class.h>
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0)
|
||||
#include <linux/qti_power_supply.h>
|
||||
#endif
|
||||
|
||||
static bool debug_enabled;
|
||||
module_param(debug_enabled, bool, 0600);
|
||||
MODULE_PARM_DESC(debug_enabled, "Enable debug for MMI DISCRETE CHARGER driver");
|
||||
|
|
@ -594,8 +598,11 @@ static int mmi_discrete_handle_usb_current(struct mmi_discrete_charger *chg,
|
|||
{
|
||||
int rc = 0, rp_ua;
|
||||
union power_supply_propval val = {0, };
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0)
|
||||
if (chg->real_charger_type == QTI_POWER_SUPPLY_TYPE_USB_FLOAT) {
|
||||
#else
|
||||
if (chg->real_charger_type == POWER_SUPPLY_TYPE_USB_FLOAT) {
|
||||
#endif
|
||||
if (usb_current == -ETIMEDOUT) {
|
||||
/*
|
||||
* Valid FLOAT charger, report the current
|
||||
|
|
@ -1054,8 +1061,11 @@ static void mmi_discrete_config_qc_charger(struct mmi_discrete_charger *chg)
|
|||
}
|
||||
|
||||
do {
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0)
|
||||
if (chg->real_charger_type != QTI_POWER_SUPPLY_TYPE_USB_HVDCP_3) {
|
||||
#else
|
||||
if (chg->real_charger_type != POWER_SUPPLY_TYPE_USB_HVDCP_3) {
|
||||
#endif
|
||||
mmi_warn(chg, "Exit for QC3.0 charger removal\n");
|
||||
break;
|
||||
}
|
||||
|
|
@ -1223,7 +1233,11 @@ static void mmi_discrete_config_charger_input(struct mmi_discrete_charger *chip)
|
|||
if (chip->charger_psy && chip->usb_psy &&
|
||||
chip->constraint.hvdcp_pmax >= HVDCP_POWER_MIN &&
|
||||
chip->chg_info.chrg_mv > HVDCP_VOLTAGE_MIN &&
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0)
|
||||
chip->chg_info.chrg_type == QTI_POWER_SUPPLY_TYPE_USB_HVDCP_3 &&
|
||||
#else
|
||||
chip->chg_info.chrg_type == POWER_SUPPLY_TYPE_USB_HVDCP_3 &&
|
||||
#endif
|
||||
chip->pd_active == MMI_POWER_SUPPLY_PD_INACTIVE)
|
||||
mmi_discrete_config_qc_charger(chip);
|
||||
|
||||
|
|
@ -2094,7 +2108,11 @@ static void mmi_handle_hvdcp_check_timeout(struct mmi_discrete_charger *chg,
|
|||
|
||||
if (hvdcp_done) {
|
||||
hvdcp_ua = (chg->real_charger_type ==
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0)
|
||||
QTI_POWER_SUPPLY_TYPE_USB_HVDCP) ?
|
||||
#else
|
||||
POWER_SUPPLY_TYPE_USB_HVDCP) ?
|
||||
#endif
|
||||
chg->hvdcp2_max_icl_ua :
|
||||
HVDCP_CURRENT_UA;
|
||||
|
||||
|
|
@ -2144,9 +2162,15 @@ static void update_sw_icl_max(struct mmi_discrete_charger *chg)
|
|||
/*
|
||||
* HVDCP 2/3, handled separately
|
||||
*/
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0)
|
||||
if (chg->real_charger_type == QTI_POWER_SUPPLY_TYPE_USB_HVDCP
|
||||
|| chg->real_charger_type == QTI_POWER_SUPPLY_TYPE_USB_HVDCP_3
|
||||
|| chg->real_charger_type == QTI_POWER_SUPPLY_TYPE_USB_HVDCP_3P5)
|
||||
#else
|
||||
if (chg->real_charger_type == POWER_SUPPLY_TYPE_USB_HVDCP
|
||||
|| chg->real_charger_type == POWER_SUPPLY_TYPE_USB_HVDCP_3
|
||||
|| chg->real_charger_type == POWER_SUPPLY_TYPE_USB_HVDCP_3P5)
|
||||
#endif
|
||||
return;
|
||||
|
||||
/* TypeC rp med or high, use rp value */
|
||||
|
|
@ -2177,7 +2201,11 @@ static void update_sw_icl_max(struct mmi_discrete_charger *chg)
|
|||
vote(chg->usb_icl_votable, SW_ICL_MAX_VOTER, true, rp_ua);
|
||||
vote(chg->usb_icl_votable, USB_PSY_VOTER, false, 0);
|
||||
break;
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0)
|
||||
case QTI_POWER_SUPPLY_TYPE_USB_FLOAT:
|
||||
#else
|
||||
case POWER_SUPPLY_TYPE_USB_FLOAT:
|
||||
#endif
|
||||
vote(chg->usb_icl_votable, SW_ICL_MAX_VOTER, true,
|
||||
SDP_CURRENT_UA);
|
||||
break;
|
||||
|
|
@ -2209,7 +2237,11 @@ static void mmi_handle_apsd_done(struct mmi_discrete_charger *chip, bool apsd_do
|
|||
if (chip->use_extcon)
|
||||
mmi_notify_device_mode(chip, true);
|
||||
break;
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0)
|
||||
case QTI_POWER_SUPPLY_TYPE_USB_FLOAT:
|
||||
#else
|
||||
case POWER_SUPPLY_TYPE_USB_FLOAT:
|
||||
#endif
|
||||
case POWER_SUPPLY_TYPE_USB_DCP:
|
||||
break;
|
||||
default:
|
||||
|
|
@ -2273,11 +2305,20 @@ int mmi_discrete_get_hw_current_max(struct mmi_discrete_charger *chip, int *tota
|
|||
}
|
||||
|
||||
/* QC 2.0/3.0 adapter */
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0)
|
||||
if (chip->real_charger_type == QTI_POWER_SUPPLY_TYPE_USB_HVDCP) {
|
||||
#else
|
||||
if (chip->real_charger_type == POWER_SUPPLY_TYPE_USB_HVDCP) {
|
||||
#endif
|
||||
*total_current_ua = chip->hvdcp2_max_icl_ua;
|
||||
return 0;
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0)
|
||||
} else if (chip->real_charger_type == QTI_POWER_SUPPLY_TYPE_USB_HVDCP_3
|
||||
|| chip->real_charger_type == QTI_POWER_SUPPLY_TYPE_USB_HVDCP_3P5) {
|
||||
#else
|
||||
} else if (chip->real_charger_type == POWER_SUPPLY_TYPE_USB_HVDCP_3
|
||||
|| chip->real_charger_type == POWER_SUPPLY_TYPE_USB_HVDCP_3P5) {
|
||||
#endif
|
||||
*total_current_ua = HVDCP_CURRENT_UA;
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -2291,7 +2332,11 @@ int mmi_discrete_get_hw_current_max(struct mmi_discrete_charger *chip, int *tota
|
|||
case POWER_SUPPLY_TYPE_USB_DCP:
|
||||
current_ua = DCP_CURRENT_UA;
|
||||
break;
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0)
|
||||
case QTI_POWER_SUPPLY_TYPE_USB_FLOAT:
|
||||
#else
|
||||
case POWER_SUPPLY_TYPE_USB_FLOAT:
|
||||
#endif
|
||||
case POWER_SUPPLY_TYPE_USB:
|
||||
current_ua = SDP_CURRENT_UA;
|
||||
break;
|
||||
|
|
@ -2645,11 +2690,23 @@ static int mmi_discrete_get_chg_info(void *data, struct mmi_charger_info *chg_in
|
|||
chip->chg_info.chrg_pmax_mw = 7500;
|
||||
else if (usb_type == POWER_SUPPLY_TYPE_USB_DCP)
|
||||
chip->chg_info.chrg_pmax_mw = chip->constraint.dcp_pmax;
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0)
|
||||
else if (usb_type == QTI_POWER_SUPPLY_TYPE_USB_HVDCP)
|
||||
#else
|
||||
else if (usb_type == POWER_SUPPLY_TYPE_USB_HVDCP)
|
||||
#endif
|
||||
chip->chg_info.chrg_pmax_mw = 7500;
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0)
|
||||
else if (usb_type == QTI_POWER_SUPPLY_TYPE_USB_HVDCP_3)
|
||||
#else
|
||||
else if (usb_type == POWER_SUPPLY_TYPE_USB_HVDCP_3)
|
||||
#endif
|
||||
chip->chg_info.chrg_pmax_mw = chip->constraint.hvdcp_pmax;
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0)
|
||||
else if (usb_type == QTI_POWER_SUPPLY_TYPE_USB_HVDCP_3P5)
|
||||
#else
|
||||
else if (usb_type == POWER_SUPPLY_TYPE_USB_HVDCP_3P5)
|
||||
#endif
|
||||
chip->chg_info.chrg_pmax_mw = 30000;
|
||||
else if (usb_type == POWER_SUPPLY_TYPE_USB_PD) {
|
||||
if (chip->pd_active == MMI_POWER_SUPPLY_PD_PPS_ACTIVE)
|
||||
|
|
|
|||
|
|
@ -12,6 +12,10 @@
|
|||
|
||||
#include <linux/power_supply.h>
|
||||
#include "mmi_discrete_charger_iio.h"
|
||||
#include <linux/version.h>
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0)
|
||||
#include <linux/qti_power_supply.h>
|
||||
#endif
|
||||
|
||||
static int mmi_discrete_iio_write_raw(struct iio_dev *indio_dev,
|
||||
struct iio_chan_spec const *chan, int val1,
|
||||
|
|
@ -40,8 +44,13 @@ static int mmi_discrete_iio_write_raw(struct iio_dev *indio_dev,
|
|||
rc = mmi_discrete_config_termination_enabled(chip, val1);
|
||||
break;
|
||||
case PSY_IIO_DP_DM:
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0)
|
||||
if (chip->real_charger_type == QTI_POWER_SUPPLY_TYPE_USB_HVDCP_3
|
||||
|| chip->real_charger_type == QTI_POWER_SUPPLY_TYPE_USB_HVDCP_3P5) {
|
||||
#else
|
||||
if (chip->real_charger_type == POWER_SUPPLY_TYPE_USB_HVDCP_3
|
||||
|| chip->real_charger_type == POWER_SUPPLY_TYPE_USB_HVDCP_3P5) {
|
||||
#endif
|
||||
rc = mmi_discrete_set_dp_dm(chip, val1);
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
#include <linux/printk.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/version.h>
|
||||
|
||||
#include "mmi_discrete_voter.h"
|
||||
|
||||
|
|
@ -804,8 +805,8 @@ struct votable *create_votable(const char *name,
|
|||
kfree(votable);
|
||||
return ERR_PTR(-EEXIST);
|
||||
}
|
||||
|
||||
votable->force_val_ent = debugfs_create_u32("force_val",
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(5,15,0)
|
||||
votable->force_val_ent = (struct dentry *)debugfs_create_u32("force_val",
|
||||
S_IFREG | 0644,
|
||||
votable->root,
|
||||
&(votable->force_val));
|
||||
|
|
@ -817,7 +818,7 @@ struct votable *create_votable(const char *name,
|
|||
kfree(votable);
|
||||
return ERR_PTR(-EEXIST);
|
||||
}
|
||||
|
||||
#endif
|
||||
votable->force_active_ent = debugfs_create_file("force_active",
|
||||
S_IFREG | 0444,
|
||||
votable->root, votable,
|
||||
|
|
|
|||
|
|
@ -430,6 +430,7 @@ static ssize_t wt6670f_store_test(struct device *dev,
|
|||
|
||||
ret = wt6670f_set_voltage(val);
|
||||
|
||||
pr_info("%s ret:%d",__func__, ret);
|
||||
return count;
|
||||
|
||||
}
|
||||
|
|
@ -454,7 +455,7 @@ static ssize_t wt6670f_show_registers(struct device *dev,
|
|||
idx = snprintf(buf, PAGE_SIZE, ">>> reg[0x11] = %04x\n", data);
|
||||
pr_err(">>>>>>>>>>Z350 test southchip 0x11 = %04x\n", data);
|
||||
}
|
||||
|
||||
pr_info("%s ret:%d",__func__, ret);
|
||||
return idx;
|
||||
}
|
||||
|
||||
|
|
@ -473,7 +474,7 @@ static ssize_t wt6670f_store_registers(struct device *dev,
|
|||
|
||||
if(QC3P_Z350 == g_qc3p_id)
|
||||
ret = wt6670f_write_word(wt, 0x83, val);
|
||||
|
||||
pr_info("%s ret:%d",__func__, ret);
|
||||
return count;
|
||||
|
||||
}
|
||||
|
|
@ -588,6 +589,7 @@ static int wt6670f_parse_dt(struct device *dev)
|
|||
ret = request_irq(gpio_to_irq(wt6670f_int_pin), wt6670f_intr_handler,
|
||||
IRQF_TRIGGER_FALLING | IRQF_ONESHOT, "wt6670f int", dev);
|
||||
enable_irq_wake(gpio_to_irq(wt6670f_int_pin));
|
||||
pr_info("%s ret:%d",__func__, ret);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -874,7 +876,7 @@ static int wt6670f_i2c_probe(struct i2c_client *client,
|
|||
pr_info("[%s] gpio_direction_input wt6670f_int_pin failed", __func__);
|
||||
probe_out:
|
||||
/* Create the procfs file at /proc/driver/wt6670f_firmware_num */
|
||||
procfs_file = proc_create("driver/wt6670f_firmware_num",0777, NULL, &mmi_wt6670f_operations);
|
||||
procfs_file = proc_create("driver/wt6670f_firmware_num",0777, NULL, (const struct proc_ops *)&mmi_wt6670f_operations);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,5 +29,5 @@ LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
|
|||
|
||||
LOCAL_ADDITIONAL_DEPENDENCIES := $(KERNEL_MODULES_OUT)/mmi_discrete_charger_class.ko
|
||||
KBUILD_OPTIONS_GKI += GKI_OBJ_MODULE_DIR=gki
|
||||
|
||||
KBUILD_OPTIONS += MODULE_KERNEL_VERSION=$(TARGET_KERNEL_VERSION)
|
||||
include $(DLKM_DIR)/AndroidKernelModule.mk
|
||||
|
|
|
|||
|
|
@ -24,5 +24,4 @@ ifneq ($(filter m y,$(CONFIG_MMI_EXT_CHG_LED)),)
|
|||
endif
|
||||
|
||||
obj-m += sgm4154x_charger.o
|
||||
|
||||
KBUILD_EXTRA_SYMBOLS += $(CURDIR)/$(KBUILD_EXTMOD)/../mmi_discrete_charger/$(GKI_OBJ_MODULE_DIR)/Module.symvers
|
||||
|
|
|
|||
|
|
@ -1,3 +1,24 @@
|
|||
ifeq ($(strip $(MODULE_KERNEL_VERSION)), 5.15)
|
||||
|
||||
all: modules
|
||||
|
||||
modules:
|
||||
$(MAKE) -C $(KERNEL_SRC) M=$(M) modules $(KBUILD_OPTIONS)
|
||||
|
||||
modules_install:
|
||||
$(MAKE) INSTALL_MOD_STRIP=1 -C $(KERNEL_SRC) M=$(M) modules_install
|
||||
|
||||
%:
|
||||
$(MAKE) -C $(KERNEL_SRC) M=$(M) $@ $(KBUILD_OPTIONS)
|
||||
|
||||
clean:
|
||||
rm -f *.o *.ko *.mod.c *.mod.o *~ .*.cmd Module.symvers
|
||||
rm -rf .tmp_versions
|
||||
|
||||
KBUILD_EXTRA_SYMBOLS += $(CURDIR)/$(KBUILD_EXTMOD)/../mmi_discrete_charger/$(GKI_OBJ_MODULE_DIR)/Module.symvers
|
||||
|
||||
else
|
||||
|
||||
KERNEL_SRC ?= /lib/modules/$(shell uname -r)/build
|
||||
|
||||
all:
|
||||
|
|
@ -9,3 +30,4 @@ modules_install:
|
|||
clean:
|
||||
$(MAKE) -C $(KERNEL_SRC) M=$(PWD) clean
|
||||
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
#include <linux/regulator/driver.h>
|
||||
#include <linux/regulator/of_regulator.h>
|
||||
#include <linux/regulator/machine.h>
|
||||
|
||||
#include <linux/version.h>
|
||||
#include <linux/acpi.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/of_gpio.h>
|
||||
|
|
@ -24,6 +24,10 @@
|
|||
#include <uapi/linux/sched/types.h>
|
||||
#include <linux/kthread.h>
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0)
|
||||
#include <linux/qti_power_supply.h>
|
||||
#endif
|
||||
|
||||
#ifdef __indicator_led_en__
|
||||
static struct sgm4154x_device *sgm_g;
|
||||
#define TRILED_NUM_MAX 3
|
||||
|
|
@ -544,7 +548,11 @@ static int sgm4154x_detected_qc20_hvdcp(struct sgm4154x_device *sgm, int *charge
|
|||
|
||||
if (vbus_voltage > MMI_HVDCP2_VOLTAGE_STANDARD) {
|
||||
dev_info(sgm->dev, "QC20 charger detected\n");
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0)
|
||||
*charger_type = QTI_POWER_SUPPLY_TYPE_USB_HVDCP;
|
||||
#else
|
||||
*charger_type = POWER_SUPPLY_TYPE_USB_HVDCP;
|
||||
#endif
|
||||
} else {
|
||||
dev_info(sgm->dev, "charger type is not HVDCP\n");
|
||||
}
|
||||
|
|
@ -810,6 +818,7 @@ static int sgm4154x_set_input_curr_lim(struct sgm4154x_device *sgm, int iindpm)
|
|||
reg_val = 0x1E;
|
||||
|
||||
#endif
|
||||
|
||||
ret = mmi_regmap_update_bits(sgm, SGM4154x_CHRG_CTRL_0,
|
||||
SGM4154x_IINDPM_I_MASK, reg_val);
|
||||
return ret;
|
||||
|
|
@ -1006,7 +1015,11 @@ int sgm4154x_disable_watchdog(struct sgm4154x_device *sgm)
|
|||
return ret;
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0)
|
||||
int sgm4154x_enable_termination(struct charger_device *chg_dev, bool enable)
|
||||
#else
|
||||
static int sgm4154x_enable_termination(struct charger_device *chg_dev, bool enable)
|
||||
#endif
|
||||
{
|
||||
struct sgm4154x_device *sgm = dev_get_drvdata(&chg_dev->dev);
|
||||
int ret = 0;
|
||||
|
|
@ -1227,9 +1240,15 @@ static int get_charger_type(struct sgm4154x_device * sgm)
|
|||
break;
|
||||
|
||||
case POWER_SUPPLY_TYPE_USB_DCP:
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0)
|
||||
case QTI_POWER_SUPPLY_TYPE_USB_HVDCP:
|
||||
case QTI_POWER_SUPPLY_TYPE_USB_HVDCP_3:
|
||||
case QTI_POWER_SUPPLY_TYPE_USB_HVDCP_3P5:
|
||||
#else
|
||||
case POWER_SUPPLY_TYPE_USB_HVDCP:
|
||||
case POWER_SUPPLY_TYPE_USB_HVDCP_3:
|
||||
case POWER_SUPPLY_TYPE_USB_HVDCP_3P5:
|
||||
#endif
|
||||
usb_type = POWER_SUPPLY_USB_TYPE_DCP;
|
||||
break;
|
||||
|
||||
|
|
@ -1701,7 +1720,7 @@ static void charger_monitor_work_func(struct work_struct *work)
|
|||
}
|
||||
|
||||
sgm4154x_dump_register(sgm);
|
||||
pr_err("%s\n",__func__);
|
||||
pr_err("%s ret:%d\n",__func__,ret);
|
||||
OUT:
|
||||
schedule_delayed_work(&sgm->charge_monitor_work, 10*HZ);
|
||||
}
|
||||
|
|
@ -1746,7 +1765,11 @@ static int sgm4154x_detected_qc30_hvdcp(struct sgm4154x_device *sgm, int *charge
|
|||
dev_info(sgm->dev, "%s vbus voltage now = %d in detected qc30\n", __func__,vbus_voltage);
|
||||
|
||||
if (vbus_voltage > MMI_HVDCP3_VOLTAGE_STANDARD) {
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0)
|
||||
*charger_type = QTI_POWER_SUPPLY_TYPE_USB_HVDCP_3;
|
||||
#else
|
||||
*charger_type = POWER_SUPPLY_TYPE_USB_HVDCP_3;
|
||||
#endif
|
||||
dev_info(sgm->dev, "%s QC3.0 charger detected\n", __func__);
|
||||
}
|
||||
|
||||
|
|
@ -1847,7 +1870,11 @@ static int sgm4154x_detected_qc3p_hvdcp(struct sgm4154x_device *sgm, int *charge
|
|||
sgm->mmi_qc3p_power = MMI_POWER_SUPPLY_QC3P_NONE;
|
||||
|
||||
if (sgm->mmi_qc3p_power != MMI_POWER_SUPPLY_QC3P_NONE) {
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0)
|
||||
*charger_type = QTI_POWER_SUPPLY_TYPE_USB_HVDCP_3P5;
|
||||
#else
|
||||
*charger_type = POWER_SUPPLY_TYPE_USB_HVDCP_3P5;
|
||||
#endif
|
||||
dev_info(sgm->dev, "%s detected qc3p, qc3p power = %d\n",
|
||||
__func__,sgm->mmi_qc3p_power);
|
||||
} else {
|
||||
|
|
@ -1962,7 +1989,11 @@ bool qc3p_detection_done(struct sgm4154x_device *chip)
|
|||
int delay_count =0;
|
||||
|
||||
#ifdef CONFIG_MMI_SGM41513_CHARGER
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0)
|
||||
if(chip->real_charger_type == QTI_POWER_SUPPLY_TYPE_USB_HVDCP) {
|
||||
#else
|
||||
if(chip->real_charger_type == POWER_SUPPLY_TYPE_USB_HVDCP) {
|
||||
#endif
|
||||
dev_info(chip->dev, "qc3p hvdcp detection already done, do not wait\n");
|
||||
return true;
|
||||
}
|
||||
|
|
@ -2087,8 +2118,11 @@ static int mmi_hvdcp_detect_kthread(void *param)
|
|||
dev_err(sgm->dev, "Cann't detected qc20 hvdcp\n");
|
||||
goto out;
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0)
|
||||
if (charger_type != QTI_POWER_SUPPLY_TYPE_USB_HVDCP || sgm->pd_active)
|
||||
#else
|
||||
if (charger_type != POWER_SUPPLY_TYPE_USB_HVDCP || sgm->pd_active)
|
||||
#endif
|
||||
goto out;
|
||||
|
||||
//do qc3.0 detected
|
||||
|
|
@ -2100,7 +2134,11 @@ static int mmi_hvdcp_detect_kthread(void *param)
|
|||
|
||||
#ifdef CONFIG_MMI_QC3P_TURBO_CHARGER
|
||||
//do qc3p detected
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0)
|
||||
if (charger_type == QTI_POWER_SUPPLY_TYPE_USB_HVDCP_3 && !sgm->pd_active) {
|
||||
#else
|
||||
if (charger_type == POWER_SUPPLY_TYPE_USB_HVDCP_3 && !sgm->pd_active) {
|
||||
#endif
|
||||
ret = sgm4154x_detected_qc3p_hvdcp(sgm, &charger_type);
|
||||
if (ret) {
|
||||
dev_err(sgm->dev, "Cann't detected qc3p hvdcp\n");
|
||||
|
|
@ -2116,17 +2154,29 @@ static int mmi_hvdcp_detect_kthread(void *param)
|
|||
|
||||
switch(ret) {
|
||||
case WT_CHG_TYPE_QC2:
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0)
|
||||
charger_type = QTI_POWER_SUPPLY_TYPE_USB_HVDCP;
|
||||
#else
|
||||
charger_type = POWER_SUPPLY_TYPE_USB_HVDCP;
|
||||
#endif
|
||||
dev_info(sgm->dev, "HDVCP 2.0 detected\n");
|
||||
break;
|
||||
case WT_CHG_TYPE_QC3:
|
||||
case WT_CHG_TYPE_QC3P_18W:
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0)
|
||||
charger_type = QTI_POWER_SUPPLY_TYPE_USB_HVDCP_3;
|
||||
#else
|
||||
charger_type = POWER_SUPPLY_TYPE_USB_HVDCP_3;
|
||||
#endif
|
||||
dev_info(sgm->dev, "HDVCP 3.0 or qc3p 18W detected\n");
|
||||
break;
|
||||
case WT_CHG_TYPE_QC3P_27W:
|
||||
dev_err(sgm->dev, "QC3P 27W have been detected !\n");
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0)
|
||||
charger_type = QTI_POWER_SUPPLY_TYPE_USB_HVDCP_3P5;
|
||||
#else
|
||||
charger_type = POWER_SUPPLY_TYPE_USB_HVDCP_3P5;
|
||||
#endif
|
||||
qc3p_update_policy(sgm);
|
||||
break;
|
||||
default:
|
||||
|
|
@ -2162,7 +2212,11 @@ static void mmi_start_hvdcp_detect(struct sgm4154x_device *sgm)
|
|||
&& (!sgm->pd_active)
|
||||
&& (sgm->real_charger_type == POWER_SUPPLY_TYPE_USB_DCP
|
||||
#ifdef CONFIG_MMI_SGM41513_CHARGER
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0)
|
||||
|| sgm->real_charger_type == QTI_POWER_SUPPLY_TYPE_USB_HVDCP
|
||||
#else
|
||||
|| sgm->real_charger_type == POWER_SUPPLY_TYPE_USB_HVDCP
|
||||
#endif
|
||||
#endif
|
||||
)) {
|
||||
dev_info(sgm->dev, "start hvdcp detect\n");
|
||||
|
|
@ -2186,7 +2240,11 @@ static bool mmi_start_bc12_charger_type_detect(struct sgm4154x_device *sgm, int
|
|||
case WT_CHG_TYPE_FC:
|
||||
case WT_CHG_TYPE_OCP:
|
||||
dev_err(sgm->dev, "unkown type have been detected !\n");
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0)
|
||||
*real_charger_type = QTI_POWER_SUPPLY_TYPE_USB_FLOAT;
|
||||
#else
|
||||
*real_charger_type = POWER_SUPPLY_TYPE_USB_FLOAT;
|
||||
#endif
|
||||
result = true;
|
||||
break;
|
||||
case WT_CHG_TYPE_SDP:
|
||||
|
|
@ -2207,7 +2265,11 @@ static bool mmi_start_bc12_charger_type_detect(struct sgm4154x_device *sgm, int
|
|||
break;
|
||||
case WT_CHG_TYPE_HVDCP:
|
||||
dev_err(sgm->dev, "quick plug out/in, HVDCP have been detected already !\n");
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0)
|
||||
*real_charger_type = QTI_POWER_SUPPLY_TYPE_USB_HVDCP;
|
||||
#else
|
||||
*real_charger_type = POWER_SUPPLY_TYPE_USB_HVDCP;
|
||||
#endif
|
||||
mmi_start_hvdcp_detect(sgm);
|
||||
result = true;
|
||||
break;
|
||||
|
|
@ -2275,6 +2337,7 @@ static void sgm4154x_vbus_remove(struct sgm4154x_device * sgm)
|
|||
#ifdef __SGM41513_CHIP_ID__
|
||||
sgm4154x_set_dynamic_vindpm_track(sgm, 0);
|
||||
#endif
|
||||
pr_info("%s ret:%d\n",__func__,ret);
|
||||
}
|
||||
|
||||
static void sgm4154x_vbus_plugin(struct sgm4154x_device * sgm)
|
||||
|
|
@ -2326,7 +2389,11 @@ static void sgm4154x_vbus_plugin(struct sgm4154x_device * sgm)
|
|||
case SGM4154x_UNKNOWN:
|
||||
case SGM4154x_NON_STANDARD:
|
||||
pr_err("SGM4154x charger type: UNKNOWN\n");
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0)
|
||||
sgm->real_charger_type = QTI_POWER_SUPPLY_TYPE_USB_FLOAT;
|
||||
#else
|
||||
sgm->real_charger_type = POWER_SUPPLY_TYPE_USB_FLOAT;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case SGM4154x_OTG_MODE:
|
||||
|
|
@ -2678,7 +2745,7 @@ static int sgm4154x_parse_dt(struct sgm4154x_device *sgm)
|
|||
{
|
||||
ret = gpio_request(chg_en_gpio, "sgm4154x chg en pin");
|
||||
if (ret) {
|
||||
dev_err(sgm->dev, "%s: %d gpio request failed\n", __func__, chg_en_gpio);
|
||||
dev_err(sgm->dev, "%s: %d gpio request chg_en failed\n", __func__, chg_en_gpio);
|
||||
return ret;
|
||||
}
|
||||
gpio_direction_output(chg_en_gpio,0);//default enable charge
|
||||
|
|
@ -2908,6 +2975,7 @@ static int sgm4154x_is_enabled_vbus(struct regulator_dev *rdev)
|
|||
int ret = 0;
|
||||
|
||||
ret = mmi_regmap_read(sgm, SGM4154x_CHRG_CTRL_1, &temp);
|
||||
pr_info("%s ret:%d\n",__func__,ret);
|
||||
return (temp&SGM4154x_OTG_EN)? 1 : 0;
|
||||
}
|
||||
static struct regulator_ops sgm4154x_vbus_ops = {
|
||||
|
|
@ -3553,7 +3621,7 @@ static int sgm4154x_probe(struct i2c_client *client,
|
|||
"mmi iio psy init failed\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
pr_info("%s otg_notify:%d\n",__func__, otg_notify);
|
||||
schedule_delayed_work(&sgm->charge_monitor_work,100);
|
||||
#ifdef __indicator_led_en__
|
||||
indicator_led_probe(client);
|
||||
|
|
|
|||
|
|
@ -5,4 +5,5 @@ include $(CLEAR_VARS)
|
|||
LOCAL_MODULE := sm5602_fg_mmi.ko
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
|
||||
KBUILD_OPTIONS += MODULE_KERNEL_VERSION=$(TARGET_KERNEL_VERSION)
|
||||
include $(DLKM_DIR)/AndroidKernelModule.mk
|
||||
|
|
|
|||
|
|
@ -1,3 +1,22 @@
|
|||
ifeq ($(strip $(MODULE_KERNEL_VERSION)), 5.15)
|
||||
|
||||
all: modules
|
||||
|
||||
modules:
|
||||
$(MAKE) -C $(KERNEL_SRC) M=$(M) modules $(KBUILD_OPTIONS)
|
||||
|
||||
modules_install:
|
||||
$(MAKE) INSTALL_MOD_STRIP=1 -C $(KERNEL_SRC) M=$(M) modules_install
|
||||
|
||||
%:
|
||||
$(MAKE) -C $(KERNEL_SRC) M=$(M) $@ $(KBUILD_OPTIONS)
|
||||
|
||||
clean:
|
||||
rm -f *.o *.ko *.mod.c *.mod.o *~ .*.cmd Module.symvers
|
||||
rm -rf .tmp_versions
|
||||
|
||||
else
|
||||
|
||||
KERNEL_SRC ?= /lib/modules/$(shell uname -r)/build
|
||||
|
||||
all:
|
||||
|
|
@ -9,3 +28,4 @@ modules_install:
|
|||
clean:
|
||||
$(MAKE) -C $(KERNEL_SRC) M=$(PWD) clean
|
||||
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -1081,8 +1081,6 @@ static int fg_set_property(struct power_supply *psy,
|
|||
const union power_supply_propval *val)
|
||||
{
|
||||
int ret = 0;
|
||||
struct sm_fg_chip *sm;
|
||||
sm = power_supply_get_drvdata(psy);
|
||||
|
||||
switch(prop) {
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -5,5 +5,6 @@ include $(CLEAR_VARS)
|
|||
LOCAL_MODULE := adapter_class.ko
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
|
||||
KBUILD_OPTIONS += MODULE_KERNEL_VERSION=$(TARGET_KERNEL_VERSION)
|
||||
include $(DLKM_DIR)/AndroidKernelModule.mk
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,21 @@
|
|||
ifeq ($(strip $(MODULE_KERNEL_VERSION)), 5.15)
|
||||
all: modules
|
||||
|
||||
modules:
|
||||
$(MAKE) -C $(KERNEL_SRC) M=$(M) modules $(KBUILD_OPTIONS)
|
||||
|
||||
modules_install:
|
||||
$(MAKE) INSTALL_MOD_STRIP=1 -C $(KERNEL_SRC) M=$(M) modules_install
|
||||
|
||||
%:
|
||||
$(MAKE) -C $(KERNEL_SRC) M=$(M) $@ $(KBUILD_OPTIONS)
|
||||
|
||||
clean:
|
||||
rm -f *.o *.ko *.mod.c *.mod.o *~ .*.cmd Module.symvers
|
||||
rm -rf .tmp_versions
|
||||
|
||||
else
|
||||
|
||||
KERNEL_SRC ?= /lib/modules/$(shell uname -r)/build
|
||||
|
||||
all:
|
||||
|
|
@ -7,4 +25,6 @@ modules_install:
|
|||
$(MAKE) INSTALL_MOD_STRIP=1 -C $(KERNEL_SRC) M=$(shell pwd) modules_install
|
||||
|
||||
clean:
|
||||
$(MAKE) -C $(KERNEL_SRC) M=$(PWD) clean
|
||||
$(MAKE) -C $(KERNEL_SRC) M=$(PWD) clean
|
||||
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -5,9 +5,16 @@ ifeq ($(USB_POWER_DELIVERY),true)
|
|||
LOCAL_ADDITIONAL_DEPENDENCIES := $(KERNEL_MODULES_OUT)/adapter_class.ko
|
||||
endif
|
||||
KBUILD_OPTIONS_GKI += GKI_OBJ_MODULE_DIR=gki
|
||||
KBUILD_OPTIONS += MODULE_KERNEL_VERSION=$(TARGET_KERNEL_VERSION)
|
||||
|
||||
ifeq ($(TCPC_CLASS),true)
|
||||
KERNEL_CFLAGS += CONFIG_TCPC_CLASS=y
|
||||
KBUILD_OPTIONS += CONFIG_TCPC_CLASS=y
|
||||
endif
|
||||
|
||||
ifeq ($(TCPC_SGM7220),true)
|
||||
KERNEL_CFLAGS += CONFIG_TCPC_SGM7220=y
|
||||
KBUILD_OPTIONS += CONFIG_TCPC_SGM7220=y
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
|
|
@ -18,6 +25,7 @@ endif
|
|||
|
||||
ifeq ($(TCPC_RT1711H),true)
|
||||
KERNEL_CFLAGS += CONFIG_TCPC_RT1711H=y
|
||||
KBUILD_OPTIONS += CONFIG_TCPC_RT1711H=y
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
|
|
@ -26,17 +34,20 @@ ifeq ($(TCPC_RT1711H),true)
|
|||
include $(DLKM_DIR)/AndroidKernelModule.mk
|
||||
endif
|
||||
|
||||
ifeq ($(TCPC_CLASS),true)
|
||||
KERNEL_CFLAGS += CONFIG_TCPC_CLASS=y
|
||||
endif
|
||||
#ifeq ($(TCPC_CLASS),true)
|
||||
# KERNEL_CFLAGS += CONFIG_TCPC_CLASS=y
|
||||
# KBUILD_OPTIONS += CONFIG_TCPC_CLASS=y
|
||||
#endif
|
||||
|
||||
ifeq ($(USB_POWER_DELIVERY),true)
|
||||
KERNEL_CFLAGS += CONFIG_USB_POWER_DELIVERY=y
|
||||
KBUILD_OPTIONS += CONFIG_USB_POWER_DELIVERY=y
|
||||
endif
|
||||
|
||||
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)
|
||||
KBUILD_OPTIONS += CONFIG_TCPC_MAX_POLLING_COUNT=$(TCPC_MAX_POLLING_COUNT)
|
||||
endif
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -16,22 +16,22 @@ ifneq ($(filter m y,$(CONFIG_USB_POWER_DELIVERY)),)
|
|||
endif
|
||||
|
||||
ifneq ($(filter m y,$(CONFIG_TCPC_RT1711H)),)
|
||||
obj-m += tcpc_rt1711h.o
|
||||
obj-m += tcpc_rt1711h.o
|
||||
endif
|
||||
|
||||
ifneq ($(filter m y,$(CONFIG_TCPC_SGM7220)),)
|
||||
obj-m += tcpc_sgm7220.o
|
||||
obj-m += tcpc_sgm7220.o
|
||||
endif
|
||||
|
||||
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 \
|
||||
tcpc_class-objs += tcpci_core.o tcpci_typec.o tcpci_timer.o \
|
||||
tcpm.o tcpci.o pd_dbg_info.o tcpci_alert.o rt-regmap.o tcpci_dual_role.o
|
||||
|
||||
ifneq ($(filter m y,$(CONFIG_USB_POWER_DELIVERY)),)
|
||||
tcpc_class-objs += tcpci_event.o \
|
||||
tcpc_class-objs += tcpci_event.o \
|
||||
pd_core.o pd_policy_engine.o pd_process_evt.o \
|
||||
pd_dpm_core.o pd_dpm_uvdm.o pd_dpm_alt_mode_dp.o pd_dpm_pdo_select.o\
|
||||
pd_dpm_reaction.o \
|
||||
|
|
@ -44,8 +44,8 @@ tcpc_class-objs += tcpci_event.o \
|
|||
pd_dpm_mmi_adapter.o
|
||||
endif
|
||||
|
||||
obj-m += tcpc_class.o
|
||||
obj-m += rt_pd_manager.o
|
||||
obj-m += tcpc_class.o
|
||||
obj-m += rt_pd_manager.o
|
||||
|
||||
KBUILD_EXTRA_SYMBOLS += $(CURDIR)/$(KBUILD_EXTMOD)/../adapter_class/$(GKI_OBJ_MODULE_DIR)/Module.symvers
|
||||
KBUILD_EXTRA_SYMBOLS += $(CURDIR)/$(KBUILD_EXTMOD)/../../../power/mmi_discrete_charger/$(GKI_OBJ_MODULE_DIR)/Module.symvers
|
||||
|
|
|
|||
|
|
@ -1,3 +1,25 @@
|
|||
ifeq ($(strip $(MODULE_KERNEL_VERSION)), 5.15)
|
||||
|
||||
all: modules
|
||||
|
||||
modules:
|
||||
$(MAKE) -C $(KERNEL_SRC) M=$(M) modules $(KBUILD_OPTIONS)
|
||||
|
||||
modules_install:
|
||||
$(MAKE) INSTALL_MOD_STRIP=1 -C $(KERNEL_SRC) M=$(M) modules_install
|
||||
|
||||
%:
|
||||
$(MAKE) -C $(KERNEL_SRC) M=$(M) $@ $(KBUILD_OPTIONS)
|
||||
|
||||
clean:
|
||||
rm -f *.o *.ko *.mod.c *.mod.o *~ .*.cmd Module.symvers
|
||||
rm -rf .tmp_versions
|
||||
|
||||
KBUILD_EXTRA_SYMBOLS += $(CURDIR)/$(KBUILD_EXTMOD)/../adapter_class/$(GKI_OBJ_MODULE_DIR)/Module.symvers
|
||||
KBUILD_EXTRA_SYMBOLS += $(CURDIR)/$(KBUILD_EXTMOD)/../../../power/mmi_discrete_charger/$(GKI_OBJ_MODULE_DIR)/Module.symvers
|
||||
|
||||
else
|
||||
|
||||
KERNEL_SRC ?= /lib/modules/$(shell uname -r)/build
|
||||
|
||||
all:
|
||||
|
|
@ -9,3 +31,4 @@ modules_install:
|
|||
clean:
|
||||
$(MAKE) -C $(KERNEL_SRC) M=$(PWD) clean
|
||||
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -25,10 +25,17 @@
|
|||
#include "inc/tcpci_typec.h"
|
||||
#include <linux/mmi_discrete_power_supply.h>
|
||||
#include <linux/mmi_discrete_charger_class.h>
|
||||
|
||||
#include <linux/qti_power_supply.h>
|
||||
#include <linux/version.h>
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0)
|
||||
#include <linux/qti_power_supply.h>
|
||||
#endif
|
||||
#define RT_PD_MANAGER_VERSION "0.0.8_G"
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0)
|
||||
#define PROBE_CNT_MAX 15
|
||||
#else
|
||||
#define PROBE_CNT_MAX 3
|
||||
#endif
|
||||
/* 10ms * 100 = 1000ms = 1s */
|
||||
#define USB_TYPE_POLLING_INTERVAL 10
|
||||
|
||||
|
|
@ -279,7 +286,11 @@ static void usb_dwork_handler(struct work_struct *work)
|
|||
break;
|
||||
} else if (val.intval != POWER_SUPPLY_TYPE_USB &&
|
||||
val.intval != POWER_SUPPLY_TYPE_USB_CDP &&
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0)
|
||||
val.intval != QTI_POWER_SUPPLY_TYPE_USB_FLOAT)
|
||||
#else
|
||||
val.intval != POWER_SUPPLY_TYPE_USB_FLOAT)
|
||||
#endif
|
||||
break;
|
||||
case DR_HOST_TO_DEVICE:
|
||||
stop_usb_host(rpmd);
|
||||
|
|
|
|||
Loading…
Reference in a new issue