Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp4557880iog; Wed, 22 Jun 2022 00:53:09 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sp26nmFoDqcaarIps/uLvVQHzS6eDf4N2o/CNhQpboyr4eJWOLt5iIuemjgiOM2AmHb7B5 X-Received: by 2002:a63:5d19:0:b0:3ff:124a:e8e9 with SMTP id r25-20020a635d19000000b003ff124ae8e9mr1887056pgb.218.1655884388830; Wed, 22 Jun 2022 00:53:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655884388; cv=none; d=google.com; s=arc-20160816; b=Pv0w2jI6DThb4OFBAcFv15JPZu8thnNPK5v4xgMB+S1VA5idMTVKhdZqz1ndBnU55w k2UUXR77UwdcxXjI5ey0gFUjGlbTys0VsMBfeVRpw8f0sjtw9iKeCHGAy4G7xM3iBZE5 72ErsO0bUcu0IGW2nCzs+mEDhKbDK841RcnESL1AjlsIatVNkLnmYS1mpK8RGDzkfQap xSFksqDXIJylnL5FyeZ6auZjoTDwBMafj32dnsUfw2iJb8kj/OFZA/7xWA5nPfM9xDe/ vas7BSzw9RRuHeRmLsao8QUmkJUQ4NvUXcWNAHCxuJMUbHrBW2bOCNElzweHVrgSKgXK futg== 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=CE7gxifsr4Seb0CXxAGhIfMAwUpSDzxQRst/+XOZ65E=; b=N9A6map+aNBPywD1DVzjdnp31Rcao8c4DWrCWvz5KpXxCqkUTHmy+kL5eV/1kklek1 VspEfMHkE0rZHO5jnCzdrxgUEOEmv6woVJ1DRHB2BVDjK2J8iRsydkiqS2SV0e/qC26u GCUuNsU29WerjAF9U6LTtUcLlZAjCoMgeRyARxM2/91eIYEntwm8EomBVb1s08HxMiGE LqDu0F4NK74WO2GH5O2wXgBDOxvS2QawZJrSreaZ/3ViFjPta2P0qeE4ansSrImQx2Gd NFE3TJModtWzzrDlwDEqdcZLXuCs22SKqVMftRjBWgieyeEbE45vQUx3vyaXGN6LpYjw dkXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=lJkocT8H; 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 u29-20020a63141d000000b003ab2440ce56si19540252pgl.207.2022.06.22.00.52.56; Wed, 22 Jun 2022 00:53:08 -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=lJkocT8H; 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 S243496AbiFVHse (ORCPT + 99 others); Wed, 22 Jun 2022 03:48:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354214AbiFVHrx (ORCPT ); Wed, 22 Jun 2022 03:47:53 -0400 Received: from mx0b-001ae601.pphosted.com (mx0b-001ae601.pphosted.com [67.231.152.168]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0F0A37A18 for ; Wed, 22 Jun 2022 00:47:43 -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 25M6wRdh014511; Wed, 22 Jun 2022 02:46:55 -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=CE7gxifsr4Seb0CXxAGhIfMAwUpSDzxQRst/+XOZ65E=; b=lJkocT8H33FK/5nYnRPekMb3K+EShj6o74DMsIIpOfUrxzH3JdNVty3q7Ms5R2lKx9xd r5zlxMdDMVLlSdYdmQU8VxF38MKGRaOjGI6aBEbMtqd+vHpr60/ekgOJPtGs4pkak+qU L7iTcPvgiXhLbWE9f6PvvPlnQBbrACPRPxFBX1rNicfFoKnpfgW9dghqKeWubIoFHKnQ QqvPZbuVUF2ynyicGOcmy1CXma8sDRPZ8wz+MeY8PJEL9gu4W7jSXJk1KJoUghNDWU7g 5cqjutZUdmW3mVGPUhpnsLa16KTBlgx3svPXarQ7JkppRiV8ZTDGWgmi1oc+oorm7+f5 yA== Received: from ediex02.ad.cirrus.com ([84.19.233.68]) by mx0b-001ae601.pphosted.com (PPS) with ESMTPS id 3gsb4p4mwn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Wed, 22 Jun 2022 02:46:55 -0500 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.2375.28; Wed, 22 Jun 2022 08:46:53 +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; Wed, 22 Jun 2022 08:46:53 +0100 Received: from vitaly-Legion-7-16ACHg6.ad.cirrus.com (unknown [198.90.238.175]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 8996C478; Wed, 22 Jun 2022 07:46:53 +0000 (UTC) From: Vitaly Rodionov To: Jaroslav Kysela , Takashi Iwai , Mark Brown CC: , , Subject: [PATCH v7 00/14] ALSA: hda: cirrus: Add initial DSP support and firmware loading Date: Wed, 22 Jun 2022 08:46:39 +0100 Message-ID: <20220622074653.179078-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: yRwtg84S-g9MoYpCrfrOB9TNsuZgFbBA X-Proofpoint-ORIG-GUID: yRwtg84S-g9MoYpCrfrOB9TNsuZgFbBA 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 v6: - Fix warning by kernel test robot 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