Skip to contentSkip to conversation

r8a7790 only has audio when clock is forced on

DISCUSSION Violeta Menendez Gonzalez 6 participants 14 messages Jun 3, 2014 – Jun 6, 2014 SuperH

lore
Share & tools
lore
#0 lore raw

Hi all,

We have a problem where audio on r8a7790 is not working due to it not sending interrupts.

We've verified that the pins and the clocks are working and correctly configured. The codec is starting and producing correct bit and word clock signals

We've made a hack to force /mstp10_clks /on that makes the audio work. Further investigation showed that it's only needed to force SSI(ALL) on, but, as far as we know, the manual doesn't say anything about it having to be kept on.

We've also debugged this hack and saw that the registers have correct values. These are some of the debugging messages we have when the audio fails:

Playing WAVE '../audio/r.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
cpg_mstp_clock_endisable: index 5, enable 1
cpg_mstp_clock_endisable: index 5, value read from group->smstpcr 0002ffe0
cpg_mstp_clock_endisable: index 5, value write in group->smstpcr 0002ffc0
cpg_mstp_clock_endisable: index 15, enable 1
cpg_mstp_clock_endisable: index 15, value read from group->smstpcr 0002ffc0
cpg_mstp_clock_endisable: index 15, value written in group->smstpcr 00027fc0
aplay: pcm_writecpg_mstp_clock_endisable: index 15, enable 0
cpg_mstp_clock_endisable: index 15, value read from group->smstpcr 00027fc0
cpg_mstp_clock_endisable: index 15, value write in group->smstpcr 0002ffc0 :1710: write errcpg_mstp_clock_endisable: index 5, enable 0
cpg_mstp_clock_endisable: index 5, value read from group->smstpcr 0002ffc0
cpg_mstp_clock_endisable: index 5, value write in group->smstpcr 0002ffe0
or: Input/output error

This shows that the SSI (ALL) clock in bit 5 being enabled before the SSI0 and that it is also disabled in the reverse sequence as expected.

Not sure what to do next or what the problem could be. Any new ideas are welcome,

Thanks!

Signature · 2 lines
Violeta Menéndez González	http://www.codethink.co.uk/
Software Engineer		Codethink - Providing Genius
#1 lore raw
Quoted 4 lines · Violeta Menendez Gonzalez

Hi all,

We have a problem where audio on r8a7790 is not working due to it not sending interrupts.

Adding Morimoto-san who does most of the work on those drivers upstream
- it's always best to CC relevant maintainers/developers on kernel stuff as things only on the lists are easily missed. Not deleting context so he sees it.

Quoted 47 lines

We've verified that the pins and the clocks are working and correctly configured. The codec is starting and producing correct bit and word clock signals

We've made a hack to force /mstp10_clks /on that makes the audio work. Further investigation showed that it's only needed to force SSI(ALL) on, but, as far as we know, the manual doesn't say anything about it having to be kept on.

We've also debugged this hack and saw that the registers have correct values. These are some of the debugging messages we have when the audio fails:

Playing WAVE '../audio/r.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
cpg_mstp_clock_endisable: index 5, enable 1
cpg_mstp_clock_endisable: index 5, value read from group->smstpcr 0002ffe0
cpg_mstp_clock_endisable: index 5, value write in group->smstpcr 0002ffc0
cpg_mstp_clock_endisable: index 15, enable 1
cpg_mstp_clock_endisable: index 15, value read from group->smstpcr 0002ffc0
cpg_mstp_clock_endisable: index 15, value written in group->smstpcr 00027fc0
aplay: pcm_writecpg_mstp_clock_endisable: index 15, enable 0
cpg_mstp_clock_endisable: index 15, value read from group->smstpcr 00027fc0
cpg_mstp_clock_endisable: index 15, value write in group->smstpcr 0002ffc0 :1710: write errcpg_mstp_clock_endisable: index 5, enable 0
cpg_mstp_clock_endisable: index 5, value read from group->smstpcr 0002ffc0
cpg_mstp_clock_endisable: index 5, value write in group->smstpcr 0002ffe0
or: Input/output error

This shows that the SSI (ALL) clock in bit 5 being enabled before the SSI0 and that it is also disabled in the reverse sequence as expected.

Not sure what to do next or what the problem could be. Any new ideas are welcome,

Thanks!

Signature · 7 lines
Violeta Menéndez González	http://www.codethink.co.uk/
Software Engineer		Codethink - Providing Genius

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
#2 lore raw

Hi Violeta, Mark

Quoted 4 lines

Adding Morimoto-san who does most of the work on those drivers upstream
- it's always best to CC relevant maintainers/developers on kernel stuff as things only on the lists are easily missed. Not deleting context so he sees it.

Thank you for adding me.
I want to help you

Quoted 2 lines
Quoted 2 lines

We have a problem where audio on r8a7790 is not working due to it not sending interrupts.

I need to ask you something

- Are you using lager board ?
- Which kernel are you using ?
- Does your kernel booted from legacy code (= using board-lager.c) or from DT code (= using board-lager-referenct.c) ?

Quoted 4 lines

We've made a hack to force /mstp10_clks /on that makes the audio work. Further investigation showed that it's only needed to force SSI(ALL) on, but, as far as we know, the manual doesn't say anything about it having to be kept on.

YES. all SSI port needs SSI(ALL).
(Actually, all SRC needs SRC(ALL) too if you use it)

Basically, R-Car sound is very complex IP.
The interrupt/data register/DMA selection are depends on your "data path"

This driver is producing many steps to use it.

At 1st, you can use "PIO transfer". this is not good performance, but, very easy settings. you can check your basic setting by this. (power/codec/pin/clock...)

The data path is..

          PIO
    [MEM] ---> [SSI]

Next step is "using DMA". but, R-Car sound has 2 DMAs (Audio DMAC/Audio DMAC peri peri) And, these DMAC usage is complex too. So, you can use basic DMA transfer as DMA 1st step. The data path is..

       Audio DMAC
    [MEM] ---> [SSI]

Next step is more complex. use SRC

Audio DMAC
Audio DMAC peri peri
[MEM] ---> [SRC] --->[SSI]

Final step is using DVC

Audio DMAC
Audio DMAC peri peri
[MEM] ---> [SRC] ---> [DVC] --->[SSI]

Actually, lagacy boot is supporting above all path. But, DT boot is supporting 1st/2nd step only at this point (On rsnd driver side, DMAEngine DT is not yet supporing) I want to support 3rd/4th step on DT, but I'm busy now...

I pushed my local patches which are based on LTSI v3.4 + our original patches. These are tring to use sound as legacy code (= not DT) for lager/koelsh. Maybe not good fit too you, but can help ?

https://dl.dropboxusercontent.com/u/2774973/lager-koelsh-sound.tar.bz2

#3 lore raw
Quoted 21 lines · Kuninori Morimoto

Hi Violeta, Mark

Quoted 4 lines

Adding Morimoto-san who does most of the work on those drivers upstream
- it's always best to CC relevant maintainers/developers on kernel stuff as things only on the lists are easily missed. Not deleting context so he sees it.

Thank you for adding me.
I want to help you

Quoted 2 lines
Quoted 2 lines

We have a problem where audio on r8a7790 is not working due to it not sending interrupts.

I need to ask you something

- Are you using lager board ?
- Which kernel are you using ?
- Does your kernel booted from legacy code (= using board-lager.c) or from DT code (= using board-lager-referenct.c) ?

Quoted 7 lines
Quoted 4 lines

We've made a hack to force /mstp10_clks /on that makes the audio work. Further investigation showed that it's only needed to force SSI(ALL) on, but, as far as we know, the manual doesn't say anything about it having to be kept on.

YES. all SSI port needs SSI(ALL).
(Actually, all SRC needs SRC(ALL) too if you use it)

The result of our investigation is as follows:

- The clock code correctly enables SSI(ALL) but the audio does not work
- If we force SSI(ALL) to be on all the time, we have working audio

Quoted 49 lines

Basically, R-Car sound is very complex IP.
The interrupt/data register/DMA selection are depends on your "data path"

This driver is producing many steps to use it.

At 1st, you can use "PIO transfer". this is not good performance, but, very easy settings. you can check your basic setting by this. (power/codec/pin/clock...)

The data path is..

          PIO
    [MEM] ---> [SSI]

Next step is "using DMA". but, R-Car sound has 2 DMAs (Audio DMAC/Audio DMAC peri peri) And, these DMAC usage is complex too. So, you can use basic DMA transfer as DMA 1st step. The data path is..

       Audio DMAC
    [MEM] ---> [SSI]

Next step is more complex. use SRC

Audio DMAC
Audio DMAC peri peri
[MEM] ---> [SRC] --->[SSI]

Final step is using DVC

Audio DMAC
Audio DMAC peri peri
[MEM] ---> [SRC] ---> [DVC] --->[SSI]

Actually, lagacy boot is supporting above all path. But, DT boot is supporting 1st/2nd step only at this point (On rsnd driver side, DMAEngine DT is not yet supporing) I want to support 3rd/4th step on DT, but I'm busy now...

I pushed my local patches which are based on LTSI v3.4 + our original patches. These are tring to use sound as legacy code (= not DT) for lager/koelsh. Maybe not good fit too you, but can help ?

https://dl.dropboxusercontent.com/u/2774973/lager-koelsh-sound.tar.bz2
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 2 lines
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius
#4 lore raw

Hi Ben

# I misunderstood your point...

Quoted 4 lines

The result of our investigation is as follows:

- The clock code correctly enables SSI(ALL) but the audio does not work
- If we force SSI(ALL) to be on all the time, we have working audio

SSI(ALL) bit mean "this bit is always required for all SSI" If you want to use SSI0, then, you need to enable "SSI(ALL) + SSI0" bit

#5 lore raw

Hi!

Quoted 5 lines · Kuninori Morimoto

Hi Ben

# I misunderstood your point...

Quoted 8 lines
Quoted 4 lines

The result of our investigation is as follows:

- The clock code correctly enables SSI(ALL) but the audio does not work
- If we force SSI(ALL) to be on all the time, we have working audio

