Commit 985a4f6e authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: rsnd: replace rsnd_dai_is_play() to rsnd_io_is_play()

Current rsnd driver can use rsnd_io_to_rdai()
we can get play/capture direction via io now.
Let's replace rsnd_dai_is_play() to rsnd_io_is_play()
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 54cb5562
...@@ -80,7 +80,7 @@ static int rsnd_adg_set_src_timsel_gen2(struct rsnd_dai *rdai, ...@@ -80,7 +80,7 @@ static int rsnd_adg_set_src_timsel_gen2(struct rsnd_dai *rdai,
struct rsnd_dai_stream *io, struct rsnd_dai_stream *io,
u32 timsel) u32 timsel)
{ {
int is_play = rsnd_dai_is_play(rdai, io); int is_play = rsnd_io_is_play(io);
int id = rsnd_mod_id(mod); int id = rsnd_mod_id(mod);
int shift = (id % 2) ? 16 : 0; int shift = (id % 2) ? 16 : 0;
u32 mask, ws; u32 mask, ws;
......
...@@ -494,11 +494,6 @@ static struct rsnd_dai *rsnd_dai_to_rdai(struct snd_soc_dai *dai) ...@@ -494,11 +494,6 @@ static struct rsnd_dai *rsnd_dai_to_rdai(struct snd_soc_dai *dai)
return rsnd_rdai_get(priv, dai->id); return rsnd_rdai_get(priv, dai->id);
} }
int rsnd_dai_is_play(struct rsnd_dai *rdai, struct rsnd_dai_stream *io)
{
return &rdai->playback == io;
}
/* /*
* rsnd_soc_dai functions * rsnd_soc_dai functions
*/ */
......
...@@ -206,11 +206,12 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod, ...@@ -206,11 +206,12 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod,
{ {
struct rsnd_dai_stream *io = rsnd_mod_to_io(mod); struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
struct rsnd_dvc *dvc = rsnd_mod_to_dvc(mod); struct rsnd_dvc *dvc = rsnd_mod_to_dvc(mod);
int is_play = rsnd_io_is_play(io);
int ret; int ret;
/* Volume */ /* Volume */
ret = rsnd_kctrl_new_m(mod, rdai, rtd, ret = rsnd_kctrl_new_m(mod, rdai, rtd,
rsnd_dai_is_play(rdai, io) ? is_play ?
"DVC Out Playback Volume" : "DVC In Capture Volume", "DVC Out Playback Volume" : "DVC In Capture Volume",
rsnd_dvc_volume_update, rsnd_dvc_volume_update,
&dvc->volume, 0x00800000 - 1); &dvc->volume, 0x00800000 - 1);
...@@ -219,7 +220,7 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod, ...@@ -219,7 +220,7 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod,
/* Mute */ /* Mute */
ret = rsnd_kctrl_new_m(mod, rdai, rtd, ret = rsnd_kctrl_new_m(mod, rdai, rtd,
rsnd_dai_is_play(rdai, io) ? is_play ?
"DVC Out Mute Switch" : "DVC In Mute Switch", "DVC Out Mute Switch" : "DVC In Mute Switch",
rsnd_dvc_volume_update, rsnd_dvc_volume_update,
&dvc->mute, 1); &dvc->mute, 1);
...@@ -228,7 +229,7 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod, ...@@ -228,7 +229,7 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod,
/* Ramp */ /* Ramp */
ret = rsnd_kctrl_new_s(mod, rdai, rtd, ret = rsnd_kctrl_new_s(mod, rdai, rtd,
rsnd_dai_is_play(rdai, io) ? is_play ?
"DVC Out Ramp Switch" : "DVC In Ramp Switch", "DVC Out Ramp Switch" : "DVC In Ramp Switch",
rsnd_dvc_volume_update, rsnd_dvc_volume_update,
&dvc->ren, 1); &dvc->ren, 1);
...@@ -236,7 +237,7 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod, ...@@ -236,7 +237,7 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod,
return ret; return ret;
ret = rsnd_kctrl_new_e(mod, rdai, rtd, ret = rsnd_kctrl_new_e(mod, rdai, rtd,
rsnd_dai_is_play(rdai, io) ? is_play ?
"DVC Out Ramp Up Rate" : "DVC In Ramp Up Rate", "DVC Out Ramp Up Rate" : "DVC In Ramp Up Rate",
&dvc->rup, &dvc->rup,
rsnd_dvc_volume_update, rsnd_dvc_volume_update,
...@@ -245,7 +246,7 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod, ...@@ -245,7 +246,7 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod,
return ret; return ret;
ret = rsnd_kctrl_new_e(mod, rdai, rtd, ret = rsnd_kctrl_new_e(mod, rdai, rtd,
rsnd_dai_is_play(rdai, io) ? is_play ?
"DVC Out Ramp Down Rate" : "DVC In Ramp Down Rate", "DVC Out Ramp Down Rate" : "DVC In Ramp Down Rate",
&dvc->rdown, &dvc->rdown,
rsnd_dvc_volume_update, rsnd_dvc_volume_update,
......
...@@ -292,9 +292,11 @@ struct rsnd_dai_stream { ...@@ -292,9 +292,11 @@ struct rsnd_dai_stream {
#define rsnd_io_to_mod_src(io) ((io)->mod[RSND_MOD_SRC]) #define rsnd_io_to_mod_src(io) ((io)->mod[RSND_MOD_SRC])
#define rsnd_io_to_mod_dvc(io) ((io)->mod[RSND_MOD_DVC]) #define rsnd_io_to_mod_dvc(io) ((io)->mod[RSND_MOD_DVC])
#define rsnd_io_to_rdai(io) ((io)->rdai) #define rsnd_io_to_rdai(io) ((io)->rdai)
#define rsnd_io_is_play(io) (&rsnd_io_to_rdai(io)->playback == io)
#define rsnd_io_to_runtime(io) ((io)->substream ? \ #define rsnd_io_to_runtime(io) ((io)->substream ? \
(io)->substream->runtime : NULL) (io)->substream->runtime : NULL)
struct rsnd_dai { struct rsnd_dai {
char name[RSND_DAI_NAME_SIZE]; char name[RSND_DAI_NAME_SIZE];
struct rsnd_dai_stream playback; struct rsnd_dai_stream playback;
...@@ -317,8 +319,6 @@ struct rsnd_dai { ...@@ -317,8 +319,6 @@ struct rsnd_dai {
struct rsnd_dai *rsnd_rdai_get(struct rsnd_priv *priv, int id); struct rsnd_dai *rsnd_rdai_get(struct rsnd_priv *priv, int id);
int rsnd_dai_is_play(struct rsnd_dai *rdai, struct rsnd_dai_stream *io);
void rsnd_dai_pointer_update(struct rsnd_dai_stream *io, int cnt); void rsnd_dai_pointer_update(struct rsnd_dai_stream *io, int cnt);
int rsnd_dai_pointer_offset(struct rsnd_dai_stream *io, int additional); int rsnd_dai_pointer_offset(struct rsnd_dai_stream *io, int additional);
......
...@@ -362,7 +362,7 @@ static int rsnd_src_set_route_gen1(struct rsnd_mod *mod, ...@@ -362,7 +362,7 @@ static int rsnd_src_set_route_gen1(struct rsnd_mod *mod,
/* /*
* SRC_ROUTE_SELECT * SRC_ROUTE_SELECT
*/ */
val = rsnd_dai_is_play(rdai, io) ? 0x1 : 0x2; val = rsnd_io_is_play(io) ? 0x1 : 0x2;
val = val << routes[id].shift; val = val << routes[id].shift;
mask = routes[id].mask << routes[id].shift; mask = routes[id].mask << routes[id].shift;
......
...@@ -307,7 +307,7 @@ static int rsnd_ssi_init(struct rsnd_mod *mod, ...@@ -307,7 +307,7 @@ static int rsnd_ssi_init(struct rsnd_mod *mod,
cr |= SDTA; cr |= SDTA;
if (rdai->sys_delay) if (rdai->sys_delay)
cr |= DEL; cr |= DEL;
if (rsnd_dai_is_play(rdai, io)) if (rsnd_io_is_play(io))
cr |= TRMD; cr |= TRMD;
/* /*
...@@ -401,7 +401,7 @@ static irqreturn_t rsnd_ssi_interrupt(int irq, void *data) ...@@ -401,7 +401,7 @@ static irqreturn_t rsnd_ssi_interrupt(int irq, void *data)
* directly as 32bit data * directly as 32bit data
* see rsnd_ssi_init() * see rsnd_ssi_init()
*/ */
if (rsnd_dai_is_play(rdai, io)) if (rsnd_io_is_play(io))
rsnd_mod_write(mod, SSITDR, *buf); rsnd_mod_write(mod, SSITDR, *buf);
else else
*buf = rsnd_mod_read(mod, SSIRDR); *buf = rsnd_mod_read(mod, SSIRDR);
......
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