From patchwork Mon Feb 13 14:50:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Binding X-Patchwork-Id: 56327 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2388158wrn; Mon, 13 Feb 2023 06:54:17 -0800 (PST) X-Google-Smtp-Source: AK7set8pGX6B4dz16z5uaAwXMp6d1xgVnXT3EM9wX4jjm1f0fM5xZomBaT872OIXW5SUfAa6Wjwe X-Received: by 2002:a05:6a20:7f92:b0:bc:9007:e53 with SMTP id d18-20020a056a207f9200b000bc90070e53mr32716267pzj.0.1676300057073; Mon, 13 Feb 2023 06:54:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676300057; cv=none; d=google.com; s=arc-20160816; b=S30Hrt+i7v8dyb0Si4HGr36UGjCh6pznZ/YMqD/mBMXIh315LRcThe6MCEgnXj/irf mpCQYY9oYRYour9G64qdqjH7V9iS0O0kMJgp5Otx7odJ4ChBXOOF1sjIa1YiJnFtEHSW iWU4l432emdp+gQLGMg0EMFrN1ry/4A8jsjMfWa3IUpBsQmguWnYSuHCQyjVFoXA/v5S QJefMoik5Z7BEjZSuY99pFIsQ4+F+HpPxLfujXK+2Mi4qyXpRJ0SxdJPAond3Iy2pGMh amcu3jzer4PX8wYHLv48dlynsqq5iDKCsPYeD0zoQileV/jWQp/nAujmXvjay3KukKxI HaEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=JIw8mwY5Md9J5BihoIWcs2nfJGbKKEYCYk7xpXo8uDM=; b=uOliBbMLmu6LdNeS9X8vqVjG8ENeuv/2AkS6+Wo5sdL4GIxfipfyGwdrelXmdVDLA5 mrZJk18ARqpkad7wQo/JQOrSpLKWftNCJfCooCqIuOHbJwHdaICJafotX1l4a2YmaYpF aD517ToZhC2ZpCiVQFQErmiHIy1t/X9L0msGgm7ZxAtHClkXyC0oJYYSftq1B2SotoXN ETqZ91RIZSM8AYOWTLKSX0LHm+GuV0eHljUcst0u2nX5IG5+mAxxdMAMIbsPH/U0gVCf h92I9V4ecP6d/eMa1DzXeItrLatK316mA62KzuLfR2O5YBJKCqUt85V4PbrIQMYcukBh CREQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=KwtavNN8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q4-20020a17090a9f4400b00233d4df537asi5648290pjv.158.2023.02.13.06.54.04; Mon, 13 Feb 2023 06:54:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=KwtavNN8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230480AbjBMOuk (ORCPT + 99 others); Mon, 13 Feb 2023 09:50:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230423AbjBMOuc (ORCPT ); Mon, 13 Feb 2023 09:50:32 -0500 Received: from mx0b-001ae601.pphosted.com (mx0a-001ae601.pphosted.com [67.231.149.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55B731BAFE for ; Mon, 13 Feb 2023 06:50:29 -0800 (PST) Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 31D5UX5D028354; Mon, 13 Feb 2023 08:50:13 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=PODMain02222019; bh=JIw8mwY5Md9J5BihoIWcs2nfJGbKKEYCYk7xpXo8uDM=; b=KwtavNN8opSlhFVCAxvQt7gDRvMENHJyrOOr5yVcbih+xawgGpVKnU/BRoHaOgzm42Yq /vAuv8wCz7MtEFz3PmDiv4Qs2tIi+uLH6PyTQcADOXz3MHg00F1Ke2bYS91YyFP27cB/ SDxx1hrHiF7pyl+j/+5ODoR8gMSNBzIE+8xzAJwMPO9Svj5Lq3D5mzJTuRCqQPTv23bD +GSDlaFno32Eut1ibghvGGtg+tErifXPGHNpdRuV4wuvarBppJPt9ONLNOrM50U87qAL Y6xU3VGsTuPrqoSe2snzM2qfsvPatInsJbTHPwmblIGJv+PTTM0ng2M9mcNnEkE2TAZr dg== Received: from ediex02.ad.cirrus.com ([84.19.233.68]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 3np9a72amh-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Feb 2023 08:50:13 -0600 Received: from ediex02.ad.cirrus.com (198.61.84.81) by ediex02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.21; Mon, 13 Feb 2023 08:50:11 -0600 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by anon-ediex02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server id 15.2.1118.21 via Frontend Transport; Mon, 13 Feb 2023 08:50:11 -0600 Received: from sbinding-cirrus-dsktp2.ad.cirrus.com (unknown [198.90.202.160]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id D7C0411AA; Mon, 13 Feb 2023 14:50:10 +0000 (UTC) From: Stefan Binding To: Jaroslav Kysela , Takashi Iwai CC: , , , Vitaly Rodionov , Stefan Binding Subject: [PATCH v2 1/3] ALSA: hda: cs35l41: Correct error condition handling Date: Mon, 13 Feb 2023 14:50:06 +0000 Message-ID: <20230213145008.1215849-2-sbinding@opensource.cirrus.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230213145008.1215849-1-sbinding@opensource.cirrus.com> References: <20230213145008.1215849-1-sbinding@opensource.cirrus.com> MIME-Version: 1.0 X-Proofpoint-GUID: Gg-lYgEfW_18MPAlBlaKj0GT02Ieh2fr X-Proofpoint-ORIG-GUID: Gg-lYgEfW_18MPAlBlaKj0GT02Ieh2fr X-Proofpoint-Spam-Reason: safe X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757728008471541925?= X-GMAIL-MSGID: =?utf-8?q?1757728008471541925?= From: Vitaly Rodionov Function cs_dsp_coeff_write_ctrl() can return 3 possible values: 0 - no change, 1 - value has changed and -1 - error, so positive value is not an error. Fixes: 7406bdbc4fb8 ("ASoC: wm_adsp: Return whether changed when writing controls") Signed-off-by: Vitaly Rodionov Signed-off-by: Stefan Binding --- sound/pci/hda/hda_cs_dsp_ctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/pci/hda/hda_cs_dsp_ctl.c b/sound/pci/hda/hda_cs_dsp_ctl.c index 5433f6227ac9..463ca06036bf 100644 --- a/sound/pci/hda/hda_cs_dsp_ctl.c +++ b/sound/pci/hda/hda_cs_dsp_ctl.c @@ -218,10 +218,10 @@ int hda_cs_dsp_write_ctl(struct cs_dsp *dsp, const char *name, int type, cs_ctl = cs_dsp_get_ctl(dsp, name, type, alg); ret = cs_dsp_coeff_write_ctrl(cs_ctl, 0, buf, len); mutex_unlock(&dsp->pwr_lock); - if (ret) + if (ret < 0) return ret; - if (cs_ctl->flags & WMFW_CTL_FLAG_SYS) + if (ret == 0 || (cs_ctl->flags & WMFW_CTL_FLAG_SYS)) return 0; ctl = cs_ctl->priv; From patchwork Mon Feb 13 14:50:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Binding X-Patchwork-Id: 56328 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2389401wrn; Mon, 13 Feb 2023 06:57:19 -0800 (PST) X-Google-Smtp-Source: AK7set/yiAgfBq8b18EiGKCtl67SaYTCN/2o97lcnkR5Bs3HrCUh/4EtwdYogQ1EjY0tGdLad+79 X-Received: by 2002:a05:6a20:160e:b0:be:afe7:ce5 with SMTP id l14-20020a056a20160e00b000beafe70ce5mr30402623pzj.51.1676300239174; Mon, 13 Feb 2023 06:57:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676300239; cv=none; d=google.com; s=arc-20160816; b=hW4vf490y1PHPwWi7RVNYZs8fkOsAWEbzQNuLHsRpeWFRjoilWefKVMhAoqD9IXzq3 saO8m0sohEv+tgUDC0a+RH9nySG7ZPRuPR12a/zc/Sad+nGXtnpbLEjCwxV52lnoPJp3 RIqSlVdoljTkxw0X3Aa8J5yfhahnwsezWfsvQCk9cDuoiCwwlxP6KBQPeNtJkron5vz4 dQnK9onyLqkD3sD8MlSHMQnYeWfXfDMJBoNwn9Go/mnHwnDg7AHKY0vBnj75+bsqz9hU OnlaXSKZ/JWcQ4JdZVfNFW45+vs++JyXm7Q0xTrhS3QBnIVu2I/35ACAdIuNIpPRVgCg rS0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ea/rFFhINu/phNw7OHU5UmtWWEBCiXfiwatQeZgF6Vg=; b=kJAKHdfGXRHBzxsg4KHy3A3nDsSU86k/4sd/vJaTnZxV7Qi08n2L/8Mb87+IzSY9Lw WbKvEFxWbLWFcMLFDNpN7MQ7NLkJsLXGeyPL9a8rhjWbkrmB6yw+82vEHB7Xu0Q83+Y6 RJolSJNQnB8V1i3vAaGvEviXDz9q0n87YGpblxjyIxHKpwNv2NAfdsXHrkr16BMmDBoI K//76MvmgY2fL7+GMwzUeqmOjcsdDAXtsV/OK3qyjNPP5OzaHQ3hRfaSWjmEHU3UrHHq d9XRehfnvRvkCAautU9ST+5v9kmyoTQo4AYVFxwPS2IH5KmZSRHfpE7FoWSAEnThnWX7 JbkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=SOxPYNDZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x9-20020a63b349000000b004f26909ea46si12263152pgt.38.2023.02.13.06.57.06; Mon, 13 Feb 2023 06:57:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=SOxPYNDZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230464AbjBMOuh (ORCPT + 99 others); Mon, 13 Feb 2023 09:50:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230378AbjBMOuc (ORCPT ); Mon, 13 Feb 2023 09:50:32 -0500 Received: from mx0b-001ae601.pphosted.com (mx0a-001ae601.pphosted.com [67.231.149.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC8B11A96A for ; Mon, 13 Feb 2023 06:50:28 -0800 (PST) Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 31D5UX5E028354; Mon, 13 Feb 2023 08:50:14 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=PODMain02222019; bh=ea/rFFhINu/phNw7OHU5UmtWWEBCiXfiwatQeZgF6Vg=; b=SOxPYNDZFNUrzaVkKlZRZtxz523HSCLbevaahZ/tzQH+l/xe5xA7q5LncoK4dzjkmm2o UujSsWbLwiKkZJpDmo4YTC9gw2TDDa4EShF+8gRjwRhBbsLEE/03l4u/RqrPS5KR0rVZ 6bQPCKM4MCbP/SycEBbPmsvWh3/6EEFORpot6TvGmwi6gJidroVbWJhJpF76uQga5VOd iMQ4WMYZp0po6womMlIYNMk3Af+KngDWFXrhdumV4KRYa03eXkE8kxA/xSQTZfp9zMnx ZXUGcxmFGvU3i0dmDqlU7Fc/C4+6vOvLK/4L17G9/id+5U56JHQqd9AmkJrQ9QYA9klv Hg== Received: from ediex02.ad.cirrus.com ([84.19.233.68]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 3np9a72amh-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Feb 2023 08:50:14 -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_256_GCM_SHA384) id 15.2.1118.21; Mon, 13 Feb 2023 08:50:11 -0600 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.2.1118.21 via Frontend Transport; Mon, 13 Feb 2023 08:50:11 -0600 Received: from sbinding-cirrus-dsktp2.ad.cirrus.com (unknown [198.90.202.160]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 0FF69B0E; Mon, 13 Feb 2023 14:50:11 +0000 (UTC) From: Stefan Binding To: Jaroslav Kysela , Takashi Iwai CC: , , , Stefan Binding Subject: [PATCH v2 2/3] ALSA: hda: cs35l41: Ensure firmware/tuning pairs are always loaded Date: Mon, 13 Feb 2023 14:50:07 +0000 Message-ID: <20230213145008.1215849-3-sbinding@opensource.cirrus.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230213145008.1215849-1-sbinding@opensource.cirrus.com> References: <20230213145008.1215849-1-sbinding@opensource.cirrus.com> MIME-Version: 1.0 X-Proofpoint-GUID: 4OBsQf7bp4e6wQ_oYQPMR7uCXMz1H5mJ X-Proofpoint-ORIG-GUID: 4OBsQf7bp4e6wQ_oYQPMR7uCXMz1H5mJ X-Proofpoint-Spam-Reason: safe X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757728199402865869?= X-GMAIL-MSGID: =?utf-8?q?1757728199402865869?= To ensure firmware for cs35l41 is correctly running, it is necessary that a corresponding tuning file is also loaded. Without both, the firmware may not be performing correctly Ensure that if we load the firmware, we have also loaded the correct tuning file. Otherwise, fall back to default firmware and tuning. If default tuning is also missing, then disable DSP firmware. Signed-off-by: Stefan Binding --- sound/pci/hda/cs35l41_hda.c | 103 ++++++++++++++++++------------------ 1 file changed, 51 insertions(+), 52 deletions(-) diff --git a/sound/pci/hda/cs35l41_hda.c b/sound/pci/hda/cs35l41_hda.c index f7815ee24f83..1aad2604b9db 100644 --- a/sound/pci/hda/cs35l41_hda.c +++ b/sound/pci/hda/cs35l41_hda.c @@ -178,11 +178,10 @@ static int cs35l41_request_firmware_files_spkid(struct cs35l41_hda *cs35l41, cs35l41->speaker_id, "wmfw"); if (!ret) { /* try cirrus/part-dspN-fwtype-sub<-spkidN><-ampname>.bin */ - cs35l41_request_firmware_file(cs35l41, coeff_firmware, coeff_filename, - CS35L41_FIRMWARE_ROOT, - cs35l41->acpi_subsystem_id, cs35l41->amp_name, - cs35l41->speaker_id, "bin"); - return 0; + return cs35l41_request_firmware_file(cs35l41, coeff_firmware, coeff_filename, + CS35L41_FIRMWARE_ROOT, + cs35l41->acpi_subsystem_id, cs35l41->amp_name, + cs35l41->speaker_id, "bin"); } /* try cirrus/part-dspN-fwtype-sub<-ampname>.wmfw */ @@ -191,10 +190,10 @@ static int cs35l41_request_firmware_files_spkid(struct cs35l41_hda *cs35l41, cs35l41->amp_name, -1, "wmfw"); if (!ret) { /* try cirrus/part-dspN-fwtype-sub<-spkidN><-ampname>.bin */ - cs35l41_request_firmware_file(cs35l41, coeff_firmware, coeff_filename, - CS35L41_FIRMWARE_ROOT, cs35l41->acpi_subsystem_id, - cs35l41->amp_name, cs35l41->speaker_id, "bin"); - return 0; + return cs35l41_request_firmware_file(cs35l41, coeff_firmware, coeff_filename, + CS35L41_FIRMWARE_ROOT, + cs35l41->acpi_subsystem_id, cs35l41->amp_name, + cs35l41->speaker_id, "bin"); } /* try cirrus/part-dspN-fwtype-sub<-spkidN>.wmfw */ @@ -209,11 +208,10 @@ static int cs35l41_request_firmware_files_spkid(struct cs35l41_hda *cs35l41, cs35l41->amp_name, cs35l41->speaker_id, "bin"); if (ret) /* try cirrus/part-dspN-fwtype-sub<-spkidN>.bin */ - cs35l41_request_firmware_file(cs35l41, coeff_firmware, coeff_filename, - CS35L41_FIRMWARE_ROOT, - cs35l41->acpi_subsystem_id, - NULL, cs35l41->speaker_id, "bin"); - return 0; + return cs35l41_request_firmware_file(cs35l41, coeff_firmware, + coeff_filename, CS35L41_FIRMWARE_ROOT, + cs35l41->acpi_subsystem_id, NULL, + cs35l41->speaker_id, "bin"); } /* try cirrus/part-dspN-fwtype-sub.wmfw */ @@ -224,29 +222,16 @@ static int cs35l41_request_firmware_files_spkid(struct cs35l41_hda *cs35l41, /* try cirrus/part-dspN-fwtype-sub<-spkidN><-ampname>.bin */ ret = cs35l41_request_firmware_file(cs35l41, coeff_firmware, coeff_filename, CS35L41_FIRMWARE_ROOT, - cs35l41->acpi_subsystem_id, - cs35l41->amp_name, cs35l41->speaker_id, "bin"); + cs35l41->acpi_subsystem_id, cs35l41->amp_name, + cs35l41->speaker_id, "bin"); if (ret) /* try cirrus/part-dspN-fwtype-sub<-spkidN>.bin */ - cs35l41_request_firmware_file(cs35l41, coeff_firmware, coeff_filename, - CS35L41_FIRMWARE_ROOT, - cs35l41->acpi_subsystem_id, - NULL, cs35l41->speaker_id, "bin"); - return 0; - } - - /* fallback try cirrus/part-dspN-fwtype.wmfw */ - ret = cs35l41_request_firmware_file(cs35l41, wmfw_firmware, wmfw_filename, - CS35L41_FIRMWARE_ROOT, NULL, NULL, -1, "wmfw"); - if (!ret) { - /* fallback try cirrus/part-dspN-fwtype.bin */ - cs35l41_request_firmware_file(cs35l41, coeff_firmware, coeff_filename, - CS35L41_FIRMWARE_ROOT, NULL, NULL, -1, "bin"); - return 0; + return cs35l41_request_firmware_file(cs35l41, coeff_firmware, + coeff_filename, CS35L41_FIRMWARE_ROOT, + cs35l41->acpi_subsystem_id, NULL, + cs35l41->speaker_id, "bin"); } - dev_warn(cs35l41->dev, "Failed to request firmware\n"); - return ret; } @@ -258,9 +243,12 @@ static int cs35l41_request_firmware_files(struct cs35l41_hda *cs35l41, { int ret; - if (cs35l41->speaker_id > -1) - return cs35l41_request_firmware_files_spkid(cs35l41, wmfw_firmware, wmfw_filename, - coeff_firmware, coeff_filename); + if (cs35l41->speaker_id > -1) { + ret = cs35l41_request_firmware_files_spkid(cs35l41, wmfw_firmware, wmfw_filename, + coeff_firmware, coeff_filename); + goto out; + + } /* try cirrus/part-dspN-fwtype-sub<-ampname>.wmfw */ ret = cs35l41_request_firmware_file(cs35l41, wmfw_firmware, wmfw_filename, @@ -268,10 +256,11 @@ static int cs35l41_request_firmware_files(struct cs35l41_hda *cs35l41, cs35l41->amp_name, -1, "wmfw"); if (!ret) { /* try cirrus/part-dspN-fwtype-sub<-ampname>.bin */ - cs35l41_request_firmware_file(cs35l41, coeff_firmware, coeff_filename, - CS35L41_FIRMWARE_ROOT, cs35l41->acpi_subsystem_id, - cs35l41->amp_name, -1, "bin"); - return 0; + ret = cs35l41_request_firmware_file(cs35l41, coeff_firmware, coeff_filename, + CS35L41_FIRMWARE_ROOT, + cs35l41->acpi_subsystem_id, cs35l41->amp_name, + -1, "bin"); + goto out; } /* try cirrus/part-dspN-fwtype-sub.wmfw */ @@ -286,25 +275,35 @@ static int cs35l41_request_firmware_files(struct cs35l41_hda *cs35l41, cs35l41->amp_name, -1, "bin"); if (ret) /* try cirrus/part-dspN-fwtype-sub.bin */ - cs35l41_request_firmware_file(cs35l41, coeff_firmware, coeff_filename, - CS35L41_FIRMWARE_ROOT, - cs35l41->acpi_subsystem_id, - NULL, -1, "bin"); - return 0; + ret = cs35l41_request_firmware_file(cs35l41, coeff_firmware, coeff_filename, + CS35L41_FIRMWARE_ROOT, + cs35l41->acpi_subsystem_id, NULL, -1, + "bin"); } +out: + if (!ret) + return 0; + + /* Handle fallback */ + dev_warn(cs35l41->dev, "Falling back to default firmware.\n"); + + release_firmware(*wmfw_firmware); + kfree(*wmfw_filename); + /* fallback try cirrus/part-dspN-fwtype.wmfw */ ret = cs35l41_request_firmware_file(cs35l41, wmfw_firmware, wmfw_filename, CS35L41_FIRMWARE_ROOT, NULL, NULL, -1, "wmfw"); - if (!ret) { + if (!ret) /* fallback try cirrus/part-dspN-fwtype.bin */ - cs35l41_request_firmware_file(cs35l41, coeff_firmware, coeff_filename, - CS35L41_FIRMWARE_ROOT, NULL, NULL, -1, "bin"); - return 0; - } - - dev_warn(cs35l41->dev, "Failed to request firmware\n"); + ret = cs35l41_request_firmware_file(cs35l41, coeff_firmware, coeff_filename, + CS35L41_FIRMWARE_ROOT, NULL, NULL, -1, "bin"); + if (ret) { + release_firmware(*wmfw_firmware); + kfree(*wmfw_filename); + dev_warn(cs35l41->dev, "Unable to find firmware and tuning\n"); + } return ret; } From patchwork Mon Feb 13 14:50:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Binding X-Patchwork-Id: 56325 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2387914wrn; Mon, 13 Feb 2023 06:53:43 -0800 (PST) X-Google-Smtp-Source: AK7set+ZPUdTivIArcPEyp9nBHtoxbu/mOXW5OxaIhPdwVSyRsNk+ibsneP++XAzqoDf7/0MYp4p X-Received: by 2002:a17:906:3d32:b0:878:72f7:bd87 with SMTP id l18-20020a1709063d3200b0087872f7bd87mr24109444ejf.6.1676300023028; Mon, 13 Feb 2023 06:53:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676300023; cv=none; d=google.com; s=arc-20160816; b=cHiDULxW291X25/WrTiGfcO7BnaDCcut8qY6u5nb0Sjw3O4Qi+I9q+W9ki4SXQO2v0 lP+EJ81rnFU3kSB9d0MM5dSX6VCyIh03pcrpXek+fSgbV6S0yHbNrNlBjNUTrFoKMKGu RorSJ46OzSYQk2W3GikH2cxP2UVULPXLBwoO5cbS8Nl5IDP41aotZfNwe1wRIzqc0zPF 4CGVTGq8/jRuS5KQAyDIYrkMC+0+nokB+d9XnHSIyZ0hT7caFQs9ojMOw4YAgLqagmER 93w8S63YvwkfJZHZvR1IOxqLFi1JknXYZHww+YzCjDHehsKECLVJSz0/lqFVGTT9Sooh l0uQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=oivy1ExM1xF7alvWxcWK8c/YVtlPEJ4ySSrAjKcVL8k=; b=eg0dL1m1KkzTBHSlZAHSy7svqfN3GvTGKS2yBRGfJfH7ckW8yy+YZljiYh2TO8MI0N OddAeeUSJ3A12ep6tNJ/vuPgyNMXqJ78K48q6Zo2PFghhHxUY4rgg85SRzqYepASna4B LeVWJGyTlikHehpZkdVtlejN4TySnlJpalBRkLnwud7UXl+nUjZKjGVgB7VCbnjzTB8s OOlVimz+gtllv3/cUkyD5VcVRmnX1ZyFEVhK2xhoxI2uN6NSY7MpqUoafiTwUOt/LkCO NKFl7EGjn5n+/PZhTs/HnF5rHaIoQGd3Qi02R4wY3fdoJX6AViaN0dTix88L77QK7r3u nwXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=ZEnwis+P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gi20-20020a1709070c9400b0084f1fb57f55si12967260ejc.523.2023.02.13.06.53.20; Mon, 13 Feb 2023 06:53:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=ZEnwis+P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230429AbjBMOud (ORCPT + 99 others); Mon, 13 Feb 2023 09:50:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230449AbjBMOub (ORCPT ); Mon, 13 Feb 2023 09:50:31 -0500 Received: from mx0b-001ae601.pphosted.com (mx0a-001ae601.pphosted.com [67.231.149.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E5331BADE for ; Mon, 13 Feb 2023 06:50:27 -0800 (PST) Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 31D5v5Z4009266; Mon, 13 Feb 2023 08:50:13 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=PODMain02222019; bh=oivy1ExM1xF7alvWxcWK8c/YVtlPEJ4ySSrAjKcVL8k=; b=ZEnwis+PgHe1dt6LH9bRrs3KBRtKktsmN7jrVFpQYr/iQx7tVXWBruN5wi3XtDgSaLge mCMGGMeHqh1Af4cN/RK9sLEMiIHcsnZMA05v8Kden6kfsewVCBE5iV3PyhUGxfKIpyGk tUD0AoLZKucswQ8MlIBBSbFIItD+FlRkfHdyD0pQJGtJ92kakWZCDJeRCFtbSh9Siq1P z7Q6w7NMUFy84yhBoZpL3xo283yd2UOyVUxvkvBLYXVCZgNsFKMkfUPgt5FN46rIfRZq KWd+vY5fuWR9YOXPojWbZP+6ODdIz3j2OMRrMmGqoCblwFFNCjna+WP6udg3Kb1FctGM tA== Received: from ediex01.ad.cirrus.com ([84.19.233.68]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 3np9a72amk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Feb 2023 08:50:13 -0600 Received: from ediex02.ad.cirrus.com (198.61.84.81) by ediex01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.21; Mon, 13 Feb 2023 08:50:11 -0600 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by anon-ediex02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server id 15.2.1118.21 via Frontend Transport; Mon, 13 Feb 2023 08:50:11 -0600 Received: from sbinding-cirrus-dsktp2.ad.cirrus.com (unknown [198.90.202.160]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 2D40411AC; Mon, 13 Feb 2023 14:50:11 +0000 (UTC) From: Stefan Binding To: Jaroslav Kysela , Takashi Iwai CC: , , , Stefan Binding Subject: [PATCH v2 3/3] ALSA: hda: cs35l41: Enable Amp High Pass Filter Date: Mon, 13 Feb 2023 14:50:08 +0000 Message-ID: <20230213145008.1215849-4-sbinding@opensource.cirrus.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230213145008.1215849-1-sbinding@opensource.cirrus.com> References: <20230213145008.1215849-1-sbinding@opensource.cirrus.com> MIME-Version: 1.0 X-Proofpoint-GUID: URn604kHDUYiA19I5c0cEokfVJduXbxP X-Proofpoint-ORIG-GUID: URn604kHDUYiA19I5c0cEokfVJduXbxP X-Proofpoint-Spam-Reason: safe X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757727973102323245?= X-GMAIL-MSGID: =?utf-8?q?1757727973102323245?= This helps smooth out pops and clicks in the amps. Signed-off-by: Stefan Binding --- sound/pci/hda/cs35l41_hda.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sound/pci/hda/cs35l41_hda.c b/sound/pci/hda/cs35l41_hda.c index 1aad2604b9db..75020edd39e7 100644 --- a/sound/pci/hda/cs35l41_hda.c +++ b/sound/pci/hda/cs35l41_hda.c @@ -58,7 +58,7 @@ static const struct reg_sequence cs35l41_hda_config[] = { { CS35L41_DSP1_RX3_SRC, 0x00000018 }, // DSP1RX3 SRC = VMON { CS35L41_DSP1_RX4_SRC, 0x00000019 }, // DSP1RX4 SRC = IMON { CS35L41_DSP1_RX5_SRC, 0x00000020 }, // DSP1RX5 SRC = ERRVOL - { CS35L41_AMP_DIG_VOL_CTRL, 0x00000000 }, // AMP_VOL_PCM 0.0 dB + { CS35L41_AMP_DIG_VOL_CTRL, 0x00008000 }, // AMP_HPF_PCM_EN = 1, AMP_VOL_PCM 0.0 dB { CS35L41_AMP_GAIN_CTRL, 0x00000084 }, // AMP_GAIN_PCM 4.5 dB }; @@ -82,13 +82,13 @@ static const struct reg_sequence cs35l41_hda_config_dsp[] = { { CS35L41_DSP1_RX3_SRC, 0x00000018 }, // DSP1RX3 SRC = VMON { CS35L41_DSP1_RX4_SRC, 0x00000019 }, // DSP1RX4 SRC = IMON { CS35L41_DSP1_RX5_SRC, 0x00000029 }, // DSP1RX5 SRC = VBSTMON - { CS35L41_AMP_DIG_VOL_CTRL, 0x00000000 }, // AMP_VOL_PCM 0.0 dB + { CS35L41_AMP_DIG_VOL_CTRL, 0x00008000 }, // AMP_HPF_PCM_EN = 1, AMP_VOL_PCM 0.0 dB { CS35L41_AMP_GAIN_CTRL, 0x00000233 }, // AMP_GAIN_PCM = 17.5dB AMP_GAIN_PDM = 19.5dB }; static const struct reg_sequence cs35l41_hda_mute[] = { { CS35L41_AMP_GAIN_CTRL, 0x00000000 }, // AMP_GAIN_PCM 0.5 dB - { CS35L41_AMP_DIG_VOL_CTRL, 0x0000A678 }, // AMP_VOL_PCM Mute + { CS35L41_AMP_DIG_VOL_CTRL, 0x0000A678 }, // AMP_HPF_PCM_EN = 1, AMP_VOL_PCM Mute }; static void cs35l41_add_controls(struct cs35l41_hda *cs35l41)