diff options
| -rw-r--r-- | drivers/power/smb347-charger.c | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/drivers/power/smb347-charger.c b/drivers/power/smb347-charger.c index cf31b31cc653..09d19d241eed 100644 --- a/drivers/power/smb347-charger.c +++ b/drivers/power/smb347-charger.c | |||
| @@ -195,14 +195,6 @@ static const unsigned int ccc_tbl[] = { | |||
| 195 | 1200000, | 195 | 1200000, |
| 196 | }; | 196 | }; |
| 197 | 197 | ||
| 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 | |||
| 206 | /* Convert current to register value using lookup table */ | 198 | /* Convert current to register value using lookup table */ |
| 207 | static int current_to_hw(const unsigned int *tbl, size_t size, unsigned int val) | 199 | static int current_to_hw(const unsigned int *tbl, size_t size, unsigned int val) |
| 208 | { | 200 | { |
| @@ -891,7 +883,6 @@ static int smb347_battery_get_property(struct power_supply *psy, | |||
| 891 | struct smb347_charger *smb = | 883 | struct smb347_charger *smb = |
| 892 | container_of(psy, struct smb347_charger, battery); | 884 | container_of(psy, struct smb347_charger, battery); |
| 893 | const struct smb347_charger_platform_data *pdata = smb->pdata; | 885 | const struct smb347_charger_platform_data *pdata = smb->pdata; |
| 894 | unsigned int v; | ||
| 895 | int ret; | 886 | int ret; |
| 896 | 887 | ||
| 897 | ret = smb347_update_ps_status(smb); | 888 | ret = smb347_update_ps_status(smb); |
| @@ -943,44 +934,6 @@ static int smb347_battery_get_property(struct power_supply *psy, | |||
| 943 | val->intval = pdata->battery_info.voltage_max_design; | 934 | val->intval = pdata->battery_info.voltage_max_design; |
| 944 | break; | 935 | break; |
| 945 | 936 | ||
| 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 | |||
| 984 | case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN: | 937 | case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN: |
| 985 | val->intval = pdata->battery_info.charge_full_design; | 938 | val->intval = pdata->battery_info.charge_full_design; |
| 986 | break; | 939 | break; |
| @@ -1002,8 +955,6 @@ static enum power_supply_property smb347_battery_properties[] = { | |||
| 1002 | POWER_SUPPLY_PROP_TECHNOLOGY, | 955 | POWER_SUPPLY_PROP_TECHNOLOGY, |
| 1003 | POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN, | 956 | POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN, |
| 1004 | POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN, | 957 | POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN, |
| 1005 | POWER_SUPPLY_PROP_VOLTAGE_NOW, | ||
| 1006 | POWER_SUPPLY_PROP_CURRENT_NOW, | ||
| 1007 | POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN, | 958 | POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN, |
| 1008 | POWER_SUPPLY_PROP_MODEL_NAME, | 959 | POWER_SUPPLY_PROP_MODEL_NAME, |
| 1009 | }; | 960 | }; |
