diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-06-09 15:11:09 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-06-09 15:11:09 -0400 |
commit | a16afaf7928b74c30a4727cdcaa67bd10675a55d (patch) | |
tree | ab6c4835991ac397d3c6eb1934ec5ea94e2098c0 | |
parent | 2a70ea5cda00214a1d573acf19fa0cd06d947e38 (diff) | |
parent | c42812da1395bf57a6f7b5934b5339a3a42c2c7d (diff) |
Merge tag 'for-v4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply
Pull power supply and reset updates from Sebastian Reichel:
- bq27xxx: Add BQ27426 support
- ab8500: Drop AB8540/9540 support
- Introduced new usb_type property
- Properly document the power-supply ABI
- misc. cleanups and fixes
* tag 'for-v4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply:
MAINTAINERS: add entry for LEGO MINDSTORMS EV3
power: supply: ab8500_charger: fix spelling mistake: "faile" -> "failed"
power: supply: axp288_fuel_gauge: Remove polling from the driver
power: supply: axp288_fuelguage: Do not bind when the fg function is not used
power: supply: axp288_charger: Do not bind when the charge function is not used
power: supply: axp288_charger: Support 3500 and 4000 mA input current limit
power: supply: s3c-adc-battery: fix driver data initialization
power: supply: charger-manager: Verify polling interval only when polling requested
power: supply: sysfs: Use enum to specify property
power: supply: ab8500: Drop AB8540/9540 support
power: supply: ab8500_fg: fix spelling mistake: "Disharge" -> "Discharge"
power: supply: simplify getting .drvdata
power: supply: bq27xxx: Add support for BQ27426
gpio-poweroff: Use gpiod_set_value_cansleep
-rw-r--r-- | Documentation/devicetree/bindings/power/supply/bq27xxx.txt | 1 | ||||
-rw-r--r-- | MAINTAINERS | 7 | ||||
-rw-r--r-- | drivers/power/reset/gpio-poweroff.c | 4 | ||||
-rw-r--r-- | drivers/power/supply/ab8500_bmdata.c | 63 | ||||
-rw-r--r-- | drivers/power/supply/ab8500_btemp.c | 93 | ||||
-rw-r--r-- | drivers/power/supply/ab8500_charger.c | 133 | ||||
-rw-r--r-- | drivers/power/supply/ab8500_fg.c | 14 | ||||
-rw-r--r-- | drivers/power/supply/abx500_chargalg.c | 62 | ||||
-rw-r--r-- | drivers/power/supply/axp288_charger.c | 26 | ||||
-rw-r--r-- | drivers/power/supply/axp288_fuel_gauge.c | 27 | ||||
-rw-r--r-- | drivers/power/supply/bq27xxx_battery.c | 9 | ||||
-rw-r--r-- | drivers/power/supply/bq27xxx_battery_i2c.c | 2 | ||||
-rw-r--r-- | drivers/power/supply/charger-manager.c | 5 | ||||
-rw-r--r-- | drivers/power/supply/gpio-charger.c | 3 | ||||
-rw-r--r-- | drivers/power/supply/power_supply_sysfs.c | 86 | ||||
-rw-r--r-- | drivers/power/supply/s3c_adc_battery.c | 8 | ||||
-rw-r--r-- | include/linux/mfd/abx500.h | 1 | ||||
-rw-r--r-- | include/linux/mfd/abx500/ab8500-bm.h | 2 | ||||
-rw-r--r-- | include/linux/mfd/abx500/ux500_chargalg.h | 4 | ||||
-rw-r--r-- | include/linux/power/bq27xxx_battery.h | 3 |
20 files changed, 147 insertions, 406 deletions
diff --git a/Documentation/devicetree/bindings/power/supply/bq27xxx.txt b/Documentation/devicetree/bindings/power/supply/bq27xxx.txt index 615c1cb6889f..37994fdb18ca 100644 --- a/Documentation/devicetree/bindings/power/supply/bq27xxx.txt +++ b/Documentation/devicetree/bindings/power/supply/bq27xxx.txt | |||
@@ -25,6 +25,7 @@ Required properties: | |||
25 | * "ti,bq27545" - BQ27545 | 25 | * "ti,bq27545" - BQ27545 |
26 | * "ti,bq27421" - BQ27421 | 26 | * "ti,bq27421" - BQ27421 |
27 | * "ti,bq27425" - BQ27425 | 27 | * "ti,bq27425" - BQ27425 |
28 | * "ti,bq27426" - BQ27426 | ||
28 | * "ti,bq27441" - BQ27441 | 29 | * "ti,bq27441" - BQ27441 |
29 | * "ti,bq27621" - BQ27621 | 30 | * "ti,bq27621" - BQ27621 |
30 | - reg: integer, I2C address of the fuel gauge. | 31 | - reg: integer, I2C address of the fuel gauge. |
diff --git a/MAINTAINERS b/MAINTAINERS index 01a02c0aa562..3aa1f81922ff 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -8052,6 +8052,13 @@ S: Maintained | |||
8052 | F: Documentation/misc-devices/eeprom | 8052 | F: Documentation/misc-devices/eeprom |
8053 | F: drivers/misc/eeprom/eeprom.c | 8053 | F: drivers/misc/eeprom/eeprom.c |
8054 | 8054 | ||
8055 | LEGO MINDSTORMS EV3 | ||
8056 | R: David Lechner <david@lechnology.com> | ||
8057 | S: Maintained | ||
8058 | F: arch/arm/boot/dts/da850-lego-ev3.dts | ||
8059 | F: Documentation/devicetree/bindings/power/supply/lego_ev3_battery.txt | ||
8060 | F: drivers/power/supply/lego_ev3_battery.c | ||
8061 | |||
8055 | LEGO USB Tower driver | 8062 | LEGO USB Tower driver |
8056 | M: Juergen Stuber <starblue@users.sourceforge.net> | 8063 | M: Juergen Stuber <starblue@users.sourceforge.net> |
8057 | L: legousb-devel@lists.sourceforge.net | 8064 | L: legousb-devel@lists.sourceforge.net |
diff --git a/drivers/power/reset/gpio-poweroff.c b/drivers/power/reset/gpio-poweroff.c index 6273ad3b411d..38206c39b3bf 100644 --- a/drivers/power/reset/gpio-poweroff.c +++ b/drivers/power/reset/gpio-poweroff.c | |||
@@ -35,11 +35,11 @@ static void gpio_poweroff_do_poweroff(void) | |||
35 | gpiod_direction_output(reset_gpio, 1); | 35 | gpiod_direction_output(reset_gpio, 1); |
36 | mdelay(100); | 36 | mdelay(100); |
37 | /* drive inactive, also active->inactive edge */ | 37 | /* drive inactive, also active->inactive edge */ |
38 | gpiod_set_value(reset_gpio, 0); | 38 | gpiod_set_value_cansleep(reset_gpio, 0); |
39 | mdelay(100); | 39 | mdelay(100); |
40 | 40 | ||
41 | /* drive it active, also inactive->active edge */ | 41 | /* drive it active, also inactive->active edge */ |
42 | gpiod_set_value(reset_gpio, 1); | 42 | gpiod_set_value_cansleep(reset_gpio, 1); |
43 | 43 | ||
44 | /* give it some time */ | 44 | /* give it some time */ |
45 | mdelay(timeout); | 45 | mdelay(timeout); |
diff --git a/drivers/power/supply/ab8500_bmdata.c b/drivers/power/supply/ab8500_bmdata.c index 4a7ed50d1dc5..7b2b69916f48 100644 --- a/drivers/power/supply/ab8500_bmdata.c +++ b/drivers/power/supply/ab8500_bmdata.c | |||
@@ -430,13 +430,6 @@ static const struct abx500_maxim_parameters ab8500_maxi_params = { | |||
430 | .charger_curr_step = 100, | 430 | .charger_curr_step = 100, |
431 | }; | 431 | }; |
432 | 432 | ||
433 | static const struct abx500_maxim_parameters abx540_maxi_params = { | ||
434 | .ena_maxi = true, | ||
435 | .chg_curr = 3000, | ||
436 | .wait_cycles = 10, | ||
437 | .charger_curr_step = 200, | ||
438 | }; | ||
439 | |||
440 | static const struct abx500_bm_charger_parameters chg = { | 433 | static const struct abx500_bm_charger_parameters chg = { |
441 | .usb_volt_max = 5500, | 434 | .usb_volt_max = 5500, |
442 | .usb_curr_max = 1500, | 435 | .usb_curr_max = 1500, |
@@ -453,17 +446,6 @@ static int ab8500_charge_output_curr_map[] = { | |||
453 | 900, 1000, 1100, 1200, 1300, 1400, 1500, 1500, | 446 | 900, 1000, 1100, 1200, 1300, 1400, 1500, 1500, |
454 | }; | 447 | }; |
455 | 448 | ||
456 | static int ab8540_charge_output_curr_map[] = { | ||
457 | 0, 0, 0, 75, 100, 125, 150, 175, | ||
458 | 200, 225, 250, 275, 300, 325, 350, 375, | ||
459 | 400, 425, 450, 475, 500, 525, 550, 575, | ||
460 | 600, 625, 650, 675, 700, 725, 750, 775, | ||
461 | 800, 825, 850, 875, 900, 925, 950, 975, | ||
462 | 1000, 1025, 1050, 1075, 1100, 1125, 1150, 1175, | ||
463 | 1200, 1225, 1250, 1275, 1300, 1325, 1350, 1375, | ||
464 | 1400, 1425, 1450, 1500, 1600, 1700, 1900, 2000, | ||
465 | }; | ||
466 | |||
467 | /* | 449 | /* |
468 | * This array maps the raw hex value to charger input current used by the | 450 | * This array maps the raw hex value to charger input current used by the |
469 | * AB8500 values | 451 | * AB8500 values |
@@ -473,17 +455,6 @@ static int ab8500_charge_input_curr_map[] = { | |||
473 | 700, 800, 900, 1000, 1100, 1300, 1400, 1500, | 455 | 700, 800, 900, 1000, 1100, 1300, 1400, 1500, |
474 | }; | 456 | }; |
475 | 457 | ||
476 | static int ab8540_charge_input_curr_map[] = { | ||
477 | 25, 50, 75, 100, 125, 150, 175, 200, | ||
478 | 225, 250, 275, 300, 325, 350, 375, 400, | ||
479 | 425, 450, 475, 500, 525, 550, 575, 600, | ||
480 | 625, 650, 675, 700, 725, 750, 775, 800, | ||
481 | 825, 850, 875, 900, 925, 950, 975, 1000, | ||
482 | 1025, 1050, 1075, 1100, 1125, 1150, 1175, 1200, | ||
483 | 1225, 1250, 1275, 1300, 1325, 1350, 1375, 1400, | ||
484 | 1425, 1450, 1475, 1500, 1500, 1500, 1500, 1500, | ||
485 | }; | ||
486 | |||
487 | struct abx500_bm_data ab8500_bm_data = { | 458 | struct abx500_bm_data ab8500_bm_data = { |
488 | .temp_under = 3, | 459 | .temp_under = 3, |
489 | .temp_low = 8, | 460 | .temp_low = 8, |
@@ -518,40 +489,6 @@ struct abx500_bm_data ab8500_bm_data = { | |||
518 | .n_chg_in_curr = ARRAY_SIZE(ab8500_charge_input_curr_map), | 489 | .n_chg_in_curr = ARRAY_SIZE(ab8500_charge_input_curr_map), |
519 | }; | 490 | }; |
520 | 491 | ||
521 | struct abx500_bm_data ab8540_bm_data = { | ||
522 | .temp_under = 3, | ||
523 | .temp_low = 8, | ||
524 | .temp_high = 43, | ||
525 | .temp_over = 48, | ||
526 | .main_safety_tmr_h = 4, | ||
527 | .temp_interval_chg = 20, | ||
528 | .temp_interval_nochg = 120, | ||
529 | .usb_safety_tmr_h = 4, | ||
530 | .bkup_bat_v = BUP_VCH_SEL_2P6V, | ||
531 | .bkup_bat_i = BUP_ICH_SEL_150UA, | ||
532 | .no_maintenance = false, | ||
533 | .capacity_scaling = false, | ||
534 | .adc_therm = ABx500_ADC_THERM_BATCTRL, | ||
535 | .chg_unknown_bat = false, | ||
536 | .enable_overshoot = false, | ||
537 | .fg_res = 100, | ||
538 | .cap_levels = &cap_levels, | ||
539 | .bat_type = bat_type_thermistor, | ||
540 | .n_btypes = ARRAY_SIZE(bat_type_thermistor), | ||
541 | .batt_id = 0, | ||
542 | .interval_charging = 5, | ||
543 | .interval_not_charging = 120, | ||
544 | .temp_hysteresis = 3, | ||
545 | .gnd_lift_resistance = 0, | ||
546 | .maxi = &abx540_maxi_params, | ||
547 | .chg_params = &chg, | ||
548 | .fg_params = &fg, | ||
549 | .chg_output_curr = ab8540_charge_output_curr_map, | ||
550 | .n_chg_out_curr = ARRAY_SIZE(ab8540_charge_output_curr_map), | ||
551 | .chg_input_curr = ab8540_charge_input_curr_map, | ||
552 | .n_chg_in_curr = ARRAY_SIZE(ab8540_charge_input_curr_map), | ||
553 | }; | ||
554 | |||
555 | int ab8500_bm_of_probe(struct device *dev, | 492 | int ab8500_bm_of_probe(struct device *dev, |
556 | struct device_node *np, | 493 | struct device_node *np, |
557 | struct abx500_bm_data *bm) | 494 | struct abx500_bm_data *bm) |
diff --git a/drivers/power/supply/ab8500_btemp.c b/drivers/power/supply/ab8500_btemp.c index f7a35ebfbab2..708fd58cd62b 100644 --- a/drivers/power/supply/ab8500_btemp.c +++ b/drivers/power/supply/ab8500_btemp.c | |||
@@ -214,22 +214,10 @@ static int ab8500_btemp_curr_source_enable(struct ab8500_btemp *di, | |||
214 | /* Only do this for batteries with internal NTC */ | 214 | /* Only do this for batteries with internal NTC */ |
215 | if (di->bm->adc_therm == ABx500_ADC_THERM_BATCTRL && enable) { | 215 | if (di->bm->adc_therm == ABx500_ADC_THERM_BATCTRL && enable) { |
216 | 216 | ||
217 | if (is_ab8540(di->parent)) { | 217 | if (di->curr_source == BTEMP_BATCTRL_CURR_SRC_7UA) |
218 | if (di->curr_source == BTEMP_BATCTRL_CURR_SRC_60UA) | 218 | curr = BAT_CTRL_7U_ENA; |
219 | curr = BAT_CTRL_60U_ENA; | 219 | else |
220 | else | 220 | curr = BAT_CTRL_20U_ENA; |
221 | curr = BAT_CTRL_120U_ENA; | ||
222 | } else if (is_ab9540(di->parent) || is_ab8505(di->parent)) { | ||
223 | if (di->curr_source == BTEMP_BATCTRL_CURR_SRC_16UA) | ||
224 | curr = BAT_CTRL_16U_ENA; | ||
225 | else | ||
226 | curr = BAT_CTRL_18U_ENA; | ||
227 | } else { | ||
228 | if (di->curr_source == BTEMP_BATCTRL_CURR_SRC_7UA) | ||
229 | curr = BAT_CTRL_7U_ENA; | ||
230 | else | ||
231 | curr = BAT_CTRL_20U_ENA; | ||
232 | } | ||
233 | 221 | ||
234 | dev_dbg(di->dev, "Set BATCTRL %duA\n", di->curr_source); | 222 | dev_dbg(di->dev, "Set BATCTRL %duA\n", di->curr_source); |
235 | 223 | ||
@@ -260,28 +248,12 @@ static int ab8500_btemp_curr_source_enable(struct ab8500_btemp *di, | |||
260 | } else if (di->bm->adc_therm == ABx500_ADC_THERM_BATCTRL && !enable) { | 248 | } else if (di->bm->adc_therm == ABx500_ADC_THERM_BATCTRL && !enable) { |
261 | dev_dbg(di->dev, "Disable BATCTRL curr source\n"); | 249 | dev_dbg(di->dev, "Disable BATCTRL curr source\n"); |
262 | 250 | ||
263 | if (is_ab8540(di->parent)) { | 251 | /* Write 0 to the curr bits */ |
264 | /* Write 0 to the curr bits */ | 252 | ret = abx500_mask_and_set_register_interruptible( |
265 | ret = abx500_mask_and_set_register_interruptible( | 253 | di->dev, |
266 | di->dev, | 254 | AB8500_CHARGER, AB8500_BAT_CTRL_CURRENT_SOURCE, |
267 | AB8500_CHARGER, AB8500_BAT_CTRL_CURRENT_SOURCE, | 255 | BAT_CTRL_7U_ENA | BAT_CTRL_20U_ENA, |
268 | BAT_CTRL_60U_ENA | BAT_CTRL_120U_ENA, | 256 | ~(BAT_CTRL_7U_ENA | BAT_CTRL_20U_ENA)); |
269 | ~(BAT_CTRL_60U_ENA | BAT_CTRL_120U_ENA)); | ||
270 | } else if (is_ab9540(di->parent) || is_ab8505(di->parent)) { | ||
271 | /* Write 0 to the curr bits */ | ||
272 | ret = abx500_mask_and_set_register_interruptible( | ||
273 | di->dev, | ||
274 | AB8500_CHARGER, AB8500_BAT_CTRL_CURRENT_SOURCE, | ||
275 | BAT_CTRL_16U_ENA | BAT_CTRL_18U_ENA, | ||
276 | ~(BAT_CTRL_16U_ENA | BAT_CTRL_18U_ENA)); | ||
277 | } else { | ||
278 | /* Write 0 to the curr bits */ | ||
279 | ret = abx500_mask_and_set_register_interruptible( | ||
280 | di->dev, | ||
281 | AB8500_CHARGER, AB8500_BAT_CTRL_CURRENT_SOURCE, | ||
282 | BAT_CTRL_7U_ENA | BAT_CTRL_20U_ENA, | ||
283 | ~(BAT_CTRL_7U_ENA | BAT_CTRL_20U_ENA)); | ||
284 | } | ||
285 | 257 | ||
286 | if (ret) { | 258 | if (ret) { |
287 | dev_err(di->dev, "%s failed disabling current source\n", | 259 | dev_err(di->dev, "%s failed disabling current source\n", |
@@ -324,25 +296,11 @@ static int ab8500_btemp_curr_source_enable(struct ab8500_btemp *di, | |||
324 | * if we got an error above | 296 | * if we got an error above |
325 | */ | 297 | */ |
326 | disable_curr_source: | 298 | disable_curr_source: |
327 | if (is_ab8540(di->parent)) { | 299 | /* Write 0 to the curr bits */ |
328 | /* Write 0 to the curr bits */ | 300 | ret = abx500_mask_and_set_register_interruptible(di->dev, |
329 | ret = abx500_mask_and_set_register_interruptible(di->dev, | 301 | AB8500_CHARGER, AB8500_BAT_CTRL_CURRENT_SOURCE, |
330 | AB8500_CHARGER, AB8500_BAT_CTRL_CURRENT_SOURCE, | 302 | BAT_CTRL_7U_ENA | BAT_CTRL_20U_ENA, |
331 | BAT_CTRL_60U_ENA | BAT_CTRL_120U_ENA, | 303 | ~(BAT_CTRL_7U_ENA | BAT_CTRL_20U_ENA)); |
332 | ~(BAT_CTRL_60U_ENA | BAT_CTRL_120U_ENA)); | ||
333 | } else if (is_ab9540(di->parent) || is_ab8505(di->parent)) { | ||
334 | /* Write 0 to the curr bits */ | ||
335 | ret = abx500_mask_and_set_register_interruptible(di->dev, | ||
336 | AB8500_CHARGER, AB8500_BAT_CTRL_CURRENT_SOURCE, | ||
337 | BAT_CTRL_16U_ENA | BAT_CTRL_18U_ENA, | ||
338 | ~(BAT_CTRL_16U_ENA | BAT_CTRL_18U_ENA)); | ||
339 | } else { | ||
340 | /* Write 0 to the curr bits */ | ||
341 | ret = abx500_mask_and_set_register_interruptible(di->dev, | ||
342 | AB8500_CHARGER, AB8500_BAT_CTRL_CURRENT_SOURCE, | ||
343 | BAT_CTRL_7U_ENA | BAT_CTRL_20U_ENA, | ||
344 | ~(BAT_CTRL_7U_ENA | BAT_CTRL_20U_ENA)); | ||
345 | } | ||
346 | 304 | ||
347 | if (ret) { | 305 | if (ret) { |
348 | dev_err(di->dev, "%s failed disabling current source\n", | 306 | dev_err(di->dev, "%s failed disabling current source\n", |
@@ -556,13 +514,8 @@ static int ab8500_btemp_id(struct ab8500_btemp *di) | |||
556 | { | 514 | { |
557 | int res; | 515 | int res; |
558 | u8 i; | 516 | u8 i; |
559 | if (is_ab8540(di->parent)) | ||
560 | di->curr_source = BTEMP_BATCTRL_CURR_SRC_60UA; | ||
561 | else if (is_ab9540(di->parent) || is_ab8505(di->parent)) | ||
562 | di->curr_source = BTEMP_BATCTRL_CURR_SRC_16UA; | ||
563 | else | ||
564 | di->curr_source = BTEMP_BATCTRL_CURR_SRC_7UA; | ||
565 | 517 | ||
518 | di->curr_source = BTEMP_BATCTRL_CURR_SRC_7UA; | ||
566 | di->bm->batt_id = BATTERY_UNKNOWN; | 519 | di->bm->batt_id = BATTERY_UNKNOWN; |
567 | 520 | ||
568 | res = ab8500_btemp_get_batctrl_res(di); | 521 | res = ab8500_btemp_get_batctrl_res(di); |
@@ -600,18 +553,8 @@ static int ab8500_btemp_id(struct ab8500_btemp *di) | |||
600 | */ | 553 | */ |
601 | if (di->bm->adc_therm == ABx500_ADC_THERM_BATCTRL && | 554 | if (di->bm->adc_therm == ABx500_ADC_THERM_BATCTRL && |
602 | di->bm->batt_id == 1) { | 555 | di->bm->batt_id == 1) { |
603 | if (is_ab8540(di->parent)) { | 556 | dev_dbg(di->dev, "Set BATCTRL current source to 20uA\n"); |
604 | dev_dbg(di->dev, | 557 | di->curr_source = BTEMP_BATCTRL_CURR_SRC_20UA; |
605 | "Set BATCTRL current source to 60uA\n"); | ||
606 | di->curr_source = BTEMP_BATCTRL_CURR_SRC_60UA; | ||
607 | } else if (is_ab9540(di->parent) || is_ab8505(di->parent)) { | ||
608 | dev_dbg(di->dev, | ||
609 | "Set BATCTRL current source to 16uA\n"); | ||
610 | di->curr_source = BTEMP_BATCTRL_CURR_SRC_16UA; | ||
611 | } else { | ||
612 | dev_dbg(di->dev, "Set BATCTRL current source to 20uA\n"); | ||
613 | di->curr_source = BTEMP_BATCTRL_CURR_SRC_20UA; | ||
614 | } | ||
615 | } | 558 | } |
616 | 559 | ||
617 | return di->bm->batt_id; | 560 | return di->bm->batt_id; |
diff --git a/drivers/power/supply/ab8500_charger.c b/drivers/power/supply/ab8500_charger.c index 5a76c6d343de..98b335042ba6 100644 --- a/drivers/power/supply/ab8500_charger.c +++ b/drivers/power/supply/ab8500_charger.c | |||
@@ -58,9 +58,7 @@ | |||
58 | 58 | ||
59 | #define MAIN_CH_INPUT_CURR_SHIFT 4 | 59 | #define MAIN_CH_INPUT_CURR_SHIFT 4 |
60 | #define VBUS_IN_CURR_LIM_SHIFT 4 | 60 | #define VBUS_IN_CURR_LIM_SHIFT 4 |
61 | #define AB8540_VBUS_IN_CURR_LIM_SHIFT 2 | ||
62 | #define AUTO_VBUS_IN_CURR_LIM_SHIFT 4 | 61 | #define AUTO_VBUS_IN_CURR_LIM_SHIFT 4 |
63 | #define AB8540_AUTO_VBUS_IN_CURR_MASK 0x3F | ||
64 | #define VBUS_IN_CURR_LIM_RETRY_SET_TIME 30 /* seconds */ | 62 | #define VBUS_IN_CURR_LIM_RETRY_SET_TIME 30 /* seconds */ |
65 | 63 | ||
66 | #define LED_INDICATOR_PWM_ENA 0x01 | 64 | #define LED_INDICATOR_PWM_ENA 0x01 |
@@ -1138,10 +1136,7 @@ static int ab8500_charger_set_current(struct ab8500_charger *di, | |||
1138 | no_stepping = true; | 1136 | no_stepping = true; |
1139 | break; | 1137 | break; |
1140 | case AB8500_USBCH_IPT_CRNTLVL_REG: | 1138 | case AB8500_USBCH_IPT_CRNTLVL_REG: |
1141 | if (is_ab8540(di->parent)) | 1139 | shift_value = VBUS_IN_CURR_LIM_SHIFT; |
1142 | shift_value = AB8540_VBUS_IN_CURR_LIM_SHIFT; | ||
1143 | else | ||
1144 | shift_value = VBUS_IN_CURR_LIM_SHIFT; | ||
1145 | prev_curr_index = (reg_value >> shift_value); | 1140 | prev_curr_index = (reg_value >> shift_value); |
1146 | curr_index = ab8500_vbus_in_curr_to_regval(di, ich); | 1141 | curr_index = ab8500_vbus_in_curr_to_regval(di, ich); |
1147 | step_udelay = STEP_UDELAY * 100; | 1142 | step_udelay = STEP_UDELAY * 100; |
@@ -1865,67 +1860,6 @@ static int ab8500_charger_update_charger_current(struct ux500_charger *charger, | |||
1865 | return ret; | 1860 | return ret; |
1866 | } | 1861 | } |
1867 | 1862 | ||
1868 | /** | ||
1869 | * ab8540_charger_power_path_enable() - enable usb power path mode | ||
1870 | * @charger: pointer to the ux500_charger structure | ||
1871 | * @enable: enable/disable flag | ||
1872 | * | ||
1873 | * Enable or disable the power path for usb mode | ||
1874 | * Returns error code in case of failure else 0(on success) | ||
1875 | */ | ||
1876 | static int ab8540_charger_power_path_enable(struct ux500_charger *charger, | ||
1877 | bool enable) | ||
1878 | { | ||
1879 | int ret; | ||
1880 | struct ab8500_charger *di; | ||
1881 | |||
1882 | if (charger->psy->desc->type == POWER_SUPPLY_TYPE_USB) | ||
1883 | di = to_ab8500_charger_usb_device_info(charger); | ||
1884 | else | ||
1885 | return -ENXIO; | ||
1886 | |||
1887 | ret = abx500_mask_and_set_register_interruptible(di->dev, | ||
1888 | AB8500_CHARGER, AB8540_USB_PP_MODE_REG, | ||
1889 | BUS_POWER_PATH_MODE_ENA, enable); | ||
1890 | if (ret) { | ||
1891 | dev_err(di->dev, "%s write failed\n", __func__); | ||
1892 | return ret; | ||
1893 | } | ||
1894 | |||
1895 | return ret; | ||
1896 | } | ||
1897 | |||
1898 | |||
1899 | /** | ||
1900 | * ab8540_charger_usb_pre_chg_enable() - enable usb pre change | ||
1901 | * @charger: pointer to the ux500_charger structure | ||
1902 | * @enable: enable/disable flag | ||
1903 | * | ||
1904 | * Enable or disable the pre-chage for usb mode | ||
1905 | * Returns error code in case of failure else 0(on success) | ||
1906 | */ | ||
1907 | static int ab8540_charger_usb_pre_chg_enable(struct ux500_charger *charger, | ||
1908 | bool enable) | ||
1909 | { | ||
1910 | int ret; | ||
1911 | struct ab8500_charger *di; | ||
1912 | |||
1913 | if (charger->psy->desc->type == POWER_SUPPLY_TYPE_USB) | ||
1914 | di = to_ab8500_charger_usb_device_info(charger); | ||
1915 | else | ||
1916 | return -ENXIO; | ||
1917 | |||
1918 | ret = abx500_mask_and_set_register_interruptible(di->dev, | ||
1919 | AB8500_CHARGER, AB8540_USB_PP_CHR_REG, | ||
1920 | BUS_POWER_PATH_PRECHG_ENA, enable); | ||
1921 | if (ret) { | ||
1922 | dev_err(di->dev, "%s write failed\n", __func__); | ||
1923 | return ret; | ||
1924 | } | ||
1925 | |||
1926 | return ret; | ||
1927 | } | ||
1928 | |||
1929 | static int ab8500_charger_get_ext_psy_data(struct device *dev, void *data) | 1863 | static int ab8500_charger_get_ext_psy_data(struct device *dev, void *data) |
1930 | { | 1864 | { |
1931 | struct power_supply *psy; | 1865 | struct power_supply *psy; |
@@ -2704,23 +2638,15 @@ static void ab8500_charger_vbus_drop_end_work(struct work_struct *work) | |||
2704 | abx500_set_register_interruptible(di->dev, | 2638 | abx500_set_register_interruptible(di->dev, |
2705 | AB8500_CHARGER, AB8500_CHARGER_CTRL, 0x01); | 2639 | AB8500_CHARGER, AB8500_CHARGER_CTRL, 0x01); |
2706 | 2640 | ||
2707 | if (is_ab8540(di->parent)) | 2641 | ret = abx500_get_register_interruptible(di->dev, AB8500_CHARGER, |
2708 | ret = abx500_get_register_interruptible(di->dev, AB8500_CHARGER, | 2642 | AB8500_CH_USBCH_STAT2_REG, ®_value); |
2709 | AB8540_CH_USBCH_STAT3_REG, ®_value); | ||
2710 | else | ||
2711 | ret = abx500_get_register_interruptible(di->dev, AB8500_CHARGER, | ||
2712 | AB8500_CH_USBCH_STAT2_REG, ®_value); | ||
2713 | if (ret < 0) { | 2643 | if (ret < 0) { |
2714 | dev_err(di->dev, "%s read failed\n", __func__); | 2644 | dev_err(di->dev, "%s read failed\n", __func__); |
2715 | return; | 2645 | return; |
2716 | } | 2646 | } |
2717 | 2647 | ||
2718 | if (is_ab8540(di->parent)) | 2648 | curr = di->bm->chg_input_curr[ |
2719 | curr = di->bm->chg_input_curr[ | 2649 | reg_value >> AUTO_VBUS_IN_CURR_LIM_SHIFT]; |
2720 | reg_value & AB8540_AUTO_VBUS_IN_CURR_MASK]; | ||
2721 | else | ||
2722 | curr = di->bm->chg_input_curr[ | ||
2723 | reg_value >> AUTO_VBUS_IN_CURR_LIM_SHIFT]; | ||
2724 | 2650 | ||
2725 | if (di->max_usb_in_curr.calculated_max != curr) { | 2651 | if (di->max_usb_in_curr.calculated_max != curr) { |
2726 | /* USB source is collapsing */ | 2652 | /* USB source is collapsing */ |
@@ -3097,14 +3023,9 @@ static int ab8500_charger_init_hw_registers(struct ab8500_charger *di) | |||
3097 | goto out; | 3023 | goto out; |
3098 | } | 3024 | } |
3099 | 3025 | ||
3100 | if (is_ab8540(di->parent)) | 3026 | ret = abx500_set_register_interruptible(di->dev, |
3101 | ret = abx500_set_register_interruptible(di->dev, | 3027 | AB8500_CHARGER, AB8500_CH_OPT_CRNTLVL_MAX_REG, |
3102 | AB8500_CHARGER, AB8500_CH_OPT_CRNTLVL_MAX_REG, | 3028 | CH_OP_CUR_LVL_1P6); |
3103 | CH_OP_CUR_LVL_2P); | ||
3104 | else | ||
3105 | ret = abx500_set_register_interruptible(di->dev, | ||
3106 | AB8500_CHARGER, AB8500_CH_OPT_CRNTLVL_MAX_REG, | ||
3107 | CH_OP_CUR_LVL_1P6); | ||
3108 | if (ret) { | 3029 | if (ret) { |
3109 | dev_err(di->dev, | 3030 | dev_err(di->dev, |
3110 | "failed to set CH_OPT_CRNTLVL_MAX_REG\n"); | 3031 | "failed to set CH_OPT_CRNTLVL_MAX_REG\n"); |
@@ -3112,8 +3033,7 @@ static int ab8500_charger_init_hw_registers(struct ab8500_charger *di) | |||
3112 | } | 3033 | } |
3113 | } | 3034 | } |
3114 | 3035 | ||
3115 | if (is_ab9540_2p0(di->parent) || is_ab9540_3p0(di->parent) | 3036 | if (is_ab8505_2p0(di->parent)) |
3116 | || is_ab8505_2p0(di->parent) || is_ab8540(di->parent)) | ||
3117 | ret = abx500_mask_and_set_register_interruptible(di->dev, | 3037 | ret = abx500_mask_and_set_register_interruptible(di->dev, |
3118 | AB8500_CHARGER, | 3038 | AB8500_CHARGER, |
3119 | AB8500_USBCH_CTRL2_REG, | 3039 | AB8500_USBCH_CTRL2_REG, |
@@ -3146,7 +3066,7 @@ static int ab8500_charger_init_hw_registers(struct ab8500_charger *di) | |||
3146 | AB8500_SYS_CTRL2_BLOCK, | 3066 | AB8500_SYS_CTRL2_BLOCK, |
3147 | AB8500_MAIN_WDOG_CTRL_REG, MAIN_WDOG_ENA); | 3067 | AB8500_MAIN_WDOG_CTRL_REG, MAIN_WDOG_ENA); |
3148 | if (ret) { | 3068 | if (ret) { |
3149 | dev_err(di->dev, "faile to enable main watchdog\n"); | 3069 | dev_err(di->dev, "failed to enable main watchdog\n"); |
3150 | goto out; | 3070 | goto out; |
3151 | } | 3071 | } |
3152 | 3072 | ||
@@ -3205,17 +3125,6 @@ static int ab8500_charger_init_hw_registers(struct ab8500_charger *di) | |||
3205 | dev_err(di->dev, "failed to setup backup battery charging\n"); | 3125 | dev_err(di->dev, "failed to setup backup battery charging\n"); |
3206 | goto out; | 3126 | goto out; |
3207 | } | 3127 | } |
3208 | if (is_ab8540(di->parent)) { | ||
3209 | ret = abx500_set_register_interruptible(di->dev, | ||
3210 | AB8500_RTC, | ||
3211 | AB8500_RTC_CTRL1_REG, | ||
3212 | bup_vch_range | vbup33_vrtcn); | ||
3213 | if (ret) { | ||
3214 | dev_err(di->dev, | ||
3215 | "failed to setup backup battery charging\n"); | ||
3216 | goto out; | ||
3217 | } | ||
3218 | } | ||
3219 | 3128 | ||
3220 | /* Enable backup battery charging */ | 3129 | /* Enable backup battery charging */ |
3221 | ret = abx500_mask_and_set_register_interruptible(di->dev, | 3130 | ret = abx500_mask_and_set_register_interruptible(di->dev, |
@@ -3226,25 +3135,6 @@ static int ab8500_charger_init_hw_registers(struct ab8500_charger *di) | |||
3226 | goto out; | 3135 | goto out; |
3227 | } | 3136 | } |
3228 | 3137 | ||
3229 | if (is_ab8540(di->parent)) { | ||
3230 | ret = abx500_mask_and_set_register_interruptible(di->dev, | ||
3231 | AB8500_CHARGER, AB8540_USB_PP_MODE_REG, | ||
3232 | BUS_VSYS_VOL_SELECT_MASK, BUS_VSYS_VOL_SELECT_3P6V); | ||
3233 | if (ret) { | ||
3234 | dev_err(di->dev, | ||
3235 | "failed to setup usb power path vsys voltage\n"); | ||
3236 | goto out; | ||
3237 | } | ||
3238 | ret = abx500_mask_and_set_register_interruptible(di->dev, | ||
3239 | AB8500_CHARGER, AB8540_USB_PP_CHR_REG, | ||
3240 | BUS_PP_PRECHG_CURRENT_MASK, 0); | ||
3241 | if (ret) { | ||
3242 | dev_err(di->dev, | ||
3243 | "failed to setup usb power path precharge current\n"); | ||
3244 | goto out; | ||
3245 | } | ||
3246 | } | ||
3247 | |||
3248 | out: | 3138 | out: |
3249 | return ret; | 3139 | return ret; |
3250 | } | 3140 | } |
@@ -3529,8 +3419,6 @@ static int ab8500_charger_probe(struct platform_device *pdev) | |||
3529 | di->usb_chg.ops.check_enable = &ab8500_charger_usb_check_enable; | 3419 | di->usb_chg.ops.check_enable = &ab8500_charger_usb_check_enable; |
3530 | di->usb_chg.ops.kick_wd = &ab8500_charger_watchdog_kick; | 3420 | di->usb_chg.ops.kick_wd = &ab8500_charger_watchdog_kick; |
3531 | di->usb_chg.ops.update_curr = &ab8500_charger_update_charger_current; | 3421 | di->usb_chg.ops.update_curr = &ab8500_charger_update_charger_current; |
3532 | di->usb_chg.ops.pp_enable = &ab8540_charger_power_path_enable; | ||
3533 | di->usb_chg.ops.pre_chg_enable = &ab8540_charger_usb_pre_chg_enable; | ||
3534 | di->usb_chg.max_out_volt = ab8500_charger_voltage_map[ | 3422 | di->usb_chg.max_out_volt = ab8500_charger_voltage_map[ |
3535 | ARRAY_SIZE(ab8500_charger_voltage_map) - 1]; | 3423 | ARRAY_SIZE(ab8500_charger_voltage_map) - 1]; |
3536 | di->usb_chg.max_out_curr = | 3424 | di->usb_chg.max_out_curr = |
@@ -3538,7 +3426,6 @@ static int ab8500_charger_probe(struct platform_device *pdev) | |||
3538 | di->usb_chg.wdt_refresh = CHG_WD_INTERVAL; | 3426 | di->usb_chg.wdt_refresh = CHG_WD_INTERVAL; |
3539 | di->usb_chg.enabled = di->bm->usb_enabled; | 3427 | di->usb_chg.enabled = di->bm->usb_enabled; |
3540 | di->usb_chg.external = false; | 3428 | di->usb_chg.external = false; |
3541 | di->usb_chg.power_path = di->bm->usb_power_path; | ||
3542 | di->usb_state.usb_current = -1; | 3429 | di->usb_state.usb_current = -1; |
3543 | 3430 | ||
3544 | /* Create a work queue for the charger */ | 3431 | /* Create a work queue for the charger */ |
diff --git a/drivers/power/supply/ab8500_fg.c b/drivers/power/supply/ab8500_fg.c index c569f82a0071..d9c6c7bedd85 100644 --- a/drivers/power/supply/ab8500_fg.c +++ b/drivers/power/supply/ab8500_fg.c | |||
@@ -1408,7 +1408,7 @@ static void ab8500_fg_charge_state_to(struct ab8500_fg *di, | |||
1408 | static void ab8500_fg_discharge_state_to(struct ab8500_fg *di, | 1408 | static void ab8500_fg_discharge_state_to(struct ab8500_fg *di, |
1409 | enum ab8500_fg_discharge_state new_state) | 1409 | enum ab8500_fg_discharge_state new_state) |
1410 | { | 1410 | { |
1411 | dev_dbg(di->dev, "Disharge state from %d [%s] to %d [%s]\n", | 1411 | dev_dbg(di->dev, "Discharge state from %d [%s] to %d [%s]\n", |
1412 | di->discharge_state, | 1412 | di->discharge_state, |
1413 | discharge_state[di->discharge_state], | 1413 | discharge_state[di->discharge_state], |
1414 | new_state, | 1414 | new_state, |
@@ -2326,9 +2326,7 @@ static int ab8500_fg_init_hw_registers(struct ab8500_fg *di) | |||
2326 | goto out; | 2326 | goto out; |
2327 | } | 2327 | } |
2328 | 2328 | ||
2329 | if (((is_ab8505(di->parent) || is_ab9540(di->parent)) && | 2329 | if (is_ab8505(di->parent)) { |
2330 | abx500_get_chip_id(di->dev) >= AB8500_CUT2P0) | ||
2331 | || is_ab8540(di->parent)) { | ||
2332 | ret = abx500_set_register_interruptible(di->dev, AB8500_RTC, | 2330 | ret = abx500_set_register_interruptible(di->dev, AB8500_RTC, |
2333 | AB8505_RTC_PCUT_MAX_TIME_REG, di->bm->fg_params->pcut_max_time); | 2331 | AB8505_RTC_PCUT_MAX_TIME_REG, di->bm->fg_params->pcut_max_time); |
2334 | 2332 | ||
@@ -2915,9 +2913,7 @@ static int ab8500_fg_sysfs_psy_create_attrs(struct ab8500_fg *di) | |||
2915 | { | 2913 | { |
2916 | unsigned int i; | 2914 | unsigned int i; |
2917 | 2915 | ||
2918 | if (((is_ab8505(di->parent) || is_ab9540(di->parent)) && | 2916 | if (is_ab8505(di->parent)) { |
2919 | abx500_get_chip_id(di->dev) >= AB8500_CUT2P0) | ||
2920 | || is_ab8540(di->parent)) { | ||
2921 | for (i = 0; i < ARRAY_SIZE(ab8505_fg_sysfs_psy_attrs); i++) | 2917 | for (i = 0; i < ARRAY_SIZE(ab8505_fg_sysfs_psy_attrs); i++) |
2922 | if (device_create_file(&di->fg_psy->dev, | 2918 | if (device_create_file(&di->fg_psy->dev, |
2923 | &ab8505_fg_sysfs_psy_attrs[i])) | 2919 | &ab8505_fg_sysfs_psy_attrs[i])) |
@@ -2937,9 +2933,7 @@ static void ab8500_fg_sysfs_psy_remove_attrs(struct ab8500_fg *di) | |||
2937 | { | 2933 | { |
2938 | unsigned int i; | 2934 | unsigned int i; |
2939 | 2935 | ||
2940 | if (((is_ab8505(di->parent) || is_ab9540(di->parent)) && | 2936 | if (is_ab8505(di->parent)) { |
2941 | abx500_get_chip_id(di->dev) >= AB8500_CUT2P0) | ||
2942 | || is_ab8540(di->parent)) { | ||
2943 | for (i = 0; i < ARRAY_SIZE(ab8505_fg_sysfs_psy_attrs); i++) | 2937 | for (i = 0; i < ARRAY_SIZE(ab8505_fg_sysfs_psy_attrs); i++) |
2944 | (void)device_remove_file(&di->fg_psy->dev, | 2938 | (void)device_remove_file(&di->fg_psy->dev, |
2945 | &ab8505_fg_sysfs_psy_attrs[i]); | 2939 | &ab8505_fg_sysfs_psy_attrs[i]); |
diff --git a/drivers/power/supply/abx500_chargalg.c b/drivers/power/supply/abx500_chargalg.c index a4411d6bbc96..947709cdd14e 100644 --- a/drivers/power/supply/abx500_chargalg.c +++ b/drivers/power/supply/abx500_chargalg.c | |||
@@ -44,9 +44,6 @@ | |||
44 | /* Five minutes expressed in seconds */ | 44 | /* Five minutes expressed in seconds */ |
45 | #define FIVE_MINUTES_IN_SECONDS 300 | 45 | #define FIVE_MINUTES_IN_SECONDS 300 |
46 | 46 | ||
47 | /* Plus margin for the low battery threshold */ | ||
48 | #define BAT_PLUS_MARGIN (100) | ||
49 | |||
50 | #define CHARGALG_CURR_STEP_LOW 0 | 47 | #define CHARGALG_CURR_STEP_LOW 0 |
51 | #define CHARGALG_CURR_STEP_HIGH 100 | 48 | #define CHARGALG_CURR_STEP_HIGH 100 |
52 | 49 | ||
@@ -101,7 +98,6 @@ enum abx500_chargalg_states { | |||
101 | STATE_HW_TEMP_PROTECT_INIT, | 98 | STATE_HW_TEMP_PROTECT_INIT, |
102 | STATE_HW_TEMP_PROTECT, | 99 | STATE_HW_TEMP_PROTECT, |
103 | STATE_NORMAL_INIT, | 100 | STATE_NORMAL_INIT, |
104 | STATE_USB_PP_PRE_CHARGE, | ||
105 | STATE_NORMAL, | 101 | STATE_NORMAL, |
106 | STATE_WAIT_FOR_RECHARGE_INIT, | 102 | STATE_WAIT_FOR_RECHARGE_INIT, |
107 | STATE_WAIT_FOR_RECHARGE, | 103 | STATE_WAIT_FOR_RECHARGE, |
@@ -133,7 +129,6 @@ static const char *states[] = { | |||
133 | "HW_TEMP_PROTECT_INIT", | 129 | "HW_TEMP_PROTECT_INIT", |
134 | "HW_TEMP_PROTECT", | 130 | "HW_TEMP_PROTECT", |
135 | "NORMAL_INIT", | 131 | "NORMAL_INIT", |
136 | "USB_PP_PRE_CHARGE", | ||
137 | "NORMAL", | 132 | "NORMAL", |
138 | "WAIT_FOR_RECHARGE_INIT", | 133 | "WAIT_FOR_RECHARGE_INIT", |
139 | "WAIT_FOR_RECHARGE", | 134 | "WAIT_FOR_RECHARGE", |
@@ -603,37 +598,6 @@ static int abx500_chargalg_usb_en(struct abx500_chargalg *di, int enable, | |||
603 | return di->usb_chg->ops.enable(di->usb_chg, enable, vset, iset); | 598 | return di->usb_chg->ops.enable(di->usb_chg, enable, vset, iset); |
604 | } | 599 | } |
605 | 600 | ||
606 | /** | ||
607 | * ab8540_chargalg_usb_pp_en() - Enable/ disable USB power path | ||
608 | * @di: pointer to the abx500_chargalg structure | ||
609 | * @enable: power path enable/disable | ||
610 | * | ||
611 | * The USB power path will be enable/ disable | ||
612 | */ | ||
613 | static int ab8540_chargalg_usb_pp_en(struct abx500_chargalg *di, bool enable) | ||
614 | { | ||
615 | if (!di->usb_chg || !di->usb_chg->ops.pp_enable) | ||
616 | return -ENXIO; | ||
617 | |||
618 | return di->usb_chg->ops.pp_enable(di->usb_chg, enable); | ||
619 | } | ||
620 | |||
621 | /** | ||
622 | * ab8540_chargalg_usb_pre_chg_en() - Enable/ disable USB pre-charge | ||
623 | * @di: pointer to the abx500_chargalg structure | ||
624 | * @enable: USB pre-charge enable/disable | ||
625 | * | ||
626 | * The USB USB pre-charge will be enable/ disable | ||
627 | */ | ||
628 | static int ab8540_chargalg_usb_pre_chg_en(struct abx500_chargalg *di, | ||
629 | bool enable) | ||
630 | { | ||
631 | if (!di->usb_chg || !di->usb_chg->ops.pre_chg_enable) | ||
632 | return -ENXIO; | ||
633 | |||
634 | return di->usb_chg->ops.pre_chg_enable(di->usb_chg, enable); | ||
635 | } | ||
636 | |||
637 | /** | 601 | /** |
638 | * abx500_chargalg_update_chg_curr() - Update charger current | 602 | * abx500_chargalg_update_chg_curr() - Update charger current |
639 | * @di: pointer to the abx500_chargalg structure | 603 | * @di: pointer to the abx500_chargalg structure |
@@ -833,9 +797,6 @@ static void abx500_chargalg_end_of_charge(struct abx500_chargalg *di) | |||
833 | di->batt_data.avg_curr > 0) { | 797 | di->batt_data.avg_curr > 0) { |
834 | if (++di->eoc_cnt >= EOC_COND_CNT) { | 798 | if (++di->eoc_cnt >= EOC_COND_CNT) { |
835 | di->eoc_cnt = 0; | 799 | di->eoc_cnt = 0; |
836 | if ((di->chg_info.charger_type & USB_CHG) && | ||
837 | (di->usb_chg->power_path)) | ||
838 | ab8540_chargalg_usb_pp_en(di, true); | ||
839 | di->charge_status = POWER_SUPPLY_STATUS_FULL; | 800 | di->charge_status = POWER_SUPPLY_STATUS_FULL; |
840 | di->maintenance_chg = true; | 801 | di->maintenance_chg = true; |
841 | dev_dbg(di->dev, "EOC reached!\n"); | 802 | dev_dbg(di->dev, "EOC reached!\n"); |
@@ -1536,22 +1497,6 @@ static void abx500_chargalg_algorithm(struct abx500_chargalg *di) | |||
1536 | break; | 1497 | break; |
1537 | 1498 | ||
1538 | case STATE_NORMAL_INIT: | 1499 | case STATE_NORMAL_INIT: |
1539 | if ((di->chg_info.charger_type & USB_CHG) && | ||
1540 | di->usb_chg->power_path) { | ||
1541 | if (di->batt_data.volt > | ||
1542 | (di->bm->fg_params->lowbat_threshold + | ||
1543 | BAT_PLUS_MARGIN)) { | ||
1544 | ab8540_chargalg_usb_pre_chg_en(di, false); | ||
1545 | ab8540_chargalg_usb_pp_en(di, false); | ||
1546 | } else { | ||
1547 | ab8540_chargalg_usb_pp_en(di, true); | ||
1548 | ab8540_chargalg_usb_pre_chg_en(di, true); | ||
1549 | abx500_chargalg_state_to(di, | ||
1550 | STATE_USB_PP_PRE_CHARGE); | ||
1551 | break; | ||
1552 | } | ||
1553 | } | ||
1554 | |||
1555 | if (di->curr_status.curr_step == CHARGALG_CURR_STEP_LOW) | 1500 | if (di->curr_status.curr_step == CHARGALG_CURR_STEP_LOW) |
1556 | abx500_chargalg_stop_charging(di); | 1501 | abx500_chargalg_stop_charging(di); |
1557 | else { | 1502 | else { |
@@ -1575,13 +1520,6 @@ static void abx500_chargalg_algorithm(struct abx500_chargalg *di) | |||
1575 | 1520 | ||
1576 | break; | 1521 | break; |
1577 | 1522 | ||
1578 | case STATE_USB_PP_PRE_CHARGE: | ||
1579 | if (di->batt_data.volt > | ||
1580 | (di->bm->fg_params->lowbat_threshold + | ||
1581 | BAT_PLUS_MARGIN)) | ||
1582 | abx500_chargalg_state_to(di, STATE_NORMAL_INIT); | ||
1583 | break; | ||
1584 | |||
1585 | case STATE_NORMAL: | 1523 | case STATE_NORMAL: |
1586 | handle_maxim_chg_curr(di); | 1524 | handle_maxim_chg_curr(di); |
1587 | if (di->charge_status == POWER_SUPPLY_STATUS_FULL && | 1525 | if (di->charge_status == POWER_SUPPLY_STATUS_FULL && |
diff --git a/drivers/power/supply/axp288_charger.c b/drivers/power/supply/axp288_charger.c index 9bfbde15b07d..6e1bc14c3304 100644 --- a/drivers/power/supply/axp288_charger.c +++ b/drivers/power/supply/axp288_charger.c | |||
@@ -88,6 +88,8 @@ | |||
88 | #define CHRG_VBUS_ILIM_2000MA 0x4 /* 2000mA */ | 88 | #define CHRG_VBUS_ILIM_2000MA 0x4 /* 2000mA */ |
89 | #define CHRG_VBUS_ILIM_2500MA 0x5 /* 2500mA */ | 89 | #define CHRG_VBUS_ILIM_2500MA 0x5 /* 2500mA */ |
90 | #define CHRG_VBUS_ILIM_3000MA 0x6 /* 3000mA */ | 90 | #define CHRG_VBUS_ILIM_3000MA 0x6 /* 3000mA */ |
91 | #define CHRG_VBUS_ILIM_3500MA 0x7 /* 3500mA */ | ||
92 | #define CHRG_VBUS_ILIM_4000MA 0x8 /* 4000mA */ | ||
91 | 93 | ||
92 | #define CHRG_VLTFC_0C 0xA5 /* 0 DegC */ | 94 | #define CHRG_VLTFC_0C 0xA5 /* 0 DegC */ |
93 | #define CHRG_VHTFC_45C 0x1F /* 45 DegC */ | 95 | #define CHRG_VHTFC_45C 0x1F /* 45 DegC */ |
@@ -223,9 +225,11 @@ static int axp288_charger_get_vbus_inlmt(struct axp288_chrg_info *info) | |||
223 | return 2500000; | 225 | return 2500000; |
224 | case CHRG_VBUS_ILIM_3000MA: | 226 | case CHRG_VBUS_ILIM_3000MA: |
225 | return 3000000; | 227 | return 3000000; |
228 | case CHRG_VBUS_ILIM_3500MA: | ||
229 | return 3500000; | ||
226 | default: | 230 | default: |
227 | dev_warn(&info->pdev->dev, "Unknown ilim reg val: %d\n", val); | 231 | /* All b1xxx values map to 4000 mA */ |
228 | return 0; | 232 | return 4000000; |
229 | } | 233 | } |
230 | } | 234 | } |
231 | 235 | ||
@@ -235,7 +239,11 @@ static inline int axp288_charger_set_vbus_inlmt(struct axp288_chrg_info *info, | |||
235 | int ret; | 239 | int ret; |
236 | u8 reg_val; | 240 | u8 reg_val; |
237 | 241 | ||
238 | if (inlmt >= 3000000) | 242 | if (inlmt >= 4000000) |
243 | reg_val = CHRG_VBUS_ILIM_4000MA << CHRG_VBUS_ILIM_BIT_POS; | ||
244 | else if (inlmt >= 3500000) | ||
245 | reg_val = CHRG_VBUS_ILIM_3500MA << CHRG_VBUS_ILIM_BIT_POS; | ||
246 | else if (inlmt >= 3000000) | ||
239 | reg_val = CHRG_VBUS_ILIM_3000MA << CHRG_VBUS_ILIM_BIT_POS; | 247 | reg_val = CHRG_VBUS_ILIM_3000MA << CHRG_VBUS_ILIM_BIT_POS; |
240 | else if (inlmt >= 2500000) | 248 | else if (inlmt >= 2500000) |
241 | reg_val = CHRG_VBUS_ILIM_2500MA << CHRG_VBUS_ILIM_BIT_POS; | 249 | reg_val = CHRG_VBUS_ILIM_2500MA << CHRG_VBUS_ILIM_BIT_POS; |
@@ -739,6 +747,18 @@ static int axp288_charger_probe(struct platform_device *pdev) | |||
739 | struct device *dev = &pdev->dev; | 747 | struct device *dev = &pdev->dev; |
740 | struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent); | 748 | struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent); |
741 | struct power_supply_config charger_cfg = {}; | 749 | struct power_supply_config charger_cfg = {}; |
750 | unsigned int val; | ||
751 | |||
752 | /* | ||
753 | * On some devices the fuelgauge and charger parts of the axp288 are | ||
754 | * not used, check that the fuelgauge is enabled (CC_CTRL != 0). | ||
755 | */ | ||
756 | ret = regmap_read(axp20x->regmap, AXP20X_CC_CTRL, &val); | ||
757 | if (ret < 0) | ||
758 | return ret; | ||
759 | if (val == 0) | ||
760 | return -ENODEV; | ||
761 | |||
742 | info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); | 762 | info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); |
743 | if (!info) | 763 | if (!info) |
744 | return -ENOMEM; | 764 | return -ENOMEM; |
diff --git a/drivers/power/supply/axp288_fuel_gauge.c b/drivers/power/supply/axp288_fuel_gauge.c index fd8f0b2210bc..084c8ba9749d 100644 --- a/drivers/power/supply/axp288_fuel_gauge.c +++ b/drivers/power/supply/axp288_fuel_gauge.c | |||
@@ -24,7 +24,6 @@ | |||
24 | #include <linux/regmap.h> | 24 | #include <linux/regmap.h> |
25 | #include <linux/jiffies.h> | 25 | #include <linux/jiffies.h> |
26 | #include <linux/interrupt.h> | 26 | #include <linux/interrupt.h> |
27 | #include <linux/workqueue.h> | ||
28 | #include <linux/mfd/axp20x.h> | 27 | #include <linux/mfd/axp20x.h> |
29 | #include <linux/platform_device.h> | 28 | #include <linux/platform_device.h> |
30 | #include <linux/power_supply.h> | 29 | #include <linux/power_supply.h> |
@@ -88,7 +87,6 @@ | |||
88 | #define FG_LOW_CAP_CRIT_THR 4 /* 4 perc */ | 87 | #define FG_LOW_CAP_CRIT_THR 4 /* 4 perc */ |
89 | #define FG_LOW_CAP_SHDN_THR 0 /* 0 perc */ | 88 | #define FG_LOW_CAP_SHDN_THR 0 /* 0 perc */ |
90 | 89 | ||
91 | #define STATUS_MON_DELAY_JIFFIES (HZ * 60) /*60 sec */ | ||
92 | #define NR_RETRY_CNT 3 | 90 | #define NR_RETRY_CNT 3 |
93 | #define DEV_NAME "axp288_fuel_gauge" | 91 | #define DEV_NAME "axp288_fuel_gauge" |
94 | 92 | ||
@@ -128,7 +126,6 @@ struct axp288_fg_info { | |||
128 | struct mutex lock; | 126 | struct mutex lock; |
129 | int status; | 127 | int status; |
130 | int max_volt; | 128 | int max_volt; |
131 | struct delayed_work status_monitor; | ||
132 | struct dentry *debug_file; | 129 | struct dentry *debug_file; |
133 | }; | 130 | }; |
134 | 131 | ||
@@ -592,16 +589,6 @@ static int fuel_gauge_property_is_writeable(struct power_supply *psy, | |||
592 | return ret; | 589 | return ret; |
593 | } | 590 | } |
594 | 591 | ||
595 | static void fuel_gauge_status_monitor(struct work_struct *work) | ||
596 | { | ||
597 | struct axp288_fg_info *info = container_of(work, | ||
598 | struct axp288_fg_info, status_monitor.work); | ||
599 | |||
600 | fuel_gauge_get_status(info); | ||
601 | power_supply_changed(info->bat); | ||
602 | schedule_delayed_work(&info->status_monitor, STATUS_MON_DELAY_JIFFIES); | ||
603 | } | ||
604 | |||
605 | static irqreturn_t fuel_gauge_thread_handler(int irq, void *dev) | 592 | static irqreturn_t fuel_gauge_thread_handler(int irq, void *dev) |
606 | { | 593 | { |
607 | struct axp288_fg_info *info = dev; | 594 | struct axp288_fg_info *info = dev; |
@@ -754,10 +741,21 @@ static int axp288_fuel_gauge_probe(struct platform_device *pdev) | |||
754 | [BAT_D_CURR] = "axp288-chrg-d-curr", | 741 | [BAT_D_CURR] = "axp288-chrg-d-curr", |
755 | [BAT_VOLT] = "axp288-batt-volt", | 742 | [BAT_VOLT] = "axp288-batt-volt", |
756 | }; | 743 | }; |
744 | unsigned int val; | ||
757 | 745 | ||
758 | if (dmi_check_system(axp288_fuel_gauge_blacklist)) | 746 | if (dmi_check_system(axp288_fuel_gauge_blacklist)) |
759 | return -ENODEV; | 747 | return -ENODEV; |
760 | 748 | ||
749 | /* | ||
750 | * On some devices the fuelgauge and charger parts of the axp288 are | ||
751 | * not used, check that the fuelgauge is enabled (CC_CTRL != 0). | ||
752 | */ | ||
753 | ret = regmap_read(axp20x->regmap, AXP20X_CC_CTRL, &val); | ||
754 | if (ret < 0) | ||
755 | return ret; | ||
756 | if (val == 0) | ||
757 | return -ENODEV; | ||
758 | |||
761 | info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); | 759 | info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); |
762 | if (!info) | 760 | if (!info) |
763 | return -ENOMEM; | 761 | return -ENOMEM; |
@@ -770,7 +768,6 @@ static int axp288_fuel_gauge_probe(struct platform_device *pdev) | |||
770 | platform_set_drvdata(pdev, info); | 768 | platform_set_drvdata(pdev, info); |
771 | 769 | ||
772 | mutex_init(&info->lock); | 770 | mutex_init(&info->lock); |
773 | INIT_DELAYED_WORK(&info->status_monitor, fuel_gauge_status_monitor); | ||
774 | 771 | ||
775 | for (i = 0; i < IIO_CHANNEL_NUM; i++) { | 772 | for (i = 0; i < IIO_CHANNEL_NUM; i++) { |
776 | /* | 773 | /* |
@@ -830,7 +827,6 @@ static int axp288_fuel_gauge_probe(struct platform_device *pdev) | |||
830 | 827 | ||
831 | fuel_gauge_create_debugfs(info); | 828 | fuel_gauge_create_debugfs(info); |
832 | fuel_gauge_init_irq(info); | 829 | fuel_gauge_init_irq(info); |
833 | schedule_delayed_work(&info->status_monitor, STATUS_MON_DELAY_JIFFIES); | ||
834 | 830 | ||
835 | return 0; | 831 | return 0; |
836 | 832 | ||
@@ -853,7 +849,6 @@ static int axp288_fuel_gauge_remove(struct platform_device *pdev) | |||
853 | struct axp288_fg_info *info = platform_get_drvdata(pdev); | 849 | struct axp288_fg_info *info = platform_get_drvdata(pdev); |
854 | int i; | 850 | int i; |
855 | 851 | ||
856 | cancel_delayed_work_sync(&info->status_monitor); | ||
857 | power_supply_unregister(info->bat); | 852 | power_supply_unregister(info->bat); |
858 | fuel_gauge_remove_debugfs(info); | 853 | fuel_gauge_remove_debugfs(info); |
859 | 854 | ||
diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c index 7ce60519b1bc..d44ed8e17c47 100644 --- a/drivers/power/supply/bq27xxx_battery.c +++ b/drivers/power/supply/bq27xxx_battery.c | |||
@@ -432,6 +432,7 @@ static u8 | |||
432 | BQ27XXX_DM_REG_ROWS, | 432 | BQ27XXX_DM_REG_ROWS, |
433 | }; | 433 | }; |
434 | #define bq27425_regs bq27421_regs | 434 | #define bq27425_regs bq27421_regs |
435 | #define bq27426_regs bq27421_regs | ||
435 | #define bq27441_regs bq27421_regs | 436 | #define bq27441_regs bq27421_regs |
436 | #define bq27621_regs bq27421_regs | 437 | #define bq27621_regs bq27421_regs |
437 | 438 | ||
@@ -664,6 +665,7 @@ static enum power_supply_property bq27421_props[] = { | |||
664 | POWER_SUPPLY_PROP_MANUFACTURER, | 665 | POWER_SUPPLY_PROP_MANUFACTURER, |
665 | }; | 666 | }; |
666 | #define bq27425_props bq27421_props | 667 | #define bq27425_props bq27421_props |
668 | #define bq27426_props bq27421_props | ||
667 | #define bq27441_props bq27421_props | 669 | #define bq27441_props bq27421_props |
668 | #define bq27621_props bq27421_props | 670 | #define bq27621_props bq27421_props |
669 | 671 | ||
@@ -734,6 +736,12 @@ static struct bq27xxx_dm_reg bq27425_dm_regs[] = { | |||
734 | [BQ27XXX_DM_TERMINATE_VOLTAGE] = { 82, 18, 2, 2800, 3700 }, | 736 | [BQ27XXX_DM_TERMINATE_VOLTAGE] = { 82, 18, 2, 2800, 3700 }, |
735 | }; | 737 | }; |
736 | 738 | ||
739 | static struct bq27xxx_dm_reg bq27426_dm_regs[] = { | ||
740 | [BQ27XXX_DM_DESIGN_CAPACITY] = { 82, 6, 2, 0, 8000 }, | ||
741 | [BQ27XXX_DM_DESIGN_ENERGY] = { 82, 8, 2, 0, 32767 }, | ||
742 | [BQ27XXX_DM_TERMINATE_VOLTAGE] = { 82, 10, 2, 2500, 3700 }, | ||
743 | }; | ||
744 | |||
737 | #if 0 /* not yet tested */ | 745 | #if 0 /* not yet tested */ |
738 | #define bq27441_dm_regs bq27421_dm_regs | 746 | #define bq27441_dm_regs bq27421_dm_regs |
739 | #else | 747 | #else |
@@ -795,6 +803,7 @@ static struct { | |||
795 | [BQ27545] = BQ27XXX_DATA(bq27545, 0x04143672, BQ27XXX_O_OTDC), | 803 | [BQ27545] = BQ27XXX_DATA(bq27545, 0x04143672, BQ27XXX_O_OTDC), |
796 | [BQ27421] = BQ27XXX_DATA(bq27421, 0x80008000, BQ27XXX_O_UTOT | BQ27XXX_O_CFGUP | BQ27XXX_O_RAM), | 804 | [BQ27421] = BQ27XXX_DATA(bq27421, 0x80008000, BQ27XXX_O_UTOT | BQ27XXX_O_CFGUP | BQ27XXX_O_RAM), |
797 | [BQ27425] = BQ27XXX_DATA(bq27425, 0x04143672, BQ27XXX_O_UTOT | BQ27XXX_O_CFGUP), | 805 | [BQ27425] = BQ27XXX_DATA(bq27425, 0x04143672, BQ27XXX_O_UTOT | BQ27XXX_O_CFGUP), |
806 | [BQ27426] = BQ27XXX_DATA(bq27426, 0x80008000, BQ27XXX_O_UTOT | BQ27XXX_O_CFGUP | BQ27XXX_O_RAM), | ||
798 | [BQ27441] = BQ27XXX_DATA(bq27441, 0x80008000, BQ27XXX_O_UTOT | BQ27XXX_O_CFGUP | BQ27XXX_O_RAM), | 807 | [BQ27441] = BQ27XXX_DATA(bq27441, 0x80008000, BQ27XXX_O_UTOT | BQ27XXX_O_CFGUP | BQ27XXX_O_RAM), |
799 | [BQ27621] = BQ27XXX_DATA(bq27621, 0x80008000, BQ27XXX_O_UTOT | BQ27XXX_O_CFGUP | BQ27XXX_O_RAM), | 808 | [BQ27621] = BQ27XXX_DATA(bq27621, 0x80008000, BQ27XXX_O_UTOT | BQ27XXX_O_CFGUP | BQ27XXX_O_RAM), |
800 | }; | 809 | }; |
diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c b/drivers/power/supply/bq27xxx_battery_i2c.c index 6b25e5f2337e..40069128ad44 100644 --- a/drivers/power/supply/bq27xxx_battery_i2c.c +++ b/drivers/power/supply/bq27xxx_battery_i2c.c | |||
@@ -249,6 +249,7 @@ static const struct i2c_device_id bq27xxx_i2c_id_table[] = { | |||
249 | { "bq27545", BQ27545 }, | 249 | { "bq27545", BQ27545 }, |
250 | { "bq27421", BQ27421 }, | 250 | { "bq27421", BQ27421 }, |
251 | { "bq27425", BQ27425 }, | 251 | { "bq27425", BQ27425 }, |
252 | { "bq27426", BQ27426 }, | ||
252 | { "bq27441", BQ27441 }, | 253 | { "bq27441", BQ27441 }, |
253 | { "bq27621", BQ27621 }, | 254 | { "bq27621", BQ27621 }, |
254 | {}, | 255 | {}, |
@@ -280,6 +281,7 @@ static const struct of_device_id bq27xxx_battery_i2c_of_match_table[] = { | |||
280 | { .compatible = "ti,bq27545" }, | 281 | { .compatible = "ti,bq27545" }, |
281 | { .compatible = "ti,bq27421" }, | 282 | { .compatible = "ti,bq27421" }, |
282 | { .compatible = "ti,bq27425" }, | 283 | { .compatible = "ti,bq27425" }, |
284 | { .compatible = "ti,bq27426" }, | ||
283 | { .compatible = "ti,bq27441" }, | 285 | { .compatible = "ti,bq27441" }, |
284 | { .compatible = "ti,bq27621" }, | 286 | { .compatible = "ti,bq27621" }, |
285 | {}, | 287 | {}, |
diff --git a/drivers/power/supply/charger-manager.c b/drivers/power/supply/charger-manager.c index 1de4b4493824..2a50b4654793 100644 --- a/drivers/power/supply/charger-manager.c +++ b/drivers/power/supply/charger-manager.c | |||
@@ -1700,8 +1700,9 @@ static int charger_manager_probe(struct platform_device *pdev) | |||
1700 | power_supply_put(psy); | 1700 | power_supply_put(psy); |
1701 | } | 1701 | } |
1702 | 1702 | ||
1703 | if (desc->polling_interval_ms == 0 || | 1703 | if (cm->desc->polling_mode != CM_POLL_DISABLE && |
1704 | msecs_to_jiffies(desc->polling_interval_ms) <= CM_JIFFIES_SMALL) { | 1704 | (desc->polling_interval_ms == 0 || |
1705 | msecs_to_jiffies(desc->polling_interval_ms) <= CM_JIFFIES_SMALL)) { | ||
1705 | dev_err(&pdev->dev, "polling_interval_ms is too small\n"); | 1706 | dev_err(&pdev->dev, "polling_interval_ms is too small\n"); |
1706 | return -EINVAL; | 1707 | return -EINVAL; |
1707 | } | 1708 | } |
diff --git a/drivers/power/supply/gpio-charger.c b/drivers/power/supply/gpio-charger.c index bd2468ca6b63..c3f2a9479468 100644 --- a/drivers/power/supply/gpio-charger.c +++ b/drivers/power/supply/gpio-charger.c | |||
@@ -212,8 +212,7 @@ static int gpio_charger_suspend(struct device *dev) | |||
212 | 212 | ||
213 | static int gpio_charger_resume(struct device *dev) | 213 | static int gpio_charger_resume(struct device *dev) |
214 | { | 214 | { |
215 | struct platform_device *pdev = to_platform_device(dev); | 215 | struct gpio_charger *gpio_charger = dev_get_drvdata(dev); |
216 | struct gpio_charger *gpio_charger = platform_get_drvdata(pdev); | ||
217 | 216 | ||
218 | if (device_may_wakeup(dev) && gpio_charger->wakeup_enabled) | 217 | if (device_may_wakeup(dev) && gpio_charger->wakeup_enabled) |
219 | disable_irq_wake(gpio_charger->irq); | 218 | disable_irq_wake(gpio_charger->irq); |
diff --git a/drivers/power/supply/power_supply_sysfs.c b/drivers/power/supply/power_supply_sysfs.c index 1350068c401a..6170ed8b6854 100644 --- a/drivers/power/supply/power_supply_sysfs.c +++ b/drivers/power/supply/power_supply_sysfs.c | |||
@@ -116,15 +116,15 @@ static ssize_t power_supply_show_usb_type(struct device *dev, | |||
116 | static ssize_t power_supply_show_property(struct device *dev, | 116 | static ssize_t power_supply_show_property(struct device *dev, |
117 | struct device_attribute *attr, | 117 | struct device_attribute *attr, |
118 | char *buf) { | 118 | char *buf) { |
119 | ssize_t ret = 0; | 119 | ssize_t ret; |
120 | struct power_supply *psy = dev_get_drvdata(dev); | 120 | struct power_supply *psy = dev_get_drvdata(dev); |
121 | const ptrdiff_t off = attr - power_supply_attrs; | 121 | enum power_supply_property psp = attr - power_supply_attrs; |
122 | union power_supply_propval value; | 122 | union power_supply_propval value; |
123 | 123 | ||
124 | if (off == POWER_SUPPLY_PROP_TYPE) { | 124 | if (psp == POWER_SUPPLY_PROP_TYPE) { |
125 | value.intval = psy->desc->type; | 125 | value.intval = psy->desc->type; |
126 | } else { | 126 | } else { |
127 | ret = power_supply_get_property(psy, off, &value); | 127 | ret = power_supply_get_property(psy, psp, &value); |
128 | 128 | ||
129 | if (ret < 0) { | 129 | if (ret < 0) { |
130 | if (ret == -ENODATA) | 130 | if (ret == -ENODATA) |
@@ -137,35 +137,48 @@ static ssize_t power_supply_show_property(struct device *dev, | |||
137 | } | 137 | } |
138 | } | 138 | } |
139 | 139 | ||
140 | if (off == POWER_SUPPLY_PROP_STATUS) | 140 | switch (psp) { |
141 | return sprintf(buf, "%s\n", | 141 | case POWER_SUPPLY_PROP_STATUS: |
142 | power_supply_status_text[value.intval]); | 142 | ret = sprintf(buf, "%s\n", |
143 | else if (off == POWER_SUPPLY_PROP_CHARGE_TYPE) | 143 | power_supply_status_text[value.intval]); |
144 | return sprintf(buf, "%s\n", | 144 | break; |
145 | power_supply_charge_type_text[value.intval]); | 145 | case POWER_SUPPLY_PROP_CHARGE_TYPE: |
146 | else if (off == POWER_SUPPLY_PROP_HEALTH) | 146 | ret = sprintf(buf, "%s\n", |
147 | return sprintf(buf, "%s\n", | 147 | power_supply_charge_type_text[value.intval]); |
148 | power_supply_health_text[value.intval]); | 148 | break; |
149 | else if (off == POWER_SUPPLY_PROP_TECHNOLOGY) | 149 | case POWER_SUPPLY_PROP_HEALTH: |
150 | return sprintf(buf, "%s\n", | 150 | ret = sprintf(buf, "%s\n", |
151 | power_supply_technology_text[value.intval]); | 151 | power_supply_health_text[value.intval]); |
152 | else if (off == POWER_SUPPLY_PROP_CAPACITY_LEVEL) | 152 | break; |
153 | return sprintf(buf, "%s\n", | 153 | case POWER_SUPPLY_PROP_TECHNOLOGY: |
154 | power_supply_capacity_level_text[value.intval]); | 154 | ret = sprintf(buf, "%s\n", |
155 | else if (off == POWER_SUPPLY_PROP_TYPE) | 155 | power_supply_technology_text[value.intval]); |
156 | return sprintf(buf, "%s\n", | 156 | break; |
157 | power_supply_type_text[value.intval]); | 157 | case POWER_SUPPLY_PROP_CAPACITY_LEVEL: |
158 | else if (off == POWER_SUPPLY_PROP_USB_TYPE) | 158 | ret = sprintf(buf, "%s\n", |
159 | return power_supply_show_usb_type(dev, psy->desc->usb_types, | 159 | power_supply_capacity_level_text[value.intval]); |
160 | psy->desc->num_usb_types, | 160 | break; |
161 | &value, buf); | 161 | case POWER_SUPPLY_PROP_TYPE: |
162 | else if (off == POWER_SUPPLY_PROP_SCOPE) | 162 | ret = sprintf(buf, "%s\n", |
163 | return sprintf(buf, "%s\n", | 163 | power_supply_type_text[value.intval]); |
164 | power_supply_scope_text[value.intval]); | 164 | break; |
165 | else if (off >= POWER_SUPPLY_PROP_MODEL_NAME) | 165 | case POWER_SUPPLY_PROP_USB_TYPE: |
166 | return sprintf(buf, "%s\n", value.strval); | 166 | ret = power_supply_show_usb_type(dev, psy->desc->usb_types, |
167 | 167 | psy->desc->num_usb_types, | |
168 | return sprintf(buf, "%d\n", value.intval); | 168 | &value, buf); |
169 | break; | ||
170 | case POWER_SUPPLY_PROP_SCOPE: | ||
171 | ret = sprintf(buf, "%s\n", | ||
172 | power_supply_scope_text[value.intval]); | ||
173 | break; | ||
174 | case POWER_SUPPLY_PROP_MODEL_NAME ... POWER_SUPPLY_PROP_SERIAL_NUMBER: | ||
175 | ret = sprintf(buf, "%s\n", value.strval); | ||
176 | break; | ||
177 | default: | ||
178 | ret = sprintf(buf, "%d\n", value.intval); | ||
179 | } | ||
180 | |||
181 | return ret; | ||
169 | } | 182 | } |
170 | 183 | ||
171 | static ssize_t power_supply_store_property(struct device *dev, | 184 | static ssize_t power_supply_store_property(struct device *dev, |
@@ -173,11 +186,10 @@ static ssize_t power_supply_store_property(struct device *dev, | |||
173 | const char *buf, size_t count) { | 186 | const char *buf, size_t count) { |
174 | ssize_t ret; | 187 | ssize_t ret; |
175 | struct power_supply *psy = dev_get_drvdata(dev); | 188 | struct power_supply *psy = dev_get_drvdata(dev); |
176 | const ptrdiff_t off = attr - power_supply_attrs; | 189 | enum power_supply_property psp = attr - power_supply_attrs; |
177 | union power_supply_propval value; | 190 | union power_supply_propval value; |
178 | 191 | ||
179 | /* maybe it is a enum property? */ | 192 | switch (psp) { |
180 | switch (off) { | ||
181 | case POWER_SUPPLY_PROP_STATUS: | 193 | case POWER_SUPPLY_PROP_STATUS: |
182 | ret = sysfs_match_string(power_supply_status_text, buf); | 194 | ret = sysfs_match_string(power_supply_status_text, buf); |
183 | break; | 195 | break; |
@@ -216,7 +228,7 @@ static ssize_t power_supply_store_property(struct device *dev, | |||
216 | 228 | ||
217 | value.intval = ret; | 229 | value.intval = ret; |
218 | 230 | ||
219 | ret = power_supply_set_property(psy, off, &value); | 231 | ret = power_supply_set_property(psy, psp, &value); |
220 | if (ret < 0) | 232 | if (ret < 0) |
221 | return ret; | 233 | return ret; |
222 | 234 | ||
diff --git a/drivers/power/supply/s3c_adc_battery.c b/drivers/power/supply/s3c_adc_battery.c index 0ffe5cd3abf6..3d00b35cafc9 100644 --- a/drivers/power/supply/s3c_adc_battery.c +++ b/drivers/power/supply/s3c_adc_battery.c | |||
@@ -293,6 +293,7 @@ static int s3c_adc_bat_probe(struct platform_device *pdev) | |||
293 | { | 293 | { |
294 | struct s3c_adc_client *client; | 294 | struct s3c_adc_client *client; |
295 | struct s3c_adc_bat_pdata *pdata = pdev->dev.platform_data; | 295 | struct s3c_adc_bat_pdata *pdata = pdev->dev.platform_data; |
296 | struct power_supply_config psy_cfg = {}; | ||
296 | int ret; | 297 | int ret; |
297 | 298 | ||
298 | client = s3c_adc_register(pdev, NULL, NULL, 0); | 299 | client = s3c_adc_register(pdev, NULL, NULL, 0); |
@@ -309,14 +310,15 @@ static int s3c_adc_bat_probe(struct platform_device *pdev) | |||
309 | main_bat.cur_value = -1; | 310 | main_bat.cur_value = -1; |
310 | main_bat.cable_plugged = 0; | 311 | main_bat.cable_plugged = 0; |
311 | main_bat.status = POWER_SUPPLY_STATUS_DISCHARGING; | 312 | main_bat.status = POWER_SUPPLY_STATUS_DISCHARGING; |
313 | psy_cfg.drv_data = &main_bat; | ||
312 | 314 | ||
313 | main_bat.psy = power_supply_register(&pdev->dev, &main_bat_desc, NULL); | 315 | main_bat.psy = power_supply_register(&pdev->dev, &main_bat_desc, &psy_cfg); |
314 | if (IS_ERR(main_bat.psy)) { | 316 | if (IS_ERR(main_bat.psy)) { |
315 | ret = PTR_ERR(main_bat.psy); | 317 | ret = PTR_ERR(main_bat.psy); |
316 | goto err_reg_main; | 318 | goto err_reg_main; |
317 | } | 319 | } |
318 | if (pdata->backup_volt_mult) { | 320 | if (pdata->backup_volt_mult) { |
319 | const struct power_supply_config psy_cfg | 321 | const struct power_supply_config backup_psy_cfg |
320 | = { .drv_data = &backup_bat, }; | 322 | = { .drv_data = &backup_bat, }; |
321 | 323 | ||
322 | backup_bat.client = client; | 324 | backup_bat.client = client; |
@@ -324,7 +326,7 @@ static int s3c_adc_bat_probe(struct platform_device *pdev) | |||
324 | backup_bat.volt_value = -1; | 326 | backup_bat.volt_value = -1; |
325 | backup_bat.psy = power_supply_register(&pdev->dev, | 327 | backup_bat.psy = power_supply_register(&pdev->dev, |
326 | &backup_bat_desc, | 328 | &backup_bat_desc, |
327 | &psy_cfg); | 329 | &backup_psy_cfg); |
328 | if (IS_ERR(backup_bat.psy)) { | 330 | if (IS_ERR(backup_bat.psy)) { |
329 | ret = PTR_ERR(backup_bat.psy); | 331 | ret = PTR_ERR(backup_bat.psy); |
330 | goto err_reg_backup; | 332 | goto err_reg_backup; |
diff --git a/include/linux/mfd/abx500.h b/include/linux/mfd/abx500.h index 44412c9d26e1..aa09414756db 100644 --- a/include/linux/mfd/abx500.h +++ b/include/linux/mfd/abx500.h | |||
@@ -271,7 +271,6 @@ struct abx500_bm_data { | |||
271 | bool autopower_cfg; | 271 | bool autopower_cfg; |
272 | bool ac_enabled; | 272 | bool ac_enabled; |
273 | bool usb_enabled; | 273 | bool usb_enabled; |
274 | bool usb_power_path; | ||
275 | bool no_maintenance; | 274 | bool no_maintenance; |
276 | bool capacity_scaling; | 275 | bool capacity_scaling; |
277 | bool chg_unknown_bat; | 276 | bool chg_unknown_bat; |
diff --git a/include/linux/mfd/abx500/ab8500-bm.h b/include/linux/mfd/abx500/ab8500-bm.h index e63681eb6c62..c06daf3d490a 100644 --- a/include/linux/mfd/abx500/ab8500-bm.h +++ b/include/linux/mfd/abx500/ab8500-bm.h | |||
@@ -248,8 +248,6 @@ enum bup_vch_sel { | |||
248 | #define BAT_CTRL_20U_ENA 0x02 | 248 | #define BAT_CTRL_20U_ENA 0x02 |
249 | #define BAT_CTRL_18U_ENA 0x01 | 249 | #define BAT_CTRL_18U_ENA 0x01 |
250 | #define BAT_CTRL_16U_ENA 0x02 | 250 | #define BAT_CTRL_16U_ENA 0x02 |
251 | #define BAT_CTRL_60U_ENA 0x01 | ||
252 | #define BAT_CTRL_120U_ENA 0x02 | ||
253 | #define BAT_CTRL_CMP_ENA 0x04 | 251 | #define BAT_CTRL_CMP_ENA 0x04 |
254 | #define FORCE_BAT_CTRL_CMP_HIGH 0x08 | 252 | #define FORCE_BAT_CTRL_CMP_HIGH 0x08 |
255 | #define BAT_CTRL_PULL_UP_ENA 0x10 | 253 | #define BAT_CTRL_PULL_UP_ENA 0x10 |
diff --git a/include/linux/mfd/abx500/ux500_chargalg.h b/include/linux/mfd/abx500/ux500_chargalg.h index 67703f23e7ba..669894f434f5 100644 --- a/include/linux/mfd/abx500/ux500_chargalg.h +++ b/include/linux/mfd/abx500/ux500_chargalg.h | |||
@@ -25,8 +25,6 @@ struct ux500_charger_ops { | |||
25 | int (*check_enable) (struct ux500_charger *, int, int); | 25 | int (*check_enable) (struct ux500_charger *, int, int); |
26 | int (*kick_wd) (struct ux500_charger *); | 26 | int (*kick_wd) (struct ux500_charger *); |
27 | int (*update_curr) (struct ux500_charger *, int); | 27 | int (*update_curr) (struct ux500_charger *, int); |
28 | int (*pp_enable) (struct ux500_charger *, bool); | ||
29 | int (*pre_chg_enable) (struct ux500_charger *, bool); | ||
30 | }; | 28 | }; |
31 | 29 | ||
32 | /** | 30 | /** |
@@ -37,7 +35,6 @@ struct ux500_charger_ops { | |||
37 | * @max_out_curr maximum output charger current in mA | 35 | * @max_out_curr maximum output charger current in mA |
38 | * @enabled indicates if this charger is used or not | 36 | * @enabled indicates if this charger is used or not |
39 | * @external external charger unit (pm2xxx) | 37 | * @external external charger unit (pm2xxx) |
40 | * @power_path USB power path support | ||
41 | */ | 38 | */ |
42 | struct ux500_charger { | 39 | struct ux500_charger { |
43 | struct power_supply *psy; | 40 | struct power_supply *psy; |
@@ -47,7 +44,6 @@ struct ux500_charger { | |||
47 | int wdt_refresh; | 44 | int wdt_refresh; |
48 | bool enabled; | 45 | bool enabled; |
49 | bool external; | 46 | bool external; |
50 | bool power_path; | ||
51 | }; | 47 | }; |
52 | 48 | ||
53 | extern struct blocking_notifier_head charger_notifier_list; | 49 | extern struct blocking_notifier_head charger_notifier_list; |
diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h index 01fbf1b16258..d6355f49fbae 100644 --- a/include/linux/power/bq27xxx_battery.h +++ b/include/linux/power/bq27xxx_battery.h | |||
@@ -24,8 +24,9 @@ enum bq27xxx_chip { | |||
24 | BQ27546, | 24 | BQ27546, |
25 | BQ27742, | 25 | BQ27742, |
26 | BQ27545, /* bq27545 */ | 26 | BQ27545, /* bq27545 */ |
27 | BQ27421, /* bq27421, bq27425, bq27441, bq27621 */ | 27 | BQ27421, /* bq27421, bq27441, bq27621 */ |
28 | BQ27425, | 28 | BQ27425, |
29 | BQ27426, | ||
29 | BQ27441, | 30 | BQ27441, |
30 | BQ27621, | 31 | BQ27621, |
31 | }; | 32 | }; |