Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
66c21c5a
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看板
提交
66c21c5a
编写于
2月 23, 2015
作者:
T
Takashi Iwai
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'topic/cleanup' into for-next
上级
dec84316
0c8d9485
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
40 addition
and
115 deletion
+40
-115
sound/core/sound.c
sound/core/sound.c
+5
-9
sound/pci/rme9652/hdspm.c
sound/pci/rme9652/hdspm.c
+35
-106
未找到文件。
sound/core/sound.c
浏览文件 @
66c21c5a
...
...
@@ -186,7 +186,7 @@ static const struct file_operations snd_fops =
};
#ifdef CONFIG_SND_DYNAMIC_MINORS
static
int
snd_find_free_minor
(
int
type
)
static
int
snd_find_free_minor
(
int
type
,
struct
snd_card
*
card
,
int
dev
)
{
int
minor
;
...
...
@@ -209,7 +209,7 @@ static int snd_find_free_minor(int type)
return
-
EBUSY
;
}
#else
static
int
snd_
kernel
_minor
(
int
type
,
struct
snd_card
*
card
,
int
dev
)
static
int
snd_
find_free
_minor
(
int
type
,
struct
snd_card
*
card
,
int
dev
)
{
int
minor
;
...
...
@@ -237,6 +237,8 @@ static int snd_kernel_minor(int type, struct snd_card *card, int dev)
}
if
(
snd_BUG_ON
(
minor
<
0
||
minor
>=
SNDRV_OS_MINORS
))
return
-
EINVAL
;
if
(
snd_minors
[
minor
])
return
-
EBUSY
;
return
minor
;
}
#endif
...
...
@@ -276,13 +278,7 @@ int snd_register_device(int type, struct snd_card *card, int dev,
preg
->
private_data
=
private_data
;
preg
->
card_ptr
=
card
;
mutex_lock
(
&
sound_mutex
);
#ifdef CONFIG_SND_DYNAMIC_MINORS
minor
=
snd_find_free_minor
(
type
);
#else
minor
=
snd_kernel_minor
(
type
,
card
,
dev
);
if
(
minor
>=
0
&&
snd_minors
[
minor
])
minor
=
-
EBUSY
;
#endif
minor
=
snd_find_free_minor
(
type
,
card
,
dev
);
if
(
minor
<
0
)
{
err
=
minor
;
goto
error
;
...
...
sound/pci/rme9652/hdspm.c
浏览文件 @
66c21c5a
...
...
@@ -6043,23 +6043,30 @@ hdspm_hw_constraints_aes32_sample_rates = {
.
mask
=
0
};
static
int
snd_hdspm_
playback_
open
(
struct
snd_pcm_substream
*
substream
)
static
int
snd_hdspm_open
(
struct
snd_pcm_substream
*
substream
)
{
struct
hdspm
*
hdspm
=
snd_pcm_substream_chip
(
substream
);
struct
snd_pcm_runtime
*
runtime
=
substream
->
runtime
;
bool
playback
=
(
substream
->
stream
==
SNDRV_PCM_STREAM_PLAYBACK
);
spin_lock_irq
(
&
hdspm
->
lock
);
snd_pcm_set_sync
(
substream
);
runtime
->
hw
=
(
playback
)
?
snd_hdspm_playback_subinfo
:
snd_hdspm_capture_subinfo
;
if
(
playback
)
{
if
(
hdspm
->
capture_substream
==
NULL
)
hdspm_stop_audio
(
hdspm
);
runtime
->
hw
=
snd_hdspm_playback_subinfo
;
if
(
hdspm
->
capture_substream
==
NULL
)
hdspm_stop_audio
(
hdspm
);
hdspm
->
playback_pid
=
current
->
pid
;
hdspm
->
playback_substream
=
substream
;
}
else
{
if
(
hdspm
->
playback_substream
==
NULL
)
hdspm_stop_audio
(
hdspm
);
hdspm
->
playback_pid
=
current
->
pid
;
hdspm
->
playback_substream
=
substream
;
hdspm
->
capture_pid
=
current
->
pid
;
hdspm
->
capture_substream
=
substream
;
}
spin_unlock_irq
(
&
hdspm
->
lock
);
...
...
@@ -6094,108 +6101,42 @@ static int snd_hdspm_playback_open(struct snd_pcm_substream *substream)
&
hdspm_hw_constraints_aes32_sample_rates
);
}
else
{
snd_pcm_hw_rule_add
(
runtime
,
0
,
SNDRV_PCM_HW_PARAM_RATE
,
snd_hdspm_hw_rule_rate_out_channels
,
hdspm
,
(
playback
?
snd_hdspm_hw_rule_rate_out_channels
:
snd_hdspm_hw_rule_rate_in_channels
),
hdspm
,
SNDRV_PCM_HW_PARAM_CHANNELS
,
-
1
);
}
snd_pcm_hw_rule_add
(
runtime
,
0
,
SNDRV_PCM_HW_PARAM_CHANNELS
,
snd_hdspm_hw_rule_out_channels
,
hdspm
,
(
playback
?
snd_hdspm_hw_rule_out_channels
:
snd_hdspm_hw_rule_in_channels
),
hdspm
,
SNDRV_PCM_HW_PARAM_CHANNELS
,
-
1
);
snd_pcm_hw_rule_add
(
runtime
,
0
,
SNDRV_PCM_HW_PARAM_CHANNELS
,
snd_hdspm_hw_rule_out_channels_rate
,
hdspm
,
(
playback
?
snd_hdspm_hw_rule_out_channels_rate
:
snd_hdspm_hw_rule_in_channels_rate
),
hdspm
,
SNDRV_PCM_HW_PARAM_RATE
,
-
1
);
return
0
;
}
static
int
snd_hdspm_
playback_
release
(
struct
snd_pcm_substream
*
substream
)
static
int
snd_hdspm_release
(
struct
snd_pcm_substream
*
substream
)
{
struct
hdspm
*
hdspm
=
snd_pcm_substream_chip
(
substream
);
bool
playback
=
(
substream
->
stream
==
SNDRV_PCM_STREAM_PLAYBACK
);
spin_lock_irq
(
&
hdspm
->
lock
);
hdspm
->
playback_pid
=
-
1
;
hdspm
->
playback_substream
=
NULL
;
spin_unlock_irq
(
&
hdspm
->
lock
);
return
0
;
}
static
int
snd_hdspm_capture_open
(
struct
snd_pcm_substream
*
substream
)
{
struct
hdspm
*
hdspm
=
snd_pcm_substream_chip
(
substream
);
struct
snd_pcm_runtime
*
runtime
=
substream
->
runtime
;
spin_lock_irq
(
&
hdspm
->
lock
);
snd_pcm_set_sync
(
substream
);
runtime
->
hw
=
snd_hdspm_capture_subinfo
;
if
(
hdspm
->
playback_substream
==
NULL
)
hdspm_stop_audio
(
hdspm
);
hdspm
->
capture_pid
=
current
->
pid
;
hdspm
->
capture_substream
=
substream
;
spin_unlock_irq
(
&
hdspm
->
lock
);
snd_pcm_hw_constraint_msbits
(
runtime
,
0
,
32
,
24
);
snd_pcm_hw_constraint_pow2
(
runtime
,
0
,
SNDRV_PCM_HW_PARAM_PERIOD_SIZE
);
switch
(
hdspm
->
io_type
)
{
case
AIO
:
case
RayDAT
:
snd_pcm_hw_constraint_minmax
(
runtime
,
SNDRV_PCM_HW_PARAM_PERIOD_SIZE
,
32
,
4096
);
snd_pcm_hw_constraint_minmax
(
runtime
,
SNDRV_PCM_HW_PARAM_BUFFER_SIZE
,
16384
,
16384
);
break
;
default:
snd_pcm_hw_constraint_minmax
(
runtime
,
SNDRV_PCM_HW_PARAM_PERIOD_SIZE
,
64
,
8192
);
snd_pcm_hw_constraint_minmax
(
runtime
,
SNDRV_PCM_HW_PARAM_PERIODS
,
2
,
2
);
break
;
}
if
(
AES32
==
hdspm
->
io_type
)
{
runtime
->
hw
.
rates
|=
SNDRV_PCM_RATE_KNOT
;
snd_pcm_hw_constraint_list
(
runtime
,
0
,
SNDRV_PCM_HW_PARAM_RATE
,
&
hdspm_hw_constraints_aes32_sample_rates
);
if
(
playback
)
{
hdspm
->
playback_pid
=
-
1
;
hdspm
->
playback_substream
=
NULL
;
}
else
{
snd_pcm_hw_rule_add
(
runtime
,
0
,
SNDRV_PCM_HW_PARAM_RATE
,
snd_hdspm_hw_rule_rate_in_channels
,
hdspm
,
SNDRV_PCM_HW_PARAM_CHANNELS
,
-
1
);
hdspm
->
capture_pid
=
-
1
;
hdspm
->
capture_substream
=
NULL
;
}
snd_pcm_hw_rule_add
(
runtime
,
0
,
SNDRV_PCM_HW_PARAM_CHANNELS
,
snd_hdspm_hw_rule_in_channels
,
hdspm
,
SNDRV_PCM_HW_PARAM_CHANNELS
,
-
1
);
snd_pcm_hw_rule_add
(
runtime
,
0
,
SNDRV_PCM_HW_PARAM_CHANNELS
,
snd_hdspm_hw_rule_in_channels_rate
,
hdspm
,
SNDRV_PCM_HW_PARAM_RATE
,
-
1
);
return
0
;
}
static
int
snd_hdspm_capture_release
(
struct
snd_pcm_substream
*
substream
)
{
struct
hdspm
*
hdspm
=
snd_pcm_substream_chip
(
substream
);
spin_lock_irq
(
&
hdspm
->
lock
);
hdspm
->
capture_pid
=
-
1
;
hdspm
->
capture_substream
=
NULL
;
spin_unlock_irq
(
&
hdspm
->
lock
);
return
0
;
}
...
...
@@ -6413,21 +6354,9 @@ static int snd_hdspm_hwdep_ioctl(struct snd_hwdep *hw, struct file *file,
return
0
;
}
static
struct
snd_pcm_ops
snd_hdspm_playback_ops
=
{
.
open
=
snd_hdspm_playback_open
,
.
close
=
snd_hdspm_playback_release
,
.
ioctl
=
snd_hdspm_ioctl
,
.
hw_params
=
snd_hdspm_hw_params
,
.
hw_free
=
snd_hdspm_hw_free
,
.
prepare
=
snd_hdspm_prepare
,
.
trigger
=
snd_hdspm_trigger
,
.
pointer
=
snd_hdspm_hw_pointer
,
.
page
=
snd_pcm_sgbuf_ops_page
,
};
static
struct
snd_pcm_ops
snd_hdspm_capture_ops
=
{
.
open
=
snd_hdspm_capture_open
,
.
close
=
snd_hdspm_capture_release
,
static
struct
snd_pcm_ops
snd_hdspm_ops
=
{
.
open
=
snd_hdspm_open
,
.
close
=
snd_hdspm_release
,
.
ioctl
=
snd_hdspm_ioctl
,
.
hw_params
=
snd_hdspm_hw_params
,
.
hw_free
=
snd_hdspm_hw_free
,
...
...
@@ -6521,9 +6450,9 @@ static int snd_hdspm_create_pcm(struct snd_card *card,
strcpy
(
pcm
->
name
,
hdspm
->
card_name
);
snd_pcm_set_ops
(
pcm
,
SNDRV_PCM_STREAM_PLAYBACK
,
&
snd_hdspm_
playback_
ops
);
&
snd_hdspm_ops
);
snd_pcm_set_ops
(
pcm
,
SNDRV_PCM_STREAM_CAPTURE
,
&
snd_hdspm_
capture_
ops
);
&
snd_hdspm_ops
);
pcm
->
info_flags
=
SNDRV_PCM_INFO_JOINT_DUPLEX
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录