summaryrefslogtreecommitdiff
path: root/sound/soc/sh/rcar/core.c
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2014-11-27 08:02:55 (GMT)
committerMark Brown <broonie@kernel.org>2014-12-03 18:51:39 (GMT)
commit417f96420a5823485b90ad7ee9fddb67996bbd7f (patch)
tree2803224ff389848a40559c6a496aad10150d9c88 /sound/soc/sh/rcar/core.c
parent97463e193654574e1533f71359d91d9d2fdb3571 (diff)
downloadlinux-417f96420a5823485b90ad7ee9fddb67996bbd7f.tar.xz
ASoC: rsnd: add callback status check method
R-Car sound can use SSI/SRC/DVC modules, and these are controlled as rsnd_mod in rsnd driver. These rsnd_mod has each own function as callback. Basically these callback function has pair like probe/remove, start/stop, etc. And, these functions are called by order to each stage like below. 1. src->probe 2. ssi->probe 3. dvc->probe 4. src->start 5. ssi->start 6. dvc->start 7. src->stop 8. ssi->stop 9. dvc->stop 10. src->remove 11. ssi->remove 12. dvc->remove But, current rsnd driver doesn't care about its status which indicates which function is called. For example, if 5) returns error, 6) is not called. In such case, 9) should not be called. This patch care about each modules status. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/sh/rcar/core.c')
-rw-r--r--sound/soc/sh/rcar/core.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 0785f84..fce61a0 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -416,9 +416,16 @@ 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); \
- dev_dbg(dev, "%s[%d] %s\n", \
- rsnd_mod_name(mod), rsnd_mod_id(mod), #func); \
- (mod)->ops->func(mod, rdai); \
+ u32 mask = 1 << __rsnd_mod_shift_##func; \
+ u32 call = __rsnd_mod_call_##func << __rsnd_mod_shift_##func; \
+ int ret = 0; \
+ if ((mod->status & mask) == call) { \
+ dev_dbg(dev, "%s[%d] %s\n", \
+ rsnd_mod_name(mod), rsnd_mod_id(mod), #func); \
+ ret = (mod)->ops->func(mod, rdai); \
+ mod->status = (mod->status & ~mask) | (~call & mask); \
+ } \
+ ret; \
})
#define rsnd_mod_call(mod, func, rdai...) \