Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Kernel Diffs for sound/soc/omap3beagle.c
- static int omap3beagle_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->dai->codec_dai;
- struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;
- unsigned int fmt;
- int ret;
- switch (params_channels(params)) {
- case 2: /* Stereo I2S mode */
- fmt = SND_SOC_DAIFMT_I2S |
- SND_SOC_DAIFMT_NB_NF |
- SND_SOC_DAIFMT_CBM_CFM;
- break;
- case 4: /* Four channel TDM mode */
- fmt = SND_SOC_DAIFMT_DSP_A |
- SND_SOC_DAIFMT_IB_NF |
- SND_SOC_DAIFMT_CBM_CFM;
- break;
- default:
- return -EINVAL;
- }
- /* Set codec DAI configuration */
- ret = snd_soc_dai_set_fmt(codec_dai, fmt);
- if (ret < 0) {
- printk(KERN_ERR "can't set codec DAI configuration\n");
- return ret;
- }
- /* Set cpu DAI configuration */
- ret = snd_soc_dai_set_fmt(cpu_dai, fmt);
- if (ret < 0) {
- printk(KERN_ERR "can't set cpu DAI configuration\n");
- 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, 19200000,
- SND_SOC_CLOCK_IN);
- if (ret < 0) {
- printk(KERN_ERR "can't set codec system clock\n");
- return ret;
- }
- 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 = "TLV320AIC3X",
- .stream_name = "AIC3X",
- .cpu_dai = &omap_mcbsp_dai[0],
- .codec_dai = &aic3x_dai,
- .init = omap3beagle_aic3x_init,
- .ops = &omap3beagle_ops,
- };
- /* Audio machine driver */
- static struct snd_soc_card snd_soc_omap3beagle = {
- .name = "omap3beagle",
- .platform = &omap_soc_platform,
- .dai_link = &omap3beagle_dai,
- .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_aic3x,
- .codec_data = &aic3x_setup,
- };
- static struct platform_device *omap3beagle_snd_device;
- static int __init omap3beagle_soc_init(void)
- {
- int ret;
- if (!machine_is_omap3_beagle()) {
- pr_debug("Not OMAP3 Beagle!\n");
- return -ENODEV;
- }
- pr_info("OMAP3 Beagle SoC init\n");
- omap3beagle_snd_device = platform_device_alloc("soc-audio", -1);
- if (!omap3beagle_snd_device) {
- printk(KERN_ERR "Platform device allocation failed\n");
- return -ENOMEM;
- }
- 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 = 2; /* McBSP3 */
- ret = platform_device_add(omap3beagle_snd_device);
- if (ret)
- goto err1;
- return 0;
- err1:
- printk(KERN_ERR "Unable to add platform device\n");
- platform_device_put(omap3beagle_snd_device);
- return ret;
- }
- Kernel Diffs for arch/arm/mach-omap2/board-omap3beagle.c:
- static struct i2c_board_info __initdata beagle_i2c1_boardinfo[] = {
- {
- I2C_BOARD_INFO("tlv320aic3x", 0x18),
- },
- {
- I2C_BOARD_INFO("twl4030", 0x48),
- .flags = I2C_CLIENT_WAKE,
- .irq = INT_34XX_SYS_NIRQ,
- .platform_data = &beagle_twldata,
- },
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement