ASoC: rsnd: get ssi/scu from rsnd_dai_stream

Current driver is assuming that SSI id = SCU id.
But, now, it can get correct SSI/SCU from
rsnd_dai_stream. use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
This commit is contained in:
Kuninori Morimoto 2014-03-02 23:43:03 -08:00 коммит произвёл Mark Brown
Родитель a126021d14
Коммит 374e542637
3 изменённых файлов: 15 добавлений и 11 удалений

Просмотреть файл

@ -192,6 +192,8 @@ struct rsnd_dai_stream {
int byte_per_period;
int next_period_byte;
};
#define rsnd_io_to_mod_ssi(io) ((io)->mod[RSND_MOD_SSI])
#define rsnd_io_to_mod_scu(io) ((io)->mod[RSND_MOD_SCU])
struct rsnd_dai {
char name[RSND_DAI_NAME_SIZE];
@ -311,7 +313,7 @@ void rsnd_scu_remove(struct platform_device *pdev,
struct rsnd_priv *priv);
struct rsnd_mod *rsnd_scu_mod_get(struct rsnd_priv *priv, int id);
unsigned int rsnd_scu_get_ssi_rate(struct rsnd_priv *priv,
struct rsnd_mod *ssi_mod,
struct rsnd_dai_stream *io,
struct snd_pcm_runtime *runtime);
#define rsnd_scu_nr(priv) ((priv)->scu_nr)

Просмотреть файл

@ -121,7 +121,8 @@ static int rsnd_scu_ssi_mode_init(struct rsnd_mod *mod,
{
struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
struct rsnd_scu *scu = rsnd_mod_to_scu(mod);
int id = rsnd_mod_id(mod);
struct rsnd_mod *ssi_mod = rsnd_io_to_mod_ssi(io);
int ssi_id = rsnd_mod_id(ssi_mod);
u32 convert_rate = rsnd_scu_convert_rate(scu);
if (convert_rate && !rsnd_dai_is_clk_master(rdai)) {
@ -134,15 +135,15 @@ static int rsnd_scu_ssi_mode_init(struct rsnd_mod *mod,
/*
* SSI_MODE0
*/
rsnd_mod_bset(mod, SSI_MODE0, (1 << id),
rsnd_scu_hpbif_is_enable(scu) ? 0 : (1 << id));
rsnd_mod_bset(mod, SSI_MODE0, (1 << ssi_id),
rsnd_scu_hpbif_is_enable(scu) ? 0 : (1 << ssi_id));
/*
* SSI_MODE1
*/
if (rsnd_ssi_is_pin_sharing(rsnd_ssi_mod_get(priv, id))) {
if (rsnd_ssi_is_pin_sharing(ssi_mod)) {
int shift = -1;
switch (id) {
switch (ssi_id) {
case 1:
shift = 0;
break;
@ -165,14 +166,13 @@ static int rsnd_scu_ssi_mode_init(struct rsnd_mod *mod,
}
unsigned int rsnd_scu_get_ssi_rate(struct rsnd_priv *priv,
struct rsnd_mod *ssi_mod,
struct rsnd_dai_stream *io,
struct snd_pcm_runtime *runtime)
{
struct rsnd_scu *scu;
unsigned int rate;
/* this function is assuming SSI id = SCU id here */
scu = rsnd_mod_to_scu(rsnd_scu_mod_get(priv, rsnd_mod_id(ssi_mod)));
scu = rsnd_mod_to_scu(rsnd_io_to_mod_scu(io));
/*
* return convert rate if SRC is used,
@ -583,8 +583,10 @@ static int rsnd_scu_start_non_gen2(struct rsnd_mod *mod,
struct rsnd_dai *rdai,
struct rsnd_dai_stream *io)
{
struct rsnd_mod *ssi_mod = rsnd_io_to_mod_ssi(io);
/* enable PIO interrupt */
rsnd_mod_write(mod, INT_ENABLE, 0x0f000000);
rsnd_mod_write(ssi_mod, INT_ENABLE, 0x0f000000);
return 0;
}

Просмотреть файл

@ -121,7 +121,7 @@ static int rsnd_ssi_master_clk_start(struct rsnd_ssi *ssi,
1, 2, 4, 8, 16, 6, 12,
};
unsigned int main_rate;
unsigned int rate = rsnd_scu_get_ssi_rate(priv, &ssi->mod, runtime);
unsigned int rate = rsnd_scu_get_ssi_rate(priv, io, runtime);
/*
* Find best clock, and try to start ADG