Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1344631
  • 博文数量: 198
  • 博客积分: 1629
  • 博客等级: 上尉
  • 技术积分: 2743
  • 用 户 组: 普通用户
  • 注册时间: 2011-08-01 15:41
文章分类
文章存档

2023年(6)

2022年(20)

2021年(8)

2020年(3)

2018年(17)

2017年(3)

2016年(3)

2015年(9)

2014年(13)

2013年(17)

2012年(77)

2011年(22)

分类: LINUX

2011-09-01 17:48:28

问题表述:
我的270开发板上接了一个ucb1400芯片,该芯片还提供触摸屏控制,现在触摸屏能用了,但是音频还有问题。
我的做法是在内核配置时选上ALSA支持,然后在ALSA的ALSA ARM devices中选上AC97 driver for the Intel PXA2xx chip,另外还选择了oss的API支持。
内核起来以后,没有什么提示错误的地方,但是现在用madplay播放MP3的时候,没有声音输出。播放的时候和我在2410上正常播放madplay时显示一样,如下:

[root@up-tech /]madplay /mnt/mmc/music/qing.mp3 
MPEG Audio Decoder 0.15.2 (beta) - Copyright (C) 2000-2004 Robert Leslie et al.
          Title: 01.贩?
                 Copyright (C) 贩-贩贩[blog.023x.com]
       Composer: 贩贩
         Artist: [贩贩]
          Album: 贩-贩?
          Track: 1
           Year: 2007
          Genre: Other
        Comment: 贩-贩贩[blog.023x.com]
error: frame 0: lost synchronization
error: frame 10720: lost synchronization
10720 frames decoded (0:04:40.0), +0.3 dB peak amplitude, 19 clipped samples

不同的是红色的部分。我运行cat /proc/interrupts的时候也能看到ac97中断次数一直在增加。

madplay编译的时候有个--with-alsa,但是我选上这个的时候,播放的时候提示audio: no such file or directory

解决思路:

仔细看了一下ucb1400的datasheet,发现它有个Master Volume Register。

在linux-2.6.24的内核驱动中默认将输出屏蔽掉了,用户程序使用oss的时候需要解除该屏蔽,或者直接在内核源代码中把默认的静音去掉。


具体在sound/pci/ac97/ac97_codec.c文件中的snd_ac97_mixer_build函数中

if (snd_ac97_try_volume_mix(ac97, AC97_MASTER)) {
              if (ac97->flags & AC97_HAS_NO_MASTER_VOL)
                      err = snd_ac97_cmute_new(card, "Master Playback Switch",
                                                 AC97_MASTER, 0, ac97);
              else
                      err = snd_ac97_cmix_new(card, "Master Playback",
                                         AC97_MASTER, 0, ac97);

              snd_ac97_write_cache(ac97, AC97_MASTER, 0x0707); // added by yqliu29 for up-tech classical-270
              if (err < 0)
                          return err;
   }

添加的一行用红色表示出来了。
原文链接:

阅读(2133) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~