kernel: export some api symbol of pmic vote

Export some pmic-voter interfaces for dlkm usage as well
as create access functions that are exported for dlkm to
manipulate the struct.

charging DLKM need some api of pmic vote, but pmic_voter.o
is included by both qpnp-smb5-main.ko and qcom-qpnp-qg.ko,
KMI don't allow double export one function in two DLKM modules.

Change-Id: I56f96b663d9ee2228d91bd2efc6977a13f270de4
Signed-off-by: mahj8 <mahj8@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1822930
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Haijian Ma <mahj8@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
mahj8 2020-12-09 13:57:27 +08:00 • committed by Xiaojun Ji
commit 303f09a9d1
3 changed files with 80 additions and 1 deletions

View file

@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0-only
obj-$(CONFIG_QPNP_SMB5) += qpnp-smb5-main.o
qpnp-smb5-main-y += step-chg-jeita.o battery.o qpnp-smb5.o smb5-lib.o pmic-voter.o storm-watch.o schgm-flash.o battery-profile-loader.o smb5-iio.o
qpnp-smb5-main-y += step-chg-jeita.o battery.o qpnp-smb5.o smb5-lib.o pmic-voter.o mmi-pmic-voter.o storm-watch.o schgm-flash.o battery-profile-loader.o smb5-iio.o
obj-$(CONFIG_QPNP_QG) += qcom-qpnp-qg.o
qcom-qpnp-qg-y += qpnp-qg.o battery-profile-loader.o pmic-voter.o qg-util.o qg-soc.o qg-sdam.o qg-battery-profile.o qg-profile-lib.o fg-alg.o
obj-$(CONFIG_SMB1398_CHARGER) += qcom-smb1398-charger.o

View file

@ -0,0 +1,60 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2015-2017, 2019-2020, The Linux Foundation. All rights reserved.
*/
#include <linux/string.h>
#include <linux/pmic-voter.h>
#include <linux/mmi-pmic-voter.h>
int mmi_get_effective_result(struct votable *votable)
{
if(votable)
return get_effective_result(votable);
return -EINVAL;
}
EXPORT_SYMBOL(mmi_get_effective_result);
int mmi_vote(struct votable *votable, const char *client_str, bool enabled, int val)
{
if(votable)
return vote(votable, client_str, enabled, val);
return -EINVAL;
}
EXPORT_SYMBOL(mmi_vote);
int mmi_rerun_election(struct votable *votable)
{
if(votable)
return rerun_election(votable);
return -EINVAL;
}
EXPORT_SYMBOL(mmi_rerun_election);
struct votable *mmi_find_votable(const char *name)
{
return find_votable(name);
}
EXPORT_SYMBOL(mmi_find_votable);
int mmi_pmic_vote_force_val_set(struct votable *votable, u32 val)
{
return pmic_vote_force_val_set(votable, val);
}
EXPORT_SYMBOL(mmi_pmic_vote_force_val_set);
int mmi_pmic_vote_force_active_get(struct votable *votable, u64 *val)
{
return pmic_vote_force_active_get(votable, val);
}
EXPORT_SYMBOL(mmi_pmic_vote_force_active_get);
int mmi_pmic_vote_force_active_set(struct votable *votable, u64 val)
{
return pmic_vote_force_active_set(votable, val);
}
EXPORT_SYMBOL(mmi_pmic_vote_force_active_set);

View file

@ -0,0 +1,19 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2015-2017, 2019-2020, The Linux Foundation. All rights reserved.
*/
#ifndef __MMI_PMIC_VOTER_H
#define __MMI_PMIC_VOTER_H
#include <linux/pmic-voter.h>
int mmi_get_effective_result(struct votable *votable);
int mmi_vote(struct votable *votable, const char *client_str, bool enabled, int val);
int mmi_rerun_election(struct votable *votable);
struct votable *mmi_find_votable(const char *name);
int mmi_pmic_vote_force_val_set(struct votable *votable, u32 val);
int mmi_pmic_vote_force_active_get(struct votable *votable, u64 *val);
int mmi_pmic_vote_force_active_set(struct votable *votable, u64 val);
#endif /* __MMI_PMIC_VOTER_H */