From patchwork Fri May 15 08:44:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 48554 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CA29D2121F for ; Fri, 15 May 2015 08:44:55 +0000 (UTC) Received: by wivs14 with SMTP id s14sf31922931wiv.1 for ; Fri, 15 May 2015 01:44:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:delivered-to:message-id:date:from :user-agent:mime-version:to:references:in-reply-to:subject :precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:content-transfer-encoding:content-type :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=f6Inh/xW+6bxyEFJxfV+9d3hLiachEqMXXYhUYtib+8=; b=R+hiDt/QkDLuIG7J1AcvpO+oQHuSLRZy3GmnWDAQsz7/J6vSGd/dW9HQYifIRnJgLA xajaRUQsWv4lxhOfHYoTVoT4F4s7MxJUN6V9lig3e6Hf8421sXIy/q8dXw+GuyRboJNW 2V5Z6MrGhyCWEKtiDGOeTEfJHehM27Fs6iupevACIdF8Vntdoix5W+ZZb79j7iBloaQl JASRgPMdYx/sz2kCeu3r9EedkVlU62lvhd2SZvU//0QiJrvdodRnxnvntngJZlAdqkE0 BaRJv4D9Uye5fK0RrXmdAZQd47zxHR9zzZBeOhB0XKPtK5pFDNy70PhvALxHmNWcNv3Y n+oQ== X-Gm-Message-State: ALoCoQnBFjTDql5sqPLMqf4zyImjH4NMC7paB6YT7+pGmuFIqP7g7WXFj/3GqBiUnOO4PyoY5EfS X-Received: by 10.152.4.194 with SMTP id m2mr6242799lam.1.1431679495079; Fri, 15 May 2015 01:44:55 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.44.135 with SMTP id e7ls558470lam.79.gmail; Fri, 15 May 2015 01:44:54 -0700 (PDT) X-Received: by 10.112.157.164 with SMTP id wn4mr6396664lbb.100.1431679494860; Fri, 15 May 2015 01:44:54 -0700 (PDT) Received: from mail-la0-f42.google.com (mail-la0-f42.google.com. [209.85.215.42]) by mx.google.com with ESMTPS id t4si641289lbo.3.2015.05.15.01.44.54 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 May 2015 01:44:54 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) client-ip=209.85.215.42; Received: by laat2 with SMTP id t2so108725145laa.1 for ; Fri, 15 May 2015 01:44:54 -0700 (PDT) X-Received: by 10.152.27.98 with SMTP id s2mr6500139lag.106.1431679494757; Fri, 15 May 2015 01:44:54 -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 hn6csp1848367lbb; Fri, 15 May 2015 01:44:53 -0700 (PDT) X-Received: by 10.194.2.16 with SMTP id 16mr15922046wjq.46.1431679493831; Fri, 15 May 2015 01:44:53 -0700 (PDT) Received: from alsa0.perex.cz (alsa0.perex.cz. [77.48.224.243]) by mx.google.com with ESMTP id el3si2584371wib.24.2015.05.15.01.44.53; Fri, 15 May 2015 01:44:53 -0700 (PDT) Received-SPF: neutral (google.com: 77.48.224.243 is neither permitted nor denied by best guess record for domain of alsa-devel-bounces@alsa-project.org) client-ip=77.48.224.243; Received: by alsa0.perex.cz (Postfix, from userid 1000) id 459472663EE; Fri, 15 May 2015 10:44:52 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on mail1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.2.4 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id ED0492605B0; Fri, 15 May 2015 10:44:46 +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 7D1312605B0; Fri, 15 May 2015 10:44:45 +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 462F826057F for ; Fri, 15 May 2015 10:44:33 +0200 (CEST) Received: by wicmx19 with SMTP id mx19so33645082wic.0 for ; Fri, 15 May 2015 01:44:33 -0700 (PDT) X-Received: by 10.194.250.98 with SMTP id zb2mr16353438wjc.90.1431679471982; Fri, 15 May 2015 01:44:31 -0700 (PDT) Received: from [192.168.1.6] (host-78-144-121-184.as13285.net. [78.144.121.184]) by mx.google.com with ESMTPSA id cf9sm1390916wjc.27.2015.05.15.01.44.30 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 May 2015 01:44:31 -0700 (PDT) Message-ID: <5555B1ED.5050707@linaro.org> Date: Fri, 15 May 2015 09:44:29 +0100 From: Srinivas Kandagatla User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Patrick Lai , Mark Brown , Rob Herring , Pawel Moll , Ian Campbell , Kumar Gala , Banajit Goswami , 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 References: <1431518302-7139-1-git-send-email-srinivas.kandagatla@linaro.org> <1431518452-7434-1-git-send-email-srinivas.kandagatla@linaro.org> <20150515052329.GA31687@kwestfie-linux.qualcomm.com> In-Reply-To: <20150515052329.GA31687@kwestfie-linux.qualcomm.com> Subject: Re: [alsa-devel] [PATCH v1 05/13] ASoC: qcom: support bitclk and osrclk per i2s port X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.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.42 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 On 15/05/15 06:23, Kenneth Westfield wrote: > On Wed, May 13, 2015 at 05:00:52AM -0700, Srinivas Kandagatla wrote: >> This patch adds support to allow bitclk and osrclk per i2s dai port. >> on APQ8016 there are 4 i2s ports each one has its own bit clks. >> >> Without this patch its not possible to support multiple i2s ports in the >> lpass driver. > >> diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c >> index 5965667..0d28ea7 100644 >> --- a/sound/soc/qcom/lpass-cpu.c >> +++ b/sound/soc/qcom/lpass-cpu.c >> @@ -33,7 +33,7 @@ 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; >> >> - ret = clk_set_rate(drvdata->mi2s_osr_clk, freq); >> + 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", >> __func__, freq, ret); > > Audio was broken on the Storm board with this patch series. The issue > has to do with the mismatch of the clock position in the array (which > was 0) and the dai->driver->id (which was 4). Basically, the position of > the bit/osr clocks in their respective arrays need to match the MI2S > port number, even if the port number doesn't start at the 0 position. > > I realize there are multiple ways to address this. The quick solution I > came up with (to get audio functioning again) was to change the DT clock > entries for the ipq806x (see changes below for your reference). The > downside to the way I did this is, that now, there is no error-checking > for clocks that should be in the DT but aren't there. > > Suggestions are welcome on how to best address this issue. I think all we need to do is populate the correct index in the clk array. TBH I don't want to change any of ipq806x bindings. I think the below fix should be the right one, actually I did think of doing this in v1 when I changed usage of dai->id to dai->driver->id , but some how I missed it. Let me know your thoughts. -----------------------><--------------------------------------------- if (dsp_of_node) { @@ -412,34 +412,36 @@ int asoc_qcom_lpass_cpu_platform_probe(struct platform_device *pdev) variant->init(pdev); for (i = 0; i < variant->num_dai; i++) { + dai_id = variant->dai_driver[i].id; 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, + drvdata->mi2s_osr_clk[dai_id] = devm_clk_get(&pdev->dev, clk_name); - if (IS_ERR(drvdata->mi2s_osr_clk[i])) { + if (IS_ERR(drvdata->mi2s_osr_clk[dai_id])) { dev_err(&pdev->dev, "%s() error getting mi2s-osr-clk: %ld\n", __func__, - PTR_ERR(drvdata->mi2s_osr_clk[i])); + PTR_ERR(drvdata->mi2s_osr_clk[dai_id])); } } for (i = 0; i < variant->num_dai; i++) { + dai_id = variant->dai_driver[i].id; if (variant->num_dai > 1) sprintf(clk_name, "mi2s-bit-clk%d", i); else sprintf(clk_name, "mi2s-bit-clk"); - drvdata->mi2s_bit_clk[i] = devm_clk_get(&pdev->dev, clk_name); - if (IS_ERR(drvdata->mi2s_bit_clk[i])) { + drvdata->mi2s_bit_clk[dai_id] = devm_clk_get(&pdev->dev, clk_name); + if (IS_ERR(drvdata->mi2s_bit_clk[dai_id])) { dev_err(&pdev->dev, "%s() error getting mi2s-bit-clk: %ld\n", __func__, PTR_ERR(drvdata->mi2s_bit_clk[i])); - return PTR_ERR(drvdata->mi2s_bit_clk[i]); + return PTR_ERR(drvdata->mi2s_bit_clk[dai_id]); } } -----------------------><--------------------------------------------- --srini > > -----------------------><--------------------------------------------- > diff --git a/Documentation/devicetree/bindings/sound/qcom,lpass-cpu.txt b/Documentation/devicetree/bindings/sound/qcom,lpass-cpu.txt > index 21c6483..2684a4f 100644 > --- a/Documentation/devicetree/bindings/sound/qcom,lpass-cpu.txt > +++ b/Documentation/devicetree/bindings/sound/qcom,lpass-cpu.txt > @@ -8,8 +8,8 @@ Required properties: > - clocks : Must contain an entry for each entry in clock-names. > - clock-names : A list which must include the following entries: > * "ahbix-clk" > - * "mi2s-osr-clk" > - * "mi2s-bit-clk" > + * "mi2s-osr-clk4" > + * "mi2s-bit-clk4" > : required clocks for "qcom,lpass-cpu-apq8016" > * "ahbix-clk" > * "mi2s-bit-clk0" > @@ -42,7 +42,7 @@ Example: > lpass@28100000 { > compatible = "qcom,lpass-cpu"; > clocks = <&lcc AHBIX_CLK>, <&lcc MI2S_OSR_CLK>, <&lcc MI2S_BIT_CLK>; > - clock-names = "ahbix-clk", "mi2s-osr-clk", "mi2s-bit-clk"; > + clock-names = "ahbix-clk", "mi2s-osr-clk4", "mi2s-bit-clk4"; > interrupts = <0 85 1>; > interrupt-names = "lpass-irq-lpaif"; > pinctrl-names = "default", "idle"; > diff --git a/arch/arm/boot/dts/qcom-ipq8064.dtsi b/arch/arm/boot/dts/qcom-ipq8064.dtsi > index 5a13366..090984f 100644 > --- a/arch/arm/boot/dts/qcom-ipq8064.dtsi > +++ b/arch/arm/boot/dts/qcom-ipq8064.dtsi > @@ -189,8 +189,8 @@ > <&lcc MI2S_OSR_CLK>, > <&lcc MI2S_BIT_CLK>; > clock-names = "ahbix-clk", > - "mi2s-osr-clk", > - "mi2s-bit-clk"; > + "mi2s-osr-clk4", > + "mi2s-bit-clk4"; > interrupts = <0 85 1>; > interrupt-names = "lpass-irq-lpaif"; > reg = <0x28100000 0x10000>; > diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c > index 5053629..7b66e52 100644 > --- a/sound/soc/qcom/lpass-cpu.c > +++ b/sound/soc/qcom/lpass-cpu.c > @@ -411,11 +411,8 @@ int asoc_qcom_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"); > + for (i = 0; i < LPASS_MAX_MI2S_PORTS; i++) { > + sprintf(clk_name, "mi2s-osr-clk%d", i); > > drvdata->mi2s_osr_clk[i] = devm_clk_get(&pdev->dev, > clk_name); > @@ -427,19 +424,14 @@ int asoc_qcom_lpass_cpu_platform_probe(struct platform_device *pdev) > } > } > > - for (i = 0; i < variant->num_dai; i++) { > - > - if (variant->num_dai > 1) > - sprintf(clk_name, "mi2s-bit-clk%d", i); > - else > - sprintf(clk_name, "mi2s-bit-clk"); > + for (i = 0; i < LPASS_MAX_MI2S_PORTS; i++) { > + sprintf(clk_name, "mi2s-bit-clk%d", i); > > drvdata->mi2s_bit_clk[i] = devm_clk_get(&pdev->dev, clk_name); > if (IS_ERR(drvdata->mi2s_bit_clk[i])) { > dev_err(&pdev->dev, > "%s() error getting mi2s-bit-clk: %ld\n", > __func__, PTR_ERR(drvdata->mi2s_bit_clk[i])); > - return PTR_ERR(drvdata->mi2s_bit_clk[i]); > } > } > -----------------------><--------------------------------------------- > diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c index 33e28370..64620ce 100644 --- a/sound/soc/qcom/lpass-cpu.c +++ b/sound/soc/qcom/lpass-cpu.c @@ -365,7 +365,7 @@ int asoc_qcom_lpass_cpu_platform_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; const struct of_device_id *match; char clk_name[16]; - int ret, i; + int ret, i, dai_id; dsp_of_node = of_parse_phandle(pdev->dev.of_node, "qcom,adsp", 0);