SSI(ALL) bit mean "this bit is always required for all SSI" If you want to use SSI0, then, you need to enable "SSI(ALL) + SSI0" bit

We have to force SSI(ALL) to stay always on on the DT with a special property, like this:
always-on = <0x00000020>;

we don't need to force SSI0 on, although it is necessary for audio that this clock is on too.

The code for mstp10 correctly enables SSI0 *and* SSI(ALL). But it only works when SSI(ALL) is forced on the DT.

When we do on the DT: always-on = <0x00000020>;
we have:
cpg_mstp_clock_endisable: index 5, enable 0
cpg_mstp_clock_endisable: index 5, value read from group->smstpcr 0002ffc0
cpg_mstp_clock_endisable: index 5, value write in group->smstpcr 0002ffc0
cpg_mstp_clock_endisable: index 5, enable 1
cpg_mstp_clock_endisable: index 5, value read from group->smstpcr 0002ffc0
cpg_mstp_clock_endisable: index 5, value write in group->smstpcr 0002ffc0
cpg_mstp_clock_endisable: index 15, enable 1
cpg_mstp_clock_endisable: index 15, value read from group->smstpcr 0002ffc0
cpg_mstp_clock_endisable: index 15, value write in group->smstpcr 00027fc0
cpg_mstp_clock_endisable: index 15, enable 0
cpg_mstp_clock_endisable: index 15, value read from group->smstpcr 00027fc0
cpg_mstp_clock_endisable: index 15, value write in group->smstpcr 0002ffc0
cpg_mstp_clock_endisable: index 5, enable 0
cpg_mstp_clock_endisable: index 5, value read from group->smstpcr 0002ffc0
cpg_mstp_clock_endisable: index 5, value write in group->smstpcr 0002ffc0 and audio is working correctly.

If we do: always-on = <0x00000000>; (or not having the property at all) then we have:
cpg_mstp_clock_endisable: index 5, enable 1
cpg_mstp_clock_endisable: index 5, value read from group->smstpcr 0002ffe0
cpg_mstp_clock_endisable: index 5, value write in group->smstpcr 0002ffc0
cpg_mstp_clock_endisable: index 15, enable 1
cpg_mstp_clock_endisable: index 15, value read from group->smstpcr 0002ffc0
cpg_mstp_clock_endisable: index 15, value write in group->smstpcr 00027fc0
cpg_mstp_clock_endisable: index 15, enable 0
cpg_mstp_clock_endisable: index 15, value read from group->smstpcr 00027fc0
cpg_mstp_clock_endisable: index 15, value write in group->smstpcr 0002ffc0
cpg_mstp_clock_endisable: index 5, enable 0
cpg_mstp_clock_endisable: index 5, value read from group->smstpcr 0002ffc0
cpg_mstp_clock_endisable: index 5, value write in group->smstpcr 0002ffe0 and we don't have audio at all.

Where index 5 is SSI(ALL) and index 15 is SSI0.
We can observe that when we force SSI(ALL) on on the DT, then clock_disable is called for SSI(ALL) before it enables again. But when we don't force SSI(ALL) to be on, then it only calls clock_enable, but the register data is the same.

This looks like the correct behaviour, but in one case we have audio, and in the other we don't.

I hope this clarifies the problem a bit more.

Thanks

Signature · 2 lines
Violeta Menéndez González	http://www.codethink.co.uk/
Software Engineer		Codethink - Providing Genius
#6 lore raw

Hi Violeta

Quoted 13 lines
Quoted 3 lines

SSI(ALL) bit mean "this bit is always required for all SSI" If you want to use SSI0, then, you need to enable "SSI(ALL) + SSI0" bit

We have to force SSI(ALL) to stay always on on the DT with a special property, like this:
always-on = <0x00000020>;

we don't need to force SSI0 on, although it is necessary for audio that this clock is on too.

The code for mstp10 correctly enables SSI0 *and* SSI(ALL). But it only works when SSI(ALL) is forced on the DT.

(snip)

Quoted 10 lines

Where index 5 is SSI(ALL) and index 15 is SSI0.
We can observe that when we force SSI(ALL) on on the DT, then clock_disable is called for SSI(ALL) before it enables again. But when we don't force SSI(ALL) to be on, then it only calls clock_enable, but the register data is the same.

This looks like the correct behaviour, but in one case we have audio, and in the other we don't.

I hope this clarifies the problem a bit more.

I understand your point on DT with SSI(ALL).
I didn't send R-Car sound DT support patch yet for some reasons. But, R-Car sound clock needs trick.

- SSI(ALL) is called via pm_runtime_xxx() from sound driver
- SRC(ALL) is called as parent clock of SRCn clocks

This is implemented on legacy clock-r8a7790.c too. So, I think "always-on" is not needed for sound driver.

My local DTS file is below.
(not enough maintenance though...)

