From patchwork Thu Apr 30 17:17:24 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 47865 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f69.google.com (mail-wg0-f69.google.com [74.125.82.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7C78E20553 for ; Thu, 30 Apr 2015 17:17:46 +0000 (UTC) Received: by wghm4 with SMTP id m4sf17131469wgh.2 for ; Thu, 30 Apr 2015 10:17:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=90loeOlyk/D2yj008VGacARFChNOJE08FlAAjnAX1+I=; b=YNYGMqcsi5GDGepa752OuAY/KZ/xlh3JLPN+1w4NryMoZSGl1HVJZN0LIORs/uDn34 aOX/gJsnoUqaUwX4xEtTnaP24jTpLiH7qkygTIH9O2Ard5WyO2rLj6gWK+l66FcmqZ/E tS6HK0tImZw1FkYcvnZ+S5RAotqaaZBSsqKhtLrxKGcVtl50WmKFVENIiXg9HwFvaieT raAHNrswpKeB0e6F97ROxto5grvYuSjbTYiG7lVcIMt1mjKuDtL0hlWhWmsFCyo7s4Zc FW7fr7A7er4zJ0yYrmuB34TJpujynLWD9CCnlUAUGSQaJjZu8erhAUukKS/bXVfCULOc CxjQ== X-Gm-Message-State: ALoCoQmjP8uvoirRWH4fYO3waSbQ50f34pnIGSwv9aILMRy6/706MdUALrDozj8XwuMoKnuRQuFK X-Received: by 10.112.171.41 with SMTP id ar9mr3110191lbc.24.1430414265774; Thu, 30 Apr 2015 10:17:45 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.2.70 with SMTP id 6ls382964las.14.gmail; Thu, 30 Apr 2015 10:17:45 -0700 (PDT) X-Received: by 10.152.5.7 with SMTP id o7mr4747351lao.51.1430414265526; Thu, 30 Apr 2015 10:17:45 -0700 (PDT) Received: from mail-la0-f41.google.com (mail-la0-f41.google.com. [209.85.215.41]) by mx.google.com with ESMTPS id wk8si2196031lbb.96.2015.04.30.10.17.45 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Apr 2015 10:17:45 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.41 as permitted sender) client-ip=209.85.215.41; Received: by labbd9 with SMTP id bd9so49487769lab.2 for ; Thu, 30 Apr 2015 10:17:45 -0700 (PDT) X-Received: by 10.112.13.6 with SMTP id d6mr3449731lbc.117.1430414265436; Thu, 30 Apr 2015 10:17:45 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.67.65 with SMTP id l1csp3242805lbt; Thu, 30 Apr 2015 10:17:44 -0700 (PDT) X-Received: by 10.68.102.161 with SMTP id fp1mr10266821pbb.64.1430414260297; Thu, 30 Apr 2015 10:17:40 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id tl4si4322695pbc.226.2015.04.30.10.17.39; Thu, 30 Apr 2015 10:17:40 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752545AbbD3RRe (ORCPT + 28 others); Thu, 30 Apr 2015 13:17:34 -0400 Received: from mail-wi0-f177.google.com ([209.85.212.177]:34674 "EHLO mail-wi0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752417AbbD3RR3 (ORCPT ); Thu, 30 Apr 2015 13:17:29 -0400 Received: by wicmx19 with SMTP id mx19so17953815wic.1 for ; Thu, 30 Apr 2015 10:17:28 -0700 (PDT) X-Received: by 10.180.7.133 with SMTP id j5mr7519458wia.84.1430414248298; Thu, 30 Apr 2015 10:17:28 -0700 (PDT) Received: from srini-ThinkPad-X1-Carbon-2nd.dlink.com (host-2-98-219-188.as13285.net. [2.98.219.188]) by mx.google.com with ESMTPSA id l3sm3287088wik.16.2015.04.30.10.17.26 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 30 Apr 2015 10:17:27 -0700 (PDT) From: Srinivas Kandagatla To: Patrick Lai , Mark Brown Cc: Rob Herring , Pawel Moll , Ian Campbell , Kumar Gala , Banajit Goswami , Kenneth Westfield , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org, linux-arm-msm@vger.kernel.org, Srinivas Kandagatla Subject: [RFC PATCH 07/14] ASoC: qcom: add no osr clk flag to lpass variant Date: Thu, 30 Apr 2015 18:17:24 +0100 Message-Id: <1430414244-11168-1-git-send-email-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1430414148-10869-1-git-send-email-srinivas.kandagatla@linaro.org> References: <1430414148-10869-1-git-send-email-srinivas.kandagatla@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: srinivas.kandagatla@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.41 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Some LPASS integrations like on APQ8016 do not have OSR clk, so adding no osr clk bit would allow such integrations to use lpass driver. Signed-off-by: Srinivas Kandagatla --- sound/soc/qcom/lpass-cpu.c | 49 +++++++++++++++++++++++++++++----------------- sound/soc/qcom/lpass.h | 2 ++ 2 files changed, 33 insertions(+), 18 deletions(-) diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c index 66d068b..17ad20d 100644 --- a/sound/soc/qcom/lpass-cpu.c +++ b/sound/soc/qcom/lpass-cpu.c @@ -33,6 +33,9 @@ static int lpass_cpu_daiops_set_sysclk(struct snd_soc_dai *dai, int clk_id, struct lpass_data *drvdata = snd_soc_dai_get_drvdata(dai); int ret; + if (drvdata->variant->no_osr_clk) + return 0; + ret = clk_set_rate(drvdata->mi2s_osr_clk[dai->id], freq); if (ret) dev_err(dai->dev, "%s() error setting mi2s osrclk to %u: %d\n", @@ -47,18 +50,21 @@ static int lpass_cpu_daiops_startup(struct snd_pcm_substream *substream, struct lpass_data *drvdata = snd_soc_dai_get_drvdata(dai); int ret; - ret = clk_prepare_enable(drvdata->mi2s_osr_clk[dai->id]); - if (ret) { - dev_err(dai->dev, "%s() error in enabling mi2s osr clk: %d\n", - __func__, ret); - return ret; + if (!drvdata->variant->no_osr_clk) { + ret = clk_prepare_enable(drvdata->mi2s_osr_clk[dai->id]); + if (ret) { + dev_err(dai->dev, "%s() error in enabling mi2s osr clk: %d\n", + __func__, ret); + return ret; + } } ret = clk_prepare_enable(drvdata->mi2s_bit_clk[dai->id]); if (ret) { dev_err(dai->dev, "%s() error in enabling mi2s bit clk: %d\n", __func__, ret); - clk_disable_unprepare(drvdata->mi2s_osr_clk[dai->id]); + if (!drvdata->variant->no_osr_clk) + clk_disable_unprepare(drvdata->mi2s_osr_clk[dai->id]); return ret; } @@ -71,7 +77,9 @@ static void lpass_cpu_daiops_shutdown(struct snd_pcm_substream *substream, struct lpass_data *drvdata = snd_soc_dai_get_drvdata(dai); clk_disable_unprepare(drvdata->mi2s_bit_clk[dai->id]); - clk_disable_unprepare(drvdata->mi2s_osr_clk[dai->id]); + + if (!drvdata->variant->no_osr_clk) + clk_disable_unprepare(drvdata->mi2s_osr_clk[dai->id]); } static int lpass_cpu_daiops_hw_params(struct snd_pcm_substream *substream, @@ -398,17 +406,22 @@ int lpass_cpu_platform_probe(struct platform_device *pdev) if (variant->init) variant->init(pdev); - for (i = 0; i < variant->num_dai; i++) { - if (variant->num_dai > 1) - sprintf(clk_name, "mi2s-osr-clk%d", i); - else - sprintf(clk_name, "mi2s-osr-clk"); - - drvdata->mi2s_osr_clk[i] = devm_clk_get(&pdev->dev, clk_name); - if (IS_ERR(drvdata->mi2s_osr_clk[i])) { - dev_err(&pdev->dev, "%s() error getting mi2s-osr-clk: %ld\n", - __func__, PTR_ERR(drvdata->mi2s_osr_clk[i])); - return PTR_ERR(drvdata->mi2s_osr_clk[i]); + if (!variant->no_osr_clk) { + for (i = 0; i < variant->num_dai; i++) { + if (variant->num_dai > 1) + sprintf(clk_name, "mi2s-osr-clk%d", i); + else + sprintf(clk_name, "mi2s-osr-clk"); + + drvdata->mi2s_osr_clk[i] = devm_clk_get(&pdev->dev, + clk_name); + if (IS_ERR(drvdata->mi2s_osr_clk[i])) { + dev_err(&pdev->dev, + "%s() error getting mi2s-osr-clk: %ld\n", + __func__, + PTR_ERR(drvdata->mi2s_osr_clk[i])); + return PTR_ERR(drvdata->mi2s_osr_clk[i]); + } } } diff --git a/sound/soc/qcom/lpass.h b/sound/soc/qcom/lpass.h index 6ce2a51..301f784 100644 --- a/sound/soc/qcom/lpass.h +++ b/sound/soc/qcom/lpass.h @@ -61,6 +61,8 @@ struct lpass_variant { u32 rdma_reg_stride; u32 rdma_channels; + /* OCR clock is not present in SOCs like APQ8016 */ + bool no_osr_clk; /* SOC specific intialization like clocks */ int (*init)(struct platform_device *pdev); int (*exit)(struct platform_device *pdev);