]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ASoC: rsnd: count each mod (SSI/SRC/DVC)
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Mon, 15 Jun 2015 06:24:34 +0000 (06:24 +0000)
committerMark Brown <broonie@kernel.org>
Tue, 16 Jun 2015 11:34:02 +0000 (12:34 +0100)
Each Renesas sound mod (= SSI/SRC/DVC) might be called from many paths
if it supports MIXer. Then, we don't need to re-call each mod function
that had been called. This patch count each mod status.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sh/rcar/core.c
sound/soc/sh/rcar/rsnd.h

index 027b04392674ef0a63d62b5a17f4dcce2a46f8ce..50ec28c24867c7ef3be387845682d41ba45b70f7 100644 (file)
@@ -211,15 +211,20 @@ u32 rsnd_get_adinr(struct rsnd_mod *mod)
 ({                                                             \
        struct rsnd_priv *priv = rsnd_mod_to_priv(mod);         \
        struct device *dev = rsnd_priv_to_dev(priv);            \
-       u32 mask = (1 << __rsnd_mod_shift_##func) & ~(1 << 31); \
-       u32 call = __rsnd_mod_call_##func << __rsnd_mod_shift_##func;   \
+       u32 mask = 0xF << __rsnd_mod_shift_##func;                      \
+       u8 val  = (mod->status >> __rsnd_mod_shift_##func) & 0xF;       \
+       u8 add  = ((val + __rsnd_mod_add_##func) & 0xF);                \
        int ret = 0;                                                    \
-       if ((mod->status & mask) == call) {                             \
-               dev_dbg(dev, "%s[%d] %s\n",                             \
-                       rsnd_mod_name(mod), rsnd_mod_id(mod), #func);   \
+       int called = 0;                                                 \
+       if (val == __rsnd_mod_call_##func) {                            \
+               called = 1;                                             \
                ret = (mod)->ops->func(mod, param);                     \
-               mod->status = (mod->status & ~mask) | (~call & mask);   \
+               mod->status = (mod->status & ~mask) +                   \
+                       (add << __rsnd_mod_shift_##func);               \
        }                                                               \
+       dev_dbg(dev, "%s[%d] 0x%08x %s\n",                              \
+               rsnd_mod_name(mod), rsnd_mod_id(mod), mod->status,      \
+               called ? #func : "");                                   \
        ret;                                                            \
 })
 
index e37234ea18e61daed23ac892053901b51275eb50..8a114cb41925d2da0c2bef21c2f57ba3f879bd52 100644 (file)
@@ -259,25 +259,36 @@ struct rsnd_mod {
 /*
  * status
  *
- * bit
- * 0   0: probe        1: remove
- * 1   0: init         1: quit
- * 2   0: start        1: stop
- * 3   0: pcm_new
- * 4   0: fallback
+ * 0xH0000CBA
  *
- * 31 bit is always called (see __rsnd_mod_call)
- * 31  0: hw_params
+ * A   0: probe        1: remove
+ * B   0: init         1: quit
+ * C   0: start        1: stop
+ *
+ * H is always called (see __rsnd_mod_call)
+ * H   0: pcm_new
+ * H   0: fallback
+ * H   0: hw_params
  */
 #define __rsnd_mod_shift_probe         0
 #define __rsnd_mod_shift_remove                0
-#define __rsnd_mod_shift_init          1
-#define __rsnd_mod_shift_quit          1
-#define __rsnd_mod_shift_start         2
-#define __rsnd_mod_shift_stop          2
-#define __rsnd_mod_shift_pcm_new       3
-#define __rsnd_mod_shift_fallback      4
-#define __rsnd_mod_shift_hw_params     31 /* always called */
+#define __rsnd_mod_shift_init          4
+#define __rsnd_mod_shift_quit          4
+#define __rsnd_mod_shift_start         8
+#define __rsnd_mod_shift_stop          8
+#define __rsnd_mod_shift_pcm_new       28 /* always called */
+#define __rsnd_mod_shift_fallback      28 /* always called */
+#define __rsnd_mod_shift_hw_params     28 /* always called */
+
+#define __rsnd_mod_add_probe            1
+#define __rsnd_mod_add_remove          -1
+#define __rsnd_mod_add_init             1
+#define __rsnd_mod_add_quit            -1
+#define __rsnd_mod_add_start            1
+#define __rsnd_mod_add_stop            -1
+#define __rsnd_mod_add_pcm_new         0
+#define __rsnd_mod_add_fallback                0
+#define __rsnd_mod_add_hw_params       0
 
 #define __rsnd_mod_call_probe          0
 #define __rsnd_mod_call_remove         1