Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp1583292pxb; Mon, 12 Apr 2021 01:24:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxyZS9B1irMzDxIPHMS/2SQ8QWPwJc3BKCSL4KjH7cJ3U+DkbPRX2KVOXxLW0sBIBrWzUbL X-Received: by 2002:a05:6402:4244:: with SMTP id g4mr28114635edb.204.1618215895929; Mon, 12 Apr 2021 01:24:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618215895; cv=none; d=google.com; s=arc-20160816; b=vd2lmtCoeT220YYjx+5TSmj2di1h7XWElkeA+hAPTzejuWPMJkk1U7VDGpYLJazi25 3/+E+rPd+gXNe5XbXEovDyrFRtoPJq9rZSaVzliyT2Icw8ZNm25fgItiU9sgKKnwHkwf cV7VqZsTDdwuyHhZjndAJdgKv6txxsNy340DBWNnCF0JrxrOlEj1j3I/ZhNSU1J+atqO eWCWf/Z17d5Jutgxn4FN386R6vW1HsBSQRC0vNwvKr/eRTVwWfEA74eWXz37h4OpU+nQ rQYPKm+Z3GBmJUkV0DAti18zp9DPXogUw+ukgNfHfOy3HpNIiGhrGwADz9mAZKNeV67H ff8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=U3KvNK5Z0Y0b8uUls56fLMW/SjSCKNnm377bqkslXR8=; b=Y5x61MOKLuxUOOk2o2QYA0KbGWFzAB5wrTjO8KGzPZqUr/atjfSiyM6vgaoXS3EOKm gR4g8LTaOVXReQ/lxYiSi+7yCmF0dUIL67rv8qB9omTIvZ3j92Dr2GMj3kbPZpcbgVkq y0k4096+Lm2+WP3qCqTZZCECehGw1E7xQqXUc5gb2ukI2UbdAY17QYvJp9cNg7v3ZGj3 jqCUtxssctIy5XgFL6V9veVtBxjhWQPTqssb5cdELUrRV4rY+x5GfEXVl10ZUBpLPk5P SJ2Bs/idgP2fNUyk3m9pyRV/4oOEj/CYUFBqo7HCeVFPLx4m6Sudsf0cywp+dAZ4zsf8 IPoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XV1PbJ+l; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z9si7043872edb.10.2021.04.12.01.24.32; Mon, 12 Apr 2021 01:24:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XV1PbJ+l; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237305AbhDLIXs (ORCPT + 99 others); Mon, 12 Apr 2021 04:23:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237296AbhDLIXp (ORCPT ); Mon, 12 Apr 2021 04:23:45 -0400 Received: from mail-vs1-xe29.google.com (mail-vs1-xe29.google.com [IPv6:2607:f8b0:4864:20::e29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 691CBC061574 for ; Mon, 12 Apr 2021 01:23:24 -0700 (PDT) Received: by mail-vs1-xe29.google.com with SMTP id g20so6228422vst.2 for ; Mon, 12 Apr 2021 01:23:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=U3KvNK5Z0Y0b8uUls56fLMW/SjSCKNnm377bqkslXR8=; b=XV1PbJ+lqigLdhRMkPoUSk3eluxQLHpAeYhojQKjAFRLh73UBVZravfBUk/6TYQ6JZ Z1ga5Bk6TFjE8hY8ks7CpxDTwodN2YqGYM+WIUBjWz4NtIukPNPtuVV/sm8X/hnqXzlQ FLOLj9c9r7tul6Lx5HRsd57MhXsVAmFOaRXBXej2siKsZXi7n5kmY2HWP7yJb9VzjPiM EHV0KxKDvRELffiMpqo/+qlpoJnAkRo9mf1WC89QhOyjEM6wCQMjnXsnpvUNtlZCnmdt gmkl2sQoD6/XWE3LT8o+fJtdCAaomGlMqX+vOqUpGqoeKV5aK1YZyD2AcJYq0Nvrzey8 klkA== 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=U3KvNK5Z0Y0b8uUls56fLMW/SjSCKNnm377bqkslXR8=; b=TgoSIZBWjOpKBldHvQW6JJzVkAfXnjGyCkvcR5HKEPhPSLrlBrqqsB5wZwX2QLV2q9 rmRXQCu68o8eOQF60Q9BnsX6qWYoccilBLaXpEfgc7sTWdolcFP5CiocbX7E9vBIVBtP KrzV6Sj1K0Iyc89KZ9IpxOCL27tU+XguHtGDG29dDpxdaOubP1kM1AOywrU0vL/1KJLl K/+E1rEnExmT1sPuPlImUtHopob2tGkoDIBpvnEOB3EFTcEYCffKXB/xU7KwqrAkLj+w eBCyvgxRsm4JoCWO7RfGf2gFr8jJsLL6bnGu/fN8EcRQfMe9wXq1kegjS3k4GZCGYlXc UnYg== X-Gm-Message-State: AOAM530FGNSJwfx9tPiSoI+bPPEwjlVXQBiAIcIbgavCBh/91/2kT+HT 6l6D+DQPPr0ypQr8wHWIbXqf6iuSUnP3OZU5x3VQFw== X-Received: by 2002:a67:fd48:: with SMTP id g8mr11986932vsr.55.1618215803602; Mon, 12 Apr 2021 01:23:23 -0700 (PDT) MIME-Version: 1.0 References: <20210315132501.441681-1-Jerome.Pouiller@silabs.com> <4503971.bAhddQ8uqO@pc-42> <5713463.b6Cmjs1FeV@pc-42> <87pmz6mhim.fsf@codeaurora.org> In-Reply-To: <87pmz6mhim.fsf@codeaurora.org> From: Ulf Hansson Date: Mon, 12 Apr 2021 10:22:47 +0200 Message-ID: Subject: Re: [PATCH v5 08/24] wfx: add bus_sdio.c To: Kalle Valo Cc: =?UTF-8?B?SsOpcsO0bWUgUG91aWxsZXI=?= , linux-wireless , netdev , driverdevel , Linux Kernel Mailing List , Greg Kroah-Hartman , "David S . Miller" , DTML , Rob Herring , linux-mmc , =?UTF-8?Q?Pali_Roh=C3=A1r?= Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On Wed, 7 Apr 2021 at 14:00, Kalle Valo wrote: > > Ulf Hansson writes: > > >> If I follow what has been done in other drivers I would write something > >> like: > >> > >> static int wfx_sdio_suspend(struct device *dev) > >> { > >> struct sdio_func *func = dev_to_sdio_func(dev); > >> struct wfx_sdio_priv *bus = sdio_get_drvdata(func); > >> > >> config_reg_write_bits(bus->core, CFG_IRQ_ENABLE_DATA, 0); > >> // Necessary to keep device firmware in RAM > >> return sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER); > > > > This will tell the mmc/sdio core to keep the SDIO card powered on > > during system suspend. Thus, it doesn't need to re-initialize it at > > system resume - and the firmware should not need to be re-programmed. > > > > On the other hand, if you don't plan to support system wakeups, it > > would probably be better to power off the card, to avoid wasting > > energy while the system is suspended. I assume that means you need to > > re-program the firmware as well. Normally, it's these kinds of things > > that need to be managed from a ->resume() callback. > > Many mac80211 drivers do so that the device is powered off during > interface down (ifconfig wlan0 down), and as mac80211 does interface > down automatically during suspend, suspend then works without extra > handlers. That sounds simple. :-) Would you mind elaborating on what is actually being powered off at interface down - and thus also I am curious what happens at a typical interface up? Even if we don't want to use system wakeups (wake-on-lan), the SDIO core and the SDIO func driver still need to somewhat agree on how to manage the power for the card during system suspend, I think. For example, for a non-removable SDIO card, the SDIO/MMC core may decide to power off the card in system suspend. Then it needs to restore power to the card and re-initialize it at system resume, of course. This doesn't mean that the actual corresponding struct device for it, gets removed/re-added, thus the SDIO func driver isn't being re-probed after the system has resumed. Although, since the SDIO card was re-initialized, it's likely that the FW may need to be re-programmed after the system has been resumed. Are you saying that re-programming the FW is always happening at interface up, when there are none system suspend/resume callbacks assigned for the SDIO func driver? Kind regards Uffe