Skip to content

Commit 619e17c

Browse files
committed
Merge tag 'for-v5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply
Pull power supply and reset updates from Sebastian Reichel: "Core: - Ensure HWMON devices are registered with valid names - Fix device wakeup code Drivers: - bq25890_charger: Add BQ25895 support - axp288_fuel_gauge: Add Minix Neo Z83-4 to blacklist - sc27xx: improve battery calibration - misc small fixes all over drivers" * tag 'for-v5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: (24 commits) power: supply: cpcap-charger: Enable vbus boost voltage power: supply: sc27xx: Add POWER_SUPPLY_PROP_CALIBRATE attribute power: supply: sc27xx: Optimize the battery capacity calibration power: supply: sc27xx: Make sure the alarm capacity is larger than 0 power: supply: sc27xx: Fix the the accuracy issue of coulomb calculation power: supply: sc27xx: Fix conditon to enable the FGU interrupt power: supply: sc27xx: Add POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN attribute power: supply: max77650: add MODULE_ALIAS() power: supply: isp1704: remove redundant assignment to variable ret power: supply: bq25890_charger: Add the BQ25895 part power: supply: sc27xx: Replace devm_add_action() followed by failure action with devm_add_action_or_reset() power: supply: sc27xx: Introduce local variable 'struct device *dev' power: reset: reboot-mode: Fix author email format power: supply: ab8500: remove set but not used variables 'vbup33_vrtcn' and 'bup_vch_range' power: supply: max17042_battery: Fix a typo in function names power: reset: gpio-restart: Fix typo when gpio reset is not found power: supply: Init device wakeup after device_add() power: supply: ab8500_charger: Mark expected switch fall-through power: supply: sbs-battery: only return health when battery present MAINTAINERS: N900: Remove isp1704_charger.h record ...
2 parents 57f1c3c + 7f73786 commit 619e17c

15 files changed

+237
-120
lines changed

MAINTAINERS

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11511,7 +11511,6 @@ NOKIA N900 POWER SUPPLY DRIVERS
1151111511
R: Pali Rohár <[email protected]>
1151211512
F: include/linux/power/bq2415x_charger.h
1151311513
F: include/linux/power/bq27xxx_battery.h
11514-
F: include/linux/power/isp1704_charger.h
1151511514
F: drivers/power/supply/bq2415x_charger.c
1151611515
F: drivers/power/supply/bq27xxx_battery.c
1151711516
F: drivers/power/supply/bq27xxx_battery_i2c.c

drivers/phy/motorola/phy-cpcap-usb.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,16 +231,18 @@ static void cpcap_usb_detect(struct work_struct *work)
231231
goto out_err;
232232

233233
error = regmap_update_bits(ddata->reg, CPCAP_REG_USBC3,
234-
CPCAP_BIT_VBUSSTBY_EN,
235-
CPCAP_BIT_VBUSSTBY_EN);
234+
CPCAP_BIT_VBUSSTBY_EN |
235+
CPCAP_BIT_VBUSEN_SPI,
236+
CPCAP_BIT_VBUSEN_SPI);
236237
if (error)
237238
goto out_err;
238239

239240
return;
240241
}
241242

242243
error = regmap_update_bits(ddata->reg, CPCAP_REG_USBC3,
243-
CPCAP_BIT_VBUSSTBY_EN, 0);
244+
CPCAP_BIT_VBUSSTBY_EN |
245+
CPCAP_BIT_VBUSEN_SPI, 0);
244246
if (error)
245247
goto out_err;
246248

drivers/power/reset/gpio-restart.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ static int gpio_restart_probe(struct platform_device *pdev)
6565
gpio_restart->reset_gpio = devm_gpiod_get(&pdev->dev, NULL,
6666
open_source ? GPIOD_IN : GPIOD_OUT_LOW);
6767
if (IS_ERR(gpio_restart->reset_gpio)) {
68-
dev_err(&pdev->dev, "Could net get reset GPIO\n");
68+
dev_err(&pdev->dev, "Could not get reset GPIO\n");
6969
return PTR_ERR(gpio_restart->reset_gpio);
7070
}
7171

drivers/power/reset/reboot-mode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,6 @@ void devm_reboot_mode_unregister(struct device *dev,
190190
}
191191
EXPORT_SYMBOL_GPL(devm_reboot_mode_unregister);
192192

