Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752587AbdIAVgP (ORCPT ); Fri, 1 Sep 2017 17:36:15 -0400 Received: from mail-sn1nam01on0134.outbound.protection.outlook.com ([104.47.32.134]:48736 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752473AbdIAVgN (ORCPT ); Fri, 1 Sep 2017 17:36:13 -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 2/3] ASoC: max98927: Added controls for Envelope tracking Date: Fri, 1 Sep 2017 14:35:07 -0700 Message-Id: <1504301708-24389-2-git-send-email-ryans.lee@maximintegrated.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1504301708-24389-1-git-send-email-ryans.lee@maximintegrated.com> References: <1504301708-24389-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: MWHPR18CA0034.namprd18.prod.outlook.com (10.175.9.148) To CY1PR11MB0843.namprd11.prod.outlook.com (10.163.237.21) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1b701ecb-60df-4085-484a-08d4f1817730 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(300000502095)(300135100095)(22001)(2017030254152)(48565401081)(300000503095)(300135400095)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:CY1PR11MB0843; X-Microsoft-Exchange-Diagnostics: 1;CY1PR11MB0843;3:Rve7EQ2ioXlzn9jgZTHwhix20glheK73+eRVtnucIPXRNMp13098W5cYT6IuDXkWEVKYpYPIqLAEN9gKIHURiJOrrAzM2zKah3lCRsGL/SETHSRwl9caC/0B3pWb7bs4dB3F4eb7FhxRWf6b7e3/R23TjvGzZlCu70gLDu2a673A8+ZUzmhQncsJbxqWpfctGJioiRAwx2NICP3M1V+iLaBCifzCR49jYcV5b5ATSmAiZjhY+nLIjiQFNJezM46Y;25:9udZxcyKpWNbSb6UwQOLRu5BVvCtjGGhximrKkkkA1dSNajknFXcxPj+hwx0OSf0EwebXB2lzoX169wI+mql3M8YAViSuARMqNAkWZgjvcvAAfyLlIvd5vFpLVNYdqea1wN/ldINQJgY8GXRcQP2nhKtlw4F736QiF1s73bB4qe79CzkebgD/4kfOirAY9pWef9qnzQ7xmLU04euaIwnSX1nVPBQ9L4qFi12TjJlYcWJfM87BBpQT2WlzPzRSmBA9mPWWc/9B7IJRzA7NW9R6M6I65IFp1WCH6YM5S4571471g4Sg7cNwbYs49UQ1844ESWMJVtX/T/23FXJeQW8fg==;31:TQhti+NTiY1avSgKA4+2rP+dd1T7oPV0xDOO7tbqAk0dk6oVMTYR55z5oj6NQk+a4V1fHDGaSGSETAA2UDWN1hJXzYhCLtibMLi5Op69//tNbzq+Y5wGNIaNG6Wmig6fWy9sIXN8j5cgFLrn84NmeXYMz5/46kFl51lKLMM4PTjJdUbiDIvOvVOUXe42tsqc0bm3Bzg7hXMZwnXlIAsFYujT5MN93DiCDGZML7Ao+IE= X-MS-TrafficTypeDiagnostic: CY1PR11MB0843: X-Microsoft-Exchange-Diagnostics: 1;CY1PR11MB0843;20:5yN+KjVI+cjjDEcJqESgyIjYVcKl71OytPywg9C5Ro6VxSSrqBA0CtmeSaVATymP6fQSv1ijIdaHdmeZK/mlNTWsiVWLa47i/tWCNXcCxUdfn9+gGYuuSguYzV015wpDLTHRlm96JTk18vPvfDWpYjTy7HfRgQVLUZnCJpnxNkkiK+Nq2J0UHrhCmWJumAPlKTDo6Ro7DrV3PbKhCBtslo5BEs66Y/EGkyHSnGWKRSRq2Jqvr4R/pr98HIJyJ5DVXTKh1BwiI+GEgYrE5hK/7/0qBB55A8Cqmx82vljFgSRDD5iTGQa6WOEIwQNEAcoKxZUBUs1iPBtXPWv+M3Z7cX2VAyD2Os8rSiXjaYVB3hPgqVIybbOVgKdSw7u1hnSC2ocaboKRleYyIJ0j2EIItVOczoatbG/lP18MljMbDI/u7DZT4rEmqc789q+sdeKw8evQcqnDS6B5hzaEmNn+q33l5sbzj6UWxNsuT0HsJEmc/K2GqXktU6DxbJdNOe0p;4:9DoJfhHUVwQmvdR8N7jZjSpr2wriNP4TbDrN2UER8BtN0bJPpiJEBV/uYUzDixuLtb3ZcB3vqv1wYwejklw8/QsgKhWkix+gaR+537mrF7MqYPWAJbZIRmPfvvRq6IU+PG5MseJBZhE6TGD9PPE8WxNsYP29Rn+AuLs/Dzv1DWrZ+gxTDVQeDEjBwSoeCyV3sGVvoi6CtFyXn+UVCJWc9aN99OgjRZjF/uIqwbZhI1JkRLy8CM4ZdVFu2CT/gvw8TBfgSBHfIPmOSqQsJB0Kh56hzl74bjqeNYU2++0pTtE= 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)(5005006)(8121501046)(3002001)(93006095)(93001095)(10201501046)(100000703101)(100105400095)(6055026)(6041248)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(20161123558100)(20161123562025)(20161123564025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:CY1PR11MB0843;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:CY1PR11MB0843; X-Forefront-PRVS: 0417A3FFD2 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6009001)(39860400002)(189002)(199003)(54534003)(7736002)(5003940100001)(2906002)(53936002)(305945005)(3846002)(6116002)(478600001)(66066001)(5660300001)(4326008)(8676002)(33646002)(76176999)(189998001)(81156014)(81166006)(6666003)(25786009)(50986999)(2950100002)(86362001)(36756003)(69596002)(53416004)(6512007)(8936002)(50226002)(6486002)(39060400002)(110136004)(106356001)(68736007)(42186005)(6506006)(105586002)(97736004)(50466002)(72206003)(101416001)(47776003)(48376002);DIR:OUT;SFP:1102;SCL:1;SRVR:CY1PR11MB0843;H:ryan-ThinkPad-T430.maxim-ic.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;CY1PR11MB0843;23:TOjaGAppFPKH5sOByNOTggGyxhdGZEDJ3qO0rajH8?= =?us-ascii?Q?NQ/AQY2vgRL4d3PCUt3gnM3mqWd6OnZiRhmYvio/cFCpQCOpgwLN7jfnhN+Q?= =?us-ascii?Q?KpYyEJUNYOQewTsa8U1be5dMwhR00aEpLLrfIKIAeM5DdWru6LzQ3vpfKKGU?= =?us-ascii?Q?dJMrnNRhj053dcSmUSoHWhlrd3KGVQthPkKllsMmdhRZawcljaJTSVueMWka?= =?us-ascii?Q?0w/msej6cRqYQoo3YRWQ7CYVyqcwvjdCxT9vYiyPVux4PeoE/1bL7bzWb3DM?= =?us-ascii?Q?Nr0Q8cZhk8b2VaRmj26zgpb5Ak5mMUKCoMR31BAdczWvT/AWbemgzvr97Swe?= =?us-ascii?Q?RUD3CVtIJs+9HC30PG1yVAYVU3E5QRK0a3a/6JoGKouEIfwGOE6m6UfZ3IRY?= =?us-ascii?Q?GlAr6pxmI2Nff9JmUiqyA0Lyxq8CAGg9P1+pWWHiA4IWz90PzOwUefe5CQW/?= =?us-ascii?Q?rNnCkpD5ilS2LwfaKPeBUUnato/C1OmD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h0mS35VGobVGt/xNWN3F+Jn/FbznaG8Gw0aEnerDYJdPvq4dNK41x3ZVvAvdP1sSP+MApVYAFXgDC7uSgnJ+hAkSxLcanRlMOTq5WaXPH2jpttWmsag==;5:0Pr/7Pym5z1ig2PgPRSPQypgAa44vJkskDYp/LtJFnbCN8Yl5U1/c0wqoIIxkbfVc9S8bsPjZ/8ef6s7I9lLeei7LSkwjt4L/z1ZmY4krrPyQUT/Po/pESWk2+BTseXCXSRfR64Hg4y8wL/kqBHx0g==;24:xxpDgBsWOoAp9w9CX0yugm066mjUWxLcmhTClko6cWTMen8ovPVoHKhaAfAk+TkDQLKFPPdGBuML6REX30BNHQNt7ppFOnoOGnhOoH72BdA=;7:R93md0LiouQ9IOtsWvBN8fl6tNxCFFekQXoO4yiLyTRbpJhqO7muuhVlGMSer+w6SvAg3WcIw/lkd1btJiToHdV3x5yLFBV5TOTXkwfMC/BLuRBBLzKvA2joLLzAaDJ8jE8g52REIC3bjLRFmmK1dfqfFaP0uid94GVUXBoWTu2BFVb2wu0CJdRUVCuJMHzeYAQClBONk+SfmvBnsAEdxe/5PYfByu6Q83w1d2vje5E= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: maximintegrated.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Sep 2017 21:36:11.3654 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fbd909df-ea69-4788-a554-f24b7854ad03 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR11MB0843 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2720 Lines: 72 Signed-off-by: Ryan Lee --- Changelog: Added one control to set different headroom value for envelop tracking function. Added one more control to enable/disable envelop tracking function. Removed writing process to register 0x0087 because it is read only register. sound/soc/codecs/max98927.c | 19 +++++++++++++++---- sound/soc/codecs/max98927.h | 4 ++++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/sound/soc/codecs/max98927.c b/sound/soc/codecs/max98927.c index a1d3935..73c7a33 100644 --- a/sound/soc/codecs/max98927.c +++ b/sound/soc/codecs/max98927.c @@ -624,6 +624,18 @@ static SOC_ENUM_SINGLE_DECL(max98927_current_limit, MAX98927_R0042_BOOST_CTRL1, 1, max98927_current_limit_text); +static const char * const max98927_env_track_headroom_text[] = { + "0.000V", "0.125V", "0.250V", "0.375V", "0.500V", "0.625V", + "0.750V", "0.875V", "1.000V", "1.125V", "1.250V", "1.375V", + "1.500V", "1.625V", "1.750V", "1.875V", "2.000V", "2.125V", + "2.250V", "2.375V", "2.500V", "2.625V", "2.750V", "2.875V", + "3.000V", "3.125V", "3.250V", "3.375V", "3.500V" +}; + +static SOC_ENUM_SINGLE_DECL(max98927_env_track_headroom, + MAX98927_R0082_ENV_TRACK_VOUT_HEADROOM, 0, + max98927_env_track_headroom_text); + static const struct snd_kcontrol_new max98927_snd_controls[] = { SOC_SINGLE_TLV("Speaker Volume", MAX98927_R003C_SPK_GAIN, 0, 6, 0, @@ -641,6 +653,9 @@ static SOC_ENUM_SINGLE_DECL(max98927_current_limit, MAX98927_AMP_VOL_SEL_SHIFT, 1, 0), SOC_ENUM("Boost Output Voltage", max98927_boost_voltage), SOC_ENUM("Current Limit", max98927_current_limit), + SOC_SINGLE("EnvTrack Switch", MAX98927_R0086_ENV_TRACK_CTRL, + MAX98927_ENV_TRACKER_EN_SHIFT, 1, 0), + SOC_ENUM("EnvTrack Headroom", max98927_env_track_headroom), }; static const struct snd_soc_dapm_route max98927_audio_map[] = { @@ -744,10 +759,6 @@ static int max98927_probe(struct snd_soc_codec *codec) regmap_write(max98927->regmap, MAX98927_R0086_ENV_TRACK_CTRL, 0x01); - regmap_write(max98927->regmap, - MAX98927_R0087_ENV_TRACK_BOOST_VOUT_READ, - 0x10); - /* voltage, current slot configuration */ regmap_write(max98927->regmap, MAX98927_R001E_PCM_TX_CH_SRC_A, diff --git a/sound/soc/codecs/max98927.h b/sound/soc/codecs/max98927.h index 9ea8397..98b5f17 100644 --- a/sound/soc/codecs/max98927.h +++ b/sound/soc/codecs/max98927.h @@ -250,6 +250,10 @@ #define MAX98927_BROWNOUT_DSP_EN (0x1 << 2) #define MAX98927_BROWNOUT_DSP_SHIFT (2) +/* MAX98927_R0086_ENV_TRACK_CTRL */ +#define MAX98927_ENV_TRACKER_EN (0x1 << 0) +#define MAX98927_ENV_TRACKER_EN_SHIFT (0) + /* MAX98927_R0100_SOFT_RESET */ #define MAX98927_SOFT_RESET (0x1 << 0) -- 1.9.1