Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

power: supply: bq25980: Move props from battery node

Currently POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT and
POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE are exposed on
the battery node and this is incorrect.

This patch exposes both of them on the charger node rather
than the battery node.

Fixes: 5069185fc18e ("power: supply: bq25980: Add support for the BQ259xx family")
Signed-off-by: Ricardo Rivera-Matos <r-rivera-matos@ti.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>

authored by

Ricardo Rivera-Matos and committed by
Sebastian Reichel
04722cec 25095550

+12 -28
+12 -28
drivers/power/supply/bq25980_charger.c
··· 606 606 return 0; 607 607 } 608 608 609 - static int bq25980_set_battery_property(struct power_supply *psy, 610 - enum power_supply_property psp, 611 - const union power_supply_propval *val) 612 - { 613 - struct bq25980_device *bq = power_supply_get_drvdata(psy); 614 - int ret = 0; 615 - 616 - switch (psp) { 617 - case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT: 618 - ret = bq25980_set_const_charge_curr(bq, val->intval); 619 - if (ret) 620 - return ret; 621 - break; 622 - 623 - case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE: 624 - ret = bq25980_set_const_charge_volt(bq, val->intval); 625 - if (ret) 626 - return ret; 627 - break; 628 - 629 - default: 630 - return -EINVAL; 631 - } 632 - 633 - return ret; 634 - } 635 - 636 609 static int bq25980_get_battery_property(struct power_supply *psy, 637 610 enum power_supply_property psp, 638 611 union power_supply_propval *val) ··· 670 697 671 698 case POWER_SUPPLY_PROP_STATUS: 672 699 ret = bq25980_set_chg_en(bq, val->intval); 700 + if (ret) 701 + return ret; 702 + break; 703 + 704 + case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT: 705 + ret = bq25980_set_const_charge_curr(bq, val->intval); 706 + if (ret) 707 + return ret; 708 + break; 709 + 710 + case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE: 711 + ret = bq25980_set_const_charge_volt(bq, val->intval); 673 712 if (ret) 674 713 return ret; 675 714 break; ··· 907 922 .name = "bq25980-battery", 908 923 .type = POWER_SUPPLY_TYPE_BATTERY, 909 924 .get_property = bq25980_get_battery_property, 910 - .set_property = bq25980_set_battery_property, 911 925 .properties = bq25980_battery_props, 912 926 .num_properties = ARRAY_SIZE(bq25980_battery_props), 913 927 .property_is_writeable = bq25980_property_is_writeable,