diff options
author | Rebecca Schultz Zavin <rebecca@android.com> | 2011-01-28 21:51:32 -0800 |
---|---|---|
committer | Rebecca Schultz Zavin <rebecca@android.com> | 2011-01-28 21:51:32 -0800 |
commit | 8f47f22d81d514a3c947d161b2fcd4a51351a5da (patch) | |
tree | 9c9d7816155fb0cc0931bd09a247c477abe0b18e | |
parent | 1d5631d33ec511a2bbe7487357afa7ba13cc2fd6 (diff) | |
parent | a0bcb8eabafef53e13050042d4b583f088535b0f (diff) |
Merge remote branch 'tegra/linux-tegra-2.6.36' into android-tegra-2.6.36
-rw-r--r-- | arch/arm/mach-tegra/tegra_i2s_audio.c | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/arch/arm/mach-tegra/tegra_i2s_audio.c b/arch/arm/mach-tegra/tegra_i2s_audio.c index 45e4cc5ee6f4..1bae833f4f2a 100644 --- a/arch/arm/mach-tegra/tegra_i2s_audio.c +++ b/arch/arm/mach-tegra/tegra_i2s_audio.c @@ -611,15 +611,15 @@ static int i2s_configure(struct platform_device *pdev) static int init_stream_buffer(struct audio_stream *, int); -static int setup_dma(struct audio_driver_state *); -static void tear_down_dma(struct audio_driver_state *); +static int setup_dma(struct audio_driver_state *, int); +static void tear_down_dma(struct audio_driver_state *, int); static void stop_dma_playback(struct audio_stream *); static int start_dma_recording(struct audio_stream *, int); static void stop_dma_recording(struct audio_stream *); struct sound_ops { - int (*setup)(struct audio_driver_state *); - void (*tear_down)(struct audio_driver_state *); + int (*setup)(struct audio_driver_state *, int); + void (*tear_down)(struct audio_driver_state *, int); void (*stop_playback)(struct audio_stream *); int (*start_recording)(struct audio_stream *, int); void (*stop_recording)(struct audio_stream *); @@ -716,12 +716,12 @@ static void setup_dma_tx_request(struct tegra_dma_req *req, static void setup_dma_rx_request(struct tegra_dma_req *req, struct audio_stream *ais); -static int setup_dma(struct audio_driver_state *ads) +static int setup_dma(struct audio_driver_state *ads, int mask) { int rc, i; pr_info("%s\n", __func__); - if ((ads->pdata->mask & TEGRA_AUDIO_ENABLE_TX)) { + if (mask & TEGRA_AUDIO_ENABLE_TX) { /* setup audio playback */ for (i = 0; i < ads->out.num_bufs; i++) { ads->out.buf_phy[i] = dma_map_single(&ads->pdev->dev, @@ -742,7 +742,7 @@ static int setup_dma(struct audio_driver_state *ads) } } - if ((ads->pdata->mask & TEGRA_AUDIO_ENABLE_RX)) { + if (mask & TEGRA_AUDIO_ENABLE_RX) { /* setup audio recording */ for (i = 0; i < ads->in.num_bufs; i++) { ads->in.buf_phy[i] = dma_map_single(&ads->pdev->dev, @@ -766,7 +766,7 @@ static int setup_dma(struct audio_driver_state *ads) return 0; fail_rx: - if (ads->pdata->mask & TEGRA_AUDIO_ENABLE_RX) { + if (mask & TEGRA_AUDIO_ENABLE_RX) { for (i = 0; i < ads->in.num_bufs; i++) { dma_unmap_single(&ads->pdev->dev, ads->in.buf_phy[i], 1 << PCM_BUFFER_MAX_SIZE_ORDER, @@ -777,7 +777,7 @@ fail_rx: ads->in.dma_chan = 0; } fail_tx: - if (ads->pdata->mask & TEGRA_AUDIO_ENABLE_TX) { + if (mask & TEGRA_AUDIO_ENABLE_TX) { for (i = 0; i < ads->out.num_bufs; i++) { dma_unmap_single(&ads->pdev->dev, ads->out.buf_phy[i], 1 << PCM_BUFFER_MAX_SIZE_ORDER, @@ -791,12 +791,12 @@ fail_tx: return rc; } -static void tear_down_dma(struct audio_driver_state *ads) +static void tear_down_dma(struct audio_driver_state *ads, int mask) { int i; pr_info("%s\n", __func__); - if (ads->pdata->mask & TEGRA_AUDIO_ENABLE_TX) { + if (mask & TEGRA_AUDIO_ENABLE_TX) { tegra_dma_free_channel(ads->out.dma_chan); for (i = 0; i < ads->out.num_bufs; i++) { dma_unmap_single(&ads->pdev->dev, ads->out.buf_phy[i], @@ -807,7 +807,7 @@ static void tear_down_dma(struct audio_driver_state *ads) } ads->out.dma_chan = NULL; - if (ads->pdata->mask & TEGRA_AUDIO_ENABLE_RX) { + if (mask & TEGRA_AUDIO_ENABLE_RX) { tegra_dma_free_channel(ads->in.dma_chan); for (i = 0; i < ads->in.num_bufs; i++) { dma_unmap_single(&ads->pdev->dev, ads->in.buf_phy[i], @@ -1122,7 +1122,9 @@ static long tegra_audio_out_ioctl(struct file *file, if (rc < 0) break; aos->num_bufs = num; - sound_ops->setup(ads); + sound_ops->tear_down(ads, TEGRA_AUDIO_ENABLE_TX); + sound_ops->setup(ads, TEGRA_AUDIO_ENABLE_TX); + pr_debug("%s: num buf set to %d\n", __func__, num); } break; case TEGRA_AUDIO_OUT_GET_NUM_BUFS: @@ -1187,9 +1189,9 @@ static long tegra_audio_ioctl(struct file *file, rc = -EBUSY; goto done; } - sound_ops->tear_down(ads); + sound_ops->tear_down(ads, ads->pdata->mask); i2s_configure(ads->pdev); - sound_ops->setup(ads); + sound_ops->setup(ads, ads->pdata->mask); } done: @@ -1277,7 +1279,8 @@ static long tegra_audio_in_ioctl(struct file *file, if (rc < 0) break; ais->num_bufs = num; - sound_ops->setup(ads); + sound_ops->tear_down(ads, TEGRA_AUDIO_ENABLE_RX); + sound_ops->setup(ads, TEGRA_AUDIO_ENABLE_RX); } break; case TEGRA_AUDIO_IN_GET_NUM_BUFS: @@ -1897,7 +1900,7 @@ static int tegra_audio_probe(struct platform_device *pdev) if (rc < 0) return rc; - sound_ops->setup(state); + sound_ops->setup(state, state->pdata->mask); rc = device_create_file(&pdev->dev, &dev_attr_dma_toggle); if (rc < 0) { |