All of lore.kernel.org
 help / color / mirror / Atom feed
* MX28EVK mainline 3.5-Patchs-3.5-rc5 sgtl5000 record not working
@ 2012-07-10 16:09 Andreas Gretler
  2012-07-11  3:14 ` Shawn Guo
  0 siblings, 1 reply; 6+ messages in thread
From: Andreas Gretler @ 2012-07-10 16:09 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

i've tested mainline 3.5-Patchs-3.5-rc5 for MX28EVK and it boot up and
work fine.

But I'm not able to record something. Playback works. I also test it
against the old 2.6.35.3 Kernel and there record works.

arecord -l show me this:

**** List of CAPTURE Hardware Devices ****
card 0: mxssgtl5000 [mxs_sgtl5000], device 0: HiFi Playback sgtl5000-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: mxssgtl5000 [mxs_sgtl5000], device 1: HiFi Capture sgtl5000-1 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0


I try record with arecord -d 2 -D hw:0,1 -f dat test.wav , but it
crash the Linux. No ErrMsg printed and the board stop working.
I have no idea what goes wrong. I put some printk message in
mxs-saif.c and the last message i can see before the board crash is in
mxs_saif_trigger() is before clk_enable is called.

		/*
		 * If the saif's master is not himself, we also need to enable
		 * itself clk for its internal basic logic to work.
		 */
		if (saif != master_saif) {
			clk_enable(saif->clk);
			__raw_writel(BM_SAIF_CTRL_RUN,
				saif->base + SAIF_CTRL + MXS_SET_ADDR);
		}

 In alsamixer i can not toggle the capture source from Mic-In to
Line-in and also can't change the Headphone from DAC to Line-IN.

I'm not sure this is the right place to ask? I will also post ist to
alsa-devel at alsa-project.org.
Can anyone confirm the Problem? Or do/understand I something wrong
with record and there is no Problem?

Andreas Gretler

^ permalink raw reply	[flat|nested] 6+ messages in thread

* MX28EVK mainline 3.5-Patchs-3.5-rc5 sgtl5000 record not working
  2012-07-10 16:09 MX28EVK mainline 3.5-Patchs-3.5-rc5 sgtl5000 record not working Andreas Gretler
@ 2012-07-11  3:14 ` Shawn Guo
  2012-07-11  8:52   ` Dong Aisheng
  0 siblings, 1 reply; 6+ messages in thread
From: Shawn Guo @ 2012-07-11  3:14 UTC (permalink / raw)
  To: linux-arm-kernel

Copy driver maintainer Dong here.

Regards,
Shawn

On Tue, Jul 10, 2012 at 06:09:44PM +0200, Andreas Gretler wrote:
> Hi,
> 
> i've tested mainline 3.5-Patchs-3.5-rc5 for MX28EVK and it boot up and
> work fine.
> 
> But I'm not able to record something. Playback works. I also test it
> against the old 2.6.35.3 Kernel and there record works.
> 
> arecord -l show me this:
> 
> **** List of CAPTURE Hardware Devices ****
> card 0: mxssgtl5000 [mxs_sgtl5000], device 0: HiFi Playback sgtl5000-0 []
>   Subdevices: 1/1
>   Subdevice #0: subdevice #0
> card 0: mxssgtl5000 [mxs_sgtl5000], device 1: HiFi Capture sgtl5000-1 []
>   Subdevices: 1/1
>   Subdevice #0: subdevice #0
> 
> 
> I try record with arecord -d 2 -D hw:0,1 -f dat test.wav , but it
> crash the Linux. No ErrMsg printed and the board stop working.
> I have no idea what goes wrong. I put some printk message in
> mxs-saif.c and the last message i can see before the board crash is in
> mxs_saif_trigger() is before clk_enable is called.
> 
> 		/*
> 		 * If the saif's master is not himself, we also need to enable
> 		 * itself clk for its internal basic logic to work.
> 		 */
> 		if (saif != master_saif) {
> 			clk_enable(saif->clk);
> 			__raw_writel(BM_SAIF_CTRL_RUN,
> 				saif->base + SAIF_CTRL + MXS_SET_ADDR);
> 		}
> 
>  In alsamixer i can not toggle the capture source from Mic-In to
> Line-in and also can't change the Headphone from DAC to Line-IN.
> 
> I'm not sure this is the right place to ask? I will also post ist to
> alsa-devel at alsa-project.org.
> Can anyone confirm the Problem? Or do/understand I something wrong
> with record and there is no Problem?
> 
> Andreas Gretler
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* MX28EVK mainline 3.5-Patchs-3.5-rc5 sgtl5000 record not working
  2012-07-11  3:14 ` Shawn Guo
