* Audio play problem with tlv320aic3106 in mainline. @ 2015-05-28 11:36 Enric Balletbo Serra 2015-05-29 7:20 ` Peter Ujfalusi 0 siblings, 1 reply; 6+ messages in thread From: Enric Balletbo Serra @ 2015-05-28 11:36 UTC (permalink / raw) To: alsa-devel Cc: Lars-Peter Clausen, Takashi Iwai, Liam Girdwood, Jyri Sarha, Peter Ujfalusi, Mark Brown Dear all, Recently I sent some patches to add support for a new board based on AM335x processor [1]. The board has the TLV320AIC3106 audio codec, the MCLK signal is provided by an external oscillator of 12MHz. The problem is that when I play a wav file for example I heard the song a double speed. This is with v4.0 and current mainline. In dts file I defined "ti,codec-clock-rate = <12000000>;" which is the correct value. Curiously when I changed the clock rate value to 24000000 I heard the song at normal speed. AFAIK the correct value for clock-rate is 12MHz so I suspect that something is wrong in the driver, maybe it sets a wrong clock divider/multiplier ? Anyone can point me in the right direction to fix the issue ? I see that am335x-evm and am335x-pepper boards also uses this audio codec, did anyone with those boards have the same problem? [1] https://patchwork.kernel.org/patch/6480071/ Thanks in advance, Enric ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Audio play problem with tlv320aic3106 in mainline. 2015-05-28 11:36 Audio play problem with tlv320aic3106 in mainline Enric Balletbo Serra @ 2015-05-29 7:20 ` Peter Ujfalusi 2015-05-29 9:24 ` Enric Balletbo Serra 0 siblings, 1 reply; 6+ messages in thread From: Peter Ujfalusi @ 2015-05-29 7:20 UTC (permalink / raw) To: Enric Balletbo Serra, alsa-devel Cc: Lars-Peter Clausen, Takashi Iwai, Liam Girdwood, Jyri Sarha, Mark Brown On 05/28/2015 02:36 PM, Enric Balletbo Serra wrote: > Dear all, > > Recently I sent some patches to add support for a new board based on > AM335x processor [1]. The board has the TLV320AIC3106 audio codec, the > MCLK signal is provided by an external oscillator of 12MHz. The > problem is that when I play a wav file for example I heard the song a > double speed. This is with v4.0 and current mainline. > > In dts file I defined "ti,codec-clock-rate = <12000000>;" which is the > correct value. Curiously when I changed the clock rate value to > 24000000 I heard the song at normal speed. AFAIK the correct value for > clock-rate is 12MHz so I suspect that something is wrong in the > driver, maybe it sets a wrong clock divider/multiplier ? Anyone can > point me in the right direction to fix the issue ? I see that > am335x-evm and am335x-pepper boards also uses this audio codec, did > anyone with those boards have the same problem? It might be really 24MHz. If the MCLK in your board is wired like am335x-evmsk or how BeagleBone's audio capes are wired (MCLK is coming from AM335x's EVENT_INTR0/1 pin as CLKOUT1/2) then 24MHz is correct. On the am335x-evm there is a dedicated crystal providing the 12MHz. > > [1] https://patchwork.kernel.org/patch/6480071/ > > Thanks in advance, > Enric > -- Péter _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Audio play problem with tlv320aic3106 in mainline. 2015-05-29 7:20 ` Peter Ujfalusi @ 2015-05-29 9:24 ` Enric Balletbo Serra 2015-05-29 12:16 ` Peter Ujfalusi 0 siblings, 1 reply; 6+ messages in thread From: Enric Balletbo Serra @ 2015-05-29 9:24 UTC (permalink / raw) To: Peter Ujfalusi Cc: alsa-devel, Lars-Peter Clausen, Takashi Iwai, Liam Girdwood, Jyri Sarha, Mark Brown Thanks for the answer Peter, 2015-05-29 9:20 GMT+02:00 Peter Ujfalusi <peter.ujfalusi@ti.com>: > On 05/28/2015 02:36 PM, Enric Balletbo Serra wrote: >> Dear all, >> >> Recently I sent some patches to add support for a new board based on >> AM335x processor [1]. The board has the TLV320AIC3106 audio codec, the >> MCLK signal is provided by an external oscillator of 12MHz. The >> problem is that when I play a wav file for example I heard the song a >> double speed. This is with v4.0 and current mainline. >> >> In dts file I defined "ti,codec-clock-rate = <12000000>;" which is the >> correct value. Curiously when I changed the clock rate value to >> 24000000 I heard the song at normal speed. AFAIK the correct value for >> clock-rate is 12MHz so I suspect that something is wrong in the >> driver, maybe it sets a wrong clock divider/multiplier ? Anyone can >> point me in the right direction to fix the issue ? I see that >> am335x-evm and am335x-pepper boards also uses this audio codec, did >> anyone with those boards have the same problem? > > It might be really 24MHz. > If the MCLK in your board is wired like am335x-evmsk or how BeagleBone's audio > capes are wired (MCLK is coming from AM335x's EVENT_INTR0/1 pin as CLKOUT1/2) > then 24MHz is correct. On the am335x-evm there is a dedicated crystal > providing the 12MHz. > Well, in my board there is also a dedicated crystal providing the 12MHz, so I expect that the correct value for clock-frequency is 12MHz not 24MHz. clocks { compatible = "simple-bus"; #address-cells = <1>; #size-cells = <0>; /* audio external oscillator */ tlv320aic3x_mclk: oscillator@0 { compatible = "fixed-clock"; #clock-cells = <0>; clock-frequency = <12000000>; /* 12MHz */ }; }; sound { compatible = "ti,da830-evm-audio"; ti,model = "AM335x-SL50"; ti,audio-codec = <&audio_codec>; ti,mcasp-controller = <&mcasp0>; clocks = <&tlv320aic3x_mclk>; clock-names = "mclk"; ti,audio-routing = "Headphone Jack", "HPLOUT", "Headphone Jack", "HPROUT", "LINE1R", "Line In", "LINE1L", "Line In"; }; For me it's really odd have to set the clock-frequency to 24MHz to make it work clock-frequency = <24000000>; For that reason I'm wondering if there is a bug in the driver, did anyone test with an am335x-evm board ? >> >> [1] https://patchwork.kernel.org/patch/6480071/ >> >> Thanks in advance, >> Enric >> > > -- > Péter Thanks, Enric _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Audio play problem with tlv320aic3106 in mainline. 2015-05-29 9:24 ` Enric Balletbo Serra @ 2015-05-29 12:16 ` Peter Ujfalusi 2015-06-01 9:16 ` Enric Balletbo Serra 0 siblings, 1 reply; 6+ messages in thread From: Peter Ujfalusi @ 2015-05-29 12:16 UTC (permalink / raw) To: Enric Balletbo Serra Cc: alsa-devel, Lars-Peter Clausen, Takashi Iwai, Liam Girdwood, Jyri Sarha, Mark Brown On 05/29/2015 12:24 PM, Enric Balletbo Serra wrote: >> It might be really 24MHz. >> If the MCLK in your board is wired like am335x-evmsk or how BeagleBone's audio >> capes are wired (MCLK is coming from AM335x's EVENT_INTR0/1 pin as CLKOUT1/2) >> then 24MHz is correct. On the am335x-evm there is a dedicated crystal >> providing the 12MHz. >> > Well, in my board there is also a dedicated crystal providing the > 12MHz, so I expect that the correct value for clock-frequency is 12MHz > not 24MHz. I was wrong with the BBW audio cape.. At least the RevA which I have does have 12MHz crystal connected to aic3106 MCLK, but there is a line to the SoC's CLKOUT2. By default the codec runs using the 12MHz. I have checked with a scope and yep, I have 12MHz for MCLK. > > clocks { > compatible = "simple-bus"; > #address-cells = <1>; > #size-cells = <0>; > > /* audio external oscillator */ > tlv320aic3x_mclk: oscillator@0 { > compatible = "fixed-clock"; > #clock-cells = <0>; > clock-frequency = <12000000>; /* 12MHz */ > }; > }; > > sound { > compatible = "ti,da830-evm-audio"; > ti,model = "AM335x-SL50"; > ti,audio-codec = <&audio_codec>; > ti,mcasp-controller = <&mcasp0>; > > clocks = <&tlv320aic3x_mclk>; > clock-names = "mclk"; > > ti,audio-routing = > "Headphone Jack", "HPLOUT", > "Headphone Jack", "HPROUT", > "LINE1R", "Line In", > "LINE1L", "Line In"; > }; If I use this with my BBW+Audio cape: audio is fine. > > For me it's really odd have to set the clock-frequency to 24MHz to make it work > > clock-frequency = <24000000>; If I change it to this, I will have slow motion playback, as expected. > For that reason I'm wondering if there is a bug in the driver, did > anyone test with an am335x-evm board ? I'm using linux-next. Not sure what could be the issue. > >>> >>> [1] https://patchwork.kernel.org/patch/6480071/ >>> >>> Thanks in advance, >>> Enric >>> >> >> -- >> Péter > > Thanks, > Enric > -- Péter _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Audio play problem with tlv320aic3106 in mainline. 2015-05-29 12:16 ` Peter Ujfalusi @ 2015-06-01 9:16 ` Enric Balletbo Serra 2015-06-01 12:10 ` Peter Ujfalusi 0 siblings, 1 reply; 6+ messages in thread From: Enric Balletbo Serra @ 2015-06-01 9:16 UTC (permalink / raw) To: Peter Ujfalusi Cc: alsa-devel, Lars-Peter Clausen, Takashi Iwai, Liam Girdwood, Jyri Sarha, Mark Brown Hi, 2015-05-29 14:16 GMT+02:00 Peter Ujfalusi <peter.ujfalusi@ti.com>: > On 05/29/2015 12:24 PM, Enric Balletbo Serra wrote: >>> It might be really 24MHz. >>> If the MCLK in your board is wired like am335x-evmsk or how BeagleBone's audio >>> capes are wired (MCLK is coming from AM335x's EVENT_INTR0/1 pin as CLKOUT1/2) >>> then 24MHz is correct. On the am335x-evm there is a dedicated crystal >>> providing the 12MHz. >>> >> Well, in my board there is also a dedicated crystal providing the >> 12MHz, so I expect that the correct value for clock-frequency is 12MHz >> not 24MHz. > > I was wrong with the BBW audio cape.. At least the RevA which I have does have > 12MHz crystal connected to aic3106 MCLK, but there is a line to the SoC's > CLKOUT2. By default the codec runs using the 12MHz. > I have checked with a scope and yep, I have 12MHz for MCLK. > >> >> clocks { >> compatible = "simple-bus"; >> #address-cells = <1>; >> #size-cells = <0>; >> >> /* audio external oscillator */ >> tlv320aic3x_mclk: oscillator@0 { >> compatible = "fixed-clock"; >> #clock-cells = <0>; >> clock-frequency = <12000000>; /* 12MHz */ >> }; >> }; >> >> sound { >> compatible = "ti,da830-evm-audio"; >> ti,model = "AM335x-SL50"; >> ti,audio-codec = <&audio_codec>; >> ti,mcasp-controller = <&mcasp0>; >> >> clocks = <&tlv320aic3x_mclk>; >> clock-names = "mclk"; >> >> ti,audio-routing = >> "Headphone Jack", "HPLOUT", >> "Headphone Jack", "HPROUT", >> "LINE1R", "Line In", >> "LINE1L", "Line In"; >> }; > > If I use this with my BBW+Audio cape: audio is fine. > Tested with linux-next and same problem here, I also checked with a scope my clock and it's 12MHz but I need to apply this patch to make it work. diff --git a/sound/soc/davinci/davinci-evm.c b/sound/soc/davinci/davinci-evm.c index 731fb0d..8ce0d32 100644 --- a/sound/soc/davinci/davinci-evm.c +++ b/sound/soc/davinci/davinci-evm.c @@ -64,6 +64,11 @@ static int evm_hw_params(struct snd_pcm_substream *substream, unsigned sysclk = ((struct snd_soc_card_drvdata_davinci *) snd_soc_card_get_drvdata(soc_card))->sysclk; + ret = snd_soc_dai_set_clkdiv(cpu_dai, 0, 2); + if (ret < 0) + return ret; + /* set the codec system clock */ ret = snd_soc_dai_set_sysclk(codec_dai, 0, sysclk, SND_SOC_CLOCK_OUT); if (ret < 0) Really odd, so we'll have something different, at the moment I don't know what could be the difference. >> >> For me it's really odd have to set the clock-frequency to 24MHz to make it work >> >> clock-frequency = <24000000>; > > If I change it to this, I will have slow motion playback, as expected. > >> For that reason I'm wondering if there is a bug in the driver, did >> anyone test with an am335x-evm board ? > > I'm using linux-next. > Not sure what could be the issue. > >> >>>> >>>> [1] https://patchwork.kernel.org/patch/6480071/ >>>> >>>> Thanks in advance, >>>> Enric >>>> >>> >>> -- >>> Péter >> >> Thanks, >> Enric >> > > > -- > Péter _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: Audio play problem with tlv320aic3106 in mainline. 2015-06-01 9:16 ` Enric Balletbo Serra @ 2015-06-01 12:10 ` Peter Ujfalusi 0 siblings, 0 replies; 6+ messages in thread From: Peter Ujfalusi @ 2015-06-01 12:10 UTC (permalink / raw) To: Enric Balletbo Serra Cc: alsa-devel, Lars-Peter Clausen, Takashi Iwai, Liam Girdwood, Jyri Sarha, Mark Brown On 06/01/2015 12:16 PM, Enric Balletbo Serra wrote: > Hi, > > 2015-05-29 14:16 GMT+02:00 Peter Ujfalusi <peter.ujfalusi@ti.com>: >> On 05/29/2015 12:24 PM, Enric Balletbo Serra wrote: >>>> It might be really 24MHz. >>>> If the MCLK in your board is wired like am335x-evmsk or how BeagleBone's audio >>>> capes are wired (MCLK is coming from AM335x's EVENT_INTR0/1 pin as CLKOUT1/2) >>>> then 24MHz is correct. On the am335x-evm there is a dedicated crystal >>>> providing the 12MHz. >>>> >>> Well, in my board there is also a dedicated crystal providing the >>> 12MHz, so I expect that the correct value for clock-frequency is 12MHz >>> not 24MHz. >> >> I was wrong with the BBW audio cape.. At least the RevA which I have does have >> 12MHz crystal connected to aic3106 MCLK, but there is a line to the SoC's >> CLKOUT2. By default the codec runs using the 12MHz. >> I have checked with a scope and yep, I have 12MHz for MCLK. >> >>> >>> clocks { >>> compatible = "simple-bus"; >>> #address-cells = <1>; >>> #size-cells = <0>; >>> >>> /* audio external oscillator */ >>> tlv320aic3x_mclk: oscillator@0 { >>> compatible = "fixed-clock"; >>> #clock-cells = <0>; >>> clock-frequency = <12000000>; /* 12MHz */ >>> }; >>> }; >>> >>> sound { >>> compatible = "ti,da830-evm-audio"; >>> ti,model = "AM335x-SL50"; >>> ti,audio-codec = <&audio_codec>; >>> ti,mcasp-controller = <&mcasp0>; >>> >>> clocks = <&tlv320aic3x_mclk>; >>> clock-names = "mclk"; >>> >>> ti,audio-routing = >>> "Headphone Jack", "HPLOUT", >>> "Headphone Jack", "HPROUT", >>> "LINE1R", "Line In", >>> "LINE1L", "Line In"; >>> }; >> >> If I use this with my BBW+Audio cape: audio is fine. >> > > Tested with linux-next and same problem here, I also checked with a > scope my clock and it's 12MHz but I need to apply this patch to make > it work. > > diff --git a/sound/soc/davinci/davinci-evm.c b/sound/soc/davinci/davinci-evm.c > index 731fb0d..8ce0d32 100644 > --- a/sound/soc/davinci/davinci-evm.c > +++ b/sound/soc/davinci/davinci-evm.c > @@ -64,6 +64,11 @@ static int evm_hw_params(struct snd_pcm_substream *substream, > unsigned sysclk = ((struct snd_soc_card_drvdata_davinci *) > snd_soc_card_get_drvdata(soc_card))->sysclk; > > + ret = snd_soc_dai_set_clkdiv(cpu_dai, 0, 2); > + if (ret < 0) > + return ret; This does not make sense... McASP is supposed to be slave when used with compatible = "ti,da830-evm-audio" This means that the reference clock is coming from internal source and AHCLKX pin is output. Setting the divider for the high-frequency clock should not be needed since the McASP is not generating any of the clocks. BTW: I see that in the DTS you are configuring the mcasp0.ahclkx pin. How this is used? While we are here, you can change the AXR2 pinmux to output. I have 'cloned' your setup on my BBW+AudioCape where I also have 12MHz MCLK. I don't have any problem with the playback speed. -- Péter ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-06-01 12:10 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-05-28 11:36 Audio play problem with tlv320aic3106 in mainline Enric Balletbo Serra 2015-05-29 7:20 ` Peter Ujfalusi 2015-05-29 9:24 ` Enric Balletbo Serra 2015-05-29 12:16 ` Peter Ujfalusi 2015-06-01 9:16 ` Enric Balletbo Serra 2015-06-01 12:10 ` Peter Ujfalusi
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).