Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4325722pxb; Tue, 2 Mar 2021 12:07:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJxqHmUFrNgcj9Gtz3q0bgTS1ROEFA4PPmcrQfCLQmiW3JysHchVofKxSkYZPVH/lPB1of7N X-Received: by 2002:a05:6402:3487:: with SMTP id v7mr21958777edc.361.1614715594292; Tue, 02 Mar 2021 12:06:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614715594; cv=none; d=google.com; s=arc-20160816; b=TmaXGTYAPfPvypS2v4RPlz7nCG4SqZRIHeREue5KEg+9ttjGFOCErc7ZIAPi12ODmZ Y5c+C+buS96PSne4cWoYciZHiY7VPO/axdsIiM9hDZ3rv9jsWqaeZs/NtzpyjioqKHU7 cgUcnj1mMG/smRktRxtfLMzFz+AJzeHiHFRgIL9j9GITXteNzysZKBYMEo3wgmgujr8s HfEWXPLEg/SdQnHx+dIZPKIALm4w0+WE7UTVq4LEOcnyGqMq3XEDOj9mEwcVAf8HoaRh pFvjLIl89negPJtkNwrLhj3LKHM9LYsMGU5TQ2Zs72l1BMZNfg5oyE6hve0NrURub8mA OkPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:date:message-id:from:references:cc:to :subject:dkim-signature; bh=8Yt0B43U8OdET4kdbA88SrJ5iYbOz8v13cIrkyLZ+4k=; b=YO77F57cVBmWLrQsyqksFQbYfp7jvZkg6IRn7oVeH5uTXRwdABl+U2664MpUmythY6 xeHeUbNnot+Kx7qxQvDEdcuxOPgPpb+m91GeP9zv1FkibmVV6LXwjGaONdHumVBTtLvb JanDM4JbMLKnJST7uRWdqcFkSwTIwCYgjoEdrhVfm7R95TuMQ754iycfQaRs3jF4GQCP DHSpjxAQrkyj9xTTNUWlVCt03tYfy4J7MIh/KBSi84SxkdOdJH8EgrO+fEDK4PFIvfsC o2Rgnv/zhwhM6h6BICf8nr0dpHy4QE3a9Vy2Z1gfKDxGi3f1ZCO6tmg4GlYr5BtyI7kG oNZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@opensynergy.com header.s=srmailgate02 header.b=MjzEBush; 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=opensynergy.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g23si6642519ejx.623.2021.03.02.12.06.02; Tue, 02 Mar 2021 12:06:34 -0800 (PST) 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=@opensynergy.com header.s=srmailgate02 header.b=MjzEBush; 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=opensynergy.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1836708AbhCBHUQ (ORCPT + 99 others); Tue, 2 Mar 2021 02:20:16 -0500 Received: from mx1.opensynergy.com ([217.66.60.4]:14153 "EHLO mx1.opensynergy.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1835956AbhCBGaD (ORCPT ); Tue, 2 Mar 2021 01:30:03 -0500 Received: from SR-MAILGATE-02.opensynergy.com (localhost.localdomain [127.0.0.1]) by mx1.opensynergy.com (Proxmox) with ESMTP id 60282A1377; Tue, 2 Mar 2021 07:29:21 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=opensynergy.com; h=cc:cc:content-transfer-encoding:content-type:content-type :date:from:from:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=srmailgate02; bh=8Yt0B43U8OdE T4kdbA88SrJ5iYbOz8v13cIrkyLZ+4k=; b=MjzEBush0yFIE3j0zZ105jP/PY0E D7YBPxe7Y6qKmIURtf+Tb8KDVY8cPScamz6XWS7xHZZKlpQ5+c2rW4Q2vJ8/3B+k /AmeysgEuNtVxig0nxAscB2F9Yf8g9Ps3bhJIJ61HedqfjTSepLn12bOyOdPu0wB zq8EDJPin6Z9i8mHmEyv1RjHRKGRq3Stzk/FCVqHPKULSZyLDta1zG7B1qmqWO+0 Hw+X6jbo7xY+/GOPgcQi+Eay9FBv1KO/A647aghWFKbYx6UGPx5poyus39XXm8oU kOKM2sPwI/VxIYfhqCxWAz4lmm/LZLqH/vCoHcoDTLcEoF9PaVlTIpGwrg== Subject: Re: [PATCH v6 9/9] ALSA: virtio: introduce device suspend/resume support To: Takashi Iwai CC: , , , "Michael S. Tsirkin" , Jaroslav Kysela , Takashi Iwai , References: <20210227085956.1700687-1-anton.yakovlev@opensynergy.com> <20210227085956.1700687-10-anton.yakovlev@opensynergy.com> From: Anton Yakovlev Message-ID: <7d4daea0-ed59-e84c-c28a-945c49204c83@opensynergy.com> Date: Tue, 2 Mar 2021 07:29:20 +0100 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-ClientProxiedBy: SR-MAIL-01.open-synergy.com (10.26.10.21) To SR-MAIL-01.open-synergy.com (10.26.10.21) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 28.02.2021 13:05, Takashi Iwai wrote: > On Sat, 27 Feb 2021 09:59:56 +0100, > Anton Yakovlev wrote: >> [snip] >> --- a/sound/virtio/virtio_pcm.c >> +++ b/sound/virtio/virtio_pcm.c >> @@ -109,6 +109,7 @@ static int virtsnd_pcm_build_hw(struct virtio_pcm_substream *vss, >> SNDRV_PCM_INFO_BATCH | >> SNDRV_PCM_INFO_BLOCK_TRANSFER | >> SNDRV_PCM_INFO_INTERLEAVED | >> + SNDRV_PCM_INFO_RESUME | >> SNDRV_PCM_INFO_PAUSE; > > Actually you don't need to set SNDRV_PCM_INFO_RESUME. > This flag means that the driver supports the full resume procedure, > which isn't often the case; with this, the driver is supposed to > resume the stream exactly from the suspended position. > > Most drivers don't set this but implement only the suspend-stop > action. Then the application (or the sound backend) will re-setup the > stream and restart accordingly. I tried to resume driver without SNDRV_PCM_INFO_RESUME, and alsa-lib called only ops->prepare(). It makes sense for a typical hw, but we have "clean" unconfigured device on resume. And we must set hw parameters as a first step. It means, that code should be more or less the same. And maybe it's better to set SNDRV_PCM_INFO_RESUME, since it allows us to resume substream in any situation (regardless of application behavior). I can refactor code to only send requests from trigger(RESUME) path and not to call ops itself. It should make code more straitforward. What do you say? -- Anton Yakovlev Senior Software Engineer OpenSynergy GmbH Rotherstr. 20, 10245 Berlin