From patchwork Sun Sep 30 03:03:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Connor McAdams X-Patchwork-Id: 10621115 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3AF8414BD for ; Sun, 30 Sep 2018 03:04:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2904527EE2 for ; Sun, 30 Sep 2018 03:04:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1D5FE27F85; Sun, 30 Sep 2018 03:04:32 +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.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham 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 630C927EE2 for ; Sun, 30 Sep 2018 03:04:31 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id C09CA2678E9; Sun, 30 Sep 2018 05:04:12 +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 BFBEE267776; Sun, 30 Sep 2018 05:04:09 +0200 (CEST) Received: from mail-qt1-f176.google.com (mail-qt1-f176.google.com [209.85.160.176]) by alsa0.perex.cz (Postfix) with ESMTP id 0E19B267774 for ; Sun, 30 Sep 2018 05:04:08 +0200 (CEST) Received: by mail-qt1-f176.google.com with SMTP id m15-v6so10663497qtp.8 for ; Sat, 29 Sep 2018 20:04:07 -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:in-reply-to:references; bh=dd7bKtioRklldvqESdgqIRuwzi9xeWLLoSY6BhHdesY=; b=ZkMtvnuQEsytoiuIKwKsNNYEY20MGpOUj52Pa1yf1Xrv8vWunHYwkjSzwiQubjATrf eYTj8iAvEBDr/bhcTb3DFe51hBoi+TetDmAexC02z9b5EHRhEcRfPRRE5e5XZR8cd6+j Rp7hD1A/6GLXiLPkPGqm4j7Y3sQicXaPKuJ3oATV2M+tcgjAPNfTDetEawfGrHjQVZUm XWMZeQMJsjyncIjksQwSzHiqN7vxDqpGHSv69oldKbo1OJ1iwa+8Vrd5Qca6xREuMD7G D8uEWq/3XiqpqoOzkwBeJEbU+2t0ByTV55fHO/+4j9IDspACqbHeLfl2W9D+e/8ZspEv wUnw== 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:in-reply-to :references; bh=dd7bKtioRklldvqESdgqIRuwzi9xeWLLoSY6BhHdesY=; b=rjo39KWpMntGH0N7si7Nofy9c4nTsWxF7XBauRR8p+TVyk6FXnTr8oti77YwnycYP9 /MmM4sPVSkErvfYRp92anlFziAKta4MBSJvOG0PVhy3Ok+QoTFZc7bAd4o8HUZj90Gda O4ww5dVN2L0nVjyWXv5k+/iyrDolT5UKeUuuyG+PYunAaM7P0zwMESvEnJGvm+JZ2Z3D FdFHt5nzW/9kVAwDkZfqQWh+rDJ58ZN67hcR0r7+7KesP7/j0+ZuvB78XXqf0CGeE7bl VWcWZbhQwtgaM78aEuXVAmVdFiM/GRtjH5Hx2NPIXXlu0u5C995O+L1iMyWubYr+pqxV QNpw== X-Gm-Message-State: ABuFfohFvSk5Cja/CN6xmLHtNE7gynOjndtrsuv7kOTNpp0s2hHXCzEW Hh870s7KqFGo//FkOIMaJX4= X-Google-Smtp-Source: ACcGV60Gp/bGuaWvvND4yR5B5iB+qA5ya8dCQwb+RGeg5FWcx32vO9u3UaxoV7KE9E+EA1mHhSm1eg== X-Received: by 2002:aed:2ce6:: with SMTP id g93-v6mr4252398qtd.288.1538276647484; Sat, 29 Sep 2018 20:04:07 -0700 (PDT) Received: from localhost.localdomain ([2605:a000:1316:4273:6520:8440:55b8:a001]) by smtp.googlemail.com with ESMTPSA id p1-v6sm4782028qkg.82.2018.09.29.20.04.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 29 Sep 2018 20:04:07 -0700 (PDT) From: Connor McAdams To: Date: Sat, 29 Sep 2018 23:03:17 -0400 Message-Id: <1538276607-30234-3-git-send-email-conmanx360@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1538276607-30234-1-git-send-email-conmanx360@gmail.com> References: <1538276607-30234-1-git-send-email-conmanx360@gmail.com> Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Alastair Bridgewater , Takashi Iwai , conmanx360@gmail.com Subject: [alsa-devel] [PATCH 02/11] ALSA: hda/ca0132 - Fix surround sound with output effects 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 fixes an issue where if surround sound was the selected output and output effects were enabled, the sound wasn't sent to all channels correctly. Signed-off-by: Connor McAdams --- sound/pci/hda/patch_ca0132.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c index aebc592..5a3fb56 100644 --- a/sound/pci/hda/patch_ca0132.c +++ b/sound/pci/hda/patch_ca0132.c @@ -4125,6 +4125,7 @@ static int ca0132_select_out(struct hda_codec *codec) } static int ae5_headphone_gain_set(struct hda_codec *codec, long val); +static int ca0132_effects_set(struct hda_codec *codec, hda_nid_t nid, long val); static void ae5_mmio_select_out(struct hda_codec *codec) { @@ -4365,12 +4366,19 @@ static int ca0132_alt_select_out(struct hda_codec *codec) snd_hda_set_pin_ctl(codec, spec->out_pins[3], pin_ctl | PIN_OUT); - if (spec->effects_switch[PLAY_ENHANCEMENT - EFFECT_START_NID]) - dspio_set_uint_param(codec, 0x80, 0x04, FLOAT_ONE); - else - dspio_set_uint_param(codec, 0x80, 0x04, FLOAT_EIGHT); + dspio_set_uint_param(codec, 0x80, 0x04, FLOAT_EIGHT); break; } + /* + * Surround always sets it's scp command to req 0x04 to FLOAT_EIGHT. + * With this set though, X_BASS cannot be enabled. So, if we have OutFX + * enabled, we need to make sure X_BASS is off, otherwise everything + * sounds all muffled. Running ca0132_effects_set with X_BASS as the + * effect should sort this out. + */ + if (spec->effects_switch[PLAY_ENHANCEMENT - EFFECT_START_NID]) + ca0132_effects_set(codec, X_BASS, + spec->effects_switch[X_BASS - EFFECT_START_NID]); /* run through the output dsp commands for the selected output. */ for (i = 0; i < alt_out_presets[spec->cur_out_type].commands; i++) { @@ -4409,7 +4417,6 @@ static void ca0132_unsol_hp_delayed(struct work_struct *work) static void ca0132_set_dmic(struct hda_codec *codec, int enable); static int ca0132_mic_boost_set(struct hda_codec *codec, long val); -static int ca0132_effects_set(struct hda_codec *codec, hda_nid_t nid, long val); static void resume_mic1(struct hda_codec *codec, unsigned int oldval); static int stop_mic1(struct hda_codec *codec); static int ca0132_cvoice_switch_set(struct hda_codec *codec); @@ -4787,6 +4794,8 @@ static int ca0132_effects_set(struct hda_codec *codec, hda_nid_t nid, long val) /* if PE if off, turn off out effects. */ if (!spec->effects_switch[PLAY_ENHANCEMENT - EFFECT_START_NID]) val = 0; + if (spec->cur_out_type == SURROUND_OUT && nid == X_BASS) + val = 0; } /* for in effect, qualify with CrystalVoice */