From patchwork Wed Mar 29 13:05:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jianhua Lu X-Patchwork-Id: 13192884 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 3678CC6FD18 for ; Wed, 29 Mar 2023 16:15:42 +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 E8E53206; Wed, 29 Mar 2023 18:14:49 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz E8E53206 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1680106540; bh=2LQtTTa/mu9cgZ0zt5gihw0wU4hZiT1hP5ebSA7aYQk=; h=From:To:Subject:Date:CC:List-Id:List-Archive:List-Help:List-Owner: List-Post:List-Subscribe:List-Unsubscribe:From; b=OZy91D5w7yptLkM1PwTRszxcosrZypCxq6UTHSRG8m1HtINxov0F0xEZEtqKQFSa0 d9ACfyVVUvJL9YI/Z2wi3gSoSvCwfyrdzbyWzz96eDyLuM8p50II/qN9XdVxnsEJTH rH7JHH6K/s0yVw8YvsshnfjNRj3kvDhDuFKe5Jf8= Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id D6119F80548; Wed, 29 Mar 2023 18:13:51 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 8F4C4F80272; Wed, 29 Mar 2023 15:05:42 +0200 (CEST) Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 6AA77F80114 for ; Wed, 29 Mar 2023 15:05:37 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 6AA77F80114 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=kKA3vi+S Received: by mail-pg1-x530.google.com with SMTP id y19so9224926pgk.5 for ; Wed, 29 Mar 2023 06:05:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680095134; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=jsSpCWEsDfnGoaRyyeTFl4Yy+RKBES/VujFMn4D6v78=; b=kKA3vi+Sbovo5u5+fyCFosu5eQC2C3KVSABeLsujBVqtX/x+zMpbybujpO2IuBQOIT DwJezqf2BIOT+pceWSbiFODF3jKmQxDorL/UKHXwkWd6522a+jrQzsPUwJJqFmnR22Uq X+F7pPYDbnQcZXz30N3YxO2pYYf+YyoLBYU2RCKW+/f/WFkJ0+dLbFryTcGOkakK6aJ3 mYwSN4LjEzbHIJhEe6LBCj8jltVwVrHjEoaaktandxKKUk6gWoPnBSP0W0yMU5nzeFHb hJdUEgAiVWG8V0nKMEgQ7to2Y7eEZRGxd04WpQn034AmPcee4Rpy7G3Fu+XuzmP+QP6m S2IA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680095134; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=jsSpCWEsDfnGoaRyyeTFl4Yy+RKBES/VujFMn4D6v78=; b=E6pfWiADuAcigXR1e5v00C8PM99cKGAX24R6LUidT4KC7UsJ+wA3A5MDqTPK/THW4x 2WyROnpb5SqfKIJLPWU9s2oEaPuv5z7f7ximFFqBHedb2DCiYtfqBnoHnUZYj+ZekIz7 kfxRxOk8Pf8djjag3iqP2yslDwf3ToEeb2dnyWbMdYG6xxr5vPK8AVvcZZvwYoOFAlED o1dQQFPLEvcQNkE8/iTd5Estd3OiR8YP6FP8czQ4qMbfoCfqZr9qucfZ2Kcw5tFQpQYz xpc6kbycd5PMFSE2pDzXK0FUdfyL3YAbaJSzjvf2T3gYxDgvEIC3Bqtbvxdgi2vs09WA r3QQ== X-Gm-Message-State: AAQBX9fu8b/WF2L4vTNMbFsaOquIbjnCED0qcWptOfF7L0emndvTqy00 NKkqBoQ22R7HR5zwnO8zjko= X-Google-Smtp-Source: AKy350YHQ81/8HFFe4IFQNlTZHAgL9aVJ2OJjYSUJfpDcFXzmy0V7n5+Ir+YF95SPcnj0RdBdqvElg== X-Received: by 2002:a62:84c4:0:b0:628:134b:6b1c with SMTP id k187-20020a6284c4000000b00628134b6b1cmr21327044pfd.2.1680095134256; Wed, 29 Mar 2023 06:05:34 -0700 (PDT) Received: from localhost.localdomain (n220246252084.netvigator.com. [220.246.252.84]) by smtp.gmail.com with ESMTPSA id n6-20020aa79046000000b005ae02dc5b94sm22790452pfo.219.2023.03.29.06.05.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Mar 2023 06:05:33 -0700 (PDT) From: Jianhua Lu To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Richard Fitzgerald , Simon Trimmer , Charles Keepax , Cristian Ciocaltea Subject: [PATCH] Asoc: wm_adsp: Add support for loading firmware with prefix name Date: Wed, 29 Mar 2023 21:05:25 +0800 Message-Id: <20230329130525.15830-1-lujianhua000@gmail.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-MailFrom: lujianhua000@gmail.com X-Mailman-Rule-Hits: nonmember-moderation 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 Message-ID-Hash: DMSGGYQCT34KAE5VLP2UYYRI5SI5LF4K X-Message-ID-Hash: DMSGGYQCT34KAE5VLP2UYYRI5SI5LF4K X-Mailman-Approved-At: Wed, 29 Mar 2023 16:13:49 +0000 CC: patches@opensource.cirrus.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, phone-devel@vger.kernel.org, Jianhua Lu 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: For platform using fdt, system_name is NULL, it doesn't provide a way to load firmware with prefix name, so add it. Signed-off-by: Jianhua Lu --- sound/soc/codecs/wm_adsp.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c index 216120b68b64..17481e42d440 100644 --- a/sound/soc/codecs/wm_adsp.c +++ b/sound/soc/codecs/wm_adsp.c @@ -760,6 +760,10 @@ static int wm_adsp_request_firmware_file(struct wm_adsp *dsp, *filename = kasprintf(GFP_KERNEL, "%s%s-%s-%s-%s.%s", dir, dsp->part, dsp->fwf_name, wm_adsp_fw[dsp->fw].file, system_name, filetype); + else if (asoc_component_prefix) + *filename = kasprintf(GFP_KERNEL, "%s%s-%s-%s-%s.%s", dir, dsp->part, + dsp->fwf_name, wm_adsp_fw[dsp->fw].file, asoc_component_prefix, + filetype); else *filename = kasprintf(GFP_KERNEL, "%s%s-%s-%s.%s", dir, dsp->part, dsp->fwf_name, wm_adsp_fw[dsp->fw].file, filetype); @@ -831,6 +835,16 @@ static int wm_adsp_request_firmware_files(struct wm_adsp *dsp, NULL, "bin"); return 0; } + } else if (asoc_component_prefix) { + if (!wm_adsp_request_firmware_file(dsp, wmfw_firmware, wmfw_filename, + cirrus_dir, NULL, + asoc_component_prefix, "wmfw")) { + adsp_dbg(dsp, "Found '%s'\n", *wmfw_filename); + wm_adsp_request_firmware_file(dsp, coeff_firmware, coeff_filename, + cirrus_dir, NULL, + asoc_component_prefix, "bin"); + return 0; + } } if (!wm_adsp_request_firmware_file(dsp, wmfw_firmware, wmfw_filename,