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: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Kuninori Morimoto 2015-01-15 08:06:49 +00:00 committed by Mark Brown
parent 54cb556247
commit 985a4f6e61
6 changed files with 12 additions and 16 deletions

View File

@ -80,7 +80,7 @@ static int rsnd_adg_set_src_timsel_gen2(struct rsnd_dai *rdai,
struct rsnd_dai_stream *io,
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 shift = (id % 2) ? 16 : 0;
u32 mask, ws;

View File

@ -494,11 +494,6 @@ static struct rsnd_dai *rsnd_dai_to_rdai(struct snd_soc_dai *dai)
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
*/

View File

@ -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_dvc *dvc = rsnd_mod_to_dvc(mod);
int is_play = rsnd_io_is_play(io);
int ret;
/* Volume */
ret = rsnd_kctrl_new_m(mod, rdai, rtd,
rsnd_dai_is_play(rdai, io) ?
is_play ?
"DVC Out Playback Volume" : "DVC In Capture Volume",
rsnd_dvc_volume_update,
&dvc->volume, 0x00800000 - 1);
@ -219,7 +220,7 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod,
/* Mute */
ret = rsnd_kctrl_new_m(mod, rdai, rtd,
rsnd_dai_is_play(rdai, io) ?
is_play ?
"DVC Out Mute Switch" : "DVC In Mute Switch",
rsnd_dvc_volume_update,
&dvc->mute, 1);
@ -228,7 +229,7 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod,
/* Ramp */
ret = rsnd_kctrl_new_s(mod, rdai, rtd,
rsnd_dai_is_play(rdai, io) ?
is_play ?
"DVC Out Ramp Switch" : "DVC In Ramp Switch",
rsnd_dvc_volume_update,
&dvc->ren, 1);
@ -236,7 +237,7 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod,
return ret;
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->rup,
rsnd_dvc_volume_update,
@ -245,7 +246,7 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod,
return ret;
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->rdown,
rsnd_dvc_volume_update,

View File

@ -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_dvc(io) ((io)->mod[RSND_MOD_DVC])
#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 ? \
(io)->substream->runtime : NULL)
struct rsnd_dai {
char name[RSND_DAI_NAME_SIZE];
struct rsnd_dai_stream playback;
@ -317,8 +319,6 @@ struct rsnd_dai {
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);
int rsnd_dai_pointer_offset(struct rsnd_dai_stream *io, int additional);

View File

@ -362,7 +362,7 @@ static int rsnd_src_set_route_gen1(struct rsnd_mod *mod,
/*
* 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;
mask = routes[id].mask << routes[id].shift;

View File

@ -307,7 +307,7 @@ static int rsnd_ssi_init(struct rsnd_mod *mod,
cr |= SDTA;
if (rdai->sys_delay)
cr |= DEL;
if (rsnd_dai_is_play(rdai, io))
if (rsnd_io_is_play(io))
cr |= TRMD;
/*
@ -401,7 +401,7 @@ static irqreturn_t rsnd_ssi_interrupt(int irq, void *data)
* directly as 32bit data
* see rsnd_ssi_init()
*/
if (rsnd_dai_is_play(rdai, io))
if (rsnd_io_is_play(io))
rsnd_mod_write(mod, SSITDR, *buf);
else
*buf = rsnd_mod_read(mod, SSIRDR);