Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp853432ybi; Fri, 31 May 2019 09:48:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqxEYM4dMsSfVLlY5MoFDdpsq26y2sW0gN5TmgRQjNV3ANbvZpGVlvKlP02x9P3ypTRNxy/y X-Received: by 2002:a63:b1d:: with SMTP id 29mr10401595pgl.103.1559321319944; Fri, 31 May 2019 09:48:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559321319; cv=none; d=google.com; s=arc-20160816; b=EPexNHGyrtzkHpVdbi0CoZTYWuydYbWQyxCvMaTwhJGErvpBW00mcMlOAY7m9maTyh ONaMFqcmkmVX11bNlekNsvlqqV1e+c5Pnt0+Xjb3dTfm07XpIRJev4o7UQ2DissYSWtk 7Cai6viB2hePp9WUsY8OUvZlSDBqlkIG+mErFeV6z/rhGZGuw6BpwRGg/YKpHzfYJLLO gqJv9S+6+s+GTxOtIaMqeNLxOxjMc2/iuVzSFf2z7ecv5yszKI1qpR8pHfMG+B7WsbgJ 7gY4OWyvlQKGcGdQbk0yUwAVcMPNfNHD0l2IqR7SaMg2xkekLNSYNGL7LPs/8LXfhC7Q RX/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=umRgW7C+tO4b3P+SNMV0Rx/bJLg4L2IeD7Igx4rfhs4=; b=YdBKMC9lggcJGQ2aBDXOuazsugLsqtvFAbHKGX/Dp3je/UwRRUiNffoPmNWgw7H3pq 7k667NEyPVtzCVn4ohF8eSxiHaVsIpXZQHG5w+TkuxO9XzwYsheVoSqDksRUFPBZ015D VcnvEym4bSfH70O0bGLPNOhim8XqLcaS+UBGRNBWHfyNjiheFgAIFOAeTWRrzR9v0Ap9 n0hSxk4AqFjpHvdYzX6CURvc+Xe31OkwkwpRwj/cPLzS83fF6XSzdJM1D3lGqlVKpkw1 ATH4leBeMdND9N9ZRHlrU1edUEp5uvVy2rT3fYYyE9ENpYxrHQ/8uBgbpa1oRWuvC+v5 5RSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=N7KaoI1r; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u13si6772917pgp.478.2019.05.31.09.48.08; Fri, 31 May 2019 09:48:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=N7KaoI1r; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727108AbfEaQrt (ORCPT + 99 others); Fri, 31 May 2019 12:47:49 -0400 Received: from mail-lf1-f66.google.com ([209.85.167.66]:33366 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726985AbfEaQrt (ORCPT ); Fri, 31 May 2019 12:47:49 -0400 Received: by mail-lf1-f66.google.com with SMTP id y17so8460710lfe.0 for ; Fri, 31 May 2019 09:47:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=umRgW7C+tO4b3P+SNMV0Rx/bJLg4L2IeD7Igx4rfhs4=; b=N7KaoI1rtdwVdRLo2srZXPg1dAzOva/R606WNk8BGKcFLmoQXMKvyjUqI0Uk7K42/e sWAoQZF5wJva1QB382HoWSuWS2PfZ8lY71z1frUeCt3+2emHU3YGuazy7UMIwQKb6BbS MdIWBb8kb1/M6Kc2Nsz8vyqIAan9wHtNMvaJo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=umRgW7C+tO4b3P+SNMV0Rx/bJLg4L2IeD7Igx4rfhs4=; b=TTLc8WTdUjnlxz6NtNPFRrmUoAUXMLJ8l3wOVJRy0IcxWRydTPdaO4bWunJHtmwMJg 1yeU7w5itzvCHtAbVXUucu47dhBMy8/uYXUWrZBgs3+WimctWmNgodSByuPQF8axn9ZL JniCXl9MP/TADFMWKk2xcuOr74uR7yRb5dRXe+x+tfll8zIhzzHyDJqJCirmoMyfBWUB 9R/pWXmDr2GPCBe1fGqEBZtpjRX1JLrTl56+iC98vgyA3r9koAElr38sE9RhsdkQr2bv Iq57l/w10ghpLCR07idN/1UfjIwKG2rua3o7fvNh31sLZZzMhjn5WKXuqcU7R31ApUKZ tYaQ== X-Gm-Message-State: APjAAAXPQLbhqWdGuE6iuzLcdAl5FxPUJmnrwaVG48KgufubEOqER5Ub znTAmCGmzWKJHYYkGvlgY4CCk5nG3f4= X-Received: by 2002:ac2:4286:: with SMTP id m6mr6356534lfh.150.1559321266745; Fri, 31 May 2019 09:47:46 -0700 (PDT) Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com. [209.85.208.180]) by smtp.gmail.com with ESMTPSA id a4sm1274564lfj.31.2019.05.31.09.47.45 for (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Fri, 31 May 2019 09:47:45 -0700 (PDT) Received: by mail-lj1-f180.google.com with SMTP id j24so10292001ljg.1 for ; Fri, 31 May 2019 09:47:45 -0700 (PDT) X-Received: by 2002:a2e:95d2:: with SMTP id y18mr6490072ljh.167.1559321264696; Fri, 31 May 2019 09:47:44 -0700 (PDT) MIME-Version: 1.0 References: <1559209955-10089-1-git-send-email-gbhat@marvell.com> In-Reply-To: From: Brian Norris Date: Fri, 31 May 2019 09:47:33 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/2] mwifiex: add support for host wakeup via PCIE wake# To: Ganapathi Bhat Cc: "linux-wireless@vger.kernel.org" , Cathy Luo , Zhiyuan Yang , James Cao , Rakesh Parmar , Sharvari Harisangam Content-Type: text/plain; charset="UTF-8" Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org (You really should re-send your patches, as they didn't make it to the list. But while you're here:) On Thu, May 30, 2019 at 3:01 AM Ganapathi Bhat wrote: > > From: Sharvari Harisangam > > > > PCIE WAKE# is asserted by firmware, when WoWLAN conditions are > > matched. Current driver does not enable PME bit needed for WAKE# > > assertion, causing host to remain in sleep even after WoWLAN conditions are > > matched. This commit fixes it by enabling wakeup (PME bit) in suspend > > handler. Are you sure said devices actually have their 'wakeup' attribute set to 'enabled' (e.g., in sysfs)? I think the PCI core should probably be taking care of this for you already. See below. > > Signed-off-by: Sharvari Harisangam > > Signed-off-by: Ganapathi Bhat > > --- > > drivers/net/wireless/marvell/mwifiex/pcie.c | 27 +++++++++++++++------------ > > 1 file changed, 15 insertions(+), 12 deletions(-) > > > > diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c > > b/drivers/net/wireless/marvell/mwifiex/pcie.c > > index 3fe81b2..0bd81d4 100644 > > --- a/drivers/net/wireless/marvell/mwifiex/pcie.c > > +++ b/drivers/net/wireless/marvell/mwifiex/pcie.c ... > > @@ -181,6 +180,10 @@ static int mwifiex_pcie_suspend(struct device *dev) > > set_bit(MWIFIEX_IS_SUSPENDED, &adapter->work_flags); > > clear_bit(MWIFIEX_IS_HS_ENABLING, &adapter->work_flags); > > > > + pci_enable_wake(pdev, pci_choose_state(pdev, state), 1); > > + pci_save_state(pdev); > > + pci_set_power_state(pdev, pci_choose_state(pdev, state)); From Documentation/power/pci.txt: """ 3.1.2. suspend() ... This callback is expected to quiesce the device and prepare it to be put into a low-power state by the PCI subsystem. It is not required (in fact it even is not recommended) that a PCI driver's suspend() callback save the standard configuration registers of the device, prepare it for waking up the system, or put it into a low-power state. All of these operations can very well be taken care of by the PCI subsystem, without the driver's participation. However, in some rare case it is convenient to carry out these operations in a PCI driver. [...] """ I think you need to do a little more work to justify why you are one of those rare cases. On a related note: some of the existing "configure wakeup" stuff we do here should probably be gated behind a call to device_may_wakeup(). That would help make it more obvious that such configuration is futile, if the device was marked as wake-disabled. Brian > > + > > return 0; > > } > >