Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754441AbbFPGWT (ORCPT ); Tue, 16 Jun 2015 02:22:19 -0400 Received: from mail-bl2on0137.outbound.protection.outlook.com ([65.55.169.137]:35168 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752218AbbFPGWK (ORCPT ); Tue, 16 Jun 2015 02:22:10 -0400 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=freescale.com; freescale.mail.onmicrosoft.com; dkim=none (message not signed) header.d=none; From: Zidan Wang To: CC: , , , , , , , , Zidan Wang Subject: [alsa-devel][PATCH v2] ASoC: wm8960: add dapm kcontrols to select left/right ADC input source Date: Tue, 16 Jun 2015 14:23:19 +0800 Message-ID: <1434435799-26829-1-git-send-email-zidan.wang@freescale.com> X-Mailer: git-send-email 1.9.1 X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BN1AFFO11FD045;1:rtSvp/PvvHuEObwhUEDp+H0zuTlXM6wq/rXEoavvKh07+rauBGsqLXsr8SnFnHJLnVtPs7It6xw1CkFoJ1njr33+lgv4iNDWoyu0AvwVQnhaV3jkFhWpZpgPKp7+sxFlDkFWCp7kW4tzoavM4H70OlhKDgcMLudna92vBvZdj4lWWYLx/1qj+157z4ZdAY9glzNs7SDiBdb2R6Bhg197zaTSuBBmg6Ji2uFcKaKMXLR7bZEoS4h9iv8QKJjwG3fGy7JJEAungA7ezhWuUhakDEIg7jAU+UITFQoyZTmitKRH8U/p/ziezK4/ZSYT7qXNqciMSSHA4qUNlqMkvD5dIQxifTpH0PWcSvOrgj9IAuk= X-Forefront-Antispam-Report: CIP:192.88.168.50;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(2980300002)(339900001)(189002)(199003)(189998001)(5001960100002)(107886002)(110136002)(5001920100001)(104016003)(229853001)(2351001)(47776003)(48376002)(77096005)(105606002)(85426001)(50466002)(50226001)(50986999)(106466001)(92566002)(33646002)(87936001)(86362001)(19580395003)(77156002)(62966003)(19580405001)(46102003)(36756003)(6806004)(4001430100001);DIR:OUT;SFP:1102;SCL:1;SRVR:BY1PR0301MB1253;H:tx30smr01.am.freescale.net;FPR:;SPF:Fail;MLV:sfv;MX:1;A:1;LANG:en; MIME-Version: 1.0 Content-Type: text/plain X-Microsoft-Exchange-Diagnostics: 1;BY1PR0301MB1253;2:VUTVFQA82SMnvLC8wF53Wb017LHhoOK4QtjyRu0eZvJUuhOEB3+jlfHEDNlz2oXB;2:znqXdEhlnBPuZdh4enWDGjJp+IC2ze39fRbRMnTYrWJVR60zp4dRgi4cFtcBnkoF42FxQo6dAu/ZB9sylC2waQdrUi+K1hez+Ofe2iAfptx3L8GbwBRBYFJts4fdt6fFHZUWRmPimRmrA9NYizp8JnNc+JRJiRe1YrPjnmU7A/gK4BFy84j2Datt2TqekRrYpfFvaLmisT8F+Rwd35/4u1kSskDWbBSdhla8lLQCsJg=;6:Bzn2QoIlveHAwLpz0s5FLct2KHSDbzdSfkAvPeIDVLkvrM2ioZQYdI8kf7jltrqEGxBdKZW+oMTyZ/ztVaZS0RS25Qq8cpN6i8yEay+F85OVW6x7tpQS0LNn1aZzYC0LSpwFEerfVAf7TnDo3DyzznabVwqzuZHTLbSghx4afj/7et5s/MaS6Gy1lrdhiCuTFAAea2v7L4XeTuHdw4OPQFJWJx1AMMUUUnuIfuzmDiLYmcXl45foHy+nrHmVLahPxPwbU0GE34N+yIaEd9dw544HeQ7clDNnpKmwFCnF29V5eIsPOSYw3Spl0FKxxSkFLB1uHNZtyUEV/8pjkNvV9g== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY1PR0301MB1253; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(520003)(5005006)(3002001);SRVR:BY1PR0301MB1253;BCL:0;PCL:0;RULEID:;SRVR:BY1PR0301MB1253; X-Microsoft-Exchange-Diagnostics: 1;BY1PR0301MB1253;3:QbZ+uBoJOqDsKNnoAb3USr82sDXF/wCFKJcntbm3jAzPWKSDGRUgbbSHnb4Vlr8WUpnlhO8mkS7eOtCNU12PQ+dv5FTfb87DJgVZ2V/kL8rjwAGAXuZvpRozUF1xwbRzONr02serJDtj+exw61Isuf+w7q+DZnMcBszCh2KIpDxI+zjC8zrmCVDyhsDvy2arN2e20iU4zTh6Lhq/Wk6+8N87QawMr/B3Ph1Rz7sdwp87wlnZLeKlwtPVajCQY2176cGzmaaFsuT+hen/SSXvsO230t69W/A51Xu9QPXd/99l7HJEslEYyCR39ja86qv3 X-Forefront-PRVS: 06098A2863 X-Microsoft-Exchange-Diagnostics: 1;BY1PR0301MB1253;9:iw1Hj2sf0T+BxVIpYvN9UsxM87yJoq17i2NFFAAAVGT3lSW2rFE9J9CiYS47IUNH4OD7dNPhu15BL85MEyI7PuDsCCwWrTJy1SGeywMMf+2TNeqC8cNzId7+6GNATCUaZnRtsYvGY03tIaeBWRrUDTYrultq/IwC/4qZtFfW0HmLjCWNBN1tYqiwgTFZemAec1akHwCyEjlH2hwJaf6FAUEE2XJuR4BnT7QdcWlG1isZA0rrYeJnf+T2844fUxPBNd29vgimcTQw/nChwHUIDbc6W7g2SSZHDbguAcLo5M53vSuyXVrftWKTL3Awu1ZJM2gGWwsb9zstKICpM5J70OcyK+i4V24y6fl+g+JZZcW+BMEEMf6JkDlWuWs5I/rwtK/SZEAmnR1guyo/WrATek/XmTzzzEsEg/2+9Sb/Llu4Wh6uV7NyRR4R/w6kVO9mtnP8rLlZZhAlIY0LRR1UHaD9ikeHgJpmOq7W55JQQqtCxPGT0kOrLfAYsE6ihTVCILVKZSMcCzu5JmxQbBaMNdAHM9npXJqaxrI4rv3kAgQghaYJSOxWb9NiMrVtmgEVINW+lFMKuy7S50m1MlhfK+4Z2vfJ+0DAUuQJwuXompLMDoJn1uOmziX+gTwEIS4Mf9PozKlHASqo6zY7YfB31GzwvVgDUy4YsCDdHV2RJ52yR7oFS5+K8/3GBi7czBvUmGwRxSYaFmovImdUdj8dOKStIr/6n+TQEVEuP5qzZbYmKD3Mi+YVeColfALQSs5Q4l/xA9kqCb//YwcfvzEfTGo9WuqhxrnrmsHwngSreG59KQTQqCN1ltiedcNtLNTbaK2i99xObOF6ABHdB1ssjSERSYLxJrs6U63X1+ns+JLfKWNeXjZOfVA6VmjPaQwaVKzZY7rJqTu4n8wHzmEeaq++GGoYMlhCUKA7YVBjnDY= X-Microsoft-Exchange-Diagnostics: 1;BY1PR0301MB1253;3:HDhAp1shtKopPUd4Q5/U3rbWm6GMTHJIW1J6URwSizUNhXaF7U0DqSe1tOZagxhzBB2XmEoVoMSuJGPux/ZBmgxUSyAXiXTfybm215t4DD3jqyUpMMXMgQaykYu74b8/ZbNvm9puwRion5eTdzDlDQ==;10:c9I1rKYSgKl0rT7hHAArulpM2m1Xwu3SqSziDKJckwHL0TFqN5B+OMjPX1xJ1pXZuKqTePoMpx5cziaZwSDNnDq8uzmJD1rDkArxIGX8/io=;6:5CU1Kh6OLpTyZTalTAV17QSiDfzrHmHg+4ZpnlK8n6KCmq4wKkDaJw3Yz5hQ16G8 X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2015 06:21:59.7020 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d;Ip=[192.88.168.50];Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0301MB1253 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3582 Lines: 83 Add dapm kcontrols to select left/right ADC input source, one to select the left ADC input source and one for the right ADC input source. In default, the left ADC will select the left input, and the right ADC will select the right input. When the left(right) ADC select the right(left) input, the left(right) input path will be powered down. Signed-off-by: Zidan Wang --- sound/soc/codecs/wm8960.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c index 023e898..3ea12b7 100644 --- a/sound/soc/codecs/wm8960.c +++ b/sound/soc/codecs/wm8960.c @@ -141,6 +141,8 @@ static const char *wm8960_3d_upper_cutoff[] = {"High", "Low"}; static const char *wm8960_3d_lower_cutoff[] = {"Low", "High"}; static const char *wm8960_alcfunc[] = {"Off", "Right", "Left", "Stereo"}; static const char *wm8960_alcmode[] = {"ALC", "Limiter"}; +static const char *wm8960_adcl_src_text[] = {"Left", "Right"}; +static const char *wm8960_adcr_src_text[] = {"Right", "Left"}; static const struct soc_enum wm8960_enum[] = { SOC_ENUM_SINGLE(WM8960_DACCTL1, 5, 4, wm8960_polarity), @@ -150,6 +152,10 @@ static const struct soc_enum wm8960_enum[] = { SOC_ENUM_SINGLE(WM8960_ALC1, 7, 4, wm8960_alcfunc), SOC_ENUM_SINGLE(WM8960_ALC3, 8, 2, wm8960_alcmode), }; +static SOC_ENUM_SINGLE_DECL(wm8960_adcl_src_enum, + WM8960_ADDCTL1, 3, wm8960_adcl_src_text); +static SOC_ENUM_SINGLE_DECL(wm8960_adcr_src_enum, + WM8960_ADDCTL1, 2, wm8960_adcr_src_text); static const int deemph_settings[] = { 0, 32000, 44100, 48000 }; @@ -281,6 +287,11 @@ SOC_SINGLE_TLV("Right Output Mixer RINPUT3 Volume", WM8960_ROUTMIX, 4, 7, 1, bypass_tlv), }; +static const struct snd_kcontrol_new wm8960_adcl_mux = + SOC_DAPM_ENUM("ADCL Source", wm8960_adcl_src_enum); +static const struct snd_kcontrol_new wm8960_adcr_mux = + SOC_DAPM_ENUM("ADCR Source", wm8960_adcr_src_enum); + static const struct snd_kcontrol_new wm8960_lin_boost[] = { SOC_DAPM_SINGLE("LINPUT2 Switch", WM8960_LINPATH, 6, 1, 0), SOC_DAPM_SINGLE("LINPUT3 Switch", WM8960_LINPATH, 7, 1, 0), @@ -344,6 +355,9 @@ SND_SOC_DAPM_ADC("Right ADC", "Capture", WM8960_POWER1, 2, 0), SND_SOC_DAPM_DAC("Left DAC", "Playback", WM8960_POWER2, 8, 0), SND_SOC_DAPM_DAC("Right DAC", "Playback", WM8960_POWER2, 7, 0), +SND_SOC_DAPM_MUX("ADCL Source", SND_SOC_NOPM, 0, 0, &wm8960_adcl_mux), +SND_SOC_DAPM_MUX("ADCR Source", SND_SOC_NOPM, 0, 0, &wm8960_adcr_mux), + SND_SOC_DAPM_MIXER("Left Output Mixer", WM8960_POWER3, 3, 0, &wm8960_loutput_mixer[0], ARRAY_SIZE(wm8960_loutput_mixer)), @@ -399,8 +413,14 @@ static const struct snd_soc_dapm_route audio_paths[] = { { "Right Input Mixer", NULL, "RINPUT2" }, { "Right Input Mixer", NULL, "RINPUT3" }, - { "Left ADC", NULL, "Left Input Mixer" }, - { "Right ADC", NULL, "Right Input Mixer" }, + { "ADCL Source", "Left", "Left Input Mixer" }, + { "ADCL Source", "Right", "Right Input Mixer" }, + + { "ADCR Source", "Left", "Left Input Mixer" }, + { "ADCR Source", "Right", "Right Input Mixer" }, + + { "Left ADC", NULL, "ADCL Source" }, + { "Right ADC", NULL, "ADCR Source" }, { "Left Output Mixer", "LINPUT3 Switch", "LINPUT3" }, { "Left Output Mixer", "Boost Bypass Switch", "Left Boost Mixer"} , -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/