Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp3868087ybl; Tue, 20 Aug 2019 03:34:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqyJ2aVprGcSigFp+D35tvCF4KABA8pl0sJKZ4o6Ium2HlwLf/PWUEEjSqRBA58tDQwfLsRT X-Received: by 2002:a17:90b:14c:: with SMTP id em12mr24759249pjb.22.1566297291666; Tue, 20 Aug 2019 03:34:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566297291; cv=none; d=google.com; s=arc-20160816; b=dhoPlXhgeYVsMcVNyiXN/E7Oxww8fWHHgzZD2Tdnez6WtbOJoTfAOIouol9WpbAWEz ocUQLs6lDbfXdPt4a5PDce6p7rMrdYuq/jCqwfi+WkCAFt2mlGT9XX53pN+mpcrztjmb MEtPCaxkt2yecNs8QjMNWjI0F9i8c6OeiNnJ9Wup5f+1sgtyFb3mIO1+xXDToHC0Cpve HV3+35EDPZBu1ZDG5lhBVabKJeulOidILKFPK2TQgZ5wJhHDvw3WZsmgeCb7xvvozVvm rThgU+UM6wmtAcwkCnoy2rtd7IIUQZ2w8JFyRdu9lLHwgInDyvtv4NLKXyCQ7sUWHjvQ KwPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:content-transfer-encoding :mime-version:subject:from:references:in-reply-to:message-id:date :dkim-signature; bh=NFj6rlF/yr9nD/Cmt71FuIipwQb32EPGJbCJ5aCSpnY=; b=k7bP28/YLIBxQvYxDlruTuzEoq2T8SvqIU2sBEO2QYYJLiWzagSH9BfUt7jpUlKnZ9 PkfA15I/mGfgXaEJMMY3bCz6JKHxVrM7CS/WIGHfTePQbo1E0Yfrgqf2ptUbPC2pWc39 aeCLN+g/uV1gj3At36OAg0vOH72NiPEpAOTbNz5KnEau3U1oQuCRxeOCQ5Z0y1EX8WDo arj9TxlIGa6ClswcTfX85neyrCd01FKGvVP5U4bQ2d+kFjZKwzTxxZCqqUYcbPd+mCfj a9vEF8lBaJ7mBvP2FmHXiOVfka6MkLdh0HboIdapNZaJBW/hWEjuvu/IA2HZDh+OoXAp hDiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rere.qmqm.pl header.s=1 header.b=rE7EV7ZA; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f8si6292906plb.178.2019.08.20.03.34.36; Tue, 20 Aug 2019 03:34:51 -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=@rere.qmqm.pl header.s=1 header.b=rE7EV7ZA; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729644AbfHTKdi (ORCPT + 99 others); Tue, 20 Aug 2019 06:33:38 -0400 Received: from rere.qmqm.pl ([91.227.64.183]:17242 "EHLO rere.qmqm.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728545AbfHTKdh (ORCPT ); Tue, 20 Aug 2019 06:33:37 -0400 Received: from remote.user (localhost [127.0.0.1]) by rere.qmqm.pl (Postfix) with ESMTPSA id 46CRtS36k0zM6; Tue, 20 Aug 2019 12:32:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rere.qmqm.pl; s=1; t=1566297120; bh=KVZrX98neVqIhou7M+iYjHQfEsdRcU2YMYDYZF0DDXU=; h=Date:In-Reply-To:References:From:Subject:To:Cc:From; b=rE7EV7ZAjcyqPBRyviP1fIiG2lhCyMHxpHtStQQRCBqlb8xA5jBOa7HgZGTBr6WYD PBgEnsZj4Gepvkmaj09Ru2mZkVzgncxmVA7HR5uV8mye32bzc7MkLocdoUroFvjpQG aXQdWLZoJ15JMxV1F3E/48r95MO2nk/UYwn2YOjY2s+rPFcd5yCOpstI5Y6oGJfB0e gcaDqtLTUD6Ts8N33hBrRfvB/lZcK0/jN0f1fNTU5zZYmEf0QwUn/x/4/smxUdlW80 3XpOTS2a1qYhBJ0Pvz2UZmv9ue5FRjUHBx3jIs1yTRDyB+IujPMmEK9Bs7iUIELryy F1ux8jYHamxMg== X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.101.2 at mail Date: Tue, 20 Aug 2019 12:33:33 +0200 Message-Id: <17f8556414a0e5352dc570fa16d50bd1bc2b4b0a.1566297120.git.mirq-linux@rere.qmqm.pl> In-Reply-To: References: From: =?UTF-8?q?Micha=C5=82=20Miros=C5=82aw?= Subject: [PATCH 2/2] ASoC: wm8904: implement input mode select as a mux MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To: alsa-devel@alsa-project.org Cc: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Charles Keepax , Greg Kroah-Hartman , Thomas Gleixner , zhong jiang , patches@opensource.cirrus.com, linux-kernel@vger.kernel.org, Allison Randal Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Make '* Capture Mode' a mux. This makes DAPM know that in single-ended mode only inverting mux paths need to be enabled. Signed-off-by: Michał Mirosław --- sound/soc/codecs/wm8904.c | 52 +++++++++++++++++++++++++-------------- 1 file changed, 33 insertions(+), 19 deletions(-) diff --git a/sound/soc/codecs/wm8904.c b/sound/soc/codecs/wm8904.c index 525e4ef654a1..e6ae0c3730d5 100644 --- a/sound/soc/codecs/wm8904.c +++ b/sound/soc/codecs/wm8904.c @@ -545,18 +545,6 @@ static const DECLARE_TLV_DB_SCALE(out_tlv, -5700, 100, 0); static const DECLARE_TLV_DB_SCALE(sidetone_tlv, -3600, 300, 0); static const DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0); -static const char *input_mode_text[] = { - "Single-Ended", "Differential Line", "Differential Mic" -}; - -static SOC_ENUM_SINGLE_DECL(lin_mode, - WM8904_ANALOGUE_LEFT_INPUT_1, 0, - input_mode_text); - -static SOC_ENUM_SINGLE_DECL(rin_mode, - WM8904_ANALOGUE_RIGHT_INPUT_1, 0, - input_mode_text); - static const char *hpf_mode_text[] = { "Hi-fi", "Voice 1", "Voice 2", "Voice 3" }; @@ -591,9 +579,6 @@ static const struct snd_kcontrol_new wm8904_adc_snd_controls[] = { SOC_DOUBLE_R_TLV("Digital Capture Volume", WM8904_ADC_DIGITAL_VOLUME_LEFT, WM8904_ADC_DIGITAL_VOLUME_RIGHT, 1, 119, 0, digital_tlv), -SOC_ENUM("Left Capture Mode", lin_mode), -SOC_ENUM("Right Capture Mode", rin_mode), - /* No TLV since it depends on mode */ SOC_DOUBLE_R("Capture Volume", WM8904_ANALOGUE_LEFT_INPUT_0, WM8904_ANALOGUE_RIGHT_INPUT_0, 0, 31, 0), @@ -852,6 +837,10 @@ static int out_pga_event(struct snd_soc_dapm_widget *w, return 0; } +static const char *input_mode_text[] = { + "Single-Ended", "Differential Line", "Differential Mic" +}; + static const char *lin_text[] = { "IN1L", "IN2L", "IN3L" }; @@ -868,6 +857,13 @@ static SOC_ENUM_SINGLE_DECL(lin_inv_enum, WM8904_ANALOGUE_LEFT_INPUT_1, 4, static const struct snd_kcontrol_new lin_inv_mux = SOC_DAPM_ENUM("Left Capture Inverting Mux", lin_inv_enum); +static SOC_ENUM_SINGLE_DECL(lin_mode_enum, + WM8904_ANALOGUE_LEFT_INPUT_1, 0, + input_mode_text); + +static const struct snd_kcontrol_new lin_mode = + SOC_DAPM_ENUM("Left Capture Mode", lin_mode_enum); + static const char *rin_text[] = { "IN1R", "IN2R", "IN3R" }; @@ -884,6 +880,13 @@ static SOC_ENUM_SINGLE_DECL(rin_inv_enum, WM8904_ANALOGUE_RIGHT_INPUT_1, 4, static const struct snd_kcontrol_new rin_inv_mux = SOC_DAPM_ENUM("Right Capture Inverting Mux", rin_inv_enum); +static SOC_ENUM_SINGLE_DECL(rin_mode_enum, + WM8904_ANALOGUE_RIGHT_INPUT_1, 0, + input_mode_text); + +static const struct snd_kcontrol_new rin_mode = + SOC_DAPM_ENUM("right Capture Mode", rin_mode_enum); + static const char *aif_text[] = { "Left", "Right" }; @@ -932,9 +935,11 @@ SND_SOC_DAPM_SUPPLY("MICBIAS", WM8904_MIC_BIAS_CONTROL_0, 0, 0, NULL, 0), SND_SOC_DAPM_MUX("Left Capture Mux", SND_SOC_NOPM, 0, 0, &lin_mux), SND_SOC_DAPM_MUX("Left Capture Inverting Mux", SND_SOC_NOPM, 0, 0, &lin_inv_mux), +SND_SOC_DAPM_MUX("Left Capture Mode", SND_SOC_NOPM, 0, 0, &lin_mode), SND_SOC_DAPM_MUX("Right Capture Mux", SND_SOC_NOPM, 0, 0, &rin_mux), SND_SOC_DAPM_MUX("Right Capture Inverting Mux", SND_SOC_NOPM, 0, 0, &rin_inv_mux), +SND_SOC_DAPM_MUX("Right Capture Mode", SND_SOC_NOPM, 0, 0, &rin_mode), SND_SOC_DAPM_PGA("Left Capture PGA", WM8904_POWER_MANAGEMENT_0, 1, 0, NULL, 0), @@ -1057,6 +1062,12 @@ static const struct snd_soc_dapm_route adc_intercon[] = { { "Left Capture Inverting Mux", "IN2L", "IN2L" }, { "Left Capture Inverting Mux", "IN3L", "IN3L" }, + { "Left Capture Mode", "Single-Ended", "Left Capture Inverting Mux" }, + { "Left Capture Mode", "Differential Line", "Left Capture Mux" }, + { "Left Capture Mode", "Differential Line", "Left Capture Inverting Mux" }, + { "Left Capture Mode", "Differential Mic", "Left Capture Mux" }, + { "Left Capture Mode", "Differential Mic", "Left Capture Inverting Mux" }, + { "Right Capture Mux", "IN1R", "IN1R" }, { "Right Capture Mux", "IN2R", "IN2R" }, { "Right Capture Mux", "IN3R", "IN3R" }, @@ -1065,11 +1076,14 @@ static const struct snd_soc_dapm_route adc_intercon[] = { { "Right Capture Inverting Mux", "IN2R", "IN2R" }, { "Right Capture Inverting Mux", "IN3R", "IN3R" }, - { "Left Capture PGA", NULL, "Left Capture Mux" }, - { "Left Capture PGA", NULL, "Left Capture Inverting Mux" }, + { "Right Capture Mode", "Single-Ended", "Right Capture Inverting Mux" }, + { "Right Capture Mode", "Differential Line", "Right Capture Mux" }, + { "Right Capture Mode", "Differential Line", "Right Capture Inverting Mux" }, + { "Right Capture Mode", "Differential Mic", "Right Capture Mux" }, + { "Right Capture Mode", "Differential Mic", "Right Capture Inverting Mux" }, - { "Right Capture PGA", NULL, "Right Capture Mux" }, - { "Right Capture PGA", NULL, "Right Capture Inverting Mux" }, + { "Left Capture PGA", NULL, "Left Capture Mode" }, + { "Right Capture PGA", NULL, "Right Capture Mode" }, { "AIFOUTL Mux", "Left", "ADCL" }, { "AIFOUTL Mux", "Right", "ADCR" }, -- 2.20.1