From patchwork Tue Jul 25 23:48:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 108719 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp165728qge; Tue, 25 Jul 2017 16:48:42 -0700 (PDT) X-Received: by 10.99.100.198 with SMTP id y189mr20837437pgb.355.1501026522381; Tue, 25 Jul 2017 16:48:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501026522; cv=none; d=google.com; s=arc-20160816; b=dQ/H3SOAlv7mHCwTHPzyIgwiejwWYMJB8XWVDE0tOXuPk6kGVGNTvcBvpm8Bfh/6N+ yDt9FEDO1dzETxJ2ieh9BJ+eNVQZprGzV9oWXqFEqV+iEpw6mWkKqOGu4cWfv8bWsePE /As9um3Fza4kjbbX0PTXxV/G2ci7rv/Yji42cTVvsf7Nt36/cTlCbaaboM9J9fiDA9sf CYuLcmu48PMxlnY8YUftR7QVJELvb5Ucg7oyzWe02bfZfLo3SwucxtD/s+Zfn0Wt8Nug qF1100BF2EAAtkv/jDl0F+GmkiWWerMU+D6s6RVxWYY9qCnmptTmfWLGtfJq9bxRAXOF zl3Q== 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=y2t+/HvjCBuSn7V5226BnEqQi5KVkgLpmar9UDTVGjLKZeJOo70ZjBjyGfeTpIZScP myZ5gc2Wx25Zjtz88wT1ZVNkPPmgr8JrGVs4ajhZwMx4bRjM0Z0r5HCcHowqgAjT6ThR k0K9Oc5VthpT83aVnL9CFN8Ji1fyDlLwIOOWoh1nz8MjdsNi1ktmvBNVipQthafOis5f yF8FIv8Dl0/VVayW2YLu7+1mba9GeThaYz2SaMDboPVmA5KDuwIaTOSvimskYquBMOgT qlTvWLA5HfRCy/G+Zk3QqzSQtjeMg/mjfV/zjmASwBQYRcQma8ZBow33Ksz5IuYzT72Q YFWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=iIpHm2nN; 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 a61si7492548plc.914.2017.07.25.16.48.42; Tue, 25 Jul 2017 16:48:42 -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=iIpHm2nN; 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 S1751828AbdGYXsj (ORCPT + 26 others); Tue, 25 Jul 2017 19:48:39 -0400 Received: from mail-io0-f182.google.com ([209.85.223.182]:38630 "EHLO mail-io0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751796AbdGYXsf (ORCPT ); Tue, 25 Jul 2017 19:48:35 -0400 Received: by mail-io0-f182.google.com with SMTP id g13so61724695ioj.5 for ; Tue, 25 Jul 2017 16:48:35 -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=iIpHm2nN81KkLotZUVyx5A7z3BAGlXo9sAqxyL3iDt+9eU09/LgJP1vx3YZN0jXrCT edX2tZgOEe8oc4hZiRmakcOl/Tm47l/VBuskYH6xTLoRajd1eVNSmyQ13so4P4WvH/hQ TTCA3+bVAgM+Wz1X4yOZBV9v9L6VnYuClcXKo= 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=CIUTLxRtbfp2VpI6fuD7tSRolCwJ6CzT/ISHAmJL/PAbP77UZAHTu862GYMlg21cRA ZbnfNvY1sMdsoyG/Agxx2tZN/apbI7VpuE10MaXgK3JmuzoFVNxsx7GK5BGTqoHvLXoi 8wKyjqSTBY15aLGJ593WcWz9Co0XjGG/Oif0Q93fKeOuuWHPVLtpC6xFaKvbDl9+1ykH 6unGqUVLfNA6WHDYS5d6Yr5XLXt1YE0vKrx4+PrjyXClcxETEqForJ0FtzK3s16s2Cl6 zOxq3lP/Rq7AW3sazPt3rJUZzeATwGvGMRy8MANA2DajMutPDqoD3rFHa46nqXnI74j/ mtnA== X-Gm-Message-State: AIVw111vSTytG+yUpgL40prK2tHwvUBhM6rhMSGMRyzdGOikgtvsHUyT SST8rfgH9vGQeSJx X-Received: by 10.107.10.28 with SMTP id u28mr20937763ioi.172.1501026515048; Tue, 25 Jul 2017 16:48:35 -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 m15sm5521463iti.9.2017.07.25.16.48.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 25 Jul 2017 16:48:34 -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 v2 2/3] ASoC: qcom: apq8016-sbc: set default mclk rate Date: Wed, 26 Jul 2017 01:48:21 +0200 Message-Id: <20170725234822.18763-3-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170725234822.18763-1-srinivas.kandagatla@linaro.org> References: <20170725234822.18763-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)