ASoC: rsnd: fixup mod ID for CTU regmap read/write
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tue, 4 Dec 2018 08:00:47 +0000 (08:00 +0000)
committerMark Brown <broonie@kernel.org>
Tue, 4 Dec 2018 15:50:56 +0000 (15:50 +0000)
commit c16015f36cc12824 ("ASoC: rsnd: add .get_id/.get_id_sub")
add new .get_id/.get_id_sub to indicate module ID/subID.
It is used for SSIU and CTU. In SSIU case, subID indicates BUSIF,
but register settings is based on SSIU ID.
OTOH, in CTU case, subID indicates CTU channel, and register settings
is based on it. This means regmap read/write function needs to care it.
This patch fixup this issue. It can't play MIXed sound without this
patch.

Fixes: c16015f36cc12824 ("ASoC: rsnd: add .get_id/.get_id_sub")
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sh/rcar/ctu.c
sound/soc/sh/rcar/gen.c
sound/soc/sh/rcar/rsnd.h

index 4dda7d968894709efe90c072320a0e050ee02389..ff41a5ee609251b1d10e7f3da711c20357d85263 100644 (file)
@@ -317,6 +317,7 @@ static struct rsnd_mod_ops rsnd_ctu_ops = {
        .get_status     = rsnd_mod_get_status,
        .id             = rsnd_ctu_id,
        .id_sub         = rsnd_ctu_id_sub,
+       .id_cmd         = rsnd_mod_id_raw,
 };
 
 struct rsnd_mod *rsnd_ctu_mod_get(struct rsnd_priv *priv, int id)
index ca639404f2cd0c3e72a4957af098604c813fd2a1..3283d677c937a4268ddb41ced0e218dff0e43d4d 100644 (file)
@@ -71,6 +71,14 @@ static int rsnd_is_accessible_reg(struct rsnd_priv *priv,
        return 1;
 }
 
+static int rsnd_mod_id_cmd(struct rsnd_mod *mod)
+{
+       if (mod->ops->id_cmd)
+               return mod->ops->id_cmd(mod);
+
+       return rsnd_mod_id(mod);
+}
+
 u32 rsnd_read(struct rsnd_priv *priv,
              struct rsnd_mod *mod, enum rsnd_reg reg)
 {
@@ -81,7 +89,7 @@ u32 rsnd_read(struct rsnd_priv *priv,
        if (!rsnd_is_accessible_reg(priv, gen, reg))
                return 0;
 
-       regmap_fields_read(gen->regs[reg], rsnd_mod_id(mod), &val);
+       regmap_fields_read(gen->regs[reg], rsnd_mod_id_cmd(mod), &val);
 
        dev_dbg(dev, "r %s - %-18s (%4d) : %08x\n",
                rsnd_mod_name(mod),
@@ -100,7 +108,7 @@ void rsnd_write(struct rsnd_priv *priv,
        if (!rsnd_is_accessible_reg(priv, gen, reg))
                return;
 
-       regmap_fields_force_write(gen->regs[reg], rsnd_mod_id(mod), data);
+       regmap_fields_force_write(gen->regs[reg], rsnd_mod_id_cmd(mod), data);
 
        dev_dbg(dev, "w %s - %-18s (%4d) : %08x\n",
                rsnd_mod_name(mod),
@@ -117,7 +125,7 @@ void rsnd_bset(struct rsnd_priv *priv, struct rsnd_mod *mod,
                return;
 
        regmap_fields_force_update_bits(gen->regs[reg],
-                                       rsnd_mod_id(mod), mask, data);
+                                       rsnd_mod_id_cmd(mod), mask, data);
 
        dev_dbg(dev, "b %s - %-18s (%4d) : %08x/%08x\n",
                rsnd_mod_name(mod),
index 3c57129af6d1cd172e49822c9ba3685150338ffb..94d51fee89995a08785204b6653930be752dd6cf 100644 (file)
@@ -306,6 +306,7 @@ struct rsnd_mod_ops {
                           enum rsnd_mod_type type);
        int (*id)(struct rsnd_mod *mod);
        int (*id_sub)(struct rsnd_mod *mod);
+       int (*id_cmd)(struct rsnd_mod *mod);
 };
 
 struct rsnd_dai_stream;