diff options
author | Laxman Dewangan <ldewangan@nvidia.com> | 2014-04-25 16:10:12 +0530 |
---|---|---|
committer | Mandar Padmawar <mpadmawar@nvidia.com> | 2014-05-07 01:16:45 -0700 |
commit | 774f8218938df64ff19de0de31ab78608bb442f8 (patch) | |
tree | 45f0547153a1ed99e825058b19a32661def357c1 /drivers/power | |
parent | 91bd52d1b1eb9cacee9883bba874f594b314ed65 (diff) |
power: bq2419x: correctly check for thermal profile data
The number of entry for temp range on DT node is counted
using of calls. If there is no entry then it returns -ve
error. Taking care of -ve returns on the entry count.
This will avoid the wrong error message as:
bq2419x 1-006b: voltage thermal profile is not correct
Change-Id: I573d392123c15241c521c3c3d80f988b8b1f25f7
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: http://git-master/r/401497
Reviewed-on: http://git-master/r/405641
GVS: Gerrit_Virtual_Submit
Diffstat (limited to 'drivers/power')
-rw-r--r-- | drivers/power/bq2419x-charger.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/drivers/power/bq2419x-charger.c b/drivers/power/bq2419x-charger.c index 057c2646fa14..fad32702daef 100644 --- a/drivers/power/bq2419x-charger.c +++ b/drivers/power/bq2419x-charger.c @@ -1299,6 +1299,7 @@ static struct bq2419x_platform_data *bq2419x_dt_parse(struct i2c_client *client) batt_reg_node = of_find_node_by_name(np, "charger"); if (batt_reg_node) { int temp_range_len, chg_current_lim_len, chg_voltage_lim_len; + int count; int wdt_timeout; int chg_restart_time; int auto_recharge_time_power_off; @@ -1408,27 +1409,32 @@ static struct bq2419x_platform_data *bq2419x_dt_parse(struct i2c_client *client) chg_pdata->tz_name = of_get_property(batt_reg_node, "ti,thermal-zone", NULL); - temp_range_len = of_property_count_u32(batt_reg_node, - "ti,temp-range"); - chg_current_lim_len = of_property_count_u32(batt_reg_node, + count = of_property_count_u32(batt_reg_node, "ti,temp-range"); + temp_range_len = (count > 0) ? count : 0; + + count = of_property_count_u32(batt_reg_node, "ti,charge-current-limit"); - if (!chg_current_lim_len) - chg_current_lim_len = of_property_count_u32(batt_reg_node, + if (count <= 0) + count = of_property_count_u32(batt_reg_node, "ti,charge-thermal-current-limit"); - chg_voltage_lim_len = of_property_count_u32(batt_reg_node, + chg_current_lim_len = (count > 0) ? count : 0; + + count = of_property_count_u32(batt_reg_node, "ti,charge-thermal-voltage-limit"); - if (temp_range_len < 0) + chg_voltage_lim_len = (count > 0) ? count : 0; + + if (!temp_range_len) goto skip_therm_profile; if (temp_range_len != chg_current_lim_len) { dev_info(&client->dev, - "thermal profile data is not correct\n"); + "current thermal profile is not correct\n"); goto skip_therm_profile; } if (chg_voltage_lim_len && (temp_range_len != chg_voltage_lim_len)) { dev_info(&client->dev, - "thermal profile data is not correct\n"); + "voltage thermal profile is not correct\n"); goto skip_therm_profile; } |