@ 2012-07-11  8:52   ` Dong Aisheng
  2012-07-16 11:23     ` Andreas Gretler
  0 siblings, 1 reply; 6+ messages in thread
From: Dong Aisheng @ 2012-07-11  8:52 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Jul 11, 2012 at 11:14:48AM +0800, Shawn Guo wrote:
> Copy driver maintainer Dong here.
> 
> Regards,
> Shawn
> 
> On Tue, Jul 10, 2012 at 06:09:44PM +0200, Andreas Gretler wrote:
> > Hi,
> > 
> > i've tested mainline 3.5-Patchs-3.5-rc5 for MX28EVK and it boot up and
> > work fine.
> > 
> > But I'm not able to record something. Playback works. I also test it
> > against the old 2.6.35.3 Kernel and there record works.
> > 
> > arecord -l show me this:
> > 
> > **** List of CAPTURE Hardware Devices ****
> > card 0: mxssgtl5000 [mxs_sgtl5000], device 0: HiFi Playback sgtl5000-0 []
> >   Subdevices: 1/1
> >   Subdevice #0: subdevice #0
> > card 0: mxssgtl5000 [mxs_sgtl5000], device 1: HiFi Capture sgtl5000-1 []
> >   Subdevices: 1/1
> >   Subdevice #0: subdevice #0
> > 
> > 
> > I try record with arecord -d 2 -D hw:0,1 -f dat test.wav , but it
> > crash the Linux. No ErrMsg printed and the board stop working.
> > I have no idea what goes wrong. I put some printk message in
> > mxs-saif.c and the last message i can see before the board crash is in
> > mxs_saif_trigger() is before clk_enable is called.
> > 
> > 		/*
> > 		 * If the saif's master is not himself, we also need to enable
> > 		 * itself clk for its internal basic logic to work.
> > 		 */
> > 		if (saif != master_saif) {
> > 			clk_enable(saif->clk);
> > 			__raw_writel(BM_SAIF_CTRL_RUN,
> > 				saif->base + SAIF_CTRL + MXS_SET_ADDR);
> > 		}
> > 
> >  In alsamixer i can not toggle the capture source from Mic-In to
> > Line-in and also can't change the Headphone from DAC to Line-IN.
> > 
> > I'm not sure this is the right place to ask? I will also post ist to
> > alsa-devel at alsa-project.org.
> > Can anyone confirm the Problem? Or do/understand I something wrong
> > with record and there is no Problem?
> > 
I can see the same problem at my side.
Usually it's caused by clock issue.
I will try to fix it tomorrow when have time.

Regards
Dong Aisheng

^ permalink raw reply	[flat|nested] 6+ messages in thread

* MX28EVK mainline 3.5-Patchs-3.5-rc5 sgtl5000 record not working
  2012-07-11  8:52   ` Dong Aisheng
@ 2012-07-16 11:23     ` Andreas Gretler
  2012-07-17 11:55       ` Dong Aisheng
  2012-07-23  9:29       ` Dong Aisheng
  0 siblings, 2 replies; 6+ messages in thread
From: Andreas Gretler @ 2012-07-16 11:23 UTC (permalink / raw)
  To: linux-arm-kernel

> I can see the same problem at my side.
> Usually it's caused by clock issue.
> I will try to fix it tomorrow when have time.
>
> Regards
> Dong Aisheng
>
 Hi,

