From patchwork Thu May 3 21:42:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Connor McAdams X-Patchwork-Id: 10379315 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BFC286037D for ; Thu, 3 May 2018 21:43:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AF6A429149 for ; Thu, 3 May 2018 21:43:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A43D029156; Thu, 3 May 2018 21:43:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9BA8129149 for ; Thu, 3 May 2018 21:43:21 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 9DBEC267235; Thu, 3 May 2018 23:43:17 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id E9797267265; Thu, 3 May 2018 23:43:15 +0200 (CEST) Received: from mail-io0-f196.google.com (mail-io0-f196.google.com [209.85.223.196]) by alsa0.perex.cz (Postfix) with ESMTP id 60C88266C1C for ; Thu, 3 May 2018 23:43:13 +0200 (CEST) Received: by mail-io0-f196.google.com with SMTP id t23-v6so23389623ioc.10 for ; Thu, 03 May 2018 14:43:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=LAhk/YczQuunxXn446ZnNEHSY1AXl0acpcAo+JR2fRU=; b=intQ4LiqrgpKhbW8DV7nBj8ABxyns499vHkqsetqXKulcJQt42mRXK/cK/hG4M+TsG KJ6sQBkneOaMzwRTVrXneUC0v4beI9wGO39iHD7RsdbQy1w0LPILrqbqGZZ1K87jyDY5 uTOqpVKvsF1IGVnTIrOTR85D7a+vVCQnx+LzCxoTi3Nv/CQgOaBDTRIm2drTh+FTuDy8 77MQWa2EJr6X7QnrKi6EscvI9F/JX0hkwTF2J7z1/47SIGyv9vH0OyW9XIS44rJdiOIO +orberMRJRX1Lje/3qAddBat0UMYEd8ApDwo/pyvLe/cWuXjBkNvy/8SNUBgGGGqZn8C DnyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=LAhk/YczQuunxXn446ZnNEHSY1AXl0acpcAo+JR2fRU=; b=Lv1UpLuv2N3z1KcZLSmb5kMLlKP1XXd3ylzcQPKCrVTt7XhryDuHTEztIVsK4lxGzJ YfsnHKqy6VJcOzeuXKSRkqf5Kd3XizXQQ5g2mRLCKp8a+jIZxr+s6sAoXA/YqMGR0wcG z9qs8gDEuoFXq5Tgt8Ko3MpwnZLzsjk2RfvqUrJdxjHpPXOsKy6I+bliPXk/dVGLg0XR nMFce14T3O+jDJ+Bm64vDAki2dN9LNFdHtG53mJBnIg9/XDaFv7twf/fc4qh33XUZuz0 4QeAlqVk8H8IvI1KmMAUnU/oQ1xVjmYii4jz8IEGlh9i63E5JsmmMMQswKisugoDdNJ2 Zh7Q== X-Gm-Message-State: ALQs6tCcRQ0cSBXPGZSVD8GkvGu6m/WishXHToGBF2f1/oqj10i8bayy Bx7xrmtgU86V/CWCe1ZeDaY= X-Google-Smtp-Source: AB8JxZqMMyTyfwXjva8QwzZ/62EV2FynelGoF+27ZvcYTFKi3O6wTrZb+2nndqwzbff39sghyzrueQ== X-Received: by 2002:a6b:3288:: with SMTP id y130-v6mr26419255ioy.287.1525383791834; Thu, 03 May 2018 14:43:11 -0700 (PDT) Received: from localhost.localdomain ([2605:a000:1316:4462:30e7:9a4b:7da5:3c1c]) by smtp.googlemail.com with ESMTPSA id u77-v6sm263119ita.30.2018.05.03.14.43.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 03 May 2018 14:43:11 -0700 (PDT) From: Connor McAdams To: Date: Thu, 3 May 2018 17:42:42 -0400 Message-Id: <1525383771-11105-1-git-send-email-conmanx360@gmail.com> X-Mailer: git-send-email 2.7.4 Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Takashi Iwai , =?UTF-8?q?J=C3=A9r=C3=A9my=20Lefaure?= , Connor McAdams , o-takashi@sakamocchi.jp Subject: [alsa-devel] [PATCH 1/9] R3Di and SBZ quirk entires + alt firmware loading X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds PCI quirk ID's for the Sound Blaster Z and Recon3Di. Only the currently tested ID's have been added. This patch also adds the ability to load alternative firmwares for each card, the firmwares can be obtained from within the Windows driver. The Recon3Di uses "ctefx-r3di.bin" and the Sound Blaster Z uses "ctefx-sbz.bin". If the alternative firmware for the given quirk is not found, the original ctefx.bin will be used. This has been confirmed to work for both the R3Di and the SBZ. This patch also makes the character array *dirstr a const. Signed-off-by: Connor McAdams --- sound/pci/hda/patch_ca0132.c | 55 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 51 insertions(+), 4 deletions(-) diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c index 768ea86..9a0286e 100644 --- a/sound/pci/hda/patch_ca0132.c +++ b/sound/pci/hda/patch_ca0132.c @@ -72,12 +72,16 @@ #define SCP_GET 1 #define EFX_FILE "ctefx.bin" +#define SBZ_EFX_FILE "ctefx-sbz.bin" +#define R3DI_EFX_FILE "ctefx-r3di.bin" #ifdef CONFIG_SND_HDA_CODEC_CA0132_DSP MODULE_FIRMWARE(EFX_FILE); +MODULE_FIRMWARE(SBZ_EFX_FILE); +MODULE_FIRMWARE(R3DI_EFX_FILE); #endif -static char *dirstr[2] = { "Playback", "Capture" }; +static const char *dirstr[2] = { "Playback", "Capture" }; enum { SPEAKER_OUT, @@ -734,6 +738,7 @@ struct ca0132_spec { unsigned int scp_resp_header; unsigned int scp_resp_data[4]; unsigned int scp_resp_count; + bool alt_firmware_present; /* mixer and effects related */ unsigned char dmic_ctl; @@ -762,6 +767,8 @@ struct ca0132_spec { enum { QUIRK_NONE, QUIRK_ALIENWARE, + QUIRK_SBZ, + QUIRK_R3DI, }; static const struct hda_pintbl alienware_pincfgs[] = { @@ -782,6 +789,10 @@ static const struct snd_pci_quirk ca0132_quirks[] = { SND_PCI_QUIRK(0x1028, 0x0685, "Alienware 15 2015", QUIRK_ALIENWARE), SND_PCI_QUIRK(0x1028, 0x0688, "Alienware 17 2015", QUIRK_ALIENWARE), SND_PCI_QUIRK(0x1028, 0x0708, "Alienware 15 R2 2016", QUIRK_ALIENWARE), + SND_PCI_QUIRK(0x1102, 0x0010, "Sound Blaster Z", QUIRK_SBZ), + SND_PCI_QUIRK(0x1102, 0x0023, "Sound Blaster Z", QUIRK_SBZ), + SND_PCI_QUIRK(0x1458, 0xA016, "Recon3Di", QUIRK_R3DI), + SND_PCI_QUIRK(0x1458, 0xA036, "Recon3Di", QUIRK_R3DI), {} }; @@ -4370,11 +4381,47 @@ static void ca0132_set_dsp_msr(struct hda_codec *codec, bool is96k) static bool ca0132_download_dsp_images(struct hda_codec *codec) { bool dsp_loaded = false; + struct ca0132_spec *spec = codec->spec; const struct dsp_image_seg *dsp_os_image; const struct firmware *fw_entry; - - if (request_firmware(&fw_entry, EFX_FILE, codec->card->dev) != 0) - return false; + /* + * Alternate firmwares for different variants. The Recon3Di apparently + * can use the default firmware, but I'll leave the option in case + * it needs it again. + */ + switch (spec->quirk) { + case QUIRK_SBZ: + if (request_firmware(&fw_entry, SBZ_EFX_FILE, + codec->card->dev) != 0) { + codec_dbg(codec, "SBZ alt firmware not detected. "); + spec->alt_firmware_present = false; + } else { + codec_dbg(codec, "Sound Blaster Z firmware selected."); + spec->alt_firmware_present = true; + } + break; + case QUIRK_R3DI: + if (request_firmware(&fw_entry, R3DI_EFX_FILE, + codec->card->dev) != 0) { + codec_dbg(codec, "Recon3Di alt firmware not detected."); + spec->alt_firmware_present = false; + } else { + codec_dbg(codec, "Recon3Di firmware selected."); + spec->alt_firmware_present = true; + } + break; + default: + spec->alt_firmware_present = false; + break; + } + /* Use default ctefx.bin if no alt firmware is detected, or if none + * exists for your particular codec. + */ + if (spec->alt_firmware_present == false) { + codec_dbg(codec, "Default firmware selected."); + if (request_firmware(&fw_entry, EFX_FILE, + codec->card->dev) != 0) + return false; + } dsp_os_image = (struct dsp_image_seg *)(fw_entry->data); if (dspload_image(codec, dsp_os_image, 0, 0, true, 0)) {