Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31A16C4708F for ; Wed, 2 Jun 2021 15:26:25 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DDCE9613BF for ; Wed, 2 Jun 2021 15:26:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DDCE9613BF Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 1DC4816DB; Wed, 2 Jun 2021 17:25:32 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 1DC4816DB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1622647582; bh=g25Cj6xQrMkwdV1kTl7mhTk+bwCdADt74DNQjh+YlB8=; h=Date:From:To:Subject:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=BHlTkgTfgDH9sX4IvWE4paik7E8eLdOHDuIEgaaGDPzdsgA1Up+JnvFfKbo4omkMw Hw9r8RoZTAsO82i14UadsjJ1jdcS2oR9fqpTPxvDkc1vWknyuV1hB9pZd2ReL6xmVE yasejrai0mfth1eIjhqReBAnaq9LeEZwJQ1WG5Ic= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id AF9A3F802A9; Wed, 2 Jun 2021 17:25:31 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id B9514F80424; Wed, 2 Jun 2021 17:25:29 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 3000FF80103 for ; Wed, 2 Jun 2021 17:25:21 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 3000FF80103 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="RYI9K0q8"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="gIAWBWHL" Received: from relay2.suse.de (unknown [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 313131FD30; Wed, 2 Jun 2021 15:25:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1622647516; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=SIQBFrJ9Jr4y38wXt8sLwXWheMJInUVIw88Crjiuld8=; b=RYI9K0q8JrFIrdsUsk7cAf2G2AUTZBQrQZdTHyJSVqCs8UnOJOS3GLbL/QW3PQ9eyOCOB7 Mgjyvs/T1WmYlYv1zTZ+b20yhvqmfe4J6MDcYv2IPgVD/4YT35dVtt5hxy/8dmvQry397b K6tMe3nIK7fOHgOJ1vQ+mtJvUixq2qo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1622647516; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=SIQBFrJ9Jr4y38wXt8sLwXWheMJInUVIw88Crjiuld8=; b=gIAWBWHLF5kNqf32sbPRUa9Cl8L+3t4A20v85orrVaoC8gOGo/8yMZ0jmKr1CvTa+GNbOR FYCDpRVaDENcGeDg== Received: from alsa1.suse.de (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id 54772A4973; Wed, 2 Jun 2021 15:25:11 +0000 (UTC) Date: Wed, 02 Jun 2021 17:25:11 +0200 Message-ID: From: Takashi Iwai To: Hui Wang Subject: Re: [PATCH] ALSA: hda: update the power_state during the direct-complete In-Reply-To: <20210602145424.3132-1-hui.wang@canonical.com> References: <20210602145424.3132-1-hui.wang@canonical.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Cc: alsa-devel@alsa-project.org, kai.heng.feng@canonical.com, kailang@realtek.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" On Wed, 02 Jun 2021 16:54:24 +0200, Hui Wang wrote: > > The patch_realtek.c needs to check if the power_state.event equals > PM_EVENT_SUSPEND, after using the direct-complete, the suspend() and > resume() will be skipped if the codec is already rt_suspended, in this > case, the patch_realtek.c will always get PM_EVENT_ON even the system > is really resumed from S3. > > We could set power_state to PMSG_SUSPEND in the prepare(), if other > PM functions are called before complete(), those functions will > override power_state; if no other PM functions are called before > complete(), we could know the suspend() and resume() are skipped since > only S3 pm functions could be skipped by direct-complete, in this case > set power_state to PMSG_RESUME in the complete(). This could guarantee > the first time of calling hda_codec_runtime_resume() after complete() > has the correct power_state. > > Fixes: 215a22ed31a1 ("ALSA: hda: Refactor codec PM to use direct-complete optimization") > Signed-off-by: Hui Wang Thanks, applied. Takashi