[5/5] ASoC: rsnd: dma: use extended audio dmac registers when available
diff mbox series

Message ID 20190313055811.26135-1-jiada_wang@mentor.com
State New, archived
Headers show
Series
  • Untitled series #386419
Related show

Commit Message

Jiada Wang March 13, 2019, 5:58 a.m. UTC
Some of SoCs have both basic and extended dmac registers set
basic set only supports busif0 ~ busif3, in order to use
busif4 ~ busif7, extended audio dmac registers need to be used.

This patch changes to use extended dmac registers set when it is
available in device-tree.

Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
---
 sound/soc/sh/rcar/dma.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Kuninori Morimoto March 13, 2019, 6:23 a.m. UTC | #1
Hi Jiada

> Some of SoCs have both basic and extended dmac registers set
> basic set only supports busif0 ~ busif3, in order to use
> busif4 ~ busif7, extended audio dmac registers need to be used.
> 
> This patch changes to use extended dmac registers set when it is
> available in device-tree.
> 
> Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
> ---

1st of all, if you want to post this kind of patch-set,
you *should* post driver side patch 1st, and if it was accepted,
you need to post SoC side patch. Then, you need to indicate
to SoC maintainer which branch/commit should be based.
Otherwise, it will 100% breaks git-bisect.

2nd, in my understanding, our conclusion at Renesas-ML
is that we don't need to think about basic/extend DMAC register.
Because extend area is 100% covering basic area.
In other words, it is compatible.
Driver side don't need to think about it.

> --- a/sound/soc/sh/rcar/dma.c
> +++ b/sound/soc/sh/rcar/dma.c
> @@ -830,7 +830,10 @@ int rsnd_dma_probe(struct rsnd_priv *priv)
>  	/*
>  	 * for Gen2 or later
>  	 */
> -	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "audmapp");
> +	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "extaudmapp");
> +	if (!res)
> +		res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
> +						   "audmapp");
>  	dmac = devm_kzalloc(dev, sizeof(*dmac), GFP_KERNEL);
>  	if (!dmac || !res) {
>  		dev_err(dev, "dma allocate failed\n");
> -- 
> 2.19.2
>
Kuninori Morimoto March 13, 2019, 6:33 a.m. UTC | #2
Hi Jiada

> > Some of SoCs have both basic and extended dmac registers set
> > basic set only supports busif0 ~ busif3, in order to use
> > busif4 ~ busif7, extended audio dmac registers need to be used.
> > 
> > This patch changes to use extended dmac registers set when it is
> > available in device-tree.
> > 
> > Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
> > ---
> 
> 1st of all, if you want to post this kind of patch-set,
> you *should* post driver side patch 1st, and if it was accepted,
> you need to post SoC side patch. Then, you need to indicate
> to SoC maintainer which branch/commit should be based.
> Otherwise, it will 100% breaks git-bisect.

Grr, orz
my head was 100% broken.
This time, your patch doesn't breaks git-bisect.
I'm so sorry.

Best regards
---
Kuninori Morimoto
Jiada Wang March 13, 2019, 6:34 a.m. UTC | #3
Hi Morimoto-san

thanks for your comments

On 2019/03/13 15:23, Kuninori Morimoto wrote:
> 
> Hi Jiada
> 
>> Some of SoCs have both basic and extended dmac registers set
>> basic set only supports busif0 ~ busif3, in order to use
>> busif4 ~ busif7, extended audio dmac registers need to be used.
>>
>> This patch changes to use extended dmac registers set when it is
>> available in device-tree.
>>
>> Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
>> ---
> 
> 1st of all, if you want to post this kind of patch-set,
> you *should* post driver side patch 1st, and if it was accepted,
> you need to post SoC side patch. Then, you need to indicate
> to SoC maintainer which branch/commit should be based.
> Otherwise, it will 100% breaks git-bisect.
> 
yes, you're right,
sorry about this

> 2nd, in my understanding, our conclusion at Renesas-ML
> is that we don't need to think about basic/extend DMAC register.
> Because extend area is 100% covering basic area.
> In other words, it is compatible.
> Driver side don't need to think about it.
>
I am a little confused,
because latest comment received from simon, suggests to let driver to 
decide which register set to use.

for me, I think it's not necessary, if extended register set is available,
driver shall always use it.

Thanks,
Jiada


>> --- a/sound/soc/sh/rcar/dma.c
>> +++ b/sound/soc/sh/rcar/dma.c
>> @@ -830,7 +830,10 @@ int rsnd_dma_probe(struct rsnd_priv *priv)
>>   	/*
>>   	 * for Gen2 or later
>>   	 */
>> -	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "audmapp");
>> +	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "extaudmapp");
>> +	if (!res)
>> +		res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
>> +						   "audmapp");
>>   	dmac = devm_kzalloc(dev, sizeof(*dmac), GFP_KERNEL);
>>   	if (!dmac || !res) {
>>   		dev_err(dev, "dma allocate failed\n");
>> -- 
>> 2.19.2
>>
Jiada Wang March 13, 2019, 6:36 a.m. UTC | #4
Hi Morimoto-san

On 2019/03/13 15:33, Kuninori Morimoto wrote:
> 
> Hi Jiada
> 
>>> Some of SoCs have both basic and extended dmac registers set
>>> basic set only supports busif0 ~ busif3, in order to use
>>> busif4 ~ busif7, extended audio dmac registers need to be used.
>>>
>>> This patch changes to use extended dmac registers set when it is
>>> available in device-tree.
>>>
>>> Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
>>> ---
>>
>> 1st of all, if you want to post this kind of patch-set,
>> you *should* post driver side patch 1st, and if it was accepted,
>> you need to post SoC side patch. Then, you need to indicate
>> to SoC maintainer which branch/commit should be based.
>> Otherwise, it will 100% breaks git-bisect.
> 
> Grr, orz
> my head was 100% broken.
> This time, your patch doesn't breaks git-bisect.
> I'm so sorry.
> 
right, no problem.
anyway, keep driver change before dts change,
is always a good practice

Thanks,
Jiada
> Best regards
> ---
> Kuninori Morimoto
>
Kuninori Morimoto March 13, 2019, 6:57 a.m. UTC | #5
Hi Simon

> > 2nd, in my understanding, our conclusion at Renesas-ML
> > is that we don't need to think about basic/extend DMAC register.
> > Because extend area is 100% covering basic area.
> > In other words, it is compatible.
> > Driver side don't need to think about it.
> > 
> I am a little confused,
> because latest comment received from simon, suggests to let driver to
> decide which register set to use.
> 
> for me, I think it's not necessary, if extended register set is available,
> driver shall always use it.

I can agree to have both basic/extend register
if driver need to switch its behavior.
But this case, there is nothing to do on driver side.
In other words, SoC always need to use extend
register if it has.
I don't know why datasheet is indicating both area.
Maybe it is because for Gen3 all-in ? I'm not sure.

Anyway, Simon, can you agree about it ?
Having both basic/extend register is just noise for driver.

Best regards
---
Kuninori Morimoto
Geert Uytterhoeven March 13, 2019, 8:52 a.m. UTC | #6
Hi Morimoto-san,

On Wed, Mar 13, 2019 at 7:57 AM Kuninori Morimoto
<kuninori.morimoto.gx@renesas.com> wrote:
> > > 2nd, in my understanding, our conclusion at Renesas-ML
> > > is that we don't need to think about basic/extend DMAC register.
> > > Because extend area is 100% covering basic area.
> > > In other words, it is compatible.
> > > Driver side don't need to think about it.
> > >
> > I am a little confused,
> > because latest comment received from simon, suggests to let driver to
> > decide which register set to use.
> >
> > for me, I think it's not necessary, if extended register set is available,
> > driver shall always use it.
>
> I can agree to have both basic/extend register
> if driver need to switch its behavior.
> But this case, there is nothing to do on driver side.
> In other words, SoC always need to use extend
> register if it has.
> I don't know why datasheet is indicating both area.
> Maybe it is because for Gen3 all-in ? I'm not sure.
>
> Anyway, Simon, can you agree about it ?
> Having both basic/extend register is just noise for driver.

I can follow your rationale of only describing the extended register set,
if available.

However:
  1) The DT bindings should state clearly that the AUDMAPP register
     block should point to the extended register set, if available,
  2) Can the driver distinguish between an old DTB describing the basic
     register set, and a new DTB describing the extended register set?
     I.e. will the driver avoid using busif4-7 when using an old DTB
     describing the basic register set, to maintain backwards compatibility?

