diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2012-02-03 03:52:38 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-02-03 06:55:39 -0500 |
commit | 95b0cf05976b7d0571e283b1fcd4c32095018cd6 (patch) | |
tree | 08ea0afff8de914c81d64d2d0d8ba8e1b9925c96 /sound/soc/sh/fsi.c | |
parent | 8c4152951cab90b52406afc72b62e9590bbe2d85 (diff) |
ASoC: fsi: modify fsi_pio_get_area() parameter and using position
This patch modify fsi_pio_get_area() parameter to use
struct fsi_stream, and used it on fsi_fifo_data_ctrl().
This is just prepare cleanup for DMAEngine support.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/sh/fsi.c')
-rw-r--r-- | sound/soc/sh/fsi.c | 43 |
1 files changed, 17 insertions, 26 deletions
diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c index 2e2663bb224c..c814d8a7cece 100644 --- a/sound/soc/sh/fsi.c +++ b/sound/soc/sh/fsi.c | |||
@@ -477,58 +477,46 @@ static void fsi_stream_quit(struct fsi_priv *fsi, int is_play) | |||
477 | * pio function | 477 | * pio function |
478 | */ | 478 | */ |
479 | 479 | ||
480 | static u8 *fsi_pio_get_area(struct fsi_priv *fsi, int stream) | 480 | static u8 *fsi_pio_get_area(struct fsi_priv *fsi, struct fsi_stream *io) |
481 | { | 481 | { |
482 | int is_play = fsi_stream_is_play(stream); | ||
483 | struct fsi_stream *io = fsi_stream_get(fsi, is_play); | ||
484 | struct snd_pcm_runtime *runtime = io->substream->runtime; | 482 | struct snd_pcm_runtime *runtime = io->substream->runtime; |
485 | 483 | ||
486 | return runtime->dma_area + | 484 | return runtime->dma_area + |
487 | samples_to_bytes(runtime, io->buff_sample_pos); | 485 | samples_to_bytes(runtime, io->buff_sample_pos); |
488 | } | 486 | } |
489 | 487 | ||
490 | static void fsi_pio_push16(struct fsi_priv *fsi, int num) | 488 | static void fsi_pio_push16(struct fsi_priv *fsi, u8 *_buf, int num) |
491 | { | 489 | { |
492 | u16 *start; | 490 | u16 *start = (u16 *)_buf; |
493 | int i; | 491 | int i; |
494 | 492 | ||
495 | start = (u16 *)fsi_pio_get_area(fsi, SNDRV_PCM_STREAM_PLAYBACK); | ||
496 | |||
497 | for (i = 0; i < num; i++) | 493 | for (i = 0; i < num; i++) |
498 | fsi_reg_write(fsi, DODT, ((u32)*(start + i) << 8)); | 494 | fsi_reg_write(fsi, DODT, ((u32)*(start + i) << 8)); |
499 | } | 495 | } |
500 | 496 | ||
501 | static void fsi_pio_pop16(struct fsi_priv *fsi, int num) | 497 | static void fsi_pio_pop16(struct fsi_priv *fsi, u8 *_buf, int num) |
502 | { | 498 | { |
503 | u16 *start; | 499 | u16 *start = (u16 *)_buf; |
504 | int i; | 500 | int i; |
505 | 501 | ||
506 | start = (u16 *)fsi_pio_get_area(fsi, SNDRV_PCM_STREAM_CAPTURE); | ||
507 | |||
508 | |||
509 | for (i = 0; i < num; i++) | 502 | for (i = 0; i < num; i++) |
510 | *(start + i) = (u16)(fsi_reg_read(fsi, DIDT) >> 8); | 503 | *(start + i) = (u16)(fsi_reg_read(fsi, DIDT) >> 8); |
511 | } | 504 | } |
512 | 505 | ||
513 | static void fsi_pio_push32(struct fsi_priv *fsi, int num) | 506 | static void fsi_pio_push32(struct fsi_priv *fsi, u8 *_buf, int num) |
514 | { | 507 | { |
515 | u32 *start; | 508 | u32 *start = (u32 *)_buf; |
516 | int i; | 509 | int i; |
517 | 510 | ||
518 | start = (u32 *)fsi_pio_get_area(fsi, SNDRV_PCM_STREAM_PLAYBACK); | ||
519 | |||
520 | |||
521 | for (i = 0; i < num; i++) | 511 | for (i = 0; i < num; i++) |
522 | fsi_reg_write(fsi, DODT, *(start + i)); | 512 | fsi_reg_write(fsi, DODT, *(start + i)); |
523 | } | 513 | } |
524 | 514 | ||
525 | static void fsi_pio_pop32(struct fsi_priv *fsi, int num) | 515 | static void fsi_pio_pop32(struct fsi_priv *fsi, u8 *_buf, int num) |
526 | { | 516 | { |
527 | u32 *start; | 517 | u32 *start = (u32 *)_buf; |
528 | int i; | 518 | int i; |
529 | 519 | ||
530 | start = (u32 *)fsi_pio_get_area(fsi, SNDRV_PCM_STREAM_CAPTURE); | ||
531 | |||
532 | for (i = 0; i < num; i++) | 520 | for (i = 0; i < num; i++) |
533 | *(start + i) = fsi_reg_read(fsi, DIDT); | 521 | *(start + i) = fsi_reg_read(fsi, DIDT); |
534 | } | 522 | } |
@@ -693,12 +681,13 @@ static void __fsi_port_clk_ctrl(struct fsi_priv *fsi, int is_play, int enable) | |||
693 | * ctrl function | 681 | * ctrl function |
694 | */ | 682 | */ |
695 | static int fsi_fifo_data_ctrl(struct fsi_priv *fsi, struct fsi_stream *io, | 683 | static int fsi_fifo_data_ctrl(struct fsi_priv *fsi, struct fsi_stream *io, |
696 | void (*run16)(struct fsi_priv *fsi, int size), | 684 | void (*run16)(struct fsi_priv *fsi, u8 *buf, int samples), |
697 | void (*run32)(struct fsi_priv *fsi, int size), | 685 | void (*run32)(struct fsi_priv *fsi, u8 *buf, int samples), |
698 | int samples) | 686 | int samples) |
699 | { | 687 | { |
700 | struct snd_pcm_runtime *runtime; | 688 | struct snd_pcm_runtime *runtime; |
701 | struct snd_pcm_substream *substream; | 689 | struct snd_pcm_substream *substream; |
690 | u8 *buf; | ||
702 | int over_period; | 691 | int over_period; |
703 | 692 | ||
704 | if (!fsi || | 693 | if (!fsi || |
@@ -723,12 +712,14 @@ static int fsi_fifo_data_ctrl(struct fsi_priv *fsi, struct fsi_stream *io, | |||
723 | io->buff_sample_pos = 0; | 712 | io->buff_sample_pos = 0; |
724 | } | 713 | } |
725 | 714 | ||
715 | buf = fsi_pio_get_area(fsi, io); | ||
716 | |||
726 | switch (io->sample_width) { | 717 | switch (io->sample_width) { |
727 | case 2: | 718 | case 2: |
728 | run16(fsi, samples); | 719 | run16(fsi, buf, samples); |
729 | break; | 720 | break; |
730 | case 4: | 721 | case 4: |
731 | run32(fsi, samples); | 722 | run32(fsi, buf, samples); |
732 | break; | 723 | break; |
733 | default: | 724 | default: |
734 | return -EINVAL; | 725 | return -EINVAL; |