[PATCH 1/3] ASoC: rsnd: control SSICR::EN correctly

2017-08-07 Thread Kuninori Morimoto

From: Kuninori Morimoto 

In case of SSI0 playback, SSI1 capture, SSI0 might be shared for
clock output if clock master mode.

Current rsnd driver had been assumed that SSI clock contiguous
output which is needed for SSI parent needs SSICR::EN (SSI module
enable) bit.
But, this bit controls data input/output, not for clock.
Clock contiguous output needs SSICR : FORCE, SCKD, SWSD,
and SSIWSR : CONT. Not SSICR : EN.

Because of this wrong assumption, and insufficient control, on current
code, for example, if it starts SSI0(playback) -> SSI1(capture) order,
SSI0 SSICR::EN bit will temporarily be 0.
It causes playback side underrun error. This is bug.
We can reproduce this issue with SSI+SRC (without DVC), and capture
during playback operation.

This patch fixup current (wrong) assumption, and control SSICR::EN bit
correctly.

Reported-by: Hiroyuki Yokoyama 
Signed-off-by: Kuninori Morimoto 
Tested-by: Hiroyuki Yokoyama 
---
 sound/soc/sh/rcar/ssi.c | 40 +++-
 1 file changed, 31 insertions(+), 9 deletions(-)

diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
index 49cdc5e..498e71d 100644
--- a/sound/soc/sh/rcar/ssi.c
+++ b/sound/soc/sh/rcar/ssi.c
@@ -72,6 +72,7 @@ struct rsnd_ssi {
u32 cr_own;
u32 cr_clk;
u32 cr_mode;
+   u32 cr_en;
u32 wsr;
int chan;
int rate;
@@ -291,6 +292,16 @@ static int rsnd_ssi_master_clk_start(struct rsnd_mod *mod,
if (ret < 0)
return ret;
 
+   /*
+* SSI clock will be output contiguously
+* by below settings.
+* This means, rsnd_ssi_master_clk_start()
+* and rsnd_ssi_register_setup() are necessary
+* for SSI parent
+*
+* SSICR  : FORCE, SCKD, SWSD
+* SSIWSR : CONT
+*/
ssi->cr_clk = FORCE | SWL_32 | SCKD | SWSD | CKDV(idx);
ssi->wsr = CONT;
ssi->rate = rate;
@@ -393,7 +404,8 @@ static void rsnd_ssi_register_setup(struct rsnd_mod *mod)
rsnd_mod_write(mod, SSIWSR, ssi->wsr);
rsnd_mod_write(mod, SSICR,  ssi->cr_own |
ssi->cr_clk |
-   ssi->cr_mode); /* without EN */
+   ssi->cr_mode|
+   ssi->cr_en);
 }
 
 static void rsnd_ssi_pointer_init(struct rsnd_mod *mod,
@@ -544,6 +556,8 @@ static int rsnd_ssi_start(struct rsnd_mod *mod,
  struct rsnd_dai_stream *io,
  struct rsnd_priv *priv)
 {
+   struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
+
if (!rsnd_ssi_is_run_mods(mod, io))
return 0;
 
@@ -554,7 +568,19 @@ static int rsnd_ssi_start(struct rsnd_mod *mod,
if (rsnd_ssi_multi_slaves_runtime(io))
return 0;
 
-   rsnd_mod_bset(mod, SSICR, EN, EN);
+   /*
+* EN is for data output.
+* SSI parent EN is not needed.
+*/
+   if (rsnd_ssi_is_parent(mod, io))
+   return 0;
+
+   ssi->cr_en = EN;
+
+   rsnd_mod_write(mod, SSICR,  ssi->cr_own |
+   ssi->cr_clk |
+   ssi->cr_mode|
+   ssi->cr_en);
 
return 0;
 }
@@ -569,13 +595,7 @@ static int rsnd_ssi_stop(struct rsnd_mod *mod,
if (!rsnd_ssi_is_run_mods(mod, io))
return 0;
 
-   /*
-* don't stop if not last user
-* see also
-*  rsnd_ssi_start
-*  rsnd_ssi_interrupt
-*/
-   if (ssi->usrcnt > 1)
+   if (rsnd_ssi_is_parent(mod, io))
return 0;
 
/*
@@ -595,6 +615,8 @@ static int rsnd_ssi_stop(struct rsnd_mod *mod,
rsnd_mod_write(mod, SSICR, cr); /* disabled all */
rsnd_ssi_status_check(mod, IIRQ);
 
+   ssi->cr_en = 0;
+
return 0;
 }
 
-- 
1.9.1



[PATCH 3/3] ASoC: rsnd: rsnd_ssi_can_output_clk() macro

2017-08-07 Thread Kuninori Morimoto

From: Kuninori Morimoto 

For example SSI0/SSI1 case, SSI1 can share pin with SSI0.
And then, SSI1 needs SSI0's clock.
This clock controlling is very picky and difficult to understand
in current code.

This patch adds new rsnd_ssi_can_output_clk() macro,
the code will be more understandable.

Signed-off-by: Kuninori Morimoto 
---
 sound/soc/sh/rcar/ssi.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
index cd0d9a8..25c351f 100644
--- a/sound/soc/sh/rcar/ssi.c
+++ b/sound/soc/sh/rcar/ssi.c
@@ -107,6 +107,7 @@ struct rsnd_ssi {
(rsnd_ssi_multi_slaves(io) & (1 << rsnd_mod_id(mod)))
 #define rsnd_ssi_is_run_mods(mod, io) \
(rsnd_ssi_run_mods(io) & (1 << rsnd_mod_id(mod)))
+#define rsnd_ssi_can_output_clk(mod) (!__rsnd_ssi_is_pin_sharing(mod))
 
 int rsnd_ssi_hdmi_port(struct rsnd_dai_stream *io)
 {
@@ -256,7 +257,6 @@ static int rsnd_ssi_master_clk_start(struct rsnd_mod *mod,
struct device *dev = rsnd_priv_to_dev(priv);
struct rsnd_dai *rdai = rsnd_io_to_rdai(io);
struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
-   struct rsnd_mod *ssi_parent_mod = rsnd_io_to_mod_ssip(io);
int chan = rsnd_runtime_channel_for_ssi(io);
int idx, ret;
unsigned int main_rate;
@@ -267,7 +267,7 @@ static int rsnd_ssi_master_clk_start(struct rsnd_mod *mod,
if (!rsnd_rdai_is_clk_master(rdai))
return 0;
 
-   if (ssi_parent_mod && !rsnd_ssi_is_parent(mod, io))
+   if (!rsnd_ssi_can_output_clk(mod))
return 0;
 
if (rsnd_ssi_is_multi_slave(mod, io))
@@ -318,12 +318,11 @@ static void rsnd_ssi_master_clk_stop(struct rsnd_mod *mod,
 {
struct rsnd_dai *rdai = rsnd_io_to_rdai(io);
struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
-   struct rsnd_mod *ssi_parent_mod = rsnd_io_to_mod_ssip(io);
 
if (!rsnd_rdai_is_clk_master(rdai))
return;
 
-   if (ssi_parent_mod && !rsnd_ssi_is_parent(mod, io))
+   if (!rsnd_ssi_can_output_clk(mod))
return;
 
if (ssi->usrcnt > 1)
-- 
1.9.1



[PATCH 2/3] ASoC: rsnd: move rsnd_ssi_config_init() execute condition into it.

2017-08-07 Thread Kuninori Morimoto
From: Kuninori Morimoto 

Make it the same style as other functions

Signed-off-by: Kuninori Morimoto 
---
 sound/soc/sh/rcar/ssi.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
index 498e71d..cd0d9a8 100644
--- a/sound/soc/sh/rcar/ssi.c
+++ b/sound/soc/sh/rcar/ssi.c
@@ -346,6 +346,9 @@ static void rsnd_ssi_config_init(struct rsnd_mod *mod,
u32 wsr;
int is_tdm;
 
+   if (rsnd_ssi_is_parent(mod, io))
+   return;
+
is_tdm = rsnd_runtime_is_ssi_tdm(io);
 
/*
@@ -484,8 +487,7 @@ static int rsnd_ssi_init(struct rsnd_mod *mod,
if (ret < 0)
return ret;
 
-   if (!rsnd_ssi_is_parent(mod, io))
-   rsnd_ssi_config_init(mod, io);
+   rsnd_ssi_config_init(mod, io);
 
rsnd_ssi_register_setup(mod);
 
-- 
1.9.1



[PATCH 0/3] ASoC: rsnd: control SSICR::EN correctly

2017-08-07 Thread Kuninori Morimoto

Hi Mark

These are bugfix patches for Renesas sound SSI driver.
SSI1 can share clock pin with SSI0, and then, I had assumed that
SSI0 clock output needs SSICR::EN bit.
But, it wasn't. SSI0 clock output for SSI1 needs other settings
which already sets, but EN was not needed.
Because of this assumption, and SSICR::EN operation bug, it gets
underrun error in some sound route. This patch solves this issue.

Kuninori Morimoto (3):
  ASoC: rsnd: control SSICR::EN correctly
  ASoC: rsnd: move rsnd_ssi_config_init() execute condition into it.
  ASoC: rsnd: rsnd_ssi_can_output_clk() macro

 sound/soc/sh/rcar/ssi.c | 53 +++--
 1 file changed, 38 insertions(+), 15 deletions(-)

-- 
1.9.1



Re: [PATCH] mmc: block: prevent propagating R1_OUT_OF_RANGE for open-ending mode

2017-08-07 Thread Wolfram Sang
Hi Shawn,

On Mon, Aug 07, 2017 at 09:32:45AM +0800, Shawn Lin wrote:
> We to some extent should tolerate R1_OUT_OF_RANGE for open-ending
> mode as it is expected behaviour and most of the backup partition
> tables should be located near some the last blocks which will always
> make open-ending read exceed the capcity of cards.
> 
> Fixes: 9820a5b11101 ("mmc: core: for data errors, take response of stop cmd 
> into account")
> Fixes: a04e6bae9e6f (mmc: core: check also R1 response for stop commands)
> Signed-off-by: Shawn Lin 

Thanks a lot for debugging and working on this issue! I think the above
reason is correct, yet I wonder if we shouldn't implement it
differently: how about introducing a new #define called STOP_ERRORS
which does not include R1_OUT_OF_RANGE and use it instead of CMD_ERRORS?

Kind regards,

   Wolfram



signature.asc
Description: PGP signature


Re: [PATCH] ARM:dts:armadillo800eva: Add console parametters

2017-08-07 Thread Simon Horman
On Sun, Aug 06, 2017 at 08:55:02PM +0700, Bui Duc Phuc (Fukuda) wrote:
> From: Bui Duc Phuc 
> 
> After the kernel boot, the login prompt doesn't appear.
> This patch will add console parametters to bootargs to fix it.
> 
> Signed-off-by: Bui Duc Phuc 
> ---
>  arch/arm/boot/dts/r8a7740-armadillo800eva.dts | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/boot/dts/r8a7740-armadillo800eva.dts 
> b/arch/arm/boot/dts/r8a7740-armadillo800eva.dts
> index 1788e18..d383b37 100644
> --- a/arch/arm/boot/dts/r8a7740-armadillo800eva.dts
> +++ b/arch/arm/boot/dts/r8a7740-armadillo800eva.dts
> @@ -24,7 +24,8 @@
>   };
>  
>   chosen {
> - bootargs = "earlyprintk ignore_loglevel root=/dev/nfs ip=dhcp 
> rw";
> + bootargs = "console=tty0 console=ttySC0,115200 earlyprintk
> + ignore_loglevel root=/dev/nfs ip=dhcp rw";
>   stdout-path = "serial0:115200n8";
>   };

Hi,

this feels wrong. My understanding is that stdout-path should be enough
to get the console.


Re: [PATCH] arm64: renesas: salvator-common: avoid audio_clkout naming conflict

2017-08-07 Thread Simon Horman
On Wed, Aug 02, 2017 at 11:55:12PM +, Kuninori Morimoto wrote:
> 
> Hi Simon
> 
> > > From: Kuninori Morimoto 
> > > 
> > > clock name of "audio_clkout" is used by Renesas sound driver.
> > > This duplicated naming breaks its clock registering/unregisering.
> > > Especially, when unbind/bind it can't handle clkout correctly.
> > > This patch renames "audio_clkout" to "audio-clkout" to avoid
> > > naming conflict.
> > > 
> > > Signed-off-by: Kuninori Morimoto 
> > > ---
> > > > Simon
> > > 
> > > This patch is for v4.13-rcX
> > 
> > Thanks, could I get a "Fixes" tag?
> 
> Thanks
> Yes, please

Thanks, I have applied this as a fix for v4.13 with the following tag.
Please let me know if that was not your expectation.

Fixes: 8a8f181d2cfd ("arm64: renesas: salvator-x: use CS2000 as AUDIO_CLK_B")


Re: [PATCH v2] drm: dw-hdmi-i2s: add missing company name on Copyright

2017-08-07 Thread Laurent Pinchart
Hi Morimoto-san,

Thank you for the patch.

On Monday 07 Aug 2017 04:09:41 Kuninori Morimoto wrote:
> From: Kuninori Morimoto 
> 
> This driver's Copyright is under Renesas Solutions Corp.
> This patch updates the year, because this driver was moved
> into synopsys folder in 2017.
> 
> Signed-off-by: Kuninori Morimoto 
> ---
> v1 -> v2
> 
>  - update year 2016 -> 2017
> 
>  drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
> b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c index
> b2cf59f..3b7e5c5 100644
> --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
> +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
> @@ -1,7 +1,8 @@
>  /*
>   * dw-hdmi-i2s-audio.c
>   *
> - * Copyright (c) 2016 Kuninori Morimoto 
> + * Copyright (c) 2017 Renesas Solutions Corp.
> + * Kuninori Morimoto 

What does this mean ? The first line makes it clear that you want to assign 
copyright ownership to Renesas for the work you've done on this driver. The 
second line, however, isn't very clear. If you want to list your e-mail 
address as an author or contact person, you should make that explicit:

 * Author: Kuninori Morimoto 

or

 * Contact: Kuninori Morimoto 

Or it could be that you have joint copyright ownership with Renesas, or own 
parts of the copyright yourself, in which case it should be

 * Copyright (c) 2017 Renesas Solutions Corp.
 * Copyright (c) 2017 Kuninori Morimoto 

>   *
>   * This program is free software; you can redistribute it and/or modify
>   * it under the terms of the GNU General Public License version 2 as

-- 
Regards,

Laurent Pinchart