i did a bit more research on it. Before the change to common clock
framework, it seems that I can toggle the headphone and adc from Mic
to Line in. The headphone toggle to direct output works, but
unfortunately if i toggle the ADC input source to Line-In  the
recorded sound is only a noisy signal.

I test several past version, but I can not find a version where the
recording function for Line-In works.


I try to understand the saif-code, but i does not understand why not
all clk_enable are replaced by clk_prepare_enable. Can anyone explain
that? I replaced the clk_enable clk_prepare_enableand the board does
not crash, but there is an input/output error.

                /*
                 * If the saif's master is not himself, we also need to enable
                 * itself clk for its internal basic logic to work.
                 */
                if (saif != master_saif) {
                        clk_enable(saif->clk);
                        __raw_writel(BM_SAIF_CTRL_RUN,
                                saif->base + SAIF_CTRL + MXS_SET_ADDR);
                }


Another question is about the initial clock rate for the saif internal
logic. Befor the clock_mx28.c was deleted, there was an
clk_set_rate(&saif1_clk, 24000000); for internal logic. Where it is
now being made? I did not found it.

I'm new to driver development and I want to develop a driver for the
Cirrus cs5381 ADC Codec. That's why I want to understand the saif
code.  The codec is pretty simple, because it can be only configured
the data output format and the Master/slave Clock mode.  Unfortunately
i would like to get the codec working in master mode with MCLK is
driven by external clock source to the codec. I see in the source code
that only EXTMSTR0 mode is implemented. I would like to get the DIRECT
mode working, and use SAIF1 in Slave mode for recive only.  For my
understanding in the SGTL5000 drive, the SAIF1 works in slave mode and
get it BITCLK and LRCLK from Saif0. I think and hope that the changes
to get the Directmode working is not very much.  The Codec provide the
BITCLK and LRCLK to the cpu . But I don't unterstand to handle that
each Saif must have a master, described in the mxs-saif.c comment.
Because in my hardware setup I only need SAIF1 in Slave mode. Can you
give me a hint howto handle this?

Best regards Andreas

^ permalink raw reply	[flat|nested] 6+ messages in thread

* MX28EVK mainline 3.5-Patchs-3.5-rc5 sgtl5000 record not working
  2012-07-16 11:23     ` Andreas Gretler
@ 2012-07-17 11:55       ` Dong Aisheng
  2012-07-23  9:29       ` Dong Aisheng
  1 sibling, 0 replies; 6+ messages in thread
From: Dong Aisheng @ 2012-07-17 11:55 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Jul 16, 2012 at 07:23:42PM +0800, Andreas Gretler wrote:
> > I can see the same problem at my side.
> > Usually it's caused by clock issue.
> > I will try to fix it tomorrow when have time.
> >
> > Regards
> > Dong Aisheng
> >
>  Hi,
> 
> i did a bit more research on it. Before the change to common clock
> framework, it seems that I can toggle the headphone and adc from Mic
> to Line in. The headphone toggle to direct output works, but
> unfortunately if i toggle the ADC input source to Line-In  the
> recorded sound is only a noisy signal.
> 
> I test several past version, but I can not find a version where the
> recording function for Line-In works.
> 
> 
It seems it's broken for a long time.
I tried 3.3 kernel, with adding below change the record can work(
can hear some noise, however, that's another issue of codec driver).
diff --git a/arch/arm/mach-mxs/clock-mx28.c b/arch/arm/mach-mxs/clock-mx28.c
index 5d68e41..bce93c3 100644
--- a/arch/arm/mach-mxs/clock-mx28.c
+++ b/arch/arm/mach-mxs/clock-mx28.c
@@ -820,8 +820,12 @@ int __init mx28_clocks_init(void)
* uses the other saif's BITCLK&LRCLK but it still needs a basic
* clock which should be fast enough for the internal logic.
*/
+       clk_prepare_enable(&saif0_clk);
+       clk_prepare_enable(&saif1_clk);
        clk_set_rate(&saif0_clk, 24000000);
	clk_set_rate(&saif1_clk, 24000000);

The reason is that the clk_enable function becomes 'nops' after commit:
6abda3e ARM: mxs: select HAVE_CLK_PREPARE for clock
which could cause clock not to be enabled properly.
You can give a quick try.

> I try to understand the saif-code, but i does not understand why not
> all clk_enable are replaced by clk_prepare_enable. Can anyone explain
clk_prepare_enable can not be called in atomic context.
So in trigger function, we call clk_enable instead.

> that? I replaced the clk_enable clk_prepare_enableand the board does
> not crash, but there is an input/output error.
> 
It seems dma did not work properly.

>                 /*
>                  * If the saif's master is not himself, we also need to enable
>                  * itself clk for its internal basic logic to work.
>                  */
>                 if (saif != master_saif) {
>                         clk_enable(saif->clk);
>                         __raw_writel(BM_SAIF_CTRL_RUN,
>                                 saif->base + SAIF_CTRL + MXS_SET_ADDR);
>                 }
> 
> 
> Another question is about the initial clock rate for the saif internal
> logic. Befor the clock_mx28.c was deleted, there was an
> clk_set_rate(&saif1_clk, 24000000); for internal logic. Where it is
> now being made? I did not found it.
That should be added.
I tried, but still did not work.
Still did not have too much time to dig into it.

For others, will reply your later.

Regards
Dong Aisheng

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* MX28EVK mainline 3.5-Patchs-3.5-rc5 sgtl5000 record not working
  2012-07-16 11:23     ` Andreas Gretler
  2012-07-17 11:55       ` Dong Aisheng
@ 2012-07-23  9:29       ` Dong Aisheng
  1 sibling, 0 replies; 6+ messages in thread
