From patchwork Thu Oct 27 19:35:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 619242 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 087F6FA3740 for ; Thu, 27 Oct 2022 19:37:26 +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 051EB2DC6; Thu, 27 Oct 2022 21:36:35 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 051EB2DC6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1666899445; bh=VxFccdJ8eFX8YQpbBjOx217t3AgYTLeNa00RZgnlJ9g=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=elaKA1VI0N5fUBn2fBOG/hJr9H3tE2cP9FVpAMMEVQXvYSXCgYU+pLhbAAlQ9vOS6 B/x5Y6pOVPiw3jwWS53J4O5BE45OkVR0qmPbcI97oiwv5r1dQLOKREQx3o9iQbK9Rr 5R1xXpSjPUqGzAhjPYh2HJANAmSXW9HoLTedETsI= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 64B2BF80553; Thu, 27 Oct 2022 21:36:16 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 2C5A5F80553; Thu, 27 Oct 2022 21:36:14 +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 935A6F80100 for ; Thu, 27 Oct 2022 21:36:07 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 935A6F80100 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="OREeyn8m" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666899368; x=1698435368; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=VxFccdJ8eFX8YQpbBjOx217t3AgYTLeNa00RZgnlJ9g=; b=OREeyn8mFS0nvVJTfZKDne5unIXwe7FdFFBAbiYL7a/Tlg5/X839PWAl o5DdYwgzPsTjpi8YrhdvFzH2sYuBhPF0shb7vvHaNTeuV5EVVmSChJxYR 9YVhzSfnY7cFWssR2+J0K3lV6FG4aeWTXeE5rH8FfsJ+CbqCSd/fB6Sfa KTjiKYBMn8ajkvxYRWU4BT/Zk1DUuVo+z3Hu6lqhCRmcefnXYmO/n7SSk MYRsqGN390RxMixUzvbVD9yU2mvpr8lDrlYCGJupngcPEqGtL7xX+gWnk 6/memQE61LrvtCtljE+uRnzy4Qj2zUjzF+PFmz+UJd9Z0mIEE2pCJhnoP Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10513"; a="334957798" X-IronPort-AV: E=Sophos;i="5.95,218,1661842800"; d="scan'208";a="334957798" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Oct 2022 12:36:03 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10513"; a="632526944" X-IronPort-AV: E=Sophos;i="5.95,218,1661842800"; d="scan'208";a="632526944" Received: from vmehta-mobl.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.212.6.254]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Oct 2022 12:36:02 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Subject: [PATCH 01/21] ASoC: SOF: Intel: remove option to disable the common_hdmi handling Date: Thu, 27 Oct 2022 15:35:20 -0400 Message-Id: <20221027193540.259520-2-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221027193540.259520-1-pierre-louis.bossart@linux.intel.com> References: <20221027193540.259520-1-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Cc: Cezary Rojewski , tiwai@suse.de, =?utf-8?q?P?= =?utf-8?q?=C3=A9ter_Ujfalusi?= , Pierre-Louis Bossart , Rander Wang , broonie@kernel.org, Ranjani Sridharan , Bard Liao 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" We've been using the same option for quite some time now, it's time to remove the kernel parameter to disable the common HDaudio codec handling. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: Bard Liao Reviewed-by: Péter Ujfalusi Reviewed-by: Ranjani Sridharan --- sound/soc/sof/intel/hda-codec.c | 12 +++--------- sound/soc/sof/intel/hda.c | 10 ++-------- sound/soc/sof/intel/hda.h | 6 ++---- 3 files changed, 7 insertions(+), 21 deletions(-) diff --git a/sound/soc/sof/intel/hda-codec.c b/sound/soc/sof/intel/hda-codec.c index f2ec2a6c2e0f..d5242b6e1552 100644 --- a/sound/soc/sof/intel/hda-codec.c +++ b/sound/soc/sof/intel/hda-codec.c @@ -133,8 +133,7 @@ static struct hda_codec *hda_codec_device_init(struct hdac_bus *bus, int addr, i } /* probe individual codec */ -static int hda_codec_probe(struct snd_sof_dev *sdev, int address, - bool hda_codec_use_common_hdmi) +static int hda_codec_probe(struct snd_sof_dev *sdev, int address) { #if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC) struct hdac_hda_priv *hda_priv; @@ -164,10 +163,6 @@ static int hda_codec_probe(struct snd_sof_dev *sdev, int address, if (!hda_priv) return -ENOMEM; - /* only probe ASoC codec drivers for HDAC-HDMI */ - if (!hda_codec_use_common_hdmi && (resp & 0xFFFF0000) == IDISP_VID_INTEL) - type = HDA_DEV_ASOC; - codec = hda_codec_device_init(&hbus->core, address, type); ret = PTR_ERR_OR_ZERO(codec); if (ret < 0) @@ -215,8 +210,7 @@ static int hda_codec_probe(struct snd_sof_dev *sdev, int address, } /* Codec initialization */ -void hda_codec_probe_bus(struct snd_sof_dev *sdev, - bool hda_codec_use_common_hdmi) +void hda_codec_probe_bus(struct snd_sof_dev *sdev) { struct hdac_bus *bus = sof_to_bus(sdev); int i, ret; @@ -227,7 +221,7 @@ void hda_codec_probe_bus(struct snd_sof_dev *sdev, if (!(bus->codec_mask & (1 << i))) continue; - ret = hda_codec_probe(sdev, i, hda_codec_use_common_hdmi); + ret = hda_codec_probe(sdev, i); if (ret < 0) { dev_warn(bus->dev, "codec #%d probe error, ret: %d\n", i, ret); diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c index 79c32d948b2d..fe0e8221534e 100644 --- a/sound/soc/sof/intel/hda.c +++ b/sound/soc/sof/intel/hda.c @@ -383,12 +383,6 @@ static int mclk_id_override = -1; module_param_named(mclk_id, mclk_id_override, int, 0444); MODULE_PARM_DESC(mclk_id, "SOF SSP mclk_id"); -#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA) -static bool hda_codec_use_common_hdmi = IS_ENABLED(CONFIG_SND_HDA_CODEC_HDMI); -module_param_named(use_common_hdmi, hda_codec_use_common_hdmi, bool, 0444); -MODULE_PARM_DESC(use_common_hdmi, "SOF HDA use common HDMI codec driver"); -#endif - static const struct hda_dsp_msg_code hda_dsp_rom_fw_error_texts[] = { {HDA_DSP_ROM_CSE_ERROR, "error: cse error"}, {HDA_DSP_ROM_CSE_WRONG_RESPONSE, "error: cse wrong response"}, @@ -929,7 +923,7 @@ static int hda_init_caps(struct snd_sof_dev *sdev) snd_hdac_ext_bus_get_ml_capabilities(bus); /* create codec instances */ - hda_codec_probe_bus(sdev, hda_codec_use_common_hdmi); + hda_codec_probe_bus(sdev); if (!HDA_IDISP_CODEC(bus->codec_mask)) hda_codec_i915_display_power(sdev, false); @@ -1335,7 +1329,7 @@ static void hda_generic_machine_select(struct snd_sof_dev *sdev, if (*mach) { mach_params = &(*mach)->mach_params; mach_params->codec_mask = bus->codec_mask; - mach_params->common_hdmi_codec_drv = hda_codec_use_common_hdmi; + mach_params->common_hdmi_codec_drv = true; } } #else diff --git a/sound/soc/sof/intel/hda.h b/sound/soc/sof/intel/hda.h index 17ed7e60cae8..e715bae32cad 100644 --- a/sound/soc/sof/intel/hda.h +++ b/sound/soc/sof/intel/hda.h @@ -714,8 +714,7 @@ void sof_hda_bus_init(struct hdac_bus *bus, struct device *dev); /* * HDA Codec operations. */ -void hda_codec_probe_bus(struct snd_sof_dev *sdev, - bool hda_codec_use_common_hdmi); +void hda_codec_probe_bus(struct snd_sof_dev *sdev); void hda_codec_jack_wake_enable(struct snd_sof_dev *sdev, bool enable); void hda_codec_jack_check(struct snd_sof_dev *sdev); @@ -731,8 +730,7 @@ int hda_codec_i915_exit(struct snd_sof_dev *sdev); #else -static inline void hda_codec_i915_display_power(struct snd_sof_dev *sdev, - bool enable) { } +static inline void hda_codec_i915_display_power(struct snd_sof_dev *sdev, bool enable) { } static inline int hda_codec_i915_init(struct snd_sof_dev *sdev) { return 0; } static inline int hda_codec_i915_exit(struct snd_sof_dev *sdev) { return 0; } From patchwork Thu Oct 27 19:35:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 619241 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 8EF8CFA3740 for ; Thu, 27 Oct 2022 19:37:59 +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 87FA32DDA; Thu, 27 Oct 2022 21:37:07 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 87FA32DDA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1666899477; bh=H6MdnLg8ogXu6qOFu0PPB0Wao3poFku9mww6l93r1ec=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=ukwhWPxmVMw9hK40JdJe4ppysBE75Fp6VHWPC7rtm5SgEh44PGfRITdzcIwDNvaWw 8AU4Tc2u62++tfww/TJs2yA/e26UINO/gC9v3TVtlstguVDXdpENO5WZjy8kEFjGvd qVyYnNhQE4ePtkGMGjScBsS03OQuC8xF7fUrOVpA= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id B1F1EF80095; Thu, 27 Oct 2022 21:36:21 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id C21BFF80579; Thu, 27 Oct 2022 21:36:20 +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 B088EF80095 for ; Thu, 27 Oct 2022 21:36:08 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz B088EF80095 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="gsXCf8mu" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666899369; x=1698435369; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=H6MdnLg8ogXu6qOFu0PPB0Wao3poFku9mww6l93r1ec=; b=gsXCf8muoPSVLMDEWaYW8GldEUls7RgFgyf4G4f5txplfVO8rx/b49by CHI2PdyVaSa2bfKBMMxumaJLya2+aSzvU38KhhtgPrlJHGzgJlzZBlEQQ Mne0yV25zQHUQQa6vEGgbW8vJmKFdcwH2Wl2TxiOejQulg0+qFB6LegiY Aqj+JnXcxhR75ftNCzd1x5ECpQQfVGCm/WsOKs4sZJfnFmht3oFNsu9IR KqKoFBuBHoH8vLNoYJygmZLkFpzx5IPJdPIVKh7lxqrmfkJRG4p4MMu7y 1sIr5aeTv4sBTXN4ZZmS0Ufy2oir5jZbRs+Und25CcCHB3Men/2wdfV/r A==; X-IronPort-AV: E=McAfee;i="6500,9779,10513"; a="334957810" X-IronPort-AV: E=Sophos;i="5.95,218,1661842800"; d="scan'208";a="334957810" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Oct 2022 12:36:06 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10513"; a="632526964" X-IronPort-AV: E=Sophos;i="5.95,218,1661842800"; d="scan'208";a="632526964" Received: from vmehta-mobl.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.212.6.254]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Oct 2022 12:36:05 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Subject: [PATCH 03/21] ASoC: SOF: Intel: hda-codec: simplify SND_SOC_SOF_HDA_AUDIO_CODEC handling Date: Thu, 27 Oct 2022 15:35:22 -0400 Message-Id: <20221027193540.259520-4-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221027193540.259520-1-pierre-louis.bossart@linux.intel.com> References: <20221027193540.259520-1-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Cc: Cezary Rojewski , tiwai@suse.de, =?utf-8?q?P?= =?utf-8?q?=C3=A9ter_Ujfalusi?= , Pierre-Louis Bossart , Rander Wang , broonie@kernel.org, Ranjani Sridharan , Bard Liao 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" Now that we have removed the dependency on SND_SOC_HDAC_HDMI, we can simplify the code and make the code conditional on a single #ifdef. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: Bard Liao Reviewed-by: Péter Ujfalusi Reviewed-by: Ranjani Sridharan --- sound/soc/sof/intel/hda-codec.c | 37 +++++++++++---------------------- sound/soc/sof/intel/hda.h | 10 +++++++-- 2 files changed, 20 insertions(+), 27 deletions(-) diff --git a/sound/soc/sof/intel/hda-codec.c b/sound/soc/sof/intel/hda-codec.c index 7feaf2ccb642..3b2ccf10be43 100644 --- a/sound/soc/sof/intel/hda-codec.c +++ b/sound/soc/sof/intel/hda-codec.c @@ -16,13 +16,12 @@ #include #include "../ops.h" #include "hda.h" + #if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC) #include "../../codecs/hdac_hda.h" -#endif /* CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC */ #define CODEC_PROBE_RETRIES 3 -#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC) #define IDISP_VID_INTEL 0x80860000 /* load the legacy HDA codec driver */ @@ -80,6 +79,7 @@ void hda_codec_jack_wake_enable(struct snd_sof_dev *sdev, bool enable) snd_hdac_chip_updatew(bus, WAKEEN, STATESTS_INT_MASK, mask); } +EXPORT_SYMBOL_NS(hda_codec_jack_wake_enable, SND_SOC_SOF_HDA_AUDIO_CODEC); /* check jack status after resuming from suspend mode */ void hda_codec_jack_check(struct snd_sof_dev *sdev) @@ -95,11 +95,6 @@ void hda_codec_jack_check(struct snd_sof_dev *sdev) if (codec->jacktbl.used) pm_request_resume(&codec->core.dev); } -#else -void hda_codec_jack_wake_enable(struct snd_sof_dev *sdev, bool enable) {} -void hda_codec_jack_check(struct snd_sof_dev *sdev) {} -#endif /* CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC */ -EXPORT_SYMBOL_NS(hda_codec_jack_wake_enable, SND_SOC_SOF_HDA_AUDIO_CODEC); EXPORT_SYMBOL_NS(hda_codec_jack_check, SND_SOC_SOF_HDA_AUDIO_CODEC); #if IS_ENABLED(CONFIG_SND_HDA_GENERIC) @@ -135,10 +130,7 @@ static struct hda_codec *hda_codec_device_init(struct hdac_bus *bus, int addr, i /* probe individual codec */ static int hda_codec_probe(struct snd_sof_dev *sdev, int address) { -#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC) struct hdac_hda_priv *hda_priv; - int type = HDA_DEV_LEGACY; -#endif struct hda_bus *hbus = sof_to_hbus(sdev); struct hda_codec *codec; u32 hda_cmd = (address << 28) | (AC_NODE_ROOT << 20) | @@ -158,12 +150,11 @@ static int hda_codec_probe(struct snd_sof_dev *sdev, int address) dev_dbg(sdev->dev, "HDA codec #%d probed OK: response: %x\n", address, resp); -#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC) hda_priv = devm_kzalloc(sdev->dev, sizeof(*hda_priv), GFP_KERNEL); if (!hda_priv) return -ENOMEM; - codec = hda_codec_device_init(&hbus->core, address, type); + codec = hda_codec_device_init(&hbus->core, address, HDA_DEV_LEGACY); ret = PTR_ERR_OR_ZERO(codec); if (ret < 0) return ret; @@ -186,25 +177,19 @@ static int hda_codec_probe(struct snd_sof_dev *sdev, int address) else codec->probe_id = 0; - if (type == HDA_DEV_LEGACY) { - ret = hda_codec_load_module(codec); - /* - * handle ret==0 (no driver bound) as an error, but pass - * other return codes without modification - */ - if (ret == 0) - ret = -ENOENT; - } + ret = hda_codec_load_module(codec); + /* + * handle ret==0 (no driver bound) as an error, but pass + * other return codes without modification + */ + if (ret == 0) + ret = -ENOENT; out: if (ret < 0) { snd_hdac_device_unregister(&codec->core); put_device(&codec->core.dev); } -#else - codec = hda_codec_device_init(&hbus->core, address, HDA_DEV_ASOC); - ret = PTR_ERR_OR_ZERO(codec); -#endif return ret; } @@ -231,6 +216,8 @@ void hda_codec_probe_bus(struct snd_sof_dev *sdev) } EXPORT_SYMBOL_NS(hda_codec_probe_bus, SND_SOC_SOF_HDA_AUDIO_CODEC); +#endif /* CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC */ + #if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC) && IS_ENABLED(CONFIG_SND_HDA_CODEC_HDMI) void hda_codec_i915_display_power(struct snd_sof_dev *sdev, bool enable) diff --git a/sound/soc/sof/intel/hda.h b/sound/soc/sof/intel/hda.h index 7a3184ed8b70..0506c0a8afac 100644 --- a/sound/soc/sof/intel/hda.h +++ b/sound/soc/sof/intel/hda.h @@ -710,7 +710,7 @@ void hda_dsp_ctrl_stop_chip(struct snd_sof_dev *sdev); */ void sof_hda_bus_init(struct hdac_bus *bus, struct device *dev); -#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA) +#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC) /* * HDA Codec operations. */ @@ -718,7 +718,13 @@ void hda_codec_probe_bus(struct snd_sof_dev *sdev); void hda_codec_jack_wake_enable(struct snd_sof_dev *sdev, bool enable); void hda_codec_jack_check(struct snd_sof_dev *sdev); -#endif /* CONFIG_SND_SOC_SOF_HDA */ +#else + +static inline void hda_codec_probe_bus(struct snd_sof_dev *sdev) { } +static inline void hda_codec_jack_wake_enable(struct snd_sof_dev *sdev, bool enable) { } +static inline void hda_codec_jack_check(struct snd_sof_dev *sdev) { } + +#endif /* CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC */ #if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC) && IS_ENABLED(CONFIG_SND_HDA_CODEC_HDMI) From patchwork Thu Oct 27 19:35:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 619240 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 E8073FA3740 for ; Thu, 27 Oct 2022 19:38:33 +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 15C2A2DC5; Thu, 27 Oct 2022 21:37:42 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 15C2A2DC5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1666899512; bh=L1063eZtklbm6ElAIxkRuZKBHgzNXoZuZOYreC68obE=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=giiKNGyCg34conEV4HWUeTUX70NbvmOoJFxKP2APzETlxrmRDQPoFYD+kVJnO3JNy JX+forF2ixm0FBiQCFO1fVAVz2x/xLhcHHk86IQxh0IPg9tQvIxbmWpbxSb0XgL+Nz tU5yAvS92Nnz0oCXg2EQmxO0TgnVjZshfMyfWW3w= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 47854F8057C; Thu, 27 Oct 2022 21:36:23 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 34E04F8056F; Thu, 27 Oct 2022 21:36:21 +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 C181FF804D9 for ; Thu, 27 Oct 2022 21:36:09 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C181FF804D9 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="kIqAngRd" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666899370; x=1698435370; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=L1063eZtklbm6ElAIxkRuZKBHgzNXoZuZOYreC68obE=; b=kIqAngRdBmwU7MaCCYou/DxQuoMFDO3LN67jynPLiv3DPK/h+R1sIUej iEtgdMC0E3w1+XlqGuKkEhEKMZv78sDin254nwvFoEUS7UkpC+gJtwSuN Re6G55TXH/A4YEtrlmT3kcjKLXgzFX55kXCVVQkQ0x4EPreoX+V022DXT J5TbSV9uIWESifxHZiAnkMBVAHMo9S5FfeV3ibJG9l6JSTCg1FuDJlXhA k2N1gQDxbd05G2vAzBCIdc8dWUMdGpcfTcVLC9Jz8o8jxJqWvw41Slm9k RasOWMrg8UAjbug9/h05IRko+tho6N2lU7xgimxmJ8n3UUKlY9aYNhTQY Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10513"; a="334957818" X-IronPort-AV: E=Sophos;i="5.95,218,1661842800"; d="scan'208";a="334957818" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Oct 2022 12:36:08 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10513"; a="632526979" X-IronPort-AV: E=Sophos;i="5.95,218,1661842800"; d="scan'208";a="632526979" Received: from vmehta-mobl.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.212.6.254]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Oct 2022 12:36:07 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Subject: [PATCH 05/21] ASoC: SOF: Intel: start moving multi-link handling in dedicated file Date: Thu, 27 Oct 2022 15:35:24 -0400 Message-Id: <20221027193540.259520-6-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221027193540.259520-1-pierre-louis.bossart@linux.intel.com> References: <20221027193540.259520-1-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Cc: Cezary Rojewski , tiwai@suse.de, =?utf-8?q?P?= =?utf-8?q?=C3=A9ter_Ujfalusi?= , Pierre-Louis Bossart , Rander Wang , broonie@kernel.org, Ranjani Sridharan , Bard Liao 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" The multi-link handling needs to be handled with dedicated helpers before cleanups and extensions. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: Bard Liao Reviewed-by: Péter Ujfalusi Reviewed-by: Ranjani Sridharan --- sound/soc/sof/intel/Makefile | 2 +- sound/soc/sof/intel/hda-mlink.c | 45 +++++++++++++++++++++++++++++++++ sound/soc/sof/intel/hda.c | 15 +++-------- sound/soc/sof/intel/hda.h | 12 +++++++++ 4 files changed, 61 insertions(+), 13 deletions(-) create mode 100644 sound/soc/sof/intel/hda-mlink.c diff --git a/sound/soc/sof/intel/Makefile b/sound/soc/sof/intel/Makefile index 8b8ea0361785..8201cbdd654c 100644 --- a/sound/soc/sof/intel/Makefile +++ b/sound/soc/sof/intel/Makefile @@ -5,7 +5,7 @@ snd-sof-acpi-intel-bdw-objs := bdw.o snd-sof-intel-hda-common-objs := hda.o hda-loader.o hda-stream.o hda-trace.o \ hda-dsp.o hda-ipc.o hda-ctrl.o hda-pcm.o \ - hda-dai.o hda-bus.o \ + hda-dai.o hda-bus.o hda-mlink.o \ skl.o hda-loader-skl.o \ apl.o cnl.o tgl.o icl.o mtl.o hda-common-ops.o diff --git a/sound/soc/sof/intel/hda-mlink.c b/sound/soc/sof/intel/hda-mlink.c new file mode 100644 index 000000000000..228ec35017ec --- /dev/null +++ b/sound/soc/sof/intel/hda-mlink.c @@ -0,0 +1,45 @@ +// SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) +// +// This file is provided under a dual BSD/GPLv2 license. When using or +// redistributing this file, you may do so under either license. +// +// Copyright(c) 2022 Intel Corporation. All rights reserved. +// + +/* + * Management of HDaudio multi-link (capabilities, power, coupling) + */ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include "../sof-audio.h" +#include "../sof-pci-dev.h" +#include "../ops.h" +#include "hda.h" + +#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA) + +void hda_bus_ml_get_capabilities(struct hdac_bus *bus) +{ + if (bus->mlcap) + snd_hdac_ext_bus_get_ml_capabilities(bus); +} + +void hda_bus_ml_put_all(struct hdac_bus *bus) +{ + struct hdac_ext_link *hlink; + + list_for_each_entry(hlink, &bus->hlink_list, list) + snd_hdac_ext_bus_link_put(bus, hlink); +} + +#endif diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c index fe2f1e42420c..6a1ee7f81d61 100644 --- a/sound/soc/sof/intel/hda.c +++ b/sound/soc/sof/intel/hda.c @@ -871,9 +871,6 @@ static int hda_init_caps(struct snd_sof_dev *sdev) { struct hdac_bus *bus = sof_to_bus(sdev); struct snd_sof_pdata *pdata = sdev->pdata; -#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA) - struct hdac_ext_link *hlink; -#endif struct sof_intel_hda_dev *hdev = pdata->hw_pdata; u32 link_mask; int ret = 0; @@ -918,9 +915,7 @@ static int hda_init_caps(struct snd_sof_dev *sdev) skip_soundwire: -#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA) - if (bus->mlcap) - snd_hdac_ext_bus_get_ml_capabilities(bus); + hda_bus_ml_get_capabilities(bus); /* create codec instances */ hda_codec_probe_bus(sdev); @@ -928,12 +923,8 @@ static int hda_init_caps(struct snd_sof_dev *sdev) if (!HDA_IDISP_CODEC(bus->codec_mask)) hda_codec_i915_display_power(sdev, false); - /* - * we are done probing so decrement link counts - */ - list_for_each_entry(hlink, &bus->hlink_list, list) - snd_hdac_ext_bus_link_put(bus, hlink); -#endif + hda_bus_ml_put_all(bus); + return 0; } diff --git a/sound/soc/sof/intel/hda.h b/sound/soc/sof/intel/hda.h index e5932763d1fc..c40364a9a761 100644 --- a/sound/soc/sof/intel/hda.h +++ b/sound/soc/sof/intel/hda.h @@ -742,6 +742,18 @@ static inline int hda_codec_i915_exit(struct snd_sof_dev *sdev) { return 0; } #endif +#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA) + +void hda_bus_ml_get_capabilities(struct hdac_bus *bus); +void hda_bus_ml_put_all(struct hdac_bus *bus); + +#else + +static inline void hda_bus_ml_get_capabilities(struct hdac_bus *bus) { } +static inline void hda_bus_ml_put_all(struct hdac_bus *bus) { } + +#endif /* CONFIG_SND_SOC_SOF_HDA */ + /* * Trace Control. */ From patchwork Thu Oct 27 19:35:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 619239 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 E84EBECAAA1 for ; Thu, 27 Oct 2022 19:39:00 +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 E844C2DBD; Thu, 27 Oct 2022 21:38:08 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz E844C2DBD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1666899539; bh=sYvcV1khHcITo/9K0EY8Xw1RoeJgNDLyLG6jpZTdpQI=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=SLiACdGhc9hwLmECF31Z9ccKsfoCW8/1kZrvoH4Yjn26JZ4iiUw3wUjQAvZEWGnIj Wiu1OC00tlfe2jVgTApt/Idte/k8BATGeFe6yh1bJ1cWPmcF9PxGSivm6plD4H/ppT oSHb9lGDBGw0gl2FSpLaulPLDSKtrIM64oKBPpfk= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id DF443F8055C; Thu, 27 Oct 2022 21:36:29 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id A1F6EF8057C; Thu, 27 Oct 2022 21:36:22 +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 C1680F80551 for ; Thu, 27 Oct 2022 21:36:10 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C1680F80551 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="CqZH2lKk" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666899371; x=1698435371; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=sYvcV1khHcITo/9K0EY8Xw1RoeJgNDLyLG6jpZTdpQI=; b=CqZH2lKknJjY5xUvblPVZhD7ScLvUv1feW288o8VFCpuAUPh4/gIlms/ vL86HYZg8ANKn+IfWt/jRblg9qnNrQdk/fb3DG+UvkCmaKIRTcd9Kmopd oJF0OcA1mULA48v8qSJ8dROzsdarpnFYfKROk/Sg7DwpydliGudi9Wfxy YHNTkQqWftBiK7/VP2CP5BGPehf207QPNdDeoYDAYyWVQX+g23p9R9Wlt ppE0gB0+qUbRInRUrFljQ7cGLyGRvyzp+z0POPZRHlfFB2aJo4fpAwN8P F3mesYE/aQJnDAjq4iJmQMmQP/HKuhbmxQnIoiIff2tdMExyRUk1SasQE A==; X-IronPort-AV: E=McAfee;i="6500,9779,10513"; a="334957820" X-IronPort-AV: E=Sophos;i="5.95,218,1661842800"; d="scan'208";a="334957820" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Oct 2022 12:36:10 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10513"; a="632526986" X-IronPort-AV: E=Sophos;i="5.95,218,1661842800"; d="scan'208";a="632526986" Received: from vmehta-mobl.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.212.6.254]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Oct 2022 12:36:09 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Subject: [PATCH 06/21] ASoC: SOF: Intel: hda: add multi-link helper for LOSVID Date: Thu, 27 Oct 2022 15:35:25 -0400 Message-Id: <20221027193540.259520-7-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221027193540.259520-1-pierre-louis.bossart@linux.intel.com> References: <20221027193540.259520-1-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Cc: Cezary Rojewski , tiwai@suse.de, =?utf-8?q?P?= =?utf-8?q?=C3=A9ter_Ujfalusi?= , Pierre-Louis Bossart , Rander Wang , broonie@kernel.org, Ranjani Sridharan , Bard Liao 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" Add new helper to deal with LOSVID. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: Bard Liao Reviewed-by: Péter Ujfalusi Reviewed-by: Ranjani Sridharan --- sound/soc/sof/intel/hda-ctrl.c | 9 +-------- sound/soc/sof/intel/hda-mlink.c | 9 +++++++++ sound/soc/sof/intel/hda.h | 2 ++ 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/sound/soc/sof/intel/hda-ctrl.c b/sound/soc/sof/intel/hda-ctrl.c index 12900965ca5f..449e1e93505e 100644 --- a/sound/soc/sof/intel/hda-ctrl.c +++ b/sound/soc/sof/intel/hda-ctrl.c @@ -185,9 +185,6 @@ int hda_dsp_ctrl_clock_power_gating(struct snd_sof_dev *sdev, bool enable) int hda_dsp_ctrl_init_chip(struct snd_sof_dev *sdev) { struct hdac_bus *bus = sof_to_bus(sdev); -#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA) - struct hdac_ext_link *hlink; -#endif struct hdac_stream *stream; int sd_offset, ret = 0; @@ -269,11 +266,7 @@ int hda_dsp_ctrl_init_chip(struct snd_sof_dev *sdev) upper_32_bits(bus->posbuf.addr)); } -#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA) - /* Reset stream-to-link mapping */ - list_for_each_entry(hlink, &bus->hlink_list, list) - writel(0, hlink->ml_addr + AZX_REG_ML_LOSIDV); -#endif + hda_bus_ml_reset_losidv(bus); bus->chip_init = true; diff --git a/sound/soc/sof/intel/hda-mlink.c b/sound/soc/sof/intel/hda-mlink.c index 228ec35017ec..b5f922603187 100644 --- a/sound/soc/sof/intel/hda-mlink.c +++ b/sound/soc/sof/intel/hda-mlink.c @@ -42,4 +42,13 @@ void hda_bus_ml_put_all(struct hdac_bus *bus) snd_hdac_ext_bus_link_put(bus, hlink); } +void hda_bus_ml_reset_losidv(struct hdac_bus *bus) +{ + struct hdac_ext_link *hlink; + + /* Reset stream-to-link mapping */ + list_for_each_entry(hlink, &bus->hlink_list, list) + writel(0, hlink->ml_addr + AZX_REG_ML_LOSIDV); +} + #endif diff --git a/sound/soc/sof/intel/hda.h b/sound/soc/sof/intel/hda.h index c40364a9a761..a82b17596a27 100644 --- a/sound/soc/sof/intel/hda.h +++ b/sound/soc/sof/intel/hda.h @@ -746,11 +746,13 @@ static inline int hda_codec_i915_exit(struct snd_sof_dev *sdev) { return 0; } void hda_bus_ml_get_capabilities(struct hdac_bus *bus); void hda_bus_ml_put_all(struct hdac_bus *bus); +void hda_bus_ml_reset_losidv(struct hdac_bus *bus); #else static inline void hda_bus_ml_get_capabilities(struct hdac_bus *bus) { } static inline void hda_bus_ml_put_all(struct hdac_bus *bus) { } +static inline void hda_bus_ml_reset_losidv(struct hdac_bus *bus) { } #endif /* CONFIG_SND_SOC_SOF_HDA */ From patchwork Thu Oct 27 19:35:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 619238 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 A31EAFA3740 for ; Thu, 27 Oct 2022 19:39:34 +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 CC77B2DCD; Thu, 27 Oct 2022 21:38:42 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz CC77B2DCD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1666899572; bh=MZJxEaftH899L8RgVoxzpkvxS6U3XMklbSyOyLqeHCI=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Du0yWbeHoHIz19NGNTMC0yTksCEMn0XUJmQhaYDfZPumhSAJ3JAJIc7KY9s/WNbwl UnksJhhlS7Ga6FBhu4T4giRpT+DHLhJnqvqBzhQF5eb+tAKjqe8hUvPhagwo6DWQxv KPtHLieNGl10PPnSUrZMWqV3jk5h5w7SiL0AyfnY= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 9B35DF805AB; Thu, 27 Oct 2022 21:36:31 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id B6F5EF80558; Thu, 27 Oct 2022 21:36:27 +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 423B8F8054A for ; Thu, 27 Oct 2022 21:36:13 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 423B8F8054A Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="DyS6a8QV" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666899374; x=1698435374; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=MZJxEaftH899L8RgVoxzpkvxS6U3XMklbSyOyLqeHCI=; b=DyS6a8QVrGZSJikSFNGrUJGmHbhLxSmbSLk+caDe2YeY8GcE7fboWokm NoRTBgMNRvWWZ+32YX684lDLZ3NxcdCk1FYglWarVxQqmktzmv2qOI+xU IwavpLaRQgotyo1t+Mj0DPvVWtVPhClLdI+3Pr72A4JsBVWzUgJCR1iC8 3lEM03sPwvEcrEHDL/8UyJuMeM4a7orYhQr0CtGaVGJuwixtAcl1Q3WHU mc+6YmrpV3CSuXMohl0x0lmLtvLvMqy19MxXLAx6lQxifJ/epsVsAtwF5 grnYgFTCcFHBKcBB79j/6oWTUVR1MHKDhrX3kE4KaA+tizwfhOi1O1ZL4 A==; X-IronPort-AV: E=McAfee;i="6500,9779,10513"; a="334957825" X-IronPort-AV: E=Sophos;i="5.95,218,1661842800"; d="scan'208";a="334957825" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Oct 2022 12:36:12 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10513"; a="632527004" X-IronPort-AV: E=Sophos;i="5.95,218,1661842800"; d="scan'208";a="632527004" Received: from vmehta-mobl.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.212.6.254]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Oct 2022 12:36:11 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Subject: [PATCH 08/21] ASoC: SOF: Intel: hda-ctrl: add codec wakeup helper Date: Thu, 27 Oct 2022 15:35:27 -0400 Message-Id: <20221027193540.259520-9-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221027193540.259520-1-pierre-louis.bossart@linux.intel.com> References: <20221027193540.259520-1-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Cc: Cezary Rojewski , tiwai@suse.de, =?utf-8?q?P?= =?utf-8?q?=C3=A9ter_Ujfalusi?= , Pierre-Louis Bossart , Rander Wang , broonie@kernel.org, Ranjani Sridharan , Bard Liao 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" Add new helper in hda-codec.c for a clean split between controller and codec. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: Bard Liao Reviewed-by: Péter Ujfalusi Reviewed-by: Ranjani Sridharan --- sound/soc/sof/intel/hda-codec.c | 8 ++++++++ sound/soc/sof/intel/hda-ctrl.c | 10 ++++------ sound/soc/sof/intel/hda.h | 2 ++ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/sound/soc/sof/intel/hda-codec.c b/sound/soc/sof/intel/hda-codec.c index e04a350dd52c..ff40ec623118 100644 --- a/sound/soc/sof/intel/hda-codec.c +++ b/sound/soc/sof/intel/hda-codec.c @@ -272,6 +272,14 @@ void hda_codec_rirb_status_clear(struct snd_sof_dev *sdev) } EXPORT_SYMBOL_NS_GPL(hda_codec_rirb_status_clear, SND_SOC_SOF_HDA_AUDIO_CODEC); +void hda_codec_set_codec_wakeup(struct snd_sof_dev *sdev, bool status) +{ + struct hdac_bus *bus = sof_to_bus(sdev); + + snd_hdac_set_codec_wakeup(bus, status); +} +EXPORT_SYMBOL_NS_GPL(hda_codec_set_codec_wakeup, SND_SOC_SOF_HDA_AUDIO_CODEC); + #endif /* CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC */ #if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC) && IS_ENABLED(CONFIG_SND_HDA_CODEC_HDMI) diff --git a/sound/soc/sof/intel/hda-ctrl.c b/sound/soc/sof/intel/hda-ctrl.c index e65562618ab8..63a5b5961726 100644 --- a/sound/soc/sof/intel/hda-ctrl.c +++ b/sound/soc/sof/intel/hda-ctrl.c @@ -185,9 +185,8 @@ int hda_dsp_ctrl_init_chip(struct snd_sof_dev *sdev) if (bus->chip_init) return 0; -#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA) - snd_hdac_set_codec_wakeup(bus, true); -#endif + hda_codec_set_codec_wakeup(sdev, true); + hda_dsp_ctrl_misc_clock_gating(sdev, false); /* reset HDA controller */ @@ -245,9 +244,8 @@ int hda_dsp_ctrl_init_chip(struct snd_sof_dev *sdev) err: hda_dsp_ctrl_misc_clock_gating(sdev, true); -#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA) - snd_hdac_set_codec_wakeup(bus, false); -#endif + + hda_codec_set_codec_wakeup(sdev, false); return ret; } diff --git a/sound/soc/sof/intel/hda.h b/sound/soc/sof/intel/hda.h index d43af8c5f483..8705ddd6f8ed 100644 --- a/sound/soc/sof/intel/hda.h +++ b/sound/soc/sof/intel/hda.h @@ -721,6 +721,7 @@ void hda_codec_check_for_state_change(struct snd_sof_dev *sdev); void hda_codec_init_cmd_io(struct snd_sof_dev *sdev); void hda_codec_detect_mask(struct snd_sof_dev *sdev); void hda_codec_rirb_status_clear(struct snd_sof_dev *sdev); +void hda_codec_set_codec_wakeup(struct snd_sof_dev *sdev, bool status); #else @@ -731,6 +732,7 @@ static inline void hda_codec_check_for_state_change(struct snd_sof_dev *sdev) { static inline void hda_codec_init_cmd_io(struct snd_sof_dev *sdev) { } static inline void hda_codec_detect_mask(struct snd_sof_dev *sdev) { } static inline void hda_codec_rirb_status_clear(struct snd_sof_dev *sdev) { } +static inline void hda_codec_set_codec_wakeup(struct snd_sof_dev *sdev, bool status) { } #endif /* CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC */ From patchwork Thu Oct 27 19:35:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 619237 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 E8921FA3740 for ; Thu, 27 Oct 2022 19:40:02 +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 2A5042DB0; Thu, 27 Oct 2022 21:39:11 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 2A5042DB0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1666899601; bh=3l31m3UNM5J6SqzitpcKaeqqD4ntI7MZ+7QJFKiOZxc=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=HpWl72qohslLXhxd2gSjJnmxX8C6GXe9SVehsuEgOGLTTIiPX2ymUUcpa/Y8ojBoe PnAWPygbb25KQpy1cL/xrRSqDbD3k9lPMaud+OwJ3KJKQ0vpzRxyXa4x9EkSHdWDQO g0vRp25UIWKqLIeIkkl+7+8eOr6XMxksIvOCI/pM= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 4EBC7F805BD; Thu, 27 Oct 2022 21:36:33 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 34219F8058C; Thu, 27 Oct 2022 21:36:28 +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 674CFF80100 for ; Thu, 27 Oct 2022 21:36:14 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 674CFF80100 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Cm9YTbrh" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666899375; x=1698435375; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3l31m3UNM5J6SqzitpcKaeqqD4ntI7MZ+7QJFKiOZxc=; b=Cm9YTbrhEZSZta2kGGfKGuIFQwjchKYpXxfgqOoUZHuG51FXB8VeYFtB z8ycfZmJPQbVCVOLVAh64lXdCODrCwRdtjUqI5RjZoh1ZaDXFGwdoUayA 6z+jp4q/URDutATGWs2VkVVPMBSKUXitAPTafrHfbu9vsAQzMBgkWZkYJ jmneK/ypAk/RqBRmgZBWaXj4ZSuUznFnLRht9OhsA6Eabxdnk0qdEaO24 7IP9qpTujmti9PN41UHgshmQGIr8VdZ/8MrHFvLv2FCvw1GaThCDB8Zt7 3I3hXm03rOV8AqwS9VO4ZrCKGccO6WtKO5o4I8WKuUiIKFEHZZY1mo6kk A==; X-IronPort-AV: E=McAfee;i="6500,9779,10513"; a="334957829" X-IronPort-AV: E=Sophos;i="5.95,218,1661842800"; d="scan'208";a="334957829" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Oct 2022 12:36:13 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10513"; a="632527012" X-IronPort-AV: E=Sophos;i="5.95,218,1661842800"; d="scan'208";a="632527012" Received: from vmehta-mobl.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.212.6.254]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Oct 2022 12:36:12 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Subject: [PATCH 09/21] ASoC: SOF: Intel: hda-codec: add hda_codec_device_remove() helper Date: Thu, 27 Oct 2022 15:35:28 -0400 Message-Id: <20221027193540.259520-10-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221027193540.259520-1-pierre-louis.bossart@linux.intel.com> References: <20221027193540.259520-1-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Cc: Cezary Rojewski , tiwai@suse.de, =?utf-8?q?P?= =?utf-8?q?=C3=A9ter_Ujfalusi?= , Pierre-Louis Bossart , Rander Wang , broonie@kernel.org, Ranjani Sridharan , Bard Liao 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" Continue split between controller and codec. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: Bard Liao Reviewed-by: Péter Ujfalusi Reviewed-by: Ranjani Sridharan --- sound/soc/sof/intel/hda-codec.c | 9 +++++++++ sound/soc/sof/intel/hda.c | 5 +---- sound/soc/sof/intel/hda.h | 2 ++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/sound/soc/sof/intel/hda-codec.c b/sound/soc/sof/intel/hda-codec.c index ff40ec623118..1e8e184151f2 100644 --- a/sound/soc/sof/intel/hda-codec.c +++ b/sound/soc/sof/intel/hda-codec.c @@ -280,6 +280,15 @@ void hda_codec_set_codec_wakeup(struct snd_sof_dev *sdev, bool status) } EXPORT_SYMBOL_NS_GPL(hda_codec_set_codec_wakeup, SND_SOC_SOF_HDA_AUDIO_CODEC); +void hda_codec_device_remove(struct snd_sof_dev *sdev) +{ + struct hdac_bus *bus = sof_to_bus(sdev); + + /* codec removal, invoke bus_device_remove */ + snd_hdac_ext_bus_device_remove(bus); +} +EXPORT_SYMBOL_NS_GPL(hda_codec_device_remove, SND_SOC_SOF_HDA_AUDIO_CODEC); + #endif /* CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC */ #if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC) && IS_ENABLED(CONFIG_SND_HDA_CODEC_HDMI) diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c index 6a1ee7f81d61..e08b57fa3bfc 100644 --- a/sound/soc/sof/intel/hda.c +++ b/sound/soc/sof/intel/hda.c @@ -1173,10 +1173,7 @@ int hda_dsp_remove(struct snd_sof_dev *sdev) /* cancel any attempt for DSP D0I3 */ cancel_delayed_work_sync(&hda->d0i3_work); -#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA) - /* codec removal, invoke bus_device_remove */ - snd_hdac_ext_bus_device_remove(bus); -#endif + hda_codec_device_remove(sdev); hda_sdw_exit(sdev); diff --git a/sound/soc/sof/intel/hda.h b/sound/soc/sof/intel/hda.h index 8705ddd6f8ed..a2b90784fac0 100644 --- a/sound/soc/sof/intel/hda.h +++ b/sound/soc/sof/intel/hda.h @@ -722,6 +722,7 @@ void hda_codec_init_cmd_io(struct snd_sof_dev *sdev); void hda_codec_detect_mask(struct snd_sof_dev *sdev); void hda_codec_rirb_status_clear(struct snd_sof_dev *sdev); void hda_codec_set_codec_wakeup(struct snd_sof_dev *sdev, bool status); +void hda_codec_device_remove(struct snd_sof_dev *sdev); #else @@ -733,6 +734,7 @@ static inline void hda_codec_init_cmd_io(struct snd_sof_dev *sdev) { } static inline void hda_codec_detect_mask(struct snd_sof_dev *sdev) { } static inline void hda_codec_rirb_status_clear(struct snd_sof_dev *sdev) { } static inline void hda_codec_set_codec_wakeup(struct snd_sof_dev *sdev, bool status) { } +static inline void hda_codec_device_remove(struct snd_sof_dev *sdev) { } #endif /* CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC */ From patchwork Thu Oct 27 19:35:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 619236 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 188C6ECAAA1 for ; Thu, 27 Oct 2022 19:40:34 +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 3FF542DBD; Thu, 27 Oct 2022 21:39:42 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 3FF542DBD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1666899632; bh=RDOSYGtxP4ldqOOaUKxB6GXEBoUjy++oyOKHOCBcjrQ=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=s+tYgbbKfYe3DMvvKurJMLiISB7xk8PPfMeXFHBoYk2kvyPOAEFNYW/ujakN9gU+P tdKXh9aJY2iLJPuUaezHDiHb0p7TkSVRLJbmrDukPilscqvCfqtxEwR33YTfvYt0rA OIZ0dHLfjzUP4GSUHwfo6CNaWpmiWyBexyP6PYcA= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 5E24DF805C1; Thu, 27 Oct 2022 21:36:36 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 9E4E4F80558; Thu, 27 Oct 2022 21:36:29 +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 0502FF8055C for ; Thu, 27 Oct 2022 21:36:16 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 0502FF8055C Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="g11WEdMU" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666899378; x=1698435378; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RDOSYGtxP4ldqOOaUKxB6GXEBoUjy++oyOKHOCBcjrQ=; b=g11WEdMU7u/KxlF7I5P6/efqA2N65238nmhXdSDM6I0txGaKYv5ELukK Lj56qUcMi/9jq8lDvKcnH3bdHGeskqsZ+AyYAJNXXdZGtkEbhVl5enO7y rAmVfM5DMDFn/vY77cM2RtGNqN5eAbVvHxdajH7UQrD9EQGiCC/XJf6L7 5RbY5yEuIMu56p/EDOwHsIiW7I117gR9u863PWXCjk9hFS9QHaLVZ3AFI WsZeUghr6daE81H3LXZx7yDGTF2MYRcGKwrbtQiRSKKXiicm2IJO/E6qN 34lnHQ3d9NTsjapJCyWFgCDaJNDUhjfl9+4BHYkAbBxFxzyv/Y4C9I8nm g==; X-IronPort-AV: E=McAfee;i="6500,9779,10513"; a="334957836" X-IronPort-AV: E=Sophos;i="5.95,218,1661842800"; d="scan'208";a="334957836" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Oct 2022 12:36:16 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10513"; a="632527027" X-IronPort-AV: E=Sophos;i="5.95,218,1661842800"; d="scan'208";a="632527027" Received: from vmehta-mobl.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.212.6.254]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Oct 2022 12:36:15 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Subject: [PATCH 11/21] ASoC: SOF: Intel: hda-stream: always allocate CORB/RIRB buffer Date: Thu, 27 Oct 2022 15:35:30 -0400 Message-Id: <20221027193540.259520-12-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221027193540.259520-1-pierre-louis.bossart@linux.intel.com> References: <20221027193540.259520-1-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Cc: Cezary Rojewski , tiwai@suse.de, =?utf-8?q?P?= =?utf-8?q?=C3=A9ter_Ujfalusi?= , Pierre-Louis Bossart , Rander Wang , broonie@kernel.org, Ranjani Sridharan , Bard Liao 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" There is no real reason to filter out this allocation at build time. Let's allocate it always, so that we can have a more dynamic way of disabling HDaudio codec support without having to recompile. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: Bard Liao Reviewed-by: Péter Ujfalusi Reviewed-by: Ranjani Sridharan --- sound/soc/sof/intel/hda-stream.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/sound/soc/sof/intel/hda-stream.c b/sound/soc/sof/intel/hda-stream.c index c858f30c08f9..59a3c0c9c21f 100644 --- a/sound/soc/sof/intel/hda-stream.c +++ b/sound/soc/sof/intel/hda-stream.c @@ -854,15 +854,16 @@ int hda_dsp_stream_init(struct snd_sof_dev *sdev) return -ENOMEM; } -#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA) - /* mem alloc for the CORB/RIRB ringbuffers */ + /* + * mem alloc for the CORB/RIRB ringbuffers - this will be used only for + * HDAudio codecs + */ ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, &pci->dev, PAGE_SIZE, &bus->rb); if (ret < 0) { dev_err(sdev->dev, "error: RB alloc failed\n"); return -ENOMEM; } -#endif /* create capture streams */ for (i = 0; i < num_capture; i++) { @@ -995,11 +996,9 @@ void hda_dsp_stream_free(struct snd_sof_dev *sdev) if (bus->posbuf.area) snd_dma_free_pages(&bus->posbuf); -#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA) - /* free position buffer */ + /* free CORB/RIRB buffer - only used for HDaudio codecs */ if (bus->rb.area) snd_dma_free_pages(&bus->rb); -#endif list_for_each_entry_safe(s, _s, &bus->stream_list, list) { /* TODO: decouple */ From patchwork Thu Oct 27 19:35:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 619235 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 0EB50ECAAA1 for ; Thu, 27 Oct 2022 19:41:03 +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 E77972DDD; Thu, 27 Oct 2022 21:40:11 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz E77972DDD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1666899662; bh=nMBgbZhHGE0Z3R1LDGUifJGuICeAUk/11KfQAoSNJko=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=vOIY4ThQGeBI8I2QAImYIdZwS9xAfvXRl9BsxoI8HFoCsNhjUZxFtssQOnyGPKAXi oHrnie6LdQYsI1IRjYsVDZhAiodtrWrezCLyLCjaBwhNhI9hbKlrnFosP3jlcVrCjo 6WNh/pEJA5U6jLzPjFlAm7Zf9SXADudd8aLXdnsQ= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 7D09AF805C4; Thu, 27 Oct 2022 21:36:42 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 0C99DF805C1; Thu, 27 Oct 2022 21:36:35 +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 93E58F8057E for ; Thu, 27 Oct 2022 21:36:22 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 93E58F8057E Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="ey/T6ZMa" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666899383; x=1698435383; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=nMBgbZhHGE0Z3R1LDGUifJGuICeAUk/11KfQAoSNJko=; b=ey/T6ZMaFYMXxqW+a5c2LPS5VoKAqVUwxdhI2WfmG/0OyozNu31nJaPU WvrF0T8xlNplE0KlxToVDOJFlDM/7WsXtDbe+v7g1mDMwU+zcPXDgr1ro 6SqazdJb/t9wkaAm79auiHl9LKm3WFsqtZR7WXnKQ7L4pjoqM3WfEkFSB v6TVuFMWmNBTurlEwMSD2puaG5jAaNvZLa17g/oqEoC7UwAZTB4at1eda OY+uBI6VblrabSacxQnHAHpxnApXkSmBXDWFUOn6uUbw89AWDhRrk2LyT nKM8qQXdAtXaRM4e5G4GS09BxgaHKorOS0fg3Ke2JzWn82XB5vLxTnUNp A==; X-IronPort-AV: E=McAfee;i="6500,9779,10513"; a="334957852" X-IronPort-AV: E=Sophos;i="5.95,218,1661842800"; d="scan'208";a="334957852" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Oct 2022 12:36:21 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10513"; a="632527051" X-IronPort-AV: E=Sophos;i="5.95,218,1661842800"; d="scan'208";a="632527051" Received: from vmehta-mobl.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.212.6.254]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Oct 2022 12:36:20 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Subject: [PATCH 15/21] ASoC: SOF: Intel: hda-codec: add helpers to suspend and resume cmd_io Date: Thu, 27 Oct 2022 15:35:34 -0400 Message-Id: <20221027193540.259520-16-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221027193540.259520-1-pierre-louis.bossart@linux.intel.com> References: <20221027193540.259520-1-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Cc: Cezary Rojewski , tiwai@suse.de, =?utf-8?q?P?= =?utf-8?q?=C3=A9ter_Ujfalusi?= , Pierre-Louis Bossart , Rander Wang , broonie@kernel.org, Ranjani Sridharan , Bard Liao 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" No functionality change, code move to have better split between HDaudio codec management and core parts. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: Bard Liao Reviewed-by: Péter Ujfalusi Reviewed-by: Ranjani Sridharan --- sound/soc/sof/intel/hda-codec.c | 21 +++++++++++++++++++++ sound/soc/sof/intel/hda-dsp.c | 10 ++++------ sound/soc/sof/intel/hda.h | 4 ++++ 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/sound/soc/sof/intel/hda-codec.c b/sound/soc/sof/intel/hda-codec.c index 4abce4ebec5a..60c15f9f0f3c 100644 --- a/sound/soc/sof/intel/hda-codec.c +++ b/sound/soc/sof/intel/hda-codec.c @@ -263,6 +263,16 @@ void hda_codec_init_cmd_io(struct snd_sof_dev *sdev) } EXPORT_SYMBOL_NS_GPL(hda_codec_init_cmd_io, SND_SOC_SOF_HDA_AUDIO_CODEC); +void hda_codec_resume_cmd_io(struct snd_sof_dev *sdev) +{ + struct hdac_bus *bus = sof_to_bus(sdev); + + /* set up CORB/RIRB buffers if was on before suspend */ + if (bus->cmd_dma_state) + snd_hdac_bus_init_cmd_io(bus); +} +EXPORT_SYMBOL_NS_GPL(hda_codec_resume_cmd_io, SND_SOC_SOF_HDA_AUDIO_CODEC); + void hda_codec_stop_cmd_io(struct snd_sof_dev *sdev) { struct hdac_bus *bus = sof_to_bus(sdev); @@ -272,6 +282,17 @@ void hda_codec_stop_cmd_io(struct snd_sof_dev *sdev) } EXPORT_SYMBOL_NS_GPL(hda_codec_stop_cmd_io, SND_SOC_SOF_HDA_AUDIO_CODEC); +void hda_codec_suspend_cmd_io(struct snd_sof_dev *sdev) +{ + struct hdac_bus *bus = sof_to_bus(sdev); + + /* stop the CORB/RIRB DMA if it is On */ + if (bus->cmd_dma_state) + snd_hdac_bus_stop_cmd_io(bus); + +} +EXPORT_SYMBOL_NS_GPL(hda_codec_suspend_cmd_io, SND_SOC_SOF_HDA_AUDIO_CODEC); + void hda_codec_rirb_status_clear(struct snd_sof_dev *sdev) { struct hdac_bus *bus = sof_to_bus(sdev); diff --git a/sound/soc/sof/intel/hda-dsp.c b/sound/soc/sof/intel/hda-dsp.c index d325e82aff4c..2596de5e24d6 100644 --- a/sound/soc/sof/intel/hda-dsp.c +++ b/sound/soc/sof/intel/hda-dsp.c @@ -745,11 +745,10 @@ int hda_dsp_resume(struct snd_sof_dev *sdev) } } } +#endif /* set up CORB/RIRB buffers if was on before suspend */ - if (bus->cmd_dma_state) - snd_hdac_bus_init_cmd_io(bus); -#endif + hda_codec_resume_cmd_io(sdev); /* Set DSP power state */ ret = snd_sof_dsp_set_power_state(sdev, &target_state); @@ -858,11 +857,10 @@ int hda_dsp_suspend(struct snd_sof_dev *sdev, u32 target_state) HDA_VS_INTEL_EM2_L1SEN, HDA_VS_INTEL_EM2_L1SEN); -#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA) /* stop the CORB/RIRB DMA if it is On */ - if (bus->cmd_dma_state) - snd_hdac_bus_stop_cmd_io(bus); + hda_codec_suspend_cmd_io(sdev); +#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA) /* no link can be powered in s0ix state */ ret = snd_hdac_ext_bus_link_power_down_all(bus); if (ret < 0) { diff --git a/sound/soc/sof/intel/hda.h b/sound/soc/sof/intel/hda.h index 3b3e05e71663..e1f3d03cd4f7 100644 --- a/sound/soc/sof/intel/hda.h +++ b/sound/soc/sof/intel/hda.h @@ -719,7 +719,9 @@ void hda_codec_jack_wake_enable(struct snd_sof_dev *sdev, bool enable); void hda_codec_jack_check(struct snd_sof_dev *sdev); void hda_codec_check_for_state_change(struct snd_sof_dev *sdev); void hda_codec_init_cmd_io(struct snd_sof_dev *sdev); +void hda_codec_resume_cmd_io(struct snd_sof_dev *sdev); void hda_codec_stop_cmd_io(struct snd_sof_dev *sdev); +void hda_codec_suspend_cmd_io(struct snd_sof_dev *sdev); void hda_codec_detect_mask(struct snd_sof_dev *sdev); void hda_codec_rirb_status_clear(struct snd_sof_dev *sdev); bool hda_codec_check_rirb_status(struct snd_sof_dev *sdev); @@ -733,7 +735,9 @@ static inline void hda_codec_jack_wake_enable(struct snd_sof_dev *sdev, bool ena static inline void hda_codec_jack_check(struct snd_sof_dev *sdev) { } static inline void hda_codec_check_for_state_change(struct snd_sof_dev *sdev) { } static inline void hda_codec_init_cmd_io(struct snd_sof_dev *sdev) { } +static inline void hda_codec_resume_cmd_io(struct snd_sof_dev *sdev) { } static inline void hda_codec_stop_cmd_io(struct snd_sof_dev *sdev) { } +static inline void hda_codec_suspend_cmd_io(struct snd_sof_dev *sdev) { } static inline void hda_codec_detect_mask(struct snd_sof_dev *sdev) { } static inline void hda_codec_rirb_status_clear(struct snd_sof_dev *sdev) { } static inline bool hda_codec_check_rirb_status(struct snd_sof_dev *sdev) { return false; } From patchwork Thu Oct 27 19:35:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 619234 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 DB4D3ECAAA1 for ; Thu, 27 Oct 2022 19:41:37 +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 0E1832DB2; Thu, 27 Oct 2022 21:40:46 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 0E1832DB2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1666899696; bh=4O0OGnzo81lXS7ivbiKF0RLSA8nl4dwOAphMuq6u228=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=JhX1V8lHK6zeSyU7DnEtZiux25LAwc20cFywT1Twxd0smnvJzn+nTPflHEUfdykFw QyG3Io4toRDRXF1k6aorp51LX7gjjzRYC16Q24pgki9R0/1q2W9NTHA6ArszarkA1t 6mp2X8F/YDovOfZkxQbqZEI3Juz+2A80AhlbVdNo= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 943AAF805D2; Thu, 27 Oct 2022 21:36:43 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 01019F805C4; Thu, 27 Oct 2022 21:36:36 +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 6AE85F80580 for ; Thu, 27 Oct 2022 21:36:24 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 6AE85F80580 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="j/l3b3hO" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666899385; x=1698435385; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=4O0OGnzo81lXS7ivbiKF0RLSA8nl4dwOAphMuq6u228=; b=j/l3b3hORCa1C7H1UJjhZSoJWXuFrm+nS0pmH3OPgGNhi9zswYd3tC3L pbrCYlxorTkpbRcVid0KKV3UhCrlOWltcUoONdrRJPR5gsWSojvj/yovU DUK9IRdbRpn716rFZFaW9mIu8mKbZgYpDn3MsC1kRD+O6RznuB7pOlIyv pM+Wl2d589NLzC2sPhe6hIvoYKwYx554lylleCq0msQB1hLtAnSQApuko 3cBJXSZC8/BYS7CI8sMmKMBx6zcEFa7WbYiMl5bTlFUD1a7nUJlUKFyqb 7fqikHyJbroGU5pDYATXbKKHZuG8xTFp3G04xGy1Ew/JFJIyXVPLGVbqX A==; X-IronPort-AV: E=McAfee;i="6500,9779,10513"; a="334957868" X-IronPort-AV: E=Sophos;i="5.95,218,1661842800"; d="scan'208";a="334957868" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Oct 2022 12:36:23 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10513"; a="632527066" X-IronPort-AV: E=Sophos;i="5.95,218,1661842800"; d="scan'208";a="632527066" Received: from vmehta-mobl.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.212.6.254]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Oct 2022 12:36:22 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Subject: [PATCH 17/21] ASoC: SOF: Intel: hda-mlink: add helpers to suspend/resume links Date: Thu, 27 Oct 2022 15:35:36 -0400 Message-Id: <20221027193540.259520-18-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221027193540.259520-1-pierre-louis.bossart@linux.intel.com> References: <20221027193540.259520-1-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Cc: Cezary Rojewski , tiwai@suse.de, =?utf-8?q?P?= =?utf-8?q?=C3=A9ter_Ujfalusi?= , Pierre-Louis Bossart , Rander Wang , broonie@kernel.org, Ranjani Sridharan , Bard Liao 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" No functionality change, just move the code in hda-mlink. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: Bard Liao Reviewed-by: Péter Ujfalusi Reviewed-by: Ranjani Sridharan --- sound/soc/sof/intel/hda-dsp.c | 36 +++++++++------------------------ sound/soc/sof/intel/hda-mlink.c | 21 +++++++++++++++++++ sound/soc/sof/intel/hda.h | 4 ++++ 3 files changed, 35 insertions(+), 26 deletions(-) diff --git a/sound/soc/sof/intel/hda-dsp.c b/sound/soc/sof/intel/hda-dsp.c index 2596de5e24d6..c61bab1a5719 100644 --- a/sound/soc/sof/intel/hda-dsp.c +++ b/sound/soc/sof/intel/hda-dsp.c @@ -614,9 +614,7 @@ static int hda_suspend(struct snd_sof_dev *sdev, bool runtime_suspend) { struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; const struct sof_intel_dsp_desc *chip = hda->desc; -#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA) struct hdac_bus *bus = sof_to_bus(sdev); -#endif int ret, j; /* @@ -637,10 +635,8 @@ static int hda_suspend(struct snd_sof_dev *sdev, bool runtime_suspend) hda_codec_jack_wake_enable(sdev, runtime_suspend); -#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA) - /* power down all hda link */ - snd_hdac_ext_bus_link_power_down_all(bus); -#endif + /* power down all hda links */ + hda_bus_ml_suspend(bus); ret = chip->power_down_dsp(sdev); if (ret < 0) { @@ -719,33 +715,23 @@ static int hda_resume(struct snd_sof_dev *sdev, bool runtime_resume) int hda_dsp_resume(struct snd_sof_dev *sdev) { struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; + struct hdac_bus *bus = sof_to_bus(sdev); struct pci_dev *pci = to_pci_dev(sdev->dev); const struct sof_dsp_power_state target_state = { .state = SOF_DSP_PM_D0, .substate = SOF_HDA_DSP_PM_D0I0, }; -#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA) - struct hdac_bus *bus = sof_to_bus(sdev); - struct hdac_ext_link *hlink = NULL; -#endif int ret; /* resume from D0I3 */ if (sdev->dsp_power_state.state == SOF_DSP_PM_D0) { -#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA) - /* power up links that were active before suspend */ - list_for_each_entry(hlink, &bus->hlink_list, list) { - if (hlink->ref_count) { - ret = snd_hdac_ext_bus_link_power_up(hlink); - if (ret < 0) { - dev_err(sdev->dev, - "error %d in %s: failed to power up links", - ret, __func__); - return ret; - } - } + ret = hda_bus_ml_resume(bus); + if (ret < 0) { + dev_err(sdev->dev, + "error %d in %s: failed to power up links", + ret, __func__); + return ret; } -#endif /* set up CORB/RIRB buffers if was on before suspend */ hda_codec_resume_cmd_io(sdev); @@ -860,16 +846,14 @@ int hda_dsp_suspend(struct snd_sof_dev *sdev, u32 target_state) /* stop the CORB/RIRB DMA if it is On */ hda_codec_suspend_cmd_io(sdev); -#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA) /* no link can be powered in s0ix state */ - ret = snd_hdac_ext_bus_link_power_down_all(bus); + ret = hda_bus_ml_suspend(bus); if (ret < 0) { dev_err(sdev->dev, "error %d in %s: failed to power down links", ret, __func__); return ret; } -#endif /* enable the system waking up via IPC IRQ */ enable_irq_wake(pci->irq); diff --git a/sound/soc/sof/intel/hda-mlink.c b/sound/soc/sof/intel/hda-mlink.c index b5f922603187..2cdee03e4a47 100644 --- a/sound/soc/sof/intel/hda-mlink.c +++ b/sound/soc/sof/intel/hda-mlink.c @@ -51,4 +51,25 @@ void hda_bus_ml_reset_losidv(struct hdac_bus *bus) writel(0, hlink->ml_addr + AZX_REG_ML_LOSIDV); } +int hda_bus_ml_resume(struct hdac_bus *bus) +{ + struct hdac_ext_link *hlink; + int ret; + + /* power up links that were active before suspend */ + list_for_each_entry(hlink, &bus->hlink_list, list) { + if (hlink->ref_count) { + ret = snd_hdac_ext_bus_link_power_up(hlink); + if (ret < 0) + return ret; + } + } + return 0; +} + +int hda_bus_ml_suspend(struct hdac_bus *bus) +{ + return snd_hdac_ext_bus_link_power_down_all(bus); +} + #endif diff --git a/sound/soc/sof/intel/hda.h b/sound/soc/sof/intel/hda.h index 0214097389d3..f0c9bb6d567d 100644 --- a/sound/soc/sof/intel/hda.h +++ b/sound/soc/sof/intel/hda.h @@ -766,12 +766,16 @@ static inline int hda_codec_i915_exit(struct snd_sof_dev *sdev) { return 0; } void hda_bus_ml_get_capabilities(struct hdac_bus *bus); void hda_bus_ml_put_all(struct hdac_bus *bus); void hda_bus_ml_reset_losidv(struct hdac_bus *bus); +int hda_bus_ml_resume(struct hdac_bus *bus); +int hda_bus_ml_suspend(struct hdac_bus *bus); #else static inline void hda_bus_ml_get_capabilities(struct hdac_bus *bus) { } static inline void hda_bus_ml_put_all(struct hdac_bus *bus) { } static inline void hda_bus_ml_reset_losidv(struct hdac_bus *bus) { } +static inline int hda_bus_ml_resume(struct hdac_bus *bus) { return 0; } +static inline int hda_bus_ml_suspend(struct hdac_bus *bus) { return 0; } #endif /* CONFIG_SND_SOC_SOF_HDA */ From patchwork Thu Oct 27 19:35:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 619233 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 6DCB4ECAAA1 for ; Thu, 27 Oct 2022 19:42:07 +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 95DDD2DAF; Thu, 27 Oct 2022 21:41:15 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 95DDD2DAF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1666899725; bh=DOPsl7eh/L5GCNTINXTpcAIX55By8BK/YgCoZ/3V3bE=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=knrDrOVvZdN0XorCH+K3m/J3iF7fpV8DWWgeqTZ3hmjD8vGONQwMzvxIv/AgzfuTq BPIr1iEBQ4UsA+lg5GWjiGPpHnTRc3u0bzWRqsFcTiEy2VgRD846wtrEiUf5tz0+1D 32TdrGX0fk7B8p0z2K9nszd3+HeOwFXwruuRk3zw= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id B3DA8F805DA; Thu, 27 Oct 2022 21:36:44 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 55EDAF805C5; Thu, 27 Oct 2022 21:36:37 +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 32589F8058C for ; Thu, 27 Oct 2022 21:36:27 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 32589F8058C Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="a09taGKn" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666899389; x=1698435389; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=DOPsl7eh/L5GCNTINXTpcAIX55By8BK/YgCoZ/3V3bE=; b=a09taGKnHZxQic1wg5zP20zVXmIIG+yw5GY+NtZzU3C9yVk8yXwJFmkG uVQlk0J5VQH2wtLOKe0X+wY7TPdzjbKRDdPkYzVsXK6rLHEfz7SimtczL zGItlCzGKi6PEPKyAXqdmJ7VcR6fUlebPRM6s1R3ilOdjse72r2Mlcl2N 8R48PiK6SLEU7y5xFEujEu6MvVYLwJsHy7gOmDYpdJY4z1oZ14aEE+eHS 407Xn53du0hkfIYZKpcm0egkfdrV8tDyqMhQo+qLbGdDB5/0jaiTxVA2w JHfqrRaH8IB1ArPrPGeiH8KonPaXFK53fU1zw63hna23MBqJ7qP2csUsU A==; X-IronPort-AV: E=McAfee;i="6500,9779,10513"; a="334957885" X-IronPort-AV: E=Sophos;i="5.95,218,1661842800"; d="scan'208";a="334957885" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Oct 2022 12:36:27 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10513"; a="632527088" X-IronPort-AV: E=Sophos;i="5.95,218,1661842800"; d="scan'208";a="632527088" Received: from vmehta-mobl.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.212.6.254]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Oct 2022 12:36:26 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Subject: [PATCH 20/21] ASoC: SOF: Intel: hda-codec: use GPL-2.0-only license Date: Thu, 27 Oct 2022 15:35:39 -0400 Message-Id: <20221027193540.259520-21-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221027193540.259520-1-pierre-louis.bossart@linux.intel.com> References: <20221027193540.259520-1-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Cc: Cezary Rojewski , tiwai@suse.de, =?utf-8?q?P?= =?utf-8?q?=C3=A9ter_Ujfalusi?= , Pierre-Louis Bossart , Rander Wang , broonie@kernel.org, Ranjani Sridharan , Bard Liao 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" All the HDAudio codec handling is completely specific to Linux and completely dependency on GPL2.0 code, specifically the snd_hdac_ library. There was no intention to have a dual-license for this code, this was an oversight that needs to be corrected. Update the SPDX and EXPORT_SYMBOL information, no functionality change otherwise. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: Bard Liao Reviewed-by: Péter Ujfalusi Reviewed-by: Ranjani Sridharan --- sound/soc/sof/intel/hda-codec.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/sound/soc/sof/intel/hda-codec.c b/sound/soc/sof/intel/hda-codec.c index 60c15f9f0f3c..50a7e3f08285 100644 --- a/sound/soc/sof/intel/hda-codec.c +++ b/sound/soc/sof/intel/hda-codec.c @@ -1,7 +1,4 @@ -// SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) -// -// This file is provided under a dual BSD/GPLv2 license. When using or -// redistributing this file, you may do so under either license. +// SPDX-License-Identifier: GPL-2.0-only // // Copyright(c) 2018 Intel Corporation. All rights reserved. // @@ -83,7 +80,7 @@ void hda_codec_jack_wake_enable(struct snd_sof_dev *sdev, bool enable) snd_hdac_chip_updatew(bus, WAKEEN, STATESTS_INT_MASK, mask); } -EXPORT_SYMBOL_NS(hda_codec_jack_wake_enable, SND_SOC_SOF_HDA_AUDIO_CODEC); +EXPORT_SYMBOL_NS_GPL(hda_codec_jack_wake_enable, SND_SOC_SOF_HDA_AUDIO_CODEC); /* check jack status after resuming from suspend mode */ void hda_codec_jack_check(struct snd_sof_dev *sdev) @@ -99,7 +96,7 @@ void hda_codec_jack_check(struct snd_sof_dev *sdev) if (codec->jacktbl.used) pm_request_resume(&codec->core.dev); } -EXPORT_SYMBOL_NS(hda_codec_jack_check, SND_SOC_SOF_HDA_AUDIO_CODEC); +EXPORT_SYMBOL_NS_GPL(hda_codec_jack_check, SND_SOC_SOF_HDA_AUDIO_CODEC); #if IS_ENABLED(CONFIG_SND_HDA_GENERIC) #define is_generic_config(bus) \ @@ -218,7 +215,7 @@ void hda_codec_probe_bus(struct snd_sof_dev *sdev) } } } -EXPORT_SYMBOL_NS(hda_codec_probe_bus, SND_SOC_SOF_HDA_AUDIO_CODEC); +EXPORT_SYMBOL_NS_GPL(hda_codec_probe_bus, SND_SOC_SOF_HDA_AUDIO_CODEC); void hda_codec_check_for_state_change(struct snd_sof_dev *sdev) { @@ -231,7 +228,7 @@ void hda_codec_check_for_state_change(struct snd_sof_dev *sdev) snd_hdac_chip_writew(bus, STATESTS, codec_mask); } } -EXPORT_SYMBOL_NS(hda_codec_check_for_state_change, SND_SOC_SOF_HDA_AUDIO_CODEC); +EXPORT_SYMBOL_NS_GPL(hda_codec_check_for_state_change, SND_SOC_SOF_HDA_AUDIO_CODEC); void hda_codec_detect_mask(struct snd_sof_dev *sdev) { @@ -355,7 +352,7 @@ void hda_codec_i915_display_power(struct snd_sof_dev *sdev, bool enable) snd_hdac_display_power(bus, HDA_CODEC_IDX_CONTROLLER, enable); } } -EXPORT_SYMBOL_NS(hda_codec_i915_display_power, SND_SOC_SOF_HDA_AUDIO_CODEC_I915); +EXPORT_SYMBOL_NS_GPL(hda_codec_i915_display_power, SND_SOC_SOF_HDA_AUDIO_CODEC_I915); int hda_codec_i915_init(struct snd_sof_dev *sdev) { @@ -372,7 +369,7 @@ int hda_codec_i915_init(struct snd_sof_dev *sdev) return 0; } -EXPORT_SYMBOL_NS(hda_codec_i915_init, SND_SOC_SOF_HDA_AUDIO_CODEC_I915); +EXPORT_SYMBOL_NS_GPL(hda_codec_i915_init, SND_SOC_SOF_HDA_AUDIO_CODEC_I915); int hda_codec_i915_exit(struct snd_sof_dev *sdev) { @@ -386,7 +383,7 @@ int hda_codec_i915_exit(struct snd_sof_dev *sdev) return snd_hdac_i915_exit(bus); } -EXPORT_SYMBOL_NS(hda_codec_i915_exit, SND_SOC_SOF_HDA_AUDIO_CODEC_I915); +EXPORT_SYMBOL_NS_GPL(hda_codec_i915_exit, SND_SOC_SOF_HDA_AUDIO_CODEC_I915); #endif From patchwork Thu Oct 27 19:35:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 619232 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 3A016ECAAA1 for ; Thu, 27 Oct 2022 19:42:58 +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 68D322E04; Thu, 27 Oct 2022 21:42:06 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 68D322E04 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1666899776; bh=CkXgfb2uB0rKr6BruYmDWfLIaYApT/LAJHKPGB+rjzM=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=nnSkGhXw9bxbD9/3sH0a/Y5fwmKPB2qWWJNyzlhT9rK7VL0mmB/l0gHsCIjFbhIv9 fXqEyHjtyb6iOm68v6zKIYSX0+qxWn++RQy5ysL79Az27gyfRzj9S4MAZu5DbAUqYM wGSWYQAWzVFcv/ccORwR1P9uw9kZrpNr7fMPez+Y= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 3E44CF805FA; Thu, 27 Oct 2022 21:36:49 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id CA71CF805C5; Thu, 27 Oct 2022 21:36:41 +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 2F549F805AE for ; Thu, 27 Oct 2022 21:36:29 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 2F549F805AE Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="PnwFiRmN" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666899391; x=1698435391; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=CkXgfb2uB0rKr6BruYmDWfLIaYApT/LAJHKPGB+rjzM=; b=PnwFiRmNXlkGKxCn9GRAXKtKjhT3EYgYqQkfI0m/4cBhqIZ/h+1+aXbm TCC5zH1KHgQ1DcpcPyOx+ABsFlZNKLdy0jUZzLJrTjSCHm+8Ed+1HW5l4 juWV0RTut3Q3EgixOYDY40RWnap6ressR7mS+lUItvNINIBIBLInD5Wpy sbMo5q78HhS4zEqX4k9+nkTMja1gdrMMih7LLTxYDpzG1xdGiGcvobdks ci4kRJJe7mqQxHKWWXuErBgtojNXFBqUrY/71ye+OecPuCzOEQu6fhDGO gR7LQoOTz91wQYq7mOAq6J8V0vpwg7u2dImU76wmNkLIP2dzMZos5Rxu8 g==; X-IronPort-AV: E=McAfee;i="6500,9779,10513"; a="334957891" X-IronPort-AV: E=Sophos;i="5.95,218,1661842800"; d="scan'208";a="334957891" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Oct 2022 12:36:28 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10513"; a="632527091" X-IronPort-AV: E=Sophos;i="5.95,218,1661842800"; d="scan'208";a="632527091" Received: from vmehta-mobl.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.212.6.254]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Oct 2022 12:36:27 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Subject: [PATCH 21/21] ASoC: SOF: introduce new DEBUG_NOCODEC mode Date: Thu, 27 Oct 2022 15:35:40 -0400 Message-Id: <20221027193540.259520-22-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221027193540.259520-1-pierre-louis.bossart@linux.intel.com> References: <20221027193540.259520-1-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Cc: Cezary Rojewski , tiwai@suse.de, =?utf-8?q?P?= =?utf-8?q?=C3=A9ter_Ujfalusi?= , Pierre-Louis Bossart , Rander Wang , broonie@kernel.org, Ranjani Sridharan , Bard Liao 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" The existing NOCODEC mode enforces a build-time mutual exclusion with the HDaudio link support, mostly to avoid any dependency on the snd_hdac library and references to HDAudio codec/i915 stuff. This is very useful to track dependencies and test a minimal configuration, but very painful for developers and CI: a recompilation and reinstall of the kernel modules is required. This patch suggests an alternate middle ground where the selection of the machine driver and all codec-related actions are bypassed at run-time, contingent on a kernel module parameter being set. For example setting BIT(10) with 'options snd_sof sof_debug=0x401' is enough to switch from an HDaudio card to a nocodec one. This new DEBUG_NOCODEC mode is not suitable for distributions and end-users. It's not even recommended on all platforms, i.e. the NOCODEC mode is known not to work on specific devices where the BIOS did not configure support for I2S/DMIC interfaces. The usual development devices such as Chromebooks, Up boards and Intel RVP are the only recommended platforms where this mode can be supported. Note that the dynamic switch between HDaudio and nocodec may not always possible depending on hardware layout, pin-mux options, and BIOS settings. The audio subsustems on Intel platforms has to support 4 types of interfaces and pin-mux can be complicated. Reviewers might ask: why didn't we do this earlier? The main reason is that all the codec-related configurations were not cleanly separated out in the sof/intel directory. With all the cleanups done recently, adding this opt-in behavior is relatively straightforward. Tested on UpExtreme (WHL) and UpExtreme i11 (TGL). Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: Bard Liao Reviewed-by: Péter Ujfalusi Reviewed-by: Ranjani Sridharan --- sound/soc/sof/Kconfig | 18 ++++++++-- sound/soc/sof/intel/Kconfig | 2 +- sound/soc/sof/intel/hda-codec.c | 59 +++++++++++++++++++++++++++++++++ sound/soc/sof/sof-audio.c | 5 +++ sound/soc/sof/sof-priv.h | 3 ++ 5 files changed, 84 insertions(+), 3 deletions(-) diff --git a/sound/soc/sof/Kconfig b/sound/soc/sof/Kconfig index 37f7df5fde17..0b9beb74b0f6 100644 --- a/sound/soc/sof/Kconfig +++ b/sound/soc/sof/Kconfig @@ -97,13 +97,13 @@ config SND_SOC_SOF_NOCODEC tristate config SND_SOC_SOF_NOCODEC_SUPPORT - bool "SOF nocodec mode support" + bool "SOF nocodec static mode support" help This adds support for a dummy/nocodec machine driver fallback option if no known codec is detected. This is typically only enabled for developers or devices where the sound card is controlled externally. - This option is mutually exclusive with the Intel HDAudio support. + This option is mutually exclusive at build time with the Intel HDAudio support. Selecting it may have negative impacts and prevent e.g. microphone functionality from being enabled on Intel CoffeeLake and later platforms. @@ -136,6 +136,19 @@ config SND_SOC_SOF_DEBUG if SND_SOC_SOF_DEBUG +config SND_SOC_SOF_NOCODEC_DEBUG_SUPPORT + bool "SOF nocodec debug mode support" + depends on !SND_SOC_SOF_NOCODEC_SUPPORT + help + This adds support for a dummy/nocodec machine driver fallback + option. + Unlike the SND_SOC_SOF_NOCODEC_SUPPORT, this option is NOT + mutually exclusive at build with the Intel HDAudio support. The + selection will be done depending on command line or modprobe.d settings + Distributions should not select this option! + Say Y if you need this nocodec debug fallback option. + If unsure select "N". + config SND_SOC_SOF_FORCE_NOCODEC_MODE bool "SOF force nocodec Mode" depends on SND_SOC_SOF_NOCODEC_SUPPORT @@ -239,6 +252,7 @@ config SND_SOC_SOF tristate select SND_SOC_TOPOLOGY select SND_SOC_SOF_NOCODEC if SND_SOC_SOF_NOCODEC_SUPPORT + select SND_SOC_SOF_NOCODEC if SND_SOC_SOF_NOCODEC_DEBUG_SUPPORT help This option is not user-selectable but automagically handled by 'select' statements at a higher level. diff --git a/sound/soc/sof/intel/Kconfig b/sound/soc/sof/intel/Kconfig index 7af495fb6125..36a0e2bf30ff 100644 --- a/sound/soc/sof/intel/Kconfig +++ b/sound/soc/sof/intel/Kconfig @@ -277,7 +277,7 @@ if SND_SOC_SOF_HDA_COMMON config SND_SOC_SOF_HDA_LINK bool "SOF support for HDA Links(HDA/HDMI)" - depends on SND_SOC_SOF_NOCODEC=n + depends on SND_SOC_SOF_NOCODEC_SUPPORT=n select SND_SOC_SOF_PROBE_WORK_QUEUE help This adds support for HDA links(HDA/HDMI) with Sound Open Firmware diff --git a/sound/soc/sof/intel/hda-codec.c b/sound/soc/sof/intel/hda-codec.c index 50a7e3f08285..8a5e99a898ec 100644 --- a/sound/soc/sof/intel/hda-codec.c +++ b/sound/soc/sof/intel/hda-codec.c @@ -72,6 +72,10 @@ void hda_codec_jack_wake_enable(struct snd_sof_dev *sdev, bool enable) struct hda_codec *codec; unsigned int mask = 0; + if (IS_ENABLED(CONFIG_SND_SOC_SOF_NOCODEC_DEBUG_SUPPORT) && + sof_debug_check_flag(SOF_DBG_FORCE_NOCODEC)) + return; + if (enable) { list_for_each_codec(codec, hbus) if (codec->jacktbl.used) @@ -88,6 +92,10 @@ void hda_codec_jack_check(struct snd_sof_dev *sdev) struct hda_bus *hbus = sof_to_hbus(sdev); struct hda_codec *codec; + if (IS_ENABLED(CONFIG_SND_SOC_SOF_NOCODEC_DEBUG_SUPPORT) && + sof_debug_check_flag(SOF_DBG_FORCE_NOCODEC)) + return; + list_for_each_codec(codec, hbus) /* * Wake up all jack-detecting codecs regardless whether an event @@ -201,6 +209,10 @@ void hda_codec_probe_bus(struct snd_sof_dev *sdev) struct hdac_bus *bus = sof_to_bus(sdev); int i, ret; + if (IS_ENABLED(CONFIG_SND_SOC_SOF_NOCODEC_DEBUG_SUPPORT) && + sof_debug_check_flag(SOF_DBG_FORCE_NOCODEC)) + return; + /* probe codecs in avail slots */ for (i = 0; i < HDA_MAX_CODECS; i++) { @@ -234,6 +246,10 @@ void hda_codec_detect_mask(struct snd_sof_dev *sdev) { struct hdac_bus *bus = sof_to_bus(sdev); + if (IS_ENABLED(CONFIG_SND_SOC_SOF_NOCODEC_DEBUG_SUPPORT) && + sof_debug_check_flag(SOF_DBG_FORCE_NOCODEC)) + return; + /* Accept unsolicited responses */ snd_hdac_chip_updatel(bus, GCTL, AZX_GCTL_UNSOL, AZX_GCTL_UNSOL); @@ -255,6 +271,10 @@ void hda_codec_init_cmd_io(struct snd_sof_dev *sdev) { struct hdac_bus *bus = sof_to_bus(sdev); + if (IS_ENABLED(CONFIG_SND_SOC_SOF_NOCODEC_DEBUG_SUPPORT) && + sof_debug_check_flag(SOF_DBG_FORCE_NOCODEC)) + return; + /* initialize the codec command I/O */ snd_hdac_bus_init_cmd_io(bus); } @@ -264,6 +284,10 @@ void hda_codec_resume_cmd_io(struct snd_sof_dev *sdev) { struct hdac_bus *bus = sof_to_bus(sdev); + if (IS_ENABLED(CONFIG_SND_SOC_SOF_NOCODEC_DEBUG_SUPPORT) && + sof_debug_check_flag(SOF_DBG_FORCE_NOCODEC)) + return; + /* set up CORB/RIRB buffers if was on before suspend */ if (bus->cmd_dma_state) snd_hdac_bus_init_cmd_io(bus); @@ -274,6 +298,10 @@ void hda_codec_stop_cmd_io(struct snd_sof_dev *sdev) { struct hdac_bus *bus = sof_to_bus(sdev); + if (IS_ENABLED(CONFIG_SND_SOC_SOF_NOCODEC_DEBUG_SUPPORT) && + sof_debug_check_flag(SOF_DBG_FORCE_NOCODEC)) + return; + /* initialize the codec command I/O */ snd_hdac_bus_stop_cmd_io(bus); } @@ -283,6 +311,10 @@ void hda_codec_suspend_cmd_io(struct snd_sof_dev *sdev) { struct hdac_bus *bus = sof_to_bus(sdev); + if (IS_ENABLED(CONFIG_SND_SOC_SOF_NOCODEC_DEBUG_SUPPORT) && + sof_debug_check_flag(SOF_DBG_FORCE_NOCODEC)) + return; + /* stop the CORB/RIRB DMA if it is On */ if (bus->cmd_dma_state) snd_hdac_bus_stop_cmd_io(bus); @@ -294,6 +326,10 @@ void hda_codec_rirb_status_clear(struct snd_sof_dev *sdev) { struct hdac_bus *bus = sof_to_bus(sdev); + if (IS_ENABLED(CONFIG_SND_SOC_SOF_NOCODEC_DEBUG_SUPPORT) && + sof_debug_check_flag(SOF_DBG_FORCE_NOCODEC)) + return; + /* clear rirb status */ snd_hdac_chip_writeb(bus, RIRBSTS, RIRB_INT_MASK); } @@ -303,6 +339,9 @@ void hda_codec_set_codec_wakeup(struct snd_sof_dev *sdev, bool status) { struct hdac_bus *bus = sof_to_bus(sdev); + if (sof_debug_check_flag(SOF_DBG_FORCE_NOCODEC)) + return; + snd_hdac_set_codec_wakeup(bus, status); } EXPORT_SYMBOL_NS_GPL(hda_codec_set_codec_wakeup, SND_SOC_SOF_HDA_AUDIO_CODEC); @@ -313,6 +352,10 @@ bool hda_codec_check_rirb_status(struct snd_sof_dev *sdev) bool active = false; u32 rirb_status; + if (IS_ENABLED(CONFIG_SND_SOC_SOF_NOCODEC_DEBUG_SUPPORT) && + sof_debug_check_flag(SOF_DBG_FORCE_NOCODEC)) + return false; + rirb_status = snd_hdac_chip_readb(bus, RIRBSTS); if (rirb_status & RIRB_INT_MASK) { /* @@ -334,6 +377,10 @@ void hda_codec_device_remove(struct snd_sof_dev *sdev) { struct hdac_bus *bus = sof_to_bus(sdev); + if (IS_ENABLED(CONFIG_SND_SOC_SOF_NOCODEC_DEBUG_SUPPORT) && + sof_debug_check_flag(SOF_DBG_FORCE_NOCODEC)) + return; + /* codec removal, invoke bus_device_remove */ snd_hdac_ext_bus_device_remove(bus); } @@ -347,6 +394,10 @@ void hda_codec_i915_display_power(struct snd_sof_dev *sdev, bool enable) { struct hdac_bus *bus = sof_to_bus(sdev); + if (IS_ENABLED(CONFIG_SND_SOC_SOF_NOCODEC_DEBUG_SUPPORT) && + sof_debug_check_flag(SOF_DBG_FORCE_NOCODEC)) + return; + if (HDA_IDISP_CODEC(bus->codec_mask)) { dev_dbg(bus->dev, "Turning i915 HDAC power %d\n", enable); snd_hdac_display_power(bus, HDA_CODEC_IDX_CONTROLLER, enable); @@ -359,6 +410,10 @@ int hda_codec_i915_init(struct snd_sof_dev *sdev) struct hdac_bus *bus = sof_to_bus(sdev); int ret; + if (IS_ENABLED(CONFIG_SND_SOC_SOF_NOCODEC_DEBUG_SUPPORT) && + sof_debug_check_flag(SOF_DBG_FORCE_NOCODEC)) + return 0; + /* i915 exposes a HDA codec for HDMI audio */ ret = snd_hdac_i915_init(bus); if (ret < 0) @@ -375,6 +430,10 @@ int hda_codec_i915_exit(struct snd_sof_dev *sdev) { struct hdac_bus *bus = sof_to_bus(sdev); + if (IS_ENABLED(CONFIG_SND_SOC_SOF_NOCODEC_DEBUG_SUPPORT) && + sof_debug_check_flag(SOF_DBG_FORCE_NOCODEC)) + return 0; + if (!bus->audio_component) return 0; diff --git a/sound/soc/sof/sof-audio.c b/sound/soc/sof/sof-audio.c index 62092e2d609c..7306a2649857 100644 --- a/sound/soc/sof/sof-audio.c +++ b/sound/soc/sof/sof-audio.c @@ -826,6 +826,10 @@ int sof_machine_check(struct snd_sof_dev *sdev) if (!IS_ENABLED(CONFIG_SND_SOC_SOF_FORCE_NOCODEC_MODE)) { const struct snd_sof_of_mach *of_mach; + if (IS_ENABLED(CONFIG_SND_SOC_SOF_NOCODEC_DEBUG_SUPPORT) && + sof_debug_check_flag(SOF_DBG_FORCE_NOCODEC)) + goto nocodec; + /* find machine */ mach = snd_sof_machine_select(sdev); if (mach) { @@ -848,6 +852,7 @@ int sof_machine_check(struct snd_sof_dev *sdev) dev_warn(sdev->dev, "Force to use nocodec mode\n"); } +nocodec: /* select nocodec mode */ dev_warn(sdev->dev, "Using nocodec machine driver\n"); mach = devm_kzalloc(sdev->dev, sizeof(*mach), GFP_KERNEL); diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h index d3ede97b6759..876e6fdbef4f 100644 --- a/sound/soc/sof/sof-priv.h +++ b/sound/soc/sof/sof-priv.h @@ -43,6 +43,9 @@ #define SOF_DBG_PRINT_IPC_SUCCESS_LOGS BIT(9) /* print IPC success * in dmesg logs */ +#define SOF_DBG_FORCE_NOCODEC BIT(10) /* ignore all codec-related + * configurations + */ /* Flag definitions used for controlling the DSP dump behavior */ #define SOF_DBG_DUMP_REGS BIT(0)