Skip to content

Commit

Permalink
fast charge: from imoseyon
Browse files Browse the repository at this point in the history
Conflicts:

	arch/arm/mach-msm/board-m2_att.c

Conflicts:

	arch/arm/mach-msm/board-m2_att.c
  • Loading branch information
ktoonsez authored and lawnn committed Mar 15, 2015
1 parent 938ac14 commit e192402
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 3 deletions.
6 changes: 6 additions & 0 deletions arch/arm/mach-msm/Kconfig
Expand Up @@ -356,6 +356,12 @@ config ARCH_MSM9625
select MSM_GPIOMUX
select MULTI_IRQ_HANDLER
select GPIO_MSM_V3
config FORCE_FAST_CHARGE
bool "Force AC charge mode at will"
default y
help
A simple sysfs interface to force adapters that
are detected as USB to charge as AC.
endmenu

choice
Expand Down
1 change: 1 addition & 0 deletions arch/arm/mach-msm/Makefile
Expand Up @@ -272,6 +272,7 @@ obj-$(CONFIG_ARCH_MSM8960) += acpuclock-8960.o acpuclock-8960ab.o
obj-$(CONFIG_ARCH_MSM8960) += memory_topology.o
obj-$(CONFIG_ARCH_MSM8960) += saw-regulator.o
obj-$(CONFIG_ARCH_MSM8960) += devices-8960.o
obj-$(CONFIG_ARCH_MSM8960) += fastchg.o
obj-$(CONFIG_ARCH_APQ8064) += devices-8960.o devices-8064.o
obj-$(CONFIG_ARCH_APQ8064) += acpuclock-8064.o
board-8960-all-objs += board-8960.o board-8960-camera.o board-8960-display.o board-8960-pmic.o board-8960-storage.o board-8960-gpiomux.o
Expand Down
4 changes: 3 additions & 1 deletion arch/arm/mach-msm/board-m2_att.c
Expand Up @@ -185,6 +185,7 @@ extern unsigned int system_rev;
#ifdef CONFIG_TOUCHSCREEN_MMS144
struct tsp_callbacks *charger_callbacks;
#endif
extern int force_fast_charge;

static struct platform_device msm_fm_platform_init = {
.name = "iris_fm",
Expand Down Expand Up @@ -1553,7 +1554,8 @@ int msm8960_get_cable_type(void)
#endif
break;
case CABLE_TYPE_USB:
fsa9485_usb_cb(1);
if (!force_fast_charge) fsa9485_usb_cb(1);
else fsa9485_charger_cb(1);
break;
case CABLE_TYPE_AC:
fsa9485_charger_cb(1);
Expand Down
4 changes: 3 additions & 1 deletion arch/arm/mach-msm/board-m2_dcm.c
Expand Up @@ -183,6 +183,7 @@ extern unsigned int system_rev;
#ifdef CONFIG_TOUCHSCREEN_MMS144
struct tsp_callbacks *charger_callbacks;
#endif
extern int force_fast_charge;

static struct platform_device msm_fm_platform_init = {
.name = "iris_fm",
Expand Down Expand Up @@ -1550,7 +1551,8 @@ int msm8960_get_cable_type(void)
#endif
break;
case CABLE_TYPE_USB:
fsa9485_usb_cb(1);
if (!force_fast_charge) fsa9485_usb_cb(1);
else fsa9485_charger_cb(1);
break;
case CABLE_TYPE_AC:
fsa9485_charger_cb(1);
Expand Down
69 changes: 69 additions & 0 deletions arch/arm/mach-msm/fastchg.c
@@ -0,0 +1,69 @@
/*
* Author: imoseyon (original by Chad Froebel)
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* 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.
*
*/

#include <linux/kobject.h>
#include <linux/sysfs.h>

int force_fast_charge;

/* sysfs interface */
static ssize_t force_fast_charge_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
{
return sprintf(buf, "%d\n", force_fast_charge);
}

static ssize_t force_fast_charge_store(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t count)
{
sscanf(buf, "%du", &force_fast_charge);
return count;
}

static struct kobj_attribute force_fast_charge_attribute =
__ATTR(force_fast_charge, 0666, force_fast_charge_show, force_fast_charge_store);

static struct attribute *attrs[] = {
&force_fast_charge_attribute.attr,
NULL,
};

static struct attribute_group attr_group = {
.attrs = attrs,
};

static struct kobject *force_fast_charge_kobj;

int force_fast_charge_init(void)
{
int retval;

force_fast_charge = 0;

force_fast_charge_kobj = kobject_create_and_add("fast_charge", kernel_kobj);
if (!force_fast_charge_kobj) {
return -ENOMEM;
}
retval = sysfs_create_group(force_fast_charge_kobj, &attr_group);
if (retval)
kobject_put(force_fast_charge_kobj);
return retval;
}
/* end sysfs interface */

void force_fast_charge_exit(void)
{
kobject_put(force_fast_charge_kobj);
}

module_init(force_fast_charge_init);
module_exit(force_fast_charge_exit);
4 changes: 3 additions & 1 deletion drivers/misc/fsa9485.c
Expand Up @@ -136,7 +136,9 @@
#define ADC_CARDOCK 0x1d
#define ADC_OPEN 0x1f

int uart_connecting;
extern int force_fast_charge;

int uart_connecting = 0;
EXPORT_SYMBOL(uart_connecting);

int detached_status;
Expand Down

0 comments on commit e192402

Please sign in to comment.