193-
MODULE_AUTHOR("Andy Yan <[email protected]");
193+
MODULE_AUTHOR("Andy Yan <[email protected]>");
194194
MODULE_DESCRIPTION("System reboot mode core library");
195195
MODULE_LICENSE("GPL v2");

drivers/power/supply/ab8500_charger.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,7 @@ static int ab8500_charger_max_usb_curr(struct ab8500_charger *di,
742742
USB_CH_IP_CUR_LVL_1P5;
743743
break;
744744
}
745-
/* Else, fall through */
745+
/* else, fall through */
746746
case USB_STAT_HM_IDGND:
747747
dev_err(di->dev, "USB Type - Charging not allowed\n");
748748
di->max_usb_in_curr.usb_type_max = USB_CH_IP_CUR_LVL_0P05;
@@ -3011,7 +3011,6 @@ static int ab8500_charger_usb_get_property(struct power_supply *psy,
30113011
static int ab8500_charger_init_hw_registers(struct ab8500_charger *di)
30123012
{
30133013
int ret = 0;
3014-
u8 bup_vch_range = 0, vbup33_vrtcn = 0;
30153014

30163015
/* Setup maximum charger current and voltage for ABB cut2.0 */
30173016
if (!is_ab8500_1p1_or_earlier(di->parent)) {
@@ -3112,12 +3111,6 @@ static int ab8500_charger_init_hw_registers(struct ab8500_charger *di)
31123111
goto out;
31133112
}
31143113

3115-
/* Backup battery voltage and current */
3116-
if (di->bm->bkup_bat_v > BUP_VCH_SEL_3P1V)
3117-
bup_vch_range = BUP_VCH_RANGE;
3118-
if (di->bm->bkup_bat_v == BUP_VCH_SEL_3P3V)
3119-
vbup33_vrtcn = VBUP33_VRTCN;
3120-
31213114
ret = abx500_set_register_interruptible(di->dev,
31223115
AB8500_RTC,
31233116
AB8500_RTC_BACKUP_CHG_REG,

drivers/power/supply/axp288_fuel_gauge.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,7 @@ static void fuel_gauge_init_irq(struct axp288_fg_info *info)
674674
/*
675675
* Some devices have no battery (HDMI sticks) and the axp288 battery's
676676
* detection reports one despite it not being there.
677+
* Please keep this listed sorted alphabetically.
677678
*/
678679
static const struct dmi_system_id axp288_fuel_gauge_blacklist[] = {
679680
{
@@ -696,6 +697,12 @@ static const struct dmi_system_id axp288_fuel_gauge_blacklist[] = {
696697
DMI_EXACT_MATCH(DMI_BIOS_VERSION, "1.000"),
697698
},
698699
},
700+
{
701+
/* ECS EF20EA */
702+
.matches = {
703+
DMI_MATCH(DMI_PRODUCT_NAME, "EF20EA"),
704+
},
705+
},
699706
{
700707
/* Intel Cherry Trail Compute Stick, Windows version */
701708
.matches = {
@@ -720,10 +727,11 @@ static const struct dmi_system_id axp288_fuel_gauge_blacklist[] = {
720727
},
721728
},
722729
{
723-
/* ECS EF20EA */
730+
/* Minix Neo Z83-4 mini PC */
724731
.matches = {
725-
DMI_MATCH(DMI_PRODUCT_NAME, "EF20EA"),
726-
},
732+
DMI_MATCH(DMI_SYS_VENDOR, "MINIX"),
733+
DMI_MATCH(DMI_PRODUCT_NAME, "Z83-4"),
734+
}
727735
},
728736
{}
729737
};

drivers/power/supply/bq25890_charger.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#define BQ25890_IRQ_PIN "bq25890_irq"
2323

2424
#define BQ25890_ID 3
25+
#define BQ25895_ID 7
2526
#define BQ25896_ID 0
2627

2728
enum bq25890_fields {
@@ -171,7 +172,7 @@ static const struct reg_field bq25890_reg_fields[] = {
171172
[F_WD] = REG_FIELD(0x07, 4, 5),
172173
[F_TMR_EN] = REG_FIELD(0x07, 3, 3),
173174
[F_CHG_TMR] = REG_FIELD(0x07, 1, 2),
174-
[F_JEITA_ISET] = REG_FIELD(0x07, 0, 0),
175+
[F_JEITA_ISET] = REG_FIELD(0x07, 0, 0), // reserved on BQ25895
175176
/* REG08 */
176177
[F_BATCMP] = REG_FIELD(0x08, 5, 7),
177178
[F_VCLAMP] = REG_FIELD(0x08, 2, 4),
@@ -180,15 +181,15 @@ static const struct reg_field bq25890_reg_fields[] = {
180181
[F_FORCE_ICO] = REG_FIELD(0x09, 7, 7),
181182
[F_TMR2X_EN] = REG_FIELD(0x09, 6, 6),
182183
[F_BATFET_DIS] = REG_FIELD(0x09, 5, 5),
183-
[F_JEITA_VSET] = REG_FIELD(0x09, 4, 4),
184+
[F_JEITA_VSET] = REG_FIELD(0x09, 4, 4), // reserved on BQ25895
184185
[F_BATFET_DLY] = REG_FIELD(0x09, 3, 3),
185186
[F_BATFET_RST_EN] = REG_FIELD(0x09, 2, 2),
186187
[F_PUMPX_UP] = REG_FIELD(0x09, 1, 1),
187188
[F_PUMPX_DN] = REG_FIELD(0x09, 0, 0),
188189
/* REG0A */
189190
[F_BOOSTV] = REG_FIELD(0x0A, 4, 7),
190191
/* PFM_OTG_DIS 3 on BQ25896 */
191-
[F_BOOSTI] = REG_FIELD(0x0A, 0, 2),
192+
[F_BOOSTI] = REG_FIELD(0x0A, 0, 2), // reserved on BQ25895
192193
/* REG0B */
193194
[F_VBUS_STAT] = REG_FIELD(0x0B, 5, 7),
194195
[F_CHG_STAT] = REG_FIELD(0x0B, 3, 4),
@@ -392,6 +393,8 @@ static int bq25890_power_supply_get_property(struct power_supply *psy,
392393
case POWER_SUPPLY_PROP_MODEL_NAME:
393394
if (bq->chip_id == BQ25890_ID)
394395
val->strval = "BQ25890";
396+
else if (bq->chip_id == BQ25895_ID)
397+
val->strval = "BQ25895";
395398
else if (bq->chip_id == BQ25896_ID)
396399
val->strval = "BQ25896";
397400
else
@@ -862,7 +865,8 @@ static int bq25890_probe(struct i2c_client *client,
862865
return bq->chip_id;
863866
}
864867

865-
if ((bq->chip_id != BQ25890_ID) && (bq->chip_id != BQ25896_ID)) {
868+
if ((bq->chip_id != BQ25890_ID) && (bq->chip_id != BQ25895_ID)
869+
&& (bq->chip_id != BQ25896_ID)) {
866870
dev_err(dev, "Chip with ID=%d, not supported!\n", bq->chip_id);
867871
return -ENODEV;
868872
}

drivers/power/supply/cpcap-charger.c

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@
108108
#define CPCAP_REG_CRM_ICHRG_1A596 CPCAP_REG_CRM_ICHRG(0xe)
109109
#define CPCAP_REG_CRM_ICHRG_NO_LIMIT CPCAP_REG_CRM_ICHRG(0xf)
110110

111+
/* CPCAP_REG_VUSBC register bits needed for VBUS */
112+
#define CPCAP_BIT_VBUS_SWITCH BIT(0) /* VBUS boost to 5V */
113+
111114
enum {
112115
CPCAP_CHARGER_IIO_BATTDET,
113116
CPCAP_CHARGER_IIO_VOLTAGE,
@@ -130,7 +133,8 @@ struct cpcap_charger_ddata {
130133
struct power_supply *usb;
131134

132135
struct phy_companion comparator; /* For USB VBUS */
133-
bool vbus_enabled;
136+
unsigned int vbus_enabled:1;
137+
unsigned int feeding_vbus:1;
134138
atomic_t active;
135139

136140
int status;
@@ -325,7 +329,6 @@ static bool cpcap_charger_vbus_valid(struct cpcap_charger_ddata *ddata)
325329
}
326330

327331
/* VBUS control functions for the USB PHY companion */
328-
329332
static void cpcap_charger_vbus_work(struct work_struct *work)
330333
{
331334
struct cpcap_charger_ddata *ddata;
@@ -343,26 +346,39 @@ static void cpcap_charger_vbus_work(struct work_struct *work)
343346
return;
344347
}
345348

349+
ddata->feeding_vbus = true;
346350
cpcap_charger_set_cable_path(ddata, false);
347351
cpcap_charger_set_inductive_path(ddata, false);
348352

349353
error = cpcap_charger_set_state(ddata, 0, 0, 0);
350354
if (error)
351355
goto out_err;
352356

357+
error = regmap_update_bits(ddata->reg, CPCAP_REG_VUSBC,
358+
CPCAP_BIT_VBUS_SWITCH,
359+
CPCAP_BIT_VBUS_SWITCH);
360+
if (error)
361+
goto out_err;
362+
353363
error = regmap_update_bits(ddata->reg, CPCAP_REG_CRM,
354364
CPCAP_REG_CRM_RVRSMODE,
355365
CPCAP_REG_CRM_RVRSMODE);
356366
if (error)
357367
goto out_err;
358368
} else {
369+
error = regmap_update_bits(ddata->reg, CPCAP_REG_VUSBC,
370+
CPCAP_BIT_VBUS_SWITCH, 0);
371+
if (error)
372+
goto out_err;
373+
359374
error = regmap_update_bits(ddata->reg, CPCAP_REG_CRM,
360375
CPCAP_REG_CRM_RVRSMODE, 0);
361376
if (error)
362377
goto out_err;
363378

364379
cpcap_charger_set_cable_path(ddata, true);
365380
cpcap_charger_set_inductive_path(ddata, true);
381+
ddata->feeding_vbus = false;
366382
}
367383

368384
return;
@@ -431,7 +447,8 @@ static void cpcap_usb_detect(struct work_struct *work)
431447
if (error)
432448
return;
433449

434-
if (cpcap_charger_vbus_valid(ddata) && s.chrgcurr1) {
450+
if (!ddata->feeding_vbus && cpcap_charger_vbus_valid(ddata) &&
451+
s.chrgcurr1) {
435452
int max_current;
436453

437454
if (cpcap_charger_battery_found(ddata))

drivers/power/supply/isp1704_charger.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ static inline int isp1704_test_ulpi(struct isp1704_charger *isp)
342342
int vendor;
343343
int product;
344344
int i;
345-
int ret = -ENODEV;
345+
int ret;
346346

347347
/* Test ULPI interface */
348348
ret = isp1704_write(isp, ULPI_SCRATCH, 0xaa);

drivers/power/supply/max17042_battery.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -511,15 +511,15 @@ static inline void max17042_override_por(struct regmap *map,
511511
regmap_write(map, reg, value);
512512
}
513513

514-
static inline void max10742_unlock_model(struct max17042_chip *chip)
514+
static inline void max17042_unlock_model(struct max17042_chip *chip)
515515
{
516516
struct regmap *map = chip->regmap;
517517

518518
regmap_write(map, MAX17042_MLOCKReg1, MODEL_UNLOCK1);
519519
regmap_write(map, MAX17042_MLOCKReg2, MODEL_UNLOCK2);
520520
}
521521

522-
static inline void max10742_lock_model(struct max17042_chip *chip)
522+
static inline void max17042_lock_model(struct max17042_chip *chip)
523523
{
524524
struct regmap *map = chip->regmap;
525525

@@ -577,7 +577,7 @@ static int max17042_init_model(struct max17042_chip *chip)
577577
if (!temp_data)
578578
return -ENOMEM;
579579

580-
max10742_unlock_model(chip);
580+
max17042_unlock_model(chip);
581581
max17042_write_model_data(chip, MAX17042_MODELChrTbl,
582582
table_size);
583583
max17042_read_model_data(chip, MAX17042_MODELChrTbl, temp_data,
@@ -589,7 +589,7 @@ static int max17042_init_model(struct max17042_chip *chip)
589589
temp_data,
590590
table_size);
591591

592-
max10742_lock_model(chip);
592+
max17042_lock_model(chip);
593593
kfree(temp_data);
594594

595595
return ret;

0 commit comments

Comments
 (0)