--- sound/soc/atmel/snd-soc-afeb9260.c 2011-03-08 00:05:50.000000000 +0100 +++ sound/soc/atmel/snd-soc-cdu.c 2011-03-10 15:36:18.561636247 +0100 @@ -36,11 +36,11 @@ #include #include -#include "../codecs/tlv320aic23.h" +#include "../codecs/tlv320aic3x.h" #include "atmel-pcm.h" #include "atmel_ssc_dai.h" -#define CODEC_CLOCK 12000000 +#define CODEC_CLOCK (1411200*2) static int afeb9260_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) @@ -53,8 +53,8 @@ /* Set codec DAI configuration */ err = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S| - SND_SOC_DAIFMT_NB_IF | - SND_SOC_DAIFMT_CBM_CFM); + SND_SOC_DAIFMT_NB_NF | + SND_SOC_DAIFMT_CBS_CFS); if (err < 0) { printk(KERN_ERR "can't set codec DAI configuration\n"); return err; @@ -63,8 +63,8 @@ /* Set cpu DAI configuration */ err = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S | - SND_SOC_DAIFMT_NB_IF | - SND_SOC_DAIFMT_CBM_CFM); + SND_SOC_DAIFMT_NB_NF | + SND_SOC_DAIFMT_CBS_CFS); if (err < 0) { printk(KERN_ERR "can't set cpu DAI configuration\n"); return err; @@ -79,6 +79,14 @@ return err; } + err = snd_soc_dai_set_clkdiv(cpu_dai, ATMEL_SSC_CMR_DIV, 19); + err = snd_soc_dai_set_clkdiv(cpu_dai, ATMEL_SSC_TCMR_PERIOD, 31); + //err = snd_soc_dai_set_sysclk(cpu_dai, 0, CODEC_CLOCK, SND_SOC_CLOCK_OUT); + if (err < 0) { + printk(KERN_ERR "can't set cpu system clock\n"); + return err; + } + return err; } @@ -86,36 +94,49 @@ .hw_params = afeb9260_hw_params, }; -static const struct snd_soc_dapm_widget tlv320aic23_dapm_widgets[] = { +static const struct snd_soc_dapm_widget aic3x_dapm_widgets[] = { SND_SOC_DAPM_HP("Headphone Jack", NULL), - SND_SOC_DAPM_LINE("Line In", NULL), + SND_SOC_DAPM_LINE("Line Out", NULL), SND_SOC_DAPM_MIC("Mic Jack", NULL), + SND_SOC_DAPM_LINE("Line In", NULL), }; static const struct snd_soc_dapm_route audio_map[] = { - {"Headphone Jack", NULL, "LHPOUT"}, - {"Headphone Jack", NULL, "RHPOUT"}, + /* Headphone connected to HPLOUT, HPROUT */ + {"Headphone Jack", NULL, "HPLOUT"}, + {"Headphone Jack", NULL, "HPROUT"}, - {"LLINEIN", NULL, "Line In"}, - {"RLINEIN", NULL, "Line In"}, + /* Line Out connected to LLOUT, RLOUT */ + {"Line Out", NULL, "LLOUT"}, + {"Line Out", NULL, "RLOUT"}, - {"MICIN", NULL, "Mic Jack"}, + /* Mic connected to (MIC3L | MIC3R) */ + {"MIC3L", NULL, "Mic Bias 2V"}, + {"MIC3R", NULL, "Mic Bias 2V"}, + {"Mic Bias 2V", NULL, "Mic Jack"}, + + /* Line In connected to (LINE1L | LINE2L), (LINE1R | LINE2R) */ + {"LINE1L", NULL, "Line In"}, + {"LINE2L", NULL, "Line In"}, + {"LINE1R", NULL, "Line In"}, + {"LINE2R", NULL, "Line In"}, }; -static int afeb9260_tlv320aic23_init(struct snd_soc_pcm_runtime *rtd) +static int afeb9260_aic3x_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_codec *codec = rtd->codec; /* Add afeb9260 specific widgets */ - snd_soc_dapm_new_controls(codec, tlv320aic23_dapm_widgets, - ARRAY_SIZE(tlv320aic23_dapm_widgets)); + snd_soc_dapm_new_controls(codec, aic3x_dapm_widgets, + ARRAY_SIZE(aic3x_dapm_widgets)); /* Set up afeb9260 specific audio path audio_map */ snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); snd_soc_dapm_enable_pin(codec, "Headphone Jack"); - snd_soc_dapm_enable_pin(codec, "Line In"); + snd_soc_dapm_enable_pin(codec, "Line Out"); snd_soc_dapm_enable_pin(codec, "Mic Jack"); + snd_soc_dapm_enable_pin(codec, "Line In"); snd_soc_dapm_sync(codec); @@ -124,13 +145,13 @@ /* Digital audio interface glue - connects codec <--> CPU */ static struct snd_soc_dai_link afeb9260_dai = { - .name = "TLV320AIC23", - .stream_name = "AIC23", + .name = "TLV320AIC3X", + .stream_name = "AIC3X", .cpu_dai_name = "atmel-ssc-dai.0", - .codec_dai_name = "tlv320aic23-hifi", - .platform_name = "atmel_pcm-audio", - .codec_name = "tlv320aic23-codec.0-0x1a", - .init = afeb9260_tlv320aic23_init, + .codec_dai_name = "tlv320aic3x-hifi", + .platform_name = "atmel-pcm-audio", + .codec_name = "tlv320aic3x-codec.0-001a", + .init = afeb9260_aic3x_init, .ops = &afeb9260_ops, }; @@ -148,10 +169,6 @@ int err; struct device *dev; - if (!(machine_is_afeb9260())) - return -ENODEV; - - afeb9260_snd_device = platform_device_alloc("soc-audio", -1); if (!afeb9260_snd_device) { printk(KERN_ERR "ASoC: Platform device allocation failed\n");