diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2015-01-15 03:06:49 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-01-15 06:37:48 -0500 |
commit | 985a4f6e61560c4cba19d910a0d81757a1063571 (patch) | |
tree | 22841fde3d2b65a24390b47db8bb75d22b9faa7d | |
parent | 54cb556247b171753484efb3c4777ca4d1babfa0 (diff) |
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>
-rw-r--r-- | sound/soc/sh/rcar/adg.c | 2 | ||||
-rw-r--r-- | sound/soc/sh/rcar/core.c | 5 | ||||
-rw-r--r-- | sound/soc/sh/rcar/dvc.c | 11 | ||||
-rw-r--r-- | sound/soc/sh/rcar/rsnd.h | 4 | ||||
-rw-r--r-- | sound/soc/sh/rcar/src.c | 2 | ||||
-rw-r--r-- | sound/soc/sh/rcar/ssi.c | 4 |
6 files changed, 12 insertions, 16 deletions
diff --git a/sound/soc/sh/rcar/adg.c b/sound/soc/sh/rcar/adg.c index 14d1a7193469..9d22c75b9b32 100644 --- a/sound/soc/sh/rcar/adg.c +++ b/sound/soc/sh/rcar/adg.c | |||
@@ -80,7 +80,7 @@ static int rsnd_adg_set_src_timsel_gen2(struct rsnd_dai *rdai, | |||
80 | struct rsnd_dai_stream *io, | 80 | struct rsnd_dai_stream *io, |
81 | u32 timsel) | 81 | u32 timsel) |
82 | { | 82 | { |
83 | int is_play = rsnd_dai_is_play(rdai, io); | 83 | int is_play = rsnd_io_is_play(io); |
84 | int id = rsnd_mod_id(mod); | 84 | int id = rsnd_mod_id(mod); |
85 | int shift = (id % 2) ? 16 : 0; | 85 | int shift = (id % 2) ? 16 : 0; |
86 | u32 mask, ws; | 86 | u32 mask, ws; |
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c index c8111857c9d9..c1f577da41fe 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c | |||
@@ -494,11 +494,6 @@ static struct rsnd_dai *rsnd_dai_to_rdai(struct snd_soc_dai *dai) | |||
494 | return rsnd_rdai_get(priv, dai->id); | 494 | return rsnd_rdai_get(priv, dai->id); |
495 | } | 495 | } |
496 | 496 | ||
497 | int rsnd_dai_is_play(struct rsnd_dai *rdai, struct rsnd_dai_stream *io) | ||
498 | { | ||
499 | return &rdai->playback == io; | ||
500 | } | ||
501 | |||
502 | /* | 497 | /* |
503 | * rsnd_soc_dai functions | 498 | * rsnd_soc_dai functions |
504 | */ | 499 | */ |
diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c index 77cb00890471..225baa32bf0b 100644 --- a/sound/soc/sh/rcar/dvc.c +++ b/sound/soc/sh/rcar/dvc.c | |||
@@ -206,11 +206,12 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod, | |||
206 | { | 206 | { |
207 | struct rsnd_dai_stream *io = rsnd_mod_to_io(mod); | 207 | struct rsnd_dai_stream *io = rsnd_mod_to_io(mod); |
208 | struct rsnd_dvc *dvc = rsnd_mod_to_dvc(mod); | 208 | struct rsnd_dvc *dvc = rsnd_mod_to_dvc(mod); |
209 | int is_play = rsnd_io_is_play(io); | ||
209 | int ret; | 210 | int ret; |
210 | 211 | ||
211 | /* Volume */ | 212 | /* Volume */ |
212 | ret = rsnd_kctrl_new_m(mod, rdai, rtd, | 213 | ret = rsnd_kctrl_new_m(mod, rdai, rtd, |
213 | rsnd_dai_is_play(rdai, io) ? | 214 | is_play ? |
214 | "DVC Out Playback Volume" : "DVC In Capture Volume", | 215 | "DVC Out Playback Volume" : "DVC In Capture Volume", |
215 | rsnd_dvc_volume_update, | 216 | rsnd_dvc_volume_update, |
216 | &dvc->volume, 0x00800000 - 1); | 217 | &dvc->volume, 0x00800000 - 1); |
@@ -219,7 +220,7 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod, | |||
219 | 220 | ||
220 | /* Mute */ | 221 | /* Mute */ |
221 | ret = rsnd_kctrl_new_m(mod, rdai, rtd, | 222 | ret = rsnd_kctrl_new_m(mod, rdai, rtd, |
222 | rsnd_dai_is_play(rdai, io) ? | 223 | is_play ? |
223 | "DVC Out Mute Switch" : "DVC In Mute Switch", | 224 | "DVC Out Mute Switch" : "DVC In Mute Switch", |
224 | rsnd_dvc_volume_update, | 225 | rsnd_dvc_volume_update, |
225 | &dvc->mute, 1); | 226 | &dvc->mute, 1); |
@@ -228,7 +229,7 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod, | |||
228 | 229 | ||
229 | /* Ramp */ | 230 | /* Ramp */ |
230 | ret = rsnd_kctrl_new_s(mod, rdai, rtd, | 231 | ret = rsnd_kctrl_new_s(mod, rdai, rtd, |
231 | rsnd_dai_is_play(rdai, io) ? | 232 | is_play ? |
232 | "DVC Out Ramp Switch" : "DVC In Ramp Switch", | 233 | "DVC Out Ramp Switch" : "DVC In Ramp Switch", |
233 | rsnd_dvc_volume_update, | 234 | rsnd_dvc_volume_update, |
234 | &dvc->ren, 1); | 235 | &dvc->ren, 1); |
@@ -236,7 +237,7 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod, | |||
236 | return ret; | 237 | return ret; |
237 | 238 | ||
238 | ret = rsnd_kctrl_new_e(mod, rdai, rtd, | 239 | ret = rsnd_kctrl_new_e(mod, rdai, rtd, |
239 | rsnd_dai_is_play(rdai, io) ? | 240 | is_play ? |
240 | "DVC Out Ramp Up Rate" : "DVC In Ramp Up Rate", | 241 | "DVC Out Ramp Up Rate" : "DVC In Ramp Up Rate", |
241 | &dvc->rup, | 242 | &dvc->rup, |
242 | rsnd_dvc_volume_update, | 243 | rsnd_dvc_volume_update, |
@@ -245,7 +246,7 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod, | |||
245 | return ret; | 246 | return ret; |
246 | 247 | ||
247 | ret = rsnd_kctrl_new_e(mod, rdai, rtd, | 248 | ret = rsnd_kctrl_new_e(mod, rdai, rtd, |
248 | rsnd_dai_is_play(rdai, io) ? | 249 | is_play ? |
249 | "DVC Out Ramp Down Rate" : "DVC In Ramp Down Rate", | 250 | "DVC Out Ramp Down Rate" : "DVC In Ramp Down Rate", |
250 | &dvc->rdown, | 251 | &dvc->rdown, |
251 | rsnd_dvc_volume_update, | 252 | rsnd_dvc_volume_update, |
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h index 0b5518259c28..83eb46c35e94 100644 --- a/sound/soc/sh/rcar/rsnd.h +++ b/sound/soc/sh/rcar/rsnd.h | |||
@@ -292,9 +292,11 @@ struct rsnd_dai_stream { | |||
292 | #define rsnd_io_to_mod_src(io) ((io)->mod[RSND_MOD_SRC]) | 292 | #define rsnd_io_to_mod_src(io) ((io)->mod[RSND_MOD_SRC]) |
293 | #define rsnd_io_to_mod_dvc(io) ((io)->mod[RSND_MOD_DVC]) | 293 | #define rsnd_io_to_mod_dvc(io) ((io)->mod[RSND_MOD_DVC]) |
294 | #define rsnd_io_to_rdai(io) ((io)->rdai) | 294 | #define rsnd_io_to_rdai(io) ((io)->rdai) |
295 | #define rsnd_io_is_play(io) (&rsnd_io_to_rdai(io)->playback == io) | ||
295 | #define rsnd_io_to_runtime(io) ((io)->substream ? \ | 296 | #define rsnd_io_to_runtime(io) ((io)->substream ? \ |
296 | (io)->substream->runtime : NULL) | 297 | (io)->substream->runtime : NULL) |
297 | 298 | ||
299 | |||
298 | struct rsnd_dai { | 300 | struct rsnd_dai { |
299 | char name[RSND_DAI_NAME_SIZE]; | 301 | char name[RSND_DAI_NAME_SIZE]; |
300 | struct rsnd_dai_stream playback; | 302 | struct rsnd_dai_stream playback; |
@@ -317,8 +319,6 @@ struct rsnd_dai { | |||
317 | 319 | ||
318 | struct rsnd_dai *rsnd_rdai_get(struct rsnd_priv *priv, int id); | 320 | struct rsnd_dai *rsnd_rdai_get(struct rsnd_priv *priv, int id); |
319 | 321 | ||
320 | int rsnd_dai_is_play(struct rsnd_dai *rdai, struct rsnd_dai_stream *io); | ||
321 | |||
322 | void rsnd_dai_pointer_update(struct rsnd_dai_stream *io, int cnt); | 322 | void rsnd_dai_pointer_update(struct rsnd_dai_stream *io, int cnt); |
323 | int rsnd_dai_pointer_offset(struct rsnd_dai_stream *io, int additional); | 323 | int rsnd_dai_pointer_offset(struct rsnd_dai_stream *io, int additional); |
324 | 324 | ||
diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c index cb2dbf3b8569..d4f9cccfff55 100644 --- a/sound/soc/sh/rcar/src.c +++ b/sound/soc/sh/rcar/src.c | |||
@@ -362,7 +362,7 @@ static int rsnd_src_set_route_gen1(struct rsnd_mod *mod, | |||
362 | /* | 362 | /* |
363 | * SRC_ROUTE_SELECT | 363 | * SRC_ROUTE_SELECT |
364 | */ | 364 | */ |
365 | val = rsnd_dai_is_play(rdai, io) ? 0x1 : 0x2; | 365 | val = rsnd_io_is_play(io) ? 0x1 : 0x2; |
366 | val = val << routes[id].shift; | 366 | val = val << routes[id].shift; |
367 | mask = routes[id].mask << routes[id].shift; | 367 | mask = routes[id].mask << routes[id].shift; |
368 | 368 | ||
diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c index 816178c71a6b..b9d33b985845 100644 --- a/sound/soc/sh/rcar/ssi.c +++ b/sound/soc/sh/rcar/ssi.c | |||
@@ -307,7 +307,7 @@ static int rsnd_ssi_init(struct rsnd_mod *mod, | |||
307 | cr |= SDTA; | 307 | cr |= SDTA; |
308 | if (rdai->sys_delay) | 308 | if (rdai->sys_delay) |
309 | cr |= DEL; | 309 | cr |= DEL; |
310 | if (rsnd_dai_is_play(rdai, io)) | 310 | if (rsnd_io_is_play(io)) |
311 | cr |= TRMD; | 311 | cr |= TRMD; |
312 | 312 | ||
313 | /* | 313 | /* |
@@ -401,7 +401,7 @@ static irqreturn_t rsnd_ssi_interrupt(int irq, void *data) | |||
401 | * directly as 32bit data | 401 | * directly as 32bit data |
402 | * see rsnd_ssi_init() | 402 | * see rsnd_ssi_init() |
403 | */ | 403 | */ |
404 | if (rsnd_dai_is_play(rdai, io)) | 404 | if (rsnd_io_is_play(io)) |
405 | rsnd_mod_write(mod, SSITDR, *buf); | 405 | rsnd_mod_write(mod, SSITDR, *buf); |
406 | else | 406 | else |
407 | *buf = rsnd_mod_read(mod, SSIRDR); | 407 | *buf = rsnd_mod_read(mod, SSIRDR); |