Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
c9840cf4
cloud-kernel
项目概览
openanolis
/
cloud-kernel
1 年多 前同步成功
通知
160
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看板
提交
c9840cf4
编写于
3月 20, 2009
作者:
T
Takashi Iwai
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'topic/hda-optimize' into topic/hda
上级
2d864c49
1dddab40
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
54 addition
and
25 deletion
+54
-25
sound/pci/hda/hda_intel.c
sound/pci/hda/hda_intel.c
+54
-25
未找到文件。
sound/pci/hda/hda_intel.c
浏览文件 @
c9840cf4
...
...
@@ -859,13 +859,18 @@ static void azx_stream_start(struct azx *chip, struct azx_dev *azx_dev)
SD_CTL_DMA_START
|
SD_INT_MASK
);
}
/* stop
a stream
*/
static
void
azx_stream_
stop
(
struct
azx
*
chip
,
struct
azx_dev
*
azx_dev
)
/* stop
DMA
*/
static
void
azx_stream_
clear
(
struct
azx
*
chip
,
struct
azx_dev
*
azx_dev
)
{
/* stop DMA */
azx_sd_writeb
(
azx_dev
,
SD_CTL
,
azx_sd_readb
(
azx_dev
,
SD_CTL
)
&
~
(
SD_CTL_DMA_START
|
SD_INT_MASK
));
azx_sd_writeb
(
azx_dev
,
SD_STS
,
SD_INT_MASK
);
/* to be sure */
}
/* stop a stream */
static
void
azx_stream_stop
(
struct
azx
*
chip
,
struct
azx_dev
*
azx_dev
)
{
azx_stream_clear
(
chip
,
azx_dev
);
/* disable SIE */
azx_writeb
(
chip
,
INTCTL
,
azx_readb
(
chip
,
INTCTL
)
&
~
(
1
<<
azx_dev
->
index
));
...
...
@@ -1076,8 +1081,7 @@ static int azx_setup_periods(struct azx *chip,
azx_sd_writel
(
azx_dev
,
SD_BDLPL
,
0
);
azx_sd_writel
(
azx_dev
,
SD_BDLPU
,
0
);
period_bytes
=
snd_pcm_lib_period_bytes
(
substream
);
azx_dev
->
period_bytes
=
period_bytes
;
period_bytes
=
azx_dev
->
period_bytes
;
periods
=
azx_dev
->
bufsize
/
period_bytes
;
/* program the initial BDL entries */
...
...
@@ -1124,24 +1128,17 @@ static int azx_setup_periods(struct azx *chip,
error:
snd_printk
(
KERN_ERR
"Too many BDL entries: buffer=%d, period=%d
\n
"
,
azx_dev
->
bufsize
,
period_bytes
);
/* reset */
azx_sd_writel
(
azx_dev
,
SD_BDLPL
,
0
);
azx_sd_writel
(
azx_dev
,
SD_BDLPU
,
0
);
return
-
EINVAL
;
}
/*
* set up the SD for streaming
*/
static
int
azx_setup_controller
(
struct
azx
*
chip
,
struct
azx_dev
*
azx_dev
)
/* reset stream */
static
void
azx_stream_reset
(
struct
azx
*
chip
,
struct
azx_dev
*
azx_dev
)
{
unsigned
char
val
;
int
timeout
;
/* make sure the run bit is zero for SD */
azx_sd_writeb
(
azx_dev
,
SD_CTL
,
azx_sd_readb
(
azx_dev
,
SD_CTL
)
&
~
SD_CTL_DMA_START
);
/* reset stream */
azx_stream_clear
(
chip
,
azx_dev
);
azx_sd_writeb
(
azx_dev
,
SD_CTL
,
azx_sd_readb
(
azx_dev
,
SD_CTL
)
|
SD_CTL_STREAM_RESET
);
udelay
(
3
);
...
...
@@ -1158,7 +1155,15 @@ static int azx_setup_controller(struct azx *chip, struct azx_dev *azx_dev)
while
(((
val
=
azx_sd_readb
(
azx_dev
,
SD_CTL
))
&
SD_CTL_STREAM_RESET
)
&&
--
timeout
)
;
}
/*
* set up the SD for streaming
*/
static
int
azx_setup_controller
(
struct
azx
*
chip
,
struct
azx_dev
*
azx_dev
)
{
/* make sure the run bit is zero for SD */
azx_stream_clear
(
chip
,
azx_dev
);
/* program the stream_tag */
azx_sd_writel
(
azx_dev
,
SD_CTL
,
(
azx_sd_readl
(
azx_dev
,
SD_CTL
)
&
~
SD_CTL_STREAM_TAG_MASK
)
|
...
...
@@ -1403,6 +1408,8 @@ static int azx_pcm_open(struct snd_pcm_substream *substream)
runtime
->
private_data
=
azx_dev
;
snd_pcm_set_sync
(
substream
);
mutex_unlock
(
&
chip
->
open_mutex
);
azx_stream_reset
(
chip
,
azx_dev
);
return
0
;
}
...
...
@@ -1429,6 +1436,11 @@ static int azx_pcm_close(struct snd_pcm_substream *substream)
static
int
azx_pcm_hw_params
(
struct
snd_pcm_substream
*
substream
,
struct
snd_pcm_hw_params
*
hw_params
)
{
struct
azx_dev
*
azx_dev
=
get_azx_dev
(
substream
);
azx_dev
->
bufsize
=
0
;
azx_dev
->
period_bytes
=
0
;
azx_dev
->
format_val
=
0
;
return
snd_pcm_lib_malloc_pages
(
substream
,
params_buffer_bytes
(
hw_params
));
}
...
...
@@ -1443,6 +1455,9 @@ static int azx_pcm_hw_free(struct snd_pcm_substream *substream)
azx_sd_writel
(
azx_dev
,
SD_BDLPL
,
0
);
azx_sd_writel
(
azx_dev
,
SD_BDLPU
,
0
);
azx_sd_writel
(
azx_dev
,
SD_CTL
,
0
);
azx_dev
->
bufsize
=
0
;
azx_dev
->
period_bytes
=
0
;
azx_dev
->
format_val
=
0
;
hinfo
->
ops
.
cleanup
(
hinfo
,
apcm
->
codec
,
substream
);
...
...
@@ -1456,23 +1471,37 @@ static int azx_pcm_prepare(struct snd_pcm_substream *substream)
struct
azx_dev
*
azx_dev
=
get_azx_dev
(
substream
);
struct
hda_pcm_stream
*
hinfo
=
apcm
->
hinfo
[
substream
->
stream
];
struct
snd_pcm_runtime
*
runtime
=
substream
->
runtime
;
unsigned
int
bufsize
,
period_bytes
,
format_val
;
int
err
;
azx_dev
->
bufsize
=
snd_pcm_lib_buffer_bytes
(
substream
);
azx_dev
->
format_val
=
snd_hda_calc_stream_format
(
runtime
->
rate
,
runtime
->
channels
,
runtime
->
format
,
hinfo
->
maxbps
);
if
(
!
azx_dev
->
format_val
)
{
format_val
=
snd_hda_calc_stream_format
(
runtime
->
rate
,
runtime
->
channels
,
runtime
->
format
,
hinfo
->
maxbps
);
if
(
!
format_val
)
{
snd_printk
(
KERN_ERR
SFX
"invalid format_val, rate=%d, ch=%d, format=%d
\n
"
,
runtime
->
rate
,
runtime
->
channels
,
runtime
->
format
);
return
-
EINVAL
;
}
bufsize
=
snd_pcm_lib_buffer_bytes
(
substream
);
period_bytes
=
snd_pcm_lib_period_bytes
(
substream
);
snd_printdd
(
"azx_pcm_prepare: bufsize=0x%x, format=0x%x
\n
"
,
azx_dev
->
bufsize
,
azx_dev
->
format_val
);
if
(
azx_setup_periods
(
chip
,
substream
,
azx_dev
)
<
0
)
return
-
EINVAL
;
bufsize
,
format_val
);
if
(
bufsize
!=
azx_dev
->
bufsize
||
period_bytes
!=
azx_dev
->
period_bytes
||
format_val
!=
azx_dev
->
format_val
)
{
azx_dev
->
bufsize
=
bufsize
;
azx_dev
->
period_bytes
=
period_bytes
;
azx_dev
->
format_val
=
format_val
;
err
=
azx_setup_periods
(
chip
,
substream
,
azx_dev
);
if
(
err
<
0
)
return
err
;
}
azx_setup_controller
(
chip
,
azx_dev
);
if
(
substream
->
stream
==
SNDRV_PCM_STREAM_PLAYBACK
)
azx_dev
->
fifo_size
=
azx_sd_readw
(
azx_dev
,
SD_FIFOSIZE
)
+
1
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录