Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752182AbdCCTkS (ORCPT ); Fri, 3 Mar 2017 14:40:18 -0500 Received: from mail-sn1nam01on0115.outbound.protection.outlook.com ([104.47.32.115]:19744 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751722AbdCCTkB (ORCPT ); Fri, 3 Mar 2017 14:40:01 -0500 Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=maximintegrated.com; From: Ryan Lee To: , , , , , , , , , , , , , , , , , , , , CC: Subject: [PATCH 07/10] Modified initialization code of VI sensing Date: Fri, 3 Mar 2017 23:52:45 +0900 Message-ID: <1488552768-14901-8-git-send-email-ryans.lee@maximintegrated.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488552768-14901-1-git-send-email-ryans.lee@maximintegrated.com> References: <1488552768-14901-1-git-send-email-ryans.lee@maximintegrated.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [222.234.201.146] X-ClientProxiedBy: KL1PR02CA0031.apcprd02.prod.outlook.com (10.165.15.41) To CY4PR11MB1367.namprd11.prod.outlook.com (10.173.16.149) X-MS-Office365-Filtering-Correlation-Id: d830e079-bc10-402d-9a7a-08d462452da9 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(48565401081);SRVR:CY4PR11MB1367; X-Microsoft-Exchange-Diagnostics: 1;CY4PR11MB1367;3:O9Lz5qb7hz0GomxQXvl2w6lfr5nF4LcIftrtb/V+Z5gQFgZt9vI8vYqC4LcCeTk4/1lbwQHHb9R7UKKaWlwYK0NNJr+8rwLyDJ02db+KMni2uKZaqf40K/rNRuJ8XIq9T1d5An1xA8eH2dJ5Ou+hn4FJ0rqLrS47K9gSQwcSt7K821qHCdkm686RyUVLjo87CArWzj8+Qz4SlZL73WVa8XxJpqgsK5W4WAHj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0hxpojluNLcDHe7f0aSFFKJBa4QOjZs56hp7M+afuMxbgH7oL2taZBpn7LgVy019fDkXfgRfKDbsLygiokVQeersKfHuLUJpPDYuXt3tz89LSf+komSsPsnni9E2J7/bSj8aP5b1bdt/X47CqcTDpTX9C4PtF5alN+oqByHmUkG2RVqpApU6xnXOKXK7FY6gOlhQs0zfLrNvuVrzMubGXbYly6EV0loZuXxKT5lmSNuSfWCwjY4Ee6KS01b8XW2wtiUAYNTgakCFbCWu866uD0oVckE7OMixU9wdtJ1179/cA7C66 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(108721460000369); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6055026)(6041248)(20161123560025)(20161123555025)(20161123564025)(20161123558025)(20161123562025)(6072148);SRVR:CY4PR11MB1367;BCL:0;PCL:0;RULEID:;SRVR:CY4PR11MB1367; X-Microsoft-Exchange-Diagnostics: 1;CY4PR11MB1367;4:yT2XrjGAtD2ozjGIUG/Uz1P4CBLMY5Nb2PLN3/pH/UxVsECU1V2ohQPEZw4tUq5UpZzTP4obb+4H8czOrA7/YPsykc/R64DZGBxqWrxNsYguH6mdzPYN8atouBitBEgAeGSxfsLVFVggMb26i0n+FIBp9Zt5A9gnKKwJa40Ydd0VztMN53U0Q7eBRDcnSpcacX3FKrXKnd7esgAV3iTGSgrxfWGtY+3DzKAyXBKfyO5AU3p9ZVqbTplYid5dIJF1JhF3nMZ2DZVqMdyxqc97idQDHmBXXbhq08kmFkNXCEGulvgfrv8C+MQ/qvtBAWLGxB0tgZLIOSc3eMfwqH39ZMWyqz6AURsbqpOFXoZ8dFZAyjemlP6fi28aA6a9uiHWKnCAsXgr+gdxcnlcLq7cFEIQr4WtpKJhcqZHz6xh/IG5Ad9eCkbdpSHgOV/qwCNcmGQ7LxfsRz/AffRhnzHRUIMkLiW54mNB4qJ8UK3syv0RBtuAQa1LqRoF1oH0J6r0fW2NMwSUqocZcZqcs5O8nPjp5G2j50t+e7Dv7lhKe8FKNuFcyo3hndxk77lFDLhG7vavtW8oH1mpDxv4gaaY2IebWkHBtp/rD0fXgOdYpj8yLSmMte/bR/ko8gyM8L6DjNLH3+p7MlNMRiGxR8Fhb2DueOBgFzVWo1OEWsR7/F4= X-Forefront-PRVS: 0235CBE7D0 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6009001)(7916002)(39850400002)(39410400002)(39840400002)(39450400003)(39860400002)(33646002)(86362001)(50986999)(5003940100001)(7416002)(25786008)(76176999)(2201001)(50226002)(189998001)(6512007)(2906002)(6486002)(6506006)(6666003)(53936002)(42186005)(53416004)(3846002)(305945005)(66066001)(6116002)(48376002)(50466002)(92566002)(8676002)(7736002)(47776003)(36756003)(2950100002)(5660300001)(4326008)(38730400002)(81166006)(921003)(1121003);DIR:OUT;SFP:1102;SCL:1;SRVR:CY4PR11MB1367;H:ryan-Lenovo-IdeaPad-Z510.maxim-ic.com;FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;CY4PR11MB1367;23:SLt1K8EXHElC6IT8PYJTYeWov2iG615gl5fiyHdOr?= =?us-ascii?Q?nQWd42XOdvqkcdNU6cr++Jqlm60nzDqrLLCqKA5M7x0Qql3NL5Gm0ViVISPj?= =?us-ascii?Q?X18J5kKSAQ69Nm4l/hxxGf+T4fOT7shrvW2bKz3o5Y9B6aXILmZNu3b1VyP2?= =?us-ascii?Q?0Aej7f6jrJDBi0om7W+YrTlyag6rIA715yj/tj53bkrznrvurqf6wCxIEU74?= =?us-ascii?Q?R7boFORrdFwQqmjrIL+6JO6N5Snj3qkIbkS3fwMyM/pxn0PtjELArbBSyQKs?= =?us-ascii?Q?KUaa1wwfSekNHBUCq9d4qWwhL4nJbVIHNWjaEjDUlXDUsNViozT0psEbqynQ?= =?us-ascii?Q?Y/OJW50dX/8ppk5pwiNHMkc9YBYDL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yjs/19ZIckI9Xxov6hInP0xG6ky+993tfLO6A23LWTeX4xIVLBc+d0I+SUWNczmMyBGFAACfjEd6shljHpyHuvkr9fsGpPVUUrgvXMcaLZIyqEtNCZVZX+Erh26L4ugkfvjbRZDlySqYWdOOlptgN3D15wvBrDuoEeNiRAwegykffvNMEPiGMfGMOPMwbINFrfegt5IgBNJuNwfheWbawtMFb1k6nxmzx+W2iE/V1A/7Fp6Vhw+9x/U2cAyA++DNy+lrWwe6w8mW5x2P5NpfCdx0W8cC9ZYKi9BgokBIrrL/1xkW0wf83gw=;5:sbNN3V3VWQMg/hOuKN/J7L/ZCw+rodjhB0vC1acS8Z3gsH1c459A124gXlGr0HZNxgQRnjaMpsJ80zOil54sTDFTgN7f7HkuHh5nvyev9zKeECfwX3RYvd9Byqpr7Op1Cvlo0i2AEqF1PSJHGC+3jUiTuxswjm5qR3CwpsFLDTI=;24:KMvlT+ulMYEAGYy9vbxOGZCVodrYizjytIK/xMrPJYsSxoLIf+7JEoenW8EXvzv/HznDRi5Vp6RuC5nh/knysiLXISYUMrVXt2wtN6l/KxU= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;CY4PR11MB1367;7:PpMVHI7tdpSUin9BEfOanEmHukl5cDBQia2/O4F+7xMa43fiNWab1dYwa1nQieuIxWDarglHfVxz8QiZhw5MSXciGrNgnyTh171wFGapvh94ze4WnYpkWixM04Bj2temqqofrIHVAPFWnmkPjR1q+W5ToaTWKY4NZ3WsyGjAm5d++288g9Ce10IO+4Jn4HuDqnf8UBdaOxx5AcWVI8Heo+D/Iw0aHyIsNEyeFQodCrkbUgy1Tm9jTSdmiRsDgDA+a88RM1KzXOyFzf021X36ecpyorbuC1I5fNjgMNRyhzzVRGgWzOwZpdh/HTJp6db7dKzLtlaFlPtURs3GwQVPGQ== X-OriginatorOrg: maximintegrated.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Mar 2017 14:54:16.0394 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR11MB1367 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 8958 Lines: 282 Signed-off-by: Ryan Lee --- Initialization code of TX(VI sensing) had a problem for interleave mode configuration. Additional configuration for volume, DC blocker, Voltage/Current limit and ADC have been added. sound/soc/codecs/max98927.c | 195 +++++++++++++++++++++++++++++++++----------- 1 file changed, 146 insertions(+), 49 deletions(-) diff --git a/sound/soc/codecs/max98927.c b/sound/soc/codecs/max98927.c index 9e70883..df2f4ff 100755 --- a/sound/soc/codecs/max98927.c +++ b/sound/soc/codecs/max98927.c @@ -1,7 +1,7 @@ /* * max98927.c -- MAX98927 ALSA Soc Audio driver * - * Copyright 2013-15 Maxim Integrated Products + * Copyright (C) 2016 Maxim Integrated Products * Author: Ryan Lee * * This program is free software; you can redistribute it and/or modify it @@ -230,18 +230,12 @@ static int max98927_dai_set_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) max98927->iface, max98927->iface); /* pcm channel configuration */ - if (max98927->iface & (SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_LEFT_J)) { + if (max98927->iface & (SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_LEFT_J)) regmap_write(max98927->regmap, MAX98927_R0018_PCM_RX_EN_A, MAX98927_PCM_RX_CH0_EN| MAX98927_PCM_RX_CH1_EN); - regmap_write(max98927->regmap, - MAX98927_R0021_PCM_MASTER_MODE, - MAX98927_PCM_TX_CH0_EN| - MAX98927_PCM_TX_CH1_EN); - } - regmap_update_bits(max98927->regmap, MAX98927_R0020_PCM_MODE_CFG, - MAX98927_PCM_MODE_CFG_PCM_BCLKEDGE, invert); + return 0; } @@ -367,12 +361,27 @@ static int max98927_dai_hw_params(struct snd_pcm_substream *substream, goto err; } /* set DAI_SR to correct LRCLK frequency */ - regmap_update_bits(max98927->regmap, MAX98927_R0023_PCM_SR_SETUP1, - MAX98927_PCM_SR_SET1_SR_MASK, sampling_rate); - regmap_update_bits(max98927->regmap, MAX98927_R0024_PCM_SR_SETUP2, - MAX98927_PCM_SR_SET2_SR_MASK, sampling_rate<<4); - regmap_update_bits(max98927->regmap, MAX98927_R0024_PCM_SR_SETUP2, - MAX98927_PCM_SR_SET2_IVADC_SR_MASK, sampling_rate); + regmap_update_bits(max98927->regmap, + MAX98927_R0023_PCM_SR_SETUP1, + MAX98927_PCM_SR_SET1_SR_MASK, + sampling_rate); + regmap_update_bits(max98927->regmap, + MAX98927_R0024_PCM_SR_SETUP2, + MAX98927_PCM_SR_SET2_SR_MASK, + sampling_rate << MAX98927_PCM_SR_SET2_SR_SHIFT); + + /* set sampling rate of IV */ + if (max98927->interleave_mode && + sampling_rate > MAX98927_PCM_SR_SET1_SR_16000) + regmap_update_bits(max98927->regmap, + MAX98927_R0024_PCM_SR_SETUP2, + MAX98927_PCM_SR_SET2_IVADC_SR_MASK, + sampling_rate - 3); + else + regmap_update_bits(max98927->regmap, + MAX98927_R0024_PCM_SR_SETUP2, + MAX98927_PCM_SR_SET2_IVADC_SR_MASK, + sampling_rate); return max98927_set_clock(max98927, params); err: return -EINVAL; @@ -408,33 +417,28 @@ static int max98927_dac_event(struct snd_soc_dapm_widget *w, switch (event) { case SND_SOC_DAPM_POST_PMU: regmap_update_bits(max98927->regmap, - MAX98927_R003A_AMP_EN, 1, 1); - /* enable the v and i for vi feedback */ - regmap_update_bits(max98927->regmap, - MAX98927_R003E_MEAS_EN, - MAX98927_MEAS_V_EN, - MAX98927_MEAS_V_EN); + MAX98927_R003A_AMP_EN, + MAX98927_AMP_EN_MASK, 1); + /* enable VMON and IMON */ regmap_update_bits(max98927->regmap, MAX98927_R003E_MEAS_EN, - MAX98927_MEAS_I_EN, - MAX98927_MEAS_I_EN); + MAX98927_MEAS_V_EN | MAX98927_MEAS_I_EN, + MAX98927_MEAS_V_EN | MAX98927_MEAS_I_EN); regmap_update_bits(max98927->regmap, - MAX98927_GLOBAL_EN_MASK, 1, 1); + MAX98927_R00FF_GLOBAL_SHDN, + MAX98927_GLOBAL_EN_MASK, 1); break; case SND_SOC_DAPM_POST_PMD: regmap_update_bits(max98927->regmap, - MAX98927_R00FF_GLOBAL_SHDN, 1, 0); + MAX98927_R00FF_GLOBAL_SHDN, + MAX98927_GLOBAL_EN_MASK, 0); regmap_update_bits(max98927->regmap, - MAX98927_R003A_AMP_EN, 1, 0); - /* disable the v and i for vi feedback */ + 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, - 0); - regmap_update_bits(max98927->regmap, - MAX98927_R003E_MEAS_EN, - MAX98927_MEAS_I_EN, - 0); + MAX98927_MEAS_V_EN | MAX98927_MEAS_I_EN, 0); break; default: return 0; @@ -754,13 +758,107 @@ static int max98927_probe(struct snd_soc_codec *codec) dev_info(codec->dev, "MAX98927 revisionID: 0x%02X\n", reg); + /* IV default slot configuration */ + regmap_write(max98927->regmap, + MAX98927_R001C_PCM_TX_HIZ_CTRL_A, + 0xFF); + regmap_write(max98927->regmap, + MAX98927_R001D_PCM_TX_HIZ_CTRL_B, + 0xFF); + regmap_write(max98927->regmap, + MAX98927_R0025_PCM_TO_SPK_MONOMIX_A, + 0x80); + regmap_write(max98927->regmap, + MAX98927_R0026_PCM_TO_SPK_MONOMIX_B, + 0x1); + /* Set inital volume (+13dB) */ + regmap_write(max98927->regmap, + MAX98927_R0036_AMP_VOL_CTRL, + 0x38); + regmap_write(max98927->regmap, + MAX98927_R003C_SPK_GAIN, + 0x05); + /* Enable DC blocker */ + regmap_write(max98927->regmap, + MAX98927_R0037_AMP_DSP_CFG, + 0x03); + /* Enable IMON VMON DC blocker */ + regmap_write(max98927->regmap, + MAX98927_R003F_MEAS_DSP_CFG, + 0xF7); + /* Boost Output Voltage & Current limit */ + regmap_write(max98927->regmap, + MAX98927_R0040_BOOST_CTRL0, + 0x1C); + regmap_write(max98927->regmap, + MAX98927_R0042_BOOST_CTRL1, + 0x3E); + /* Measurement ADC config */ + regmap_write(max98927->regmap, + MAX98927_R0043_MEAS_ADC_CFG, + 0x04); + regmap_write(max98927->regmap, + MAX98927_R0044_MEAS_ADC_BASE_MSB, + 0x00); + regmap_write(max98927->regmap, + MAX98927_R0045_MEAS_ADC_BASE_LSB, + 0x24); + /* Brownout Level */ + regmap_write(max98927->regmap, + MAX98927_R007F_BROWNOUT_LVL4_AMP1_CTRL1, + 0x06); + /* Envelope Tracking configuration */ + regmap_write(max98927->regmap, + MAX98927_R0082_ENV_TRACK_VOUT_HEADROOM, + 0x08); + regmap_write(max98927->regmap, + MAX98927_R0086_ENV_TRACK_CTRL, + 0x01); + regmap_write(max98927->regmap, + MAX98927_R0087_ENV_TRACK_BOOST_VOUT_READ, + 0x10); - if (max98927->regmap) - regmap_write(max98927->regmap, - MAX98927_R001E_PCM_TX_CH_SRC_A, - ((max98927->i_l_slot << - MAX98927_PCM_TX_CH_SRC_A_I_SHIFT) - | max98927->v_l_slot) & 0xFF); + /* voltage, current slot configuration */ + regmap_write(max98927->regmap, + MAX98927_R001E_PCM_TX_CH_SRC_A, + (max98927->i_l_slot<v_l_slot)&0xFF); + + if (max98927->v_l_slot < 8) { + regmap_update_bits(max98927->regmap, + MAX98927_R001C_PCM_TX_HIZ_CTRL_A, + 1 << max98927->v_l_slot, 0); + regmap_update_bits(max98927->regmap, + MAX98927_R001A_PCM_TX_EN_A, + 1 << max98927->v_l_slot, + 1 << max98927->v_l_slot); + } else { + regmap_update_bits(max98927->regmap, + MAX98927_R001D_PCM_TX_HIZ_CTRL_B, + 1 << (max98927->v_l_slot - 8), 0); + regmap_update_bits(max98927->regmap, + MAX98927_R001B_PCM_TX_EN_B, + 1 << (max98927->v_l_slot - 8), + 1 << (max98927->v_l_slot - 8)); + } + + if (max98927->i_l_slot < 8) { + regmap_update_bits(max98927->regmap, + MAX98927_R001C_PCM_TX_HIZ_CTRL_A, + 1 << max98927->i_l_slot, 0); + regmap_update_bits(max98927->regmap, + MAX98927_R001A_PCM_TX_EN_A, + 1 << max98927->i_l_slot, + 1 << max98927->i_l_slot); + } else { + regmap_update_bits(max98927->regmap, + MAX98927_R001D_PCM_TX_HIZ_CTRL_B, + 1 << (max98927->i_l_slot - 8), 0); + regmap_update_bits(max98927->regmap, + MAX98927_R001B_PCM_TX_EN_B, + 1 << (max98927->i_l_slot - 8), + 1 << (max98927->i_l_slot - 8)); + } /* Set interleave mode */ if (max98927->interleave_mode) @@ -793,9 +891,10 @@ static const struct regmap_config max98927_regmap = { .cache_type = REGCACHE_RBTREE, }; -int probe_common(struct i2c_client *i2c, struct max98927_priv *max98927) +static void max98927_slot_config(struct i2c_client *i2c, + struct max98927_priv *max98927) { - int ret = 0, value; + int value; if (!of_property_read_u32(i2c->dev.of_node, "vmon-l-slot", &value)) max98927->v_l_slot = value & 0xF; @@ -805,13 +904,6 @@ int probe_common(struct i2c_client *i2c, struct max98927_priv *max98927) max98927->i_l_slot = value & 0xF; else max98927->i_l_slot = 1; - - ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_max98927, - max98927_dai, ARRAY_SIZE(max98927_dai)); - if (ret < 0) - dev_err(&i2c->dev, - "Failed to register codec: %d\n", ret); - return ret; } static int max98927_i2c_probe(struct i2c_client *i2c, @@ -850,9 +942,14 @@ static int max98927_i2c_probe(struct i2c_client *i2c, goto err; } + /* voltage/current slot configuration */ + max98927_slot_config(i2c, max98927); /* codec registeration */ - ret = probe_common(i2c, max98927); + ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_max98927, + max98927_dai, ARRAY_SIZE(max98927_dai)); + if (ret < 0) + dev_err(&i2c->dev, "Failed to register codec: %d\n", ret); return ret; -- 2.7.4