Last active
August 29, 2015 13:56
-
-
Save axsddlr/9175994 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 4bec0cfd819192a9927b642e8e099cbf4ce32223 Mon Sep 17 00:00:00 2001 | |
From: Andre Saddler <[email protected]> | |
Date: Sun, 23 Feb 2014 07:19:12 -0500 | |
Subject: [PATCH] FFC: restore old implement abit | |
--- | |
drivers/power/smb349_charger.c | 42 ++++++++++++++++++++++++++++++++++++++++++ | |
drivers/usb/dwc3/dwc3_otg.c | 8 ++++++-- | |
drivers/usb/otg/msm_otg.c | 42 ++++++++++++++++++++++++++++++++++++++++++ | |
3 files changed, 90 insertions(+), 2 deletions(-) | |
diff --git a/drivers/power/smb349_charger.c b/drivers/power/smb349_charger.c | |
index c697c5c..6fda7d4 100644 | |
--- a/drivers/power/smb349_charger.c | |
+++ b/drivers/power/smb349_charger.c | |
@@ -60,6 +60,10 @@ | |
#define SMB349_MASK(BITS, POS) ((unsigned char)(((1 << BITS) - 1) << POS)) | |
+#ifdef CONFIG_FORCE_FAST_CHARGE | |
+#include <linux/fastchg.h> | |
+#endif | |
+ | |
/* Register definitions */ | |
#define CHG_CURRENT_REG 0x00 | |
#define CHG_OTHER_CURRENT_REG 0x01 | |
@@ -3137,6 +3141,9 @@ static int smb349_input_current_limit_set(struct smb349_struct *smb349_chg, int | |
{ | |
int i; | |
u8 temp; | |
+#ifdef CONFIG_FORCE_FAST_CHARGE | |
+ int custom_ma = icl_ma; | |
+#endif | |
if ((icl_ma < SMB349_INPUT_CURRENT_LIMIT_MIN_MA) || | |
(icl_ma > SMB349_INPUT_CURRENT_LIMIT_MAX_MA)) { | |
@@ -3154,7 +3161,42 @@ static int smb349_input_current_limit_set(struct smb349_struct *smb349_chg, int | |
i = 0; | |
} | |
+#ifdef CONFIG_FORCE_FAST_CHARGE | |
+ if (force_fast_charge == 1) { | |
+ i = 4; | |
+ custom_ma = FAST_CHARGE_1200; | |
+ icl_ma = custom_ma; | |
+ } else if (force_fast_charge == 2) { | |
+ switch (fast_charge_level) { | |
+ case FAST_CHARGE_500: | |
+ i = 0; | |
+ custom_ma = FAST_CHARGE_500; | |
+ break; | |
+ case FAST_CHARGE_900: | |
+ i = 1; | |
+ custom_ma = FAST_CHARGE_900; | |
+ break; | |
+ case FAST_CHARGE_1200: | |
+ i = 4; | |
+ custom_ma = FAST_CHARGE_1200; | |
+ break; | |
+ case FAST_CHARGE_1500: | |
+ i = 6; | |
+ custom_ma = FAST_CHARGE_1500; | |
+ break; | |
+ case FAST_CHARGE_2000: | |
+ i = 0xA; | |
+ custom_ma = FAST_CHARGE_2000; | |
+ break; | |
+ default: | |
+ break; | |
+ } | |
+ icl_ma = custom_ma; | |
+ } | |
temp = icl_ma_table[i].value; | |
+#else | |
+ temp = icl_ma_table[i].value; | |
+#endif | |
pr_info("input current limit=%d setting %02x\n", icl_ma, temp); | |
return smb349_masked_write(smb349_chg->client, CHG_CURRENT_REG, | |
diff --git a/drivers/usb/dwc3/dwc3_otg.c b/drivers/usb/dwc3/dwc3_otg.c | |
index d7105ab..82f399f 100644 | |
--- a/drivers/usb/dwc3/dwc3_otg.c | |
+++ b/drivers/usb/dwc3/dwc3_otg.c | |
@@ -24,6 +24,10 @@ | |
#include "io.h" | |
#include "xhci.h" | |
+#ifdef CONFIG_FORCE_FAST_CHARGE | |
+#include <linux/fastchg.h> | |
+#endif | |
+ | |
#ifdef CONFIG_LGE_PM | |
#include <mach/board_lge.h> | |
#include <linux/power_supply.h> | |
@@ -861,10 +865,10 @@ static void dwc3_otg_sm_work(struct work_struct *w) | |
DWC3_IDEV_CHG_MAX); | |
else | |
dwc3_otg_set_power(phy, | |
- IDEV_CHG_MIN); | |
+ IUNIT); | |
#else | |
dwc3_otg_set_power(phy, | |
- DWC3_IDEV_CHG_MIN); | |
+ IUNIT); | |
#endif | |
#ifdef CONFIG_LGE_PM | |
if (!slimport_is_connected()) { | |
diff --git a/drivers/usb/otg/msm_otg.c b/drivers/usb/otg/msm_otg.c | |
index ce00f79..ec4e739 100644 | |
--- a/drivers/usb/otg/msm_otg.c | |
+++ b/drivers/usb/otg/msm_otg.c | |
@@ -48,6 +48,10 @@ | |
#include <mach/msm_bus.h> | |
#include <mach/rpm-regulator.h> | |
+#ifdef CONFIG_FORCE_FAST_CHARGE | |
+#include <linux/fastchg.h> | |
+#endif | |
+ | |
#define MSM_USB_BASE (motg->regs) | |
#define DRIVER_NAME "msm_otg" | |
@@ -1326,6 +1330,9 @@ psy_error: | |
static void msm_otg_notify_charger(struct msm_otg *motg, unsigned mA) | |
{ | |
struct usb_gadget *g = motg->phy.otg->gadget; | |
+#ifdef CONFIG_FORCE_FAST_CHARGE | |
+ int custom_ma = mA; | |
+#endif | |
if (g && g->is_a_peripheral) | |
return; | |
@@ -1345,6 +1352,41 @@ static void msm_otg_notify_charger(struct msm_otg *motg, unsigned mA) | |
if (motg->cur_power == mA) | |
return; | |
+#ifdef CONFIG_FORCE_FAST_CHARGE | |
+ if (force_fast_charge == 1) { | |
+ custom_ma = FAST_CHARGE_1200; | |
+ pr_info("USB fast charging is ON - 1200mA.\n"); | |
+ mA = custom_ma; | |
+ } else if (force_fast_charge == 2) { | |
+ switch (fast_charge_level) { | |
+ case FAST_CHARGE_500: | |
+ custom_ma = FAST_CHARGE_500; | |
+ pr_info("USB fast charging is ON - 500mA.\n"); | |
+ break; | |
+ case FAST_CHARGE_900: | |
+ custom_ma = FAST_CHARGE_900; | |
+ pr_info("USB fast charging is ON - 900mA.\n"); | |
+ break; | |
+ case FAST_CHARGE_1200: | |
+ custom_ma = FAST_CHARGE_1200; | |
+ pr_info("USB fast charging is ON - 1200mA.\n"); | |
+ break; | |
+ case FAST_CHARGE_1500: | |
+ custom_ma = FAST_CHARGE_1500; | |
+ pr_info("USB fast charging is ON - 1500mA.\n"); | |
+ break; | |
+ case FAST_CHARGE_2000: | |
+ custom_ma = FAST_CHARGE_2000; | |
+ pr_info("USB fast charging is ON - 2000mA.\n"); | |
+ break; | |
+ default: | |
+ break; | |
+ } | |
+ mA = custom_ma; | |
+ } else { | |
+ pr_info("USB fast charging is OFF.\n"); | |
+ } | |
+#endif | |
dev_info(motg->phy.dev, "Avail curr from USB = %u\n", mA); | |
/* | |
-- | |
1.9.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment