summaryrefslogtreecommitdiff
path: root/drivers/power/qcom-charger/pmic-voter.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/power/qcom-charger/pmic-voter.h')
-rw-r--r--drivers/power/qcom-charger/pmic-voter.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/drivers/power/qcom-charger/pmic-voter.h b/drivers/power/qcom-charger/pmic-voter.h
new file mode 100644
index 000000000000..30cfecad4287
--- /dev/null
+++ b/drivers/power/qcom-charger/pmic-voter.h
@@ -0,0 +1,46 @@
+/* Copyright (c) 2015 The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __PMIC_VOTER_H
+#define __PMIC_VOTER_H
+
+#include <linux/mutex.h>
+
+struct votable;
+
+enum votable_type {
+ VOTE_MIN,
+ VOTE_MAX,
+ VOTE_SET_ANY,
+ NUM_VOTABLE_TYPES,
+};
+
+int get_client_vote(struct votable *votable, int client_id);
+int get_client_vote_locked(struct votable *votable, int client_id);
+int get_effective_result(struct votable *votable);
+int get_effective_result_locked(struct votable *votable);
+int get_effective_client_id(struct votable *votable);
+int get_effective_client_id_locked(struct votable *votable);
+int vote(struct votable *votable, int client_id, bool state, int val);
+struct votable *create_votable(struct device *dev, const char *name,
+ int votable_type, int num_clients,
+ int default_result,
+ int (*callback)(struct device *dev,
+ int effective_result,
+ int effective_client,
+ int last_result,
+ int last_client)
+ );
+void lock_votable(struct votable *votable);
+void unlock_votable(struct votable *votable);
+
+#endif /* __PMIC_VOTER_H */