From patchwork Wed Oct 19 17:53:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 616450 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id F1E39C4332F for ; Wed, 19 Oct 2022 17:40:40 +0000 (UTC) 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 3147BAF80; Wed, 19 Oct 2022 19:39:49 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 3147BAF80 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1666201239; bh=balksJ4DcgKo/myJ5XKTp/iK1/FFaM13O6nS0HqnHSA=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=iYFY6h1Nj+ej3c8XrjSa8iX6bpksZY0LXstgVtGm0LUVYlx1zhgwKONV+j37B45hT pBGBHRltpfJs1roz18qeDiDZ5NDhpRnIKICrjjcn/ZfDsmY2KVRFE+GQXOixQhcXOR 9lzJZSyBgBZnUN9IfeaygmsS3B2t6JK8c3y3xQnU= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id B93C6F8057C; Wed, 19 Oct 2022 19:37:48 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 08F69F804CB; Wed, 19 Oct 2022 19:37:46 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (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 9F899F804CC for ; Wed, 19 Oct 2022 19:37:37 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 9F899F804CC Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="J/KvcBMl" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666201058; x=1697737058; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=balksJ4DcgKo/myJ5XKTp/iK1/FFaM13O6nS0HqnHSA=; b=J/KvcBMl48x47896NBQAM5jPMC0/hcq+F23dpouSY9/pO/js8PZhFj5J r9aBa49eCGBlyHzpq9xLubbBioT/pLC7bTCtuDbqe1uwCAozlg4u5noXG I1GhZqzL14EyxFH0VvpiNGknDIR3pXPeybrQmJQnXGbSTzaDoJ7M33HW8 LFBLatWaNXkiMP3wN4ZmFs5M5Do/D3s9obyP/b5kdqeXZ5WLH4Aldg4OJ 3feoMvPly8cqTCC4Swj1ZqLueXKalXccHg7ov6klZypl2iDxlP4LAPjyQ tMNBayCSoHdIMjK9i0JAJ+hCY+0WKnV948guARlGicIA1f46QlesERvQD A==; X-IronPort-AV: E=McAfee;i="6500,9779,10505"; a="333045716" X-IronPort-AV: E=Sophos;i="5.95,196,1661842800"; d="scan'208";a="333045716" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Oct 2022 10:37:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10505"; a="771898590" X-IronPort-AV: E=Sophos;i="5.95,196,1661842800"; d="scan'208";a="771898590" Received: from crojewsk-ctrl.igk.intel.com ([10.102.9.28]) by fmsmga001.fm.intel.com with ESMTP; 19 Oct 2022 10:37:25 -0700 From: Cezary Rojewski To: alsa-devel@alsa-project.org, broonie@kernel.org Subject: [PATCH 8/8] ASoC: Intel: avs: Enact power gating policy Date: Wed, 19 Oct 2022 19:53:17 +0200 Message-Id: <20221019175317.1540919-9-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221019175317.1540919-1-cezary.rojewski@intel.com> References: <20221019175317.1540919-1-cezary.rojewski@intel.com> MIME-Version: 1.0 Cc: Cezary Rojewski , pierre-louis.bossart@linux.intel.com, tiwai@suse.com, hdegoede@redhat.com, amadeuszx.slawinski@linux.intel.com 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" Update all firmware loading functions to also account for the power gating policy. As module loading routine is missing the chicken bits manipulation entirely, add the entire set there. Signed-off-by: Cezary Rojewski --- sound/soc/intel/avs/loader.c | 10 ++++++++++ sound/soc/intel/avs/pcm.c | 2 ++ 2 files changed, 12 insertions(+) diff --git a/sound/soc/intel/avs/loader.c b/sound/soc/intel/avs/loader.c index 2d80a271eb50..35811fe4a160 100644 --- a/sound/soc/intel/avs/loader.c +++ b/sound/soc/intel/avs/loader.c @@ -224,11 +224,19 @@ static int avs_cldma_load_module(struct avs_dev *adev, struct avs_module_entry * if (ret < 0) return ret; + avs_hda_power_gating_enable(adev, false); + avs_hda_clock_gating_enable(adev, false); + avs_hda_l1sen_enable(adev, false); + hda_cldma_set_data(cl, (void *)mod->data, mod->size); hda_cldma_transfer(cl, msecs_to_jiffies(AVS_CLDMA_START_DELAY_MS)); ret = avs_ipc_load_modules(adev, &mentry->module_id, 1); hda_cldma_stop(cl); + avs_hda_l1sen_enable(adev, true); + avs_hda_clock_gating_enable(adev, true); + avs_hda_power_gating_enable(adev, true); + if (ret) { dev_err(adev->dev, "load module %d failed: %d\n", mentry->module_id, ret); avs_release_last_firmware(adev); @@ -605,6 +613,7 @@ int avs_dsp_boot_firmware(struct avs_dev *adev, bool purge) for (i = 1; i < adev->fw_cfg.max_libs_count; i++) memset(adev->lib_names[i], 0, AVS_LIB_NAME_SIZE); + avs_hda_power_gating_enable(adev, false); avs_hda_clock_gating_enable(adev, false); avs_hda_l1sen_enable(adev, false); @@ -625,6 +634,7 @@ int avs_dsp_boot_firmware(struct avs_dev *adev, bool purge) reenable_gating: avs_hda_l1sen_enable(adev, true); avs_hda_clock_gating_enable(adev, true); + avs_hda_power_gating_enable(adev, true); if (ret < 0) return ret; diff --git a/sound/soc/intel/avs/pcm.c b/sound/soc/intel/avs/pcm.c index a869402e0f4c..d2f1aacb3b2c 100644 --- a/sound/soc/intel/avs/pcm.c +++ b/sound/soc/intel/avs/pcm.c @@ -743,6 +743,7 @@ static int avs_component_load_libraries(struct avs_soc_component *acomp) if (ret < 0) return ret; + avs_hda_power_gating_enable(adev, false); avs_hda_clock_gating_enable(adev, false); avs_hda_l1sen_enable(adev, false); @@ -750,6 +751,7 @@ static int avs_component_load_libraries(struct avs_soc_component *acomp) avs_hda_l1sen_enable(adev, true); avs_hda_clock_gating_enable(adev, true); + avs_hda_power_gating_enable(adev, true); if (!ret) ret = avs_module_info_init(adev, false);