Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7658263imu; Tue, 22 Jan 2019 09:23:50 -0800 (PST) X-Google-Smtp-Source: ALg8bN48GwXSjLyWnHXgVZglObFUeKJ5kE9KhVdNCZby4YiEMlVf9CHj5/bWdV3izTM1ZlU45gj7 X-Received: by 2002:a17:902:b118:: with SMTP id q24mr35538332plr.209.1548177830517; Tue, 22 Jan 2019 09:23:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548177830; cv=none; d=google.com; s=arc-20160816; b=HIIkyBo0xoLyvTvyU/i0iRr50I+JLF5AEWCQ3YxIhYr+mFIc1REdtlgi14Rwzoeru5 TEfWLeMIuKH+nzox6FsbqqGanSk0oNq0Nwow6nczHgsihx2ioaD6iFirsWHjvbDs5jDc 9D/9qGT8ATyqzvtY/Fs7BCKGkBlgPeGCtDQxb8/P+QcEEUe9ig5b6/PEpJmEMFSNlvOh FWUukSupJX4V0qPbPu82QgDFD4ZJfdUo54sT/TwNBYarPqkvhy6SawW92RNMUrWwt15b 0S7XcGstNXndh09BBeB9iarFLScS9mzXIrbLVXML97GP79qRXydI3YrKg48DhFbmdw5y K1aA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=BqPvDNJt9bC+rlGQ/qnfH+2DYWKN25Q5lNqN8xIEWG0=; b=HEwg36vG52EJlkrQFMQx292SVS1VbyjF1RF3cpi9cNFnxenJm49aX4BIJxSOCSELEa YrWn6NV9FInlN5UU95K/8hrx9P+pNaCJKoCM2aAPuy7ZeB4+1DLTIGBao1Dd/1aZ6+mC YJz24vI2ftKEdzy5iN2uHT2QGp3bJH0vpCq5KBSjjLajqDgQfXuckBfe3aNiNRe+Xkgn q6ikw9m7jd/t0YbA0cQct+72r3+3zexIkL0YR7RFfjypeCcxk3y5TifyDvHWdyRo5Q/N 1MJP1hKXCYkWYMvlZQ5U10QZl97hWXh6oQgM5OYnGt35ix1WrvlDwTykXViQdcypOaq9 bTsQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m10si15468012plt.295.2019.01.22.09.23.34; Tue, 22 Jan 2019 09:23:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729570AbfAVRWW (ORCPT + 99 others); Tue, 22 Jan 2019 12:22:22 -0500 Received: from mail-lf1-f67.google.com ([209.85.167.67]:33619 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729448AbfAVRWW (ORCPT ); Tue, 22 Jan 2019 12:22:22 -0500 Received: by mail-lf1-f67.google.com with SMTP id i26so18708636lfc.0; Tue, 22 Jan 2019 09:22:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=BqPvDNJt9bC+rlGQ/qnfH+2DYWKN25Q5lNqN8xIEWG0=; b=edtUeERMBTVaXPxXFpwdbDYNVhkV2bvnDQ5S/ZL18ODiGBaBmuKs5VgqW9ShrWdaXj q8QJjTvxSjzkSYkPMEXMcICvbDvVnankOSTP3h/Kd1cDyOGPWrOuk1ldiMMvGeZ0c3Jw mMG4jHQkehgd7KrSAeaXQX3SSh3omGUJq5EwRZf9nLkO3zYQmfOMwA+zKY+BB+agw51X I+O1uXaqCAeTYQAFncKEyLkr6jvNULRuH8scopZKoE6JmpESY63CISgEcwU1H9W7gO/l Say+cS8gaXTOErfVJO5r5HVCI/Q2v0hRA2spBDTGff8+Hi8jcqIAPRhTSGgKHjVtIu0f G6dQ== X-Gm-Message-State: AJcUukeAjpDVUkNFBfwpLD2DHg0SohOckSZBhYMLMKEddgJbYDZiMKVk K9vUqGINsuDJVP0PtxjqY2K5GRM5 X-Received: by 2002:a19:7006:: with SMTP id h6mr22351020lfc.147.1548177739885; Tue, 22 Jan 2019 09:22:19 -0800 (PST) Received: from xi.terra (c-74bee655.07-184-6d6c6d4.bbcust.telenor.se. [85.230.190.116]) by smtp.gmail.com with ESMTPSA id m1sm91908lfb.56.2019.01.22.09.22.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Jan 2019 09:22:18 -0800 (PST) Received: from johan by xi.terra with local (Exim 4.91) (envelope-from ) id 1glzkd-0004f1-Bb; Tue, 22 Jan 2019 18:22:15 +0100 Date: Tue, 22 Jan 2019 18:22:15 +0100 From: Johan Hovold To: Andreas Kemnade Cc: letux-kernel@openphoenux.org, johan@kernel.org, robh+dt@kernel.org, mark.rutland@arm.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 2/6] gnss: sirf: set power state initially off Message-ID: <20190122172215.GQ3691@localhost> References: <20190116211812.6337-1-andreas@kemnade.info> <20190116211812.6337-3-andreas@kemnade.info> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190116211812.6337-3-andreas@kemnade.info> User-Agent: Mutt/1.11.2 (2019-01-07) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 16, 2019 at 10:18:08PM +0100, Andreas Kemnade wrote: > 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 > --- > - 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; I want to handle this case a bit differently. First, we shouldn't penalise the common case where the receiver is already off by power cycling when not needed. Second, the above could race with runtime pm. Third, we mustn't call sirf_set_active() when we have no on-off gpio. I've prepare a small series which implements this force hibernate mode at probe if already active. This should be easy to extend with a function retrieving the current state at boot also for the no-wakeup case (e.g. keep the port open for one report cycle). This also allows for a cleaner implementation of sirf_set_active() for the no-wakeup case (I noticed you added some optimisation there after I implemented force-hibernate-at-probe). Johan