Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751404AbdH1Xbv (ORCPT ); Mon, 28 Aug 2017 19:31:51 -0400 Received: from mail-cys01nam02on0125.outbound.protection.outlook.com ([104.47.37.125]:29802 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751330AbdH1Xbn (ORCPT ); Mon, 28 Aug 2017 19:31:43 -0400 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=RyanS.Lee@maximintegrated.com; From: Ryan Lee To: lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com, ryans.lee@maximintegrated.com, kuninori.morimoto.gx@renesas.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Cc: ryan.lee.maxim@gmail.com Subject: [PATCH 8/9] ASoC: max98927: Modified DAPM widget and map to enable/disable VI sense path Date: Mon, 28 Aug 2017 16:31:00 -0700 Message-Id: <1503963061-14763-8-git-send-email-ryans.lee@maximintegrated.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1503963061-14763-1-git-send-email-ryans.lee@maximintegrated.com> References: <1503963061-14763-1-git-send-email-ryans.lee@maximintegrated.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [204.17.143.20] X-ClientProxiedBy: BN6PR16CA0010.namprd16.prod.outlook.com (10.172.212.148) To SN1PR11MB0848.namprd11.prod.outlook.com (10.163.208.146) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3401e1fb-be75-47de-aad0-08d4ee6cefda X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(48565401081)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:SN1PR11MB0848; X-Microsoft-Exchange-Diagnostics: 1;SN1PR11MB0848;3:cpxudL99fIamjeAixCAFGJWwNHrlGHp4cn+yGGfWB/OBVVLfTOXITzgksnWCRHR0GWPTLVdCKizFNGuSENSpKtnora4Kr7an36nGQbh9Fff2xVNaKlamFDcBJ8tOt74ID4X8KtndYxmke23u/yVznUuD+kcS+QabStaJRx9ioTtYmzpOkG5VZq6BguviISszhkansxnx5fsDhE60AhJ6RuOwVh5MnIoldqNK3kZHWu/0eVanUcJapLn7jo2UjWT6;25:Dl2/wAEm/GE3j0VtbPJmUkOlYyGundrvbS1kyZKYrj+vdK2LlEQNmzIW1nDDsYRewOCTN7a/VfwillsHpDuWp8E4a5BXjTgMcyAmG+lpttjA65SAv1oJ3FKUXf7xPiGxOXTAmlyXqxdmmRwKvgn7tQzgpx2YuT/qUDRj9yjlJm+nmw1RDubXpPXpK/ccNAOkqUZrIk5M9yaCGziBCmjAkt+GsnXy5s8lzN+WOJy2KP95mzEXjVQiiwagQzdIU7gQv0Rh4N02snENXksfsFT4TxuE3UJaPPY8vgnAcdtooHECjqcJD3SdP7C0aDPVcSjlQ+Za4m2HanbUvTcYSKQA4Q==;31:nW/DKX9QgufQHy1la3lxZl+exYuqZlgbbugWlUCPT4ITqSlvFJDQNkmnIyYatUz9byGAP99XlDBhihG8jU8Oo40bF5Ey3mz7KNB+lvDg665oiMMyeYl7Y+H/pqqVrgFQ6B63S/QLjMORy9IU0YIXxuQY1JvTuwU4TQ4zerdcjJhWmLlk8tExPgz32iEIx65tFbmiuZ5v04JlipZlVWUJdf0O56+U3Q/DIl38Q5ydCbY= X-MS-TrafficTypeDiagnostic: SN1PR11MB0848: X-Microsoft-Exchange-Diagnostics: 1;SN1PR11MB0848;20:/F3iDgpz9tZHHrW3+9kTu5SqPB0MMrYlKmpNitZ+H5vj6X9Y37hp++lslJvdsD+F6jYHkJGU2gRrkzdJ455sAcdJJi3wHqpK3kpTbThSO0U3cm4OZudoq8uIceYLyFq8cGdIupfye7wuasylXjjxlomjwhFRbRwisBpnB6rAgi48F1Jk6014DkHJbxsyed53EgcQg6EnokqxH5+hCM5TnwznPlDspUzfMM0z9a2Eb3DN6jRDcDKtbLN9tVUPScc3KSdwp7UX2Y2kjWTQidXY8IXBsFNNCLUE852z3JgbMVE+Vo1gh9HM7REEdOF+0JsuoxiYRL+4QtXIf/YekC+1mEjHvWvCJYGCRD3rmekWOWcvN42xIpcOct1K4VtBP5spS8xETHNKTVLQD9c1VxlYPqx5l7Kre5HQxk7yVhmrBSh6/CF9MkpvyqXBP3W2eaBGop9/47knpy4IVPkPti9Y7PYbYneKdGu6oF8Ssf2NvUhQISyP8NFc6g3ebuZNqYgP;4:4LYfcxTE0uJKO8hy+gj5SrJoKrT1MiyS+fhetEWKAJv4lA5dSisu6XxX8Rx9DIYcRzNopF45XBFFb49oY3Z3QgpjG8Hs7HSAVOYJDShklowih6aFLRIMIXQwXKyEgkRk9XubfjE6xI3Z8QZYuaXtkpOxxbX+vKAWoYe88hpfHHeunQDHnbmMtn35QLNuU8zcHD/WSgHL91akkL4gz02+iAtpAmDqVLi/6/pvJ39szmttrSzItQi+khW7iG43GJcKd6qLP0XuwG1fz6UIX/1V4znJQxdwcfJla7XzTD4bjN0= X-Exchange-Antispam-Report-Test: UriScan:(108721460000369); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(93001095)(100000703101)(100105400095)(6055026)(6041248)(20161123564025)(20161123555025)(20161123562025)(20161123560025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:SN1PR11MB0848;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:SN1PR11MB0848; X-Forefront-PRVS: 0413C9F1ED X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(7370300001)(6009001)(39860400002)(199003)(189002)(2950100002)(101416001)(81166006)(6666003)(6486002)(6506006)(25786009)(48376002)(8676002)(50466002)(81156014)(305945005)(97736004)(36756003)(72206003)(69596002)(7736002)(5660300001)(53936002)(50226002)(478600001)(86362001)(50986999)(76176999)(2906002)(6512007)(53416004)(42186005)(110136004)(33646002)(106356001)(105586002)(189998001)(4326008)(3846002)(5003940100001)(47776003)(7350300001)(66066001)(68736007)(6116002);DIR:OUT;SFP:1102;SCL:1;SRVR:SN1PR11MB0848;H:ryan-ThinkPad-T430.maxim-ic.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;SN1PR11MB0848;23:/F7Zt33El/q8u8IregnEWm8agIg4fxiZBuhEv+/6Z?= =?us-ascii?Q?/Je6h9WMCladqv6DWtGCH6Z1c3Dwt9rIaO87Sgyi8o6sZCKn3w7+17/mli3v?= =?us-ascii?Q?vD5hbiQBVcQDJxm+MDH4z8SeDuoAj9jOIODpQIp+M2DAWxoJraZkrDS2+wgp?= =?us-ascii?Q?ppON4gP2nUJLcmvDLzc5U70HhadfzwjwHiZ4gXGjehJKRlXiynB2pWz9ze03?= =?us-ascii?Q?eXLoKgPNIb9j9+AOwzkjed/E56tnykNNbt8T7TB9Ww8pJWeEbuRMD+fbR96O?= =?us-ascii?Q?x2WHNXCpXJIWxmvYNo99pDVIuvgvxj2/gEk+BSPqejGbeSZaEUHPcYILPcW9?= =?us-ascii?Q?9HscpROSlbh5h76jgwwCUKDpST9PS4FZEYUhn+qiQMfdLf6/ic9G4QMMNDUL?= =?us-ascii?Q?WBfEmMnVzTzDoJKLR7sgZ1P9kyfTdGQpKBk+o9A0L7hAWOoOZp1kQ4LDBZob?= =?us-ascii?Q?7xfaRiQBQjdWwCzc5+TmabZaqZfEjuonDIWq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7FqPVLfinhcKtwFPPfDCg4GoiykMyyFNAg116isrLsDKj9bNI4F+yzF13h/bevimNMrWzXho7WRraCTi8buMAzt2JxqW8tWdgHlXINpW7IZs7SZjIofjtKONOQ7qiS7J958mjW+qIVMd2uZzehuOg==;5:qrzecT2mPvZkEce5SCIQMlDHn9LzxPvezfxz3iGrwN7clgBDmMaDF3HkmCXRxbSjomeSHmhtN4Itn1uVBi2iQHsaZ4AYrZcIRAgNo/vjfZ2hx7VsTir7iK5CPnJliAhuSih3PAtwpgptUNCh0WbGLQ==;24:rLhV1u7HYgl7DrhGV2jJBERfEDAPq1Y0bmx8vkBRMcrnWW+Odr2qk4s2eA6JbpTmcbzA8jQg+P1IjM9/NxFGcFHkSDn4WM3hiMC4bcLki3M=;7:IyppGYbHVBrgE2XWDuIgpyvMz68QIFJhem+MTCc2N1l43bcFdf2LRjOS9zzpniYjM6CBqsYa3kGk1trGOy+Kzo2kdydcx07/pizUd6jbwbtS5/p+eq+tMnD1n2RVftyKmJZgFjqggRqJ3kBm/2xQ1/mTTdM+GRKvdFuGpVhNAGiFl9Ww82+EVnzx1rBAiikObZSbc+TmBYWyDadNzQnlKoHD6aOWA4eSpcw1f/lW59w= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: maximintegrated.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Aug 2017 23:31:40.3108 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR11MB0848 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2911 Lines: 78 Signed-off-by: Ryan Lee --- sound/soc/codecs/max98927.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/sound/soc/codecs/max98927.c b/sound/soc/codecs/max98927.c index 5517251..f944659 100644 --- a/sound/soc/codecs/max98927.c +++ b/sound/soc/codecs/max98927.c @@ -509,11 +509,6 @@ static int max98927_dac_event(struct snd_soc_dapm_widget *w, regmap_update_bits(max98927->regmap, MAX98927_R003A_AMP_EN, MAX98927_AMP_EN_MASK, 1); - /* enable VMON and IMON */ - regmap_update_bits(max98927->regmap, - MAX98927_R003E_MEAS_EN, - MAX98927_MEAS_V_EN | MAX98927_MEAS_I_EN, - MAX98927_MEAS_V_EN | MAX98927_MEAS_I_EN); regmap_update_bits(max98927->regmap, MAX98927_R00FF_GLOBAL_SHDN, MAX98927_GLOBAL_EN_MASK, 1); @@ -525,10 +520,6 @@ static int max98927_dac_event(struct snd_soc_dapm_widget *w, regmap_update_bits(max98927->regmap, MAX98927_R003A_AMP_EN, MAX98927_AMP_EN_MASK, 0); - /* disable VMON and IMON */ - regmap_update_bits(max98927->regmap, - MAX98927_R003E_MEAS_EN, - MAX98927_MEAS_V_EN | MAX98927_MEAS_I_EN, 0); break; default: return 0; @@ -547,14 +538,24 @@ static int max98927_dac_event(struct snd_soc_dapm_widget *w, static const struct snd_kcontrol_new max98927_dai_controls = SOC_DAPM_ENUM("DAI Sel", dai_sel_enum); +static const struct snd_kcontrol_new max98927_vi_control = + SOC_DAPM_SINGLE("Switch", MAX98927_R003F_MEAS_DSP_CFG, 2, 1, 0); + static const struct snd_soc_dapm_widget max98927_dapm_widgets[] = { - SND_SOC_DAPM_AIF_IN("DAI_OUT", "HiFi Playback", 0, SND_SOC_NOPM, 0, 0), SND_SOC_DAPM_DAC_E("Amp Enable", "HiFi Playback", MAX98927_R003A_AMP_EN, 0, 0, max98927_dac_event, SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), SND_SOC_DAPM_MUX("DAI Sel Mux", SND_SOC_NOPM, 0, 0, &max98927_dai_controls), SND_SOC_DAPM_OUTPUT("BE_OUT"), + SND_SOC_DAPM_AIF_OUT("Voltage Sense", "HiFi Capture", 0, + MAX98927_R003E_MEAS_EN, 0, 0), + SND_SOC_DAPM_AIF_OUT("Current Sense", "HiFi Capture", 0, + MAX98927_R003E_MEAS_EN, 1, 0), + SND_SOC_DAPM_SWITCH("VI Sense", SND_SOC_NOPM, 0, 0, + &max98927_vi_control), + SND_SOC_DAPM_SIGGEN("VMON"), + SND_SOC_DAPM_SIGGEN("IMON"), }; static DECLARE_TLV_DB_SCALE(max98927_spk_tlv, 300, 300, 0); @@ -656,11 +657,16 @@ static SOC_ENUM_SINGLE_DECL(max98927_env_track_headroom, }; static const struct snd_soc_dapm_route max98927_audio_map[] = { - {"Amp Enable", NULL, "DAI_OUT"}, + /* Plabyack */ {"DAI Sel Mux", "Left", "Amp Enable"}, {"DAI Sel Mux", "Right", "Amp Enable"}, {"DAI Sel Mux", "LeftRight", "Amp Enable"}, {"BE_OUT", NULL, "DAI Sel Mux"}, + /* Capture */ + { "VI Sense", "Switch", "VMON" }, + { "VI Sense", "Switch", "IMON" }, + { "Voltage Sense", NULL, "VI Sense" }, + { "Current Sense", NULL, "VI Sense" }, }; static struct snd_soc_dai_driver max98927_dai[] = { -- 1.9.1