It is very nice if you can wait for my DT patches, since R-Car sound driver is very complex / needs some trick etc...

     mstp10_clks: mstp10_clks@e6150998 {
                compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks";
                reg = <0 0xe6150998 0 4>, <0 0xe61509a8 0 4>;
                clocks = <&p_clk>, /* parent of SCU */
                        <&p_clk>,
                        <&p_clk>, <&p_clk>, <&p_clk>, <&p_clk>, <&p_clk>,
                        <&p_clk>, <&p_clk>, <&p_clk>, <&p_clk>, <&p_clk>,
                        <&mstp10_clks R8A7790_CLK_SCU>, <&mstp10_clks R8A7790_CLK_SCU>,
                        <&mstp10_clks R8A7790_CLK_SCU>, <&mstp10_clks R8A7790_CLK_SCU>,
                        <&mstp10_clks R8A7790_CLK_SCU>, <&mstp10_clks R8A7790_CLK_SCU>,
                        <&mstp10_clks R8A7790_CLK_SCU>, <&mstp10_clks R8A7790_CLK_SCU>,
                        <&mstp10_clks R8A7790_CLK_SCU>, <&mstp10_clks R8A7790_CLK_SCU>,
                        <&mstp10_clks R8A7790_CLK_SCU>, <&mstp10_clks R8A7790_CLK_SCU>;
                  #clock-cells = <1>;
                clock-indices = <
                        R8A7790_CLK_SCU
                        R8A7790_CLK_SSI
                        R8A7790_CLK_SSI9 R8A7790_CLK_SSI8 R8A7790_CLK_SSI7 R8A7790_CLK_SSI6 R8A7790_CLK_SSI5
                        R8A7790_CLK_SSI4 R8A7790_CLK_SSI3 R8A7790_CLK_SSI2 R8A7790_CLK_SSI1 R8A7790_CLK_SSI0
                        R8A7790_CLK_DVC1 R8A7790_CLK_DVC0
                        R8A7790_CLK_SRC9 R8A7790_CLK_SRC8 R8A7790_CLK_SRC7 R8A7790_CLK_SRC6 R8A7790_CLK_SRC5
                        R8A7790_CLK_SRC4 R8A7790_CLK_SRC3 R8A7790_CLK_SRC2 R8A7790_CLK_SRC1 R8A7790_CLK_SRC0
                >;
                clock-output-names =
                        "scu", "ssi",
                        "ssi9", "ssi8", "ssi7", "ssi6", "ssi5",
                        "ssi4", "ssi3", "ssi2", "ssi1", "ssi0",
                        "dvc1", "dvc0",
                        "src9", "src8", "src7", "src6", "src5",
                        "src4", "src3", "src2", "src1", "src0";
        };

...

