From patchwork Mon Jul 24 09:05:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Enric Balletbo i Serra X-Patchwork-Id: 9859015 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 3707860385 for ; Mon, 24 Jul 2017 09:05:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 280312858A for ; Mon, 24 Jul 2017 09:05:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1CD9228590; Mon, 24 Jul 2017 09:05:44 +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=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, UNPARSEABLE_RELAY 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 EF3592859E for ; Mon, 24 Jul 2017 09:05:42 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id B8F49266A09; Mon, 24 Jul 2017 11:05:40 +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 F3D5D266E41; Mon, 24 Jul 2017 11:05:38 +0200 (CEST) Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227]) by alsa0.perex.cz (Postfix) with ESMTP id 99E82266949 for ; Mon, 24 Jul 2017 11:05:34 +0200 (CEST) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id 3468E26B88F From: Enric Balletbo i Serra To: Liam Girdwood , Mark Brown Date: Mon, 24 Jul 2017 11:05:25 +0200 Message-Id: <20170724090525.12710-1-enric.balletbo@collabora.com> X-Mailer: git-send-email 2.9.3 Cc: alsa-devel@alsa-project.org, Hsin-Yu Chao , linux-kernel@vger.kernel.org Subject: [alsa-devel] [PATCH] ASoC: max98090 - Expose HP out enable. 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 From: Hsin-Yu Chao Expose the headphone output enables to user space. This will allow userspace to ensure that there is stable output before the headphones are turned on, avoiding a pop on insertion. Signed-off-by: Hsin-Yu Chao Signed-off-by: Enric Balletbo i Serra --- sound/soc/codecs/max98090.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c index 6682848..f38c051 100644 --- a/sound/soc/codecs/max98090.c +++ b/sound/soc/codecs/max98090.c @@ -1074,6 +1074,15 @@ static SOC_ENUM_SINGLE_DECL(mixhprsel_mux_enum, static const struct snd_kcontrol_new max98090_mixhprsel_mux = SOC_DAPM_ENUM("MIXHPRSEL Mux", mixhprsel_mux_enum); +/* HP output enables. */ +static const struct snd_kcontrol_new max98090_hpl_enable = + SOC_DAPM_SINGLE("Switch", M98090_REG_OUTPUT_ENABLE, + M98090_HPLEN_SHIFT, 1, 0); + +static const struct snd_kcontrol_new max98090_hpr_enable = + SOC_DAPM_SINGLE("Switch", M98090_REG_OUTPUT_ENABLE, + M98090_HPREN_SHIFT, 1, 0); + static const struct snd_soc_dapm_widget max98090_dapm_widgets[] = { SND_SOC_DAPM_INPUT("MIC1"), SND_SOC_DAPM_INPUT("MIC2"), @@ -1218,10 +1227,10 @@ static const struct snd_soc_dapm_widget max98090_dapm_widgets[] = { SND_SOC_DAPM_MUX("MIXHPRSEL Mux", M98090_REG_HP_CONTROL, M98090_MIXHPRSEL_SHIFT, 0, &max98090_mixhprsel_mux), - SND_SOC_DAPM_PGA("HP Left Out", M98090_REG_OUTPUT_ENABLE, - M98090_HPLEN_SHIFT, 0, NULL, 0), - SND_SOC_DAPM_PGA("HP Right Out", M98090_REG_OUTPUT_ENABLE, - M98090_HPREN_SHIFT, 0, NULL, 0), + SND_SOC_DAPM_SWITCH("HP Left Out", SND_SOC_NOPM, 0, 0, + &max98090_hpl_enable), + SND_SOC_DAPM_SWITCH("HP Right Out", SND_SOC_NOPM, 0, 0, + &max98090_hpr_enable), SND_SOC_DAPM_PGA("SPK Left Out", M98090_REG_OUTPUT_ENABLE, M98090_SPLEN_SHIFT, 0, NULL, 0), @@ -1405,8 +1414,8 @@ static const struct snd_soc_dapm_route max98090_dapm_routes[] = { * Disable this for lowest power if bypassing * the DAC with an analog signal */ - {"HP Left Out", NULL, "DACL"}, - {"HP Left Out", NULL, "MIXHPLSEL Mux"}, + {"HP Left Out", "Switch", "DACL"}, + {"HP Left Out", "Switch", "MIXHPLSEL Mux"}, {"MIXHPRSEL Mux", "HP Mixer", "Right Headphone Mixer"}, @@ -1414,8 +1423,8 @@ static const struct snd_soc_dapm_route max98090_dapm_routes[] = { * Disable this for lowest power if bypassing * the DAC with an analog signal */ - {"HP Right Out", NULL, "DACR"}, - {"HP Right Out", NULL, "MIXHPRSEL Mux"}, + {"HP Right Out", "Switch", "DACR"}, + {"HP Right Out", "Switch", "MIXHPRSEL Mux"}, {"SPK Left Out", NULL, "Left Speaker Mixer"}, {"SPK Right Out", NULL, "Right Speaker Mixer"},