Merged Force Fast Charge Driver by @Faux123 and ME :)

Conflicts:
	arch/arm/mach-msm/fastchg.c
	drivers/usb/otg/msm_otg.c
FAST CHARGE: new hack to allow detect any USB cable as ORIGINAL Cable.

This allow faster file transfer USB 2.0 and can help with faster charging.
FAST CHARGE: Ver 1.4 added new controls to bypass ROM thermal control.

If i want to use Intelli thermal i cant get more than 300ma! as no one
telling to kernel to allow high charge power.

by doing:
echo 1600 > /sys/module/smb349_charger/parameters/smb349_thermal_mitigation

so the smb349_thermal_mitigation stay 300ma

now kernel will use fake charge mA value to boost smb349_thermal_mitigation
when USB is connected.

and if battery will be over 55c it's will set 300mA max till cooldown.

here some examples switching max mA in STweaks in manual mode:

<3>smb349_set_thermal_chg_current_set: thermal-engine set chg current to 500
<3>LGE charging scenario : state 0 -> 0(0-0), temp=34, volt=4180, BTM=0, charger=1, cur_set=500/500, chg_cur = 199
<3>smb349_set_thermal_chg_current_set: thermal-engine set chg current to 1600
<3>LGE charging scenario : state 0 -> 0(0-0), temp=36, volt=4057, BTM=0, charger=1, cur_set=1600/1600, chg_cur = 117
<3>smb349_set_thermal_chg_current_set: thermal-engine set chg current to 1800
<3>LGE charging scenario : state 0 -> 0(0-0), temp=33, volt=4201, BTM=0, charger=1, cur_set=1800/1600, chg_cur = 244
Revert USB CABLE Hack, it's not working as needed.
FORCE FAST CHARGE: bump to v1.5 Cleanups + FIX, now it's WORKS
BATTERY POWER: fixed bugged function that i added long time ago.

*We do not need to update the thermal_mitigation each battery update.
it's creating not needed work non stop on charge.
*When current_now is below 300ma then set thermal_mitigation to 300
in order to maintain stable connection to device over USB. no disconnects.
*If battery is LOW and ROM we connected strong charger, then each time ROM
Theraml update the smb349_thermal_mitigation check what we want to have based
on fast charge profile. and update it and not what ROM thermal want.
*Check if battery overheatted or 55C and drop thermal_mitigation to 300
to cool it and preserve.

Conflicts:
	drivers/power/smb349_charger.c
FORCE FAST CHARGE: V1.6 allow kernel control for smb349_thermal_mitigation

*ROM thermal driver controlling the smb349_thermal_mitigation that lock
max charge from charger/usb to what ROM thermal decide.
Well that is not always good for us :)

*If we connect USB from PC, we will get 500ma charge limit as USB
cant give us more any way. prevent force fast charge to set higher.

*If battery is overheatted or at >= 98% limit charge to 300ma to prevent
battery damage.

*ROM thermal is slow in detecting allowed mA limit, so we use kernel
power connector detection function to update smb349_thermal_mitigation
limit current.

again only if no high temp and battery below 98%

*Also allow USER to set limit using force fast charge interface when using
charger! on USB it's will charge max 500 as should.
FORCE FAST CHARGE: v1.7 auto reload force on power plug/unplug.

*Some users report that they must disable and enable the
force fast charge to get high charge power. or they stuck at 300mA

For me all was OK as is. but i am nice dev, so here is auto reload
when Unplugged, force fast charge set to disabled.
and when plugged back to enabled, if was enabled.

From LOG:

PLUG PC USB:
<6>msm-dwc3 msm_dwc3: chg_type = USB_SDP_CHARGER
<6>dwc3 f9200000.dwc3: Avail curr from USB = 500
<6>dwc3 f9200000.dwc3: Power plugged, FFC is set to = 2
<6>smb349_input_current_limit_set: input current limit=1800 setting 09
<6>msm_otg_notify_power_supply: power_supply_get_by_name(usb)
<6>smb349_is_charger_present: DC is present. DC_IN volt:4841060

UNPLUG:
<3>android_work: sent uevent USB_STATE=DISCONNECTED
<6>dwc3 f9200000.dwc3: Avail curr from USB = 0
<6>dwc3 f9200000.dwc3: Power Unplugged, FFC is set to = 0
<3>smb349_is_charger_present: DC is missing.
<6>smb349_input_current_limit_set: input current limit=2000 setting 0a
<6>msm_otg_notify_power_supply: power_supply_get_by_name(usb)
<3>smb349_is_charger_present: DC is missing.
BATTERY CHARGER: When PC USB connected. limit to 370mA.

*Usb chaarge never pass 370ma any way. but when driver set to 500
USB connection with PC, reset on higher drain. and reconnect.
Stop it by reducing max mA on USB to 370.

*Split pr info by 2, and add requested mittigation.
Do not update thermal mitigation when SMB349_VZW_FAST_CHG used for VS980
FORCE FAST CHARGE: V1.8 new fixes and options.

*Fixed fast charge to 1200 when using FFC ON, was stuck on 300ma!
*Added Ability to charge on MAX 300ma as requested by my user.
*Corrected 1500ma to 1600ma to make it more standard current.
*Rised USB max mA from 370 to 400mA. as we need more 100 for stable MTP
link from PC to Phone.
FORCE FAST CHARGE: v1.9 added auto FFC on/off based on battery %

*If battery is above 95% then fast charge is set to OFF
if battery is below 95% it's enabled again if was ON/Manual before.

This should prevent full charge bugs and SODS.
FORCE FAST CHARGE: v2.0 add mutex guards to functions.

*My functions get values from other code, and best to lock the read
in that time for asking function.
FORCE FAST CHARGE: Guard with mutex the workqueue functions.

*One can be used by ROM Thermal Driver.
And other by USB power connect/disconnect.

So both of them can try to use the functions and do the work restart.
This will lead to deadlock and SOD.
FORCE FAST CHARGE: v2.1 Correct Mutex init and defines in right place.
FORCE FAST CHARGE: v2.2 fix charging on 900ma limit.
FORCE FAST CHARGE: Delete useless FAKE AC hack. it's brake ROM LED.

This has no effect on battery charge. it's just say AC and not USB
But brake charge LED after unplug, it's still turned ON.
and charge mode is not disabled, so wakelock is held, user loose
power, as CPU dont sleep.

Time for this HACK to be cleaned. it's was OFF by default.
but users used it, and posted nags. purge is the best option here.
FORCE FAST CHARGE: v2.3 added more checks, and code style.

*New checks to thermal mitigation functions and corrected code style.
*Removed updating charging scenario when no charger connected. no point to do so.
Updater-Script: TESTING
Signed-off-by: renderbroken <zkennedy87@gmail.com>
OZIP: Updater-Script: Update fot Synapse Support
Signed-off-by: renderbroken <zkennedy87@gmail.com>