Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3764127pxk; Tue, 8 Sep 2020 01:37:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzMbf4IhV81y9Vmew2XUW7khzULZbMhryGuuJfNcylzK87oo05ksaMMqKK91UpzHgS9I/Gc X-Received: by 2002:a50:e004:: with SMTP id e4mr25628521edl.114.1599554260254; Tue, 08 Sep 2020 01:37:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599554260; cv=none; d=google.com; s=arc-20160816; b=dZ/Dy31qrb/HzS6xKB1g7l0lv1AXteS4314wAGreAZtRvBlch+FE9tsPhxpHQZ/iHp iNNIidcDZ+6LInx8RHUvStuzFG9EzI0SjgFqvE1Vmi5zx91jkYDIHWUhSJMzDsb7yvxn NLCbOcl21SNWTsTyXqtIVjR8d6O+e6hO3dYER2j7fTUIKmD+aFX2+OxaNZwxLBSe1ziq bSEByMKBMRKfnBkjbigKATN5D9Jj/HQw4XZte09/nEY+JXj/6SC7fZkyiskXGMbfhGA3 Dpuv9gDeVhSMv2ufr9cm/ki9/XVT40TO87P6nbvEKFvRDZO1MAa0NM+Ov4arzvCvihQd 8s6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :ironport-sdr:dkim-signature; bh=xp2jtEwWlIVWqx9i65+JtXtOEPvP+lssrgvRxVi0wCI=; b=NG6ey/klrLm4qkVD/2aeFX+3HBHmoRPtKSy/P0cSIxaUvPEYJ3AXPyOUU6j2bFU07n JMku3mP5A2+ON9Uj9xXn6lrXiCAs1JmRqwL7pa2kn1g3tTebERpCjSRfItTe+cMPNkVN ji3XekLM174YXiDGrJ3rI+r1v0t8G7wHnA1zTrxx8ZohqJlUpFyCIu1ckBz2+1YlcLMu +4VhcLXd3K5eP3iGn/JTYphmQgQHwOKBDcZLnL27vFweOoJRhi2xUHJV0v6Jp+8fPLH+ N2YaLbYXrl7ijxfdGEYZp52F1HbevTMjdyl7m3QROx72E5fZGbRj2gzULGTuUyotETXr CGRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@axis.com header.s=axis-central1 header.b=V24crpU+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=axis.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i21si11232416eje.143.2020.09.08.01.37.17; Tue, 08 Sep 2020 01:37:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@axis.com header.s=axis-central1 header.b=V24crpU+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=axis.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730117AbgIHIfm (ORCPT + 99 others); Tue, 8 Sep 2020 04:35:42 -0400 Received: from smtp1.axis.com ([195.60.68.17]:1668 "EHLO smtp1.axis.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729629AbgIHIfi (ORCPT ); Tue, 8 Sep 2020 04:35:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; l=1856; q=dns/txt; s=axis-central1; t=1599554137; x=1631090137; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xp2jtEwWlIVWqx9i65+JtXtOEPvP+lssrgvRxVi0wCI=; b=V24crpU+c1xlqJyJpoVKYrcp954FXp+zxM5BBBfhtgXlnmOBnu2LLq2s ZY50tN2wy7NwVfc0VszTRNhpXiWZELP5M9dv38ARY2zkA+rhbhRYLhiJk TjHiuV7MzejCgosVpfBA13qlrH62TjDVfmDQDeegQb6uSSYZq6HIhyQHK aaQvyLUMQJsE0utWo8JAAOZNCx6GudGB8csYECd/8QRQ81KO92syiMTkQ Eam+mA8nDB9DJ6NE9eVM5EXJSI3lO1BUD5ixgrZKtyIWcPJ3DAh697ZGm OmJUUQ44cRb/dUGE72BExwiomludkDOtHI1T00cRnXUfPJkgEML4UMQ6l Q==; IronPort-SDR: SUM5QoENwhtyx2B6qE8P7GTzyoyjJY/j3tg8kW/LjcD9A9JjlDi8579OLER5ex99nYk/jFJQiZ 71ngP+kiNNrKNgMVcvLmi2Q9teAg86SsJtZk7szJhtFQ6y7GuXbizqNStR5BLurjxR2VZLy1cN JOkQZma0/nTQuUC1vdIECEpZNKsXpLViSrZJcQ4XoyvCe6bAyHSvvFKe9Oa8I+DskxYlRFeE3k jDm19QdWRfM4un6np6SmHs0zXO7qHJaK/KwtAQzaCbnIH6pv8zotoXnBVsl+F4rgAJ36UMTkHq nr4= X-IronPort-AV: E=Sophos;i="5.76,405,1592863200"; d="scan'208";a="12651992" From: Camel Guo To: , , , CC: , , , Camel Guo Subject: [PATCH 2/2] ASoC: tlv320adcx140: Wake up codec before accessing register Date: Tue, 8 Sep 2020 10:35:21 +0200 Message-ID: <20200908083521.14105-2-camel.guo@axis.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200908083521.14105-1-camel.guo@axis.com> References: <20200908083521.14105-1-camel.guo@axis.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Camel Guo According to its datasheet, after reset this codec goes into sleep mode. In this mode, any register accessing should be avoided except for exiting sleep mode. Hence this commit moves SLEEP_CFG access before any register accessing. Signed-off-by: Camel Guo --- sound/soc/codecs/tlv320adcx140.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/sound/soc/codecs/tlv320adcx140.c b/sound/soc/codecs/tlv320adcx140.c index 597dd1062943..6d456aa269ad 100644 --- a/sound/soc/codecs/tlv320adcx140.c +++ b/sound/soc/codecs/tlv320adcx140.c @@ -842,6 +842,18 @@ static int adcx140_codec_probe(struct snd_soc_component *component) if (ret) goto out; + if (adcx140->supply_areg == NULL) + sleep_cfg_val |= ADCX140_AREG_INTERNAL; + + ret = regmap_write(adcx140->regmap, ADCX140_SLEEP_CFG, sleep_cfg_val); + if (ret) { + dev_err(adcx140->dev, "setting sleep config failed %d\n", ret); + goto out; + } + + /* 8.4.3: Wait >= 1ms after entering active mode. */ + usleep_range(1000, 100000); + pdm_count = device_property_count_u32(adcx140->dev, "ti,pdm-edge-select"); if (pdm_count <= ADCX140_NUM_PDM_EDGES && pdm_count > 0) { @@ -889,18 +901,6 @@ static int adcx140_codec_probe(struct snd_soc_component *component) if (ret) goto out; - if (adcx140->supply_areg == NULL) - sleep_cfg_val |= ADCX140_AREG_INTERNAL; - - ret = regmap_write(adcx140->regmap, ADCX140_SLEEP_CFG, sleep_cfg_val); - if (ret) { - dev_err(adcx140->dev, "setting sleep config failed %d\n", ret); - goto out; - } - - /* 8.4.3: Wait >= 1ms after entering active mode. */ - usleep_range(1000, 100000); - ret = regmap_update_bits(adcx140->regmap, ADCX140_BIAS_CFG, ADCX140_MIC_BIAS_VAL_MSK | ADCX140_MIC_BIAS_VREF_MSK, bias_cfg); -- 2.20.1