Re: [PATCH] dmaengine: rcar-dmac: read DMATCRB instead of DMATCR for residue

2017-10-16 Thread Kuninori Morimoto

Hi Geert

> >> > SYS/RT/Audio DMAC have both TCR/TCRB register.
> >> > Its difference is transfer counter value of read (= TCR)
> >> > or write (= TCRB). The relationship is like below.
> >> >
> >> >  TCR   TCRB
> >> >  [SOURCE] -> [DMAC] -> [DESTINATION]
> >> >
> >> > Thus, we want to read TCRB instead of TCR for residue.
> >> > Otherwise, Sound Capture has noise after PluseAudio support
> >> > (= 07b7acb51d2 ("ASoC: rsnd: update pointer more accurate"))
> >> >
> >> > Signed-off-by: Hiroyuki Yokoyama 
> >> > [Kuninori: added detail information in log]
> >> > Signed-off-by: Kuninori Morimoto 
> > (snip)
> >> However, shouldn't the register to use depend on the DMA direction?
> >
> > I think TCRB is OK for all direction,
> > but yes, we can care its direction.
> > I can post v2 patch, if you want.
> > Geert do you want to care direction ?
> 
> Please do. I think in general the .get_residue() callback should return the
> correct value for both reading and writing.

OK, will post v2

Best regards
---
Kuninori Morimoto


Re: [PATCH] dmaengine: rcar-dmac: read DMATCRB instead of DMATCR for residue

2017-10-16 Thread Kuninori Morimoto

Hi Geert

> >> > SYS/RT/Audio DMAC have both TCR/TCRB register.
> >> > Its difference is transfer counter value of read (= TCR)
> >> > or write (= TCRB). The relationship is like below.
> >> >
> >> >  TCR   TCRB
> >> >  [SOURCE] -> [DMAC] -> [DESTINATION]
> >> >
> >> > Thus, we want to read TCRB instead of TCR for residue.
> >> > Otherwise, Sound Capture has noise after PluseAudio support
> >> > (= 07b7acb51d2 ("ASoC: rsnd: update pointer more accurate"))
> >> >
> >> > Signed-off-by: Hiroyuki Yokoyama 
> >> > [Kuninori: added detail information in log]
> >> > Signed-off-by: Kuninori Morimoto 
> > (snip)
> >> However, shouldn't the register to use depend on the DMA direction?
> >
> > I think TCRB is OK for all direction,
> > but yes, we can care its direction.
> > I can post v2 patch, if you want.
> > Geert do you want to care direction ?
> 
> Please do. I think in general the .get_residue() callback should return the
> correct value for both reading and writing.

OK, will post v2

Best regards
---
Kuninori Morimoto


Re: [PATCH] dmaengine: rcar-dmac: read DMATCRB instead of DMATCR for residue

2017-10-16 Thread Geert Uytterhoeven
Hi Morimoto-san,

On Mon, Oct 16, 2017 at 9:12 AM, Kuninori Morimoto
 wrote:
>> > SYS/RT/Audio DMAC have both TCR/TCRB register.
>> > Its difference is transfer counter value of read (= TCR)
>> > or write (= TCRB). The relationship is like below.
>> >
>> >  TCR   TCRB
>> >  [SOURCE] -> [DMAC] -> [DESTINATION]
>> >
>> > Thus, we want to read TCRB instead of TCR for residue.
>> > Otherwise, Sound Capture has noise after PluseAudio support
>> > (= 07b7acb51d2 ("ASoC: rsnd: update pointer more accurate"))
>> >
>> > Signed-off-by: Hiroyuki Yokoyama 
>> > [Kuninori: added detail information in log]
>> > Signed-off-by: Kuninori Morimoto 
> (snip)
>> However, shouldn't the register to use depend on the DMA direction?
>
> I think TCRB is OK for all direction,
> but yes, we can care its direction.
> I can post v2 patch, if you want.
> Geert do you want to care direction ?

Please do. I think in general the .get_residue() callback should return the
correct value for both reading and writing.

Thanks!

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@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


Re: [PATCH] dmaengine: rcar-dmac: read DMATCRB instead of DMATCR for residue

2017-10-16 Thread Geert Uytterhoeven
Hi Morimoto-san,

On Mon, Oct 16, 2017 at 9:12 AM, Kuninori Morimoto
 wrote:
