Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 350581
b: refs/heads/master
c: f6271b4
h: refs/heads/master
i:
  350579: 2216247
v: v3
  • Loading branch information
Jonas Aaberg authored and Lee Jones committed Dec 11, 2012
1 parent 8ca5648 commit c9d4de7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e32ad07cea1f198db1cc6c2055dd8471b562a535
refs/heads/master: f6271b4fb1d5ce7d6cf2c84a96b56cca4ceca372
15 changes: 11 additions & 4 deletions trunk/drivers/power/ab8500_btemp.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ struct ab8500_btemp_ranges {
* @btemp_ranges: Battery temperature range structure
* @btemp_wq: Work queue for measuring the temperature periodically
* @btemp_periodic_work: Work for measuring the temperature periodically
* @initialized: True if battery id read.
*/
struct ab8500_btemp {
struct device *dev;
Expand All @@ -100,6 +101,7 @@ struct ab8500_btemp {
struct ab8500_btemp_ranges btemp_ranges;
struct workqueue_struct *btemp_wq;
struct delayed_work btemp_periodic_work;
bool initialized;
};

/* BTEMP power supply properties */
Expand Down Expand Up @@ -569,6 +571,13 @@ static void ab8500_btemp_periodic_work(struct work_struct *work)
struct ab8500_btemp *di = container_of(work,
struct ab8500_btemp, btemp_periodic_work.work);

if (!di->initialized) {
di->initialized = true;
/* Identify the battery */
if (ab8500_btemp_id(di) < 0)
dev_warn(di->dev, "failed to identify the battery\n");
}

di->bat_temp = ab8500_btemp_measure_temp(di);

if (di->bat_temp != di->prev_bat_temp) {
Expand Down Expand Up @@ -998,6 +1007,8 @@ static int __devinit ab8500_btemp_probe(struct platform_device *pdev)
di->parent = dev_get_drvdata(pdev->dev.parent);
di->gpadc = ab8500_gpadc_get("ab8500-gpadc.0");

di->initialized = false;

/* BTEMP supply */
di->btemp_psy.name = "ab8500_btemp";
di->btemp_psy.type = POWER_SUPPLY_TYPE_BATTERY;
Expand All @@ -1022,10 +1033,6 @@ static int __devinit ab8500_btemp_probe(struct platform_device *pdev)
INIT_DEFERRABLE_WORK(&di->btemp_periodic_work,
ab8500_btemp_periodic_work);

/* Identify the battery */
if (ab8500_btemp_id(di) < 0)
dev_warn(di->dev, "failed to identify the battery\n");

/* Set BTEMP thermal limits. Low and Med are fixed */
di->btemp_ranges.btemp_low_limit = BTEMP_THERMAL_LOW_LIMIT;
di->btemp_ranges.btemp_med_limit = BTEMP_THERMAL_MED_LIMIT;
Expand Down

0 comments on commit c9d4de7

Please sign in to comment.