Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp149383pxb; Wed, 25 Aug 2021 23:06:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzrYmDxRE+05qFThyPmDi2nK0j69LxNVmPzrwpoKWFAmuTYrNf28X5fi6maPYjyRQfCdrHo X-Received: by 2002:a17:906:e8a:: with SMTP id p10mr2383464ejf.265.1629957965339; Wed, 25 Aug 2021 23:06:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629957965; cv=none; d=google.com; s=arc-20160816; b=lwK5KmtdE7gfLa0tcyJICpEy5eBQnmIVKhSp/VN+tCvC0GljDu+yQeZAlPBbMQ6iTz P+w2aV+C/C3uIezU2/4ZAmxUz/P71b+KUL9M1kPpeZwq7w949GbyySP7hMMce4CSYfsM gbF3T7M1J/35XBrO2ulY/Ulo37YHjgeAv92y3Hd7+wqMEO7z3bnSWso6u+mudiWFajNx VB7ZR9S3tqTK0W8tnbHhGWxcJxaLvZF0KUwaJyilTwlXw5sRlPBztWZz14Q+TkpdP8xk RywPn7cylWV1MO8Pi84ni1vat1mWIfvhqY7SZ2jPf7m4e+9Qa0Xguk2hI4N0xBnYdSJW fuvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:subject:cc:to:from:message-id :date:dkim-signature:dkim-signature; bh=SNpBB1riqWMDgTE3zjGmFc2HQ/tL4Dep2J1e5XaBy04=; b=jzMte2V4488eKK2HOgsaCvfoFMYaIOQKQ/jIVJ0ivvJVV2f5qmRelxuxHMhcieQ+0f DqD/V84j0nUcAhbifYV34TwhYba2TJAfGYG0SokAImOfGecjx0+g2E5be8/DzvcXgWIY rj8BwiDQwHmQuClUx7qt5wZppDSxMsUBPJsB/1YqNaAoUW7pmVobCxBJo9KAxQZ1nada Dh2wyB1Z4mPrb/mK5sAjuZUJlw8VgUl1opoTdFyeMfl0C7KreH+PEvzZ7P6f9WTfUFY/ ziwE4QFSdggk1+4BF1eWQUx9nJ8vNa4z/Oo8psB2eceD0YPn/lYBWzmzMv7icEsdzR9W 4TfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=cu4eirSW; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=fm3uV55Q; 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=suse.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z10si2273861edd.2.2021.08.25.23.05.40; Wed, 25 Aug 2021 23:06:05 -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=@suse.de header.s=susede2_rsa header.b=cu4eirSW; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=fm3uV55Q; 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=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238215AbhHZGEd (ORCPT + 99 others); Thu, 26 Aug 2021 02:04:33 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:54896 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235644AbhHZGEc (ORCPT ); Thu, 26 Aug 2021 02:04:32 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 36B7122275; Thu, 26 Aug 2021 06:03:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1629957825; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SNpBB1riqWMDgTE3zjGmFc2HQ/tL4Dep2J1e5XaBy04=; b=cu4eirSW+5hHB/QGrqiL+5zPRaYHWNOMwV7XFP2NmbGdXIDu53pBC/7mSqABuvrPFRGQcd ZRVpyRmtVKjx2P49Z7tasFLO9zoMCIc3+hADXSR+Zk3qmYnntAJrp6lxNb5vhs+5AbQ8qo gv/Kk/IwqK3c1GIMa/EK6Dl73w34Yy0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1629957825; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SNpBB1riqWMDgTE3zjGmFc2HQ/tL4Dep2J1e5XaBy04=; b=fm3uV55QwT9JRwtq/R5RU6dPv33n4R+zjz9hNhqOzhymo8Ud1e0Ujta/UJ8Y/Wl6l78pQ/ 2V7uwIyOmXfCClDA== Received: from alsa1.suse.de (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id 2C0D6A3B89; Thu, 26 Aug 2021 06:03:45 +0000 (UTC) Date: Thu, 26 Aug 2021 08:03:45 +0200 Message-ID: From: Takashi Iwai To: Vitaly Rodionov Cc: , , Stefan Binding , Takashi Iwai , Subject: Re: [PATCH 2/2] ALSA: hda/cs8409: Prevent pops and clicks during reboot In-Reply-To: References: <20210812183433.6330-1-vitalyr@opensource.cirrus.com> <20210812183433.6330-2-vitalyr@opensource.cirrus.com> <6595e87d-1dae-b536-c17b-eafa07d04bbe@opensource.cirrus.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=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 25 Aug 2021 20:04:05 +0200, Vitaly Rodionov wrote: > Actually when codec is suspended and we do reboot from UI, then sometimes we > see suspend() calls in kernel log and no pops, but sometimes > > we still have no suspend() on reboot and we hear pops. But when we do reboot > from command line: > sudo reboot  then we always have pops and no suspend() > called. > > Then we have added extra logging and we can see that on reboot codec somehow > getting resume() call and we run jack detect on resume that causing pops. Hm, it's interesting who triggers the runtime resume. > We were thinking about possible solution for that and we would propose some > changes in generic code hda_bind.c: > > static void hda_codec_driver_shutdown(struct device *dev) { +   if (codec-> > patch_ops.suspend) +      codec->patch_ops.suspend(codec);    > snd_hda_codec_shutdown(dev_to_hda_codec(dev)); +  hda_codec_driver_remove > (dev_to_hda_codec(dev)); } Sorry, it's no-no. The suspend can't be called unconditionally, and the driver unbind must not be called in the callback itself. Does the patch below work instead? thanks, Takashi --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -2356,8 +2356,11 @@ static void azx_shutdown(struct pci_dev *pci) if (!card) return; chip = card->private_data; - if (chip && chip->running) + if (chip && chip->running) { + chip->bus.shutdown = 1; + cancel_work_sync(&bus->unsol_work); azx_shutdown_chip(chip); + } } /* PCI IDs */