>> > SYS/RT/Audio DMAC have both TCR/TCRB register.
>> > Its difference is transfer counter value of read (= TCR)
>> > or write (= TCRB). The relationship is like below.
>> >
>> >  TCR   TCRB
>> >  [SOURCE] -> [DMAC] -> [DESTINATION]
>> >
>> > Thus, we want to read TCRB instead of TCR for residue.
>> > Otherwise, Sound Capture has noise after PluseAudio support
>> > (= 07b7acb51d2 ("ASoC: rsnd: update pointer more accurate"))
>> >
>> > Signed-off-by: Hiroyuki Yokoyama 
>> > [Kuninori: added detail information in log]
>> > Signed-off-by: Kuninori Morimoto 
> (snip)
>> However, shouldn't the register to use depend on the DMA direction?
>
> I think TCRB is OK for all direction,
> but yes, we can care its direction.
> I can post v2 patch, if you want.
> Geert do you want to care direction ?

Please do. I think in general the .get_residue() callback should return the
correct value for both reading and writing.

Thanks!

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@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


Re: [PATCH] dmaengine: rcar-dmac: read DMATCRB instead of DMATCR for residue

2017-10-16 Thread Kuninori Morimoto

Hi Geert

> > SYS/RT/Audio DMAC have both TCR/TCRB register.
> > Its difference is transfer counter value of read (= TCR)
> > or write (= TCRB). The relationship is like below.
> >
> >  TCR   TCRB
> >  [SOURCE] -> [DMAC] -> [DESTINATION]
> >
> > Thus, we want to read TCRB instead of TCR for residue.
> > Otherwise, Sound Capture has noise after PluseAudio support
> > (= 07b7acb51d2 ("ASoC: rsnd: update pointer more accurate"))
> >
> > Signed-off-by: Hiroyuki Yokoyama 
> > [Kuninori: added detail information in log]
> > Signed-off-by: Kuninori Morimoto 
(snip)
> However, shouldn't the register to use depend on the DMA direction?

I think TCRB is OK for all direction,
but yes, we can care its direction.
I can post v2 patch, if you want.
Geert do you want to care direction ?

Best regards
---
Kuninori Morimoto


Re: [PATCH] dmaengine: rcar-dmac: read DMATCRB instead of DMATCR for residue

2017-10-16 Thread Kuninori Morimoto

Hi Geert

> > SYS/RT/Audio DMAC have both TCR/TCRB register.
> > Its difference is transfer counter value of read (= TCR)
> > or write (= TCRB). The relationship is like below.
> >
> >  TCR   TCRB
> >  [SOURCE] -> [DMAC] -> [DESTINATION]
> >
> > Thus, we want to read TCRB instead of TCR for residue.
> > Otherwise, Sound Capture has noise after PluseAudio support
> > (= 07b7acb51d2 ("ASoC: rsnd: update pointer more accurate"))
> >
> > Signed-off-by: Hiroyuki Yokoyama 
> > [Kuninori: added detail information in log]
> > Signed-off-by: Kuninori Morimoto 
(snip)
> However, shouldn't the register to use depend on the DMA direction?

I think TCRB is OK for all direction,
but yes, we can care its direction.
I can post v2 patch, if you want.
Geert do you want to care direction ?

Best regards
---
Kuninori Morimoto


Re: [PATCH] dmaengine: rcar-dmac: read DMATCRB instead of DMATCR for residue

2017-10-16 Thread Geert Uytterhoeven
Hi Morimoto-san,

On Mon, Oct 16, 2017 at 7:28 AM, Kuninori Morimoto
 wrote:
> From: Kuninori Morimoto 
>
> SYS/RT/Audio DMAC have both TCR/TCRB register.
> Its difference is transfer counter value of read (= TCR)
> or write (= TCRB). The relationship is like below.
>
>  TCR   TCRB
>  [SOURCE] -> [DMAC] -> [DESTINATION]
>
> Thus, we want to read TCRB instead of TCR for residue.
> Otherwise, Sound Capture has noise after PluseAudio support
> (= 07b7acb51d2 ("ASoC: rsnd: update pointer more accurate"))
>
> Signed-off-by: Hiroyuki Yokoyama 
> [Kuninori: added detail information in log]
> Signed-off-by: Kuninori Morimoto 

Thanks for your patch!

> --- a/drivers/dma/sh/rcar-dmac.c
> +++ b/drivers/dma/sh/rcar-dmac.c
> @@ -1310,7 +1310,7 @@ static unsigned int rcar_dmac_chan_get_residue(struct 
> rcar_dmac_chan *chan,
> }
>
> /* Add the residue for the current chunk. */
> -   residue += rcar_dmac_chan_read(chan, RCAR_DMATCR) << desc->xfer_shift;
> +   residue += rcar_dmac_chan_read(chan, RCAR_DMATCRB) << 
> desc->xfer_shift;

Indeed, TCR indicates the counter value used for reading, while TCRB indicates
the counter value used for writing.

However, shouldn't the register to use depend on the DMA direction?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@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


Re: [PATCH] dmaengine: rcar-dmac: read DMATCRB instead of DMATCR for residue

