diff options
Diffstat (limited to 'ANDROID_3.4.5/sound/soc/kirkwood')
-rw-r--r-- | ANDROID_3.4.5/sound/soc/kirkwood/Kconfig | 30 | ||||
-rw-r--r-- | ANDROID_3.4.5/sound/soc/kirkwood/Makefile | 11 | ||||
-rw-r--r-- | ANDROID_3.4.5/sound/soc/kirkwood/kirkwood-dma.c | 398 | ||||
-rw-r--r-- | ANDROID_3.4.5/sound/soc/kirkwood/kirkwood-i2s.c | 491 | ||||
-rw-r--r-- | ANDROID_3.4.5/sound/soc/kirkwood/kirkwood-openrd.c | 111 | ||||
-rw-r--r-- | ANDROID_3.4.5/sound/soc/kirkwood/kirkwood-t5325.c | 131 | ||||
-rw-r--r-- | ANDROID_3.4.5/sound/soc/kirkwood/kirkwood.h | 128 |
7 files changed, 0 insertions, 1300 deletions
diff --git a/ANDROID_3.4.5/sound/soc/kirkwood/Kconfig b/ANDROID_3.4.5/sound/soc/kirkwood/Kconfig deleted file mode 100644 index c62d7152..00000000 --- a/ANDROID_3.4.5/sound/soc/kirkwood/Kconfig +++ /dev/null @@ -1,30 +0,0 @@ -config SND_KIRKWOOD_SOC - tristate "SoC Audio for the Marvell Kirkwood chip" - depends on ARCH_KIRKWOOD - help - Say Y or M if you want to add support for codecs attached to - the Kirkwood I2S interface. You will also need to select the - audio interfaces to support below. - -config SND_KIRKWOOD_SOC_I2S - tristate - -config SND_KIRKWOOD_SOC_OPENRD - tristate "SoC Audio support for Kirkwood Openrd Client" - depends on SND_KIRKWOOD_SOC && (MACH_OPENRD_CLIENT || MACH_OPENRD_ULTIMATE) - depends on I2C - select SND_KIRKWOOD_SOC_I2S - select SND_SOC_CS42L51 - help - Say Y if you want to add support for SoC audio on - Openrd Client. - -config SND_KIRKWOOD_SOC_T5325 - tristate "SoC Audio support for HP t5325" - depends on SND_KIRKWOOD_SOC && MACH_T5325 && I2C - select SND_KIRKWOOD_SOC_I2S - select SND_SOC_ALC5623 - help - Say Y if you want to add support for SoC audio on - the HP t5325 thin client. - diff --git a/ANDROID_3.4.5/sound/soc/kirkwood/Makefile b/ANDROID_3.4.5/sound/soc/kirkwood/Makefile deleted file mode 100644 index 3e62ae9e..00000000 --- a/ANDROID_3.4.5/sound/soc/kirkwood/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -snd-soc-kirkwood-objs := kirkwood-dma.o -snd-soc-kirkwood-i2s-objs := kirkwood-i2s.o - -obj-$(CONFIG_SND_KIRKWOOD_SOC) += snd-soc-kirkwood.o -obj-$(CONFIG_SND_KIRKWOOD_SOC_I2S) += snd-soc-kirkwood-i2s.o - -snd-soc-openrd-objs := kirkwood-openrd.o -snd-soc-t5325-objs := kirkwood-t5325.o - -obj-$(CONFIG_SND_KIRKWOOD_SOC_OPENRD) += snd-soc-openrd.o -obj-$(CONFIG_SND_KIRKWOOD_SOC_T5325) += snd-soc-t5325.o diff --git a/ANDROID_3.4.5/sound/soc/kirkwood/kirkwood-dma.c b/ANDROID_3.4.5/sound/soc/kirkwood/kirkwood-dma.c deleted file mode 100644 index b9f16598..00000000 --- a/ANDROID_3.4.5/sound/soc/kirkwood/kirkwood-dma.c +++ /dev/null @@ -1,398 +0,0 @@ -/* - * kirkwood-dma.c - * - * (c) 2010 Arnaud Patard <apatard@mandriva.com> - * (c) 2010 Arnaud Patard <arnaud.patard@rtp-net.org> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - */ - -#include <linux/init.h> -#include <linux/module.h> -#include <linux/device.h> -#include <linux/io.h> -#include <linux/slab.h> -#include <linux/interrupt.h> -#include <linux/dma-mapping.h> -#include <linux/mbus.h> -#include <sound/soc.h> -#include "kirkwood.h" - -#define KIRKWOOD_RATES \ - (SNDRV_PCM_RATE_44100 | \ - SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_96000) -#define KIRKWOOD_FORMATS \ - (SNDRV_PCM_FMTBIT_S16_LE | \ - SNDRV_PCM_FMTBIT_S24_LE | \ - SNDRV_PCM_FMTBIT_S32_LE) - -struct kirkwood_dma_priv { - struct snd_pcm_substream *play_stream; - struct snd_pcm_substream *rec_stream; - struct kirkwood_dma_data *data; -}; - -static struct snd_pcm_hardware kirkwood_dma_snd_hw = { - .info = (SNDRV_PCM_INFO_INTERLEAVED | - SNDRV_PCM_INFO_MMAP | - SNDRV_PCM_INFO_MMAP_VALID | - SNDRV_PCM_INFO_BLOCK_TRANSFER | - SNDRV_PCM_INFO_PAUSE), - .formats = KIRKWOOD_FORMATS, - .rates = KIRKWOOD_RATES, - .rate_min = 44100, - .rate_max = 96000, - .channels_min = 1, - .channels_max = 2, - .buffer_bytes_max = KIRKWOOD_SND_MAX_PERIOD_BYTES * KIRKWOOD_SND_MAX_PERIODS, - .period_bytes_min = KIRKWOOD_SND_MIN_PERIOD_BYTES, - .period_bytes_max = KIRKWOOD_SND_MAX_PERIOD_BYTES, - .periods_min = KIRKWOOD_SND_MIN_PERIODS, - .periods_max = KIRKWOOD_SND_MAX_PERIODS, - .fifo_size = 0, -}; - -static u64 kirkwood_dma_dmamask = DMA_BIT_MASK(32); - -static irqreturn_t kirkwood_dma_irq(int irq, void *dev_id) -{ - struct kirkwood_dma_priv *prdata = dev_id; - struct kirkwood_dma_data *priv = prdata->data; - unsigned long mask, status, cause; - - mask = readl(priv->io + KIRKWOOD_INT_MASK); - status = readl(priv->io + KIRKWOOD_INT_CAUSE) & mask; - - cause = readl(priv->io + KIRKWOOD_ERR_CAUSE); - if (unlikely(cause)) { - printk(KERN_WARNING "%s: got err interrupt 0x%lx\n", - __func__, cause); - writel(cause, priv->io + KIRKWOOD_ERR_CAUSE); - return IRQ_HANDLED; - } - - /* we've enabled only bytes interrupts ... */ - if (status & ~(KIRKWOOD_INT_CAUSE_PLAY_BYTES | \ - KIRKWOOD_INT_CAUSE_REC_BYTES)) { - printk(KERN_WARNING "%s: unexpected interrupt %lx\n", - __func__, status); - return IRQ_NONE; - } - - /* ack int */ - writel(status, priv->io + KIRKWOOD_INT_CAUSE); - - if (status & KIRKWOOD_INT_CAUSE_PLAY_BYTES) - snd_pcm_period_elapsed(prdata->play_stream); - - if (status & KIRKWOOD_INT_CAUSE_REC_BYTES) - snd_pcm_period_elapsed(prdata->rec_stream); - - return IRQ_HANDLED; -} - -static void -kirkwood_dma_conf_mbus_windows(void __iomem *base, int win, - unsigned long dma, - const struct mbus_dram_target_info *dram) -{ - int i; - - /* First disable and clear windows */ - writel(0, base + KIRKWOOD_AUDIO_WIN_CTRL_REG(win)); - writel(0, base + KIRKWOOD_AUDIO_WIN_BASE_REG(win)); - - /* try to find matching cs for current dma address */ - for (i = 0; i < dram->num_cs; i++) { - const struct mbus_dram_window *cs = dram->cs + i; - if ((cs->base & 0xffff0000) < (dma & 0xffff0000)) { - writel(cs->base & 0xffff0000, - base + KIRKWOOD_AUDIO_WIN_BASE_REG(win)); - writel(((cs->size - 1) & 0xffff0000) | - (cs->mbus_attr << 8) | - (dram->mbus_dram_target_id << 4) | 1, - base + KIRKWOOD_AUDIO_WIN_CTRL_REG(win)); - } - } -} - -static int kirkwood_dma_open(struct snd_pcm_substream *substream) -{ - int err; - struct snd_pcm_runtime *runtime = substream->runtime; - struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; - struct snd_soc_platform *platform = soc_runtime->platform; - struct snd_soc_dai *cpu_dai = soc_runtime->cpu_dai; - struct kirkwood_dma_data *priv; - struct kirkwood_dma_priv *prdata = snd_soc_platform_get_drvdata(platform); - const struct mbus_dram_target_info *dram; - unsigned long addr; - - priv = snd_soc_dai_get_dma_data(cpu_dai, substream); - snd_soc_set_runtime_hwparams(substream, &kirkwood_dma_snd_hw); - - /* Ensure that all constraints linked to dma burst are fulfilled */ - err = snd_pcm_hw_constraint_minmax(runtime, - SNDRV_PCM_HW_PARAM_BUFFER_BYTES, - priv->burst * 2, - KIRKWOOD_AUDIO_BUF_MAX-1); - if (err < 0) - return err; - - err = snd_pcm_hw_constraint_step(runtime, 0, - SNDRV_PCM_HW_PARAM_BUFFER_BYTES, - priv->burst); - if (err < 0) - return err; - - err = snd_pcm_hw_constraint_step(substream->runtime, 0, - SNDRV_PCM_HW_PARAM_PERIOD_BYTES, - priv->burst); - if (err < 0) - return err; - - if (prdata == NULL) { - prdata = kzalloc(sizeof(struct kirkwood_dma_priv), GFP_KERNEL); - if (prdata == NULL) - return -ENOMEM; - - prdata->data = priv; - - err = request_irq(priv->irq, kirkwood_dma_irq, IRQF_SHARED, - "kirkwood-i2s", prdata); - if (err) { - kfree(prdata); - return -EBUSY; - } - - snd_soc_platform_set_drvdata(platform, prdata); - - /* - * Enable Error interrupts. We're only ack'ing them but - * it's useful for diagnostics - */ - writel((unsigned long)-1, priv->io + KIRKWOOD_ERR_MASK); - } - - dram = mv_mbus_dram_info(); - addr = virt_to_phys(substream->dma_buffer.area); - if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { - prdata->play_stream = substream; - kirkwood_dma_conf_mbus_windows(priv->io, - KIRKWOOD_PLAYBACK_WIN, addr, dram); - } else { - prdata->rec_stream = substream; - kirkwood_dma_conf_mbus_windows(priv->io, - KIRKWOOD_RECORD_WIN, addr, dram); - } - - return 0; -} - -static int kirkwood_dma_close(struct snd_pcm_substream *substream) -{ - struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; - struct snd_soc_dai *cpu_dai = soc_runtime->cpu_dai; - struct snd_soc_platform *platform = soc_runtime->platform; - struct kirkwood_dma_priv *prdata = snd_soc_platform_get_drvdata(platform); - struct kirkwood_dma_data *priv; - - priv = snd_soc_dai_get_dma_data(cpu_dai, substream); - - if (!prdata || !priv) - return 0; - - if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) - prdata->play_stream = NULL; - else - prdata->rec_stream = NULL; - - if (!prdata->play_stream && !prdata->rec_stream) { - writel(0, priv->io + KIRKWOOD_ERR_MASK); - free_irq(priv->irq, prdata); - kfree(prdata); - snd_soc_platform_set_drvdata(platform, NULL); - } - - return 0; -} - -static int kirkwood_dma_hw_params(struct snd_pcm_substream *substream, - struct snd_pcm_hw_params *params) -{ - struct snd_pcm_runtime *runtime = substream->runtime; - - snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer); - runtime->dma_bytes = params_buffer_bytes(params); - - return 0; -} - -static int kirkwood_dma_hw_free(struct snd_pcm_substream *substream) -{ - snd_pcm_set_runtime_buffer(substream, NULL); - return 0; -} - -static int kirkwood_dma_prepare(struct snd_pcm_substream *substream) -{ - struct snd_pcm_runtime *runtime = substream->runtime; - struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; - struct snd_soc_dai *cpu_dai = soc_runtime->cpu_dai; - struct kirkwood_dma_data *priv; - unsigned long size, count; - - priv = snd_soc_dai_get_dma_data(cpu_dai, substream); - - /* compute buffer size in term of "words" as requested in specs */ - size = frames_to_bytes(runtime, runtime->buffer_size); - size = (size>>2)-1; - count = snd_pcm_lib_period_bytes(substream); - - if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { - writel(count, priv->io + KIRKWOOD_PLAY_BYTE_INT_COUNT); - writel(runtime->dma_addr, priv->io + KIRKWOOD_PLAY_BUF_ADDR); - writel(size, priv->io + KIRKWOOD_PLAY_BUF_SIZE); - } else { - writel(count, priv->io + KIRKWOOD_REC_BYTE_INT_COUNT); - writel(runtime->dma_addr, priv->io + KIRKWOOD_REC_BUF_ADDR); - writel(size, priv->io + KIRKWOOD_REC_BUF_SIZE); - } - - - return 0; -} - -static snd_pcm_uframes_t kirkwood_dma_pointer(struct snd_pcm_substream - *substream) -{ - struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; - struct snd_soc_dai *cpu_dai = soc_runtime->cpu_dai; - struct kirkwood_dma_data *priv; - snd_pcm_uframes_t count; - - priv = snd_soc_dai_get_dma_data(cpu_dai, substream); - - if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) - count = bytes_to_frames(substream->runtime, - readl(priv->io + KIRKWOOD_PLAY_BYTE_COUNT)); - else - count = bytes_to_frames(substream->runtime, - readl(priv->io + KIRKWOOD_REC_BYTE_COUNT)); - - return count; -} - -struct snd_pcm_ops kirkwood_dma_ops = { - .open = kirkwood_dma_open, - .close = kirkwood_dma_close, - .ioctl = snd_pcm_lib_ioctl, - .hw_params = kirkwood_dma_hw_params, - .hw_free = kirkwood_dma_hw_free, - .prepare = kirkwood_dma_prepare, - .pointer = kirkwood_dma_pointer, -}; - -static int kirkwood_dma_preallocate_dma_buffer(struct snd_pcm *pcm, - int stream) -{ - struct snd_pcm_substream *substream = pcm->streams[stream].substream; - struct snd_dma_buffer *buf = &substream->dma_buffer; - size_t size = kirkwood_dma_snd_hw.buffer_bytes_max; - - buf->dev.type = SNDRV_DMA_TYPE_DEV; - buf->dev.dev = pcm->card->dev; - buf->area = dma_alloc_coherent(pcm->card->dev, size, - &buf->addr, GFP_KERNEL); - if (!buf->area) - return -ENOMEM; - buf->bytes = size; - buf->private_data = NULL; - - return 0; -} - -static int kirkwood_dma_new(struct snd_soc_pcm_runtime *rtd) -{ - struct snd_card *card = rtd->card->snd_card; - struct snd_pcm *pcm = rtd->pcm; - int ret; - - if (!card->dev->dma_mask) - card->dev->dma_mask = &kirkwood_dma_dmamask; - if (!card->dev->coherent_dma_mask) - card->dev->coherent_dma_mask = DMA_BIT_MASK(32); - - if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { - ret = kirkwood_dma_preallocate_dma_buffer(pcm, - SNDRV_PCM_STREAM_PLAYBACK); - if (ret) - return ret; - } - - if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { - ret = kirkwood_dma_preallocate_dma_buffer(pcm, - SNDRV_PCM_STREAM_CAPTURE); - if (ret) - return ret; - } - - return 0; -} - -static void kirkwood_dma_free_dma_buffers(struct snd_pcm *pcm) -{ - struct snd_pcm_substream *substream; - struct snd_dma_buffer *buf; - int stream; - - for (stream = 0; stream < 2; stream++) { - substream = pcm->streams[stream].substream; - if (!substream) - continue; - buf = &substream->dma_buffer; - if (!buf->area) - continue; - - dma_free_coherent(pcm->card->dev, buf->bytes, - buf->area, buf->addr); - buf->area = NULL; - } -} - -static struct snd_soc_platform_driver kirkwood_soc_platform = { - .ops = &kirkwood_dma_ops, - .pcm_new = kirkwood_dma_new, - .pcm_free = kirkwood_dma_free_dma_buffers, -}; - -static int __devinit kirkwood_soc_platform_probe(struct platform_device *pdev) -{ - return snd_soc_register_platform(&pdev->dev, &kirkwood_soc_platform); -} - -static int __devexit kirkwood_soc_platform_remove(struct platform_device *pdev) -{ - snd_soc_unregister_platform(&pdev->dev); - return 0; -} - -static struct platform_driver kirkwood_pcm_driver = { - .driver = { - .name = "kirkwood-pcm-audio", - .owner = THIS_MODULE, - }, - - .probe = kirkwood_soc_platform_probe, - .remove = __devexit_p(kirkwood_soc_platform_remove), -}; - -module_platform_driver(kirkwood_pcm_driver); - -MODULE_AUTHOR("Arnaud Patard <arnaud.patard@rtp-net.org>"); -MODULE_DESCRIPTION("Marvell Kirkwood Audio DMA module"); -MODULE_LICENSE("GPL"); -MODULE_ALIAS("platform:kirkwood-pcm-audio"); diff --git a/ANDROID_3.4.5/sound/soc/kirkwood/kirkwood-i2s.c b/ANDROID_3.4.5/sound/soc/kirkwood/kirkwood-i2s.c deleted file mode 100644 index 3cb9aa42..00000000 --- a/ANDROID_3.4.5/sound/soc/kirkwood/kirkwood-i2s.c +++ /dev/null @@ -1,491 +0,0 @@ -/* - * kirkwood-i2s.c - * - * (c) 2010 Arnaud Patard <apatard@mandriva.com> - * (c) 2010 Arnaud Patard <arnaud.patard@rtp-net.org> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - */ - -#include <linux/init.h> -#include <linux/module.h> -#include <linux/platform_device.h> -#include <linux/io.h> -#include <linux/slab.h> -#include <linux/mbus.h> -#include <linux/delay.h> -#include <sound/pcm.h> -#include <sound/pcm_params.h> -#include <sound/soc.h> -#include <plat/audio.h> -#include "kirkwood.h" - -#define DRV_NAME "kirkwood-i2s" - -#define KIRKWOOD_I2S_RATES \ - (SNDRV_PCM_RATE_44100 | \ - SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_96000) -#define KIRKWOOD_I2S_FORMATS \ - (SNDRV_PCM_FMTBIT_S16_LE | \ - SNDRV_PCM_FMTBIT_S24_LE | \ - SNDRV_PCM_FMTBIT_S32_LE) - -static int kirkwood_i2s_set_fmt(struct snd_soc_dai *cpu_dai, - unsigned int fmt) -{ - struct kirkwood_dma_data *priv = snd_soc_dai_get_drvdata(cpu_dai); - unsigned long mask; - unsigned long value; - - switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { - case SND_SOC_DAIFMT_RIGHT_J: - mask = KIRKWOOD_I2S_CTL_RJ; - break; - case SND_SOC_DAIFMT_LEFT_J: - mask = KIRKWOOD_I2S_CTL_LJ; - break; - case SND_SOC_DAIFMT_I2S: - mask = KIRKWOOD_I2S_CTL_I2S; - break; - default: - return -EINVAL; - } - - /* - * Set same format for playback and record - * This avoids some troubles. - */ - value = readl(priv->io+KIRKWOOD_I2S_PLAYCTL); - value &= ~KIRKWOOD_I2S_CTL_JUST_MASK; - value |= mask; - writel(value, priv->io+KIRKWOOD_I2S_PLAYCTL); - - value = readl(priv->io+KIRKWOOD_I2S_RECCTL); - value &= ~KIRKWOOD_I2S_CTL_JUST_MASK; - value |= mask; - writel(value, priv->io+KIRKWOOD_I2S_RECCTL); - - return 0; -} - -static inline void kirkwood_set_dco(void __iomem *io, unsigned long rate) -{ - unsigned long value; - - value = KIRKWOOD_DCO_CTL_OFFSET_0; - switch (rate) { - default: - case 44100: - value |= KIRKWOOD_DCO_CTL_FREQ_11; - break; - case 48000: - value |= KIRKWOOD_DCO_CTL_FREQ_12; - break; - case 96000: - value |= KIRKWOOD_DCO_CTL_FREQ_24; - break; - } - writel(value, io + KIRKWOOD_DCO_CTL); - - /* wait for dco locked */ - do { - cpu_relax(); - value = readl(io + KIRKWOOD_DCO_SPCR_STATUS); - value &= KIRKWOOD_DCO_SPCR_STATUS; - } while (value == 0); -} - -static int kirkwood_i2s_startup(struct snd_pcm_substream *substream, - struct snd_soc_dai *dai) -{ - struct kirkwood_dma_data *priv = snd_soc_dai_get_drvdata(dai); - - snd_soc_dai_set_dma_data(dai, substream, priv); - return 0; -} - -static int kirkwood_i2s_hw_params(struct snd_pcm_substream *substream, - struct snd_pcm_hw_params *params, - struct snd_soc_dai *dai) -{ - struct kirkwood_dma_data *priv = snd_soc_dai_get_drvdata(dai); - unsigned int i2s_reg, reg; - unsigned long i2s_value, value; - - if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { - i2s_reg = KIRKWOOD_I2S_PLAYCTL; - reg = KIRKWOOD_PLAYCTL; - } else { - i2s_reg = KIRKWOOD_I2S_RECCTL; - reg = KIRKWOOD_RECCTL; - } - - /* set dco conf */ - kirkwood_set_dco(priv->io, params_rate(params)); - - i2s_value = readl(priv->io+i2s_reg); - i2s_value &= ~KIRKWOOD_I2S_CTL_SIZE_MASK; - - value = readl(priv->io+reg); - value &= ~KIRKWOOD_PLAYCTL_SIZE_MASK; - - /* - * Size settings in play/rec i2s control regs and play/rec control - * regs must be the same. - */ - switch (params_format(params)) { - case SNDRV_PCM_FORMAT_S16_LE: - i2s_value |= KIRKWOOD_I2S_CTL_SIZE_16; - value |= KIRKWOOD_PLAYCTL_SIZE_16_C; - break; - /* - * doesn't work... S20_3LE != kirkwood 20bit format ? - * - case SNDRV_PCM_FORMAT_S20_3LE: - i2s_value |= KIRKWOOD_I2S_CTL_SIZE_20; - value |= KIRKWOOD_PLAYCTL_SIZE_20; - break; - */ - case SNDRV_PCM_FORMAT_S24_LE: - i2s_value |= KIRKWOOD_I2S_CTL_SIZE_24; - value |= KIRKWOOD_PLAYCTL_SIZE_24; - break; - case SNDRV_PCM_FORMAT_S32_LE: - i2s_value |= KIRKWOOD_I2S_CTL_SIZE_32; - value |= KIRKWOOD_PLAYCTL_SIZE_32; - break; - default: - return -EINVAL; - } - - if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { - value &= ~KIRKWOOD_PLAYCTL_MONO_MASK; - if (params_channels(params) == 1) - value |= KIRKWOOD_PLAYCTL_MONO_BOTH; - else - value |= KIRKWOOD_PLAYCTL_MONO_OFF; - } - - writel(i2s_value, priv->io+i2s_reg); - writel(value, priv->io+reg); - - return 0; -} - -static int kirkwood_i2s_play_trigger(struct snd_pcm_substream *substream, - int cmd, struct snd_soc_dai *dai) -{ - struct kirkwood_dma_data *priv = snd_soc_dai_get_drvdata(dai); - unsigned long value; - - /* - * specs says KIRKWOOD_PLAYCTL must be read 2 times before - * changing it. So read 1 time here and 1 later. - */ - value = readl(priv->io + KIRKWOOD_PLAYCTL); - - switch (cmd) { - case SNDRV_PCM_TRIGGER_START: - /* stop audio, enable interrupts */ - value = readl(priv->io + KIRKWOOD_PLAYCTL); - value |= KIRKWOOD_PLAYCTL_PAUSE; - writel(value, priv->io + KIRKWOOD_PLAYCTL); - - value = readl(priv->io + KIRKWOOD_INT_MASK); - value |= KIRKWOOD_INT_CAUSE_PLAY_BYTES; - writel(value, priv->io + KIRKWOOD_INT_MASK); - - /* configure audio & enable i2s playback */ - value = readl(priv->io + KIRKWOOD_PLAYCTL); - value &= ~KIRKWOOD_PLAYCTL_BURST_MASK; - value &= ~(KIRKWOOD_PLAYCTL_PAUSE | KIRKWOOD_PLAYCTL_I2S_MUTE - | KIRKWOOD_PLAYCTL_SPDIF_EN); - - if (priv->burst == 32) - value |= KIRKWOOD_PLAYCTL_BURST_32; - else - value |= KIRKWOOD_PLAYCTL_BURST_128; - value |= KIRKWOOD_PLAYCTL_I2S_EN; - writel(value, priv->io + KIRKWOOD_PLAYCTL); - break; - - case SNDRV_PCM_TRIGGER_STOP: - /* stop audio, disable interrupts */ - value = readl(priv->io + KIRKWOOD_PLAYCTL); - value |= KIRKWOOD_PLAYCTL_PAUSE | KIRKWOOD_PLAYCTL_I2S_MUTE; - writel(value, priv->io + KIRKWOOD_PLAYCTL); - - value = readl(priv->io + KIRKWOOD_INT_MASK); - value &= ~KIRKWOOD_INT_CAUSE_PLAY_BYTES; - writel(value, priv->io + KIRKWOOD_INT_MASK); - - /* disable all playbacks */ - value = readl(priv->io + KIRKWOOD_PLAYCTL); - value &= ~(KIRKWOOD_PLAYCTL_I2S_EN | KIRKWOOD_PLAYCTL_SPDIF_EN); - writel(value, priv->io + KIRKWOOD_PLAYCTL); - break; - - case SNDRV_PCM_TRIGGER_PAUSE_PUSH: - case SNDRV_PCM_TRIGGER_SUSPEND: - value = readl(priv->io + KIRKWOOD_PLAYCTL); - value |= KIRKWOOD_PLAYCTL_PAUSE | KIRKWOOD_PLAYCTL_I2S_MUTE; - writel(value, priv->io + KIRKWOOD_PLAYCTL); - break; - - case SNDRV_PCM_TRIGGER_RESUME: - case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: - value = readl(priv->io + KIRKWOOD_PLAYCTL); - value &= ~(KIRKWOOD_PLAYCTL_PAUSE | KIRKWOOD_PLAYCTL_I2S_MUTE); - writel(value, priv->io + KIRKWOOD_PLAYCTL); - break; - - default: - return -EINVAL; - } - - return 0; -} - -static int kirkwood_i2s_rec_trigger(struct snd_pcm_substream *substream, - int cmd, struct snd_soc_dai *dai) -{ - struct kirkwood_dma_data *priv = snd_soc_dai_get_drvdata(dai); - unsigned long value; - - value = readl(priv->io + KIRKWOOD_RECCTL); - - switch (cmd) { - case SNDRV_PCM_TRIGGER_START: - /* stop audio, enable interrupts */ - value = readl(priv->io + KIRKWOOD_RECCTL); - value |= KIRKWOOD_RECCTL_PAUSE; - writel(value, priv->io + KIRKWOOD_RECCTL); - - value = readl(priv->io + KIRKWOOD_INT_MASK); - value |= KIRKWOOD_INT_CAUSE_REC_BYTES; - writel(value, priv->io + KIRKWOOD_INT_MASK); - - /* configure audio & enable i2s record */ - value = readl(priv->io + KIRKWOOD_RECCTL); - value &= ~KIRKWOOD_RECCTL_BURST_MASK; - value &= ~KIRKWOOD_RECCTL_MONO; - value &= ~(KIRKWOOD_RECCTL_PAUSE | KIRKWOOD_RECCTL_MUTE - | KIRKWOOD_RECCTL_SPDIF_EN); - - if (priv->burst == 32) - value |= KIRKWOOD_RECCTL_BURST_32; - else - value |= KIRKWOOD_RECCTL_BURST_128; - value |= KIRKWOOD_RECCTL_I2S_EN; - - writel(value, priv->io + KIRKWOOD_RECCTL); - break; - - case SNDRV_PCM_TRIGGER_STOP: - /* stop audio, disable interrupts */ - value = readl(priv->io + KIRKWOOD_RECCTL); - value |= KIRKWOOD_RECCTL_PAUSE | KIRKWOOD_RECCTL_MUTE; - writel(value, priv->io + KIRKWOOD_RECCTL); - - value = readl(priv->io + KIRKWOOD_INT_MASK); - value &= ~KIRKWOOD_INT_CAUSE_REC_BYTES; - writel(value, priv->io + KIRKWOOD_INT_MASK); - - /* disable all records */ - value = readl(priv->io + KIRKWOOD_RECCTL); - value &= ~(KIRKWOOD_RECCTL_I2S_EN | KIRKWOOD_RECCTL_SPDIF_EN); - writel(value, priv->io + KIRKWOOD_RECCTL); - break; - - case SNDRV_PCM_TRIGGER_PAUSE_PUSH: - case SNDRV_PCM_TRIGGER_SUSPEND: - value = readl(priv->io + KIRKWOOD_RECCTL); - value |= KIRKWOOD_RECCTL_PAUSE | KIRKWOOD_RECCTL_MUTE; - writel(value, priv->io + KIRKWOOD_RECCTL); - break; - - case SNDRV_PCM_TRIGGER_RESUME: - case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: - value = readl(priv->io + KIRKWOOD_RECCTL); - value &= ~(KIRKWOOD_RECCTL_PAUSE | KIRKWOOD_RECCTL_MUTE); - writel(value, priv->io + KIRKWOOD_RECCTL); - break; - - default: - return -EINVAL; - } - - return 0; -} - -static int kirkwood_i2s_trigger(struct snd_pcm_substream *substream, int cmd, - struct snd_soc_dai *dai) -{ - if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) - return kirkwood_i2s_play_trigger(substream, cmd, dai); - else - return kirkwood_i2s_rec_trigger(substream, cmd, dai); - - return 0; -} - -static int kirkwood_i2s_probe(struct snd_soc_dai *dai) -{ - struct kirkwood_dma_data *priv = snd_soc_dai_get_drvdata(dai); - unsigned long value; - unsigned int reg_data; - - /* put system in a "safe" state : */ - /* disable audio interrupts */ - writel(0xffffffff, priv->io + KIRKWOOD_INT_CAUSE); - writel(0, priv->io + KIRKWOOD_INT_MASK); - - reg_data = readl(priv->io + 0x1200); - reg_data &= (~(0x333FF8)); - reg_data |= 0x111D18; - writel(reg_data, priv->io + 0x1200); - - msleep(500); - - reg_data = readl(priv->io + 0x1200); - reg_data &= (~(0x333FF8)); - reg_data |= 0x111D18; - writel(reg_data, priv->io + 0x1200); - - /* disable playback/record */ - value = readl(priv->io + KIRKWOOD_PLAYCTL); - value &= ~(KIRKWOOD_PLAYCTL_I2S_EN|KIRKWOOD_PLAYCTL_SPDIF_EN); - writel(value, priv->io + KIRKWOOD_PLAYCTL); - - value = readl(priv->io + KIRKWOOD_RECCTL); - value &= ~(KIRKWOOD_RECCTL_I2S_EN | KIRKWOOD_RECCTL_SPDIF_EN); - writel(value, priv->io + KIRKWOOD_RECCTL); - - return 0; - -} - -static int kirkwood_i2s_remove(struct snd_soc_dai *dai) -{ - return 0; -} - -static const struct snd_soc_dai_ops kirkwood_i2s_dai_ops = { - .startup = kirkwood_i2s_startup, - .trigger = kirkwood_i2s_trigger, - .hw_params = kirkwood_i2s_hw_params, - .set_fmt = kirkwood_i2s_set_fmt, -}; - - -static struct snd_soc_dai_driver kirkwood_i2s_dai = { - .probe = kirkwood_i2s_probe, - .remove = kirkwood_i2s_remove, - .playback = { - .channels_min = 1, - .channels_max = 2, - .rates = KIRKWOOD_I2S_RATES, - .formats = KIRKWOOD_I2S_FORMATS,}, - .capture = { - .channels_min = 1, - .channels_max = 2, - .rates = KIRKWOOD_I2S_RATES, - .formats = KIRKWOOD_I2S_FORMATS,}, - .ops = &kirkwood_i2s_dai_ops, -}; - -static __devinit int kirkwood_i2s_dev_probe(struct platform_device *pdev) -{ - struct resource *mem; - struct kirkwood_asoc_platform_data *data = - pdev->dev.platform_data; - struct kirkwood_dma_data *priv; - int err; - - priv = kzalloc(sizeof(struct kirkwood_dma_data), GFP_KERNEL); - if (!priv) { - dev_err(&pdev->dev, "allocation failed\n"); - err = -ENOMEM; - goto error; - } - dev_set_drvdata(&pdev->dev, priv); - - mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!mem) { - dev_err(&pdev->dev, "platform_get_resource failed\n"); - err = -ENXIO; - goto err_alloc; - } - - priv->mem = request_mem_region(mem->start, SZ_16K, DRV_NAME); - if (!priv->mem) { - dev_err(&pdev->dev, "request_mem_region failed\n"); - err = -EBUSY; - goto err_alloc; - } - - priv->io = ioremap(priv->mem->start, SZ_16K); - if (!priv->io) { - dev_err(&pdev->dev, "ioremap failed\n"); - err = -ENOMEM; - goto err_iomem; - } - - priv->irq = platform_get_irq(pdev, 0); - if (priv->irq <= 0) { - dev_err(&pdev->dev, "platform_get_irq failed\n"); - err = -ENXIO; - goto err_ioremap; - } - - if (!data) { - dev_err(&pdev->dev, "no platform data ?!\n"); - err = -EINVAL; - goto err_ioremap; - } - - priv->burst = data->burst; - - return snd_soc_register_dai(&pdev->dev, &kirkwood_i2s_dai); - -err_ioremap: - iounmap(priv->io); -err_iomem: - release_mem_region(priv->mem->start, SZ_16K); -err_alloc: - kfree(priv); -error: - return err; -} - -static __devexit int kirkwood_i2s_dev_remove(struct platform_device *pdev) -{ - struct kirkwood_dma_data *priv = dev_get_drvdata(&pdev->dev); - - snd_soc_unregister_dai(&pdev->dev); - iounmap(priv->io); - release_mem_region(priv->mem->start, SZ_16K); - kfree(priv); - - return 0; -} - -static struct platform_driver kirkwood_i2s_driver = { - .probe = kirkwood_i2s_dev_probe, - .remove = __devexit_p(kirkwood_i2s_dev_remove), - .driver = { - .name = DRV_NAME, - .owner = THIS_MODULE, - }, -}; - -module_platform_driver(kirkwood_i2s_driver); - -/* Module information */ -MODULE_AUTHOR("Arnaud Patard, <arnaud.patard@rtp-net.org>"); -MODULE_DESCRIPTION("Kirkwood I2S SoC Interface"); -MODULE_LICENSE("GPL"); -MODULE_ALIAS("platform:kirkwood-i2s"); diff --git a/ANDROID_3.4.5/sound/soc/kirkwood/kirkwood-openrd.c b/ANDROID_3.4.5/sound/soc/kirkwood/kirkwood-openrd.c deleted file mode 100644 index 80bd59c3..00000000 --- a/ANDROID_3.4.5/sound/soc/kirkwood/kirkwood-openrd.c +++ /dev/null @@ -1,111 +0,0 @@ -/* - * kirkwood-openrd.c - * - * (c) 2010 Arnaud Patard <apatard@mandriva.com> - * (c) 2010 Arnaud Patard <arnaud.patard@rtp-net.org> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - */ - -#include <linux/module.h> -#include <linux/moduleparam.h> -#include <linux/interrupt.h> -#include <linux/platform_device.h> -#include <linux/slab.h> -#include <sound/soc.h> -#include <mach/kirkwood.h> -#include <plat/audio.h> -#include <asm/mach-types.h> -#include "../codecs/cs42l51.h" - -static int openrd_client_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 *codec_dai = rtd->codec_dai; - unsigned int freq; - - switch (params_rate(params)) { - default: - case 44100: - freq = 11289600; - break; - case 48000: - freq = 12288000; - break; - case 96000: - freq = 24576000; - break; - } - - return snd_soc_dai_set_sysclk(codec_dai, 0, freq, SND_SOC_CLOCK_IN); - -} - -static struct snd_soc_ops openrd_client_ops = { - .hw_params = openrd_client_hw_params, -}; - - -static struct snd_soc_dai_link openrd_client_dai[] = { -{ - .name = "CS42L51", - .stream_name = "CS42L51 HiFi", - .cpu_dai_name = "kirkwood-i2s", - .platform_name = "kirkwood-pcm-audio", - .codec_dai_name = "cs42l51-hifi", - .codec_name = "cs42l51-codec.0-004a", - .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBS_CFS, - .ops = &openrd_client_ops, -}, -}; - - -static struct snd_soc_card openrd_client = { - .name = "OpenRD Client", - .owner = THIS_MODULE, - .dai_link = openrd_client_dai, - .num_links = ARRAY_SIZE(openrd_client_dai), -}; - -static int __devinit openrd_probe(struct platform_device *pdev) -{ - struct snd_soc_card *card = &openrd_client; - int ret; - - card->dev = &pdev->dev; - - ret = snd_soc_register_card(card); - if (ret) - dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", - ret); - return ret; -} - -static int __devexit openrd_remove(struct platform_device *pdev) -{ - struct snd_soc_card *card = platform_get_drvdata(pdev); - - snd_soc_unregister_card(card); - return 0; -} - -static struct platform_driver openrd_driver = { - .driver = { - .name = "openrd-client-audio", - .owner = THIS_MODULE, - }, - .probe = openrd_probe, - .remove = __devexit_p(openrd_remove), -}; - -module_platform_driver(openrd_driver); - -/* Module information */ -MODULE_AUTHOR("Arnaud Patard <arnaud.patard@rtp-net.org>"); -MODULE_DESCRIPTION("ALSA SoC OpenRD Client"); -MODULE_LICENSE("GPL"); -MODULE_ALIAS("platform:openrd-client-audio"); diff --git a/ANDROID_3.4.5/sound/soc/kirkwood/kirkwood-t5325.c b/ANDROID_3.4.5/sound/soc/kirkwood/kirkwood-t5325.c deleted file mode 100644 index f8983635..00000000 --- a/ANDROID_3.4.5/sound/soc/kirkwood/kirkwood-t5325.c +++ /dev/null @@ -1,131 +0,0 @@ -/* - * kirkwood-t5325.c - * - * (c) 2010 Arnaud Patard <arnaud.patard@rtp-net.org> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - */ - -#include <linux/module.h> -#include <linux/moduleparam.h> -#include <linux/interrupt.h> -#include <linux/platform_device.h> -#include <linux/slab.h> -#include <sound/soc.h> -#include <mach/kirkwood.h> -#include <plat/audio.h> -#include <asm/mach-types.h> -#include "../codecs/alc5623.h" - -static int t5325_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 *codec_dai = rtd->codec_dai; - unsigned int freq; - - freq = params_rate(params) * 256; - - return snd_soc_dai_set_sysclk(codec_dai, 0, freq, SND_SOC_CLOCK_IN); - -} - -static struct snd_soc_ops t5325_ops = { - .hw_params = t5325_hw_params, -}; - -static const struct snd_soc_dapm_widget t5325_dapm_widgets[] = { - SND_SOC_DAPM_HP("Headphone Jack", NULL), - SND_SOC_DAPM_SPK("Speaker", NULL), - SND_SOC_DAPM_MIC("Mic Jack", NULL), -}; - -static const struct snd_soc_dapm_route t5325_route[] = { - { "Headphone Jack", NULL, "HPL" }, - { "Headphone Jack", NULL, "HPR" }, - - {"Speaker", NULL, "SPKOUT"}, - {"Speaker", NULL, "SPKOUTN"}, - - { "MIC1", NULL, "Mic Jack" }, - { "MIC2", NULL, "Mic Jack" }, -}; - -static int t5325_dai_init(struct snd_soc_pcm_runtime *rtd) -{ - struct snd_soc_codec *codec = rtd->codec; - struct snd_soc_dapm_context *dapm = &codec->dapm; - - snd_soc_dapm_enable_pin(dapm, "Mic Jack"); - snd_soc_dapm_enable_pin(dapm, "Headphone Jack"); - snd_soc_dapm_enable_pin(dapm, "Speaker"); - - return 0; -} - -static struct snd_soc_dai_link t5325_dai[] = { -{ - .name = "ALC5621", - .stream_name = "ALC5621 HiFi", - .cpu_dai_name = "kirkwood-i2s", - .platform_name = "kirkwood-pcm-audio", - .codec_dai_name = "alc5621-hifi", - .codec_name = "alc562x-codec.0-001a", - .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBS_CFS, - .ops = &t5325_ops, - .init = t5325_dai_init, -}, -}; - -static struct snd_soc_card t5325 = { - .name = "t5325", - .owner = THIS_MODULE, - .dai_link = t5325_dai, - .num_links = ARRAY_SIZE(t5325_dai), - - .dapm_widgets = t5325_dapm_widgets, - .num_dapm_widgets = ARRAY_SIZE(t5325_dapm_widgets), - .dapm_routes = t5325_route, - .num_dapm_routes = ARRAY_SIZE(t5325_route), -}; - -static int __devinit t5325_probe(struct platform_device *pdev) -{ - struct snd_soc_card *card = &t5325; - int ret; - - card->dev = &pdev->dev; - - ret = snd_soc_register_card(card); - if (ret) - dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", - ret); - return ret; -} - -static int __devexit t5325_remove(struct platform_device *pdev) -{ - struct snd_soc_card *card = platform_get_drvdata(pdev); - - snd_soc_unregister_card(card); - return 0; -} - -static struct platform_driver t5325_driver = { - .driver = { - .name = "t5325-audio", - .owner = THIS_MODULE, - }, - .probe = t5325_probe, - .remove = __devexit_p(t5325_remove), -}; - -module_platform_driver(t5325_driver); - -MODULE_AUTHOR("Arnaud Patard <arnaud.patard@rtp-net.org>"); -MODULE_DESCRIPTION("ALSA SoC t5325 audio client"); -MODULE_LICENSE("GPL"); -MODULE_ALIAS("platform:t5325-audio"); diff --git a/ANDROID_3.4.5/sound/soc/kirkwood/kirkwood.h b/ANDROID_3.4.5/sound/soc/kirkwood/kirkwood.h deleted file mode 100644 index 9047436b..00000000 --- a/ANDROID_3.4.5/sound/soc/kirkwood/kirkwood.h +++ /dev/null @@ -1,128 +0,0 @@ -/* - * kirkwood.h - * - * (c) 2010 Arnaud Patard <apatard@mandriva.com> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - */ - -#ifndef _KIRKWOOD_AUDIO_H -#define _KIRKWOOD_AUDIO_H - -#define KIRKWOOD_RECORD_WIN 0 -#define KIRKWOOD_PLAYBACK_WIN 1 -#define KIRKWOOD_MAX_AUDIO_WIN 2 - -#define KIRKWOOD_AUDIO_WIN_BASE_REG(win) (0xA00 + ((win)<<3)) -#define KIRKWOOD_AUDIO_WIN_CTRL_REG(win) (0xA04 + ((win)<<3)) - - -#define KIRKWOOD_RECCTL 0x1000 -#define KIRKWOOD_RECCTL_SPDIF_EN (1<<11) -#define KIRKWOOD_RECCTL_I2S_EN (1<<10) -#define KIRKWOOD_RECCTL_PAUSE (1<<9) -#define KIRKWOOD_RECCTL_MUTE (1<<8) -#define KIRKWOOD_RECCTL_BURST_MASK (3<<5) -#define KIRKWOOD_RECCTL_BURST_128 (2<<5) -#define KIRKWOOD_RECCTL_BURST_32 (1<<5) -#define KIRKWOOD_RECCTL_MONO (1<<4) -#define KIRKWOOD_RECCTL_MONO_CHAN_RIGHT (1<<3) -#define KIRKWOOD_RECCTL_MONO_CHAN_LEFT (0<<3) -#define KIRKWOOD_RECCTL_SIZE_MASK (7<<0) -#define KIRKWOOD_RECCTL_SIZE_16 (7<<0) -#define KIRKWOOD_RECCTL_SIZE_16_C (3<<0) -#define KIRKWOOD_RECCTL_SIZE_20 (2<<0) -#define KIRKWOOD_RECCTL_SIZE_24 (1<<0) -#define KIRKWOOD_RECCTL_SIZE_32 (0<<0) - -#define KIRKWOOD_REC_BUF_ADDR 0x1004 -#define KIRKWOOD_REC_BUF_SIZE 0x1008 -#define KIRKWOOD_REC_BYTE_COUNT 0x100C - -#define KIRKWOOD_PLAYCTL 0x1100 -#define KIRKWOOD_PLAYCTL_PLAY_BUSY (1<<16) -#define KIRKWOOD_PLAYCTL_BURST_MASK (3<<11) -#define KIRKWOOD_PLAYCTL_BURST_128 (2<<11) -#define KIRKWOOD_PLAYCTL_BURST_32 (1<<11) -#define KIRKWOOD_PLAYCTL_PAUSE (1<<9) -#define KIRKWOOD_PLAYCTL_SPDIF_MUTE (1<<8) -#define KIRKWOOD_PLAYCTL_MONO_MASK (3<<5) -#define KIRKWOOD_PLAYCTL_MONO_BOTH (3<<5) -#define KIRKWOOD_PLAYCTL_MONO_OFF (0<<5) -#define KIRKWOOD_PLAYCTL_I2S_MUTE (1<<7) -#define KIRKWOOD_PLAYCTL_SPDIF_EN (1<<4) -#define KIRKWOOD_PLAYCTL_I2S_EN (1<<3) -#define KIRKWOOD_PLAYCTL_SIZE_MASK (7<<0) -#define KIRKWOOD_PLAYCTL_SIZE_16 (7<<0) -#define KIRKWOOD_PLAYCTL_SIZE_16_C (3<<0) -#define KIRKWOOD_PLAYCTL_SIZE_20 (2<<0) -#define KIRKWOOD_PLAYCTL_SIZE_24 (1<<0) -#define KIRKWOOD_PLAYCTL_SIZE_32 (0<<0) - -#define KIRKWOOD_PLAY_BUF_ADDR 0x1104 -#define KIRKWOOD_PLAY_BUF_SIZE 0x1108 -#define KIRKWOOD_PLAY_BYTE_COUNT 0x110C - -#define KIRKWOOD_DCO_CTL 0x1204 -#define KIRKWOOD_DCO_CTL_OFFSET_MASK (0xFFF<<2) -#define KIRKWOOD_DCO_CTL_OFFSET_0 (0x800<<2) -#define KIRKWOOD_DCO_CTL_FREQ_MASK (3<<0) -#define KIRKWOOD_DCO_CTL_FREQ_11 (0<<0) -#define KIRKWOOD_DCO_CTL_FREQ_12 (1<<0) -#define KIRKWOOD_DCO_CTL_FREQ_24 (2<<0) - -#define KIRKWOOD_DCO_SPCR_STATUS 0x120c -#define KIRKWOOD_DCO_SPCR_STATUS_DCO_LOCK (1<<16) - -#define KIRKWOOD_ERR_CAUSE 0x1300 -#define KIRKWOOD_ERR_MASK 0x1304 - -#define KIRKWOOD_INT_CAUSE 0x1308 -#define KIRKWOOD_INT_MASK 0x130C -#define KIRKWOOD_INT_CAUSE_PLAY_BYTES (1<<14) -#define KIRKWOOD_INT_CAUSE_REC_BYTES (1<<13) -#define KIRKWOOD_INT_CAUSE_DMA_PLAY_END (1<<7) -#define KIRKWOOD_INT_CAUSE_DMA_PLAY_3Q (1<<6) -#define KIRKWOOD_INT_CAUSE_DMA_PLAY_HALF (1<<5) -#define KIRKWOOD_INT_CAUSE_DMA_PLAY_1Q (1<<4) -#define KIRKWOOD_INT_CAUSE_DMA_REC_END (1<<3) -#define KIRKWOOD_INT_CAUSE_DMA_REC_3Q (1<<2) -#define KIRKWOOD_INT_CAUSE_DMA_REC_HALF (1<<1) -#define KIRKWOOD_INT_CAUSE_DMA_REC_1Q (1<<0) - -#define KIRKWOOD_REC_BYTE_INT_COUNT 0x1310 -#define KIRKWOOD_PLAY_BYTE_INT_COUNT 0x1314 -#define KIRKWOOD_BYTE_INT_COUNT_MASK 0xffffff - -#define KIRKWOOD_I2S_PLAYCTL 0x2508 -#define KIRKWOOD_I2S_RECCTL 0x2408 -#define KIRKWOOD_I2S_CTL_JUST_MASK (0xf<<26) -#define KIRKWOOD_I2S_CTL_LJ (0<<26) -#define KIRKWOOD_I2S_CTL_I2S (5<<26) -#define KIRKWOOD_I2S_CTL_RJ (8<<26) -#define KIRKWOOD_I2S_CTL_SIZE_MASK (3<<30) -#define KIRKWOOD_I2S_CTL_SIZE_16 (3<<30) -#define KIRKWOOD_I2S_CTL_SIZE_20 (2<<30) -#define KIRKWOOD_I2S_CTL_SIZE_24 (1<<30) -#define KIRKWOOD_I2S_CTL_SIZE_32 (0<<30) - -#define KIRKWOOD_AUDIO_BUF_MAX (16*1024*1024) - -/* Theses values come from the marvell alsa driver */ -/* need to find where they come from */ -#define KIRKWOOD_SND_MIN_PERIODS 8 -#define KIRKWOOD_SND_MAX_PERIODS 16 -#define KIRKWOOD_SND_MIN_PERIOD_BYTES 0x4000 -#define KIRKWOOD_SND_MAX_PERIOD_BYTES 0x4000 - -struct kirkwood_dma_data { - struct resource *mem; - void __iomem *io; - int irq; - int burst; -}; - -#endif |