Received: by 10.192.165.148 with SMTP id m20csp327928imm; Thu, 3 May 2018 21:30:41 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrOhBVQVm6TcVyNND9xBhE5ANOxTHVO6thld7lCwcYtTir4cG5SJS56AtXSjA2hJAhUBgw7 X-Received: by 10.98.238.21 with SMTP id e21mr20987389pfi.203.1525408241282; Thu, 03 May 2018 21:30:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525408241; cv=none; d=google.com; s=arc-20160816; b=ZpKO51/+6awFRwK60OJScb0h0APAZTkfyUuOIH3XjXyuZBvg0obdjkBQS1ijnKlMHf wkxANV1AxRXt2K80w5PEtwYNHSH/huQT6ulK/vIIJ8OLobcZuWomyQYj/xnYImct42Ir 0v+71EHM4IaLBbdCtn1S+iIY2HffkRPcgTkW/YoifeYcrSiyXxL99n+k8xpZG4qrPwOk V2oRnhuTmjJBW3PikG8MEmPTv7DkAH6NIFDjkkUITfNqRsyBEc2JICeHd3iZ7j1OKtL5 TLg91+ieTjqXPrXRpRytZmZ0WAT0Xcgiexc5DVye1b3RGDLBzMZE+7PYwSNaKXQucznF 07rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=G088UWbqJeWxh+TneL2l9cNGlQVTL90LBD11aOYlgSc=; b=vtTq/x7cica+qb3iUH+h3/nhwWc7yVDOUETYXPsfkbsb3H6NQE5zKmSkB6zMXLsdpz fg+dg30cCswLMP3eG1V5LePbMegkiCkHMTqkLa8B4y4qsdtXKRRVlYrXqe+X6oULhYDR 0xGv8YSTGbUa4Cu3eZWYQXJCk4TFyTBobZGQjLPeHQ2e4ZOVVVEEeHr7OV0njuNVHuvE 4eGBa5onWVw/dmjshDWjY2CkMSLEJoSRKWeo946F3c0eS8KbTXchHIf7V3BLwSwEB1Ja W0nqHgMZ7RlBrUUBMn3OcwbJ3lTfErgRiJPQNcSMAprLTWl2Kkp7n0eEGCJMgxh3BknE 0T3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=pz472r05; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q9-v6si12005354pgp.226.2018.05.03.21.30.26; Thu, 03 May 2018 21:30:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=pz472r05; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751106AbeEDEaQ (ORCPT + 99 others); Fri, 4 May 2018 00:30:16 -0400 Received: from mail-ot0-f193.google.com ([74.125.82.193]:36093 "EHLO mail-ot0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750707AbeEDEaP (ORCPT ); Fri, 4 May 2018 00:30:15 -0400 Received: by mail-ot0-f193.google.com with SMTP id m11-v6so16963886otf.3 for ; Thu, 03 May 2018 21:30:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=G088UWbqJeWxh+TneL2l9cNGlQVTL90LBD11aOYlgSc=; b=pz472r05qnc1dI23ncc2stGMWU6WfWlLLfYyKYk9MvXYqtfsugp53RwcGAPTgvqSrm WPjDU4yZmrMdMlO3YWhj8vKvNWBsalrLO00yH6A9oGzGw0rYa+fZ6RqULdkLIgSXx6Ip 3dEj3xX51xsGkzoB7K4jpQAqqsyR9+H9/TN/iz8gaEIb8U3mPuUgM1UT5SfWf8IiqM5y bPu1xYt1dkqCnr0tbjfQCnlBszbMcAuFxzdt531OboBdEXhLrdtLRiGklkEYJing5ORq Zk2bMd1KX1AMnByoa8+E1p8V0gIiwNzp6ubZwcC+ve8Sjs9w1K3HDCwPjliDTth/ylYA WUKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=G088UWbqJeWxh+TneL2l9cNGlQVTL90LBD11aOYlgSc=; b=VdWTDVMzVymRTmQAYgb3E2YTq6vTRik+mZeAFibgTZfECigwMbrAZnUV36n1g/qUwP ziLuOF3ki9vdHR9Sn6gXXxJpOInukd2BhJO3M0S9xMPeBEUYt4uFAKuhKcPgpJaigJC8 50BPS9R5vKDX9fVndi/1qqpL43VJF0UQRUvc2lsfccYmxMlqvo8t3h2aWhZ7zshh52oW 5kouVD7bGSf0udq8837pch2hRzgb4Ys6sN439bAQj8jYIIVWrz+OOq0Zun/nVLOg0bcJ cJT6WdRIO8BAz0oU1gQqZ8odUK9KKR3R5RVW0gRk5d+NyG/GECaTItmC2lmwAjSoSbLc ASCQ== X-Gm-Message-State: ALQs6tCKBBVcz9sOJeY95VBe3Hzc7lt59ARSd9boL9Dmk63JWWKs7d2x Jm2KOpTbkUIGGdMK8T0jxtDHSMUZUMBNh6ibri4= X-Received: by 2002:a9d:e33:: with SMTP id c48-v6mr19669271otc.118.1525408214680; Thu, 03 May 2018 21:30:14 -0700 (PDT) MIME-Version: 1.0 Received: by 10.201.121.131 with HTTP; Thu, 3 May 2018 21:30:14 -0700 (PDT) In-Reply-To: <1525407594-25644-1-git-send-email-conmanx360@gmail.com> References: <1525407594-25644-1-git-send-email-conmanx360@gmail.com> From: Connor McAdams Date: Fri, 4 May 2018 00:30:14 -0400 Message-ID: Subject: Re: [PATCH 1/9] R3Di and SBZ quirk entires + alt firmware loading To: Connor McAdams Cc: Takashi Sakamoto , Jaroslav Kysela , Takashi Iwai , =?UTF-8?B?SsOpcsOpbXkgTGVmYXVyZQ==?= , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Sorry for sending these twice, I made a formatting mistake in the first series, and they would not apply properly. Hopefully these do not show up as spam because of this. I went through and fixed them all individually and re-committed them, but kept the same commit messages. I still have a lot to learn. Thanks, Connor On Fri, May 4, 2018 at 12:19 AM, Connor McAdams wrote: > 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 | 61 +++++++++++++++++++++++++++++++++++++++----- > 1 file changed, 55 insertions(+), 6 deletions(-) > > diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c > index 768ea86..8346100 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), > {} > }; > > @@ -3207,7 +3218,7 @@ static int ca0132_select_out(struct hda_codec *codec) > pin_ctl & ~PIN_HP); > /* enable speaker node */ > pin_ctl = snd_hda_codec_read(codec, spec->out_pins[0], 0, > - AC_VERB_GET_PIN_WIDGET_CONTROL, 0); > + AC_VERB_GET_PIN_WIDGET_CONTROL, 0); > snd_hda_set_pin_ctl(codec, spec->out_pins[0], > pin_ctl | PIN_OUT); > } else { > @@ -4370,11 +4381,49 @@ 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) { > + 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)) { > @@ -4476,7 +4525,7 @@ static struct hda_verb ca0132_base_exit_verbs[] = { > {} > }; > > -/* Other verbs tables. Sends after DSP download. */ > +/* Other verbs tables. Sends after DSP download. */ > static struct hda_verb ca0132_init_verbs0[] = { > /* chip init verbs */ > {0x15, 0x70D, 0xF0}, > -- > 2.7.4 >