Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp4212483iog; Tue, 21 Jun 2022 14:40:22 -0700 (PDT) X-Google-Smtp-Source: AGRyM1siiIDyW5/EAhcYRebZ+QJbiX+3wjvNQI4iZ46amCDJiYjS1MePu4VoDjyrjyvEXArpHeuN X-Received: by 2002:aa7:c952:0:b0:434:edcc:f247 with SMTP id h18-20020aa7c952000000b00434edccf247mr178431edt.412.1655847621900; Tue, 21 Jun 2022 14:40:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655847621; cv=none; d=google.com; s=arc-20160816; b=ir+/YmzW7XlHPmJ2Q6cWkAs0YZ9NmN5E6+V3SmBt0Q7YGgNNgSTJbHqXGkhnJF2lQ6 RXb2YSZvidNT/sTZKa3P3V3pj8BzQS7PD9FMHNt7VDeG/WbapF1ahJX/zJ8LXMvhP8Xy yqyKbdnaarDsTJQlvEJurOWGoTaN681AQKJYvvlUf4DQ7MJDKkJS/CjNurqq9ZFVO1SP +YwgAu+uL3GmjbPaE+H/+zz5+kYVaxbTcbq+eTHo0dK3AlsVke0w2+cav1txyAgTsvqb jPHt3z63Sf5VjiEnskv4W5vbFxDbc3iYuSh07i0yCydlYjDYY4CrO48yZrvbzZ6k482m bZ1Q== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=hG2O0Ae/l3SL3nlV1NIEggjHFsZlf5b9gTGrlsyn3l4=; b=hEvZxN9qRP9SJ2FqYjj0nQGRYOu/I3HELP3DSHRj3RYXWtdxI+Sy0oFNme1glglWfH vQm6+SzRAKDHkOJ2Kna9g67toAFuZFrk2yZryl30V3yV098G2vzgHj3l5EBhPQh4k+tX n1HrHSHQ8IQBBzFbtledjYmH5u8lM5GaqcIkZorQEXeAdNakvzlSKZ7tiCwoTm+w/dX+ 4OmDAX0gupnDR6/ZG9kS4uQm0SuHrmGeRY89exDxpg7BAiU/SoZxcldPJb+tGtn+gFYv LAkfYD1p6Cnxnlz0cIRG8fDZ4cBX53FMeGglJW7GcvM/gKKs+xD7IWFtuQDacK3KDJjs Ns1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=Bu4ooekZ; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o3-20020aa7c503000000b0043560f82427si14271318edq.617.2022.06.21.14.39.56; Tue, 21 Jun 2022 14:40:21 -0700 (PDT) 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=Bu4ooekZ; 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 S1355902AbiFUViu (ORCPT + 99 others); Tue, 21 Jun 2022 17:38:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354116AbiFUViZ (ORCPT ); Tue, 21 Jun 2022 17:38:25 -0400 Received: from mx0b-001ae601.pphosted.com (mx0b-001ae601.pphosted.com [67.231.152.168]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A6A011A23 for ; Tue, 21 Jun 2022 14:38:24 -0700 (PDT) Received: from pps.filterd (m0077474.ppops.net [127.0.0.1]) by mx0b-001ae601.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 25LBDkxR018841; Tue, 21 Jun 2022 16:38:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=PODMain02222019; bh=hG2O0Ae/l3SL3nlV1NIEggjHFsZlf5b9gTGrlsyn3l4=; b=Bu4ooekZl5jJQknOn9U7PDN8QoGfuFsQt3hRGQv6Uh4YtxW+5sAn7KGuBVYL23/XgENA qEBtaIAA6FPrH7tBJSvx+tnKK50UU64nqnkI3s6uPn9DrzhDtRb6evMdKiFfmLW51Rpz s/tj40mf6hr53+ZboK0GfCm1bzC4wcOVl0F0IdJvVeF+LOgFzQGDiVqu6IaMYKPLiy0J +JGre7pfZ8sOqy9iHMrwB3oKmQxblaoIEqUlyfkRgZhAScgZXgOZ3dj+oIuWISUFdF45 sJOj7VHKaaySIcGlGyV+S1xUC/IJk7OsFpkx+jxVYW2rcO0fNs0F4gzrl/I8VfJIt0C2 VQ== Received: from ediex01.ad.cirrus.com ([84.19.233.68]) by mx0b-001ae601.pphosted.com (PPS) with ESMTPS id 3gsb4p45ae-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Tue, 21 Jun 2022 16:38:03 -0500 Received: from EDIEX01.ad.cirrus.com (198.61.84.80) by EDIEX01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Tue, 21 Jun 2022 22:38:01 +0100 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.2375.28 via Frontend Transport; Tue, 21 Jun 2022 22:38:01 +0100 Received: from vitaly-Legion-7-16ACHg6.ad.cirrus.com (unknown [198.90.238.175]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id A4CDE7C; Tue, 21 Jun 2022 21:38:01 +0000 (UTC) From: Vitaly Rodionov To: Jaroslav Kysela , Takashi Iwai , Mark Brown CC: , , Subject: [PATCH v6 00/14] ALSA: hda: cirrus: Add initial DSP support and firmware loading Date: Tue, 21 Jun 2022 22:37:47 +0100 Message-ID: <20220621213801.2021097-1-vitalyr@opensource.cirrus.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: gG0iVWVAeW7MjEtaGc-yHvIAM3QJCkHe X-Proofpoint-ORIG-GUID: gG0iVWVAeW7MjEtaGc-yHvIAM3QJCkHe X-Proofpoint-Spam-Reason: safe X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 The CS35L41 Amplifier contains a DSP, capable of running firmware. The firmware can run algorithms such as Speaker Protection, to ensure that playback at high gains do not harm the speakers. Adding support for CS35L41 firmware into the CS35L41 HDA driver also allows us to support several extra features, such as hiberation and interrupts. The chain adds support in stages: - General fixes to improve generalization and code re-use inside the CS35L41 HDA driver. - Add support for interrupts into the driver, which is required for complete support of the firmware. - Refactor ASoC CS35L41 code which deals with firmware to allow for code re-use inside the CS35L41 HDA driver. - Add support for loading firmware and tuning files from file system, and creating alsa controls to control it. - Support firmware load paths for different hardware systems. - Support suspend/resume in the driver when using firmware. The firmware supports hibernation, which allows the CS35L41 to drop into a low power mode during suspend. - Support the ability to unload firmware, swap and reload the firmware. This is to allow different firmware to run during calibration. The intended use-case is to load the firmware once on boot, and the driver autmatically tries to load the firmware after it binds to the HDA driver. This behaviour can be switched off using a kconfig, if desired. changes since v5: - Fix warning by kernel test robot changes since v4: - Fully remove tlv remnants from control add apis - Remove unnecessary debug - Rename variable to be more generic - Remove redundent length check from read/write control apis - Use SNDRV_CTL_ELEM_IFACE_CARD for firmware load controls - Make kcontrol add/remove synchronous - Load firmware asynchronous when loading via control - Used cached controls when reloading firmware; only delete controls when removing the driver itself - Improve kcontrol remove - Fix control write + notify - Cleanup of unnecessary code - Fix race condition when loading firmware before playback - Ensure errors are properly propogated - Fix include for Module parameters Stefan Binding (13): ALSA: hda: hda_cs_dsp_ctl: Add Library to support CS_DSP ALSA controls ALSA: hda: hda_cs_dsp_ctl: Add apis to write the controls directly ALSA: hda: cs35l41: Save codec object inside component struct ALSA: hda: cs35l41: Save Subsystem ID inside CS35L41 Driver ALSA: hda: cs35l41: Support reading subsystem id from ACPI ALSA: hda: cs35l41: Support multiple load paths for firmware ALSA: hda: cs35l41: Support Speaker ID for laptops ALSA: hda: cs35l41: Support Hibernation during Suspend ALSA: hda: cs35l41: Read Speaker Calibration data from UEFI variables ALSA: hda: hda_cs_dsp_ctl: Add fw id strings ALSA: hda: cs35l41: Add defaulted values into dsp bypass config sequence ALSA: hda: cs35l41: Support Firmware switching and reloading ALSA: hda: cs35l41: Add module parameter to control firmware load Vitaly Rodionov (1): ALSA: hda: cs35l41: Add initial DSP support and firmware loading MAINTAINERS | 1 + include/sound/cs35l41.h | 4 + sound/pci/hda/Kconfig | 8 + sound/pci/hda/Makefile | 2 + sound/pci/hda/cs35l41_hda.c | 902 +++++++++++++++++++++++++++++++- sound/pci/hda/cs35l41_hda.h | 39 ++ sound/pci/hda/cs35l41_hda_i2c.c | 1 + sound/pci/hda/cs35l41_hda_spi.c | 1 + sound/pci/hda/hda_component.h | 4 + sound/pci/hda/hda_cs_dsp_ctl.c | 254 +++++++++ sound/pci/hda/hda_cs_dsp_ctl.h | 39 ++ sound/pci/hda/patch_realtek.c | 27 +- 12 files changed, 1277 insertions(+), 5 deletions(-) create mode 100644 sound/pci/hda/hda_cs_dsp_ctl.c create mode 100644 sound/pci/hda/hda_cs_dsp_ctl.h -- 2.34.1