diff options
Diffstat (limited to 'sound/soc/sh/rcar/scu.c')
-rw-r--r-- | sound/soc/sh/rcar/scu.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/sound/soc/sh/rcar/scu.c b/sound/soc/sh/rcar/scu.c index 2df2e9150b89..f4453e33a847 100644 --- a/sound/soc/sh/rcar/scu.c +++ b/sound/soc/sh/rcar/scu.c @@ -146,20 +146,26 @@ static int rsnd_scu_set_hpbif(struct rsnd_priv *priv, return 0; } +bool rsnd_scu_hpbif_is_enable(struct rsnd_mod *mod) +{ + struct rsnd_scu *scu = rsnd_mod_to_scu(mod); + u32 flags = rsnd_scu_mode_flags(scu); + + return !!(flags & RSND_SCU_USE_HPBIF); +} + static int rsnd_scu_start(struct rsnd_mod *mod, struct rsnd_dai *rdai, struct rsnd_dai_stream *io) { struct rsnd_priv *priv = rsnd_mod_to_priv(mod); - struct rsnd_scu *scu = rsnd_mod_to_scu(mod); struct device *dev = rsnd_priv_to_dev(priv); - u32 flags = rsnd_scu_mode_flags(scu); int ret; /* * SCU will be used if it has RSND_SCU_USE_HPBIF flags */ - if (!(flags & RSND_SCU_USE_HPBIF)) { + if (!rsnd_scu_hpbif_is_enable(mod)) { /* it use PIO transter */ dev_dbg(dev, "%s%d is not used\n", rsnd_mod_name(mod), rsnd_mod_id(mod)); @@ -192,7 +198,8 @@ static struct rsnd_mod_ops rsnd_scu_ops = { struct rsnd_mod *rsnd_scu_mod_get(struct rsnd_priv *priv, int id) { - BUG_ON(id < 0 || id >= rsnd_scu_nr(priv)); + if (WARN_ON(id < 0 || id >= rsnd_scu_nr(priv))) + id = 0; return &((struct rsnd_scu *)(priv->scu) + id)->mod; } |