From patchwork Wed May 9 09:44:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 10388911 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 54A4460353 for ; Wed, 9 May 2018 09:44:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 44067288D0 for ; Wed, 9 May 2018 09:44:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 37E4E28EBD; Wed, 9 May 2018 09:44:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D35E1288D0 for ; Wed, 9 May 2018 09:44:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934110AbeEIJoe (ORCPT ); Wed, 9 May 2018 05:44:34 -0400 Received: from mail-lf0-f65.google.com ([209.85.215.65]:42573 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933824AbeEIJod (ORCPT ); Wed, 9 May 2018 05:44:33 -0400 Received: by mail-lf0-f65.google.com with SMTP id u21-v6so50027533lfu.9; Wed, 09 May 2018 02:44:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=LFaANa4m6obYYPpPLVEOufWumfRDXma8pijVoUPJsfc=; b=Taw5KcsQWFBQOgmUtskz0BvPPBpBOsveeotVEcE0xX5YSBsLFbvkfyJnhP40behH1u BgUV0gzp3Z1u5Bp3zbh2wDOrqQZTlqs0Iw9Dg+vlnbJStz4IiBvdy8U92Kml7jjAR2qd u3z59lNYmBJLyYi1zHcxKtphy7zLXtHF1R2vBXabObJpgXvPkwOhNx5mwt5e2n98GP44 Vc0OInpk3Jw6QJ6h6kK2Zi1NMeKTKUtFwZ4S6/sfy7gwq/AFyTAyddc+MihXvgkWD4r6 omgmM3fI2hXXlkbSOM7I+74VUn0CwFoRpMYSI6vmnwADA4B3OhKaOIR2eeN5oLWVqtWC Ehnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=LFaANa4m6obYYPpPLVEOufWumfRDXma8pijVoUPJsfc=; b=qxFawyLcrkLEJh0KheXwgALxfn/mOVIjVVWf9z0pCRVB40iMO+ulc5OTQhW0mSjVob atZCHOJBsrWtUTixJ00b5XIlIXhlWBuXC2UmqczA+nZ2p9wdhbjC1jSmywmN6zIHUJyS shrYcuFqCIv6KEZZLfwSDLIJYymUS1rKM7TqqpjNQ4THWFpZvXhlBoqwyWhdMNNAntEy EFyjcyIHQgqB7YNuP06qTx/Re1ROkKHFxjGXHmMk6uld3DkCen1r6gODixosbEb1aJ4z +7KrlLMvKRKt9rcWCWegxZ2WOyAk/d3eUeo9oHJzY3aYPEQnpD1LiZr9vXSbbCsmuhCO 2vWg== X-Gm-Message-State: ALKqPwdjCwrl9foc2f/Wq7QcRFYSYaGKg5OkIf9hpFMIQsEfsdMu5ozP T+UeMyJTXveSc3CyYQRrqTM= X-Google-Smtp-Source: AB8JxZomEnsKr3Czxl2t6GeXz5SPLEnA82Xl6NqFkKq+iNnP0mXauMuOL/PXNlGh4OSPaFErvzJ8/A== X-Received: by 2002:a2e:9e10:: with SMTP id e16-v6mr4308393ljk.108.1525859071433; Wed, 09 May 2018 02:44:31 -0700 (PDT) Received: from xi.terra (c-8bb2e655.07-184-6d6c6d4.cust.bredbandsbolaget.se. [85.230.178.139]) by smtp.gmail.com with ESMTPSA id a21-v6sm965923lfl.84.2018.05.09.02.44.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 May 2018 02:44:30 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.90_1) (envelope-from ) id 1fGLeB-0003W3-L7; Wed, 09 May 2018 11:44:31 +0200 From: Johan Hovold To: Greg Kroah-Hartman Cc: Rob Herring , Sebastian Reichel , Tony Lindgren , "H. Nikolaus Schaller" , Andreas Kemnade , Mark Rutland , Arnd Bergmann , Pavel Machek , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, linux-pm@vger.kernel.org, Johan Hovold Subject: [PATCH EXAMPLE 2/2] dbg: gnss: sirf: allow aggressive controller runtime PM Date: Wed, 9 May 2018 11:44:19 +0200 Message-Id: <20180509094419.13470-2-johan@kernel.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180509094419.13470-1-johan@kernel.org> References: <20180509094419.13470-1-johan@kernel.org> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This is just an example of how a serdev driver could go about to allow aggressive controller runtime PM by dropping the RPM reference taken by serdev core in serdev_device_open(). Note that for most GNSS devices this does not make any sense, as allowing the controller to suspend this way would cause the first message of every report burst to be corrupted (and discarded). This one applies on top of the GNSS series available here: https://lkml.kernel.org/r/20180424163458.11947-1-johan@kernel.org Not-Signed-off-by: Johan Hovold --- drivers/gnss/sirf.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/gnss/sirf.c b/drivers/gnss/sirf.c index 497f8eb8467f..31b2cbccd194 100644 --- a/drivers/gnss/sirf.c +++ b/drivers/gnss/sirf.c @@ -57,6 +57,9 @@ static int sirf_open(struct gnss_device *gdev) goto err_close; } + /* Allow aggresive controller runtime PM. */ + pm_runtime_put(&serdev->ctrl->dev); + return 0; err_close: @@ -70,6 +73,9 @@ static void sirf_close(struct gnss_device *gdev) struct sirf_data *data = gnss_get_drvdata(gdev); struct serdev_device *serdev = data->serdev; + /* Balance the put in open() */ + pm_runtime_get(&serdev->ctrl->dev); + serdev_device_close(serdev); pm_runtime_put(&serdev->dev);