diff options
author | mirko <mirko@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2008-12-13 01:54:56 +0000 |
---|---|---|
committer | mirko <mirko@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2008-12-13 01:54:56 +0000 |
commit | a95f9f92e2953d5829a29e95644dc4c4bc93f590 (patch) | |
tree | 01f2bf78edb2e3bb1466df9bca72e068632d0e74 /target/linux/s3c24xx/patches-2.6.26/1209-add-pcf50633-allow-force-charger-type.patch.patch | |
parent | 9fa649271dbc9c83417488203aeb1668a0238c54 (diff) |
change prefix for kernelpatchbase 2.6.26
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@13619 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/s3c24xx/patches-2.6.26/1209-add-pcf50633-allow-force-charger-type.patch.patch')
-rwxr-xr-x | target/linux/s3c24xx/patches-2.6.26/1209-add-pcf50633-allow-force-charger-type.patch.patch | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/target/linux/s3c24xx/patches-2.6.26/1209-add-pcf50633-allow-force-charger-type.patch.patch b/target/linux/s3c24xx/patches-2.6.26/1209-add-pcf50633-allow-force-charger-type.patch.patch new file mode 100755 index 000000000..0abfd0a87 --- /dev/null +++ b/target/linux/s3c24xx/patches-2.6.26/1209-add-pcf50633-allow-force-charger-type.patch.patch @@ -0,0 +1,69 @@ +From a671530397303f2a65c503e9670b5e32e867ffcf Mon Sep 17 00:00:00 2001 +From: Andy Green <andy@openmoko.com> +Date: Fri, 25 Jul 2008 23:06:19 +0100 +Subject: [PATCH] add-pcf50633-allow-force-charger-type.patch + +This patch adds a sysfs node: + +/sys/class/i2c-adapter/i2c-0/0-0073/force_usb_limit_dangerous + +it allows to force the charging limit regardless of the one chosen +by pcf50633 kernel driver. As such, if you write a charging limit +here that is not suitable for the power source, and the power source +is not current limited on its side, it could draw more current than +your power source can handle, burn down you house, etc. + +If you're certain that your power supply can handle it, you can use +this on your own responsibility to make the amount drawn by the +PMU match what you believed your power supply could handle. + +Example usage, in case where you have a dumb 500mA USB charger that +does not have the ID resistor: + +# cat /sys/class/i2c-adapter/i2c-0/0-0073/charger_type +host/500mA usb mode 100mA <=== dumb charger does not ennumerate us +# echo 500 > /sys/class/i2c-adapter/i2c-0/0-0073/force_usb_limit_dangerous +# cat /sys/class/i2c-adapter/i2c-0/0-0073/charger_type +host/500mA usb mode 500mA + +Signed-off-by: Andy Green <andy@openmoko.com> +--- + drivers/i2c/chips/pcf50633.c | 15 +++++++++++++++ + 1 files changed, 15 insertions(+), 0 deletions(-) + +diff --git a/drivers/i2c/chips/pcf50633.c b/drivers/i2c/chips/pcf50633.c +index 352b54a..1074b94 100644 +--- a/drivers/i2c/chips/pcf50633.c ++++ b/drivers/i2c/chips/pcf50633.c +@@ -1946,6 +1946,20 @@ static ssize_t show_charger_type(struct device *dev, + + static DEVICE_ATTR(charger_type, 0444, show_charger_type, NULL); + ++static ssize_t force_usb_limit_dangerous(struct device *dev, ++ struct device_attribute *attr, const char *buf, size_t count) ++{ ++ struct i2c_client *client = to_i2c_client(dev); ++ struct pcf50633_data *pcf = i2c_get_clientdata(client); ++ int ma = simple_strtoul(buf, NULL, 10); ++ ++ pcf50633_usb_curlim_set(pcf, ma); ++ return count; ++} ++ ++static DEVICE_ATTR(force_usb_limit_dangerous, 0600, ++ NULL, force_usb_limit_dangerous); ++ + /* + * Charger adc + */ +@@ -2023,6 +2037,7 @@ static struct attribute *pcf_sysfs_entries[] = { + &dev_attr_voltage_ldo6.attr, + &dev_attr_voltage_hcldo.attr, + &dev_attr_charger_type.attr, ++ &dev_attr_force_usb_limit_dangerous.attr, + &dev_attr_charger_adc.attr, + &dev_attr_dump_regs.attr, + NULL, /* going to add things at this point! */ +-- +1.5.6.3 + |