diff options
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/tegra/tegra_i2s.c | 129 | ||||
-rw-r--r-- | sound/soc/tegra/tegra_pcm.c | 9 | ||||
-rw-r--r-- | sound/soc/tegra/tegra_soc.h | 10 | ||||
-rw-r--r-- | sound/soc/tegra/tegra_soc_wm8903.c | 61 | ||||
-rw-r--r-- | sound/soc/tegra/tegra_spdif.c | 110 | ||||
-rw-r--r-- | sound/soc/tegra/tegra_wired_jack.c | 10 |
6 files changed, 144 insertions, 185 deletions
diff --git a/sound/soc/tegra/tegra_i2s.c b/sound/soc/tegra/tegra_i2s.c index 6bde5f719cf0..840a2138533c 100644 --- a/sound/soc/tegra/tegra_i2s.c +++ b/sound/soc/tegra/tegra_i2s.c @@ -29,6 +29,7 @@ struct tegra_i2s_info { unsigned int bit_format; bool i2s_master; int ref_count; + aud_dev_info i2sdev_info; struct das_regs_cache das_regs; }; @@ -38,13 +39,14 @@ void free_i2s_dma_request(struct snd_pcm_substream *substream) { struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; + struct tegra_i2s_info *info = cpu_dai->private_data; - int fifo_mode = AUDIO_RX_MODE; + info->i2sdev_info.fifo_mode = AUDIO_RX_MODE; if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) - fifo_mode = AUDIO_TX_MODE; + info->i2sdev_info.fifo_mode = AUDIO_TX_MODE; - i2s_free_dma_requestor(cpu_dai->id, fifo_mode); + am_free_dma_requestor(&info->i2sdev_info); } void setup_i2s_dma_request(struct snd_pcm_substream *substream, @@ -56,17 +58,17 @@ void setup_i2s_dma_request(struct snd_pcm_substream *substream, struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; struct tegra_i2s_info *info = cpu_dai->private_data; - int fifo_mode = AUDIO_RX_MODE; + info->i2sdev_info.fifo_mode = AUDIO_RX_MODE; if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) - fifo_mode = AUDIO_TX_MODE; + info->i2sdev_info.fifo_mode = AUDIO_TX_MODE; - req->req_sel = i2s_get_dma_requestor(cpu_dai->id, fifo_mode); + req->req_sel = am_get_dma_requestor(&info->i2sdev_info); if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { req->to_memory = false; req->dest_addr = - i2s_get_fifo_phy_base(cpu_dai->id, fifo_mode); + am_get_fifo_phy_base(&info->i2sdev_info); req->dest_wrap = 4; req->source_wrap = 0; if (info->bit_format == AUDIO_FRAME_FORMAT_DSP) @@ -77,7 +79,7 @@ void setup_i2s_dma_request(struct snd_pcm_substream *substream, } else { req->to_memory = true; req->source_addr = - i2s_get_fifo_phy_base(cpu_dai->id, fifo_mode); + am_get_fifo_phy_base(&info->i2sdev_info); req->dest_wrap = 0; req->source_wrap = 4; if (info->bit_format == AUDIO_FRAME_FORMAT_DSP) @@ -93,44 +95,40 @@ void setup_i2s_dma_request(struct snd_pcm_substream *substream, return; } -void set_i2s_fifo_attention(struct snd_pcm_substream *substream, - int buffersize) -{ - struct snd_soc_pcm_runtime *rtd = substream->private_data; - struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; - - i2s_set_fifo_attention(cpu_dai->id, - buffersize, - (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)? - AUDIO_TX_MODE: AUDIO_RX_MODE); -} - /* playback */ static inline void start_i2s_playback(struct snd_soc_dai *cpu_dai) { - i2s_fifo_enable(cpu_dai->id, AUDIO_TX_MODE, 1); + struct tegra_i2s_info *info = cpu_dai->private_data; + + info->i2sdev_info.fifo_mode = AUDIO_TX_MODE; + am_set_stream_state(&info->i2sdev_info, true); } static inline void stop_i2s_playback(struct snd_soc_dai *cpu_dai) { - i2s_set_fifo_irq_on_err(cpu_dai->id, AUDIO_TX_MODE, 0); - i2s_set_fifo_irq_on_qe(cpu_dai->id, AUDIO_TX_MODE, 0); - i2s_fifo_enable(cpu_dai->id, AUDIO_TX_MODE, 0); - while (i2s_get_status(cpu_dai->id, AUDIO_TX_MODE)); + struct tegra_i2s_info *info = cpu_dai->private_data; + + info->i2sdev_info.fifo_mode = AUDIO_TX_MODE; + am_set_stream_state(&info->i2sdev_info, false); + while (am_get_status(&info->i2sdev_info)); } /* recording */ static inline void start_i2s_capture(struct snd_soc_dai *cpu_dai) { - i2s_fifo_enable(cpu_dai->id, AUDIO_RX_MODE, 1); + struct tegra_i2s_info *info = cpu_dai->private_data; + + info->i2sdev_info.fifo_mode = AUDIO_RX_MODE; + am_set_stream_state(&info->i2sdev_info, true); } static inline void stop_i2s_capture(struct snd_soc_dai *cpu_dai) { - i2s_set_fifo_irq_on_err(cpu_dai->id, AUDIO_RX_MODE, 0); - i2s_set_fifo_irq_on_qe(cpu_dai->id, AUDIO_RX_MODE, 0); - i2s_fifo_enable(cpu_dai->id, AUDIO_RX_MODE, 0); - while (i2s_get_status(cpu_dai->id, AUDIO_RX_MODE)); + struct tegra_i2s_info *info = cpu_dai->private_data; + + info->i2sdev_info.fifo_mode = AUDIO_RX_MODE; + am_set_stream_state(&info->i2sdev_info, false); + while (am_get_status(&info->i2sdev_info)); } @@ -138,8 +136,14 @@ static int tegra_i2s_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) { - unsigned int i2s_id = dai->id; int val; + am_stream_format_info fmt; + struct tegra_i2s_info *info = dai->private_data; + + info->i2sdev_info.fifo_mode = AUDIO_RX_MODE; + + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) + info->i2sdev_info.fifo_mode = AUDIO_TX_MODE; switch (params_format(params)) { case SNDRV_PCM_FORMAT_S16_LE: @@ -154,12 +158,8 @@ static int tegra_i2s_hw_params(struct snd_pcm_substream *substream, default: return -EINVAL; } - i2s_set_bit_size(i2s_id, val); - if (tegra_i2sloopback_func == TEGRA_INT_I2SLOOPBACK_ON) - i2s_set_loopback(i2s_id,1); - else - i2s_set_loopback(i2s_id,0); + fmt.bitsize = val; switch (params_rate(params)) { case 8000: @@ -174,7 +174,7 @@ static int tegra_i2s_hw_params(struct snd_pcm_substream *substream, return -EINVAL; } - i2s_set_samplerate(i2s_id, val); + fmt.samplerate = val; switch (params_channels(params)) { case 1: val = AUDIO_CHANNEL_1; break; @@ -189,7 +189,10 @@ static int tegra_i2s_hw_params(struct snd_pcm_substream *substream, return -EINVAL; } - i2s_set_channels(i2s_id, val); + fmt.channels = val; + fmt.buffersize = params_period_bytes(params); + + am_set_stream_format(&info->i2sdev_info, &fmt); return 0; } @@ -198,9 +201,9 @@ static int tegra_i2s_hw_params(struct snd_pcm_substream *substream, static int tegra_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt) { - struct tegra_i2s_info *info = cpu_dai->private_data; - unsigned int i2s_id = cpu_dai->id; int val1, val2; + am_dev_format_info devfmt; + struct tegra_i2s_info *info = cpu_dai->private_data; switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { case SND_SOC_DAIFMT_CBS_CFS: @@ -216,7 +219,8 @@ static int tegra_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai, default: return -EINVAL; } - i2s_set_master(i2s_id, info->i2s_master); + + devfmt.mastermode = info->i2s_master; val2 = AUDIO_LRCK_LEFT_LOW; @@ -242,9 +246,12 @@ static int tegra_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai, return -EINVAL; } - i2s_set_bit_format(i2s_id, val1); - i2s_set_left_right_control_polarity(i2s_id, val2); + devfmt.audiomode = val1; + devfmt.polarity = val2; + devfmt.loopmode = + (tegra_i2sloopback_func == TEGRA_INT_I2SLOOPBACK_ON)? 1 : 0; + am_set_device_format(&info->i2sdev_info, &devfmt); return 0; } @@ -287,18 +294,21 @@ static int i2s_configure(struct tegra_i2s_info *info ) { struct platform_device *pdev = info->pdev; struct tegra_audio_platform_data *pdata = pdev->dev.platform_data; - struct tegra_i2s_property i2sprop; - memset(&i2sprop, 0, sizeof(i2sprop)); + am_stream_format_info strm_fmt; + am_dev_format_info dev_fmt; + + memset(&dev_fmt, 0, sizeof(dev_fmt)); + dev_fmt.mastermode = pdata->i2s_master; + dev_fmt.audiomode = pdata->mode; + dev_fmt.clkrate = pdata->dev_clk_rate; + dev_fmt.fifofmt = pdata->fifo_fmt; - i2sprop.master_mode = pdata->i2s_master; - i2sprop.audio_mode = pdata->mode; - i2sprop.bit_size = pdata->bit_size; - i2sprop.clk_rate = pdata->dev_clk_rate; - i2sprop.sample_rate = pdata->i2s_master_clk; - i2sprop.fifo_fmt = pdata->fifo_fmt; + memset(&strm_fmt, 0, sizeof(strm_fmt)); + strm_fmt.bitsize = pdata->bit_size; + strm_fmt.samplerate = pdata->i2s_master_clk; - i2s_init(pdev->id, &i2sprop); + am_device_init(&info->i2sdev_info, (void*)&dev_fmt, (void*)&strm_fmt); return 0; } @@ -308,7 +318,7 @@ int tegra_i2s_suspend(struct snd_soc_dai *cpu_dai) { struct tegra_i2s_info *info = cpu_dai->private_data; - i2s_suspend(cpu_dai->id); + am_suspend(&info->i2sdev_info); tegra_das_get_all_regs(&info->das_regs); @@ -321,12 +331,12 @@ int tegra_i2s_resume(struct snd_soc_dai *cpu_dai) tegra_das_set_all_regs(&info->das_regs); - i2s_resume(cpu_dai->id); + am_resume(&info->i2sdev_info); tegra_jack_resume(); /* disabled clock as it is being enabled back on startup */ - i2s_clock_disable(cpu_dai->id); + am_clock_disable(&info->i2sdev_info); return 0; } @@ -341,7 +351,7 @@ static int tegra_i2s_startup(struct snd_pcm_substream *substream, struct tegra_i2s_info *info = dai->private_data; if (!info->ref_count) - i2s_clock_enable(dai->id); + am_clock_enable(&info->i2sdev_info); info->ref_count++; return 0; @@ -356,7 +366,7 @@ static void tegra_i2s_shutdown(struct snd_pcm_substream *substream, info->ref_count--; if (!info->ref_count) - i2s_clock_disable(dai->id); + am_clock_disable(&info->i2sdev_info); return; } @@ -426,6 +436,9 @@ static int tegra_i2s_driver_probe(struct platform_device *pdev) info->pdata->driver_data = info; BUG_ON(!info->pdata); + info->i2sdev_info.dev_type = AUDIO_I2S_DEVICE; + info->i2sdev_info.dev_id = pdev->id; + err = i2s_configure(info); if (err) { goto fail_clock; @@ -447,7 +460,7 @@ static int tegra_i2s_driver_probe(struct platform_device *pdev) return 0; fail_clock: - i2s_close(pdev->id); + am_device_deinit(&info->i2sdev_info); kfree(info); return err; } diff --git a/sound/soc/tegra/tegra_pcm.c b/sound/soc/tegra/tegra_pcm.c index d5601b2b6f4f..b531841cbc7c 100644 --- a/sound/soc/tegra/tegra_pcm.c +++ b/sound/soc/tegra/tegra_pcm.c @@ -97,16 +97,7 @@ static void dma_complete_callback (struct tegra_dma_req *req) static int tegra_pcm_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) { - struct snd_soc_pcm_runtime *rtd = substream->private_data; - struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; - int buffersize = params_period_bytes(params); - snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer); - - if (strcmp(cpu_dai->name, "tegra-spdif") == 0) - set_spdif_fifo_attention(substream, buffersize); - else - set_i2s_fifo_attention(substream, buffersize); return 0; } diff --git a/sound/soc/tegra/tegra_soc.h b/sound/soc/tegra/tegra_soc.h index 4b839e33bf0e..361cbc79c3ee 100644 --- a/sound/soc/tegra/tegra_soc.h +++ b/sound/soc/tegra/tegra_soc.h @@ -39,9 +39,7 @@ #include <linux/tegra_audio.h> #include <linux/regulator/consumer.h> #include <mach/iomap.h> -#include <mach/spdif.h> -#include <mach/tegra_i2s.h> -#include <mach/spdif.h> +#include <mach/audio_manager.h> #include <mach/irqs.h> #include <mach/pinmux.h> #include <mach/audio.h> @@ -122,20 +120,16 @@ int tegra_jack_init(struct snd_soc_codec *codec); void tegra_jack_exit(void); void tegra_jack_resume(void); void tegra_switch_set_state(int state); -void speaker_settings(struct snd_soc_codec *codec, int value); void setup_i2s_dma_request(struct snd_pcm_substream *substream, struct tegra_dma_req *req, void (*dma_callback)(struct tegra_dma_req *req), void *dma_data); void free_i2s_dma_request(struct snd_pcm_substream *substream); -void set_i2s_fifo_attention(struct snd_pcm_substream *substream, - int buffersize); + void setup_spdif_dma_request(struct snd_pcm_substream *substream, struct tegra_dma_req *req, void (*dma_callback)(struct tegra_dma_req *req), void *dma_data); void free_spdif_dma_request(struct snd_pcm_substream *substream); -void set_spdif_fifo_attention(struct snd_pcm_substream *substream, - int buffersize); #endif diff --git a/sound/soc/tegra/tegra_soc_wm8903.c b/sound/soc/tegra/tegra_soc_wm8903.c index dcc48cdbc64f..c73ab053b8b1 100644 --- a/sound/soc/tegra/tegra_soc_wm8903.c +++ b/sound/soc/tegra/tegra_soc_wm8903.c @@ -328,62 +328,6 @@ static struct snd_soc_ops tegra_spdif_ops = { .hw_params = tegra_spdif_hw_params, }; -void speaker_settings(struct snd_soc_codec *codec, int value) -{ - int CtrlReg = 0; - - /* Set Spkr */ - CtrlReg = snd_soc_read(codec, WM8903_ANALOGUE_SPK_MIX_LEFT_0); - CtrlReg &= ~WM8903_DACL_TO_MIXSPKL_MASK; - CtrlReg |= (value << WM8903_DACL_TO_MIXSPKL_SHIFT); - - snd_soc_write(codec, WM8903_ANALOGUE_SPK_MIX_LEFT_0, CtrlReg); - - - CtrlReg = snd_soc_read(codec, WM8903_ANALOGUE_SPK_MIX_RIGHT_0); - CtrlReg &= ~WM8903_DACR_TO_MIXSPKR_MASK; - CtrlReg |= (value << WM8903_DACR_TO_MIXSPKR_SHIFT); - - snd_soc_write(codec, WM8903_ANALOGUE_SPK_MIX_RIGHT_0, CtrlReg); - - CtrlReg = snd_soc_read(codec, WM8903_POWER_MANAGEMENT_4); - CtrlReg = SET_REG_VAL(CtrlReg, - WM8903_MIXSPKL_ENA_WIDTH, - WM8903_MIXSPKL_ENA_SHIFT, value); - CtrlReg = SET_REG_VAL(CtrlReg, - WM8903_MIXSPKR_ENA_WIDTH, - WM8903_MIXSPKR_ENA_SHIFT, value); - - snd_soc_write(codec, WM8903_POWER_MANAGEMENT_4, CtrlReg); - - CtrlReg = snd_soc_read(codec, WM8903_ANALOGUE_OUT3_LEFT); - CtrlReg = SET_REG_VAL(CtrlReg, 1, 8, ~value); - snd_soc_write(codec, WM8903_ANALOGUE_OUT3_LEFT, CtrlReg); - - CtrlReg = snd_soc_read(codec, WM8903_ANALOGUE_OUT3_RIGHT); - CtrlReg = SET_REG_VAL(CtrlReg, 1, 8, ~value); - snd_soc_write(codec, WM8903_ANALOGUE_OUT3_RIGHT, CtrlReg); - - CtrlReg = snd_soc_read(codec, WM8903_POWER_MANAGEMENT_5); - CtrlReg &= ~WM8903_SPKL_ENA_MASK; - CtrlReg |= (value << WM8903_SPKL_ENA_SHIFT); - CtrlReg &= ~WM8903_SPKR_ENA_MASK; - CtrlReg |= (value << WM8903_SPKR_ENA_SHIFT); - - - snd_soc_write(codec, WM8903_POWER_MANAGEMENT_5, CtrlReg); - - - CtrlReg = snd_soc_read(codec, WM8903_GPIO_CONTROL_3); - - if (value) - CtrlReg = 0x33; - else - CtrlReg = 0; - - snd_soc_write(codec, WM8903_GPIO_CONTROL_3, CtrlReg); -} - void tegra_ext_control(struct snd_soc_codec *codec, int new_con) { struct tegra_audio_data* audio_data = codec->socdev->codec_data; @@ -426,11 +370,6 @@ void tegra_ext_control(struct snd_soc_codec *codec, int new_con) audio_data->codec_con = new_con; - /* using this function until pin/widget works*/ - if (new_con & TEGRA_SPK) - speaker_settings(codec, 1); - else - speaker_settings(codec, 0); /* signal a DAPM event */ snd_soc_dapm_sync(codec); diff --git a/sound/soc/tegra/tegra_spdif.c b/sound/soc/tegra/tegra_spdif.c index dff38ffe0b72..82cd5d88b15d 100644 --- a/sound/soc/tegra/tegra_spdif.c +++ b/sound/soc/tegra/tegra_spdif.c @@ -19,6 +19,7 @@ */ #include "tegra_soc.h" +#include <mach/spdif.h> /* spdif controller */ struct tegra_spdif_info { @@ -26,16 +27,21 @@ struct tegra_spdif_info { struct tegra_audio_platform_data *pdata; unsigned long spdif_phys; unsigned long spdif_base; + aud_dev_info spdev_info; }; void free_spdif_dma_request(struct snd_pcm_substream *substream) { - int fifo_mode = AUDIO_RX_MODE; + struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; + struct tegra_spdif_info *info = cpu_dai->private_data; + + info->spdev_info.fifo_mode = AUDIO_RX_MODE; if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) - fifo_mode = AUDIO_TX_MODE; + info->spdev_info.fifo_mode = AUDIO_TX_MODE; - spdif_free_dma_requestor(fifo_mode); + am_free_dma_requestor(&info->spdev_info); } void setup_spdif_dma_request(struct snd_pcm_substream *substream, @@ -47,23 +53,21 @@ void setup_spdif_dma_request(struct snd_pcm_substream *substream, struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; struct tegra_spdif_info *info = cpu_dai->private_data; - int fifo_mode = AUDIO_RX_MODE; + info->spdev_info.fifo_mode = AUDIO_RX_MODE; if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) - fifo_mode = AUDIO_TX_MODE; + info->spdev_info.fifo_mode = AUDIO_TX_MODE; if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { req->to_memory = false; - req->dest_addr = spdif_get_fifo_phy_base(info->spdif_phys, - fifo_mode); + req->dest_addr = am_get_fifo_phy_base(&info->spdev_info); req->dest_wrap = 4; req->source_wrap = 0; req->dest_bus_width = 32; req->source_bus_width = 32; } else { req->to_memory = true; - req->dest_addr = spdif_get_fifo_phy_base(info->spdif_phys, - fifo_mode); + req->dest_addr = am_get_fifo_phy_base(&info->spdev_info); req->dest_wrap = 0; req->source_wrap = 4; req->dest_bus_width = 32; @@ -71,35 +75,29 @@ void setup_spdif_dma_request(struct snd_pcm_substream *substream, } req->complete = dma_callback; req->dev = dma_data; - req->req_sel = spdif_get_dma_requestor(fifo_mode); + req->req_sel = am_get_dma_requestor(&info->spdev_info); return; } -void set_spdif_fifo_attention(struct snd_pcm_substream *substream, - int buffersize) -{ - spdif_set_fifo_attention( - buffersize, - (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)? - AUDIO_TX_MODE: AUDIO_RX_MODE); -} - /* playback */ static inline void start_spdif_playback(struct snd_soc_dai *dai) { struct tegra_spdif_info *info = dai->private_data; - spdif_fifo_enable(info->spdif_base, AUDIO_TX_MODE, true); + info->spdev_info.fifo_mode = AUDIO_TX_MODE; + + am_set_stream_state(&info->spdev_info, true); } static inline void stop_spdif_playback(struct snd_soc_dai *dai) { struct tegra_spdif_info *info = dai->private_data; - spdif_fifo_enable(info->spdif_base, AUDIO_TX_MODE, false); - while (spdif_get_status(info->spdif_base, AUDIO_TX_MODE) & - SPDIF_STATUS_0_TX_BSY); + info->spdev_info.fifo_mode = AUDIO_TX_MODE; + + am_set_stream_state(&info->spdev_info, false); + while (am_get_status(&info->spdev_info) & SPDIF_STATUS_0_TX_BSY); } /* capture */ @@ -107,28 +105,31 @@ static inline void start_spdif_capture(struct snd_soc_dai *dai) { struct tegra_spdif_info *info = dai->private_data; - spdif_fifo_enable(info->spdif_base, AUDIO_RX_MODE, true); + info->spdev_info.fifo_mode = AUDIO_RX_MODE; + am_set_stream_state(&info->spdev_info, true); } static inline void stop_spdif_capture(struct snd_soc_dai *dai) { struct tegra_spdif_info *info = dai->private_data; - spdif_fifo_enable(info->spdif_base, AUDIO_RX_MODE, false); - while (spdif_get_status(info->spdif_base, AUDIO_RX_MODE) & - SPDIF_STATUS_0_RX_BSY); + info->spdev_info.fifo_mode = AUDIO_RX_MODE; + am_set_stream_state(&info->spdev_info, false); + while (am_get_status(&info->spdev_info) & SPDIF_STATUS_0_RX_BSY); } static int tegra_spdif_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) { - struct tegra_spdif_info *info = dai->private_data; int val; - int fifo_mode = AUDIO_RX_MODE; + am_stream_format_info fmt; + struct tegra_spdif_info *info = dai->private_data; + + info->spdev_info.fifo_mode = AUDIO_RX_MODE; if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) - fifo_mode = AUDIO_TX_MODE; + info->spdev_info.fifo_mode = AUDIO_TX_MODE; switch (params_format(params)) { case SNDRV_PCM_FORMAT_S16_LE: @@ -144,8 +145,7 @@ static int tegra_spdif_hw_params(struct snd_pcm_substream *substream, return -EINVAL; } - spdif_set_bit_mode(info->spdif_base, val); - spdif_set_fifo_packed(info->spdif_base, 1); + fmt.bitsize = val; switch (params_rate(params)) { case 8000: @@ -160,7 +160,10 @@ static int tegra_spdif_hw_params(struct snd_pcm_substream *substream, return -EINVAL; } - spdif_set_sample_rate(fifo_mode, val); + fmt.channels = val; + fmt.buffersize = params_period_bytes(params); + + am_set_stream_format(&info->spdev_info, &fmt); return 0; } @@ -210,16 +213,18 @@ static int tegra_spdif_trigger(struct snd_pcm_substream *substream, int cmd, #ifdef CONFIG_PM int tegra_spdif_suspend(struct snd_soc_dai *cpu_dai) { - spdif_suspend(); + struct tegra_spdif_info *info = cpu_dai->private_data; + am_suspend(&info->spdev_info); return 0; } int tegra_spdif_resume(struct snd_soc_dai *cpu_dai) { - spdif_resume(); + struct tegra_spdif_info *info = cpu_dai->private_data; + am_resume(&info->spdev_info); /* disabled clock as startup code enable the clock */ - spdif_clock_disable(AUDIO_TX_MODE); + am_clock_disable(&info->spdev_info); return 0; } @@ -231,12 +236,14 @@ int tegra_spdif_resume(struct snd_soc_dai *cpu_dai) static int tegra_spdif_startup(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { - int fifo_mode = AUDIO_RX_MODE; + struct tegra_spdif_info *info = dai->private_data; + + info->spdev_info.fifo_mode = AUDIO_RX_MODE; if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) - fifo_mode = AUDIO_TX_MODE; + info->spdev_info.fifo_mode = AUDIO_TX_MODE; - spdif_clock_enable(fifo_mode); + am_clock_enable(&info->spdev_info); return 0; } @@ -244,12 +251,14 @@ static int tegra_spdif_startup(struct snd_pcm_substream *substream, static void tegra_spdif_shutdown(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { - int fifo_mode = AUDIO_RX_MODE; + struct tegra_spdif_info *info = dai->private_data; + + info->spdev_info.fifo_mode = AUDIO_RX_MODE; if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) - fifo_mode = AUDIO_TX_MODE; + info->spdev_info.fifo_mode = AUDIO_TX_MODE; - spdif_clock_disable(fifo_mode); + am_clock_disable(&info->spdev_info); return; } @@ -296,7 +305,7 @@ static int tegra_spdif_driver_probe(struct platform_device *pdev) int err = 0; struct resource *res, *mem; struct tegra_spdif_info *info; - struct tegra_spdif_property sp_prop; + am_dev_format_info dev_fmt; pr_info("%s\n", __func__); @@ -332,10 +341,19 @@ static int tegra_spdif_driver_probe(struct platform_device *pdev) goto fail_release_mem; } - sp_prop.clk_rate = info->pdata->dev_clk_rate; + memset(&dev_fmt, 0, sizeof(dev_fmt)); + dev_fmt.clkrate = info->pdata->dev_clk_rate; + info->spdev_info.base = info->spdif_base; + info->spdev_info.phy_base = info->spdif_phys; + + info->spdev_info.dev_type = AUDIO_SPDIF_DEVICE; + info->spdev_info.dev_id = pdev->id; + info->spdev_info.fifo_mode = AUDIO_TX_MODE; + + am_device_init(&info->spdev_info, (void *)&dev_fmt, 0); - spdif_init(info->spdif_base, AUDIO_TX_MODE, &sp_prop); - spdif_init(info->spdif_base, AUDIO_RX_MODE, &sp_prop); + info->spdev_info.fifo_mode = AUDIO_RX_MODE; + am_device_init(&info->spdev_info, (void *)&dev_fmt, 0); tegra_spdif_dai.dev = &pdev->dev; tegra_spdif_dai.private_data = info; diff --git a/sound/soc/tegra/tegra_wired_jack.c b/sound/soc/tegra/tegra_wired_jack.c index 1ee029856cb0..e51cb35c3158 100644 --- a/sound/soc/tegra/tegra_wired_jack.c +++ b/sound/soc/tegra/tegra_wired_jack.c @@ -144,7 +144,7 @@ static int tegra_wired_jack_probe(struct platform_device *pdev) { int ret; int hp_det_n = 0, cdc_irq = 0; - int en_mic_int = 0, en_mic_ext = 0; + int en_mic_int = -1, en_mic_ext = -1; int en_spkr = 0; struct wired_jack_conf *pdata; @@ -152,9 +152,9 @@ static int tegra_wired_jack_probe(struct platform_device *pdev) if (!pdata || !pdata->hp_det_n #if defined(CONFIG_ARCH_TEGRA_2x_SOC) - || !pdata->cdc_irq || !pdata->en_spkr + || !pdata->en_mic_int || !pdata->en_mic_ext #endif - || !pdata->en_mic_int || !pdata->en_mic_ext) { + || !pdata->cdc_irq || !pdata->en_spkr) { pr_err("Please set up gpio pins for jack.\n"); return -EBUSY; } @@ -176,6 +176,7 @@ static int tegra_wired_jack_probe(struct platform_device *pdev) return ret; } +#if defined(CONFIG_ARCH_TEGRA_2x_SOC) /* Mic switch controlling pins */ en_mic_int = pdata->en_mic_int; en_mic_ext = pdata->en_mic_ext; @@ -204,6 +205,8 @@ static int tegra_wired_jack_probe(struct platform_device *pdev) gpio_export(en_mic_ext, false); } +#endif + en_spkr = pdata->en_spkr; ret = gpio_request(en_spkr, "en_spkr"); if (ret) { @@ -212,6 +215,7 @@ static int tegra_wired_jack_probe(struct platform_device *pdev) en_spkr = -1; } + if (en_spkr != -1) { gpio_direction_output(en_spkr, 0); gpio_export(en_spkr, false); |