From patchwork Sat May 16 12:32:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 48603 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f72.google.com (mail-wg0-f72.google.com [74.125.82.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9262421411 for ; Sat, 16 May 2015 12:35:45 +0000 (UTC) Received: by wgtl5 with SMTP id l5sf38463831wgt.1 for ; Sat, 16 May 2015 05:35:44 -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=1+Yu/3KFjALuTGmt4BqNuEj1eli6tewyImoJfW8Cs10=; b=M6HB0HPCekgQ3qU6J3LTAXdFzsQYaaCDtP92IBoHofOKKB9ZuV3n1CQGO/TXPr16sv rqbWzVuONVwG020y82me7MXijwO56wLoP8tjZsmPpQxQCXWc+gHTPbXTJHw5zyg3dSnw hvB4SYiQYutTdMGISmT0a3o6CPMklh/FAlqJf3mlevR0FCoLrH/CddpJZzmlhwhm3EYH /drgrz8oegaZUUoNs+eRp8qZPe1h+cUYMI4dpVId9UpoTblOs3mR8QarXOlmO2FQ/qnh aakzhhtQD7cY67wzMa/OhpafzkOvwG2XJ9gUIW1XgLx6qCqe7eBT9RYaJWgOKX38C6We 9k/w== X-Gm-Message-State: ALoCoQkfQCl8Cup5q94OdrOsm0L4VcVtpga/3HrTaOv8myCj6DjExreSjVfHSS/71POwdUDp+rdK X-Received: by 10.180.105.67 with SMTP id gk3mr2761815wib.4.1431779744902; Sat, 16 May 2015 05:35:44 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.120.71 with SMTP id la7ls585668lab.25.gmail; Sat, 16 May 2015 05:35:44 -0700 (PDT) X-Received: by 10.112.147.201 with SMTP id tm9mr10719212lbb.40.1431779744508; Sat, 16 May 2015 05:35:44 -0700 (PDT) Received: from mail-la0-f51.google.com (mail-la0-f51.google.com. [209.85.215.51]) by mx.google.com with ESMTPS id au9si2947737lbc.168.2015.05.16.05.35.44 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 16 May 2015 05:35:44 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) client-ip=209.85.215.51; Received: by laat2 with SMTP id t2so158769329laa.1 for ; Sat, 16 May 2015 05:35:44 -0700 (PDT) X-Received: by 10.152.37.228 with SMTP id b4mr10435308lak.117.1431779744211; Sat, 16 May 2015 05:35:44 -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.108.230 with SMTP id hn6csp2709366lbb; Sat, 16 May 2015 05:35:42 -0700 (PDT) X-Received: by 10.66.248.195 with SMTP id yo3mr27127741pac.123.1431779742254; Sat, 16 May 2015 05:35:42 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id kc8si7072460pbc.130.2015.05.16.05.35.12; Sat, 16 May 2015 05:35: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; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755139AbbEPMdA (ORCPT + 28 others); Sat, 16 May 2015 08:33:00 -0400 Received: from mail-wi0-f179.google.com ([209.85.212.179]:38436 "EHLO mail-wi0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755097AbbEPMcy (ORCPT ); Sat, 16 May 2015 08:32:54 -0400 Received: by wicnf17 with SMTP id nf17so20728855wic.1 for ; Sat, 16 May 2015 05:32:52 -0700 (PDT) X-Received: by 10.180.206.229 with SMTP id lr5mr5849257wic.86.1431779572747; Sat, 16 May 2015 05:32:52 -0700 (PDT) Received: from srini-ThinkPad-X1-Carbon-2nd.dlink.com (host-78-144-121-184.as13285.net. [78.144.121.184]) by mx.google.com with ESMTPSA id j1sm2698607wia.22.2015.05.16.05.32.50 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 16 May 2015 05:32:52 -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: [PATCH v2 06/13] ASoC: qcom: make osr clock optional Date: Sat, 16 May 2015 13:32:49 +0100 Message-Id: <1431779569-2091-1-git-send-email-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1431779462-1732-1-git-send-email-srinivas.kandagatla@linaro.org> References: <1431779462-1732-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.51 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 making osr clk optional would allow such integrations to use lpass driver. Tested-by: Kenneth Westfield Signed-off-by: Srinivas Kandagatla --- sound/soc/qcom/lpass-cpu.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c index 86c9d1a..95369d8 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 (IS_ERR(drvdata->mi2s_osr_clk[dai->driver->id])) + return 0; + ret = clk_set_rate(drvdata->mi2s_osr_clk[dai->driver->id], freq); if (ret) dev_err(dai->dev, "%s() error setting mi2s osrclk to %u: %d\n", @@ -47,18 +50,22 @@ 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->diver->id]); - if (ret) { - dev_err(dai->dev, "%s() error in enabling mi2s osr clk: %d\n", - __func__, ret); - return ret; + if (!IS_ERR(drvdata->mi2s_osr_clk[dai->driver->id])) { + ret = clk_prepare_enable( + drvdata->mi2s_osr_clk[dai->driver->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->driver->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->driver->id]); + if (!IS_ERR(drvdata->mi2s_osr_clk[dai->driver->id])) + clk_disable_unprepare(drvdata->mi2s_osr_clk[dai->driver->id]); return ret; } @@ -71,7 +78,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->driver->id]); - clk_disable_unprepare(drvdata->mi2s_osr_clk[dai->driver->id]); + + if (!IS_ERR(drvdata->mi2s_osr_clk[dai->driver->id])) + clk_disable_unprepare(drvdata->mi2s_osr_clk[dai->driver->id]); } static int lpass_cpu_daiops_hw_params(struct snd_pcm_substream *substream, @@ -415,7 +424,7 @@ int asoc_qcom_lpass_cpu_platform_probe(struct platform_device *pdev) dev_err(&pdev->dev, "%s() error getting mi2s-osr-clk: %ld\n", __func__, - return PTR_ERR(drvdata->mi2s_osr_clk[dai_id])); + PTR_ERR(drvdata->mi2s_osr_clk[dai_id])); } if (variant->num_dai > 1)