linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Kemnade <andreas@kemnade.info>
To: letux-kernel@openphoenux.org, johan@kernel.org,
	robh+dt@kernel.org, mark.rutland@arm.com,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Andreas Kemnade <andreas@kemnade.info>
Subject: [PATCH v3 2/6] gnss: sirf: set power state initially off
Date: Wed, 16 Jan 2019 22:18:08 +0100	[thread overview]
Message-ID: <20190116211812.6337-3-andreas@kemnade.info> (raw)
In-Reply-To: <20190116211812.6337-1-andreas@kemnade.info>

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


  parent reply	other threads:[~2019-01-16 21:19 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-16 21:18 [PATCH v3 0/6] gnss: sirf: add support for w2sg0004 + lna Andreas Kemnade
2019-01-16 21:18 ` [PATCH v3 1/6] gnss: sirf: write data to gnss only when the gnss device is open Andreas Kemnade
2019-01-16 21:18 ` Andreas Kemnade [this message]
2019-01-22 17:22   ` [PATCH v3 2/6] gnss: sirf: set power state initially off Johan Hovold
2019-01-16 21:18 ` [PATCH v3 3/6] gnss: sirf: add support for configurations without wakeup signal Andreas Kemnade
2019-01-22 17:56   ` Johan Hovold
2019-01-16 21:18 ` [PATCH v3 4/6] dt-bindings: gnss: add w2sg0004 compatible string Andreas Kemnade
2019-01-16 21:18 ` [PATCH v3 5/6] gnss: sirf: add a separate supply for a lna Andreas Kemnade
2019-01-22 18:03   ` Johan Hovold
2019-01-16 21:18 ` [PATCH v3 6/6] dt-bindings: gnss: add lna-supply property Andreas Kemnade
2019-01-17 15:58   ` Rob Herring
2019-01-22 18:11   ` Johan Hovold

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=20190116211812.6337-3-andreas@kemnade.info \
    --to=andreas@kemnade.info \
    --cc=devicetree@vger.kernel.org \
    --cc=johan@kernel.org \
    --cc=letux-kernel@openphoenux.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=robh+dt@kernel.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;
as well as URLs for NNTP newsgroup(s).