Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp4558553imd; Tue, 30 Oct 2018 04:05:50 -0700 (PDT) X-Google-Smtp-Source: AJdET5cehKTwWKgJD6rfxquWAFjxod4ZXPtBfEVliM3chdtERkx+RFuq6Ptb4KYAMKgsqE9qjxh1 X-Received: by 2002:a17:902:3041:: with SMTP id u59-v6mr17443878plb.279.1540897550541; Tue, 30 Oct 2018 04:05:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540897550; cv=none; d=google.com; s=arc-20160816; b=D9qv+3U6uc3jnUUaiUfq36hn74TbgsnlEd6JMnfbmRX8D9JttwDCch8EPcFeRVVlgL 22vYCqCFkQpZYlUxWxCnG41EbuaZ06u8d0iMAGynib6Y7BBYuwcZIs8m4V5EiU6x3xpZ vBmzMgzBZsGH/V5iL3pvwnRaHSMv7SRep88cU9fMKiAuD1dFeo+BIZuMIRGXEoqXZYvI AoX2gtScdxk+d4a2sVRqDXv841qaL6TZUOOHw2roFhRk/IjuVxPaGte7opuBCSWm/jFe +t3Rcahnqus4hsJenIt5iAas4FgB9bFFmnyGi53SCCIBKHuXCmBNvr33zIpEzFQB6tvb qNnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:from:subject; bh=Pq3egYQUyuuJbhC2nWzxHhInwWV28VvPoPKdYpujsls=; b=bDrPTZ0G3dpbnx1fzr66qNN4kQaqRVUJqMGCRu69G+mA5er8hvVze1Q40ZBwRQ66iL MNl34uNjBOmJUTdYrDzOSfJ3tV1q56TrHZ38WlS4rTz2uEbE25DdSw5VwfBRw6MTN+al kBy/FFVOO6rq/jApV+6pfy/ebsFsNXN0au7epw1v9mdaDOkXQ7kbfuCH5Y7txtOb6ViI yJvIW/OrcW1Rn0OVJUCFBamxdkIS8HIfnYhnOiSR7L9ZRN8AWAMSmqRicKtzQBpw11Hb gg4SX+rwPDpMWW+4NC2t/XItb1B/l4fb+KNqK88CrBECktjELFjZ+Ge19qPihuyg/yV9 kJNA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t27-v6si6118985pfl.107.2018.10.30.04.05.32; Tue, 30 Oct 2018 04:05:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727716AbeJ3T6I (ORCPT + 99 others); Tue, 30 Oct 2018 15:58:08 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:39678 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727638AbeJ3T6H (ORCPT ); Tue, 30 Oct 2018 15:58:07 -0400 Received: by mail-wr1-f68.google.com with SMTP id r10-v6so12087842wrv.6 for ; Tue, 30 Oct 2018 04:05:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Pq3egYQUyuuJbhC2nWzxHhInwWV28VvPoPKdYpujsls=; b=cQnR4NQP4RtA65+gQK2KPaUzuhropX32uLHzE8M0YgM07Rr4ArCGICSdmQWzKsA6Xl uBepBRvSKcAksTcNDy2VP6/S+tQaEpaoN8/AyqiBSY1hwkwiSY02742zzEN0XI1dqwCI EVSnLzSWxONIQLF4tY3yXvcIlX5tJMAuj7uLoQE1rf4vkdPkqEkDYLeyQsA3a4WHeXqu 7dpfpOwMs7idqBevBkb38RpCq1JF6Y9qh2pBJfyKMGMFNiG5vdCd1+5B4T/irEKXW8KM d35VfnyD/Qac4qvqJxyay4RVIndzlhZsGW0/cEOj+01dgWSO1z957NQvktAo8XIw30BE UA/A== X-Gm-Message-State: AGRZ1gLmqo2EUW+tA4WPrMyhmeuBGxhNMSwg9Ur+P2pDZIi0rh/tXS+y vMBE1Wbw1/RPW9sTVNzD4Quw0g== X-Received: by 2002:a5d:4d81:: with SMTP id b1-v6mr19230463wru.80.1540897505393; Tue, 30 Oct 2018 04:05:05 -0700 (PDT) Received: from shalem.localdomain (546A5441.cm-12-3b.dynamic.ziggo.nl. [84.106.84.65]) by smtp.gmail.com with ESMTPSA id r16-v6sm21258596wrv.21.2018.10.30.04.05.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Oct 2018 04:05:04 -0700 (PDT) Subject: Re: Regression found (Stop-marking-clocks-as-CLK_IS_CRITICAL) From: Hans de Goede To: Pierre-Louis Bossart , Dean Wallace , Andy Shevchenko Cc: Stephen Boyd , Michael Turquette , linux-clk , Stable , Johannes Stezenbach , Carlo Caione , Andy Shevchenko , Linux Kernel Mailing List , Mogens Jensen References: <20181025232517.ywnw54qibemosjws@picard> <154083512089.98144.9141070901932719147@swboyd.mtv.corp.google.com> <20181029190819.2ivlx73n6y6sx4vk@picard> Message-ID: <2696c9c2-29f7-18cf-1893-bd2fc2f203f9@redhat.com> Date: Tue, 30 Oct 2018 12:05:03 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 30-10-18 11:17, Hans de Goede wrote: > Hi Pierre-Louis, > > On 29-10-18 23:03, Pierre-Louis Bossart wrote: >> >> On 10/29/18 2:08 PM, Dean Wallace wrote: >>> On 29-10-18, Andy Shevchenko wrote: >>>> On Mon, Oct 29, 2018 at 7:52 PM Andy Shevchenko >>>> wrote: >>>>> Cc: Pierre as well. >>>>> >>>>> On Mon, Oct 29, 2018 at 7:48 PM Stephen Boyd wrote: >>>>>> Quoting Dean Wallace (2018-10-25 16:25:17) >>>>>>> I have found a regression in 4.18.15 that means I lose sound on my old >>>>>>> Toshiba Chromebook 2 (Swanky).  My system details are:- >>>>>>> >>>>>>> Toshiba Chromebook (Swanky) >>>>>>> MrChromebox UEFI coreboot >>>>>>> Arch Linux running latest alsa/pulseaudio >>>>>>> >>>>>>> Upgraded kernel from 4.18.14 to 4.18.15 and lost all sound output.  By >>>>>>> output I mean, the card is still detected, the module loaded, all apps >>>>>>> showing sound is being playing, but no actual audible sound comes >>>>>>> through.  Upgraded to 4.18.16 same issue. >>>>>>> >>>>>>> Dug around and found Upstream commit 648e921888ad96ea3dc922739e96716ad3225d7f >>>>>>> clk: x86: Stop marking clocks as CLK_IS_CRITICAL >>>>>>> "This commit removes the CLK_IS_CRITICAL marking, fixing Cherry Trail >>>>>>> devices not being able to reach S0i3 greatly decreasing their battery >>>>>>> drain when suspended." >>>>>>> >>>>>>> I reverted it and compiled 4.18.16 and have sound back again.  Could >>>>>>> this be looked into, with possibility of fix. >>>>>>> >>>>>> Thanks for the bug report. I'm adding some people involved in the commit >>>>>> you mention is causing audio regressions. The best plan is to probably >>>>>> revert the commit from the 4.18 linux stable tree. Or there may be >>>>>> another patch missing that would be useful to make this backported patch >>>>>> work. Hopefully Hans or Andy knows. >>>>> Hans has been investigating S0ix issues on Baytrail and Cherrytrail machines. >>>>> I have a feeling that the problem can be fixed by properly handling >>>>> clock in ASoC driver(s). Perhaps Hans and Pierre can figure this out >>>>> better than me. >>>> Looking to sound/soc/intel/boards/cht_bsw_rt5672.c I see no >>>> suspend-resume hooks. Perhaps, adding them like in the commit >>>> ac8bd9e13be2 ("r8169: Disable clk during suspend / resume") would >>>> help. >> >> I missed this change while i was away. It's indeed the expectation that the audio mclk is handled by the firmware, > > I believe that the statement "It's indeed the expectation that the > audio mclk is handled by the firmware" is not correct for BYT/CHT > platforms (and the commit causing the regression only affects BYT/CHT > platforms). Various machine drivers under sound/soc/intel/boards have > code to deal with the mclk themselves, like this: > >         drv->mclk = devm_clk_get(&pdev->dev, "pmc_plt_clk_3"); > ... > >         if (SND_SOC_DAPM_EVENT_ON(event)) { >                 ret = clk_prepare_enable(ctx->mclk); >         ... >         } else { >                 clk_disable_unprepare(ctx->mclk); >         } > > The above code is from sound/soc/intel/boards/cht_bsw_max98090_ti.c > which is the machine driver used on the machines for which problems > are now being reported. > > And my commit introducing the problem is in essence a revert of: > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit?id=d31fd43c0f9a41e2678a1e78c0f22f0384c6edd3 > > Which is from 2017-07-14 and the ASoC code for BYT/CHT platforms is > much older then that. > > Also I asked Carlo why he wrote that patch and it was to fix a problem > with ethernet on some laptops. > >> not sure I understand why removing the CLK_IS_CRITICAL was necessary or what it has to do with S0ix. > > It is necessary, because if it is set the clock never gets disabled and > on x86 platforms using suspend2idle we are responsible for *all* the hardware > power-management as OS. If we do not disable the clocks then we can only > reach S0i1 instead of S0i3 when suspended leading to increased battery > drain during suspend. > > Also note that this patch is only causing problems on CHT + max98090 codec > using machines. I've tested it on many other BYT/CHT machines myself and > we've not had any other bug reports related to this. > > So this clearly points to a problem with the clock management in the > cht_bsw_max98090_ti.c machine driver. > > I've some ideas how to fix this and I will prepare some patches to test. p.s. It seems that a sub-thread of this thread where me and the reporter have been working on debugging this has lost most of the people in the Cc. So here is a quick status update. So far this issue has been seen on Swanky and Clapper model chromebooks. Reverting the patch causing this regression and then doing: for i in /sys/kernel/debug/clk/pmc_plt_clk_?; do echo -n "$i: "; cat $i/clk_flags; echo; done has shown that before my patch to not set CLK_IS_CRITICAL the CLK_IS_CRITICAL was being set on pmc_plt_clk_0. Which shows that that clock is somehow being used for sounds on these boards. I think that pmc_plt_clk_0 is being used instead of pmc_plt_clk_3, but it could also be the case that both are being used. I'm currently preparing patches to test both scenarios. Regards, Hans