Skip to content

Commit fcc015c

Browse files
Ramakrishna PallalaAnton Vorontsov
authored andcommitted
smb347-charger: Clean up battery attributes
CURRENT_NOW and VOLTAGE_NOW should be instantaneous readings from power supply(ex: battery). smb347 charger driver reports charge voltage for VOLTAGE_NOW and charge current for CURRENT_NOW attributes which are not instantaneous readings. This patch removes the battery VOLTAGE_NOW and CURRENT_NOW properties from the driver and also removes hw_to_current() which is not required anymore. Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
1 parent 9a8422d commit fcc015c

1 file changed

Lines changed: 0 additions & 49 deletions

File tree

‎drivers/power/smb347-charger.c‎

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -195,14 +195,6 @@ static const unsigned int ccc_tbl[] = {
195195
1200000,
196196
};
197197

198-
/* Convert register value to current using lookup table */
199-
static int hw_to_current(const unsigned int *tbl, size_t size, unsigned int val)
200-
{
201-
if (val >= size)
202-
return -EINVAL;
203-
return tbl[val];
204-
}
205-
206198
/* Convert current to register value using lookup table */
207199
static int current_to_hw(const unsigned int *tbl, size_t size, unsigned int val)
208200
{
@@ -891,7 +883,6 @@ static int smb347_battery_get_property(struct power_supply *psy,
891883
struct smb347_charger *smb =
892884
container_of(psy, struct smb347_charger, battery);
893885
const struct smb347_charger_platform_data *pdata = smb->pdata;
894-
unsigned int v;
895886
int ret;
896887

897888
ret = smb347_update_ps_status(smb);
@@ -943,44 +934,6 @@ static int smb347_battery_get_property(struct power_supply *psy,
943934
val->intval = pdata->battery_info.voltage_max_design;
944935
break;
945936

946-
case POWER_SUPPLY_PROP_VOLTAGE_NOW:
947-
if (!smb347_is_ps_online(smb))
948-
return -ENODATA;
949-
ret = regmap_read(smb->regmap, STAT_A, &v);
950-
if (ret < 0)
951-
return ret;
952-
953-
v &= STAT_A_FLOAT_VOLTAGE_MASK;
954-
if (v > 0x3d)
955-
v = 0x3d;
956-
957-
val->intval = 3500000 + v * 20000;
958-
break;
959-
960-
case POWER_SUPPLY_PROP_CURRENT_NOW:
961-
if (!smb347_is_ps_online(smb))
962-
return -ENODATA;
963-
964-
ret = regmap_read(smb->regmap, STAT_B, &v);
965-
if (ret < 0)
966-
return ret;
967-
968-
/*
969-
* The current value is composition of FCC and PCC values
970-
* and we can detect which table to use from bit 5.
971-
*/
972-
if (v & 0x20) {
973-
val->intval = hw_to_current(fcc_tbl,
974-
ARRAY_SIZE(fcc_tbl),
975-
v & 7);
976-
} else {
977-
v >>= 3;
978-
val->intval = hw_to_current(pcc_tbl,
979-
ARRAY_SIZE(pcc_tbl),
980-
v & 7);
981-
}
982-
break;
983-
984937
case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN:
985938
val->intval = pdata->battery_info.charge_full_design;
986939
break;
@@ -1002,8 +955,6 @@ static enum power_supply_property smb347_battery_properties[] = {
1002955
POWER_SUPPLY_PROP_TECHNOLOGY,
1003956
POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN,
1004957
POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN,
1005-
POWER_SUPPLY_PROP_VOLTAGE_NOW,
1006-
POWER_SUPPLY_PROP_CURRENT_NOW,
1007958
POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
1008959
POWER_SUPPLY_PROP_MODEL_NAME,
1009960
};

0 commit comments

Comments
 (0)