From mboxrd@z Thu Jan 1 00:00:00 1970 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=-2.2 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no 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 C4824C28CBC for ; Wed, 6 May 2020 16:13:30 +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 4A655208CA for ; Wed, 6 May 2020 16:13:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="tJ98rTGO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4A655208CA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com 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 97843171D; Wed, 6 May 2020 18:12:38 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 97843171D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1588781608; bh=aH3Q0WQnmtzDKh0GuRVgXgBeVz1l5BCk0k5umGqU6/E=; h=Subject:To:References:From:Date:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=tJ98rTGOr5wFWRay8GIxZzhgnCRTk2J7JAnx7Gl1Hug9nb2Ue1gehbQ8n6jUk30fc l6laC/giozkgWhUQsUVI9vW9HBJSJ9k3cmnuJBhfA+0N10in6raumA6PrfB+6Kb4Fc otouuhfuHKt9pLDkxX5ofAIWTo5Fr5ZYDBtHxGd4= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 3CCCCF80234; Wed, 6 May 2020 18:12:38 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 26A5DF80249; Wed, 6 May 2020 18:12:36 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id C12FFF800AD for ; Wed, 6 May 2020 18:12:26 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C12FFF800AD IronPort-SDR: v1E3CLSUFGwonLD6RWplKF6KLrWZk2j7zp4eOS2EinixqyfCv8oYYlWZVaPEe5x6wB5ziadyfw rzQad0unfypw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2020 09:12:23 -0700 IronPort-SDR: NOAfkdK19OS7XIm55yw+N3YrPpwhcapAGB/PmXnxZmF2WpE2OENiFtWDlIx77Q426IB3UvryWD PLm0HZxEFWdQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,359,1583222400"; d="scan'208";a="249808805" Received: from sbhat1-mobl.amr.corp.intel.com (HELO [10.251.3.11]) ([10.251.3.11]) by fmsmga007.fm.intel.com with ESMTP; 06 May 2020 09:12:21 -0700 Subject: Re: Keeping the codec running at all times To: Jaroslav Kysela , Ricard Wanderlof , alsa-devel References: <7a54134e-ce30-d7d5-bcf3-31269f1103f1@perex.cz> From: Pierre-Louis Bossart Message-ID: <73594637-b978-aca8-e81e-be72a5075ae8@linux.intel.com> Date: Wed, 6 May 2020 11:12:20 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <7a54134e-ce30-d7d5-bcf3-31269f1103f1@perex.cz> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit 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" >> In certain system-on-chip systems, with separate ADCs and DACs for >> instance, the ADC could generate clocks for the DAC, where it not for the >> fact that ALSA shuts down whatever device is not being used in order to >> conserve power. Is it possible to instruct ALSA not to do this, i.e. once >> a codec has been configured to operate at a given sample rate, it will >> continue to do so, even after all streams have stopped. >> >> I suppose one way to do this would be to change the codec >> set_bias_level() >> callback so that the BIAS_OFF and BIAS_STANDBY cases don't do anything >> but >> leave the codec running. But it doesn't sound like a clean way of doing >> this. >> >> Of course, one complication is that at system startup, before any capture >> or playback operations have been attempted, ALSA doesn't know which >> sample >> rate should be configured, as there is no concept of a 'default sample >> rate'; the sample rate is always set when a stream is opened. > > The driver may limit the available rates (thus it may be possible to set > the one accepted rate via the module parameter or so which may be used > for the codec initialization before an application uses the PCM device). It's a valid request, some platforms want to avoid any glitches due to clocks and require that they remain active, even if it means writing-off power optimizations. If your codec exposes a clock object then you could have e.g. a board or machine driver configure the clock (clk_get/clk_set_rate/clk_prepare_enable) and leave it on regardless of the streaming usages. You would still need to make sure that the clock rates are compatible with the hw_params when streaming does happen. that's what e.g. was done for Intel to make sure the MCLK, BCLK and FSYNC could be enabled even when the DSP was idle.