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 <mahj8@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1823126
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:
mahj8 2020-12-09 16:39:07 +08:00 • committed by Haijian Ma
commit 1d2d1f5f14
2 changed files with 33 additions and 0 deletions

View file

@ -16,7 +16,12 @@
#include <linux/reboot.h>
#include <linux/platform_device.h>
#include <linux/power_supply.h>
#include <linux/version.h>
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 61))
#include <linux/mmi-pmic-voter.h>
#else
#include <linux/pmic-voter.h>
#endif
#include <linux/of_device.h>
#include <linux/regmap.h>
#include <linux/regulator/consumer.h>
@ -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, \

View file

@ -27,11 +27,23 @@
*/
#define pr_fmt(fmt) "qpnp_adap_chg-[%s]: " fmt, __func__
#include <linux/module.h>
#include <linux/version.h>
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 61))
#include <linux/mmi-pmic-voter.h>
#else
#include <linux/pmic-voter.h>
#endif
#include <linux/power_supply.h>
#include <linux/notifier.h>
#include <linux/moduleparam.h>
#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;