aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJohan Gardsmark <johan.gardsmark@stericsson.com>2011-01-05 15:23:55 +0100
committerHenrik Öhman <henrik.ohman@stericsson.com>2011-03-11 08:40:41 +0100
commit1c622178155acd3601137f867ec02ff56a5b1ff6 (patch)
treed7aa8c07b4e8c2465b7d1ca3c693632f2bd9d8cc /include
parent685bcb6c51d7591ccd0b596fa4d225e19175ce92 (diff)
power: ab8500_bm: Add support for non-ab8500 chargers
Adds support to use non-ab8500 chargers in the ab8500 charging algorithm. The charger specific functions are now stored in a "sub class" charger structure with the power_supply as a "base class". ST-Ericsson ID: WP324917 Change-Id: I3c29c6b767209d750498ecd6b8a690d9fb073109 Signed-off-by: Johan Gardsmark <johan.gardsmark@stericsson.com> Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/16416 Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/mfd/ab8500/ab8500-bm.h9
-rw-r--r--include/linux/mfd/ab8500/ux500_chargalg.h37
2 files changed, 37 insertions, 9 deletions
diff --git a/include/linux/mfd/ab8500/ab8500-bm.h b/include/linux/mfd/ab8500/ab8500-bm.h
index 82a0c15ffda..d99a150f992 100644
--- a/include/linux/mfd/ab8500/ab8500-bm.h
+++ b/include/linux/mfd/ab8500/ab8500-bm.h
@@ -260,15 +260,8 @@ struct v_to_cap {
};
/* Forward declaration */
-struct ab8500_charger;
struct ab8500_fg;
-struct ab8500_charger_ops {
- int (*ac_en) (struct ab8500_charger *, int, int, int);
- int (*usb_en) (struct ab8500_charger *, int, int, int);
- int (*kick_watchdog) (struct ab8500_charger *);
-};
-
/**
* struct ab8500_fg_parameters - Fuel gauge algorithm parameters, in seconds
* if not specified
@@ -394,7 +387,6 @@ struct ab8500_bm_charger_parameters {
* @cap_levels capacity in percent for the different capacity levels
* @pcb_ntc table with resistance to temp for PCB mounted NTC
* @bat_type table of supported battery types
- * @charger_ops pointers to the charger functions used by the algorithm
* @chg_params charger parameters
* @fg_params fuel gauge parameters
*/
@@ -416,7 +408,6 @@ struct ab8500_bm_data {
struct ab8500_bm_capacity_levels *cap_levels;
struct res_to_temp *pcb_ntc;
struct battery_type *bat_type;
- struct ab8500_charger_ops charger_ops;
const struct ab8500_bm_charger_parameters *chg_params;
const struct ab8500_fg_parameters *fg_params;
};
diff --git a/include/linux/mfd/ab8500/ux500_chargalg.h b/include/linux/mfd/ab8500/ux500_chargalg.h
new file mode 100644
index 00000000000..2048ab65c8f
--- /dev/null
+++ b/include/linux/mfd/ab8500/ux500_chargalg.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) ST-Ericsson SA 2011
+ * Author: Johan Gardsmark <johan.gardsmark@stericsson.com> for ST-Ericsson.
+ * License terms: GNU General Public License (GPL), version 2
+ */
+
+#ifndef _UX500_CHARGALG_H
+#define _UX500_CHARGALG_H
+
+#include <linux/power_supply.h>
+
+#define psy_to_ux500_charger(x) container_of((x), \
+ struct ux500_charger, psy)
+
+/* Forward declaration */
+struct ux500_charger;
+
+struct ux500_charger_ops {
+ int (*enable) (struct ux500_charger *, int, int, int);
+ int (*kick_wd) (struct ux500_charger *);
+};
+
+/**
+ * struct ux500_charger - power supply ux500 charger sub class
+ * @psy power supply base class
+ * @ops ux500 charger operations
+ * @max_out_volt maximum output charger voltage in mV
+ * @max_out_curr maximum output charger current in mA
+ */
+struct ux500_charger {
+ struct power_supply psy;
+ struct ux500_charger_ops ops;
+ int max_out_volt;
+ int max_out_curr;
+};
+
+#endif