Thread (12 messages) 12 messages, 3 authors, 2019-01-22
STALE2719d
Revisions (4)
  1. v1 [diff vs current]
  2. v2 [diff vs current]
  3. v3 current
  4. v4 [diff vs current]

[PATCH v3 2/6] gnss: sirf: set power state initially off

From: Andreas Kemnade <andreas@kemnade.info>
Date: 2019-01-16 21:19:13
Also in: lkml
Subsystem: gnss subsystem, the rest · Maintainers: Johan Hovold, Linus Torvalds

On the GTA04 mobile phone, it was observed that the gps was powered
on sometimes intially. Generally a reboot without powering the device
off (direct reset of the processor, reboot from a system where gps
power toggle was done in userspace) or glitches on the gpio pin during
power on could cause this problem.
This has the drawback that probing takes some seconds on
systems without wakeup signal. On systems with wakeup signal
this penalty is much lower.
But if the chip is initially on and that is not fixed, the suspend
current will be multiple times higher, so this sacrifice should
be justified

Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
---
- was part of 2/5 in v2

 drivers/gnss/sirf.c | 7 +++++++
 1 file changed, 7 insertions(+)
diff --git a/drivers/gnss/sirf.c b/drivers/gnss/sirf.c
index b21e14351b82..c7706b91f6f0 100644
--- a/drivers/gnss/sirf.c
+++ b/drivers/gnss/sirf.c
@@ -367,6 +367,13 @@ static int sirf_probe(struct serdev_device *serdev)
 	if (IS_ENABLED(CONFIG_PM)) {
 		pm_runtime_set_suspended(dev);	/* clear runtime_error flag */
 		pm_runtime_enable(dev);
+		/*
+		 * Device might be enabled at boot, so ensure it is off.
+		 * This was observed in practice on GTA04.
+		 */
+		ret = sirf_set_active(data, false);
+		if (ret < 0)
+			goto err_disable_rpm;
 	} else {
 		ret = sirf_runtime_resume(dev);
 		if (ret < 0)
-- 
2.11.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help