From 1d2d1f5f14e788faa44b52cb894bf671ee35274c Mon Sep 17 00:00:00 2001 From: mahj8 Date: Wed, 9 Dec 2020 16:39:07 +0800 Subject: [PATCH] DLKM: use new api in mmi-pmic-voter.c Because GKI, export api move from pmic-voter.c to mmi-pmic-voter.c and for compatible, use kernel version to compatible with old product. Change-Id: Ia2c74ae4447d0621ac5bced0f3355d868712ac24 Signed-off-by: mahj8 Reviewed-on: https://gerrit.mot.com/1823126 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Huosheng Liao Submit-Approved: Jira Key --- .../mmi-smbcharger-iio/mmi-smbcharger-iio.c | 21 +++++++++++++++++++ .../qpnp_adaptive_charge.c | 12 +++++++++++ 2 files changed, 33 insertions(+) diff --git a/drivers/power/mmi-smbcharger-iio/mmi-smbcharger-iio.c b/drivers/power/mmi-smbcharger-iio/mmi-smbcharger-iio.c index e486da482535..877a1a943e36 100755 --- a/drivers/power/mmi-smbcharger-iio/mmi-smbcharger-iio.c +++ b/drivers/power/mmi-smbcharger-iio/mmi-smbcharger-iio.c @@ -16,7 +16,12 @@ #include #include #include +#include +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 61)) +#include +#else #include +#endif #include #include #include @@ -33,6 +38,22 @@ #define MODULE_LOG "SMBMMI" +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 61)) +#define get_effective_result(votable) \ + mmi_get_effective_result(votable) + +#define vote(votable, client_str, enabled, val) \ + mmi_vote(votable, client_str, enabled, val) + +#define find_votable(name) mmi_find_votable(name) + +#define pmic_vote_force_val_set(votable, val) \ + mmi_pmic_vote_force_val_set(votable, val) + +#define pmic_vote_force_active_set(votable, val) \ + mmi_pmic_vote_force_active_set(votable, val) +#endif + #define mmi_err(chg, fmt, ...) \ do { \ pr_err("%s: %s: %s: " fmt, chg->name, \ diff --git a/drivers/power/qpnp_adaptive_charge/qpnp_adaptive_charge.c b/drivers/power/qpnp_adaptive_charge/qpnp_adaptive_charge.c index 677dd1ac9f36..cc735b8271f4 100755 --- a/drivers/power/qpnp_adaptive_charge/qpnp_adaptive_charge.c +++ b/drivers/power/qpnp_adaptive_charge/qpnp_adaptive_charge.c @@ -27,11 +27,23 @@ */ #define pr_fmt(fmt) "qpnp_adap_chg-[%s]: " fmt, __func__ #include +#include +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 61)) +#include +#else #include +#endif #include #include #include +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 61)) +#define vote(votable, client_str, enabled, val) \ + mmi_vote(votable, client_str, enabled, val) + +#define find_votable(name) mmi_find_votable(name) +#endif + static struct adap_chg_data { struct power_supply *batt_psy; struct power_supply *dc_psy;