Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
54b78608
cloud-kernel
项目概览
openanolis
/
cloud-kernel
1 年多 前同步成功
通知
161
Star
36
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
54b78608
编写于
6月 03, 2010
作者:
M
Mauro Carvalho Chehab
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
V4L/DVB: tm6000-alsa: rework audio buffer allocation/deallocation
Signed-off-by:
N
Mauro Carvalho Chehab
<
mchehab@redhat.com
>
上级
0e57ff8d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
32 addition
and
31 deletion
+32
-31
drivers/staging/tm6000/tm6000-alsa.c
drivers/staging/tm6000/tm6000-alsa.c
+32
-27
drivers/staging/tm6000/tm6000.h
drivers/staging/tm6000/tm6000.h
+0
-4
未找到文件。
drivers/staging/tm6000/tm6000-alsa.c
浏览文件 @
54b78608
...
...
@@ -16,6 +16,7 @@
#include <linux/interrupt.h>
#include <linux/usb.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <asm/delay.h>
#include <sound/core.h>
...
...
@@ -106,19 +107,39 @@ static int _tm6000_stop_audio_dma(struct snd_tm6000_card *chip)
return
0
;
}
static
int
dsp_buffer_free
(
struct
snd_tm6000_card
*
chip
)
static
void
dsp_buffer_free
(
struct
snd_pcm_substream
*
substream
)
{
BUG_ON
(
!
chip
->
bufsize
);
struct
snd_tm6000_card
*
chip
=
snd_pcm_substream_chip
(
substream
);
dprintk
(
2
,
"Freeing buffer
\n
"
);
/* FIXME: Frees buffer */
vfree
(
substream
->
runtime
->
dma_area
);
substream
->
runtime
->
dma_area
=
NULL
;
substream
->
runtime
->
dma_bytes
=
0
;
}
chip
->
bufsize
=
0
;
static
int
dsp_buffer_alloc
(
struct
snd_pcm_substream
*
substream
,
int
size
)
{
struct
snd_tm6000_card
*
chip
=
snd_pcm_substream_chip
(
substream
);
return
0
;
dprintk
(
2
,
"Allocating buffer
\n
"
);
if
(
substream
->
runtime
->
dma_area
)
{
if
(
substream
->
runtime
->
dma_bytes
>
size
)
return
0
;
dsp_buffer_free
(
substream
);
}
substream
->
runtime
->
dma_area
=
vmalloc
(
size
);
if
(
!
substream
->
runtime
->
dma_area
)
return
-
ENOMEM
;
substream
->
runtime
->
dma_bytes
=
size
;
return
0
;
}
/****************************************************************************
ALSA PCM Interface
****************************************************************************/
...
...
@@ -185,23 +206,13 @@ static int snd_tm6000_close(struct snd_pcm_substream *substream)
static
int
snd_tm6000_hw_params
(
struct
snd_pcm_substream
*
substream
,
struct
snd_pcm_hw_params
*
hw_params
)
{
struct
snd_tm6000_card
*
chip
=
snd_pcm_substream_chip
(
substream
)
;
int
size
,
rc
;
if
(
substream
->
runtime
->
dma_area
)
{
dsp_buffer_free
(
chip
);
substream
->
runtime
->
dma_area
=
NULL
;
}
chip
->
period_size
=
params_period_bytes
(
hw_params
);
chip
->
num_periods
=
params_periods
(
hw_params
);
chip
->
bufsize
=
chip
->
period_size
*
params_periods
(
hw_params
);
BUG_ON
(
!
chip
->
bufsize
);
dprintk
(
1
,
"Setting buffer
\n
"
);
/* FIXME: Allocate buffer for audio */
size
=
params_period_bytes
(
hw_params
)
*
params_periods
(
hw_params
);
rc
=
dsp_buffer_alloc
(
substream
,
size
);
if
(
rc
<
0
)
return
rc
;
return
0
;
}
...
...
@@ -211,13 +222,7 @@ static int snd_tm6000_hw_params(struct snd_pcm_substream *substream,
*/
static
int
snd_tm6000_hw_free
(
struct
snd_pcm_substream
*
substream
)
{
struct
snd_tm6000_card
*
chip
=
snd_pcm_substream_chip
(
substream
);
if
(
substream
->
runtime
->
dma_area
)
{
dsp_buffer_free
(
chip
);
substream
->
runtime
->
dma_area
=
NULL
;
}
dsp_buffer_free
(
substream
);
return
0
;
}
...
...
drivers/staging/tm6000/tm6000.h
浏览文件 @
54b78608
...
...
@@ -136,11 +136,7 @@ struct snd_tm6000_card {
struct
snd_card
*
card
;
spinlock_t
reg_lock
;
atomic_t
count
;
unsigned
int
period_size
;
unsigned
int
num_periods
;
struct
tm6000_core
*
core
;
struct
tm6000_buffer
*
buf
;
int
bufsize
;
struct
snd_pcm_substream
*
substream
;
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录