From patchwork Thu Jun 1 15:47:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Fitzgerald X-Patchwork-Id: 10175 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp429794vqr; Thu, 1 Jun 2023 08:50:44 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6PnWDHmrUm1THlTbduiDnpFoCt94zza0rTo79FJkQ96Y72y0RGDgdLF8052Nuwu5OCsm3i X-Received: by 2002:a17:902:f54b:b0:1b0:5425:2165 with SMTP id h11-20020a170902f54b00b001b054252165mr7591462plf.29.1685634644074; Thu, 01 Jun 2023 08:50:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685634644; cv=none; d=google.com; s=arc-20160816; b=ydvrlNUOlAFvrWuKjUSbCfNTBKCj+lsSmaL3hn6MwmXtGqlXD1A2307EksGFf1CI7P 78xDHpWSKPbtljXkrNDpZD6A+MFiCGEKV81mHdgV12Frwy4FXAcfd7YWZel2EFYxmgUY FCQaiUU4qAkTYKSE5mg8ZZWjI+q/mVPhlodh2JeVpDRc/KKs0qs5YVz9QPXYZpg+ek6X NyCpyNE/Y+eAEvhL7aCb6sJqmwwJzf+R/hm7fINhQmR04Obhu++LAgxvOVGJS/i3E4Rm 3lUai+kyOwCkcjuqlrPDC4TvLnRdEvNf/BqlLG1BPeur1g4wWW7bLZ4sonEO0hKnxy2S 5GcQ== 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=bdWsE9aVcmlFMt82dUiPp2zt+xLfnmMuI7ekR9LlaWs=; b=aQiLiVMhf6dq217zRUrAbD/qeT4qDMMkvMXObOLbprK41Gp0zxbOKc9I9XxAhchfRm 8BYeeb1Zihzz+BDGNdxpCm32+sWP81GzbHATtRRBamWIKG2lNE/W+g99upSP83BZD0s3 esl87DVyF3S7NcS5J2tufyBGLDZOhti8I4EM9xvoLxy8h6WigOpZehZjV765JAYFaQcV 9ytLKzpIj6yvHuNAS8r8/y0+GnQ75Ge5/V6y3dvCQTjm0Cl9ukuKcdQxUpCXU4U4i2gc bpTTh5fn5E2fvjGlDP3kud9JdGbULswfxMpunaJLeG4Ooi/O74AXB1nPCh+PBRSqu2WZ o/hA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=SR1x4xhp; 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 c19-20020a170902c1d300b001a80ddd372csi34288plc.43.2023.06.01.08.50.31; Thu, 01 Jun 2023 08:50:44 -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=SR1x4xhp; 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 S234961AbjFAPsS (ORCPT + 99 others); Thu, 1 Jun 2023 11:48:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233607AbjFAPr4 (ORCPT ); Thu, 1 Jun 2023 11:47:56 -0400 Received: from mx0b-001ae601.pphosted.com (mx0b-001ae601.pphosted.com [67.231.152.168]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E164413D for ; Thu, 1 Jun 2023 08:47:53 -0700 (PDT) Received: from pps.filterd (m0077474.ppops.net [127.0.0.1]) by mx0b-001ae601.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3515TBgv016524; Thu, 1 Jun 2023 10:47:33 -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=bdWsE9aVcmlFMt82dUiPp2zt+xLfnmMuI7ekR9LlaWs=; b=SR1x4xhpDx3tVuwOtdtGYIT5lFVZp22J1/KKtHmwPNXQO7rX+i7GgMcdavKZGjRuk27W ephmVJys/HsnkC8vqEnmC3i3Yckd1p2MoY3b/FAhFVxlFp2NnVp+ow5izI7h16s+GSo0 0DoNIr5IPAUjWv4CuW38NCl1zQAhmwizPODq87ZBUV6r8KZpeCzDqv/2PKi/PSztiJ8n VLEf/We9fLXrnGWlLflYk7hjpYttIwZOQX9SCD3DXk88UNTwpfV6KB4yF2+pYNnOXGou bVjiWHSFs9kwF7Wk2JTSEshk1PsFKSODrZ6R5w9HNRqYMh/Fl+zPwmKSsU4ECRoVBplP FA== Received: from ediex02.ad.cirrus.com ([84.19.233.68]) by mx0b-001ae601.pphosted.com (PPS) with ESMTPS id 3que9mxjyq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 01 Jun 2023 10:47:32 -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_256_GCM_SHA384) id 15.2.1118.26; Thu, 1 Jun 2023 16:47:31 +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.2.1118.26 via Frontend Transport; Thu, 1 Jun 2023 16:47:31 +0100 Received: from edi-sw-dsktp-006.ad.cirrus.com (edi-sw-dsktp-006.ad.cirrus.com [198.90.251.127]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 38F0F468; Thu, 1 Jun 2023 15:47:31 +0000 (UTC) From: Richard Fitzgerald To: , , CC: , , , Richard Fitzgerald Subject: [PATCH v4 00/12] ALSA: hda: Adding support for CS35L56 on HDA systems Date: Thu, 1 Jun 2023 16:47:19 +0100 Message-ID: <20230601154731.3210572-1-rf@opensource.cirrus.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Proofpoint-GUID: q69MXZHl7QbP0KtaKI9fm4YYM2UcAGtl X-Proofpoint-ORIG-GUID: q69MXZHl7QbP0KtaKI9fm4YYM2UcAGtl 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, 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767516032906770441?= X-GMAIL-MSGID: =?utf-8?q?1767516032906770441?= This set of patches adds support for using the CS35L56 boosted smart amplifier on HDA systems. In these systems the CS35L56 audio is routed through a HDA-to-I2S bridge codec. This doesn't include the changes to the Realtek driver to actually hook up the CS35L56 driver, because we don't yet have the QUIRK IDs to associate it with. But we want to publish the driver now so that it is available for bringing up hardware with the CS35L56. The first 9 patches are moving code out of the ASoC driver and into the shared library so that it can be shared with the HDA driver. Patch #10 fixes missing #includes in the HDA headers so that the CS35L56 driver doesn't have to #include headers that it doesn't use. Finally, #11 and #12 actually add the support for CS35L56 on HDA. CHANGES SINCE V3 Patch 01: - Fix double-free of IRQ caused by passing wrong cookie to devm_irq_free() Patch 12: - Fix memory leak of struct firmware object and firmware name strings. - Find and open firmware files before taking the irq_lock mutex and pm_runtime. - Don't bother executing the firmware loading code if no firmware files were found. Richard Fitzgerald (4): ASoC: cs35l56: Move runtime suspend/resume to shared library ASoC: cs35l56: Move cs_dsp init into shared library ASoC: cs35l56: Move part of cs35l56_init() to shared library ALSA: hda: Fix missing header dependencies Simon Trimmer (8): ASoC: cs35l56: Move shared data into a common data structure ASoC: cs35l56: Make cs35l56_system_reset() code more generic ASoC: cs35l56: Convert utility functions to use common data structure ASoC: cs35l56: Move utility functions to shared file ASoC: cs35l56: Make common function for control port wait ASoC: cs35l56: Make a common function to shutdown the DSP ALSA: hda: Add mute_hook to hda_component ALSA: hda/cs35l56: Add driver for Cirrus Logic CS35L56 amplifier include/sound/cs35l56.h | 29 +- sound/pci/hda/Kconfig | 31 + sound/pci/hda/Makefile | 6 + sound/pci/hda/cs35l56_hda.c | 1010 +++++++++++++++++++++++++++++ sound/pci/hda/cs35l56_hda.h | 48 ++ sound/pci/hda/cs35l56_hda_i2c.c | 69 ++ sound/pci/hda/cs35l56_hda_spi.c | 68 ++ sound/pci/hda/hda_auto_parser.h | 2 + sound/pci/hda/hda_component.h | 1 + sound/pci/hda/hda_generic.h | 3 + sound/soc/codecs/cs35l56-i2c.c | 14 +- sound/soc/codecs/cs35l56-sdw.c | 72 +- sound/soc/codecs/cs35l56-shared.c | 459 ++++++++++++- sound/soc/codecs/cs35l56-spi.c | 10 +- sound/soc/codecs/cs35l56.c | 648 ++++-------------- sound/soc/codecs/cs35l56.h | 15 +- 16 files changed, 1893 insertions(+), 592 deletions(-) create mode 100644 sound/pci/hda/cs35l56_hda.c create mode 100644 sound/pci/hda/cs35l56_hda.h create mode 100644 sound/pci/hda/cs35l56_hda_i2c.c create mode 100644 sound/pci/hda/cs35l56_hda_spi.c Reviewed-by: Takashi Iwai