s3c2440 linux3.2.65 uda134x声卡卡顿,杂音修复

针对s3c2440平台Linux3.2.65内核下uda134x声卡出现的播放杂音和卡顿现象,博主进行了优化工作,主要修改了sound/soc/samsung/dma.c文件。通过对比Linux2.6.32.65版本的s3c24xx_pcm.c中关于DMA的部分,对代码进行调整,解决了uda134x声卡的问题。
摘要由CSDN通过智能技术生成

linux3.2.65中uda1341播放声音杂音与卡顿

我只做了linux3.2.65中的优化,主要修改的文件是sound/soc/samsung/dma.c 因为在linux2.6.32.65中uda134x播放声音正常,因此这里参考了linux2.6.32.65中

linux-2.6.32.64\sound\soc\s3c24xx\s3c24xx_pcm.c中有关DMA的部分,以下是linux3.2.55修改之后的源文件内容

另外更改本次的uda134x同时也参考了http://www.xuebuyuan.com/2150214.html
要使用uda134x需要在arch/arm/mach-s3c2440/mach-smdk2440.c中添加以下代码部分/* UDA1341 */
static struct s3c24xx_uda134x_platform_data s3c24xx_uda134x_data = {
	.l3_clk = S3C2410_GPB(4),
	.l3_data = S3C2410_GPB(3),
	.l3_mode = S3C2410_GPB(2),
	.model = UDA134X_UDA1341,
};

static struct platform_device s3c_device_uda134x = {
	.name = "s3c24xx_uda134x",
	.dev = {
		.platform_data    = &s3c24xx_uda134x_data,
	}
};
static struct platform_device s3c_device_uda134x_codec ={
    .name = "uda134x-codec",
    .id = -1,
};
	&s3c_device_uda134x_codec,
	&s3c_device_uda134x,
	&samsung_asoc_dma,
如果你的是3.2内核基本上可以原样copy否则的请参考linux2.6.32中的uda134x dma部分。



/*
 * dma.c  --  ALSA Soc Audio Layer
 *
 * (c) 2006 Wolfson Microelectronics PLC.
 * Graeme Gregory graeme.gregory@wolfsonmicro.com or linux@wolfsonmicro.com
 *
 * Copyright 2004-2005 Simtec Electronics
 *	http://armlinux.simtec.co.uk/
 *	Ben Dooks <ben@simtec.co.uk>
 *
 *  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.
 */

#include <linux/slab.h>
#include <linux/dma-mapping.h>
#include <linux/module.h>

#include <sound/soc.h>
#include <sound/pcm_params.h>

#include <asm/dma.h>
#include <mach/hardware.h>
#include <mach/dma.h>

#include "dma.h"

#define ST_RUNNING		(1<<0)
#define ST_OPENED		(1<<1)

enum s3c2410_dmasrc {
	S3C2410_DMASRC_HW,		/* source is memory */
	S3C2410_DMASRC_MEM		/* source is hardware */
};


static const struct snd_pcm_hardware dma_hardware = {
	.info			= SNDRV_PCM_INFO_INTERLEAVED |
				    SNDRV_PCM_INFO_BLOCK_TRANSFER |
				    SNDRV_PCM_INFO_MMAP |
				    SNDRV_PCM_INFO_MMAP_VALID,
	.formats		= SNDRV_PCM_FMTBIT_S16_LE |
				    SNDRV_PCM_FMTBIT_U16_LE |
				    SNDRV_PCM_FMTBIT_U8 |
				    SNDRV_PCM_FMTBIT_S8,
	.channels_min		= 2,
	.channels_max		= 2,
	.buffer_bytes_max	= 128*1024,
	.period_bytes_min	= PAGE_SIZE,
	.period_bytes_max	= PAGE_SIZE*2,
	.periods_min		= 2,
	.periods_max		= 128,
	.fifo_size		= 32,
};

struct runtime_data {
	spinlock_t lock;
	int state;
	unsigned int dma_loaded;
	unsigned int dma_limit;
	unsigned int dma_period;
	dma_addr_t dma_start;
	dma_addr_t dma_pos;
	dma_addr_t dma_end;
	struct s3c_dma_params *params;
};

//static void audio_buffdon
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值