ASoC: rsnd: tidyup data align position for capture
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tue, 8 Dec 2015 05:38:23 +0000 (05:38 +0000)
committerMark Brown <broonie@kernel.org>
Tue, 8 Dec 2015 12:47:46 +0000 (12:47 +0000)
L/R channel data has been treated as inverted on R-Car sound 16bit mode,
Thus, 4689032b1("ASoC: rsnd: tidyup data align position") tidyuped data
align position. But it couldn't care about capture case. This patch
cares both playback/capture

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sh/rcar/cmd.c
sound/soc/sh/rcar/core.c
sound/soc/sh/rcar/gen.c
sound/soc/sh/rcar/rsnd.h

index ab904c3f20b51e4057bb6003824aa7c3703643e6..cd1f064e63c4344af914e2629b92e0d326f47376 100644 (file)
@@ -80,6 +80,7 @@ static int rsnd_cmd_init(struct rsnd_mod *mod,
        dev_dbg(dev, "ctu/mix path = 0x%08x", data);
 
        rsnd_mod_write(mod, CMD_ROUTE_SLCT, data);
+       rsnd_mod_write(mod, CMD_BUSIF_DALIGN, rsnd_get_dalign(mod, io));
 
        rsnd_adg_set_cmd_timsel_gen2(mod, io);
 
index f1d7af114a315a57d6a292b769f21d780e34e02c..849c1ad93df2d21095e926caa6101dfb6444b727 100644 (file)
@@ -272,13 +272,22 @@ u32 rsnd_get_adinr_chan(struct rsnd_mod *mod, struct rsnd_dai_stream *io)
  */
 u32 rsnd_get_dalign(struct rsnd_mod *mod, struct rsnd_dai_stream *io)
 {
-       struct rsnd_mod *src = rsnd_io_to_mod_src(io);
        struct rsnd_mod *ssi = rsnd_io_to_mod_ssi(io);
-       struct rsnd_mod *target = src ? src : ssi;
+       struct rsnd_mod *target;
        struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
        u32 val = 0x76543210;
        u32 mask = ~0;
 
+       if (rsnd_io_is_play(io)) {
+               struct rsnd_mod *src = rsnd_io_to_mod_src(io);
+
+               target = src ? src : ssi;
+       } else {
+               struct rsnd_mod *cmd = rsnd_io_to_mod_cmd(io);
+
+               target = cmd ? cmd : ssi;
+       }
+
        mask <<= runtime->channels * 4;
        val = val & mask;
 
index 50fc73042b7edc0842c6eefaa3cf31264a69ddb6..7c5485e46fd711613ed5e54eb417c579b6433091 100644 (file)
@@ -242,6 +242,7 @@ static int rsnd_gen2_probe(struct rsnd_priv *priv)
                RSND_GEN_M_REG(SRC_ROUTE_MODE0, 0xc,    0x20),
                RSND_GEN_M_REG(SRC_CTRL,        0x10,   0x20),
                RSND_GEN_M_REG(SRC_INT_ENABLE0, 0x18,   0x20),
+               RSND_GEN_M_REG(CMD_BUSIF_DALIGN,0x188,  0x20),
                RSND_GEN_M_REG(CMD_ROUTE_SLCT,  0x18c,  0x20),
                RSND_GEN_M_REG(CMD_CTRL,        0x190,  0x20),
                RSND_GEN_S_REG(SCU_SYS_STATUS0, 0x1c8),
index 970e1301f7c6b93d8bfe14cdecaf71c564101e5d..ad854d6719ea02cefc2bbe4465ab76ac37722b62 100644 (file)
@@ -81,6 +81,7 @@ enum rsnd_reg {
        RSND_REG_SCU_SYS_INT_EN0,
        RSND_REG_SCU_SYS_INT_EN1,       /* Gen2 only */
        RSND_REG_CMD_CTRL,              /* Gen2 only */
+       RSND_REG_CMD_BUSIF_DALIGN,      /* Gen2 only */
        RSND_REG_CMD_ROUTE_SLCT,
        RSND_REG_CMDOUT_TIMSEL,         /* Gen2 only */
        RSND_REG_CTU_CTUIR,
@@ -319,6 +320,7 @@ struct rsnd_dai_stream {
 #define rsnd_io_to_mod_ctu(io) rsnd_io_to_mod((io), RSND_MOD_CTU)
 #define rsnd_io_to_mod_mix(io) rsnd_io_to_mod((io), RSND_MOD_MIX)
 #define rsnd_io_to_mod_dvc(io) rsnd_io_to_mod((io), RSND_MOD_DVC)
+#define rsnd_io_to_mod_cmd(io) rsnd_io_to_mod((io), RSND_MOD_CMD)
 #define rsnd_io_to_rdai(io)    ((io)->rdai)
 #define rsnd_io_to_priv(io)    (rsnd_rdai_to_priv(rsnd_io_to_rdai(io)))
 #define rsnd_io_is_play(io)    (&rsnd_io_to_rdai(io)->playback == io)