diff options
author | Jonas Aaberg <jonas.aberg@stericsson.com> | 2012-02-27 05:02:44 -0500 |
---|---|---|
committer | Lee Jones <lee.jones@linaro.org> | 2012-12-11 03:43:52 -0500 |
commit | f6271b4fb1d5ce7d6cf2c84a96b56cca4ceca372 (patch) | |
tree | d191df216d4b443c6a8909b1dee2c72a7811a137 | |
parent | e32ad07cea1f198db1cc6c2055dd8471b562a535 (diff) |
ab8500_btemp: Detect battery type in workqueue
Detect battery type in work queue instead of probe.
This reduces the system boot time with 1.5s.
Signed-off-by: Jonas Aaberg <jonas.aberg@stericsson.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Reviewed-by: Karl KOMIEROWSKI <karl.komierowski@stericsson.com>
-rw-r--r-- | drivers/power/ab8500_btemp.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/power/ab8500_btemp.c b/drivers/power/ab8500_btemp.c index 8135542ee746..5d1bf0bd6fa5 100644 --- a/drivers/power/ab8500_btemp.c +++ b/drivers/power/ab8500_btemp.c | |||
@@ -84,6 +84,7 @@ struct ab8500_btemp_ranges { | |||
84 | * @btemp_ranges: Battery temperature range structure | 84 | * @btemp_ranges: Battery temperature range structure |
85 | * @btemp_wq: Work queue for measuring the temperature periodically | 85 | * @btemp_wq: Work queue for measuring the temperature periodically |
86 | * @btemp_periodic_work: Work for measuring the temperature periodically | 86 | * @btemp_periodic_work: Work for measuring the temperature periodically |
87 | * @initialized: True if battery id read. | ||
87 | */ | 88 | */ |
88 | struct ab8500_btemp { | 89 | struct ab8500_btemp { |
89 | struct device *dev; | 90 | struct device *dev; |
@@ -100,6 +101,7 @@ struct ab8500_btemp { | |||
100 | struct ab8500_btemp_ranges btemp_ranges; | 101 | struct ab8500_btemp_ranges btemp_ranges; |
101 | struct workqueue_struct *btemp_wq; | 102 | struct workqueue_struct *btemp_wq; |
102 | struct delayed_work btemp_periodic_work; | 103 | struct delayed_work btemp_periodic_work; |
104 | bool initialized; | ||
103 | }; | 105 | }; |
104 | 106 | ||
105 | /* BTEMP power supply properties */ | 107 | /* BTEMP power supply properties */ |
@@ -569,6 +571,13 @@ static void ab8500_btemp_periodic_work(struct work_struct *work) | |||
569 | struct ab8500_btemp *di = container_of(work, | 571 | struct ab8500_btemp *di = container_of(work, |
570 | struct ab8500_btemp, btemp_periodic_work.work); | 572 | struct ab8500_btemp, btemp_periodic_work.work); |
571 | 573 | ||
574 | if (!di->initialized) { | ||
575 | di->initialized = true; | ||
576 | /* Identify the battery */ | ||
577 | if (ab8500_btemp_id(di) < 0) | ||
578 | dev_warn(di->dev, "failed to identify the battery\n"); | ||
579 | } | ||
580 | |||
572 | di->bat_temp = ab8500_btemp_measure_temp(di); | 581 | di->bat_temp = ab8500_btemp_measure_temp(di); |
573 | 582 | ||
574 | if (di->bat_temp != di->prev_bat_temp) { | 583 | if (di->bat_temp != di->prev_bat_temp) { |
@@ -998,6 +1007,8 @@ static int __devinit ab8500_btemp_probe(struct platform_device *pdev) | |||
998 | di->parent = dev_get_drvdata(pdev->dev.parent); | 1007 | di->parent = dev_get_drvdata(pdev->dev.parent); |
999 | di->gpadc = ab8500_gpadc_get("ab8500-gpadc.0"); | 1008 | di->gpadc = ab8500_gpadc_get("ab8500-gpadc.0"); |
1000 | 1009 | ||
1010 | di->initialized = false; | ||
1011 | |||
1001 | /* BTEMP supply */ | 1012 | /* BTEMP supply */ |
1002 | di->btemp_psy.name = "ab8500_btemp"; | 1013 | di->btemp_psy.name = "ab8500_btemp"; |
1003 | di->btemp_psy.type = POWER_SUPPLY_TYPE_BATTERY; | 1014 | di->btemp_psy.type = POWER_SUPPLY_TYPE_BATTERY; |
@@ -1022,10 +1033,6 @@ static int __devinit ab8500_btemp_probe(struct platform_device *pdev) | |||
1022 | INIT_DEFERRABLE_WORK(&di->btemp_periodic_work, | 1033 | INIT_DEFERRABLE_WORK(&di->btemp_periodic_work, |
1023 | ab8500_btemp_periodic_work); | 1034 | ab8500_btemp_periodic_work); |
1024 | 1035 | ||
1025 | /* Identify the battery */ | ||
1026 | if (ab8500_btemp_id(di) < 0) | ||
1027 | dev_warn(di->dev, "failed to identify the battery\n"); | ||
1028 | |||
1029 | /* Set BTEMP thermal limits. Low and Med are fixed */ | 1036 | /* Set BTEMP thermal limits. Low and Med are fixed */ |
1030 | di->btemp_ranges.btemp_low_limit = BTEMP_THERMAL_LOW_LIMIT; | 1037 | di->btemp_ranges.btemp_low_limit = BTEMP_THERMAL_LOW_LIMIT; |
1031 | di->btemp_ranges.btemp_med_limit = BTEMP_THERMAL_MED_LIMIT; | 1038 | di->btemp_ranges.btemp_med_limit = BTEMP_THERMAL_MED_LIMIT; |