Thanks!

P.S. The binding doc seems to need some love.
     I came up with the following a while ago, but got interrupted.
     Feel free to steal ;-)

--- a/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
+++ b/Documentation/devicetree/bindings/sound/renesas,rsnd.txt
@@ -338,9 +338,9 @@ Required properties:
 =============================================

 - compatible                   : "renesas,rcar_sound-<soctype>", fallbacks
-                                 "renesas,rcar_sound-gen1" if generation1, and
-                                 "renesas,rcar_sound-gen2" if
generation2 (or RZ/G1)
-                                 "renesas,rcar_sound-gen3" if
generation3 (or RZ/G2)
+                                 "renesas,rcar_sound-gen1" if R-Car Gen1, and
+                                 "renesas,rcar_sound-gen2" if R-Car
Gen2 or RZ/G1
+                                 "renesas,rcar_sound-gen3" if R-Car
Gen3 or RZ/G2
                                  Examples with soctypes are:
                                    - "renesas,rcar_sound-r8a7743" (RZ/G1M)
                                    - "renesas,rcar_sound-r8a7745" (RZ/G1E)
@@ -357,8 +357,10 @@ Required properties:
                                    - "renesas,rcar_sound-r8a77990" (R-Car E3)
 - reg                          : Should contain the register physical address.
                                  required register is
-                                  SRU/ADG/SSI      if generation1
-                                  SRU/ADG/SSIU/SSI if generation2
+                                  SRU/ADG/SSI      if R-Car Gen1
+                                  SCU/ADG/SSIU/SSI/AUDMAPP if R-Car Gen2,
+                                                   R-Car Gen3, RZ/G1, or RZ/G2.
+- reg-names = "scu", "adg", "ssiu", "ssi", "audmapp";
 - rcar_sound,ssi               : Should contain SSI feature.
                                  The number of SSI subnode should be
same as HW.
                                  see below for detail.

Gr{oetje,eeting}s,

                        Geert


--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

Patch
diff mbox series

diff --git a/sound/soc/sh/rcar/dma.c b/sound/soc/sh/rcar/dma.c
index 0324a5c39619..905502ccedba 100644
--- a/sound/soc/sh/rcar/dma.c
+++ b/sound/soc/sh/rcar/dma.c
@@ -830,7 +830,10 @@  int rsnd_dma_probe(struct rsnd_priv *priv)
 	/*
 	 * for Gen2 or later
 	 */
-	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "audmapp");
+	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "extaudmapp");
+	if (!res)
+		res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
+						   "audmapp");
 	dmac = devm_kzalloc(dev, sizeof(*dmac), GFP_KERNEL);
 	if (!dmac || !res) {
 		dev_err(dev, "dma allocate failed\n");