From: Dong Aisheng @ 2012-07-23  9:29 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Jul 16, 2012 at 07:23:42PM +0800, Andreas Gretler wrote:
Sorry for late reply, a little busy these days and did not have too much
time to research it.

> I'm new to driver development and I want to develop a driver for the
> Cirrus cs5381 ADC Codec. That's why I want to understand the saif
> code.  The codec is pretty simple, because it can be only configured
> the data output format and the Master/slave Clock mode.  Unfortunately
> i would like to get the codec working in master mode with MCLK is
> driven by external clock source to the codec.
> I see in the source code
> that only EXTMSTR0 mode is implemented. I would like to get the DIRECT
> mode working, and use SAIF1 in Slave mode for recive only.  For my
> understanding in the SGTL5000 drive, the SAIF1 works in slave mode and
> get it BITCLK and LRCLK from Saif0. I think and hope that the changes
> to get the Directmode working is not very much.  The Codec provide the
> BITCLK and LRCLK to the cpu . But I don't unterstand to handle that
> each Saif must have a master, described in the mxs-saif.c comment.
> Because in my hardware setup I only need SAIF1 in Slave mode. Can you
> give me a hint howto handle this?
> 
Hmm, the most quick method maybe saif as master and codec as slave since
current driver supports that.
If you really want the codec to be master, what i think you can try is:
1) make the saif driver support working on slave mode for record
Currently mxs-saif driver only supports master mode, mainly due to saif
tx can only work as master so we simply make saif as master by default to
codec for both rx/tx. But from spec, saif could be a slave to codec and
receive clocks from codec if only working on rx.
You may need change mxs_saif_set_dai_fmt a bit.
2) you probably also need set saif clkmux to DIRECT mode via
mxs_saif_clkmux_select.
3) If you want the saif to provide mclk to codec, i have tried that saif
can also output mclk when working on slave mode.
But i have no such board working like that, you may need give a try
if saif can work properly on that mode for record.

Regards
Dong Aisheng

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-07-23  9:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-10 16:09 MX28EVK mainline 3.5-Patchs-3.5-rc5 sgtl5000 record not working Andreas Gretler
2012-07-11  3:14 ` Shawn Guo
2012-07-11  8:52   ` Dong Aisheng
2012-07-16 11:23     ` Andreas Gretler
2012-07-17 11:55       ` Dong Aisheng
2012-07-23  9:29       ` Dong Aisheng

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.