Skip to content

Commit a16afaf

Browse files
committed
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
2 parents 2a70ea5 + c42812d commit a16afaf

20 files changed

+147
-406
lines changed

Documentation/devicetree/bindings/power/supply/bq27xxx.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Required properties:
2525
* "ti,bq27545" - BQ27545
2626
* "ti,bq27421" - BQ27421
2727
* "ti,bq27425" - BQ27425
28+
* "ti,bq27426" - BQ27426
2829
* "ti,bq27441" - BQ27441
2930
* "ti,bq27621" - BQ27621
3031
- reg: integer, I2C address of the fuel gauge.

MAINTAINERS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8052,6 +8052,13 @@ S: Maintained
80528052
F: Documentation/misc-devices/eeprom
80538053
F: drivers/misc/eeprom/eeprom.c
80548054

8055+
LEGO MINDSTORMS EV3
8056+
R: David Lechner <[email protected]>
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+
80558062
LEGO USB Tower driver
80568063
M: Juergen Stuber <[email protected]>
80578064

drivers/power/reset/gpio-poweroff.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ static void gpio_poweroff_do_poweroff(void)
3535
gpiod_direction_output(reset_gpio, 1);
3636
mdelay(100);
3737
/* drive inactive, also active->inactive edge */
38-
gpiod_set_value(reset_gpio, 0);
38+
gpiod_set_value_cansleep(reset_gpio, 0);
3939
mdelay(100);
4040

4141
/* drive it active, also inactive->active edge */
42-
gpiod_set_value(reset_gpio, 1);
42+
gpiod_set_value_cansleep(reset_gpio, 1);
4343

4444
/* give it some time */
4545
mdelay(timeout);

drivers/power/supply/ab8500_bmdata.c

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -430,13 +430,6 @@ static const struct abx500_maxim_parameters ab8500_maxi_params = {
430430
.charger_curr_step = 100,
431431
};
432432

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-
440433
static const struct abx500_bm_charger_parameters chg = {
441434
.usb_volt_max = 5500,
442435
.usb_curr_max = 1500,
@@ -453,17 +446,6 @@ static int ab8500_charge_output_curr_map[] = {
453446
900, 1000, 1100, 1200, 1300, 1400, 1500, 1500,
454447
};
455448

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-
467449
/*
468450
* This array maps the raw hex value to charger input current used by the
469451
* AB8500 values
@@ -473,17 +455,6 @@ static int ab8500_charge_input_curr_map[] = {
473455
700, 800, 900, 1000, 1100, 1300, 1400, 1500,
474456
};
475457

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-
487458
struct abx500_bm_data ab8500_bm_data = {
488459
.temp_under = 3,
489460
.temp_low = 8,
@@ -518,40 +489,6 @@ struct abx500_bm_data ab8500_bm_data = {
518489
.n_chg_in_curr = ARRAY_SIZE(ab8500_charge_input_curr_map),
519490
};
520491

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-
555492
int ab8500_bm_of_probe(struct device *dev,
556493
struct device_node *np,
557494
struct abx500_bm_data *bm)

drivers/power/supply/ab8500_btemp.c

Lines changed: 18 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -214,22 +214,10 @@ static int ab8500_btemp_curr_source_enable(struct ab8500_btemp *di,
214214
/* Only do this for batteries with internal NTC */
215215
if (di->bm->adc_therm == ABx500_ADC_THERM_BATCTRL && enable) {
216216

217-
if (is_ab8540(di->parent)) {
218-
if (di->curr_source == BTEMP_BATCTRL_CURR_SRC_60UA)
219-
curr = BAT_CTRL_60U_ENA;
220-
else
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-
}
217+
if (di->curr_source == BTEMP_BATCTRL_CURR_SRC_7UA)
218+
curr = BAT_CTRL_7U_ENA;
219+
else
220+
curr = BAT_CTRL_20U_ENA;
233221

234222
dev_dbg(di->dev, "Set BATCTRL %duA\n", di->curr_source);
235223

@@ -260,28 +248,12 @@ static int ab8500_btemp_curr_source_enable(struct ab8500_btemp *di,
260248
} else if (di->bm->adc_therm == ABx500_ADC_THERM_BATCTRL && !enable) {
261249
dev_dbg(di->dev, "Disable BATCTRL curr source\n");
262250

263-
if (is_ab8540(di->parent)) {
264-
/* Write 0 to the curr bits */
265-
ret = abx500_mask_and_set_register_interruptible(
266-
di->dev,
267-
AB8500_CHARGER, AB8500_BAT_CTRL_CURRENT_SOURCE,
268-
BAT_CTRL_60U_ENA | BAT_CTRL_120U_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-
}
251+
/* Write 0 to the curr bits */
252+
ret = abx500_mask_and_set_register_interruptible(
253+
di->dev,
254+
AB8500_CHARGER, AB8500_BAT_CTRL_CURRENT_SOURCE,
255+
BAT_CTRL_7U_ENA | BAT_CTRL_20U_ENA,
256+
~(BAT_CTRL_7U_ENA | BAT_CTRL_20U_ENA));
285257

286258
if (ret) {
287259
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,
324296
* if we got an error above
325297
*/
326298
disable_curr_source:
327-
if (is_ab8540(di->parent)) {
328-
/* Write 0 to the curr bits */
329-
ret = abx500_mask_and_set_register_interruptible(di->dev,
330-
AB8500_CHARGER, AB8500_BAT_CTRL_CURRENT_SOURCE,
331-
BAT_CTRL_60U_ENA | BAT_CTRL_120U_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-
}
299+
/* Write 0 to the curr bits */
300+
ret = abx500_mask_and_set_register_interruptible(di->dev,
301+
AB8500_CHARGER, AB8500_BAT_CTRL_CURRENT_SOURCE,
302+
BAT_CTRL_7U_ENA | BAT_CTRL_20U_ENA,
303+
~(BAT_CTRL_7U_ENA | BAT_CTRL_20U_ENA));
346304

347305
if (ret) {
348306
dev_err(di->dev, "%s failed disabling current source\n",
@@ -556,13 +514,8 @@ static int ab8500_btemp_id(struct ab8500_btemp *di)
556514
{
557515
int res;
558516
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;
565517

518+
di->curr_source = BTEMP_BATCTRL_CURR_SRC_7UA;
566519
di->bm->batt_id = BATTERY_UNKNOWN;
567520

568521
res = ab8500_btemp_get_batctrl_res(di);
@@ -600,18 +553,8 @@ static int ab8500_btemp_id(struct ab8500_btemp *di)
600553
*/
601554
if (di->bm->adc_therm == ABx500_ADC_THERM_BATCTRL &&
602555
di->bm->batt_id == 1) {
603-
if (is_ab8540(di->parent)) {
604-
dev_dbg(di->dev,
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-
}
556+
dev_dbg(di->dev, "Set BATCTRL current source to 20uA\n");
557+
di->curr_source = BTEMP_BATCTRL_CURR_SRC_20UA;
615558
}
616559

617560
return di->bm->batt_id;

0 commit comments

Comments
 (0)