Add FastCharge

file:9c453bb262d74ec00cb2d5eaf1d18fb2b977acf0 -> file:51b347af328bb1a6ff6be214dfa7e531b2a963b6
--- a/arch/arm/mach-msm/Kconfig
+++ b/arch/arm/mach-msm/Kconfig
@@ -2350,4 +2350,11 @@ config MSM_DCVS
algorithm and the algorithm returns a frequency for the core which is
passed to the frequency change driver.
+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.
+
endif
file:7855b046ef09699af7e3ee42c7eeeae20b5d1bdd -> file:0b557c2b4a48378f850b3161b2568a9b6e5cb7f7
--- a/arch/arm/mach-msm/Makefile
+++ b/arch/arm/mach-msm/Makefile
@@ -230,6 +230,9 @@ obj-$(CONFIG_ARCH_MSM8960) += acpuclock-
obj-$(CONFIG_ARCH_MSM8960) += memory_topology.o
obj-$(CONFIG_ARCH_MSM8960) += saw-regulator.o
obj-$(CONFIG_ARCH_MSM8960) += devices-8960.o
+
+obj-$(CONFIG_FORCE_FAST_CHARGE) += fastchg.o
+
obj-$(CONFIG_ARCH_APQ8064) += devices-8960.o devices-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
board-8930-all-objs += board-8930.o board-8930-camera.o board-8930-display.o board-8930-pmic.o board-8930-storage.o board-8930-gpiomux.o
file:41fd1b0bfe5b242efcd6da70ece5fca5e79d07cd(new)
--- /dev/null
+++ b/arch/arm/mach-msm/fastchg.c
@@ -0,0 +1,70 @@
+/*
+ * Author: Chad Froebel <chadfroebel@gmail.com>
+ *
+ * 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>
+#include <linux/fastchg.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);
file:bcbb68f0a8c477421af5d4c09c7bdfde59abb274 -> file:d23ca038dcdc236fa1886dc339d97ae84be46962
--- a/drivers/misc/fsa9485.c
+++ b/drivers/misc/fsa9485.c
@@ -36,6 +36,7 @@
#include <linux/mfd/pmic8058.h>
#include <linux/input.h>
#include <linux/sii9234.h>
+#include <linux/fastchg.h>
/* FSA9480 I2C registers */
#define FSA9485_REG_DEVID 0x01
@@ -645,8 +646,14 @@ static int fsa9485_detect_dev(struct fsa
if (val1 & DEV_USB || val2 & DEV_T2_USB_MASK) {
dev_info(&client->dev, "usb connect\n");
- if (pdata->usb_cb)
- pdata->usb_cb(FSA9485_ATTACHED);
+ if (pdata->usb_cb) {
+ if (force_fast_charge != 0) {
+ pdata->charger_cb(FSA9485_ATTACHED);
+ } else {
+ pdata->usb_cb(FSA9485_ATTACHED);
+ }
+ }
+
if (usbsw->mansw) {
ret = i2c_smbus_write_byte_data(client,
FSA9485_REG_MANSW1, usbsw->mansw);
file:ba459fcdce28a94116576716d66325209fd63518(new)
--- /dev/null
+++ b/include/linux/fastchg.h
@@ -0,0 +1,21 @@
+/*
+ * Author: Chad Froebel <chadfroebel@gmail.com>
+ *
+ * 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.
+ *
+ */
+
+
+#ifndef _LINUX_FASTCHG_H
+#define _LINUX_FASTCHG_H
+
+extern int force_fast_charge;
+
+#endif