From patchwork Thu Sep 21 06:43:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bard Liao X-Patchwork-Id: 13393699 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 202F1CD4958 for ; Thu, 21 Sep 2023 06:35:44 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 9F3EEA4B; Thu, 21 Sep 2023 08:34:51 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 9F3EEA4B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1695278141; bh=Uu1FgcDEvBVHUCLithFMPg/f0NwSrFDEgPpam3COMR4=; h=From:To:Cc:Subject:Date:List-Id:List-Archive:List-Help:List-Owner: List-Post:List-Subscribe:List-Unsubscribe:From; b=UPBCLhnqO4iXz6XaPeg/HP4AevF4ALclI+zyCUiFFhIOcuOJpTKgZHTWsHuQ9xf0G ywaw4kKEqwvcP8BOdfpZSYHgLZrtjoFSKvVv/9QNEVGJEbvb/tS9vQly1sAlf4qyXW k4euMCu+3Ux2xDtTbJnV559p204MAVAaj2RQc9Is= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 26AF7F8025A; Thu, 21 Sep 2023 08:34:51 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id B6F48F8025A; Thu, 21 Sep 2023 08:34:50 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id E94DAF8025A; Thu, 21 Sep 2023 08:34:45 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.151]) (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 8B128F800AA for ; Thu, 21 Sep 2023 08:34:39 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 8B128F800AA Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=iKTFFonf DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695278081; x=1726814081; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=Uu1FgcDEvBVHUCLithFMPg/f0NwSrFDEgPpam3COMR4=; b=iKTFFonfi46R/CuhQPpTD13rhgWHDkv4/2kuVV3vHmdhrUYB6zti0LS3 oCDAvZ4vTqmNDce2dLx5BSnUYTTihTNSoVP1mxD2pJZbCh/2nF6SitGgF WoESFOOLI1lXb8dGy3Sxho0YHFORsMmhWRDkAooCZPCcJU3Z9cIxsBVRN B4CVwk22CiulPp4emSd3hFbS1aYSfzQAAOWlqqKne3KEa9Sx2Bxa8cs2+ pDAeVlvtp9jiI6Bo6U9PkP8ltms9yztQplFptr/BY5a9kfLf8W57LlspJ Aad6Y2OMLWEjVw3YzrfsAeEKuokabMwfYdVQkyiHXj1O7f25x6KzlxdHN w==; X-IronPort-AV: E=McAfee;i="6600,9927,10839"; a="360684864" X-IronPort-AV: E=Sophos;i="6.03,164,1694761200"; d="scan'208";a="360684864" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Sep 2023 23:33:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10839"; a="837200822" X-IronPort-AV: E=Sophos;i="6.03,164,1694761200"; d="scan'208";a="837200822" Received: from bard-ubuntu.sh.intel.com ([10.239.185.57]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Sep 2023 23:33:54 -0700 From: Bard Liao To: broonie@kernel.org, tiwai@suse.de Cc: alsa-devel@alsa-project.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com, peter.ujfalusi@linux.intel.com Subject: [PATCH] ASoC: hdac_hda: fix HDA patch loader support Date: Thu, 21 Sep 2023 14:43:17 +0800 Message-Id: <20230921064317.2120452-1-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Message-ID-Hash: W4WGCV2EQFAPMKYFNNDI3RVPG67W3FOS X-Message-ID-Hash: W4WGCV2EQFAPMKYFNNDI3RVPG67W3FOS X-MailFrom: yung-chuan.liao@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: The array size is irrelevant with SNDRV_CARDS. dev_index is from codec address and the available codec number is HDA_MAX_CODECS. Also, hda_pvt->fw is for a temporary use, no need to add a new extra field in hdac_hda_priv{}. Fixes: 842a62a75e70 ("ASoC: hdac_hda: add HDA patch loader support") Signed-off-by: Bard Liao Reviewed-by: Pierre-Louis Bossart Reviewed-by: Ranjani Sridharan Reviewed-by: Takashi Iwai --- sound/soc/codecs/hdac_hda.c | 15 ++++++++------- sound/soc/codecs/hdac_hda.h | 3 --- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/sound/soc/codecs/hdac_hda.c b/sound/soc/codecs/hdac_hda.c index 8f5d97949d3d..355f30779a34 100644 --- a/sound/soc/codecs/hdac_hda.c +++ b/sound/soc/codecs/hdac_hda.c @@ -37,10 +37,10 @@ SNDRV_PCM_RATE_192000) #ifdef CONFIG_SND_HDA_PATCH_LOADER -static char *loadable_patch[SNDRV_CARDS]; +static char *loadable_patch[HDA_MAX_CODECS]; module_param_array_named(patch, loadable_patch, charp, NULL, 0444); -MODULE_PARM_DESC(patch, "Patch file for Intel HD audio interface."); +MODULE_PARM_DESC(patch, "Patch file array for Intel HD audio interface. The array index is the codec address."); #endif static int hdac_hda_dai_open(struct snd_pcm_substream *substream, @@ -434,20 +434,21 @@ static int hdac_hda_codec_probe(struct snd_soc_component *component) #ifdef CONFIG_SND_HDA_PATCH_LOADER if (loadable_patch[hda_pvt->dev_index] && *loadable_patch[hda_pvt->dev_index]) { + const struct firmware *fw; + dev_info(&hdev->dev, "Applying patch firmware '%s'\n", loadable_patch[hda_pvt->dev_index]); - ret = request_firmware(&hda_pvt->fw, loadable_patch[hda_pvt->dev_index], + ret = request_firmware(&fw, loadable_patch[hda_pvt->dev_index], &hdev->dev); if (ret < 0) goto error_no_pm; - if (hda_pvt->fw) { - ret = snd_hda_load_patch(hcodec->bus, hda_pvt->fw->size, hda_pvt->fw->data); + if (fw) { + ret = snd_hda_load_patch(hcodec->bus, fw->size, fw->data); if (ret < 0) { dev_err(&hdev->dev, "failed to load hda patch %d\n", ret); goto error_no_pm; } - release_firmware(hda_pvt->fw); - hda_pvt->fw = NULL; + release_firmware(fw); } } #endif diff --git a/sound/soc/codecs/hdac_hda.h b/sound/soc/codecs/hdac_hda.h index b7a12aea8d32..d03a5d4e7288 100644 --- a/sound/soc/codecs/hdac_hda.h +++ b/sound/soc/codecs/hdac_hda.h @@ -27,9 +27,6 @@ struct hdac_hda_priv { struct hdac_hda_pcm pcm[HDAC_DAI_ID_NUM]; bool need_display_power; int dev_index; -#ifdef CONFIG_SND_HDA_PATCH_LOADER - const struct firmware *fw; -#endif }; struct hdac_ext_bus_ops *snd_soc_hdac_hda_get_ops(void);