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: 6306391 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 496159F373 for ; Thu, 30 Apr 2015 17:22:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 61EC6201B9 for ; Thu, 30 Apr 2015 17:22:31 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 13D8F2018E for ; Thu, 30 Apr 2015 17:22:30 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 551F72659BF; Thu, 30 Apr 2015 19:22:24 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 31C5926616A; Thu, 30 Apr 2015 19:19:35 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 6305A26616A; Thu, 30 Apr 2015 19:19:33 +0200 (CEST) Received: from mail-wi0-f178.google.com (mail-wi0-f178.google.com [209.85.212.178]) by alsa0.perex.cz (Postfix) with ESMTP id 760AF2604C3 for ; Thu, 30 Apr 2015 19:17:28 +0200 (CEST) Received: by wief7 with SMTP id f7so18013861wie.0 for ; Thu, 30 Apr 2015 10:17:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=89IMZrIiF7RG0Se8mtEWj2OfVbpW4+BdAJDC4wZOLM0=; b=K7bPnpqS35+UVE02W/ySHVCHoav0+gZIh+g03WaR7db8RSoDDUnxTrxQdHN1swjk54 xHPilUr9B6le5nCohF/TtpaV23cNoK4SBny/0x3CER8vAEzjm116pDnhc4kl4L/vmw0Q ggH43/zYX1Ou7DRJFjSbmRWoamsER+iMwZT4KojoZyTyGVLWFgVyKcg4KiQsmiz8/IYq mk1zkcBy2yDn9IotJHGyeVA2v7AivoXmNU0ytMh7xBp7Pk+yO53KJQEbzXTst4lC2iKz GYPfiGUZj6o3Z+9oKEdV5OXymlNQktxe4rj9Y5bI1sVc5JOejvTYA5odRNUun6r69eQQ bTAg== X-Gm-Message-State: ALoCoQk/j7J3yreWY8j9bH93o+L+LRGT+a1EQxeofhUw93YIivNip24HEw5pww6weMowFmeWun2i 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 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> Cc: devicetree@vger.kernel.org, Kenneth Westfield , Banajit Goswami , Pawel Moll , Ian Campbell , Takashi Iwai , linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Liam Girdwood , Rob Herring , Srinivas Kandagatla , Kumar Gala , alsa-devel@alsa-project.org Subject: [alsa-devel] [RFC PATCH 07/14] ASoC: qcom: add no osr clk flag to lpass variant X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP 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);