Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @@ -21,10 +21,15 @@
- #include <linux/clk.h>
- #include <linux/platform_device.h>
- +#include <linux/module.h>
- +#include <linux/moduleparam.h>
- +#include <linux/timer.h>
- +#include <linux/interrupt.h>
- #include <sound/core.h>
- #include <sound/pcm.h>
- #include <sound/soc.h>
- #include <sound/soc-dapm.h>
- +#include <linux/i2c.h>
- #include <asm/mach-types.h>
- #include <mach/hardware.h>
- @@ -34,6 +39,7 @@
- #include "omap-mcbsp.h"
- #include "omap-pcm.h"
- #include "../codecs/twl4030.h"
- +#include "../codecs/tlv320aic3x.h"
- static int omap3beagle_hw_params(struct snd_pcm_substream *substream,
- struct snd_pcm_hw_params *params)
- @@ -73,27 +79,72 @@
- return ret;
- }
- + /* Vi har en extern MCLK, behövs denna? */
- +
- /* Set the codec system clock for DAC and ADC */
- - ret = snd_soc_dai_set_sysclk(codec_dai, 0, 26000000,
- + ret = snd_soc_dai_set_sysclk(codec_dai, 0, 19200000,
- SND_SOC_CLOCK_IN);
- if (ret < 0) {
- printk(KERN_ERR "can't set codec system clock\n");
- - return ret;
- - }
- + return ret;
- + }
- - return 0;
- + return 0;
- }
- static struct snd_soc_ops omap3beagle_ops = {
- .hw_params = omap3beagle_hw_params,
- };
- +static const struct snd_soc_dapm_widget aic3x_dapm_widgets[] = {
- + SND_SOC_DAPM_HP("Headphone Jack", NULL),
- + SND_SOC_DAPM_LINE("Line In", NULL),
- +};
- +
- +static const struct snd_soc_dapm_route audio_map[] = {
- + /* Headphone connected to LLOUT, LROUT */
- + {"Headphone Jack", NULL, "LLOUT"},
- + {"Headphone Jack", NULL, "LROUT"},
- +
- + /* 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 omap3beagle_aic3x_init(struct snd_soc_codec *codec)
- +{
- + /* Add beagle specific widgets */
- + snd_soc_dapm_new_controls(codec, aic3x_dapm_widgets,
- + ARRAY_SIZE(aic3x_dapm_widgets));
- +
- + /* Set up beagle specific audio path audio_map */
- + snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map));
- +
- + /* not connected */
- + snd_soc_dapm_disable_pin(codec, "MONO_LOUT");
- + snd_soc_dapm_disable_pin(codec, "HPLCOM");
- + snd_soc_dapm_disable_pin(codec, "HPRCOM");
- + snd_soc_dapm_disable_pin(codec, "HPLOUT");
- + snd_soc_dapm_disable_pin(codec, "HPROUT");
- +
- + /* always connected */
- + snd_soc_dapm_enable_pin(codec, "Headphone Jack");
- + snd_soc_dapm_enable_pin(codec, "Line In");
- +
- + snd_soc_dapm_sync(codec);
- +
- + return 0;
- +}
- +
- /* Digital audio interface glue - connects codec <--> CPU */
- static struct snd_soc_dai_link omap3beagle_dai = {
- - .name = "TWL4030",
- - .stream_name = "TWL4030",
- + .name = "TLV320AIC3X",
- + .stream_name = "AIC3X",
- .cpu_dai = &omap_mcbsp_dai[0],
- - .codec_dai = &twl4030_dai[TWL4030_DAI_HIFI],
- + .codec_dai = &aic3x_dai,
- + .init = omap3beagle_aic3x_init,
- .ops = &omap3beagle_ops,
- };
- @@ -105,10 +156,13 @@
- .num_links = 1,
- };
- +static struct aic3x_setup_data aic3x_setup;
- +
- /* Audio subsystem */
- static struct snd_soc_device omap3beagle_snd_devdata = {
- .card = &snd_soc_omap3beagle,
- - .codec_dev = &soc_codec_dev_twl4030,
- + .codec_dev = &soc_codec_dev_aic3x,
- + .codec_data = &aic3x_setup,
- };
- static struct platform_device *omap3beagle_snd_device;
- @@ -131,7 +185,7 @@
- platform_set_drvdata(omap3beagle_snd_device, &omap3beagle_snd_devdata);
- omap3beagle_snd_devdata.dev = &omap3beagle_snd_device->dev;
- - *(unsigned int *)omap3beagle_dai.cpu_dai->private_data = 1; /* McBSP2 */
- + *(unsigned int *)omap3beagle_dai.cpu_dai->private_data = 2; /* McBSP3 */
- ret = platform_device_add(omap3beagle_snd_device);
- if (ret)
- [1] Done emacs board-omap3beagle.c (wd: /media/Extra/rowboat-android/TI_Android_GingerBread_2_3_Sources/kernel/arch/arm/mach-omap2)
- (wd now: /media/Extra/rowboat-android/TI_Android_GingerBread_2_3_Sources/kernel/arch/arm/configs)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement