From 510a3788814b64c7dca58231d994731f92a08acf Mon Sep 17 00:00:00 2001 From: zhaoxp3 Date: Wed, 27 Jun 2018 17:01:14 -0500 Subject: [PATCH] power: pmic-voter: Export Interfaces Export some pmic-voter interfaces for dlkm usage as well as create access functions that are exported for dlkm to manipulate the struct. ported from https://gerrit.mot.com/1200744 Change-Id: I073a4e976f8cd184fa20b262eba9bc962a4a1bb2 Signed-off-by: zhaoxp3 Reviewed-on: https://gerrit.mot.com/1499583 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Wang Wang Submit-Approved: Jira Key --- drivers/power/supply/qcom/pmic-voter.c | 30 ++++++++++++++++++++++++++ include/linux/pmic-voter.h | 4 ++++ 2 files changed, 34 insertions(+) diff --git a/drivers/power/supply/qcom/pmic-voter.c b/drivers/power/supply/qcom/pmic-voter.c index 838e3f7ecb62..2624932e38d0 100644 --- a/drivers/power/supply/qcom/pmic-voter.c +++ b/drivers/power/supply/qcom/pmic-voter.c @@ -340,6 +340,7 @@ int get_effective_result(struct votable *votable) unlock_votable(votable); return value; } +EXPORT_SYMBOL(get_effective_result); /** * get_effective_client() - @@ -498,6 +499,7 @@ out: unlock_votable(votable); return rc; } +EXPORT_SYMBOL(vote); /** * vote_override() - @@ -571,6 +573,7 @@ int rerun_election(struct votable *votable) unlock_votable(votable); return rc; } +EXPORT_SYMBOL(rerun_election); struct votable *find_votable(const char *name) { @@ -599,6 +602,7 @@ out: else return NULL; } +EXPORT_SYMBOL(find_votable); static int force_active_get(void *data, u64 *val) { @@ -645,6 +649,32 @@ out: DEFINE_DEBUGFS_ATTRIBUTE(votable_force_ops, force_active_get, force_active_set, "%lld\n"); +int pmic_vote_force_val_set(struct votable *votable, u32 val) { + if(votable) { + votable->force_val = val; + return 0; + } + + return -EINVAL; +} +EXPORT_SYMBOL(pmic_vote_force_val_set); + +int pmic_vote_force_active_get(struct votable *votable, u64 *val) { + if(votable) + return force_active_get(votable, val); + + return -EINVAL; +} +EXPORT_SYMBOL(pmic_vote_force_active_get); + +int pmic_vote_force_active_set(struct votable *votable, u64 val) { + if(votable) + return force_active_set(votable, val); + + return -EINVAL; +} +EXPORT_SYMBOL(pmic_vote_force_active_set); + static int show_votable_clients(struct seq_file *m, void *data) { struct votable *votable = m->private; diff --git a/include/linux/pmic-voter.h b/include/linux/pmic-voter.h index a2472741f597..ecbe13ca7a55 100644 --- a/include/linux/pmic-voter.h +++ b/include/linux/pmic-voter.h @@ -45,4 +45,8 @@ void destroy_votable(struct votable *votable); void lock_votable(struct votable *votable); void unlock_votable(struct votable *votable); +int pmic_vote_force_val_set(struct votable *votable, u32 val); +int pmic_vote_force_active_get(struct votable *votable, u64 *val); +int pmic_vote_force_active_set(struct votable *votable, u64 val); + #endif /* __PMIC_VOTER_H */