Re: [PATCH] sound: soc: fsl: Do not set DAI sysclk when it is equal to system freq

2017-09-07 Thread Nicolin Chen
On Fri, Sep 08, 2017 at 01:10:12AM +0200, Łukasz Majewski wrote: > >Just add a property to this cpu node like: > > clock = <&clks IMX6QDL_CLK_SSI2>; > > This doesn't solve the issue: I have a patch locally that should be able to solve your problem. But I need to first verify on my board toni

Re: [PATCH] sound: soc: fsl: Do not set DAI sysclk when it is equal to system freq

2017-09-07 Thread Łukasz Majewski
Hi Nicolin, On Wed, Sep 06, 2017 at 08:35:50PM +0200, Łukasz Majewski wrote: clocks = <&clks IMX6QDL_CLK_SSI2_IPG>, <&clks IMX6QDL_CLK_SSI2>; clock-names = "ipg", "baud"; dailink_master: cpu { sound-dai =

Re: [PATCH] sound: soc: fsl: Do not set DAI sysclk when it is equal to system freq

2017-09-07 Thread Nicolin Chen
On Thu, Sep 07, 2017 at 02:44:11PM +0100, Mark Brown wrote: > > On the other hand, the sys clock (baudclk in the driver) should be > > configured whenever it's related to external clock outputs. When I > > implemented this set_sysclk() for fsl_ssi.c, I used it to set this > > sys clock (baudclk)

Re: [PATCH] sound: soc: fsl: Do not set DAI sysclk when it is equal to system freq

2017-09-07 Thread Mark Brown
On Tue, Sep 05, 2017 at 10:45:29AM -0700, Nicolin Chen wrote: > The ipg clock is merely used to access registers, and has nothing > (directly) to do with external clock outputs. The driver shall not > change the ipg clock as the system ipg clock (its parent clock) > might be messed and even system

Re: [PATCH] sound: soc: fsl: Do not set DAI sysclk when it is equal to system freq

2017-09-06 Thread Łukasz Majewski
On 09/06/2017 09:47 PM, Nicolin Chen wrote: On Wed, Sep 06, 2017 at 08:35:50PM +0200, Łukasz Majewski wrote: clocks = <&clks IMX6QDL_CLK_SSI2_IPG>, <&clks IMX6QDL_CLK_SSI2>; clock-names = "ipg", "baud"; dailink_master: cpu {

Re: [PATCH] sound: soc: fsl: Do not set DAI sysclk when it is equal to system freq

2017-09-06 Thread Nicolin Chen
On Wed, Sep 06, 2017 at 08:35:50PM +0200, Łukasz Majewski wrote: > clocks = <&clks IMX6QDL_CLK_SSI2_IPG>, ><&clks IMX6QDL_CLK_SSI2>; > clock-names = "ipg", "baud"; > >>dailink_master: cpu { > >>sound-dai = <&ssi2>; > >>

Re: [PATCH] sound: soc: fsl: Do not set DAI sysclk when it is equal to system freq

2017-09-06 Thread Łukasz Majewski
Hi Nicolin, On Wed, Sep 06, 2017 at 11:22:48AM +0200, Łukasz Majewski wrote: Here is the routine that I understood from the code: 1) asoc_simple_card_parse_clk_cpu(dev, cpu, dai_link, cpu_dai); => asoc_simple_card_parse_clk(dev, cpu,// cpu node in sound{} [1]

Re: [PATCH] sound: soc: fsl: Do not set DAI sysclk when it is equal to system freq

2017-09-06 Thread Nicolin Chen
On Wed, Sep 06, 2017 at 11:22:48AM +0200, Łukasz Majewski wrote: > >Here is the routine that I understood from the code: > >1) asoc_simple_card_parse_clk_cpu(dev, cpu, dai_link, cpu_dai); > >=> asoc_simple_card_parse_clk(dev, cpu,// cpu node in sound{} [1] > >

Re: [PATCH] sound: soc: fsl: Do not set DAI sysclk when it is equal to system freq

2017-09-06 Thread Łukasz Majewski
Hi Nicolin, On Tue, Sep 05, 2017 at 11:13:40PM +0200, Łukasz Majewski wrote: They key point here is the asoc_simple_card_parse_clk() function from simple-card-utils.c Please look how the clock is assigned; It first checks for cpu clock, then for "system-clock-frequency" DTS node and _finally_

Re: [PATCH] sound: soc: fsl: Do not set DAI sysclk when it is equal to system freq

2017-09-06 Thread Łukasz Majewski
Hi Fabio, On Tue, Sep 5, 2017 at 6:13 PM, Łukasz Majewski wrote: &i2c1 { clock-frequency = <40>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_i2c1>; status = "okay"; codec: tfa9879@6C { #sound-dai-cells = <0>;

Re: [PATCH] sound: soc: fsl: Do not set DAI sysclk when it is equal to system freq

2017-09-05 Thread Fabio Estevam
On Tue, Sep 5, 2017 at 6:13 PM, Łukasz Majewski wrote: > &i2c1 { > clock-frequency = <40>; > pinctrl-names = "default"; > pinctrl-0 = <&pinctrl_i2c1>; > status = "okay"; > > codec: tfa9879@6C { > #sound-dai-cells = <0>; >

Re: [PATCH] sound: soc: fsl: Do not set DAI sysclk when it is equal to system freq

2017-09-05 Thread Nicolin Chen
On Tue, Sep 05, 2017 at 11:13:40PM +0200, Łukasz Majewski wrote: > They key point here is the asoc_simple_card_parse_clk() function > from simple-card-utils.c > > Please look how the clock is assigned; It first checks for cpu > clock, then for "system-clock-frequency" DTS node and _finally_ > loo

Re: [PATCH] sound: soc: fsl: Do not set DAI sysclk when it is equal to system freq

2017-09-05 Thread Łukasz Majewski
Hi Fabio, Hi Lukasz, On Tue, Sep 5, 2017 at 5:35 AM, Łukasz Majewski wrote: Note: [*] - I could workaround this problem by setting: system-clock-frequency = <0> in dailink_master: cpu { sound-dai = <&ssi2>; };

Re: [PATCH] sound: soc: fsl: Do not set DAI sysclk when it is equal to system freq

2017-09-05 Thread Łukasz Majewski
Hi Nicolin, On Tue, Sep 05, 2017 at 10:35:34AM +0200, Łukasz Majewski wrote: And apparently, we shouldn't set bitclk to 66MHz either. Can you help to find where this 66MHz comes from? 2. int asoc_simple_card_init_dai() @ simple-card-utils.c Oh, I just searched in the simple-card.c but mis

Re: [PATCH] sound: soc: fsl: Do not set DAI sysclk when it is equal to system freq

2017-09-05 Thread Fabio Estevam
Hi Lukasz, On Tue, Sep 5, 2017 at 5:35 AM, Łukasz Majewski wrote: > Note: > [*] - I could workaround this problem by setting: > > system-clock-frequency = <0> in > > dailink_master: cpu { > sound-dai = <&ssi2>; > }; > W

Re: [PATCH] sound: soc: fsl: Do not set DAI sysclk when it is equal to system freq

2017-09-05 Thread Nicolin Chen
On Tue, Sep 05, 2017 at 10:35:34AM +0200, Łukasz Majewski wrote: > >And apparently, we shouldn't set bitclk to 66MHz either. Can > >you help to find where this 66MHz comes from? > 2. int asoc_simple_card_init_dai() @ simple-card-utils.c Oh, I just searched in the simple-card.c but missed this fi

Re: [PATCH] sound: soc: fsl: Do not set DAI sysclk when it is equal to system freq

2017-09-05 Thread Nicolin Chen
On Tue, Sep 05, 2017 at 04:15:50PM +0100, Mark Brown wrote: > > Just to be clear: > > > What clock shall be set with: > > > struct snd_soc_dai_ops { > > int (*set_sysclk)(struct snd_soc_dai *dai, > > int clk_id, unsigned int freq, int dir); > > } > > > callback? > > > The SSI

Re: [PATCH] sound: soc: fsl: Do not set DAI sysclk when it is equal to system freq

2017-09-05 Thread Mark Brown
On Tue, Sep 05, 2017 at 10:19:05AM +0200, Łukasz Majewski wrote: > On 09/05/2017 09:52 AM, Nicolin Chen wrote: > > Can you elaborate why you set ipg clock as bclk? I don't remember SSI could > > derive bitclock from ipg clock. > Just to be clear: > What clock shall be set with: > struct snd_soc

Re: [PATCH] sound: soc: fsl: Do not set DAI sysclk when it is equal to system freq

2017-09-05 Thread Łukasz Majewski
On 09/05/2017 07:20 AM, Nicolin Chen wrote: On Sun, Sep 03, 2017 at 04:40:21PM +0200, Łukasz Majewski wrote: /* * Hardware limitation: The bclk rate must be * never greater than 1/5 IPG clock rate */ if (freq * 5 > clk_get_rate(ssi_private->clk)) { dev_err(cpu_dai->dev, "bitclk > ipgclk/5\n"); r

Re: [PATCH] sound: soc: fsl: Do not set DAI sysclk when it is equal to system freq

2017-09-05 Thread Łukasz Majewski
On 09/05/2017 09:52 AM, Nicolin Chen wrote: On Tue, Sep 05, 2017 at 09:37:43AM +0200, Łukasz Majewski wrote: The last call is changing the bit clock (BCLK) frequency to SSI's IP block clock (ipg = 66 MHz) [1]. I think a bigger question here is why the routine sets BCLK to 66MHz. Yes, exactl

Re: [PATCH] sound: soc: fsl: Do not set DAI sysclk when it is equal to system freq

2017-09-05 Thread Nicolin Chen
On Tue, Sep 05, 2017 at 09:37:43AM +0200, Łukasz Majewski wrote: > >>The last call is changing the bit clock (BCLK) frequency to SSI's IP > >>block clock (ipg = 66 MHz) [1]. > > > >I think a bigger question here is why the routine sets BCLK to 66MHz. > > Yes, exactly. > > In my case the bclk is

Re: [PATCH] sound: soc: fsl: Do not set DAI sysclk when it is equal to system freq

2017-09-05 Thread Łukasz Majewski
On 09/05/2017 07:06 AM, Nicolin Chen wrote: On Sun, Sep 03, 2017 at 01:05:01PM +0200, Lukasz Majewski wrote: The problem is visible in the following setup (on the imx6q): "simple-audio-card" -> ssi2 -> I2S + I2C -> codec The function call log (simple-card probe -> CONFIG_SND_SIMPLE_CARD): asoc

Re: [PATCH] sound: soc: fsl: Do not set DAI sysclk when it is equal to system freq

2017-09-04 Thread Nicolin Chen
On Sun, Sep 03, 2017 at 04:40:21PM +0200, Łukasz Majewski wrote: > >/* > >* Hardware limitation: The bclk rate must be > >* never greater than 1/5 IPG clock rate > >*/ > >if (freq * 5 > clk_get_rate(ssi_private->clk)) { > >dev_err(cpu_dai->dev, "bitclk > ipgclk/5\n"); > >return -EINVAL; > >} > > >

Re: [PATCH] sound: soc: fsl: Do not set DAI sysclk when it is equal to system freq

2017-09-04 Thread Nicolin Chen
On Sun, Sep 03, 2017 at 01:05:01PM +0200, Lukasz Majewski wrote: > The problem is visible in the following setup (on the imx6q): > "simple-audio-card" -> ssi2 -> I2S + I2C -> codec > > The function call log (simple-card probe -> CONFIG_SND_SIMPLE_CARD): > > asoc_simple_card_init_dai() @ sound/soc

Re: [PATCH] sound: soc: fsl: Do not set DAI sysclk when it is equal to system freq

2017-09-03 Thread Fabio Estevam
On Sun, Sep 3, 2017 at 11:40 AM, Łukasz Majewski wrote: > This is the part of fsl_ssi_set_bclk() function which is called after > fsl_ssi_set_dai_sysclk() (which sets ssi_private->bitclk_freq = freq;). > > Before the aforementioned check we do have: > > if (ssi_private->bitclk_freq) >

Re: [PATCH] sound: soc: fsl: Do not set DAI sysclk when it is equal to system freq

2017-09-03 Thread Łukasz Majewski
From: Lukasz Majewski Sent: Sunday, September 3, 2017 8:05:01 AM To: Timur Tabi; Nicolin Chen; Xiubo Li; Fabio Estevam; Liam Girdwood; Mark Brown; Jaroslav Kysela; Takashi Iwai Cc: alsa-de...@alsa-project.org; linuxppc-...@lists.ozlabs.org; linux-kernel@vger.kernel.org; Lukasz Majewski

[PATCH] sound: soc: fsl: Do not set DAI sysclk when it is equal to system freq

2017-09-03 Thread Lukasz Majewski
The problem is visible in the following setup (on the imx6q): "simple-audio-card" -> ssi2 -> I2S + I2C -> codec The function call log (simple-card probe -> CONFIG_SND_SIMPLE_CARD): asoc_simple_card_init_dai() @ sound/soc/generic/simple-card-utils.c snd_soc_dai_set_sysclk() fsl_ssi_set_dai_sysclk(