aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd Poynor <toddpoynor@google.com>2014-09-22 20:37:09 -0700
committerMoyster <oysterized@gmail.com>2017-12-13 21:45:17 +0100
commit8a9f5ad001ed36fc7d6a70d25cffb6f06116ec09 (patch)
treed8f95fe6be4f51aacb16e44d25cef2a7abc7578a
parente35c72ed2ceecbc479b476bd5269f35604534baa (diff)
power: mediatek: remove wireless power_supply if no kernel support
Remove wireless power_supply entry if CONFIG_MTK_WIRELESS_CHARGER_SUPPORT is not enabled. Change-Id: I9cbb1d59c29b70c1adf314bf4a93e9e0c02cd431 Signed-off-by: Todd Poynor <toddpoynor@google.com>
-rw-r--r--drivers/power/mediatek/battery_common.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/power/mediatek/battery_common.c b/drivers/power/mediatek/battery_common.c
index 6f018a770..e5a672ac4 100644
--- a/drivers/power/mediatek/battery_common.c
+++ b/drivers/power/mediatek/battery_common.c
@@ -232,10 +232,12 @@ static int suspend_discharging = -1;
/* FOR ANDROID BATTERY SERVICE */
/* ////////////////////////////////////////////////////////////////////////////// */
+#if defined(CONFIG_MTK_WIRELESS_CHARGER_SUPPORT)
struct wireless_data {
struct power_supply psy;
int WIRELESS_ONLINE;
};
+#endif
struct ac_data {
struct power_supply psy;
@@ -272,9 +274,11 @@ struct battery_data {
int adjust_power;
};
+#if defined(CONFIG_MTK_WIRELESS_CHARGER_SUPPORT)
static enum power_supply_property wireless_props[] = {
POWER_SUPPLY_PROP_ONLINE,
};
+#endif
static enum power_supply_property ac_props[] = {
POWER_SUPPLY_PROP_ONLINE,
@@ -525,6 +529,7 @@ int init_proc_log(void)
}
+#if defined(CONFIG_MTK_WIRELESS_CHARGER_SUPPORT)
static int wireless_get_property(struct power_supply *psy,
enum power_supply_property psp, union power_supply_propval *val)
{
@@ -541,6 +546,7 @@ static int wireless_get_property(struct power_supply *psy,
}
return ret;
}
+#endif
static int ac_get_property(struct power_supply *psy,
enum power_supply_property psp, union power_supply_propval *val)
@@ -695,6 +701,7 @@ static int battery_get_property(struct power_supply *psy,
return ret;
}
+#if defined(CONFIG_MTK_WIRELESS_CHARGER_SUPPORT)
/* wireless_data initialization */
static struct wireless_data wireless_main = {
.psy = {
@@ -706,6 +713,7 @@ static struct wireless_data wireless_main = {
},
.WIRELESS_ONLINE = 0,
};
+#endif
/* ac_data initialization */
static struct ac_data ac_main = {
@@ -1986,6 +1994,7 @@ void update_charger_info(int wireless_state)
#endif
}
+#if defined(CONFIG_MTK_WIRELESS_CHARGER_SUPPORT)
static void wireless_update(struct wireless_data *wireless_data)
{
struct power_supply *wireless_psy = &wireless_data->psy;
@@ -2003,6 +2012,7 @@ static void wireless_update(struct wireless_data *wireless_data)
power_supply_changed(wireless_psy);
}
+#endif // CONFIG_MTK_WIRELESS_CHARGER_SUPPORT
#ifdef MEIZU_M81
static void ac_update(struct ac_data *ac_data)
@@ -2895,7 +2905,9 @@ static void mt_battery_update_status(void)
{
usb_update(&usb_main);
ac_update(&ac_main);
+#if defined(CONFIG_MTK_WIRELESS_CHARGER_SUPPORT)
wireless_update(&wireless_main);
+#endif
battery_update(&battery_main);
}
@@ -3915,6 +3927,7 @@ static int battery_probe(struct platform_device *dev)
}
battery_log(BAT_LOG_CRTI, "[BAT_probe] power_supply_register USB Success !!\n");
+#if defined(CONFIG_MTK_WIRELESS_CHARGER_SUPPORT)
ret = power_supply_register(&(dev->dev), &wireless_main.psy);
if (ret) {
battery_log(BAT_LOG_CRTI,
@@ -3923,6 +3936,7 @@ static int battery_probe(struct platform_device *dev)
}
battery_log(BAT_LOG_CRTI,
"[BAT_probe] power_supply_register WIRELESS Success !!\n");
+#endif
ret = power_supply_register(&(dev->dev), &battery_main.psy);
if (ret) {