rcar_sound: rcar_sound@0xec500000 {
        #sound-dai-cells = <1>;
        compatible =  "renesas,rcar_sound-r8a7790", "renesas,rcar_sound-gen2", "renesas,rcar_sound";
        interrupt-parent = <&gic>;
        reg =   <0 0xec500000 0 0x1000>, /* SCU */
                <0 0xec5a0000 0 0x100>,  /* ADG */
                <0 0xec540000 0 0x1000>, /* SSIU */
                <0 0xec541000 0 0x1280>; /* SSI */
        clocks = <&mstp10_clks R8A7790_CLK_SSI>,
                <&mstp10_clks R8A7790_CLK_SSI9>, <&mstp10_clks R8A7790_CLK_SSI8>,
                <&mstp10_clks R8A7790_CLK_SSI7>, <&mstp10_clks R8A7790_CLK_SSI6>,
                <&mstp10_clks R8A7790_CLK_SSI5>, <&mstp10_clks R8A7790_CLK_SSI4>,
                <&mstp10_clks R8A7790_CLK_SSI3>, <&mstp10_clks R8A7790_CLK_SSI2>,
                <&mstp10_clks R8A7790_CLK_SSI1>, <&mstp10_clks R8A7790_CLK_SSI0>,
                <&mstp10_clks R8A7790_CLK_SRC9>, <&mstp10_clks R8A7790_CLK_SRC8>,
                <&mstp10_clks R8A7790_CLK_SRC7>, <&mstp10_clks R8A7790_CLK_SRC6>,
                <&mstp10_clks R8A7790_CLK_SRC5>, <&mstp10_clks R8A7790_CLK_SRC4>,
                <&mstp10_clks R8A7790_CLK_SRC3>, <&mstp10_clks R8A7790_CLK_SRC2>,
                <&mstp10_clks R8A7790_CLK_SRC1>, <&mstp10_clks R8A7790_CLK_SRC0>,
                <&audio_clk_a>, <&audio_clk_b>, <&audio_clk_c>, <&m2_clk>;
        clock-names = "ssi",
                        "ssi.9", "ssi.8", "ssi.7", "ssi.6", "ssi.5",
                        "ssi.4", "ssi.3", "ssi.2", "ssi.1", "ssi.0",
                        "src.9", "src.8", "src.7", "src.6", "src.5",
                        "src.4", "src.3", "src.2", "src.1", "src.0",
                        "clk_a", "clk_b", "clk_c", "clk_i";
       ...
#7 lore raw
Quoted 26 lines · Kuninori Morimoto

Hi Violeta

Quoted 13 lines
Quoted 3 lines

SSI(ALL) bit mean "this bit is always required for all SSI" If you want to use SSI0, then, you need to enable "SSI(ALL) + SSI0" bit

We have to force SSI(ALL) to stay always on on the DT with a special property, like this:
always-on = <0x00000020>;

we don't need to force SSI0 on, although it is necessary for audio that this clock is on too.

The code for mstp10 correctly enables SSI0 *and* SSI(ALL). But it only works when SSI(ALL) is forced on the DT.

(snip)

Quoted 9 lines

Where index 5 is SSI(ALL) and index 15 is SSI0.
We can observe that when we force SSI(ALL) on on the DT, then clock_disable is called for SSI(ALL) before it enables again. But when we don't force SSI(ALL) to be on, then it only calls clock_enable, but the register data is the same.

This looks like the correct behaviour, but in one case we have audio, and in the other we don't.

Quoted 8 lines
Quoted 1 line

I hope this clarifies the problem a bit more.

I understand your point on DT with SSI(ALL).
I didn't send R-Car sound DT support patch yet for some reasons. But, R-Car sound clock needs trick.

- SSI(ALL) is called via pm_runtime_xxx() from sound driver
- SRC(ALL) is called as parent clock of SRCn clocks

See, this is why I /hate/ the implicit clock management. This is another case where we're getting bitten by it.

Quoted 9 lines

This is implemented on legacy clock-r8a7790.c too. So, I think "always-on" is not needed for sound driver.

My local DTS file is below.
(not enough maintenance though...)

It is very nice if you can wait for my DT patches, since R-Car sound driver is very complex / needs some trick etc...

Quoted 7 lines
     mstp10_clks: mstp10_clks@e6150998 {
                compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks";
                reg = <0 0xe6150998 0 4>, <0 0xe61509a8 0 4>;
                clocks = <&p_clk>, /* parent of SCU */
                        <&p_clk>,
                        <&p_clk>, <&p_clk>, <&p_clk>, <&p_clk>, <&p_clk>,
                        <&p_clk>, <&p_clk>, <&p_clk>, <&p_clk>, <&p_clk>,

we have these as <&mstp10_clks R8A7790_CLK_SSI>

Quoted 27 lines
                        <&mstp10_clks R8A7790_CLK_SCU>, <&mstp10_clks R8A7790_CLK_SCU>,
                        <&mstp10_clks R8A7790_CLK_SCU>, <&mstp10_clks R8A7790_CLK_SCU>,
                        <&mstp10_clks R8A7790_CLK_SCU>, <&mstp10_clks R8A7790_CLK_SCU>,
                        <&mstp10_clks R8A7790_CLK_SCU>, <&mstp10_clks R8A7790_CLK_SCU>,
                        <&mstp10_clks R8A7790_CLK_SCU>, <&mstp10_clks R8A7790_CLK_SCU>,
                        <&mstp10_clks R8A7790_CLK_SCU>, <&mstp10_clks R8A7790_CLK_SCU>;
                  #clock-cells = <1>;
                clock-indices = <
                        R8A7790_CLK_SCU
                        R8A7790_CLK_SSI
                        R8A7790_CLK_SSI9 R8A7790_CLK_SSI8 R8A7790_CLK_SSI7 R8A7790_CLK_SSI6 R8A7790_CLK_SSI5
                        R8A7790_CLK_SSI4 R8A7790_CLK_SSI3 R8A7790_CLK_SSI2 R8A7790_CLK_SSI1 R8A7790_CLK_SSI0
                        R8A7790_CLK_DVC1 R8A7790_CLK_DVC0
                        R8A7790_CLK_SRC9 R8A7790_CLK_SRC8 R8A7790_CLK_SRC7 R8A7790_CLK_SRC6 R8A7790_CLK_SRC5
                        R8A7790_CLK_SRC4 R8A7790_CLK_SRC3 R8A7790_CLK_SRC2 R8A7790_CLK_SRC1 R8A7790_CLK_SRC0
                >;
                clock-output-names =
                        "scu", "ssi",
                        "ssi9", "ssi8", "ssi7", "ssi6", "ssi5",
                        "ssi4", "ssi3", "ssi2", "ssi1", "ssi0",
                        "dvc1", "dvc0",
                        "src9", "src8", "src7", "src6", "src5",
                        "src4", "src3", "src2", "src1", "src0";
        };

...

Quoted 9 lines
rcar_sound: rcar_sound@0xec500000 {
        #sound-dai-cells = <1>;
        compatible =  "renesas,rcar_sound-r8a7790", "renesas,rcar_sound-gen2", "renesas,rcar_sound";
        interrupt-parent = <&gic>;
        reg =   <0 0xec500000 0 0x1000>, /* SCU */
                <0 0xec5a0000 0 0x100>,  /* ADG */
                <0 0xec540000 0 0x1000>, /* SSIU */
                <0 0xec541000 0 0x1280>; /* SSI */
        clocks = <&mstp10_clks R8A7790_CLK_SSI>,

I don't think we have this one here.

Quoted 19 lines
                <&mstp10_clks R8A7790_CLK_SSI9>, <&mstp10_clks R8A7790_CLK_SSI8>,
                <&mstp10_clks R8A7790_CLK_SSI7>, <&mstp10_clks R8A7790_CLK_SSI6>,
                <&mstp10_clks R8A7790_CLK_SSI5>, <&mstp10_clks R8A7790_CLK_SSI4>,
                <&mstp10_clks R8A7790_CLK_SSI3>, <&mstp10_clks R8A7790_CLK_SSI2>,
                <&mstp10_clks R8A7790_CLK_SSI1>, <&mstp10_clks R8A7790_CLK_SSI0>,
                <&mstp10_clks R8A7790_CLK_SRC9>, <&mstp10_clks R8A7790_CLK_SRC8>,
                <&mstp10_clks R8A7790_CLK_SRC7>, <&mstp10_clks R8A7790_CLK_SRC6>,
                <&mstp10_clks R8A7790_CLK_SRC5>, <&mstp10_clks R8A7790_CLK_SRC4>,
                <&mstp10_clks R8A7790_CLK_SRC3>, <&mstp10_clks R8A7790_CLK_SRC2>,
                <&mstp10_clks R8A7790_CLK_SRC1>, <&mstp10_clks R8A7790_CLK_SRC0>,
                <&audio_clk_a>, <&audio_clk_b>, <&audio_clk_c>, <&m2_clk>;
        clock-names = "ssi",
                        "ssi.9", "ssi.8", "ssi.7", "ssi.6", "ssi.5",
                        "ssi.4", "ssi.3", "ssi.2", "ssi.1", "ssi.0",
                        "src.9", "src.8", "src.7", "src.6", "src.5",
                        "src.4", "src.3", "src.2", "src.1", "src.0",
                        "clk_a", "clk_b", "clk_c", "clk_i";
       ...
Signature · 2 lines
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius
#8 lore raw
Quoted 95 lines · Ben Dooks
Quoted 26 lines · Kuninori Morimoto

Hi Violeta

Quoted 13 lines
Quoted 3 lines

SSI(ALL) bit mean "this bit is always required for all SSI" If you want to use SSI0, then, you need to enable "SSI(ALL) + SSI0" bit

We have to force SSI(ALL) to stay always on on the DT with a special property, like this:
always-on = <0x00000020>;

we don't need to force SSI0 on, although it is necessary for audio that this clock is on too.

The code for mstp10 correctly enables SSI0 *and* SSI(ALL). But it only works when SSI(ALL) is forced on the DT.

(snip)

Quoted 9 lines

Where index 5 is SSI(ALL) and index 15 is SSI0.
We can observe that when we force SSI(ALL) on on the DT, then clock_disable is called for SSI(ALL) before it enables again. But when we don't force SSI(ALL) to be on, then it only calls clock_enable, but the register data is the same.

This looks like the correct behaviour, but in one case we have audio, and in the other we don't.

Quoted 8 lines
Quoted 1 line

I hope this clarifies the problem a bit more.

I understand your point on DT with SSI(ALL).
I didn't send R-Car sound DT support patch yet for some reasons. But, R-Car sound clock needs trick.

- SSI(ALL) is called via pm_runtime_xxx() from sound driver
- SRC(ALL) is called as parent clock of SRCn clocks

See, this is why I /hate/ the implicit clock management. This is another case where we're getting bitten by it.

Quoted 9 lines

This is implemented on legacy clock-r8a7790.c too. So, I think "always-on" is not needed for sound driver.

My local DTS file is below.
(not enough maintenance though...)

It is very nice if you can wait for my DT patches, since R-Car sound driver is very complex / needs some trick etc...

Quoted 7 lines
      mstp10_clks: mstp10_clks@e6150998 {
                 compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks";
                 reg = <0 0xe6150998 0 4>, <0 0xe61509a8 0 4>;
                 clocks = <&p_clk>, /* parent of SCU */
                         <&p_clk>,
                         <&p_clk>, <&p_clk>, <&p_clk>, <&p_clk>, <&p_clk>,
                         <&p_clk>, <&p_clk>, <&p_clk>, <&p_clk>, <&p_clk>,

we have these as <&mstp10_clks R8A7790_CLK_SSI>

Quoted 27 lines
                         <&mstp10_clks R8A7790_CLK_SCU>, <&mstp10_clks R8A7790_CLK_SCU>,
                         <&mstp10_clks R8A7790_CLK_SCU>, <&mstp10_clks R8A7790_CLK_SCU>,
                         <&mstp10_clks R8A7790_CLK_SCU>, <&mstp10_clks R8A7790_CLK_SCU>,
                         <&mstp10_clks R8A7790_CLK_SCU>, <&mstp10_clks R8A7790_CLK_SCU>,
                         <&mstp10_clks R8A7790_CLK_SCU>, <&mstp10_clks R8A7790_CLK_SCU>,
                         <&mstp10_clks R8A7790_CLK_SCU>, <&mstp10_clks R8A7790_CLK_SCU>;
                   #clock-cells = <1>;
                 clock-indices = <
                         R8A7790_CLK_SCU
                         R8A7790_CLK_SSI
                         R8A7790_CLK_SSI9 R8A7790_CLK_SSI8 R8A7790_CLK_SSI7 R8A7790_CLK_SSI6 R8A7790_CLK_SSI5
                         R8A7790_CLK_SSI4 R8A7790_CLK_SSI3 R8A7790_CLK_SSI2 R8A7790_CLK_SSI1 R8A7790_CLK_SSI0
                         R8A7790_CLK_DVC1 R8A7790_CLK_DVC0
                         R8A7790_CLK_SRC9 R8A7790_CLK_SRC8 R8A7790_CLK_SRC7 R8A7790_CLK_SRC6 R8A7790_CLK_SRC5
                         R8A7790_CLK_SRC4 R8A7790_CLK_SRC3 R8A7790_CLK_SRC2 R8A7790_CLK_SRC1 R8A7790_CLK_SRC0
                 >;
                 clock-output-names =
                         "scu", "ssi",
                         "ssi9", "ssi8", "ssi7", "ssi6", "ssi5",
                         "ssi4", "ssi3", "ssi2", "ssi1", "ssi0",
                         "dvc1", "dvc0",
                         "src9", "src8", "src7", "src6", "src5",
                         "src4", "src3", "src2", "src1", "src0";
         };

...

Quoted 9 lines
rcar_sound: rcar_sound@0xec500000 {
         #sound-dai-cells = <1>;
         compatible =  "renesas,rcar_sound-r8a7790", "renesas,rcar_sound-gen2", "renesas,rcar_sound";
         interrupt-parent = <&gic>;
         reg =   <0 0xec500000 0 0x1000>, /* SCU */
                 <0 0xec5a0000 0 0x100>,  /* ADG */
                 <0 0xec540000 0 0x1000>, /* SSIU */
                 <0 0xec541000 0 0x1280>; /* SSI */
         clocks = <&mstp10_clks R8A7790_CLK_SSI>,
Quoted 1 line

I don't think we have this one here.

Indeed. Adding it fixed our issue.

Thanks all.

Quoted 22 lines
Quoted 20 lines
                 <&mstp10_clks R8A7790_CLK_SSI9>, <&mstp10_clks R8A7790_CLK_SSI8>,
                 <&mstp10_clks R8A7790_CLK_SSI7>, <&mstp10_clks R8A7790_CLK_SSI6>,
                 <&mstp10_clks R8A7790_CLK_SSI5>, <&mstp10_clks R8A7790_CLK_SSI4>,
                 <&mstp10_clks R8A7790_CLK_SSI3>, <&mstp10_clks R8A7790_CLK_SSI2>,
                 <&mstp10_clks R8A7790_CLK_SSI1>, <&mstp10_clks R8A7790_CLK_SSI0>,
                 <&mstp10_clks R8A7790_CLK_SRC9>, <&mstp10_clks R8A7790_CLK_SRC8>,
                 <&mstp10_clks R8A7790_CLK_SRC7>, <&mstp10_clks R8A7790_CLK_SRC6>,
                 <&mstp10_clks R8A7790_CLK_SRC5>, <&mstp10_clks R8A7790_CLK_SRC4>,
                 <&mstp10_clks R8A7790_CLK_SRC3>, <&mstp10_clks R8A7790_CLK_SRC2>,
                 <&mstp10_clks R8A7790_CLK_SRC1>, <&mstp10_clks R8A7790_CLK_SRC0>,
                 <&audio_clk_a>, <&audio_clk_b>, <&audio_clk_c>, <&m2_clk>;
         clock-names = "ssi",
                         "ssi.9", "ssi.8", "ssi.7", "ssi.6", "ssi.5",
                         "ssi.4", "ssi.3", "ssi.2", "ssi.1", "ssi.0",
                         "src.9", "src.8", "src.7", "src.6", "src.5",
                         "src.4", "src.3", "src.2", "src.1", "src.0",
                         "clk_a", "clk_b", "clk_c", "clk_i";
        ...
Signature · 2 lines
Violeta Menéndez González	http://www.codethink.co.uk/
Software Engineer		Codethink - Providing Genius
#9 lore raw

Hi Ben, Violeta

Quoted 9 lines
Quoted 7 lines
Quoted 5 lines
         reg =   <0 0xec500000 0 0x1000>, /* SCU */
                 <0 0xec5a0000 0 0x100>,  /* ADG */
                 <0 0xec540000 0 0x1000>, /* SSIU */
                 <0 0xec541000 0 0x1280>; /* SSI */
         clocks = <&mstp10_clks R8A7790_CLK_SSI>,

I don't think we have this one here.

Indeed. Adding it fixed our issue.

Phew, nice !
Sorry for my poor English which causes delay solution.

Quoted 5 lines
Quoted 5 lines
Quoted 2 lines

- SSI(ALL) is called via pm_runtime_xxx() from sound driver
- SRC(ALL) is called as parent clock of SRCn clocks

See, this is why I /hate/ the implicit clock management. This is another case where we're getting bitten by it.

I troubled about this ALL bit too, then, it become current style.

One reason was that
this driver is supporting Gen1 sound too. But, this SRC(ALL) didn't exist on Gen1..

#10 lore raw

Hi Morimoto-san,

Quoted 6 lines · Kuninori Morimoto
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines

- SSI(ALL) is called via pm_runtime_xxx() from sound driver
- SRC(ALL) is called as parent clock of SRCn clocks

See, this is why I /hate/ the implicit clock management. This is another case where we're getting bitten by it.

Quoted 6 lines

I troubled about this ALL bit too, then, it become current style.

One reason was that
this driver is supporting Gen1 sound too. But, this SRC(ALL) didn't exist on Gen1..

This is not the only module that has a clock in R-Car Gen2, but not in Gen1. The same is true for GPIO. There may be others...

When adding a device node to the DTS, always make sure to double check if it has a clock, and add it.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#11 lore raw
In reply to Kuninori Morimoto
Quoted 11 lines · Kuninori Morimoto

Hi Violeta, Mark

Quoted 4 lines

Adding Morimoto-san who does most of the work on those drivers upstream
- it's always best to CC relevant maintainers/developers on kernel stuff as things only on the lists are easily missed. Not deleting context so he sees it.

Thank you for adding me.
I want to help you

Sorry I didn't Cc'ed you in the first place

Quoted 6 lines
Quoted 2 lines
Quoted 2 lines

We have a problem where audio on r8a7790 is not working due to it not sending interrupts.

I need to ask you something

- Are you using lager board ?

Yes

Quoted 1 line

- Which kernel are you using ?

3.15-rc1

Quoted 3 lines

- Does your kernel booted from legacy code (= using board-lager.c) or from DT code (= using board-lager-referenct.c) ?

DT code

Quoted 57 lines
Quoted 4 lines

We've made a hack to force /mstp10_clks /on that makes the audio work. Further investigation showed that it's only needed to force SSI(ALL) on, but, as far as we know, the manual doesn't say anything about it having to be kept on.

YES. all SSI port needs SSI(ALL).
(Actually, all SRC needs SRC(ALL) too if you use it)

Basically, R-Car sound is very complex IP.
The interrupt/data register/DMA selection are depends on your "data path"

This driver is producing many steps to use it.

At 1st, you can use "PIO transfer". this is not good performance, but, very easy settings. you can check your basic setting by this. (power/codec/pin/clock...)

The data path is..

           PIO
     [MEM] ---> [SSI]

Next step is "using DMA". but, R-Car sound has 2 DMAs (Audio DMAC/Audio DMAC peri peri) And, these DMAC usage is complex too. So, you can use basic DMA transfer as DMA 1st step. The data path is..

        Audio DMAC
     [MEM] ---> [SSI]

Next step is more complex. use SRC

Audio DMAC
Audio DMAC peri peri
[MEM] ---> [SRC] --->[SSI]

Final step is using DVC

Audio DMAC
Audio DMAC peri peri
[MEM] ---> [SRC] ---> [DVC] --->[SSI]

Actually, lagacy boot is supporting above all path. But, DT boot is supporting 1st/2nd step only at this point (On rsnd driver side, DMAEngine DT is not yet supporing) I want to support 3rd/4th step on DT, but I'm busy now...

I pushed my local patches which are based on LTSI v3.4 + our original patches. These are tring to use sound as legacy code (= not DT) for lager/koelsh. Maybe not good fit too you, but can help ?

https://dl.dropboxusercontent.com/u/2774973/lager-koelsh-sound.tar.bz2
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 2 lines
Violeta Menéndez González	http://www.codethink.co.uk/
Software Engineer		Codethink - Providing Genius
#12 lore raw

Hi Violeta,

Quoted 8 lines · Violeta Menendez Gonzalez
Quoted 1 line

- Which kernel are you using ?

3.15-rc1

Quoted 3 lines

- Does your kernel booted from legacy code (= using board-lager.c) or from DT code (= using board-lager-referenct.c) ?

DT code

Does applying commit 3c90c55dcde745bed81f6447f24ba96bda43d984 ("drivers: sh: compile drivers/sh/pm_runtime.c if ARCH_SHMOBILE_MULTI") help?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#13 lore raw
Quoted 8 lines · Geert Uytterhoeven

Hi Violeta,

Quoted 4 lines · Violeta Menendez Gonzalez
Quoted 1 line

- Which kernel are you using ?

3.15-rc1

Quoted 8 lines
Quoted 4 lines
Quoted 3 lines

- Does your kernel booted from legacy code (= using board-lager.c) or from DT code (= using board-lager-referenct.c) ?

DT code

Does applying commit 3c90c55dcde745bed81f6447f24ba96bda43d984 ("drivers: sh: compile drivers/sh/pm_runtime.c if ARCH_SHMOBILE_MULTI") help?

We should have that in our tree (other things don't work). As a note, we did include a debug output showing the clock driver is writing the clock enables for these bits.

The system is also not showing any signs of external aborts, which is indicative of trying to access an IP block when it is not clocked. I will sit down and see if we can debug through this once we've had a look at DMA.

Signature · 3 lines
Ben Dooks, [email protected], http://www.fluff.org/ben/

Large Hadron Colada: A large Pina Colada that makes the universe disappear.