Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3811273ybt; Tue, 30 Jun 2020 11:42:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzqrc2nBWazpODwhdZwmmvRqK+LQgS8F5I3060hutMdjhmOYEOXp9ZCUa47/QzPiuh7DXZu X-Received: by 2002:a17:907:40f5:: with SMTP id no5mr19151241ejb.149.1593542088795; Tue, 30 Jun 2020 11:34:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593542088; cv=none; d=google.com; s=arc-20160816; b=o9U6AeP48RFLj6yze7Dvcrt7iy5uODE0hp40ExS3UVgKvUAzpJBYVZ4tEkMnLD0Ru5 MD9A62zoAGv1VL68Y7GWLBV8fu+WbPvMbXTvJjRQ/nn4Qy+xvmyDeipNDVBaJlzAwmSN ti402WTbjUwjJvPBpodwEdTH3MgAvXu/50cCCQc5+cc+YXZ4ffERbe5Dj7QzKTK5vbRL BnjeeLMOUyhaU/6FZPxAtqApATFxjkloXsiR6PSy9ncNTRQCAOMlLhJKPOCZqmeOnhUq CocA+SpU5I8sFLCNkQ6wtK+DaAY2pZOhuvKQe5wkKwOZzjozDPshGmA3hNoV66a1qCkl OV/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=DKhKc2F3GMBryymTWCSq+sfE4E/Lnw60J5yB4He9en4=; b=KcBQ7dHN17oYcff4tztRcUcZ/PzzHbDbKEQDZ8I2Ns+fQAGL3FJr1gQH3GJRORqLEr KC+QL+8D+6FLakaw4bZ2Xt7JEwlMOhpjWfjZo9K+EJ6W7sr4ffgKh0qzCZhgiye0UyS+ HFjyGJSfXdxazewxqKiR9gt/DtoX/9LrXdmNItbSSjs1XcZo5+WfSn9l7z9NL3GXA4tg 7g+NQ5fDSc9I2GkXt9XpFl7V5OPj1x13H6TDrvCpYlAYyCIf43I+7xCi8g3M8w06xKh8 r3S0YLGIzJZ9GyBAHXIdzHSXi1F0VPsSGgISd9nTUfiasrjVX3qqzYkQHXFteYVD77vt hQ/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tVZzCLkr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dr16si2970368ejc.320.2020.06.30.11.34.25; Tue, 30 Jun 2020 11:34:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@kernel.org header.s=default header.b=tVZzCLkr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733200AbgF3Qvc (ORCPT + 99 others); Tue, 30 Jun 2020 12:51:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:51408 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728022AbgF3Qvb (ORCPT ); Tue, 30 Jun 2020 12:51:31 -0400 Received: from localhost (unknown [122.182.251.219]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 29E2220722; Tue, 30 Jun 2020 16:51:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593535891; bh=aJfBwSRR9T2vIaRp4pZHy0LuJfSWE/tmG0LQ3K1OGjQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=tVZzCLkrtwW+KIgZor7eQaHmVHcIeI8AY1I/KDSPtbMRrulci8G1m7PXQAENQK2Gv RvOswL281ETj2PeoapQ0y3wbiaAxtU9H43IDzRVoPoLxbgiZjhluhxBJiFA0osypvT jRm4VnOhPXCzx7nswbjCJgC41LgtiYYuwb10xSA0= Date: Tue, 30 Jun 2020 22:21:26 +0530 From: Vinod Koul To: Bard Liao Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, tiwai@suse.de, broonie@kernel.org, gregkh@linuxfoundation.org, jank@cadence.com, srinivas.kandagatla@linaro.org, rander.wang@linux.intel.com, ranjani.sridharan@linux.intel.com, hui.wang@canonical.com, pierre-louis.bossart@linux.intel.com, sanyog.r.kale@intel.com, slawomir.blauciak@intel.com, mengdong.lin@intel.com, bard.liao@intel.com Subject: Re: [PATCH 8/9] soundwire: intel: add wake interrupt support Message-ID: <20200630165126.GT2599@vkoul-mobl> References: <20200623173546.21870-1-yung-chuan.liao@linux.intel.com> <20200623173546.21870-9-yung-chuan.liao@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200623173546.21870-9-yung-chuan.liao@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 24-06-20, 01:35, Bard Liao wrote: > From: Rander Wang > > When system is suspended in clock stop mode on intel platforms, both > master and slave are in clock stop mode and soundwire bus is taken > over by a glue hardware. The bus message for jack event is processed > by this glue hardware, which will trigger an interrupt to resume audio > pci device. Then audio pci driver will resume soundwire master and slave, > transfer bus ownership to master, finally slave will report jack event > to master and codec driver is triggered to check jack status. > > if a slave has been attached to a bus, the slave->dev_num_sticky > should be non-zero, so we can check this value to skip the > ghost devices defined in ACPI table but not populated in hardware. > > Signed-off-by: Rander Wang > Signed-off-by: Pierre-Louis Bossart > Signed-off-by: Bard Liao > --- > drivers/soundwire/intel.c | 48 +++++++++++++++++++++++++++++++++- > drivers/soundwire/intel.h | 1 + > drivers/soundwire/intel_init.c | 22 ++++++++++++++++ > 3 files changed, 70 insertions(+), 1 deletion(-) > > diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c > index 06c553d94890..22d9fd3e34fa 100644 > --- a/drivers/soundwire/intel.c > +++ b/drivers/soundwire/intel.c > @@ -13,6 +13,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -436,7 +437,7 @@ static int intel_shim_init(struct sdw_intel *sdw, bool clock_stop) > return ret; > } > > -static void __maybe_unused intel_shim_wake(struct sdw_intel *sdw, bool wake_enable) > +static void intel_shim_wake(struct sdw_intel *sdw, bool wake_enable) why drop __maybe? > { > void __iomem *shim = sdw->link_res->shim; > unsigned int link_id = sdw->instance; > @@ -1337,6 +1338,51 @@ static int intel_master_remove(struct platform_device *pdev) > return 0; > } > > +int intel_master_process_wakeen_event(struct platform_device *pdev) > +{ > + struct device *dev = &pdev->dev; > + struct sdw_intel *sdw; > + struct sdw_bus *bus; > + struct sdw_slave *slave; > + void __iomem *shim; > + u16 wake_sts; > + > + sdw = platform_get_drvdata(pdev); > + bus = &sdw->cdns.bus; > + > + if (bus->prop.hw_disabled) { > + dev_dbg(dev, > + "SoundWire master %d is disabled, ignoring\n", > + bus->link_id); single line pls > + return 0; > + } > + > + shim = sdw->link_res->shim; > + wake_sts = intel_readw(shim, SDW_SHIM_WAKESTS); > + > + if (!(wake_sts & BIT(sdw->instance))) > + return 0; > + > + /* disable WAKEEN interrupt ASAP to prevent interrupt flood */ > + intel_shim_wake(sdw, false); when & where is this enabled? > + > + /* > + * wake up master and slave so that slave can notify master > + * the wakeen event and let codec driver check codec status > + */ > + list_for_each_entry(slave, &bus->slaves, node) { > + /* > + * discard devices that are defined in ACPI tables but > + * not physically present and devices that cannot > + * generate wakes > + */ > + if (slave->dev_num_sticky && slave->prop.wake_capable) > + pm_request_resume(&slave->dev); Hmmm, shouldn't slave do this? would it not make sense to notify the slave thru callback and then slave decides to resume or not..? -- ~Vinod