summaryrefslogtreecommitdiff
path: root/target/linux/xburst/files-2.6.32/sound
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/xburst/files-2.6.32/sound')
-rw-r--r--target/linux/xburst/files-2.6.32/sound/soc/codecs/jzcodec.c520
-rw-r--r--target/linux/xburst/files-2.6.32/sound/soc/codecs/jzcodec.h22
-rw-r--r--target/linux/xburst/files-2.6.32/sound/soc/jz4740/Kconfig37
-rw-r--r--target/linux/xburst/files-2.6.32/sound/soc/jz4740/Makefile17
-rw-r--r--target/linux/xburst/files-2.6.32/sound/soc/jz4740/jz4740-i2s.c570
-rw-r--r--target/linux/xburst/files-2.6.32/sound/soc/jz4740/jz4740-i2s.h18
-rw-r--r--target/linux/xburst/files-2.6.32/sound/soc/jz4740/jz4740-pcm.c345
-rw-r--r--target/linux/xburst/files-2.6.32/sound/soc/jz4740/jz4740-pcm.h22
-rw-r--r--target/linux/xburst/files-2.6.32/sound/soc/jz4740/n516.c303
-rw-r--r--target/linux/xburst/files-2.6.32/sound/soc/jz4740/n526.c169
-rw-r--r--target/linux/xburst/files-2.6.32/sound/soc/jz4740/qi_lb60.c182
11 files changed, 0 insertions, 2205 deletions
diff --git a/target/linux/xburst/files-2.6.32/sound/soc/codecs/jzcodec.c b/target/linux/xburst/files-2.6.32/sound/soc/codecs/jzcodec.c
deleted file mode 100644
index 5d8020c1c0..0000000000
--- a/target/linux/xburst/files-2.6.32/sound/soc/codecs/jzcodec.c
+++ /dev/null
@@ -1,520 +0,0 @@
-/*
- * Copyright (C) 2009, Lars-Peter Clausen <lars@metafoo.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/platform_device.h>
-#include <linux/delay.h>
-
-#include <sound/core.h>
-#include <sound/pcm.h>
-#include <sound/pcm_params.h>
-#include <sound/initval.h>
-#include <sound/soc-dapm.h>
-#include <sound/soc.h>
-
-#define JZ_REG_CODEC_1 0x0
-#define JZ_REG_CODEC_2 0x1
-
-#define JZ_CODEC_1_LINE_ENABLE BIT(29)
-#define JZ_CODEC_1_MIC_ENABLE BIT(28)
-#define JZ_CODEC_1_SW1_ENABLE BIT(27)
-#define JZ_CODEC_1_ADC_ENABLE BIT(26)
-#define JZ_CODEC_1_SW2_ENABLE BIT(25)
-#define JZ_CODEC_1_DAC_ENABLE BIT(24)
-#define JZ_CODEC_1_VREF_DISABLE BIT(20)
-#define JZ_CODEC_1_VREF_AMP_DISABLE BIT(19)
-#define JZ_CODEC_1_VREF_PULL_DOWN BIT(18)
-#define JZ_CODEC_1_VREF_LOW_CURRENT BIT(17)
-#define JZ_CODEC_1_VREF_HIGH_CURRENT BIT(16)
-#define JZ_CODEC_1_HEADPHONE_DISABLE BIT(14)
-#define JZ_CODEC_1_HEADPHONE_AMP_CHANGE_ANY BIT(13)
-#define JZ_CODEC_1_HEADPHONE_CHANGE BIT(12)
-#define JZ_CODEC_1_HEADPHONE_PULL_DOWN_M BIT(11)
-#define JZ_CODEC_1_HEADPHONE_PULL_DOWN_R BIT(10)
-#define JZ_CODEC_1_HEADPHONE_POWER_DOWN_M BIT(9)
-#define JZ_CODEC_1_HEADPHONE_POWER_DOWN BIT(8)
-#define JZ_CODEC_1_SUSPEND BIT(1)
-#define JZ_CODEC_1_RESET BIT(0)
-
-#define JZ_CODEC_1_LINE_ENABLE_OFFSET 29
-#define JZ_CODEC_1_MIC_ENABLE_OFFSET 28
-#define JZ_CODEC_1_SW1_ENABLE_OFFSET 27
-#define JZ_CODEC_1_ADC_ENABLE_OFFSET 26
-#define JZ_CODEC_1_SW2_ENABLE_OFFSET 25
-#define JZ_CODEC_1_DAC_ENABLE_OFFSET 24
-#define JZ_CODEC_1_HEADPHONE_DISABLE_OFFSET 14
-#define JZ_CODEC_1_HEADPHONE_POWER_DOWN_OFFSET 8
-
-#define JZ_CODEC_2_INPUT_VOLUME_MASK 0x1f0000
-#define JZ_CODEC_2_SAMPLE_RATE_MASK 0x000f00
-#define JZ_CODEC_2_MIC_BOOST_GAIN_MASK 0x000030
-#define JZ_CODEC_2_HEADPHONE_VOLUME_MASK 0x000003
-
-#define JZ_CODEC_2_INPUT_VOLUME_OFFSET 16
-#define JZ_CODEC_2_SAMPLE_RATE_OFFSET 8
-#define JZ_CODEC_2_MIC_BOOST_GAIN_OFFSET 4
-#define JZ_CODEC_2_HEADPHONE_VOLUME_OFFSET 0
-
-struct jz_codec {
- void __iomem *base;
- struct resource *mem;
-
- uint32_t reg_cache[2];
- struct snd_soc_codec codec;
-};
-
-inline static struct jz_codec *codec_to_jz(struct snd_soc_codec *codec)
-{
- return container_of(codec, struct jz_codec, codec);
-}
-
-static unsigned int jz_codec_read(struct snd_soc_codec *codec, unsigned int reg)
-{
- struct jz_codec *jz_codec = codec_to_jz(codec);
- return readl(jz_codec->base + (reg << 2));
-}
-
-static int jz_codec_write(struct snd_soc_codec *codec, unsigned int reg,
-unsigned int val)
-{
- struct jz_codec *jz_codec = codec_to_jz(codec);
- jz_codec->reg_cache[reg] = val;
-
- writel(val, jz_codec->base + (reg << 2));
- return 0;
-}
-
-static const struct snd_kcontrol_new jz_codec_controls[] = {
- SOC_SINGLE("Master Playback Volume", JZ_REG_CODEC_2,
- JZ_CODEC_2_HEADPHONE_VOLUME_OFFSET, 3, 0),
- SOC_SINGLE("Capture Volume", JZ_REG_CODEC_2,
- JZ_CODEC_2_INPUT_VOLUME_OFFSET, 31, 0),
- SOC_SINGLE("Master Playback Switch", JZ_REG_CODEC_1,
- JZ_CODEC_1_HEADPHONE_DISABLE_OFFSET, 1, 1),
- SOC_SINGLE("Mic Capture Volume", JZ_REG_CODEC_2,
- JZ_CODEC_2_MIC_BOOST_GAIN_OFFSET, 3, 0),
-};
-
-static const struct snd_kcontrol_new jz_codec_output_controls[] = {
- SOC_DAPM_SINGLE("Bypass Switch", JZ_REG_CODEC_1,
- JZ_CODEC_1_SW1_ENABLE_OFFSET, 1, 0),
- SOC_DAPM_SINGLE("DAC Switch", JZ_REG_CODEC_1,
- JZ_CODEC_1_SW2_ENABLE_OFFSET, 1, 0),
-};
-
-static const struct snd_kcontrol_new jz_codec_input_controls[] =
-{
- SOC_DAPM_SINGLE("Line Capture Switch", JZ_REG_CODEC_1,
- JZ_CODEC_1_LINE_ENABLE_OFFSET, 1, 0),
- SOC_DAPM_SINGLE("Mic Capture Switch", JZ_REG_CODEC_1,
- JZ_CODEC_1_MIC_ENABLE_OFFSET, 1, 0),
-};
-
-static const struct snd_soc_dapm_widget jz_codec_dapm_widgets[] = {
- SND_SOC_DAPM_ADC("ADC", "Capture", JZ_REG_CODEC_1,
- JZ_CODEC_1_ADC_ENABLE_OFFSET, 0),
- SND_SOC_DAPM_DAC("DAC", "Playback", JZ_REG_CODEC_1,
- JZ_CODEC_1_DAC_ENABLE_OFFSET, 0),
-
- SND_SOC_DAPM_MIXER("Output Mixer", JZ_REG_CODEC_1,
- JZ_CODEC_1_HEADPHONE_POWER_DOWN_OFFSET, 1,
- jz_codec_output_controls,
- ARRAY_SIZE(jz_codec_output_controls)),
-
- SND_SOC_DAPM_MIXER_NAMED_CTL("Input Mixer", SND_SOC_NOPM, 0, 0,
- jz_codec_input_controls,
- ARRAY_SIZE(jz_codec_input_controls)),
- SND_SOC_DAPM_MIXER("Line Input", SND_SOC_NOPM, 0, 0, NULL, 0),
-
- SND_SOC_DAPM_OUTPUT("LOUT"),
- SND_SOC_DAPM_OUTPUT("ROUT"),
-
- SND_SOC_DAPM_INPUT("MIC"),
- SND_SOC_DAPM_INPUT("LIN"),
- SND_SOC_DAPM_INPUT("RIN"),
-};
-
-static const struct snd_soc_dapm_route jz_codec_dapm_routes[] = {
-
- {"Line Input", NULL, "LIN"},
- {"Line Input", NULL, "RIN"},
-
- {"Input Mixer", "Line Capture Switch", "Line Input"},
- {"Input Mixer", "Mic Capture Switch", "MIC"},
-
- {"ADC", NULL, "Input Mixer"},
-
- {"Output Mixer", "Bypass Switch", "Input Mixer"},
- {"Output Mixer", "DAC Switch", "DAC"},
-
- {"LOUT", NULL, "Output Mixer"},
- {"ROUT", NULL, "Output Mixer"},
-};
-
-static int jz_codec_hw_params(struct snd_pcm_substream *substream, struct
-snd_pcm_hw_params *params, struct snd_soc_dai *dai)
-{
- uint32_t val;
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct snd_soc_device *socdev = rtd->socdev;
- struct snd_soc_codec *codec = socdev->card->codec;
-
- switch (params_format(params)) {
- case SNDRV_PCM_FORMAT_S8:
- case SNDRV_PCM_FORMAT_S16_LE:
- case SNDRV_PCM_FORMAT_S18_3LE:
- break;
- default:
- return -EINVAL;
- break;
- }
-
- switch (params_rate(params)) {
- case 8000:
- val = 0;
- break;
- case 11025:
- val = 1;
- break;
- case 12000:
- val = 2;
- break;
- case 16000:
- val = 3;
- break;
- case 22050:
- val = 4;
- break;
- case 24000:
- val = 5;
- break;
- case 32000:
- val = 6;
- break;
- case 44100:
- val = 7;
- break;
- case 48000:
- val = 8;
- break;
- default:
- return -EINVAL;
- }
-
- val <<= JZ_CODEC_2_SAMPLE_RATE_OFFSET;
-
- snd_soc_update_bits(codec, JZ_REG_CODEC_2,
- JZ_CODEC_2_SAMPLE_RATE_MASK, val);
-
- return 0;
-}
-
-static int jz_codec_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
-{
- switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
- case SND_SOC_DAIFMT_CBM_CFM:
- break;
- default:
- return -EINVAL;
- }
-
- switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
- case SND_SOC_DAIFMT_I2S:
- break;
- default:
- return -EINVAL;
- }
-
- switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
- case SND_SOC_DAIFMT_NB_NF:
- break;
- default:
- return -EINVAL;
- }
-
- return 0;
-}
-
-static int jz_codec_set_sysclk(struct snd_soc_dai *codec_dai,
- int clk_id, unsigned int freq, int dir)
-{
- return 0;
-}
-
-
-static struct snd_soc_dai_ops jz_codec_dai_ops = {
- .hw_params = jz_codec_hw_params,
- .set_fmt = jz_codec_set_fmt,
-/* .set_clkdiv = jz_codec_set_clkdiv,*/
- .set_sysclk = jz_codec_set_sysclk,
-};
-
-struct snd_soc_dai jz_codec_dai = {
- .name = "jz-codec",
- .playback = {
- .stream_name = "Playback",
- .channels_min = 2,
- .channels_max = 2,
- .rates = SNDRV_PCM_RATE_8000_44100,
- .formats = SNDRV_PCM_FMTBIT_S16_LE,
- },
- .capture = {
- .stream_name = "Capture",
- .channels_min = 2,
- .channels_max = 2,
- .rates = SNDRV_PCM_RATE_8000_44100,
- .formats = SNDRV_PCM_FMTBIT_S16_LE,
- },
- .ops = &jz_codec_dai_ops,
- .symmetric_rates = 1,
-};
-EXPORT_SYMBOL_GPL(jz_codec_dai);
-
-static int jz_codec_set_bias_level(struct snd_soc_codec *codec,
- enum snd_soc_bias_level level)
-{
-
- if (codec->bias_level == SND_SOC_BIAS_OFF && level != SND_SOC_BIAS_OFF) {
- snd_soc_update_bits(codec, JZ_REG_CODEC_1,
- JZ_CODEC_1_RESET, JZ_CODEC_1_RESET);
- udelay(2);
-
- snd_soc_update_bits(codec, JZ_REG_CODEC_1,
- JZ_CODEC_1_SUSPEND | JZ_CODEC_1_RESET, 0);
- }
- switch (level) {
- case SND_SOC_BIAS_ON:
- snd_soc_update_bits(codec, JZ_REG_CODEC_1,
- JZ_CODEC_1_VREF_DISABLE | JZ_CODEC_1_VREF_AMP_DISABLE |
- JZ_CODEC_1_HEADPHONE_POWER_DOWN_M |
- JZ_CODEC_1_VREF_LOW_CURRENT | JZ_CODEC_1_VREF_HIGH_CURRENT,
- 0);
- break;
- case SND_SOC_BIAS_PREPARE:
- snd_soc_update_bits(codec, JZ_REG_CODEC_1,
- JZ_CODEC_1_VREF_LOW_CURRENT | JZ_CODEC_1_VREF_HIGH_CURRENT,
- JZ_CODEC_1_VREF_LOW_CURRENT | JZ_CODEC_1_VREF_HIGH_CURRENT);
- break;
- case SND_SOC_BIAS_STANDBY:
- snd_soc_update_bits(codec, JZ_REG_CODEC_1,
- JZ_CODEC_1_VREF_DISABLE | JZ_CODEC_1_VREF_AMP_DISABLE,
- JZ_CODEC_1_VREF_DISABLE | JZ_CODEC_1_VREF_AMP_DISABLE);
- break;
- case SND_SOC_BIAS_OFF:
- snd_soc_update_bits(codec, JZ_REG_CODEC_1,
- JZ_CODEC_1_SUSPEND, JZ_CODEC_1_SUSPEND);
- break;
- }
- codec->bias_level = level;
-
- return 0;
-}
-
-
-static struct snd_soc_codec *jz_codec_codec;
-
-static int jz_codec_dev_probe(struct platform_device *pdev)
-{
- int ret;
- struct snd_soc_device *socdev = platform_get_drvdata(pdev);
- struct snd_soc_codec *codec = jz_codec_codec;
-
- BUG_ON(!codec);
-
- socdev->card->codec = codec;
-
- ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1);
- if (ret) {
- dev_err(&pdev->dev, "Failed to create pcms: %d\n", ret);
- goto err;
- }
- snd_soc_add_controls(codec, jz_codec_controls,
- ARRAY_SIZE(jz_codec_controls));
-
- snd_soc_dapm_new_controls(codec, jz_codec_dapm_widgets,
- ARRAY_SIZE(jz_codec_dapm_widgets));
-
- snd_soc_dapm_add_routes(codec, jz_codec_dapm_routes,
- ARRAY_SIZE(jz_codec_dapm_routes));
-
- snd_soc_dapm_new_widgets(codec);
-
- ret = snd_soc_init_card(socdev);
-
- if (ret) {
- dev_err(&pdev->dev, "Failed to register card\n");
- goto err;
- }
-
- return 0;
-
-err:
- snd_soc_free_pcms(socdev);
- snd_soc_dapm_free(socdev);
-
- return ret;
-}
-
-static int jz_codec_dev_remove(struct platform_device *pdev)
-{
- struct snd_soc_device *socdev = platform_get_drvdata(pdev);
- snd_soc_free_pcms(socdev);
- snd_soc_dapm_free(socdev);
-
- return 0;
-}
-
-struct snd_soc_codec_device soc_codec_dev_jzcodec = {
- .probe = jz_codec_dev_probe,
- .remove = jz_codec_dev_remove,
-};
-EXPORT_SYMBOL_GPL(soc_codec_dev_jzcodec);
-
-static int __devinit jz_codec_probe(struct platform_device *pdev)
-{
- int ret;
- struct jz_codec *jz_codec;
- struct snd_soc_codec *codec;
-
- jz_codec = kzalloc(sizeof(*jz_codec), GFP_KERNEL);
-
- if (!jz_codec)
- return -ENOMEM;
-
- jz_codec->mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-
- if (!jz_codec->mem) {
- dev_err(&pdev->dev, "Failed to get mmio memory resource\n");
- ret = -ENOENT;
- goto err_free_jz_codec;
- }
-
- jz_codec->mem = request_mem_region(jz_codec->mem->start,
- resource_size(jz_codec->mem), pdev->name);
-
- if (!jz_codec->mem) {
- dev_err(&pdev->dev, "Failed to request mmio memory region\n");
- ret = -EBUSY;
- goto err_free_jz_codec;
- }
-
- jz_codec->base = ioremap(jz_codec->mem->start, resource_size(jz_codec->mem));
-
- if (!jz_codec->base) {
- dev_err(&pdev->dev, "Failed to ioremap mmio memory\n");
- ret = -EBUSY;
- goto err_release_mem_region;
- }
-
- jz_codec_dai.dev = &pdev->dev;
-
- codec = &jz_codec->codec;
-
- codec->dev = &pdev->dev;
- codec->name = "jz-codec";
- codec->owner = THIS_MODULE;
-
- codec->read = jz_codec_read;
- codec->write = jz_codec_write;
- codec->set_bias_level = jz_codec_set_bias_level;
- codec->bias_level = SND_SOC_BIAS_OFF;
-
- codec->dai = &jz_codec_dai;
- codec->num_dai = 1;
-
- codec->reg_cache = jz_codec->reg_cache;
- codec->reg_cache_size = 2;
-
- codec->private_data = jz_codec;
-
- mutex_init(&codec->mutex);
- INIT_LIST_HEAD(&codec->dapm_widgets);
- INIT_LIST_HEAD(&codec->dapm_paths);
-
- jz_codec_codec = codec;
-
- snd_soc_update_bits(codec, JZ_REG_CODEC_1,
- JZ_CODEC_1_SW2_ENABLE, JZ_CODEC_1_SW2_ENABLE);
-
-
- platform_set_drvdata(pdev, jz_codec);
- ret = snd_soc_register_codec(codec);
-
- if (ret) {
- dev_err(&pdev->dev, "Failed to register codec\n");
- goto err_iounmap;
- }
-
- ret = snd_soc_register_dai(&jz_codec_dai);
- if (ret) {
- dev_err(&pdev->dev, "Failed to register codec dai\n");
- goto err_unregister_codec;
- }
-
- jz_codec_set_bias_level (codec, SND_SOC_BIAS_STANDBY);
-
- return 0;
-err_unregister_codec:
- snd_soc_unregister_codec(codec);
-err_iounmap:
- iounmap(jz_codec->base);
-err_release_mem_region:
- release_mem_region(jz_codec->mem->start, resource_size(jz_codec->mem));
-err_free_jz_codec:
- kfree(jz_codec);
-
- return ret;
-}
-
-static int __devexit jz_codec_remove(struct platform_device *pdev)
-{
- struct jz_codec *jz_codec = platform_get_drvdata(pdev);
-
- snd_soc_unregister_dai(&jz_codec_dai);
- snd_soc_unregister_codec(&jz_codec->codec);
-
- iounmap(jz_codec->base);
- release_mem_region(jz_codec->mem->start, resource_size(jz_codec->mem));
-
- platform_set_drvdata(pdev, NULL);
- kfree(jz_codec);
-
- return 0;
-}
-
-static struct platform_driver jz_codec_driver = {
- .probe = jz_codec_probe,
- .remove = __devexit_p(jz_codec_remove),
- .driver = {
- .name = "jz4740-codec",
- .owner = THIS_MODULE,
- },
-};
-
-static int __init jz_codec_init(void)
-{
- return platform_driver_register(&jz_codec_driver);
-}
-module_init(jz_codec_init);
-
-static void __exit jz_codec_exit(void)
-{
- platform_driver_unregister(&jz_codec_driver);
-}
-module_exit(jz_codec_exit);
-
-MODULE_DESCRIPTION("JZ4720/JZ4740 SoC internal codec driver");
-MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");
-MODULE_LICENSE("GPL v2");
-MODULE_ALIAS("platform:jz-codec");
diff --git a/target/linux/xburst/files-2.6.32/sound/soc/codecs/jzcodec.h b/target/linux/xburst/files-2.6.32/sound/soc/codecs/jzcodec.h
deleted file mode 100644
index 05c57b8f05..0000000000
--- a/target/linux/xburst/files-2.6.32/sound/soc/codecs/jzcodec.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright (C) 2009, Lars-Peter Clausen <lars@metafoo.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-#ifndef _ICODEC_H
-#define _ICODEC_H
-
-#define JZCODEC_SYSCLK 0
-
-extern struct snd_soc_dai jz_codec_dai;
-extern struct snd_soc_codec_device soc_codec_dev_jzcodec;
-
-#endif
diff --git a/target/linux/xburst/files-2.6.32/sound/soc/jz4740/Kconfig b/target/linux/xburst/files-2.6.32/sound/soc/jz4740/Kconfig
deleted file mode 100644
index 93dabb06a0..0000000000
--- a/target/linux/xburst/files-2.6.32/sound/soc/jz4740/Kconfig
+++ /dev/null
@@ -1,37 +0,0 @@
-config SND_JZ4740_SOC
- tristate "SoC Audio for Ingenic JZ4740 SoC"
- depends on SOC_JZ4740 && SND_SOC
- help
- Say Y or M if you want to add support for codecs attached to
- the Jz4740 AC97, I2S or SSP interface. You will also need
- to select the audio interfaces to support below.
-
-config SND_JZ4740_SOC_QI_LB60
- tristate "SoC Audio support for Qi Hardware Ben Nanonote"
- depends on SND_JZ4740_SOC && JZ4740_QI_LB60
- select SND_JZ4740_SOC_I2S
- select SND_SOC_JZCODEC
- help
- Say Y if you want to add support for SoC audio of internal codec on Ingenic Jz4740 QI_LB60 board.
-
-config SND_JZ4740_SOC_N516
- tristate "SoC Audio support for Hanvon N516 eBook reader"
- depends on SND_JZ4740_SOC && JZ4740_N516
- select SND_JZ4740_SOC_I2S
- select SND_SOC_JZCODEC
- help
- Say Y if you want to enable support for SoC audio on the Hanvon N516.
-
-config SND_JZ4740_SOC_N526
- tristate "SoC Audio support for Hanvon N526 eBook reader"
- depends on SND_JZ4740_SOC && JZ4740_N526
- select SND_JZ4740_SOC_I2S
- select SND_SOC_JZCODEC
- help
- Say Y if you want to enable support for SoC audio on the Hanvon N526.
-
-config SND_JZ4740_SOC_I2S
- depends on SND_JZ4740_SOC
- tristate "SoC Audio (I2S protocol) for Ingenic jz4740 chip"
- help
- Say Y if you want to use I2S protocol and I2S codec on Ingenic Jz4740 QI_LB60 board.
diff --git a/target/linux/xburst/files-2.6.32/sound/soc/jz4740/Makefile b/target/linux/xburst/files-2.6.32/sound/soc/jz4740/Makefile
deleted file mode 100644
index e7952d3b80..0000000000
--- a/target/linux/xburst/files-2.6.32/sound/soc/jz4740/Makefile
+++ /dev/null
@@ -1,17 +0,0 @@
-#
-# Jz4740 Platform Support
-#
-snd-soc-jz4740-objs := jz4740-pcm.o
-snd-soc-jz4740-i2s-objs := jz4740-i2s.o
-
-obj-$(CONFIG_SND_JZ4740_SOC) += snd-soc-jz4740.o
-obj-$(CONFIG_SND_JZ4740_SOC_I2S) += snd-soc-jz4740-i2s.o
-
-# Jz4740 Machine Support
-snd-soc-qi-lb60-objs := qi_lb60.o
-snd-soc-n516-objs := n516.o
-snd-soc-n526-objs := n526.o
-
-obj-$(CONFIG_SND_JZ4740_SOC_QI_LB60) += snd-soc-qi-lb60.o
-obj-$(CONFIG_SND_JZ4740_SOC_N516) += snd-soc-n516.o
-obj-$(CONFIG_SND_JZ4740_SOC_N526) += snd-soc-n526.o
diff --git a/target/linux/xburst/files-2.6.32/sound/soc/jz4740/jz4740-i2s.c b/target/linux/xburst/files-2.6.32/sound/soc/jz4740/jz4740-i2s.c
deleted file mode 100644
index c1e070bfd3..0000000000
--- a/target/linux/xburst/files-2.6.32/sound/soc/jz4740/jz4740-i2s.c
+++ /dev/null
@@ -1,570 +0,0 @@
-/*
- * Copyright (C) 2010, Lars-Peter Clausen <lars@metafoo.de>
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/dma-mapping.h>
-#include <linux/platform_device.h>
-#include <linux/clk.h>
-#include <linux/io.h>
-#include <linux/delay.h>
-
-#include <sound/core.h>
-#include <sound/pcm.h>
-#include <sound/pcm_params.h>
-#include <sound/soc.h>
-#include <sound/soc-dapm.h>
-#include <sound/initval.h>
-
-#include "jz4740-i2s.h"
-#include "jz4740-pcm.h"
-
-#define JZ_REG_AIC_CONF 0x00
-#define JZ_REG_AIC_CTRL 0x04
-#define JZ_REG_AIC_I2S_FMT 0x10
-#define JZ_REG_AIC_FIFO_STATUS 0x14
-#define JZ_REG_AIC_I2S_STATUS 0x1c
-#define JZ_REG_AIC_CLK_DIV 0x30
-#define JZ_REG_AIC_FIFO 0x34
-
-#define JZ_AIC_CONF_FIFO_RX_THRESHOLD_MASK (0xf << 12)
-#define JZ_AIC_CONF_FIFO_TX_THRESHOLD_MASK (0xf << 8)
-#define JZ_AIC_CONF_OVERFLOW_PLAY_LAST BIT(6)
-#define JZ_AIC_CONF_INTERNAL_CODEC BIT(5)
-#define JZ_AIC_CONF_I2S BIT(4)
-#define JZ_AIC_CONF_RESET BIT(3)
-#define JZ_AIC_CONF_BIT_CLK_MASTER BIT(2)
-#define JZ_AIC_CONF_SYNC_CLK_MASTER BIT(1)
-#define JZ_AIC_CONF_ENABLE BIT(0)
-
-#define JZ_AIC_CONF_FIFO_RX_THRESHOLD_OFFSET 12
-#define JZ_AIC_CONF_FIFO_TX_THRESHOLD_OFFSET 8
-
-#define JZ_AIC_CTRL_OUTPUT_SAMPLE_SIZE_MASK (0x7 << 19)
-#define JZ_AIC_CTRL_INPUT_SAMPLE_SIZE_MASK (0x7 << 16)
-#define JZ_AIC_CTRL_ENABLE_RX_DMA BIT(15)
-#define JZ_AIC_CTRL_ENABLE_TX_DMA BIT(14)
-#define JZ_AIC_CTRL_MONO_TO_STEREO BIT(11)
-#define JZ_AIC_CTRL_SWITCH_ENDIANNESS BIT(10)
-#define JZ_AIC_CTRL_SIGNED_TO_UNSIGNED BIT(9)
-#define JZ_AIC_CTRL_FLUSH BIT(8)
-#define JZ_AIC_CTRL_ENABLE_ROR_INT BIT(6)
-#define JZ_AIC_CTRL_ENABLE_TUR_INT BIT(5)
-#define JZ_AIC_CTRL_ENABLE_RFS_INT BIT(4)
-#define JZ_AIC_CTRL_ENABLE_TFS_INT BIT(3)
-#define JZ_AIC_CTRL_ENABLE_LOOPBACK BIT(2)
-#define JZ_AIC_CTRL_ENABLE_PLAYBACK BIT(1)
-#define JZ_AIC_CTRL_ENABLE_CAPTURE BIT(0)
-
-#define JZ_AIC_CTRL_OUTPUT_SAMPLE_SIZE_OFFSET 19
-#define JZ_AIC_CTRL_INPUT_SAMPLE_SIZE_OFFSET 16
-
-#define JZ_AIC_I2S_FMT_DISABLE_BIT_CLK BIT(12)
-#define JZ_AIC_I2S_FMT_ENABLE_SYS_CLK BIT(4)
-#define JZ_AIC_I2S_FMT_MSB BIT(0)
-
-#define JZ_AIC_I2S_STATUS_BUSY BIT(2)
-
-#define JZ_AIC_CLK_DIV_MASK 0xf
-
-struct jz4740_i2s {
- struct resource *mem;
- void __iomem *base;
- dma_addr_t phys_base;
-
- struct clk *clk_aic;
- struct clk *clk_i2s;
-
- struct jz4740_pcm_config pcm_config;
-};
-
-static struct jz4740_dma_config jz4740_i2s_dma_playback_config = {
- .src_width = JZ4740_DMA_WIDTH_16BIT,
- .dst_width = JZ4740_DMA_WIDTH_32BIT,
- .transfer_size = JZ4740_DMA_TRANSFER_SIZE_16BYTE,
- .request_type = JZ4740_DMA_TYPE_AIC_TRANSMIT,
- .flags = JZ4740_DMA_SRC_AUTOINC,
- .mode = JZ4740_DMA_MODE_SINGLE,
-};
-
-static struct jz4740_dma_config jz4740_i2s_dma_capture_config = {
- .src_width = JZ4740_DMA_WIDTH_32BIT,
- .dst_width = JZ4740_DMA_WIDTH_16BIT,
- .transfer_size = JZ4740_DMA_TRANSFER_SIZE_16BYTE,
- .request_type = JZ4740_DMA_TYPE_AIC_RECEIVE,
- .flags = JZ4740_DMA_DST_AUTOINC,
- .mode = JZ4740_DMA_MODE_SINGLE,
-};
-
-
-static inline uint32_t jz4740_i2s_read(const struct jz4740_i2s *i2s, unsigned int reg)
-{
- return readl(i2s->base + reg);
-}
-
-static inline void jz4740_i2s_write(const struct jz4740_i2s *i2s, unsigned
-int reg, uint32_t value)
-{
- writel(value, i2s->base + reg);
-}
-
-static inline struct jz4740_i2s *jz4740_dai_to_i2s(struct snd_soc_dai *dai)
-{
- return dai->private_data;
-}
-
-static int jz4740_i2s_startup(struct snd_pcm_substream *substream, struct
- snd_soc_dai *dai)
-{
- struct jz4740_i2s *i2s = jz4740_dai_to_i2s(dai);
- uint32_t conf, ctrl;
-
- if (dai->active)
- return 0;
-
- conf = jz4740_i2s_read(i2s, JZ_REG_AIC_CONF);
- ctrl = jz4740_i2s_read(i2s, JZ_REG_AIC_CTRL);
-
- conf |= JZ_AIC_CONF_ENABLE;
- ctrl |= JZ_AIC_CTRL_FLUSH;
-
-
- jz4740_i2s_write(i2s, JZ_REG_AIC_CTRL, ctrl);
- clk_enable(i2s->clk_i2s);
- jz4740_i2s_write(i2s, JZ_REG_AIC_CONF, conf);
-
- return 0;
-}
-
-static void jz4740_i2s_shutdown(struct snd_pcm_substream *substream, struct
- snd_soc_dai *dai)
-{
- struct jz4740_i2s *i2s = jz4740_dai_to_i2s(dai);
- uint32_t conf;
-
- if (!dai->active)
- return;
-
- conf = jz4740_i2s_read(i2s, JZ_REG_AIC_CONF);
- conf &= ~JZ_AIC_CONF_ENABLE;
- jz4740_i2s_write(i2s, JZ_REG_AIC_CONF, conf);
-
- clk_disable(i2s->clk_i2s);
-}
-
-
-static int jz4740_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
- struct snd_soc_dai *dai)
-{
- struct jz4740_i2s *i2s = jz4740_dai_to_i2s(dai);
- bool playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK);
-
- uint32_t ctrl;
- uint32_t mask;
-
- if (playback) {
- mask = JZ_AIC_CTRL_ENABLE_PLAYBACK |
- JZ_AIC_CTRL_ENABLE_TX_DMA;
- } else {
- mask = JZ_AIC_CTRL_ENABLE_CAPTURE |
- JZ_AIC_CTRL_ENABLE_RX_DMA;
- }
-
- ctrl = jz4740_i2s_read(i2s, JZ_REG_AIC_CTRL);
-
- switch (cmd) {
- case SNDRV_PCM_TRIGGER_START:
- case SNDRV_PCM_TRIGGER_RESUME:
- case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
- ctrl |= mask;
- break;
- case SNDRV_PCM_TRIGGER_STOP:
- case SNDRV_PCM_TRIGGER_SUSPEND:
- case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
- ctrl &= ~mask;
- break;
- default:
- return -EINVAL;
- }
-
- jz4740_i2s_write(i2s, JZ_REG_AIC_CTRL, ctrl);
-
- return 0;
-}
-
-
-static int jz4740_i2s_set_fmt(struct snd_soc_dai *dai,
- unsigned int fmt)
-{
- struct jz4740_i2s *i2s = jz4740_dai_to_i2s(dai);
-
- uint32_t format = 0;
- uint32_t conf;
-
- conf = jz4740_i2s_read(i2s, JZ_REG_AIC_CONF);
-
- conf &= ~(JZ_AIC_CONF_BIT_CLK_MASTER | JZ_AIC_CONF_SYNC_CLK_MASTER);
-
- switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
- case SND_SOC_DAIFMT_CBS_CFS:
- conf |= JZ_AIC_CONF_BIT_CLK_MASTER |
- JZ_AIC_CONF_SYNC_CLK_MASTER;
- format |= JZ_AIC_I2S_FMT_ENABLE_SYS_CLK;
- break;
- case SND_SOC_DAIFMT_CBM_CFS:
- conf |= JZ_AIC_CONF_SYNC_CLK_MASTER;
- break;
- case SND_SOC_DAIFMT_CBS_CFM:
- conf |= JZ_AIC_CONF_BIT_CLK_MASTER;
- break;
- case SND_SOC_DAIFMT_CBM_CFM:
- break;
- default:
- return -EINVAL;
- }
-
- switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
- case SND_SOC_DAIFMT_MSB:
- format |= JZ_AIC_I2S_FMT_MSB;
- break;
- case SND_SOC_DAIFMT_I2S:
- break;
- default:
- return -EINVAL;
- }
-
- switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
- case SND_SOC_DAIFMT_NB_NF:
- break;
- default:
- return -EINVAL;
- }
-
- jz4740_i2s_write(i2s, JZ_REG_AIC_CONF, conf);
- jz4740_i2s_write(i2s, JZ_REG_AIC_I2S_FMT, format);
-
- return 0;
-}
-
-static int jz4740_i2s_hw_params(struct snd_pcm_substream *substream,
- struct snd_pcm_hw_params *params,
- struct snd_soc_dai *dai)
-{
- struct jz4740_i2s *i2s = jz4740_dai_to_i2s(dai);
- bool playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK);
- int sample_size;
- enum jz4740_dma_width dma_width;
- uint32_t ctrl;
-
- ctrl = jz4740_i2s_read(i2s, JZ_REG_AIC_CTRL);
-
- switch (params_format(params)) {
- case SNDRV_PCM_FORMAT_S8:
- sample_size = 0;
- dma_width = JZ4740_DMA_WIDTH_8BIT;
- break;
- case SNDRV_PCM_FORMAT_S16:
- sample_size = 1;
- dma_width = JZ4740_DMA_WIDTH_16BIT;
- break;
- default:
- return -EINVAL;
- }
-
- if (playback) {
- ctrl &= ~JZ_AIC_CTRL_OUTPUT_SAMPLE_SIZE_MASK;
- ctrl |= sample_size << JZ_AIC_CTRL_OUTPUT_SAMPLE_SIZE_OFFSET;
- } else {
- ctrl &= ~JZ_AIC_CTRL_INPUT_SAMPLE_SIZE_MASK;
- ctrl |= sample_size << JZ_AIC_CTRL_INPUT_SAMPLE_SIZE_OFFSET;
- }
-
- switch (params_channels(params)) {
- case 2:
- break;
- case 1:
- if (playback) {
- ctrl |= JZ_AIC_CTRL_MONO_TO_STEREO;
- break;
- }
- default:
- return -EINVAL;
- }
-
- jz4740_i2s_write(i2s, JZ_REG_AIC_CTRL, ctrl);
-
- /* This is quite ugly, but apperently it's offical method for passing dma
- * config to the pcm module */
- if (playback) {
- jz4740_i2s_dma_playback_config.src_width = dma_width;
- i2s->pcm_config.dma_config = &jz4740_i2s_dma_playback_config;
- } else {
- jz4740_i2s_dma_capture_config.dst_width = dma_width;
- i2s->pcm_config.dma_config = &jz4740_i2s_dma_capture_config;
- }
- i2s->pcm_config.fifo_addr = i2s->phys_base + JZ_REG_AIC_FIFO;
-
- dai->dma_data = &i2s->pcm_config;
-
- return 0;
-}
-
-static int jz4740_i2s_set_clkdiv(struct snd_soc_dai *dai,
- int div_id, int div)
-{
- struct jz4740_i2s *i2s = jz4740_dai_to_i2s(dai);
-
- switch (div_id) {
- case JZ4740_I2S_BIT_CLK:
- if (div & 1 || div > 16)
- return -EINVAL;
- jz4740_i2s_write(i2s, JZ_REG_AIC_CLK_DIV, div - 1);
- break;
- default:
- return -EINVAL;
- }
-
- return 0;
-}
-
-static int jz4740_i2s_set_sysclk(struct snd_soc_dai *dai, int clk_id,
- unsigned int freq, int dir)
-{
- struct jz4740_i2s *i2s = jz4740_dai_to_i2s(dai);
- int ret = 0;
- struct clk *parent;
-
- switch (clk_id) {
- case JZ4740_I2S_CLKSRC_EXT:
- parent = clk_get(NULL, "ext");
- clk_set_parent(i2s->clk_i2s, parent);
- break;
- case JZ4740_I2S_CLKSRC_PLL:
- parent = clk_get(NULL, "pll half");
- clk_set_parent(i2s->clk_i2s, parent);
- ret = clk_set_rate(i2s->clk_i2s, freq);
- break;
- default:
- return -EINVAL;
- }
- clk_put(parent);
-
- return ret;
-}
-
-static int jz4740_i2s_suspend(struct snd_soc_dai *dai)
-{
- struct jz4740_i2s *i2s = jz4740_dai_to_i2s(dai);
- uint32_t conf;
-
- if (dai->active) {
- conf = jz4740_i2s_read(i2s, JZ_REG_AIC_CONF);
- conf &= ~JZ_AIC_CONF_ENABLE;
- jz4740_i2s_write(i2s, JZ_REG_AIC_CONF, conf);
-
- clk_disable(i2s->clk_i2s);
- }
-
- clk_disable(i2s->clk_aic);
-
- return 0;
-}
-
-static int jz4740_i2s_resume(struct snd_soc_dai *dai)
-{
- struct jz4740_i2s *i2s = jz4740_dai_to_i2s(dai);
- uint32_t conf;
-
- clk_enable(i2s->clk_aic);
-
- if (dai->active) {
- clk_enable(i2s->clk_i2s);
-
- conf = jz4740_i2s_read(i2s, JZ_REG_AIC_CONF);
- conf |= JZ_AIC_CONF_ENABLE;
- jz4740_i2s_write(i2s, JZ_REG_AIC_CONF, conf);
-
- }
-
- return 0;
-}
-
-
-static int jz4740_i2s_probe(struct platform_device *pdev, struct snd_soc_dai *dai)
-{
- struct jz4740_i2s *i2s = jz4740_dai_to_i2s(dai);
- uint32_t conf;
-
- conf = (7 << JZ_AIC_CONF_FIFO_RX_THRESHOLD_OFFSET) |
- (8 << JZ_AIC_CONF_FIFO_TX_THRESHOLD_OFFSET) |
- JZ_AIC_CONF_OVERFLOW_PLAY_LAST |
- JZ_AIC_CONF_I2S |
- JZ_AIC_CONF_INTERNAL_CODEC;
-
- jz4740_i2s_write(i2s, JZ_REG_AIC_CONF, JZ_AIC_CONF_RESET);
- jz4740_i2s_write(i2s, JZ_REG_AIC_CONF, conf);
-
- return 0;
-}
-
-
-static struct snd_soc_dai_ops jz4740_i2s_dai_ops = {
- .startup = jz4740_i2s_startup,
- .shutdown = jz4740_i2s_shutdown,
- .trigger = jz4740_i2s_trigger,
- .hw_params = jz4740_i2s_hw_params,
- .set_fmt = jz4740_i2s_set_fmt,
- .set_clkdiv = jz4740_i2s_set_clkdiv,
- .set_sysclk = jz4740_i2s_set_sysclk,
-};
-
-#define JZ4740_I2S_FMTS (SNDRV_PCM_FMTBIT_S8 | \
- SNDRV_PCM_FMTBIT_S16_LE)
-
-struct snd_soc_dai jz4740_i2s_dai = {
- .name = "jz4740-i2s",
- .probe = jz4740_i2s_probe,
- .playback = {
- .channels_min = 1,
- .channels_max = 2,
- .rates = SNDRV_PCM_RATE_8000_44100,
- .formats = JZ4740_I2S_FMTS,
- },
- .capture = {
- .channels_min = 2,
- .channels_max = 2,
- .rates = SNDRV_PCM_RATE_8000_44100,
- .formats = JZ4740_I2S_FMTS,
- },
- .symmetric_rates = 1,
- .ops = &jz4740_i2s_dai_ops,
- .suspend = jz4740_i2s_suspend,
- .resume = jz4740_i2s_resume,
-};
-EXPORT_SYMBOL_GPL(jz4740_i2s_dai);
-
-static int __devinit jz4740_i2s_dev_probe(struct platform_device *pdev)
-{
- struct jz4740_i2s *i2s;
- int ret;
-
- i2s = kzalloc(sizeof(*i2s), GFP_KERNEL);
-
- if (!i2s)
- return -ENOMEM;
-
- i2s->mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-
- if (!i2s->mem) {
- ret = -ENOENT;
- goto err_free;
- }
-
- i2s->mem = request_mem_region(i2s->mem->start, resource_size(i2s->mem),
- pdev->name);
-
- if (!i2s->mem) {
- ret = -EBUSY;
- goto err_free;
- }
-
- i2s->base = ioremap_nocache(i2s->mem->start, resource_size(i2s->mem));
-
- if (!i2s->base) {
- ret = -EBUSY;
- goto err_release_mem_region;
- }
-
- i2s->phys_base = i2s->mem->start;
-
- jz4740_i2s_dai.private_data = i2s;
-
- ret = snd_soc_register_dai(&jz4740_i2s_dai);
-
- i2s->clk_aic = clk_get(&pdev->dev, "aic");
-
- if (IS_ERR(i2s->clk_aic)) {
- ret = PTR_ERR(i2s->clk_aic);
- goto err_iounmap;
- }
-
-
- i2s->clk_i2s = clk_get(&pdev->dev, "i2s");
-
- if (IS_ERR(i2s->clk_i2s)) {
- ret = PTR_ERR(i2s->clk_i2s);
- goto err_iounmap;
- }
-
- clk_enable(i2s->clk_aic);
-
- platform_set_drvdata(pdev, i2s);
-
- return 0;
-
-err_iounmap:
- iounmap(i2s->base);
-err_release_mem_region:
- release_mem_region(i2s->mem->start, resource_size(i2s->mem));
-err_free:
- kfree(i2s);
-
- return ret;
-}
-
-static int __devexit jz4740_i2s_dev_remove(struct platform_device *pdev)
-{
- struct jz4740_i2s *i2s = platform_get_drvdata(pdev);
-
- snd_soc_unregister_dai(&jz4740_i2s_dai);
-
- clk_disable(i2s->clk_aic);
- clk_put(i2s->clk_i2s);
- clk_put(i2s->clk_aic);
-
- iounmap(i2s->base);
- release_mem_region(i2s->mem->start, resource_size(i2s->mem));
-
- platform_set_drvdata(pdev, NULL);
- kfree(i2s);
-
- return 0;
-}
-
-static struct platform_driver jz4740_i2s_driver = {
- .probe = jz4740_i2s_dev_probe,
- .remove = __devexit_p(jz4740_i2s_dev_remove),
- .driver = {
- .name = "jz4740-i2s",
- .owner = THIS_MODULE,
- },
-};
-
-static int __init jz4740_i2s_init(void)
-{
- return platform_driver_register(&jz4740_i2s_driver);
-}
-module_init(jz4740_i2s_init);
-
-static void __exit jz4740_i2s_exit(void)
-{
- platform_driver_unregister(&jz4740_i2s_driver);
-}
-module_exit(jz4740_i2s_exit);
-
-MODULE_AUTHOR("Lars-Peter Clausen, <lars@metafoo.de>");
-MODULE_DESCRIPTION("Ingenic JZ4740 SoC I2S driver");
-MODULE_LICENSE("GPL");
-MODULE_ALIAS("platform:jz4740-i2s");
diff --git a/target/linux/xburst/files-2.6.32/sound/soc/jz4740/jz4740-i2s.h b/target/linux/xburst/files-2.6.32/sound/soc/jz4740/jz4740-i2s.h
deleted file mode 100644
index da22ed88a5..0000000000
--- a/target/linux/xburst/files-2.6.32/sound/soc/jz4740/jz4740-i2s.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#ifndef _JZ4740_I2S_H
-#define _JZ4740_I2S_H
-
-/* I2S clock source */
-#define JZ4740_I2S_CLKSRC_EXT 0
-#define JZ4740_I2S_CLKSRC_PLL 1
-
-#define JZ4740_I2S_BIT_CLK 0
-
-extern struct snd_soc_dai jz4740_i2s_dai;
-
-#endif
diff --git a/target/linux/xburst/files-2.6.32/sound/soc/jz4740/jz4740-pcm.c b/target/linux/xburst/files-2.6.32/sound/soc/jz4740/jz4740-pcm.c
deleted file mode 100644
index 3ccc652a0b..0000000000
--- a/target/linux/xburst/files-2.6.32/sound/soc/jz4740/jz4740-pcm.c
+++ /dev/null
@@ -1,345 +0,0 @@
-/*
- * Copyright (C) 2010, Lars-Peter Clausen <lars@metafoo.de>
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/interrupt.h>
-#include <linux/dma-mapping.h>
-
-#include <sound/core.h>
-#include <sound/pcm.h>
-#include <sound/pcm_params.h>
-#include <sound/soc.h>
-
-#include <asm/mach-jz4740/dma.h>
-#include "jz4740-pcm.h"
-
-struct jz4740_runtime_data {
- unsigned int dma_period;
- dma_addr_t dma_start;
- dma_addr_t dma_pos;
- dma_addr_t dma_end;
-
- struct jz4740_dma_chan *dma;
-
- dma_addr_t fifo_addr;
-};
-
-/* identify hardware playback capabilities */
-static const struct snd_pcm_hardware jz4740_pcm_hardware = {
- .info = SNDRV_PCM_INFO_MMAP |
- SNDRV_PCM_INFO_MMAP_VALID |
- SNDRV_PCM_INFO_INTERLEAVED |
- SNDRV_PCM_INFO_BLOCK_TRANSFER,
- .formats = SNDRV_PCM_FMTBIT_S16_LE |
- SNDRV_PCM_FMTBIT_S8,
- .rates = SNDRV_PCM_RATE_8000_48000,
- .channels_min = 1,
- .channels_max = 2,
- .period_bytes_min = 32,
- .period_bytes_max = 2 * PAGE_SIZE,
- .periods_min = 2,
- .periods_max = 128,
- .buffer_bytes_max = 128 * 2 * PAGE_SIZE,
- .fifo_size = 32,
-};
-
-static void jz4740_pcm_start_transfer(struct jz4740_runtime_data *prtd, int stream)
-{
- unsigned int count;
-
- if (prtd->dma_pos + prtd->dma_period > prtd->dma_end)
- count = prtd->dma_end - prtd->dma_pos;
- else
- count = prtd->dma_period;
-
- jz4740_dma_disable(prtd->dma);
-
- if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
- jz4740_dma_set_src_addr(prtd->dma, prtd->dma_pos);
- jz4740_dma_set_dst_addr(prtd->dma, prtd->fifo_addr);
- } else {
- jz4740_dma_set_src_addr(prtd->dma, prtd->fifo_addr);
- jz4740_dma_set_dst_addr(prtd->dma, prtd->dma_pos);
- }
-
- jz4740_dma_set_transfer_count(prtd->dma, count);
-
- jz4740_dma_enable(prtd->dma);
-
- prtd->dma_pos += prtd->dma_period;
- if (prtd->dma_pos >= prtd->dma_end)
- prtd->dma_pos = prtd->dma_start;
-}
-
-static void jz4740_pcm_dma_transfer_done(struct jz4740_dma_chan *dma, int err,
- void *dev_id)
-{
- struct snd_pcm_substream *substream = dev_id;
- struct snd_pcm_runtime *runtime = substream->runtime;
- struct jz4740_runtime_data *prtd = runtime->private_data;
-
- snd_pcm_period_elapsed(substream);
-
- jz4740_pcm_start_transfer(prtd, substream->stream);
-}
-
-static int jz4740_pcm_hw_params(struct snd_pcm_substream *substream,
- struct snd_pcm_hw_params *params)
-{
- struct snd_pcm_runtime *runtime = substream->runtime;
- struct jz4740_runtime_data *prtd = runtime->private_data;
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct jz4740_pcm_config *config;
-
- config = rtd->dai->cpu_dai->dma_data;
- if (!prtd->dma) {
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
- prtd->dma = jz4740_dma_request(substream, "PCM Playback");
- else
- prtd->dma = jz4740_dma_request(substream, "PCM Capture");
- }
-
- if (!prtd->dma)
- return -EBUSY;
-
- jz4740_dma_configure(prtd->dma, config->dma_config);
- prtd->fifo_addr = config->fifo_addr;
-
- jz4740_dma_set_complete_cb(prtd->dma, jz4740_pcm_dma_transfer_done);
-
- snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer);
- runtime->dma_bytes = params_buffer_bytes(params);
-
- prtd->dma_period = params_period_bytes(params);
- prtd->dma_start = runtime->dma_addr;
- prtd->dma_pos = prtd->dma_start;
- prtd->dma_end = prtd->dma_start + runtime->dma_bytes;
-
- return 0;
-}
-
-static int jz4740_pcm_hw_free(struct snd_pcm_substream *substream)
-{
- struct jz4740_runtime_data *prtd = substream->runtime->private_data;
-
- snd_pcm_set_runtime_buffer(substream, NULL);
- if (prtd->dma) {
- jz4740_dma_free(prtd->dma);
- prtd->dma = NULL;
- }
-
- return 0;
-}
-
-static int jz4740_pcm_prepare(struct snd_pcm_substream *substream)
-{
- struct jz4740_runtime_data *prtd = substream->runtime->private_data;
- int ret = 0;
-
- if (!prtd->dma)
- return 0;
-
- prtd->dma_pos = prtd->dma_start;
-
- return ret;
-}
-
-static int jz4740_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
-{
- struct snd_pcm_runtime *runtime = substream->runtime;
- struct jz4740_runtime_data *prtd = runtime->private_data;
-
- int ret = 0;
-
- switch (cmd) {
- case SNDRV_PCM_TRIGGER_START:
- case SNDRV_PCM_TRIGGER_RESUME:
- case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
- jz4740_pcm_start_transfer(prtd, substream->stream);
- break;
- case SNDRV_PCM_TRIGGER_STOP:
- case SNDRV_PCM_TRIGGER_SUSPEND:
- case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
- jz4740_dma_disable(prtd->dma);
- break;
- default:
- ret = -EINVAL;
- }
-
- return ret;
-}
-
-static snd_pcm_uframes_t jz4740_pcm_pointer(struct snd_pcm_substream *substream)
-{
- struct snd_pcm_runtime *runtime = substream->runtime;
- struct jz4740_runtime_data *prtd = runtime->private_data;
- unsigned long count, pos;
- snd_pcm_uframes_t offset;
- struct jz4740_dma_chan *dma = prtd->dma;
-
- count = jz4740_dma_get_residue(dma);
- if (prtd->dma_pos == prtd->dma_start)
- pos = prtd->dma_end - prtd->dma_start - count;
- else
- pos = prtd->dma_pos - prtd->dma_start - count;
-
- offset = bytes_to_frames(runtime, pos);
- if (offset >= runtime->buffer_size)
- offset = 0;
-
- return offset;
-}
-
-static int jz4740_pcm_open(struct snd_pcm_substream *substream)
-{
- struct snd_pcm_runtime *runtime = substream->runtime;
- struct jz4740_runtime_data *prtd;
-
- snd_soc_set_runtime_hwparams(substream, &jz4740_pcm_hardware);
- prtd = kzalloc(sizeof(struct jz4740_runtime_data), GFP_KERNEL);
-
- if (prtd == NULL)
- return -ENOMEM;
-
- runtime->private_data = prtd;
- return 0;
-}
-
-static int jz4740_pcm_close(struct snd_pcm_substream *substream)
-{
- struct snd_pcm_runtime *runtime = substream->runtime;
- struct jz4740_runtime_data *prtd = runtime->private_data;
-
- kfree(prtd);
-
- return 0;
-}
-
-static int jz4740_pcm_mmap(struct snd_pcm_substream *substream,
- struct vm_area_struct *vma)
-{
- return remap_pfn_range(vma, vma->vm_start,
- substream->dma_buffer.addr >> PAGE_SHIFT,
- vma->vm_end - vma->vm_start, vma->vm_page_prot);
-}
-
-static struct snd_pcm_ops jz4740_pcm_ops = {
- .open = jz4740_pcm_open,
- .close = jz4740_pcm_close,
- .ioctl = snd_pcm_lib_ioctl,
- .hw_params = jz4740_pcm_hw_params,
- .hw_free = jz4740_pcm_hw_free,
- .prepare = jz4740_pcm_prepare,
- .trigger = jz4740_pcm_trigger,
- .pointer = jz4740_pcm_pointer,
- .mmap = jz4740_pcm_mmap,
-};
-
-static int jz4740_pcm_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 = jz4740_pcm_hardware.buffer_bytes_max;
-
- buf->dev.type = SNDRV_DMA_TYPE_DEV;
- buf->dev.dev = pcm->card->dev;
- buf->private_data = NULL;
-
- buf->area = dma_alloc_noncoherent(pcm->card->dev, size,
- &buf->addr, GFP_KERNEL);
- if (!buf->area)
- return -ENOMEM;
-
- buf->bytes = size;
-
- return 0;
-}
-
-static void jz4740_pcm_free(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_noncoherent(pcm->card->dev, buf->bytes,
- buf->area, buf->addr);
- buf->area = NULL;
- }
-}
-
-static u64 jz4740_pcm_dmamask = DMA_BIT_MASK(32);
-
-int jz4740_pcm_new(struct snd_card *card, struct snd_soc_dai *dai,
- struct snd_pcm *pcm)
-{
- int ret = 0;
-
- if (!card->dev->dma_mask)
- card->dev->dma_mask = &jz4740_pcm_dmamask;
-
- if (!card->dev->coherent_dma_mask)
- card->dev->coherent_dma_mask = DMA_BIT_MASK(32);
-
- if (dai->playback.channels_min) {
- ret = jz4740_pcm_preallocate_dma_buffer(pcm,
- SNDRV_PCM_STREAM_PLAYBACK);
- if (ret)
- goto err;
- }
-
- if (dai->capture.channels_min) {
- ret = jz4740_pcm_preallocate_dma_buffer(pcm,
- SNDRV_PCM_STREAM_CAPTURE);
- if (ret)
- goto err;
- }
-
-err:
- return ret;
-}
-
-struct snd_soc_platform jz4740_soc_platform = {
- .name = "jz4740-pcm",
- .pcm_ops = &jz4740_pcm_ops,
- .pcm_new = jz4740_pcm_new,
- .pcm_free = jz4740_pcm_free,
-};
-EXPORT_SYMBOL_GPL(jz4740_soc_platform);
-
-static int __init jz4740_soc_platform_init(void)
-{
- return snd_soc_register_platform(&jz4740_soc_platform);
-}
-module_init(jz4740_soc_platform_init);
-
-static void __exit jz4740_soc_platform_exit(void)
-{
- snd_soc_unregister_platform(&jz4740_soc_platform);
-}
-module_exit(jz4740_soc_platform_exit);
-
-MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");
-MODULE_DESCRIPTION("Ingenic SoC JZ4740 PCM driver");
-MODULE_LICENSE("GPL");
diff --git a/target/linux/xburst/files-2.6.32/sound/soc/jz4740/jz4740-pcm.h b/target/linux/xburst/files-2.6.32/sound/soc/jz4740/jz4740-pcm.h
deleted file mode 100644
index 2a1180081a..0000000000
--- a/target/linux/xburst/files-2.6.32/sound/soc/jz4740/jz4740-pcm.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#ifndef _JZ4740_PCM_H
-#define _JZ4740_PCM_H
-
-#include <linux/dma-mapping.h>
-#include <asm/mach-jz4740/dma.h>
-
-/* platform data */
-extern struct snd_soc_platform jz4740_soc_platform;
-
-struct jz4740_pcm_config {
- struct jz4740_dma_config *dma_config;
- phys_addr_t fifo_addr;
-};
-
-#endif
diff --git a/target/linux/xburst/files-2.6.32/sound/soc/jz4740/n516.c b/target/linux/xburst/files-2.6.32/sound/soc/jz4740/n516.c
deleted file mode 100644
index 9cb51c20fd..0000000000
--- a/target/linux/xburst/files-2.6.32/sound/soc/jz4740/n516.c
+++ /dev/null
@@ -1,303 +0,0 @@
-/*
- * Copyright (C) 2009, Yauhen Kharuzhy <jekhor@gmail.com>
- * OpenInkpot project
- * Copyright (C) 2010, Lars-Peter Clausen <lars@metafoo.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-#include <linux/module.h>
-#include <linux/interrupt.h>
-#include <linux/platform_device.h>
-#include <sound/core.h>
-#include <sound/pcm.h>
-#include <sound/soc.h>
-#include <sound/soc-dapm.h>
-#include <sound/jack.h>
-#include <linux/gpio.h>
-#include <linux/workqueue.h>
-
-#include "../codecs/jzcodec.h"
-#include "jz4740-pcm.h"
-#include "jz4740-i2s.h"
-
-#include <asm/mach-jz4740/board-n516.h>
-
-enum {
- N516_SPEAKER_AUTO = 0,
- N516_SPEAKER_OFF = 1,
- N516_SPEAKER_ON = 2,
-};
-
-static int n516_speaker_mode;
-static struct snd_soc_codec *n516_codec;
-static struct work_struct n516_headphone_work;
-
-static void n516_ext_control(void)
-{
- if (!n516_codec)
- return;
-
- switch (n516_speaker_mode) {
- case N516_SPEAKER_ON:
- snd_soc_dapm_enable_pin(n516_codec, "Speaker");
- break;
- case N516_SPEAKER_OFF:
- snd_soc_dapm_disable_pin(n516_codec, "Speaker");
- break;
- case N516_SPEAKER_AUTO:
- if (snd_soc_dapm_get_pin_status(n516_codec, "Headphone"))
- snd_soc_dapm_disable_pin(n516_codec, "Speaker");
- else
- snd_soc_dapm_enable_pin(n516_codec, "Speaker");
- break;
- default:
- break;
- }
-
- /* signal a DAPM event */
- snd_soc_dapm_sync(n516_codec);
-}
-
-static int n516_speaker_event(struct snd_soc_dapm_widget *widget,
- struct snd_kcontrol *ctrl, int event)
-{
- int on = !SND_SOC_DAPM_EVENT_OFF(event);
-
- gpio_set_value(GPIO_SPEAKER_ENABLE, on);
-
- return 0;
-}
-
-static void n516_headphone_event_work(struct work_struct *work)
-{
- n516_ext_control();
-}
-
-static int n516_headphone_event(struct snd_soc_dapm_widget *widget,
- struct snd_kcontrol *ctrl, int event)
-{
- /* We can't call soc_dapm_sync from a event handler */
- if (event & (SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD))
- schedule_work(&n516_headphone_work);
- return 0;
-}
-
-static const struct snd_soc_dapm_widget n516_widgets[] = {
- SND_SOC_DAPM_SPK("Speaker", n516_speaker_event),
- SND_SOC_DAPM_HP("Headphone", n516_headphone_event),
- SND_SOC_DAPM_MIC("Mic", NULL),
-};
-
-static const struct snd_soc_dapm_route n516_routes[] = {
- {"Mic", NULL, "MIC"},
- {"Speaker", NULL, "LOUT"},
- {"Speaker", NULL, "ROUT"},
- {"Headphone", NULL, "LOUT"},
- {"Headphone", NULL, "ROUT"},
-};
-
-static const char *n516_speaker_modes[] = {"Auto", "Off", "On"};
-static const struct soc_enum n516_speaker_mode_enum =
- SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(n516_speaker_modes), n516_speaker_modes);
-
-static int n516_get_speaker_mode(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- ucontrol->value.integer.value[0] = n516_speaker_mode;
- return 0;
-}
-
-static int n516_set_speaker_mode(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- if (n516_speaker_mode == ucontrol->value.integer.value[0])
- return 0;
-
- n516_speaker_mode = ucontrol->value.integer.value[0];
- n516_ext_control();
- return 1;
-}
-
-static const struct snd_kcontrol_new n516_controls[] = {
- SOC_ENUM_EXT("Speaker Function", n516_speaker_mode_enum,
- n516_get_speaker_mode, n516_set_speaker_mode),
-};
-
-#define N516_DAIFMT (SND_SOC_DAIFMT_I2S | \
- SND_SOC_DAIFMT_NB_NF | \
- SND_SOC_DAIFMT_CBM_CFM)
-
-static int n516_codec_init(struct snd_soc_codec *codec)
-{
- int ret;
- struct snd_soc_dai *cpu_dai = codec->socdev->card->dai_link->cpu_dai;
- struct snd_soc_dai *codec_dai = codec->socdev->card->dai_link->codec_dai;
-
- n516_codec = codec;
-
- snd_soc_dapm_nc_pin(codec, "LIN");
- snd_soc_dapm_nc_pin(codec, "RIN");
-
- ret = snd_soc_dai_set_fmt(codec_dai, N516_DAIFMT);
- if (ret < 0) {
- dev_err(codec->dev, "Failed to set codec dai format: %d\n", ret);
- return ret;
- }
-
- ret = snd_soc_dai_set_fmt(cpu_dai, N516_DAIFMT);
- if (ret < 0) {
- dev_err(codec->dev, "Failed to set cpu dai format: %d\n", ret);
- return ret;
- }
-
- ret = snd_soc_dai_set_sysclk(codec_dai, JZCODEC_SYSCLK, 111,
- SND_SOC_CLOCK_IN);
- if (ret < 0) {
- dev_err(codec->dev, "Failed to set codec dai sysclk: %d\n", ret);
- return ret;
- }
-
- ret = snd_soc_add_controls(codec, n516_controls,
- ARRAY_SIZE(n516_controls));
- if (ret) {
- dev_err(codec->dev, "Failed to add controls: %d\n", ret);
- return ret;
- }
-
-
- ret = snd_soc_dapm_new_controls(codec, n516_widgets,
- ARRAY_SIZE(n516_widgets));
- if (ret) {
- dev_err(codec->dev, "Failed to add dapm controls: %d\n", ret);
- return ret;
- }
-
- ret = snd_soc_dapm_add_routes(codec, n516_routes, ARRAY_SIZE(n516_routes));
- if (ret) {
- dev_err(codec->dev, "Failed to add dapm routes: %d\n", ret);
- return ret;
- }
-
- snd_soc_dapm_sync(codec);
-
- return 0;
-}
-
-static struct snd_soc_dai_link n516_dai = {
- .name = "jz-codec",
- .stream_name = "JZCODEC",
- .cpu_dai = &jz4740_i2s_dai,
- .codec_dai = &jz_codec_dai,
- .init = n516_codec_init,
-};
-
-static struct snd_soc_card n516_card = {
- .name = "N516",
- .dai_link = &n516_dai,
- .num_links = 1,
- .platform = &jz4740_soc_platform,
-};
-
-static struct snd_soc_device n516_snd_devdata = {
- .card = &n516_card,
- .codec_dev = &soc_codec_dev_jzcodec,
-};
-
-static struct platform_device *n516_snd_device;
-
-static struct snd_soc_jack n516_hp_jack;
-
-static struct snd_soc_jack_pin n516_hp_pin = {
- .pin = "Headphone",
- .mask = SND_JACK_HEADPHONE,
-};
-
-static struct snd_soc_jack_gpio n516_hp_gpio = {
- .gpio = GPIO_HPHONE_DETECT,
- .name = "Headphone detect",
- .report = SND_JACK_HEADPHONE,
- .debounce_time = 100,
-};
-
-static int __init n516_add_headphone_jack(void)
-{
- int ret;
-
- ret = snd_soc_jack_new(&n516_card, "Headphone jack",
- SND_JACK_HEADPHONE, &n516_hp_jack);
- if (ret)
- return ret;
-
- ret = snd_soc_jack_add_pins(&n516_hp_jack, 1, &n516_hp_pin);
- if (ret)
- return ret;
-
- ret = snd_soc_jack_add_gpios(&n516_hp_jack, 1, &n516_hp_gpio);
-
- return ret;
-}
-
-static int __init n516_init(void)
-{
- int ret;
-
- n516_snd_device = platform_device_alloc("soc-audio", -1);
-
- if (!n516_snd_device)
- return -ENOMEM;
-
- ret = gpio_request(GPIO_SPEAKER_ENABLE, "Speaker enable");
- if (ret) {
- pr_err("n516 snd: Failed to request SPEAKER_ENABLE GPIO(%d): %d\n",
- GPIO_SPEAKER_ENABLE, ret);
- goto err_device_put;
- }
-
- gpio_direction_output(GPIO_SPEAKER_ENABLE, 0);
- INIT_WORK(&n516_headphone_work, n516_headphone_event_work);
-
- platform_set_drvdata(n516_snd_device, &n516_snd_devdata);
- n516_snd_devdata.dev = &n516_snd_device->dev;
- ret = platform_device_add(n516_snd_device);
- if (ret) {
- pr_err("n516 snd: Failed to add snd soc device: %d\n", ret);
- goto err_unset_pdata;
- }
-
- ret = n516_add_headphone_jack();
- /* We can live without it, so just print a warning */
- if (ret)
- pr_warning("n516 snd: Failed to initalise headphone jack: %d\n", ret);
-
- return 0;
-
-err_unset_pdata:
- platform_set_drvdata(n516_snd_device, NULL);
-/*err_gpio_free_speaker:*/
- gpio_free(GPIO_SPEAKER_ENABLE);
-err_device_put:
- platform_device_put(n516_snd_device);
-
- return ret;
-}
-module_init(n516_init);
-
-static void __exit n516_exit(void)
-{
- snd_soc_jack_free_gpios(&n516_hp_jack, 1, &n516_hp_gpio);
- gpio_free(GPIO_SPEAKER_ENABLE);
- platform_device_unregister(n516_snd_device);
-}
-module_exit(n516_exit);
-
-MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");
-MODULE_DESCRIPTION("ALSA SoC N516 Audio support");
-MODULE_LICENSE("GPL v2");
diff --git a/target/linux/xburst/files-2.6.32/sound/soc/jz4740/n526.c b/target/linux/xburst/files-2.6.32/sound/soc/jz4740/n526.c
deleted file mode 100644
index 2283904e36..0000000000
--- a/target/linux/xburst/files-2.6.32/sound/soc/jz4740/n526.c
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * Copyright (C) 2009, Lars-Peter Clausen <lars@metafoo.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-#include <linux/module.h>
-#include <linux/moduleparam.h>
-#include <linux/timer.h>
-#include <linux/interrupt.h>
-#include <linux/platform_device.h>
-#include <sound/core.h>
-#include <sound/pcm.h>
-#include <sound/soc.h>
-#include <sound/soc-dapm.h>
-#include <linux/gpio.h>
-
-#include "../codecs/jzcodec.h"
-#include "jz4740-pcm.h"
-#include "jz4740-i2s.h"
-
-#define N526_AMP_EN_GPIO JZ_GPIO_PORTD(4)
-
-static int n526_spk_event(struct snd_soc_dapm_widget *widget,
- struct snd_kcontrol *ctrl, int event)
-{
- gpio_set_value(N526_AMP_EN_GPIO, !SND_SOC_DAPM_EVENT_OFF(event));
- return 0;
-}
-
-static const struct snd_soc_dapm_widget n526_widgets[] = {
- SND_SOC_DAPM_SPK("Speaker", n526_spk_event),
- SND_SOC_DAPM_HP("Headphone", NULL),
- SND_SOC_DAPM_MIC("Mic", NULL),
-};
-
-static const struct snd_soc_dapm_route n526_routes[] = {
- {"Mic", NULL, "MIC"},
- {"Speaker", NULL, "LOUT"},
- {"Speaker", NULL, "ROUT"},
- {"Headphone", NULL, "LOUT"},
- {"Headphone", NULL, "ROUT"},
-};
-
-static const struct snd_kcontrol_new n526_controls[] = {
- SOC_DAPM_PIN_SWITCH("Speaker"),
-};
-
-#define N526_DAIFMT (SND_SOC_DAIFMT_I2S | \
- SND_SOC_DAIFMT_NB_NF | \
- SND_SOC_DAIFMT_CBM_CFM)
-
-static int n526_codec_init(struct snd_soc_codec *codec)
-{
- int ret;
- struct snd_soc_dai *cpu_dai = codec->socdev->card->dai_link->cpu_dai;
- struct snd_soc_dai *codec_dai = codec->socdev->card->dai_link->codec_dai;
-
- snd_soc_dapm_nc_pin(codec, "LIN");
- snd_soc_dapm_nc_pin(codec, "RIN");
-
- ret = snd_soc_dai_set_fmt(codec_dai, N526_DAIFMT);
- if (ret < 0) {
- dev_err(codec->dev, "Failed to set codec dai format: %d\n", ret);
- return ret;
- }
-
- ret = snd_soc_dai_set_fmt(cpu_dai, N526_DAIFMT);
- if (ret < 0) {
- dev_err(codec->dev, "Failed to set cpu dai format: %d\n", ret);
- return ret;
- }
-
- ret = snd_soc_dai_set_sysclk(codec_dai, JZCODEC_SYSCLK, 111,
- SND_SOC_CLOCK_IN);
- if (ret < 0) {
- dev_err(codec->dev, "Failed to set codec dai sysclk: %d\n", ret);
- return ret;
- }
-
- snd_soc_dapm_new_controls(codec, n526_widgets, ARRAY_SIZE(n526_widgets));
-
- snd_soc_add_controls(codec, n526_controls,
- ARRAY_SIZE(n526_controls));
-
- snd_soc_dapm_add_routes(codec, n526_routes, ARRAY_SIZE(n526_routes));
-
- snd_soc_dapm_sync(codec);
-
- return 0;
-}
-
-static struct snd_soc_dai_link n526_dai = {
- .name = "jz-codec",
- .stream_name = "JZCODEC",
- .cpu_dai = &jz4740_i2s_dai,
- .codec_dai = &jz_codec_dai,
- .init = n526_codec_init,
-};
-
-static struct snd_soc_card n526 = {
- .name = "N526",
- .dai_link = &n526_dai,
- .num_links = 1,
- .platform = &jz4740_soc_platform,
-};
-
-static struct snd_soc_device n526_snd_devdata = {
- .card = &n526,
- .codec_dev = &soc_codec_dev_jzcodec,
-};
-
-static struct platform_device *n526_snd_device;
-
-static int __init n526_init(void)
-{
- int ret;
-
- n526_snd_device = platform_device_alloc("soc-audio", -1);
-
- if (!n526_snd_device)
- return -ENOMEM;
-
- ret = gpio_request(N526_AMP_EN_GPIO, "AMP");
- if (ret) {
- pr_err("n526 snd: Failed to request AMP GPIO(%d): %d\n",
- N526_AMP_EN_GPIO, ret);
- goto err_device_put;
- }
-
- gpio_direction_output(JZ_GPIO_PORTD(4), 0);
-
- platform_set_drvdata(n526_snd_device, &n526_snd_devdata);
- n526_snd_devdata.dev = &n526_snd_device->dev;
- ret = platform_device_add(n526_snd_device);
- if (ret) {
- pr_err("n526 snd: Failed to add snd soc device: %d\n", ret);
- goto err_unset_pdata;
- }
-
- return 0;
-
-err_unset_pdata:
- platform_set_drvdata(n526_snd_device, NULL);
- gpio_free(N526_AMP_EN_GPIO);
-err_device_put:
- platform_device_put(n526_snd_device);
-
- return ret;
-}
-module_init(n526_init);
-
-static void __exit n526_exit(void)
-{
- gpio_free(N526_AMP_EN_GPIO);
- platform_device_unregister(n526_snd_device);
-}
-module_exit(n526_exit);
-
-MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");
-MODULE_DESCRIPTION("ALSA SoC N526 audio support");
-MODULE_LICENSE("GPL v2");
diff --git a/target/linux/xburst/files-2.6.32/sound/soc/jz4740/qi_lb60.c b/target/linux/xburst/files-2.6.32/sound/soc/jz4740/qi_lb60.c
deleted file mode 100644
index a2ce3cf7ea..0000000000
--- a/target/linux/xburst/files-2.6.32/sound/soc/jz4740/qi_lb60.c
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * Copyright (C) 2009, Lars-Peter Clausen <lars@metafoo.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-#include <linux/module.h>
-#include <linux/moduleparam.h>
-#include <linux/timer.h>
-#include <linux/interrupt.h>
-#include <linux/platform_device.h>
-#include <sound/core.h>
-#include <sound/pcm.h>
-#include <sound/soc.h>
-#include <sound/soc-dapm.h>
-#include <linux/gpio.h>
-
-#include "../codecs/jzcodec.h"
-#include "jz4740-pcm.h"
-#include "jz4740-i2s.h"
-
-
-#define QI_LB60_SND_GPIO JZ_GPIO_PORTB(29)
-#define QI_LB60_AMP_GPIO JZ_GPIO_PORTD(4)
-
-static int qi_lb60_spk_event(struct snd_soc_dapm_widget *widget,
- struct snd_kcontrol *ctrl, int event)
-{
- int on = 0;
- if (event & SND_SOC_DAPM_POST_PMU)
- on = 1;
- else if (event & SND_SOC_DAPM_PRE_PMD)
- on = 0;
-
- gpio_set_value(QI_LB60_SND_GPIO, on);
- gpio_set_value(QI_LB60_AMP_GPIO, on);
-
- return 0;
-}
-
-static const struct snd_soc_dapm_widget qi_lb60_widgets[] = {
- SND_SOC_DAPM_SPK("Speaker", qi_lb60_spk_event),
- SND_SOC_DAPM_MIC("Mic", NULL),
-};
-
-static const struct snd_soc_dapm_route qi_lb60_routes[] = {
- {"Mic", NULL, "MIC"},
- {"Speaker", NULL, "LOUT"},
- {"Speaker", NULL, "ROUT"},
-};
-
-#define QI_LB60_DAIFMT (SND_SOC_DAIFMT_I2S | \
- SND_SOC_DAIFMT_NB_NF | \
- SND_SOC_DAIFMT_CBM_CFM)
-
-static int qi_lb60_codec_init(struct snd_soc_codec *codec)
-{
- int ret;
- struct snd_soc_dai *cpu_dai = codec->socdev->card->dai_link->cpu_dai;
- struct snd_soc_dai *codec_dai = codec->socdev->card->dai_link->codec_dai;
-
- snd_soc_dapm_nc_pin(codec, "LIN");
- snd_soc_dapm_nc_pin(codec, "RIN");
-
- ret = snd_soc_dai_set_fmt(codec_dai, QI_LB60_DAIFMT);
- if (ret < 0) {
- dev_err(codec->dev, "Failed to set codec dai format: %d\n", ret);
- return ret;
- }
-
- ret = snd_soc_dai_set_fmt(cpu_dai, QI_LB60_DAIFMT);
- if (ret < 0) {
- dev_err(codec->dev, "Failed to set cpu dai format: %d\n", ret);
- return ret;
- }
-
- ret = snd_soc_dai_set_sysclk(codec_dai, JZCODEC_SYSCLK, 111,
- SND_SOC_CLOCK_IN);
- if (ret < 0) {
- dev_err(codec->dev, "Failed to set codec dai sysclk: %d\n", ret);
- return ret;
- }
-
- snd_soc_dapm_new_controls(codec, qi_lb60_widgets, ARRAY_SIZE(qi_lb60_widgets));
-
- snd_soc_dapm_add_routes(codec, qi_lb60_routes, ARRAY_SIZE(qi_lb60_routes));
-
- snd_soc_dapm_sync(codec);
-
- return 0;
-}
-
-static struct snd_soc_dai_link qi_lb60_dai = {
- .name = "jz-codec",
- .stream_name = "JZCODEC",
- .cpu_dai = &jz4740_i2s_dai,
- .codec_dai = &jz_codec_dai,
- .init = qi_lb60_codec_init,
-};
-
-static struct snd_soc_card qi_lb60 = {
- .name = "QI LB60",
- .dai_link = &qi_lb60_dai,
- .num_links = 1,
- .platform = &jz4740_soc_platform,
-};
-
-static struct snd_soc_device qi_lb60_snd_devdata = {
- .card = &qi_lb60,
- .codec_dev = &soc_codec_dev_jzcodec,
-};
-
-static struct platform_device *qi_lb60_snd_device;
-
-static int __init qi_lb60_init(void)
-{
- int ret;
-
- qi_lb60_snd_device = platform_device_alloc("soc-audio", -1);
-
- if (!qi_lb60_snd_device)
- return -ENOMEM;
-
-
- ret = gpio_request(QI_LB60_SND_GPIO, "SND");
- if (ret) {
- pr_err("qi_lb60 snd: Failed to request SND GPIO(%d): %d\n",
- QI_LB60_SND_GPIO, ret);
- goto err_device_put;
- }
-
- ret = gpio_request(QI_LB60_AMP_GPIO, "AMP");
- if (ret) {
- pr_err("qi_lb60 snd: Failed to request AMP GPIO(%d): %d\n",
- QI_LB60_AMP_GPIO, ret);
- goto err_gpio_free_snd;
- }
-
- gpio_direction_output(JZ_GPIO_PORTB(29), 0);
- gpio_direction_output(JZ_GPIO_PORTD(4), 0);
-
- platform_set_drvdata(qi_lb60_snd_device, &qi_lb60_snd_devdata);
- qi_lb60_snd_devdata.dev = &qi_lb60_snd_device->dev;
- ret = platform_device_add(qi_lb60_snd_device);
- if (ret) {
- pr_err("qi_lb60 snd: Failed to add snd soc device: %d\n", ret);
- goto err_unset_pdata;
- }
-
- return 0;
-
-err_unset_pdata:
- platform_set_drvdata(qi_lb60_snd_device, NULL);
-/*err_gpio_free_amp:*/
- gpio_free(QI_LB60_AMP_GPIO);
-err_gpio_free_snd:
- gpio_free(QI_LB60_SND_GPIO);
-err_device_put:
- platform_device_put(qi_lb60_snd_device);
-
- return ret;
-}
-module_init(qi_lb60_init);
-
-static void __exit qi_lb60_exit(void)
-{
- gpio_free(QI_LB60_AMP_GPIO);
- gpio_free(QI_LB60_SND_GPIO);
- platform_device_unregister(qi_lb60_snd_device);
-}
-module_exit(qi_lb60_exit);
-
-MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");
-MODULE_DESCRIPTION("ALSA SoC QI LB60 Audio support");
-MODULE_LICENSE("GPL v2");