Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp33044iog; Wed, 29 Jun 2022 17:26:14 -0700 (PDT) X-Google-Smtp-Source: AGRyM1ssFenqS8JhJ/kwZAmPYle7F00ywwlGyRoqi9OIRTjN1KMlCcMLhKLZ15R6SMLMFGuUQhJm X-Received: by 2002:a63:6a85:0:b0:3fa:722a:fbdc with SMTP id f127-20020a636a85000000b003fa722afbdcmr5187050pgc.174.1656548774189; Wed, 29 Jun 2022 17:26:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656548774; cv=none; d=google.com; s=arc-20160816; b=zQLeheC2pOjFAgeXflq8QmhpthXsCtlB6WNZ9SzOW95sjuKvW/ydwAErJlTotrm7gX Cyh8NBl8mhb3gHiEeC8rVZplPNTBquZ+33o6rJoRdxVhRoWKfuDkPEl7CgmgNpbt79gb H53+XUq6GlzHXTl6Xx2m+3sG6Dj7Xrd1qHy6aA1ZVavNTR+3XlGNna60/TWs62DJuqjf G0lPHbOnoT6iRtuPpmPdCHl0E5mydKwb46ZlZIjkNVLET3s+tG+NSsb5VFe2QTRb8gof tBjwyCLA85gwqead1d0Td9yaYG5mLU6+QgFyOQdN8+7gyJGALhFTdE3mnRM+9Yuo9yn0 EFpA== 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=oUm9OGlO8y2JiDbD8O6kuDzqGt+w9zxkAJ1wrpdYSTE=; b=uOHjpsUYgVVy/CDTH7Ay6QeIU+js2qGZv9iOMMmU8k1Ldxi0JJUXr4AzQDBy7WsyiZ GF3cyPOExJZ1pws6RL67qV8PUoYVcb0NyH52pgZ0zyitUmdAvsUQMgGlIU15ZOM2cL89 3oC3qHm5QZ0AxwOpdpadGGyPyRYWUhUwrQthwoE/3UI008F4WDexddMJEMnaxZan5quu dL9FauwfnJKVRNYBiNUlO4PTc/Ph3TfFgRdYgVzmWwTtIB/bIRdeACRAAtgscwL2Wj0g HNYrSEiN+c3fvXWu/SJvdWIAl/lMTGdgSbhtenuBIfnRRxNBMoSp82S9ShJQb3X5LOVn aAqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=mKbG3Wna; 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 a14-20020a170902ecce00b00163be809240si28951705plh.302.2022.06.29.17.25.58; Wed, 29 Jun 2022 17:26:14 -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=mKbG3Wna; 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 S231152AbiF3AYy (ORCPT + 99 others); Wed, 29 Jun 2022 20:24:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231207AbiF3AYq (ORCPT ); Wed, 29 Jun 2022 20:24:46 -0400 Received: from mx0b-001ae601.pphosted.com (mx0b-001ae601.pphosted.com [67.231.152.168]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F242A22B37 for ; Wed, 29 Jun 2022 17:24:36 -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 25TNvJvG021960; Wed, 29 Jun 2022 19:23:38 -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=oUm9OGlO8y2JiDbD8O6kuDzqGt+w9zxkAJ1wrpdYSTE=; b=mKbG3WnatP+SDRHfpkOBOtQvrmYPzimrfCYk8jqsFfMjiJ2k+Zx5wCS8HepLc806NSgn UVZbh0Jub7pwNPj79PKvcDUTxC2rN/NH3HIV7iMvXu+CPMnkY6LCk/OhLDyqSCXyLRHv LDKUgDRAOyG5BLbojcQ9+3AnhN6Q6/ysR9PFO0o0XSW4a4HklN+DVUV9sMYXLNOPDRBo R4UYmff4iAF72XArRlcz+gPOU5pBVIIjJoNe05MEJ4Uwcr4v7/7RjhOh5JXCcUW3I07W vHpGbinyFsZ8wg+0MTDj1uY+i7tGjcF/Zv9gtQ4GFR4LkCXVx/qBqbwziMtJWOn7PE5/ nw== Received: from ediex02.ad.cirrus.com ([84.19.233.68]) by mx0b-001ae601.pphosted.com (PPS) with ESMTPS id 3gwxsq5vf7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Wed, 29 Jun 2022 19:23:37 -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; Thu, 30 Jun 2022 01:23:36 +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; Thu, 30 Jun 2022 01:23:36 +0100 Received: from vitaly-Legion-7-16ACHg6.ad.cirrus.com (unknown [198.90.238.125]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 1958C2A9; Thu, 30 Jun 2022 00:23:36 +0000 (UTC) From: Vitaly Rodionov To: Jaroslav Kysela , Takashi Iwai , Mark Brown CC: , , Subject: [PATCH v8 00/14] ALSA: hda: cirrus: Add initial DSP support and firmware loading Date: Thu, 30 Jun 2022 01:23:21 +0100 Message-ID: <20220630002335.366545-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: iahNl7avNbhLrGyp8oKGLWE2L7bk4rXM X-Proofpoint-ORIG-GUID: iahNl7avNbhLrGyp8oKGLWE2L7bk4rXM 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 v7: - Use private_data rather than private_value to save control info - Clean up alsa control memory allocation/deallocation - Remove unnecessary whitespace - Get subsystem id from codec, rather than saving it separately 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 | 883 +++++++++++++++++++++++++++++++- 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 | 3 + sound/pci/hda/hda_cs_dsp_ctl.c | 240 +++++++++ sound/pci/hda/hda_cs_dsp_ctl.h | 39 ++ sound/pci/hda/patch_realtek.c | 26 +- 12 files changed, 1242 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