From: Lee Jones <lee.jones@linaro.org>
To: linux-kernel@vger.kernel.org
Cc: linus.walleij@stericsson.com, arnd@arndb.de, cbou@mail.ru,
dwmw2@infradead.org, rajanikanth.hv@linaro.org,
Jonas Aaberg <jonas.aberg@stericsson.com>,
Lee Jones <lee.jones@linaro.org>
Subject: [PATCH 03/12] ab8500_btemp: Detect battery type in workqueue
Date: Fri, 30 Nov 2012 11:57:25 +0000 [thread overview]
Message-ID: <1354276654-590-4-git-send-email-lee.jones@linaro.org> (raw)
In-Reply-To: <1354276654-590-1-git-send-email-lee.jones@linaro.org>
From: Jonas Aaberg <jonas.aberg@stericsson.com>
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>
---
drivers/power/ab8500_btemp.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/drivers/power/ab8500_btemp.c b/drivers/power/ab8500_btemp.c
index 8135542..5d1bf0b 100644
--- a/drivers/power/ab8500_btemp.c
+++ b/drivers/power/ab8500_btemp.c
@@ -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;
@@ -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 */
@@ -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) {
@@ -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;
@@ -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;
--
1.7.9.5
next prev parent reply other threads:[~2012-11-30 12:00 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-30 11:57 [PATCH 00/12] Refactoring the ab8500 battery management drivers Lee Jones
2012-11-30 11:57 ` [PATCH 01/12] ab8500_charger: Charger current step-up/down Lee Jones
2012-11-30 11:57 ` [PATCH 02/12] ab8500_fg: Don't clear the CCMuxOffset bit Lee Jones
2012-11-30 11:57 ` Lee Jones [this message]
2012-11-30 11:57 ` [PATCH 04/12] ab8500_btemp: Fix crazy tabbing implementation Lee Jones
2012-11-30 11:57 ` [PATCH 05/12] ab8500-bmdata: Re-jiggle bmdevs_of_probe to be more succinct Lee Jones
2012-11-30 11:57 ` [PATCH 06/12] ab8500_bm: Rename battery management platform data to something more logical Lee Jones
2012-11-30 11:57 ` [PATCH 07/12] ab8500_bm: Always send platform specific battery information via pdata Lee Jones
2012-11-30 11:57 ` [PATCH 08/12] ab8500_btemp: Reorder obtainment of platform specific battery management data Lee Jones
2012-11-30 11:57 ` [PATCH 09/12] ab8500_charger: " Lee Jones
2012-11-30 11:57 ` [PATCH 10/12] ab8500_fg: " Lee Jones
2012-11-30 11:57 ` [PATCH 11/12] abx500_chargalg: " Lee Jones
2012-11-30 11:57 ` [PATCH 12/12] ab8500_bm: Make the battery Device Tree node reference less cryptic Lee Jones
2012-12-01 18:45 ` [PATCH 00/12] Refactoring the ab8500 battery management drivers Linus Walleij
2012-12-11 3:34 ` Anton Vorontsov
2012-12-11 8:40 ` Lee Jones
2012-12-11 10:30 ` Lee Jones
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1354276654-590-4-git-send-email-lee.jones@linaro.org \
--to=lee.jones@linaro.org \
--cc=arnd@arndb.de \
--cc=cbou@mail.ru \
--cc=dwmw2@infradead.org \
--cc=jonas.aberg@stericsson.com \
--cc=linus.walleij@stericsson.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rajanikanth.hv@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®