ASoC: rsnd: judge multi SSI in runtime
Current rsnd supports multi SSI (maximum 4 SSI for 8ch), and, it should determine whether using each SSI or not in runtime. Current judgement is vague, and had broken by c308abe45e2("ASoC: rsnd: rsnd_ssi_is_multi_slave() macro uses rsnd_ssi_multi_slaves()") This patch makes clean it, and solve this issue. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
615fb6c7b1
commit
4f5c634d58
|
@ -230,7 +230,7 @@ int rsnd_get_slot_width(struct rsnd_dai_stream *io)
|
||||||
int chan = runtime->channels;
|
int chan = runtime->channels;
|
||||||
|
|
||||||
/* Multi channel Mode */
|
/* Multi channel Mode */
|
||||||
if (rsnd_ssi_multi_slaves(io))
|
if (rsnd_ssi_multi_slaves_runtime(io))
|
||||||
chan /= rsnd_get_slot_num(io);
|
chan /= rsnd_get_slot_num(io);
|
||||||
|
|
||||||
/* TDM Extend Mode needs 8ch */
|
/* TDM Extend Mode needs 8ch */
|
||||||
|
|
|
@ -599,7 +599,7 @@ void rsnd_ssi_remove(struct rsnd_priv *priv);
|
||||||
struct rsnd_mod *rsnd_ssi_mod_get(struct rsnd_priv *priv, int id);
|
struct rsnd_mod *rsnd_ssi_mod_get(struct rsnd_priv *priv, int id);
|
||||||
int rsnd_ssi_is_dma_mode(struct rsnd_mod *mod);
|
int rsnd_ssi_is_dma_mode(struct rsnd_mod *mod);
|
||||||
int rsnd_ssi_use_busif(struct rsnd_dai_stream *io);
|
int rsnd_ssi_use_busif(struct rsnd_dai_stream *io);
|
||||||
u32 rsnd_ssi_multi_slaves(struct rsnd_dai_stream *io);
|
u32 rsnd_ssi_multi_slaves_runtime(struct rsnd_dai_stream *io);
|
||||||
|
|
||||||
#define rsnd_ssi_is_pin_sharing(io) \
|
#define rsnd_ssi_is_pin_sharing(io) \
|
||||||
__rsnd_ssi_is_pin_sharing(rsnd_io_to_mod_ssi(io))
|
__rsnd_ssi_is_pin_sharing(rsnd_io_to_mod_ssi(io))
|
||||||
|
|
|
@ -144,7 +144,7 @@ static void rsnd_ssi_status_check(struct rsnd_mod *mod,
|
||||||
rsnd_mod_name(mod), rsnd_mod_id(mod));
|
rsnd_mod_name(mod), rsnd_mod_id(mod));
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 rsnd_ssi_multi_slaves(struct rsnd_dai_stream *io)
|
static u32 rsnd_ssi_multi_slaves(struct rsnd_dai_stream *io)
|
||||||
{
|
{
|
||||||
struct rsnd_mod *mod;
|
struct rsnd_mod *mod;
|
||||||
enum rsnd_mod_type types[] = {
|
enum rsnd_mod_type types[] = {
|
||||||
|
@ -166,6 +166,17 @@ u32 rsnd_ssi_multi_slaves(struct rsnd_dai_stream *io)
|
||||||
return mask;
|
return mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u32 rsnd_ssi_multi_slaves_runtime(struct rsnd_dai_stream *io)
|
||||||
|
{
|
||||||
|
struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
|
||||||
|
u32 mask = rsnd_ssi_multi_slaves(io);
|
||||||
|
|
||||||
|
if (mask && (runtime->channels >= 6))
|
||||||
|
return mask;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int rsnd_ssi_master_clk_start(struct rsnd_mod *mod,
|
static int rsnd_ssi_master_clk_start(struct rsnd_mod *mod,
|
||||||
struct rsnd_dai_stream *io)
|
struct rsnd_dai_stream *io)
|
||||||
{
|
{
|
||||||
|
@ -415,7 +426,7 @@ static int rsnd_ssi_start(struct rsnd_mod *mod,
|
||||||
* EN will be set via SSIU :: SSI_CONTROL
|
* EN will be set via SSIU :: SSI_CONTROL
|
||||||
* if Multi channel mode
|
* if Multi channel mode
|
||||||
*/
|
*/
|
||||||
if (rsnd_ssi_multi_slaves(io))
|
if (rsnd_ssi_multi_slaves_runtime(io))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
rsnd_mod_bset(mod, SSICR, EN, EN);
|
rsnd_mod_bset(mod, SSICR, EN, EN);
|
||||||
|
|
|
@ -27,7 +27,7 @@ static int rsnd_ssiu_init(struct rsnd_mod *mod,
|
||||||
struct rsnd_priv *priv)
|
struct rsnd_priv *priv)
|
||||||
{
|
{
|
||||||
struct rsnd_dai *rdai = rsnd_io_to_rdai(io);
|
struct rsnd_dai *rdai = rsnd_io_to_rdai(io);
|
||||||
u32 multi_ssi_slaves = rsnd_ssi_multi_slaves(io);
|
u32 multi_ssi_slaves = rsnd_ssi_multi_slaves_runtime(io);
|
||||||
int use_busif = rsnd_ssi_use_busif(io);
|
int use_busif = rsnd_ssi_use_busif(io);
|
||||||
int id = rsnd_mod_id(mod);
|
int id = rsnd_mod_id(mod);
|
||||||
u32 mask1, val1;
|
u32 mask1, val1;
|
||||||
|
@ -136,7 +136,7 @@ static int rsnd_ssiu_start_gen2(struct rsnd_mod *mod,
|
||||||
|
|
||||||
rsnd_mod_write(mod, SSI_CTRL, 0x1);
|
rsnd_mod_write(mod, SSI_CTRL, 0x1);
|
||||||
|
|
||||||
if (rsnd_ssi_multi_slaves(io))
|
if (rsnd_ssi_multi_slaves_runtime(io))
|
||||||
rsnd_mod_write(mod, SSI_CONTROL, 0x1);
|
rsnd_mod_write(mod, SSI_CONTROL, 0x1);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -151,7 +151,7 @@ static int rsnd_ssiu_stop_gen2(struct rsnd_mod *mod,
|
||||||
|
|
||||||
rsnd_mod_write(mod, SSI_CTRL, 0);
|
rsnd_mod_write(mod, SSI_CTRL, 0);
|
||||||
|
|
||||||
if (rsnd_ssi_multi_slaves(io))
|
if (rsnd_ssi_multi_slaves_runtime(io))
|
||||||
rsnd_mod_write(mod, SSI_CONTROL, 0);
|
rsnd_mod_write(mod, SSI_CONTROL, 0);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue