From patchwork Wed Aug 2 13:17:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 109218 Delivered-To: patch@linaro.org Received: by 10.140.101.6 with SMTP id t6csp2772814qge; Wed, 2 Aug 2017 06:18:40 -0700 (PDT) X-Received: by 10.99.181.29 with SMTP id y29mr17412971pge.135.1501679920248; Wed, 02 Aug 2017 06:18:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501679920; cv=none; d=google.com; s=arc-20160816; b=YUkjnHaLBcwVfKorvm96tPFMcRFKEEBHDPKlRwsIiWFeFvEulKp5NIL2s5tszHMBaY wbBnRNOIu6Gy08h0LOibNr2DnzB43Mh2nlDs827F6fWqsPjunAT3a6ZsaM+9v9V2kpi7 K+6fysfA/bmB0hBkiq+A7AqtGZ2/sNMCGLtvho3M8Wz0aP8FThAqDYFGs7jsTowpvW7Q EjmkWw4BG/V20sUpNwUC8qignmxDwfJ/0zoqpyrpFbKPEUDg88TPogZQQ9xwWKkz8ceO 4dn8v6ZZrQFT6PNkx7jyK16vYmWEMpMXY84OnVZyOkBZmvC7Nnf+Eg9eXhIleWS04XZz CVzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=p/jaAf6BmnVZoukyOZ3FpA2j8jlfdNYAxGO0q0KYVPU=; b=0Mihh9JuujqtdLd0ibXHeCaXGIGz7k+0t4OfL392HRBwCzfKQVY49OC+zoeI4hhovd X5q626bat/5xL4wlENFm298XRb2Ugb0O3Xl0oF0KspspIAbLVNgwJodfifb3OsE6EkY2 /caKqjbxnOv2PdGmocX2aHvQaJopes9DH6BafRDcCiZOT8rXgpTv9mVl+d3wKEeDfSAy 3cpjeZ3EqicMbo2c8Vu8e+IjUMQlWX/luL/l++WkZ1T95koxcjlc5KSqbI4nEZqXa1Nd WlZcykThCvwuNOS5vXes+LYvcXxVWxqnYWa64A4X2jRrTi1urdF5pLKqhbkdo2AplqZS 6ong== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=HG9/PX7a; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j91si21285400pld.637.2017.08.02.06.18.39; Wed, 02 Aug 2017 06:18:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.b=HG9/PX7a; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752247AbdHBNSh (ORCPT + 25 others); Wed, 2 Aug 2017 09:18:37 -0400 Received: from mail-it0-f44.google.com ([209.85.214.44]:35333 "EHLO mail-it0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752005AbdHBNSH (ORCPT ); Wed, 2 Aug 2017 09:18:07 -0400 Received: by mail-it0-f44.google.com with SMTP id h199so23560045ith.0 for ; Wed, 02 Aug 2017 06:18:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=p/jaAf6BmnVZoukyOZ3FpA2j8jlfdNYAxGO0q0KYVPU=; b=HG9/PX7ahde5pLWLs6H5YQG4H5Tg3jcRcth5y7pMdWsA0VpAmOW/45wZQ0paiBcLtL UBQsa11Zif3mN/5EMug65CPPjcSR8mkg79WTzQTXqCX+JQOxD1uH/S6/Ahew0Co19IS3 xNaxgqpZCICV1zv+aIUAAkwA9TX1FS1gKRikk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=p/jaAf6BmnVZoukyOZ3FpA2j8jlfdNYAxGO0q0KYVPU=; b=uXWA5l9LWlP8PI+IEhlHHlKzAOYUPXXL7PveHp77l2PUIKPgYOaoR7O6Sax0qn0kH6 6f5ihsZlCTmcKdyrPfW4UlxfftfSuMR+KEIxgNrO0AYJf82HM/xPSduFTwTMA1bD94/C pnUSGpJYhOIELhz1Dod9jUG8Tlyeuly6C27ptGjVV0EV9Z69vhN5LXHrckjtvsI66q8J T1d+V2j00X6pS9uLZdYGvybasmG0wzoZDtUscOXIE4Un0CzJgOX5pK7382/4loBtvpDC ZElHH05FSC74k9z+Evy1cGOEgee6D402WQWbkkhdqqopEbPbu9W/1giVP14qRJzmTw3F zu3w== X-Gm-Message-State: AIVw110HwFWPp6neyak8dMbc72ZwY9tdG/SrtuXvmSV1yvVvy7XfD/u1 lBe0xlMV5AuxaCYT X-Received: by 10.36.29.212 with SMTP id 203mr5414767itj.103.1501679887115; Wed, 02 Aug 2017 06:18:07 -0700 (PDT) Received: from localhost.localdomain (static.8.26.4.46.clients.your-server.de. [46.4.26.8]) by smtp.gmail.com with ESMTPSA id f8sm1406724itc.26.2017.08.02.06.18.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 02 Aug 2017 06:18:06 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: Mark Brown , Banajit Goswami , alsa-devel@alsa-project.org Cc: Jaroslav Kysela , Takashi Iwai , Patrick Lai , linux-kernel@vger.kernel.org, Srinivas Kandagatla Subject: [PATCH v3 2/3] ASoC: qcom: apq8016-sbc: set default mclk rate Date: Wed, 2 Aug 2017 15:17:47 +0200 Message-Id: <20170802131748.10958-3-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170802131748.10958-1-srinivas.kandagatla@linaro.org> References: <20170802131748.10958-1-srinivas.kandagatla@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Srinivas Kandagatla MCLK for internal audio codec is expected to be at 9.6MHz by default. This patch adds support to 9.6MHz to make the default case possible. Signed-off-by: Srinivas Kandagatla --- sound/soc/qcom/apq8016_sbc.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) -- 2.9.3 diff --git a/sound/soc/qcom/apq8016_sbc.c b/sound/soc/qcom/apq8016_sbc.c index d084d74..f07aa1e 100644 --- a/sound/soc/qcom/apq8016_sbc.c +++ b/sound/soc/qcom/apq8016_sbc.c @@ -34,13 +34,16 @@ struct apq8016_sbc_data { #define MIC_CTRL_QUA_WS_SLAVE_SEL_10 BIT(17) #define MIC_CTRL_TLMM_SCLK_EN BIT(1) #define SPKR_CTL_PRI_WS_SLAVE_SEL_11 (BIT(17) | BIT(16)) +#define DEFAULT_MCLK_RATE 9600000 static int apq8016_sbc_dai_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_dai *cpu_dai = rtd->cpu_dai; + struct snd_soc_codec *codec; + struct snd_soc_dai_link *dai_link = rtd->dai_link; struct snd_soc_card *card = rtd->card; struct apq8016_sbc_data *pdata = snd_soc_card_get_drvdata(card); - int rval = 0; + int i, rval; switch (cpu_dai->id) { case MI2S_PRIMARY: @@ -63,12 +66,24 @@ static int apq8016_sbc_dai_init(struct snd_soc_pcm_runtime *rtd) default: dev_err(card->dev, "unsupported cpu dai configuration\n"); - rval = -EINVAL; - break; + return -EINVAL; + + } + for (i = 0 ; i < dai_link->num_codecs; i++) { + struct snd_soc_dai *dai = rtd->codec_dais[i]; + + codec = dai->codec; + /* Set default mclk for internal codec */ + rval = snd_soc_codec_set_sysclk(codec, 0, 0, DEFAULT_MCLK_RATE, + SND_SOC_CLOCK_IN); + if (rval != 0 && rval != -ENOTSUPP) { + dev_warn(card->dev, "Failed to set mclk: %d\n", rval); + return rval; + } } - return rval; + return 0; } static struct apq8016_sbc_data *apq8016_sbc_parse_of(struct snd_soc_card *card)