diff options
author | Ravindra Lokhande <rlokhande@nvidia.com> | 2010-12-08 18:54:09 +0530 |
---|---|---|
committer | Niket Sirsi <nsirsi@nvidia.com> | 2010-12-20 16:31:56 -0800 |
commit | 1508f7aa5850b1ac02d9876eb5dac34356c86244 (patch) | |
tree | 87f37b92c645a3114e76dee5af952f82f1819fac /sound/soc/tegra/tegra_pcm_rpc.c | |
parent | 75f8537e1c8c8a0dc5e694d6baf1a09ecdd15ffe (diff) |
[tegra ALSA] set mode and i/o device.tegra-10.9.8
Set mode and input, output device for newly
created device 1.
Needed for bug 738770
Change-Id: I01ef4efb018a32cca8b1a0ff1e63f2a8de63dbfe
Reviewed-on: http://git-master/r/12314
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Tested-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
Tested-by: Ravindra Lokhande <rlokhande@nvidia.com>
Diffstat (limited to 'sound/soc/tegra/tegra_pcm_rpc.c')
-rw-r--r-- | sound/soc/tegra/tegra_pcm_rpc.c | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/sound/soc/tegra/tegra_pcm_rpc.c b/sound/soc/tegra/tegra_pcm_rpc.c index f6cd0861a698..bc532c4c6dfa 100644 --- a/sound/soc/tegra/tegra_pcm_rpc.c +++ b/sound/soc/tegra/tegra_pcm_rpc.c @@ -23,6 +23,7 @@ #include "tegra_transport.h" struct tegra_audio_data* tegra_snd_cx[2]; +struct tegra_audio_state_t tegra_audio_state; static const struct snd_pcm_hardware tegra_pcm_hardware = { .info = SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_PAUSE |\ @@ -453,6 +454,7 @@ static int pcm_common_close(struct snd_pcm_substream *substream) struct tegra_audio_data *ptscx = tegra_snd_cx[pcm->device]; NvAudioFxMessage message; NvError e; + NvAudioFxIoDevice io_device; if (!prtd) snd_printk(KERN_ERR "pcm_close called with prtd = NULL\n"); @@ -490,15 +492,66 @@ static int pcm_common_close(struct snd_pcm_substream *substream) } if (prtd->stdoutpath) { + if (pcm->device == I2S2) { + io_device = NvAudioFxIoDevice_Bluetooth_Sco; + ptscx->xrt_fxn.SetProperty(ptscx->mi2s1, + NvAudioFxIoProperty_OutputDisable, + sizeof(NvAudioFxIoDevice), + &io_device); + } tegra_audiofx_destroy_output(prtd->stdoutpath); kfree(prtd->stdoutpath); } if (prtd->stdinpath) { + if (pcm->device == I2S2) { + io_device = NvAudioFxIoDevice_Bluetooth_Sco; + ptscx->xrt_fxn.SetProperty(ptscx->mi2s1, + NvAudioFxIoProperty_InputDisable, + sizeof(NvAudioFxIoDevice), + &io_device); + } tegra_audiofx_destroy_input(prtd->stdinpath); kfree(prtd->stdinpath); } + if (pcm->device == I2S2) { + ptscx->xrt_fxn.GetProperty(ptscx->mi2s1, + NvAudioFxIoProperty_OutputSelect, + sizeof(NvAudioFxIoDevice), + &io_device); + if (io_device & NvAudioFxIoDevice_Bluetooth_Sco) { + ptscx->xrt_fxn.GetProperty(ptscx->mi2s1, + NvAudioFxIoProperty_InputSelect, + sizeof(NvAudioFxIoDevice), + &io_device); + if (io_device & NvAudioFxIoDevice_Bluetooth_Sco) { + mutex_lock(&tegra_audio_state.mutex_lock); + tegra_audio_state.devices_available &= + ~(NvAudioFxIoDevice_Bluetooth_Sco); + + ptscx->xrt_fxn.SetProperty(ptscx->mi2s1, + NvAudioFxIoProperty_OutputAvailable, + sizeof(NvAudioFxIoDevice), + &tegra_audio_state.devices_available); + + ptscx->xrt_fxn.SetProperty(ptscx->mi2s1, + NvAudioFxIoProperty_InputAvailable, + sizeof(NvAudioFxIoDevice), + &tegra_audio_state.devices_available); + + tegra_audio_state.audio_mode &= + ~(NvAudioFxMode_Bluetooth_Sco); + ptscx->xrt_fxn.SetProperty( + (NvAudioFxObjectHandle)ptscx->mixer_handle, + NvAudioFxMixerProperty_ModeSelect, + sizeof(NvAudioFxMode), + &tegra_audio_state.audio_mode); + mutex_unlock(&tegra_audio_state.mutex_lock); + } + } + } + if (prtd) kfree(prtd); @@ -647,6 +700,48 @@ static int tegra_pcm_open(struct snd_pcm_substream *substream) goto fail; } } + + if (pcm->device == I2S2) { + NvAudioFxIoDevice io_device; + + mutex_lock(&tegra_audio_state.mutex_lock); + tegra_audio_state.audio_mode |= NvAudioFxMode_Bluetooth_Sco; + tegra_audio_state.devices_available |= + NvAudioFxIoDevice_Bluetooth_Sco; + mutex_unlock(&tegra_audio_state.mutex_lock); + + ptscx->xrt_fxn.SetProperty( + (NvAudioFxObjectHandle)ptscx->mixer_handle, + NvAudioFxMixerProperty_ModeSelect, + sizeof(NvAudioFxMode), + &tegra_audio_state.audio_mode); + + ptscx->xrt_fxn.SetProperty(ptscx->mi2s1, + NvAudioFxIoProperty_OutputAvailable, + sizeof(NvAudioFxIoDevice), + &tegra_audio_state.devices_available); + + ptscx->xrt_fxn.SetProperty(ptscx->mi2s1, + NvAudioFxIoProperty_InputAvailable, + sizeof(NvAudioFxIoDevice), + &tegra_audio_state.devices_available); + + io_device = NvAudioFxIoDevice_Bluetooth_Sco; + + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { + ptscx->xrt_fxn.SetProperty(ptscx->mi2s1, + NvAudioFxIoProperty_OutputEnable, + sizeof(NvAudioFxIoDevice), + &io_device); + } + else { + ptscx->xrt_fxn.SetProperty(ptscx->mi2s1, + NvAudioFxIoProperty_InputEnable, + sizeof(NvAudioFxIoDevice), + &io_device); + } + } + return ret; fail: snd_printk(KERN_ERR "tegra_pcm_open - failed \n"); @@ -891,6 +986,10 @@ EXPORT_SYMBOL_GPL(tegra_soc_platform); static int __init tegra_soc_platform_init(void) { + tegra_audio_state.devices_available = NvAudioFxIoDevice_Default; + tegra_audio_state.audio_mode = NvAudioFxMode_Normal; + mutex_init(&tegra_audio_state.mutex_lock); + return snd_soc_register_platform(&tegra_soc_platform); } |