2017-10-16 Thread Geert Uytterhoeven
Hi Morimoto-san,

On Mon, Oct 16, 2017 at 7:28 AM, Kuninori Morimoto
 wrote:
> From: Kuninori Morimoto 
>
> SYS/RT/Audio DMAC have both TCR/TCRB register.
> Its difference is transfer counter value of read (= TCR)
> or write (= TCRB). The relationship is like below.
>
>  TCR   TCRB
>  [SOURCE] -> [DMAC] -> [DESTINATION]
>
> Thus, we want to read TCRB instead of TCR for residue.
> Otherwise, Sound Capture has noise after PluseAudio support
> (= 07b7acb51d2 ("ASoC: rsnd: update pointer more accurate"))
>
> Signed-off-by: Hiroyuki Yokoyama 
> [Kuninori: added detail information in log]
> Signed-off-by: Kuninori Morimoto 

Thanks for your patch!

> --- a/drivers/dma/sh/rcar-dmac.c
> +++ b/drivers/dma/sh/rcar-dmac.c
> @@ -1310,7 +1310,7 @@ static unsigned int rcar_dmac_chan_get_residue(struct 
> rcar_dmac_chan *chan,
> }
>
> /* Add the residue for the current chunk. */
> -   residue += rcar_dmac_chan_read(chan, RCAR_DMATCR) << desc->xfer_shift;
> +   residue += rcar_dmac_chan_read(chan, RCAR_DMATCRB) << 
> desc->xfer_shift;

Indeed, TCR indicates the counter value used for reading, while TCRB indicates
the counter value used for writing.

However, shouldn't the register to use depend on the DMA direction?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@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] dmaengine: rcar-dmac: read DMATCRB instead of DMATCR for residue

2017-10-15 Thread Kuninori Morimoto
From: Kuninori Morimoto 

SYS/RT/Audio DMAC have both TCR/TCRB register.
Its difference is transfer counter value of read (= TCR)
or write (= TCRB). The relationship is like below.

 TCR   TCRB
 [SOURCE] -> [DMAC] -> [DESTINATION]

Thus, we want to read TCRB instead of TCR for residue.
Otherwise, Sound Capture has noise after PluseAudio support
(= 07b7acb51d2 ("ASoC: rsnd: update pointer more accurate"))

Signed-off-by: Hiroyuki Yokoyama 
[Kuninori: added detail information in log]
Signed-off-by: Kuninori Morimoto 
---
 drivers/dma/sh/rcar-dmac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/sh/rcar-dmac.c b/drivers/dma/sh/rcar-dmac.c
index 2b2c7db..50c4950 100644
--- a/drivers/dma/sh/rcar-dmac.c
+++ b/drivers/dma/sh/rcar-dmac.c
@@ -1310,7 +1310,7 @@ static unsigned int rcar_dmac_chan_get_residue(struct 
rcar_dmac_chan *chan,
}
 
/* Add the residue for the current chunk. */
-   residue += rcar_dmac_chan_read(chan, RCAR_DMATCR) << desc->xfer_shift;
+   residue += rcar_dmac_chan_read(chan, RCAR_DMATCRB) << desc->xfer_shift;
 
return residue;
 }
-- 
1.9.1



[PATCH] dmaengine: rcar-dmac: read DMATCRB instead of DMATCR for residue

2017-10-15 Thread Kuninori Morimoto
From: Kuninori Morimoto 

SYS/RT/Audio DMAC have both TCR/TCRB register.
Its difference is transfer counter value of read (= TCR)
or write (= TCRB). The relationship is like below.

 TCR   TCRB
 [SOURCE] -> [DMAC] -> [DESTINATION]

Thus, we want to read TCRB instead of TCR for residue.
Otherwise, Sound Capture has noise after PluseAudio support
(= 07b7acb51d2 ("ASoC: rsnd: update pointer more accurate"))

Signed-off-by: Hiroyuki Yokoyama 
[Kuninori: added detail information in log]
Signed-off-by: Kuninori Morimoto 
---
 drivers/dma/sh/rcar-dmac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/sh/rcar-dmac.c b/drivers/dma/sh/rcar-dmac.c
index 2b2c7db..50c4950 100644
--- a/drivers/dma/sh/rcar-dmac.c
+++ b/drivers/dma/sh/rcar-dmac.c
@@ -1310,7 +1310,7 @@ static unsigned int rcar_dmac_chan_get_residue(struct 
rcar_dmac_chan *chan,
}
 
/* Add the residue for the current chunk. */
-   residue += rcar_dmac_chan_read(chan, RCAR_DMATCR) << desc->xfer_shift;
+   residue += rcar_dmac_chan_read(chan, RCAR_DMATCRB) << desc->xfer_shift;
 
return residue;
 }
-- 
1.9.1