diff options
author | Pali Rohár <pali.rohar@gmail.com> | 2011-10-31 20:43:09 -0400 |
---|---|---|
committer | Anton Vorontsov <cbouatmailru@gmail.com> | 2011-11-25 15:00:52 -0500 |
commit | c6cd4f267d442f2ce279024adb03a69e8608e0f6 (patch) | |
tree | ef55415b14c002235cfdefc9b7f9c6a2e026a2da /drivers/power/bq27x00_battery.c | |
parent | 270968c0984aeed096da3cfffb0e131f4c416166 (diff) |
bq27x00_battery: Fix reporting error messages
* Do not be noise if battery is not calibrated (use dev_dbg)
Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
Diffstat (limited to 'drivers/power/bq27x00_battery.c')
-rw-r--r-- | drivers/power/bq27x00_battery.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/drivers/power/bq27x00_battery.c b/drivers/power/bq27x00_battery.c index c4c403e5542c..82ab6ca45f58 100644 --- a/drivers/power/bq27x00_battery.c +++ b/drivers/power/bq27x00_battery.c | |||
@@ -155,7 +155,7 @@ static int bq27x00_battery_read_rsoc(struct bq27x00_device_info *di) | |||
155 | rsoc = bq27x00_read(di, BQ27000_REG_RSOC, true); | 155 | rsoc = bq27x00_read(di, BQ27000_REG_RSOC, true); |
156 | 156 | ||
157 | if (rsoc < 0) | 157 | if (rsoc < 0) |
158 | dev_err(di->dev, "error reading relative State-of-Charge\n"); | 158 | dev_dbg(di->dev, "error reading relative State-of-Charge\n"); |
159 | 159 | ||
160 | return rsoc; | 160 | return rsoc; |
161 | } | 161 | } |
@@ -170,7 +170,8 @@ static int bq27x00_battery_read_charge(struct bq27x00_device_info *di, u8 reg) | |||
170 | 170 | ||
171 | charge = bq27x00_read(di, reg, false); | 171 | charge = bq27x00_read(di, reg, false); |
172 | if (charge < 0) { | 172 | if (charge < 0) { |
173 | dev_err(di->dev, "error reading nominal available capacity\n"); | 173 | dev_dbg(di->dev, "error reading charge register %02x: %d\n", |
174 | reg, charge); | ||
174 | return charge; | 175 | return charge; |
175 | } | 176 | } |
176 | 177 | ||
@@ -214,7 +215,7 @@ static int bq27x00_battery_read_ilmd(struct bq27x00_device_info *di) | |||
214 | ilmd = bq27x00_read(di, BQ27000_REG_ILMD, true); | 215 | ilmd = bq27x00_read(di, BQ27000_REG_ILMD, true); |
215 | 216 | ||
216 | if (ilmd < 0) { | 217 | if (ilmd < 0) { |
217 | dev_err(di->dev, "error reading initial last measured discharge\n"); | 218 | dev_dbg(di->dev, "error reading initial last measured discharge\n"); |
218 | return ilmd; | 219 | return ilmd; |
219 | } | 220 | } |
220 | 221 | ||
@@ -236,7 +237,7 @@ static int bq27x00_battery_read_energy(struct bq27x00_device_info *di) | |||
236 | 237 | ||
237 | ae = bq27x00_read(di, BQ27x00_REG_AE, false); | 238 | ae = bq27x00_read(di, BQ27x00_REG_AE, false); |
238 | if (ae < 0) { | 239 | if (ae < 0) { |
239 | dev_err(di->dev, "error reading available energy\n"); | 240 | dev_dbg(di->dev, "error reading available energy\n"); |
240 | return ae; | 241 | return ae; |
241 | } | 242 | } |
242 | 243 | ||
@@ -295,7 +296,8 @@ static int bq27x00_battery_read_time(struct bq27x00_device_info *di, u8 reg) | |||
295 | 296 | ||
296 | tval = bq27x00_read(di, reg, false); | 297 | tval = bq27x00_read(di, reg, false); |
297 | if (tval < 0) { | 298 | if (tval < 0) { |
298 | dev_err(di->dev, "error reading register %02x: %d\n", reg, tval); | 299 | dev_dbg(di->dev, "error reading time register %02x: %d\n", |
300 | reg, tval); | ||
299 | return tval; | 301 | return tval; |
300 | } | 302 | } |
301 | 303 | ||
@@ -313,6 +315,7 @@ static void bq27x00_update(struct bq27x00_device_info *di) | |||
313 | cache.flags = bq27x00_read(di, BQ27x00_REG_FLAGS, is_bq27500); | 315 | cache.flags = bq27x00_read(di, BQ27x00_REG_FLAGS, is_bq27500); |
314 | if (cache.flags >= 0) { | 316 | if (cache.flags >= 0) { |
315 | if (!is_bq27500 && (cache.flags & BQ27000_FLAG_CI)) { | 317 | if (!is_bq27500 && (cache.flags & BQ27000_FLAG_CI)) { |
318 | dev_info(di->dev, "battery is not calibrated! ignoring capacity values\n"); | ||
316 | cache.capacity = -ENODATA; | 319 | cache.capacity = -ENODATA; |
317 | cache.energy = -ENODATA; | 320 | cache.energy = -ENODATA; |
318 | cache.time_to_empty = -ENODATA; | 321 | cache.time_to_empty = -ENODATA; |
@@ -369,8 +372,10 @@ static int bq27x00_battery_current(struct bq27x00_device_info *di, | |||
369 | int flags; | 372 | int flags; |
370 | 373 | ||
371 | curr = bq27x00_read(di, BQ27x00_REG_AI, false); | 374 | curr = bq27x00_read(di, BQ27x00_REG_AI, false); |
372 | if (curr < 0) | 375 | if (curr < 0) { |
376 | dev_err(di->dev, "error reading current\n"); | ||
373 | return curr; | 377 | return curr; |
378 | } | ||
374 | 379 | ||
375 | if (di->chip == BQ27500) { | 380 | if (di->chip == BQ27500) { |
376 | /* bq27500 returns signed value */ | 381 | /* bq27500 returns signed value */ |
@@ -460,8 +465,10 @@ static int bq27x00_battery_voltage(struct bq27x00_device_info *di, | |||
460 | int volt; | 465 | int volt; |
461 | 466 | ||
462 | volt = bq27x00_read(di, BQ27x00_REG_VOLT, false); | 467 | volt = bq27x00_read(di, BQ27x00_REG_VOLT, false); |
463 | if (volt < 0) | 468 | if (volt < 0) { |
469 | dev_err(di->dev, "error reading voltage\n"); | ||
464 | return volt; | 470 | return volt; |
471 | } | ||
465 | 472 | ||
466 | val->intval = volt * 1000; | 473 | val->intval = volt * 1000; |
467 | 474 | ||