From patchwork Fri Jan 15 20:11:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Schulman X-Patchwork-Id: 12024101 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 156EAC433E0 for ; Fri, 15 Jan 2021 20:42:44 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3BB4623AA7 for ; Fri, 15 Jan 2021 20:42:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3BB4623AA7 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=cirrus.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id EB51A17F4; Fri, 15 Jan 2021 21:41:50 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz EB51A17F4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1610743361; bh=AxE51BkiMkLTzvK1/J1z0q/+yFWuSP58ELukAvJl/+Q=; h=From:To:Subject:Date:Cc:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=eGKtq6iTbkL0YteWc01j5SbJO7scspirJ7De9JXP8K1f0GYQC8iWMKps1gFMk19HZ /g5X3cvIg/0U66wEewFl34kbsvUi080CI8UzD9k5Dijn4MejX/j563DOyjhfrscCGa x0toNhK6949gQet6i191aj1W3k5eNIwpGPUllfXQ= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 79BA6F8016D; Fri, 15 Jan 2021 21:41:50 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 18F49F801ED; Fri, 15 Jan 2021 21:41:49 +0100 (CET) Received: from mx0b-001ae601.pphosted.com (mx0b-001ae601.pphosted.com [67.231.152.168]) (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 1A36CF80113 for ; Fri, 15 Jan 2021 21:41:41 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 1A36CF80113 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=cirrus.com header.i=@cirrus.com header.b="g/KeM1Kj" Received: from pps.filterd (m0077474.ppops.net [127.0.0.1]) by mx0b-001ae601.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 10FKbMJd018307; Fri, 15 Jan 2021 14:41:40 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=PODMain02222019; bh=BXMbSTYs/6mWVCG5cVYWFlAcuvl8gIl+wDHgVpijhGg=; b=g/KeM1KjJ+fiTw6VK8RAp9Vf6tn00vXhhrjc9Ademu1DaedX0BLDWIeZNkKL+J9pifba TqwCCqAEBOmZCZ56esbD15fyAk9Kg4sKTGdWpec0xL4BNGQgyBynwVsii0SS3hmggSSl MsuFGIdJlB2OEPG3qF7meWOir2vwLLAoBO8MO7IGFP1UPXVPOZPk347AthEcTd5yHOPf p/9R2+DoISfVMEqEiGJ6ZzN5qMAhiWlOtEIziVadT9T93G1c93dKiC+E5PbrGsvm9mRd kTooY/rLCk9OpVMvuX/Ia+NVvuMQnpuJJMdc7lVTVKKVEjIVvW8saF8r6d0Re8XxG+42 3A== Received: from ediex02.ad.cirrus.com ([87.246.76.36]) by mx0b-001ae601.pphosted.com with ESMTP id 35y9ss05jp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Fri, 15 Jan 2021 14:41:40 -0600 Received: from EDIEX01.ad.cirrus.com (198.61.84.80) by EDIEX02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Fri, 15 Jan 2021 20:11:32 +0000 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by EDIEX01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server id 15.1.1913.5 via Frontend Transport; Fri, 15 Jan 2021 20:11:32 +0000 Received: from james-tower.ad.cirrus.com (unknown [141.131.78.182]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 3B21A45; Fri, 15 Jan 2021 20:11:26 +0000 (UTC) From: James Schulman To: Subject: [PATCH] ASoC: wm_adsp: Fix control name parsing for multi-fw Date: Fri, 15 Jan 2021 14:11:05 -0600 Message-ID: <20210115201105.14075-1-james.schulman@cirrus.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 priorityscore=1501 phishscore=0 spamscore=0 malwarescore=0 bulkscore=0 lowpriorityscore=0 adultscore=0 mlxlogscore=848 impostorscore=0 clxscore=1011 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101150125 Cc: alsa-devel@alsa-project.org, James Schulman , ckeepax@opensource.cirrus.com, david.rhodes@cirrus.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" When switching between firmware types, the wrong control can be selected when requesting control in kernel API. Use the currently selected DSP firwmare type to select the proper mixer control. Signed-off-by: James Schulman Acked-by: Charles Keepax --- sound/soc/codecs/wm_adsp.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c index 1fc7bc1970ea..262c2db4f81c 100644 --- a/sound/soc/codecs/wm_adsp.c +++ b/sound/soc/codecs/wm_adsp.c @@ -2033,11 +2033,14 @@ static struct wm_coeff_ctl *wm_adsp_get_ctl(struct wm_adsp *dsp, unsigned int alg) { struct wm_coeff_ctl *pos, *rslt = NULL; + const char *fw_txt = wm_adsp_fw_text[dsp->fw]; list_for_each_entry(pos, &dsp->ctl_list, list) { if (!pos->subname) continue; if (strncmp(pos->subname, name, pos->subname_len) == 0 && + strncmp(pos->fw_name, fw_txt, + SNDRV_CTL_ELEM_ID_NAME_MAXLEN) == 0 && pos->alg_region.alg == alg && pos->alg_region.type == type) { rslt = pos;