linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
To: Patrick Lai <plai@codeaurora.org>,
	Mark Brown <broonie@kernel.org>, Rob Herring <robh+dt@kernel.org>,
	Pawel Moll <pawel.moll@arm.com>,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	Kumar Gala <galak@codeaurora.org>,
	Banajit Goswami <bgoswami@codeaurora.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.de>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	alsa-devel@alsa-project.org, linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH v1 05/13] ASoC: qcom: support bitclk and osrclk per i2s port
Date: Fri, 15 May 2015 09:44:29 +0100	[thread overview]
Message-ID: <5555B1ED.5050707@linaro.org> (raw)
In-Reply-To: <20150515052329.GA31687@kwestfie-linux.qualcomm.com>



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.
-----------------------><---------------------------------------------
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);
         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]);
>   		}
>   	}
> -----------------------><---------------------------------------------
>

  reply	other threads:[~2015-05-15  8:44 UTC|newest]

Thread overview: 88+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-30 17:15 [RFC PATCH 00/14] ASoC: qcom: add support to apq8016 audio Srinivas Kandagatla
2015-04-30 17:16 ` [RFC PATCH 01/14] ASoC: qcom: Remove redundant error check Srinivas Kandagatla
2015-05-04 12:24   ` Mark Brown
2015-04-30 17:16 ` [RFC PATCH 02/14] ASoC: qcom: remove unnecessary header files Srinivas Kandagatla
2015-05-04 12:24   ` Mark Brown
2015-04-30 17:16 ` [RFC PATCH 03/14] ASoC: qcom: move ipq806x specific bits out of lpass driver Srinivas Kandagatla
2015-05-02 23:57   ` Kenneth Westfield
2015-05-05  5:19     ` Kenneth Westfield
2015-05-05  7:17       ` Srinivas Kandagatla
2015-05-06  5:43         ` [alsa-devel] " Kenneth Westfield
2015-05-05  7:16     ` Srinivas Kandagatla
2015-05-06  5:35       ` [alsa-devel] " Kenneth Westfield
2015-04-30 17:17 ` [RFC PATCH 04/14] ASoC: qcom: remove hardcoded i2s port number Srinivas Kandagatla
2015-04-30 17:17 ` [RFC PATCH 05/14] ASoC: qcom: remove hardcoded dma channel Srinivas Kandagatla
2015-04-30 17:17 ` [RFC PATCH 06/14] ASoC: qcom: support bitclk and osrclk per i2s port Srinivas Kandagatla
2015-04-30 17:17 ` [RFC PATCH 07/14] ASoC: qcom: add no osr clk flag to lpass variant Srinivas Kandagatla
2015-05-02 23:58   ` Kenneth Westfield
2015-05-05  7:17     ` Srinivas Kandagatla
2015-05-04 12:26   ` Mark Brown
2015-05-05  7:16     ` Srinivas Kandagatla
2015-04-30 17:17 ` [RFC PATCH 08/14] ASoC: qcom: add dma channel control offset to variant data Srinivas Kandagatla
2015-05-02 23:59   ` Kenneth Westfield
2015-05-05  7:16     ` Srinivas Kandagatla
2015-04-30 17:17 ` [RFC PATCH 09/14] ASoC: qcom: Add ability to handle interrupts per dma channel Srinivas Kandagatla
2015-05-03  0:00   ` Kenneth Westfield
2015-05-05  7:17     ` Srinivas Kandagatla
2015-04-30 17:17 ` [RFC PATCH 10/14] ASoC: qcom: add bit map to track static dma channel allocations Srinivas Kandagatla
2015-04-30 17:17 ` [RFC PATCH 11/14] ASoC: qcom: Add apq8016 lpass driver support Srinivas Kandagatla
2015-04-30 17:18 ` [RFC PATCH 12/14] ASoC: qcom: add apq8016 sound card support Srinivas Kandagatla
2015-05-03  0:01   ` Kenneth Westfield
2015-05-05  7:17     ` Srinivas Kandagatla
2015-04-30 17:18 ` [RFC PATCH 13/14] ASoC: qcom: Document apq8016 bindings Srinivas Kandagatla
2015-04-30 17:18 ` [RFC PATCH 14/14] ASoC: qcom: document apq8016 machine driver bindings Srinivas Kandagatla
2015-05-03  0:03   ` Kenneth Westfield
2015-05-03  3:59     ` Kenneth Westfield
2015-05-05  7:17     ` Srinivas Kandagatla
2015-05-06  5:41       ` [alsa-devel] " Kenneth Westfield
2015-05-02 23:57 ` [RFC PATCH 00/14] ASoC: qcom: add support to apq8016 audio Kenneth Westfield
2015-05-06  5:47   ` Kenneth Westfield
2015-05-06  6:54     ` Srinivas Kandagatla
2015-05-12  4:06       ` [alsa-devel] " Kenneth Westfield
2015-05-12 10:21         ` Srinivas Kandagatla
2015-05-12 17:04           ` Lars-Peter Clausen
2015-05-14  7:55             ` Srinivas Kandagatla
2015-05-12 13:11         ` Srinivas Kandagatla
2015-05-13 11:58 ` [PATCH v1 00/13] " Srinivas Kandagatla
2015-05-13 12:00   ` [PATCH v1 01/13] ASoC: qcom: make lpass driver depend on OF Srinivas Kandagatla
2015-05-13 12:00   ` [PATCH v1 02/13] ASoC: qcom: move ipq806x specific bits out of lpass driver Srinivas Kandagatla
2015-05-15  5:23     ` Kenneth Westfield
2015-05-15  8:48       ` Srinivas Kandagatla
2015-05-13 12:00   ` [PATCH v1 03/13] ASoC: qcom: remove hardcoded i2s port number Srinivas Kandagatla
2015-05-13 12:00   ` [PATCH v1 04/13] ASoC: qcom: remove hardcoded dma channel Srinivas Kandagatla
2015-05-13 12:00   ` [PATCH v1 05/13] ASoC: qcom: support bitclk and osrclk per i2s port Srinivas Kandagatla
2015-05-15  5:23     ` Kenneth Westfield
2015-05-15  8:44       ` Srinivas Kandagatla [this message]
2015-05-13 12:02   ` [PATCH v1 06/13] ASoC: qcom: make osr clock optional Srinivas Kandagatla
2015-05-13 12:02   ` [PATCH v1 07/13] ASoC: qcom: add dma channel control offset to variant data Srinivas Kandagatla
2015-05-13 12:02   ` [PATCH v1 08/13] ASoC: qcom: Add ability to handle interrupts per dma channel Srinivas Kandagatla
2015-05-13 12:02   ` [PATCH v1 09/13] ASoC: qcom: add bit map to track static dma channel allocations Srinivas Kandagatla
2015-05-13 12:03   ` [PATCH v1 10/13] ASoC: qcom: Add apq8016 lpass driver support Srinivas Kandagatla
2015-05-15  5:23     ` Kenneth Westfield
2015-05-15  8:46       ` Srinivas Kandagatla
2015-05-13 12:03   ` [PATCH v1 11/13] ASoC: qcom: add apq8016 sound card support Srinivas Kandagatla
2015-05-15  5:23     ` Kenneth Westfield
2015-05-15  8:47       ` Srinivas Kandagatla
2015-05-13 12:03   ` [PATCH v1 12/13] ASoC: qcom: Document apq8016 bindings Srinivas Kandagatla
2015-05-13 12:03   ` [PATCH v1 13/13] ASoC: qcom: document apq8016 sbc machine driver bindings Srinivas Kandagatla
2015-05-16 12:31 ` [PATCH v2 00/13] ASoC: qcom: add support to apq8016 audio Srinivas Kandagatla
2015-05-16 12:32   ` [PATCH v2 01/13] ASoC: qcom: make lpass driver depend on OF Srinivas Kandagatla
2015-05-21 20:10     ` Mark Brown
2015-05-16 12:32   ` [PATCH v2 02/13] ASoC: qcom: move ipq806x specific bits out of lpass driver Srinivas Kandagatla
2015-05-21 20:11     ` Mark Brown
2015-05-16 12:32   ` [PATCH v2 03/13] ASoC: qcom: remove hardcoded i2s port number Srinivas Kandagatla
2015-05-16 12:32   ` [PATCH v2 04/13] ASoC: qcom: remove hardcoded dma channel Srinivas Kandagatla
2015-05-21 20:12     ` Mark Brown
2015-05-16 12:32   ` [PATCH v2 05/13] ASoC: qcom: support bitclk and osrclk per i2s port Srinivas Kandagatla
2015-05-17 16:14     ` Kenneth Westfield
2015-05-16 12:32   ` [PATCH v2 06/13] ASoC: qcom: make osr clock optional Srinivas Kandagatla
2015-05-17 16:15     ` Kenneth Westfield
2015-05-16 12:32   ` [PATCH v2 07/13] ASoC: qcom: add dma channel control offset to variant data Srinivas Kandagatla
2015-05-16 12:33   ` [PATCH v2 08/13] ASoC: qcom: Add ability to handle interrupts per dma channel Srinivas Kandagatla
2015-05-16 12:33   ` [PATCH v2 09/13] ASoC: qcom: add bit map to track static dma channel allocations Srinivas Kandagatla
2015-05-16 12:33   ` [PATCH v2 10/13] ASoC: qcom: Add apq8016 lpass driver support Srinivas Kandagatla
2015-05-16 12:33   ` [PATCH v2 11/13] ASoC: qcom: add apq8016 sound card support Srinivas Kandagatla
2015-05-16 12:33   ` [PATCH v2 12/13] ASoC: qcom: Document apq8016 bindings Srinivas Kandagatla
2015-05-16 12:33   ` [PATCH v2 13/13] ASoC: qcom: document apq8016 sbc machine driver bindings Srinivas Kandagatla
2015-05-17 16:15   ` [PATCH v2 00/13] ASoC: qcom: add support to apq8016 audio Kenneth Westfield
2015-05-21 17:05   ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5555B1ED.5050707@linaro.org \
    --to=srinivas.kandagatla@linaro.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=bgoswami@codeaurora.org \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=galak@codeaurora.org \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pawel.moll@arm.com \
    --cc=perex@perex.cz \
    --cc=plai@codeaurora.org \
    --cc=robh+dt@kernel.org \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).