Commit 8c9d7503 authored by Jiada Wang's avatar Jiada Wang Committed by Mark Brown

ASoC: rsnd: ssiu: Support BUSIF other than BUSIF0

Currently only BUSIF0 is supported by SSIU, all register setting
is done only for BUSIF.

Since BUSIF1 ~ BUSIF7 has been supported, so also support
these BUSIF from SSIU.

One note is that we can't support SSI9-4/5/6/7 so far,
because its address is out of calculation rule.
Signed-off-by: default avatarJiada Wang <jiada_wang@mentor.com>
Signed-off-by: default avatarTimo Wischer <twischer@de.adit-jv.com>
[Kuninori: tidyup for upstream]
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: default avatarHiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 92c7d384
......@@ -219,9 +219,30 @@ static int rsnd_gen2_probe(struct rsnd_priv *priv)
RSND_GEN_S_REG(HDMI1_SEL, 0x9e4),
/* FIXME: it needs SSI_MODE2/3 in the future */
RSND_GEN_M_REG(SSI_BUSIF_MODE, 0x0, 0x80),
RSND_GEN_M_REG(SSI_BUSIF_ADINR, 0x4, 0x80),
RSND_GEN_M_REG(SSI_BUSIF_DALIGN,0x8, 0x80),
RSND_GEN_M_REG(SSI_BUSIF0_MODE, 0x0, 0x80),
RSND_GEN_M_REG(SSI_BUSIF0_ADINR, 0x4, 0x80),
RSND_GEN_M_REG(SSI_BUSIF0_DALIGN, 0x8, 0x80),
RSND_GEN_M_REG(SSI_BUSIF1_MODE, 0x20, 0x80),
RSND_GEN_M_REG(SSI_BUSIF1_ADINR, 0x24, 0x80),
RSND_GEN_M_REG(SSI_BUSIF1_DALIGN, 0x28, 0x80),
RSND_GEN_M_REG(SSI_BUSIF2_MODE, 0x40, 0x80),
RSND_GEN_M_REG(SSI_BUSIF2_ADINR, 0x44, 0x80),
RSND_GEN_M_REG(SSI_BUSIF2_DALIGN, 0x48, 0x80),
RSND_GEN_M_REG(SSI_BUSIF3_MODE, 0x60, 0x80),
RSND_GEN_M_REG(SSI_BUSIF3_ADINR, 0x64, 0x80),
RSND_GEN_M_REG(SSI_BUSIF3_DALIGN, 0x68, 0x80),
RSND_GEN_M_REG(SSI_BUSIF4_MODE, 0x500, 0x80),
RSND_GEN_M_REG(SSI_BUSIF4_ADINR, 0x504, 0x80),
RSND_GEN_M_REG(SSI_BUSIF4_DALIGN, 0x508, 0x80),
RSND_GEN_M_REG(SSI_BUSIF5_MODE, 0x520, 0x80),
RSND_GEN_M_REG(SSI_BUSIF5_ADINR, 0x524, 0x80),
RSND_GEN_M_REG(SSI_BUSIF5_DALIGN, 0x528, 0x80),
RSND_GEN_M_REG(SSI_BUSIF6_MODE, 0x540, 0x80),
RSND_GEN_M_REG(SSI_BUSIF6_ADINR, 0x544, 0x80),
RSND_GEN_M_REG(SSI_BUSIF6_DALIGN, 0x548, 0x80),
RSND_GEN_M_REG(SSI_BUSIF7_MODE, 0x560, 0x80),
RSND_GEN_M_REG(SSI_BUSIF7_ADINR, 0x564, 0x80),
RSND_GEN_M_REG(SSI_BUSIF7_DALIGN, 0x568, 0x80),
RSND_GEN_M_REG(SSI_MODE, 0xc, 0x80),
RSND_GEN_M_REG(SSI_CTRL, 0x10, 0x80),
RSND_GEN_M_REG(SSI_INT_ENABLE, 0x18, 0x80),
......
......@@ -156,9 +156,30 @@ enum rsnd_reg {
RSND_REG_SSI_MODE2,
RSND_REG_SSI_CONTROL,
RSND_REG_SSI_CTRL,
RSND_REG_SSI_BUSIF_MODE,
RSND_REG_SSI_BUSIF_ADINR,
RSND_REG_SSI_BUSIF_DALIGN,
RSND_REG_SSI_BUSIF0_MODE,
RSND_REG_SSI_BUSIF0_ADINR,
RSND_REG_SSI_BUSIF0_DALIGN,
RSND_REG_SSI_BUSIF1_MODE,
RSND_REG_SSI_BUSIF1_ADINR,
RSND_REG_SSI_BUSIF1_DALIGN,
RSND_REG_SSI_BUSIF2_MODE,
RSND_REG_SSI_BUSIF2_ADINR,
RSND_REG_SSI_BUSIF2_DALIGN,
RSND_REG_SSI_BUSIF3_MODE,
RSND_REG_SSI_BUSIF3_ADINR,
RSND_REG_SSI_BUSIF3_DALIGN,
RSND_REG_SSI_BUSIF4_MODE,
RSND_REG_SSI_BUSIF4_ADINR,
RSND_REG_SSI_BUSIF4_DALIGN,
RSND_REG_SSI_BUSIF5_MODE,
RSND_REG_SSI_BUSIF5_ADINR,
RSND_REG_SSI_BUSIF5_DALIGN,
RSND_REG_SSI_BUSIF6_MODE,
RSND_REG_SSI_BUSIF6_ADINR,
RSND_REG_SSI_BUSIF6_DALIGN,
RSND_REG_SSI_BUSIF7_MODE,
RSND_REG_SSI_BUSIF7_ADINR,
RSND_REG_SSI_BUSIF7_DALIGN,
RSND_REG_SSI_INT_ENABLE,
RSND_REG_SSI_SYS_STATUS0,
RSND_REG_SSI_SYS_STATUS1,
......
......@@ -140,15 +140,59 @@ static int rsnd_ssiu_init_gen2(struct rsnd_mod *mod,
rsnd_mod_write(mod, SSI_MODE, mode);
if (rsnd_ssi_use_busif(io)) {
rsnd_mod_write(mod, SSI_BUSIF_ADINR,
rsnd_get_adinr_bit(mod, io) |
(rsnd_io_is_play(io) ?
rsnd_runtime_channel_after_ctu(io) :
rsnd_runtime_channel_original(io)));
rsnd_mod_write(mod, SSI_BUSIF_MODE,
rsnd_get_busif_shift(io, mod) | 1);
rsnd_mod_write(mod, SSI_BUSIF_DALIGN,
rsnd_get_dalign(mod, io));
int id = rsnd_mod_id(mod);
int busif = rsnd_ssi_get_busif(io);
/*
* FIXME
*
* We can't support SSI9-4/5/6/7, because its address is
* out of calculation rule
*/
if ((id == 9) && (busif >= 4)) {
struct device *dev = rsnd_priv_to_dev(priv);
dev_err(dev, "This driver doesn't support SSI%d-%d, so far",
id, busif);
}
#define RSND_WRITE_BUSIF(i) \
rsnd_mod_write(mod, SSI_BUSIF##i##_ADINR, \
rsnd_get_adinr_bit(mod, io) | \
(rsnd_io_is_play(io) ? \
rsnd_runtime_channel_after_ctu(io) : \
rsnd_runtime_channel_original(io))); \
rsnd_mod_write(mod, SSI_BUSIF##i##_MODE, \
rsnd_get_busif_shift(io, mod) | 1); \
rsnd_mod_write(mod, SSI_BUSIF##i##_DALIGN, \
rsnd_get_dalign(mod, io))
switch (busif) {
case 0:
RSND_WRITE_BUSIF(0);
break;
case 1:
RSND_WRITE_BUSIF(1);
break;
case 2:
RSND_WRITE_BUSIF(2);
break;
case 3:
RSND_WRITE_BUSIF(3);
break;
case 4:
RSND_WRITE_BUSIF(4);
break;
case 5:
RSND_WRITE_BUSIF(5);
break;
case 6:
RSND_WRITE_BUSIF(6);
break;
case 7:
RSND_WRITE_BUSIF(7);
break;
}
}
if (hdmi) {
......@@ -194,10 +238,12 @@ static int rsnd_ssiu_start_gen2(struct rsnd_mod *mod,
struct rsnd_dai_stream *io,
struct rsnd_priv *priv)
{
int busif = rsnd_ssi_get_busif(io);
if (!rsnd_ssi_use_busif(io))
return 0;
rsnd_mod_write(mod, SSI_CTRL, 0x1);
rsnd_mod_bset(mod, SSI_CTRL, 1 << (busif * 4), 1 << (busif * 4));
if (rsnd_ssi_multi_slaves_runtime(io))
rsnd_mod_write(mod, SSI_CONTROL, 0x1);
......@@ -209,10 +255,12 @@ static int rsnd_ssiu_stop_gen2(struct rsnd_mod *mod,
struct rsnd_dai_stream *io,
struct rsnd_priv *priv)
{
int busif = rsnd_ssi_get_busif(io);
if (!rsnd_ssi_use_busif(io))
return 0;
rsnd_mod_write(mod, SSI_CTRL, 0);
rsnd_mod_bset(mod, SSI_CTRL, 1 << (busif * 4), 0);
if (rsnd_ssi_multi_slaves_runtime(io))
rsnd_mod_write(mod, SSI_CONTROL, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment