Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp334832ybt; Tue, 30 Jun 2020 22:59:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy+ZjXAg7YoKXHMsTPrrH1990SDzR5JPA+eAlR8dnliVA1YK6bXkgJN58choWA2g8ydJrWh X-Received: by 2002:a17:906:7746:: with SMTP id o6mr22054352ejn.75.1593583166271; Tue, 30 Jun 2020 22:59:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593583166; cv=none; d=google.com; s=arc-20160816; b=w7RVF7vUWebvoSojqqB5RRvG107lkrKyEg4s1jHM+ouXIH7bQNPdrWIjGtBTgKyVHP rYBBOnmMv9cisTpoULw9qP2XZ7XyTCQqJF30Q0RusK5GGQP3fvmwgjxYW54M8T6Q8BqX sJFDx7XrDcCCq834zptNLJgbCe7UzJgUI1gmDf7cVKwU03XCJLQCGYUK2nZdnmGpOArI PzWQSLJ8QOHXktN9DyAlWqzMe/LOkB9C65phJ2l7SwbtTIDAQDtX8PdbWEBJlqt2A6+H E7EHnzfsS0foLp7sc3ybQCNHsqCW7vY1OuvneU4D5Jwg7Ye5GMLrs3fyl0npBSTn+v0c 3ZaQ== 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=iqd+p4rJeRZeHXfH2MDQ9YZRAGBnaOcmag5FyzfKYrQ=; b=ZtqDadpcskh1EPEcaqC3UPmp1KE0lLQDGVkG/40yvB6wvXHKJK/R3lGuiVwHoKTRtt 3yyiwKWi5Miph7X1UmED6MZPhJ10z6nKdhkpMHgIu4x9YpJqFv1T0HYenw2q3GU+KzDE KnrmA+cFX8A1NwE2qYk05RuuEKuZehRKLMud57bqqVl96GxSzYdxPxbkslyiGBkRvkzV 8Owm3uEuTl1J52KiB4Q1jfjgLEAXi2UTi9VTuStBdJ39oGNgJPVhtpHJnPlXn5h46AJN u7Eg49B+Mh8RBF27BFGEcLrMGxJ7MDG7zxaGUjB5C115BeBivPkN8GwnJUhJqQmW1/sQ glsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jKDS7Thl; 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 be27si3308026edb.50.2020.06.30.22.59.01; Tue, 30 Jun 2020 22:59:26 -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=jKDS7Thl; 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 S1726779AbgGAF47 (ORCPT + 99 others); Wed, 1 Jul 2020 01:56:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:58898 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725272AbgGAF46 (ORCPT ); Wed, 1 Jul 2020 01:56:58 -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 5082F20747; Wed, 1 Jul 2020 05:56:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593583018; bh=qyAj0nKPFYUi90Eumgd+ayXy3UaN1w3BRIx9nkrkAZQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=jKDS7ThlTXWAo/SqAgJWHqPz/ggV+FOXBVbgF/Qcksbg3SqE6/+0l7TIu6JQdRh4X 3Xq1M0ZgBFsx6qTwtO0SMVsA5gFuPeoo1wPqRRzMiE4UykG+6q7BPXzEf+Azts0Tn9 sx0NxH/PXxKJgzKSGgluF9W5VKwAXjM5+e5AwlOA= Date: Wed, 1 Jul 2020 11:26:54 +0530 From: Vinod Koul To: Pierre-Louis Bossart Cc: Bard Liao , 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, 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: <20200701055654.GW2599@vkoul-mobl> References: <20200623173546.21870-1-yung-chuan.liao@linux.intel.com> <20200623173546.21870-9-yung-chuan.liao@linux.intel.com> <20200630165126.GT2599@vkoul-mobl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 30-06-20, 12:18, Pierre-Louis Bossart wrote: > > > + 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? > > in follow-up patches where the clock-stop mode is enabled. ok > > > + * 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..? > > In this mode, the bus is clock-stop mode, and events are detected with level > detector tied to PCI events. The master and slave devices are all in > pm_runtime suspended states. The codec cannot make any decisions on its own > since the bus is stopped, it needs to first resume, which assumes that the > master resumes first and the enumeration re-done before it can access any of > its registers. > > By looping through the list of devices that can generate events, you end-up > first forcing the master to resume, and then each slave resumes and can > check who generated the event and what happened while suspended. if the > codec didn't generate the event it will go back to suspended mode after the > usual timeout. > > We can add a callback but that callback would only be used for Intel > solutions, but internally it would only do a pm_request_resume() since the > codec cannot make any decisions before first resuming. In other words, it > would be an Intel-specific callback that is implemented using generic resume > operations. It's probably better to keep this in Intel-specific code, no? I do not like the idea that a device would be woken up, that kind of defeats the whole idea behind the runtime pm. Waking up a device to check the events is a generic sdw concept, I don't see that as Intel specific one. I would like to see a generic callback for the devices and let devices do the resume part, that is standard operating principle when we deal with suspended devices. If the device thinks they need to resume, they will do the runtime resume, check the status and sleep if not applicable. Since we have set the parents correctly, any resume operation for slaves would wake master up as well... I do not see a need for intel driver to resume slave devices here, or did I miss something? -- ~Vinod