diff options
author | Pavel <pavel@ucw.cz> | 2017-11-07 20:36:27 +0100 |
---|---|---|
committer | Pavel <pavel@ucw.cz> | 2017-11-07 20:36:27 +0100 |
commit | 772f118686ae6c427fb1adc46c8bc60d41c7d7d5 (patch) | |
tree | 285e323b64cef875c88712fcdc0018deabe960cf | |
parent | fbb3c05cd19dc5bf16cb13b62d3739c6adcb4fc6 (diff) | |
download | linux-n900-n950-v4.13.tar.gz |
Enable debugging.n950-v4.13
Check version of bq27.
Attempt to force 500mA on USB.
-rw-r--r-- | drivers/power/supply/bq2415x_charger.c | 1 | ||||
-rw-r--r-- | drivers/power/supply/bq27xxx_battery.c | 16 | ||||
-rw-r--r-- | drivers/power/supply/twl5031_charger.c | 10 |
3 files changed, 26 insertions, 1 deletions
diff --git a/drivers/power/supply/bq2415x_charger.c b/drivers/power/supply/bq2415x_charger.c index c4770a94cc8e66..6480c4cd4fc79d 100644 --- a/drivers/power/supply/bq2415x_charger.c +++ b/drivers/power/supply/bq2415x_charger.c @@ -24,6 +24,7 @@ * http://www.ti.com/product/bq24158 */ +#define DEBUG #include <linux/kernel.h> #include <linux/module.h> #include <linux/param.h> diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c index 4ab2bfcb3d8528..ead70a4f204662 100644 --- a/drivers/power/supply/bq27xxx_battery.c +++ b/drivers/power/supply/bq27xxx_battery.c @@ -1948,6 +1948,22 @@ int bq27xxx_battery_setup(struct bq27xxx_device_info *di) dev_info(di->dev, "support ver. %s enabled\n", DRIVER_VERSION); + if (di->chip == BQ27521) { + int val; + val = di->bus.read(di, 0x32, false); + if (val == 0x2100) { + printk("rev. 13 chip detected; add support\n"); + /* https://elinux.org/N950 has details */ + return PTR_ERR(ENODEV); + } + + val = di->bus.read(di, 0x34, false); + if ((val & 0xff00) != 0x2100) { + printk("rev. 14 chip not detected?!\n"); + return PTR_ERR(EINVAL); + } + } + bq27xxx_battery_settings(di); bq27xxx_battery_update(di); diff --git a/drivers/power/supply/twl5031_charger.c b/drivers/power/supply/twl5031_charger.c index 8378c4a34d3695..ecfbeb44594006 100644 --- a/drivers/power/supply/twl5031_charger.c +++ b/drivers/power/supply/twl5031_charger.c @@ -21,6 +21,7 @@ * */ +#define DEBUG #include <linux/init.h> #include <linux/module.h> #include <linux/platform_device.h> @@ -34,6 +35,8 @@ #include <linux/ulpi/regs.h> #include <linux/i2c/twl.h> +#define dev_dbg dev_info + #define TWL5031_BCC_CTRL2 0x01 #define TWL5031_CHGMODE_SW BIT(0) #define TWL5031_SW_USBCHRG_EN BIT(1) @@ -266,6 +269,7 @@ static void twl5031_bcc_psy_fsm_detect(struct twl5031_bcc_data *bcc) if (ctl < 0) goto out; + printk("twl5031: enabling USB detection: setting control to %lx\n", ctl); ctl |= (TWL5031_CHGMODE_SW | TWL5031_SW_USB_DET_EN); if (twl5031_bcc_write(TWL5031_BCC_CTRL2, ctl) < 0) goto out; @@ -297,6 +301,7 @@ static void twl5031_bcc_psy_fsm_detect(struct twl5031_bcc_data *bcc) } while (!time_after(jiffies, timeout) && bcc->dcd_online); switch (res) { + case TWL5031_USB_DET_STS_100MA: case TWL5031_USB_DET_STS_500MA: ctl |= TWL5031_SW_CHRG_DET | TWL5031_SW_USBCHRG_EN; bcc->usb_present = true; @@ -304,6 +309,7 @@ static void twl5031_bcc_psy_fsm_detect(struct twl5031_bcc_data *bcc) psy_type = twl5031_bcc_usb_charger_type(bcc); dev_dbg(bcc->dev, "500mA detected, STS %02x\n", res); break; +#if 0 case TWL5031_USB_DET_STS_100MA: ctl |= TWL5031_SW_USBCHRG_EN; psy_type = POWER_SUPPLY_TYPE_USB; @@ -311,6 +317,7 @@ static void twl5031_bcc_psy_fsm_detect(struct twl5031_bcc_data *bcc) bcc->usb_current = 100; dev_dbg(bcc->dev, "100mA detected, STS %02x\n", res); break; +#endif default: ctl &= ~TWL5031_SW_USBCHRG_EN; dev_dbg(bcc->dev, "No charger detected, STS %02x\n", res); @@ -323,6 +330,7 @@ static void twl5031_bcc_psy_fsm_detect(struct twl5031_bcc_data *bcc) } ctl &= ~TWL5031_SW_USB_DET_EN; /* save result, stop FSM */ + printk("twl5031: fsm detect: setting control to %lx\n", ctl); if (twl5031_bcc_write(TWL5031_BCC_CTRL2, ctl) < 0) goto out; @@ -353,7 +361,7 @@ static void twl5031_bcc_psy_usb_detect(struct twl5031_bcc_data *bcc) dev_dbg(bcc->dev, "Dedicated Charging Port\n"); break; default: - dev_dbg(bcc->dev, "UNKOWN port type, trying to connect\n"); + dev_dbg(bcc->dev, "UNKNOWN port type, trying to connect\n"); } } } |