Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp314077pxb; Thu, 26 Aug 2021 03:57:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxSVhNy4zN6U+DipWFKEPX9oO6YqgeCIBGsSboU06g6zD+7FbKjotDWU5HKna/lFQHAdVg6 X-Received: by 2002:a05:6638:3048:: with SMTP id u8mr2912066jak.91.1629975449180; Thu, 26 Aug 2021 03:57:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629975449; cv=none; d=google.com; s=arc-20160816; b=bAvHh5MIldfu/RjdiHO45FbWAbTqMY7xzRJ5BcneMPjuPV3ncqUamr/IqOT4KKUyV8 8rwtonVetvfq9LUCJMgC9OfTYNn7jm6rGO2vK0Whz0RbH/x3jM3zMgBwN6xjGcFUrOJz VEzgCTlWJZ0ts70Zgyy1ts0eU+RQ+4F1wqH8tU+af7XOecS+2oFM4fkv82BAPjDz8iE1 1QFYuxrBsMR8vXVEmSTcGlr2YwHhDjTBQ3aB3XT1f6D3HB8x02YFyL4nSOWZKcNQnW01 mj/exiSXOo2/72AfENObHiunn276fCKZPNfHUZovcZtd2lPODoW9V/n+lGw86yDZhzRd OLfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=rKbGnFewnvquiODNsJhrKCT/ltFar1VCwKiMo46phr4=; b=m95zhyck/oxaQSD7gPB9OZXM9kjEzCfcVHBHG+qHKKShLtoeMU+eX9DexkQ0+GqFpp TPHIG45afus9943Ksvyk7ci3nGnfJUenHfaBFjMPD5o8PaMe43UB8mRcFF5EPNHdCtCb rhGbZlfH7gyMp5No+ADrPEL4V6BSdE28vRuvt6S+pH+C8sa7idGFMe7faC8pJ/ciljK1 Mc2T3uGRuAsCZBsGLHKL4+FswZwjJG24kA+1JwtNxVcLfUzLkk2SjIhO05S9l26GuHEJ VcdviC/82HW5dMRe+9FRSV5lR/gSM2uOln4Jocp9C9NxumDzQs8oE/tCBWEEJhPuM2Ts WB9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b="mtUwhHf/"; 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=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a10si2262424iow.65.2021.08.26.03.57.17; Thu, 26 Aug 2021 03:57:29 -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=@cirrus.com header.s=PODMain02222019 header.b="mtUwhHf/"; 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=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241608AbhHZK5R (ORCPT + 99 others); Thu, 26 Aug 2021 06:57:17 -0400 Received: from mx0a-001ae601.pphosted.com ([67.231.149.25]:38426 "EHLO mx0b-001ae601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S241491AbhHZK5Q (ORCPT ); Thu, 26 Aug 2021 06:57:16 -0400 Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 17Q5tlP8023865; Thu, 26 Aug 2021 05:56:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=PODMain02222019; bh=rKbGnFewnvquiODNsJhrKCT/ltFar1VCwKiMo46phr4=; b=mtUwhHf/r/6OPjcv+AAhRvCQEs3tHWbVXh2AZTmzcSkiw1Phc1gFDs9D5QeC+YRdjcOL bkKIA7wuboYj5wYYaytGaYPbr6Xs6+gaWj1mJOkho2TAXpFS+SZLS4WQ3I7NqK+NNVMk dXNkhuvQ2G4hNAKiDBWUSLlJIVZx29wA6W6TfQiuEOinercjPvHxToK48kToQpW7B2lh l+5sZokVwDcxWi731BiulpxKXEAAn7n98/QrVik1vL6CMr186MzihCXyJTmiC5ZD65Sb FxMBcITCoGjEJANm/hSK/5FqtRjJeeqb0+5ZIifV5fGxuApVQBCHb4Au2oUXOgaJ+kru 9g== Received: from ediex02.ad.cirrus.com ([87.246.76.36]) by mx0a-001ae601.pphosted.com with ESMTP id 3anr2esha4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Thu, 26 Aug 2021 05:56:17 -0500 Received: from EDIEX01.ad.cirrus.com (198.61.84.80) by EDIEX02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Thu, 26 Aug 2021 11:56:15 +0100 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by EDIEX01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server id 15.1.2242.12 via Frontend Transport; Thu, 26 Aug 2021 11:56:15 +0100 Received: from [198.90.238.186] (unknown [198.90.238.186]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 09A312BA; Thu, 26 Aug 2021 10:56:14 +0000 (UTC) Subject: Re: [PATCH 2/2] ALSA: hda/cs8409: Prevent pops and clicks during reboot To: Takashi Iwai CC: , , Stefan Binding , Takashi Iwai , References: <20210812183433.6330-1-vitalyr@opensource.cirrus.com> <20210812183433.6330-2-vitalyr@opensource.cirrus.com> <6595e87d-1dae-b536-c17b-eafa07d04bbe@opensource.cirrus.com> From: Vitaly Rodionov Message-ID: <2974107a-787f-8788-2ee1-86b6c8055035@opensource.cirrus.com> Date: Thu, 26 Aug 2021 11:56:07 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Proofpoint-GUID: SoaxBqdzVWYlswpM0hroqg8cXsUk-RLq X-Proofpoint-ORIG-GUID: SoaxBqdzVWYlswpM0hroqg8cXsUk-RLq X-Proofpoint-Spam-Reason: safe Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 26/08/2021 11:49 am, Takashi Iwai wrote: > On Thu, 26 Aug 2021 08:03:45 +0200, > Takashi Iwai wrote: >> 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? > Sorry there was a typo. A bit more revised patch is below. > > > Takashi Hi Takashi, Thanks a lot for quick response. I have tested previous patch and it did not fix an issue, as suspend() was not called. Now I will test new revised patch and let you know ASAP. I am adding some extra logging, unfortunately on reboot these messages are missing from kernel log, however I managed to capture reboot screen and I will attach an image where last messages shown. Thanks, Vitaly > > --- a/sound/pci/hda/hda_intel.c > +++ b/sound/pci/hda/hda_intel.c > @@ -1383,14 +1383,17 @@ static void azx_free(struct azx *chip) > hda->freed = 1; > } > > -static int azx_dev_disconnect(struct snd_device *device) > +static void __azx_disconnect(struct azx *chip) > { > - struct azx *chip = device->device_data; > struct hdac_bus *bus = azx_bus(chip); > > chip->bus.shutdown = 1; > cancel_work_sync(&bus->unsol_work); > +} > > +static int azx_dev_disconnect(struct snd_device *device) > +{ > + __azx_disconnect(device->device_data); > return 0; > } > > @@ -2356,8 +2359,10 @@ static void azx_shutdown(struct pci_dev *pci) > if (!card) > return; > chip = card->private_data; > - if (chip && chip->running) > + if (chip && chip->running) { > + __azx_disconnect(chip); > azx_shutdown_chip(chip); > + } > } > > /* PCI IDs */