Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
7d930ce2
cloud-kernel
项目概览
openanolis
/
cloud-kernel
大约 1 年 前同步成功
通知
158
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7d930ce2
编写于
9月 17, 2013
作者:
M
Mark Brown
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'asoc/topic/component' into asoc-core
Conflicts: include/sound/soc.h
上级
7f05cc98
cb470087
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
174 addition
and
104 deletion
+174
-104
include/sound/soc.h
include/sound/soc.h
+27
-14
sound/soc/soc-core.c
sound/soc/soc-core.c
+147
-90
未找到文件。
include/sound/soc.h
浏览文件 @
7d930ce2
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
#ifndef __LINUX_SND_SOC_H
#ifndef __LINUX_SND_SOC_H
#define __LINUX_SND_SOC_H
#define __LINUX_SND_SOC_H
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/platform_device.h>
#include <linux/types.h>
#include <linux/types.h>
#include <linux/notifier.h>
#include <linux/notifier.h>
...
@@ -630,6 +631,26 @@ struct snd_soc_compr_ops {
...
@@ -630,6 +631,26 @@ struct snd_soc_compr_ops {
int
(
*
trigger
)(
struct
snd_compr_stream
*
);
int
(
*
trigger
)(
struct
snd_compr_stream
*
);
};
};
/* component interface */
struct
snd_soc_component_driver
{
const
char
*
name
;
/* DT */
int
(
*
of_xlate_dai_name
)(
struct
snd_soc_component
*
component
,
struct
of_phandle_args
*
args
,
const
char
**
dai_name
);
};
struct
snd_soc_component
{
const
char
*
name
;
int
id
;
int
num_dai
;
struct
device
*
dev
;
struct
list_head
list
;
const
struct
snd_soc_component_driver
*
driver
;
};
/* SoC Audio Codec device */
/* SoC Audio Codec device */
struct
snd_soc_codec
{
struct
snd_soc_codec
{
const
char
*
name
;
const
char
*
name
;
...
@@ -670,6 +691,9 @@ struct snd_soc_codec {
...
@@ -670,6 +691,9 @@ struct snd_soc_codec {
struct
mutex
cache_rw_mutex
;
struct
mutex
cache_rw_mutex
;
int
val_bytes
;
int
val_bytes
;
/* component */
struct
snd_soc_component
component
;
/* dapm */
/* dapm */
struct
snd_soc_dapm_context
dapm
;
struct
snd_soc_dapm_context
dapm
;
unsigned
int
ignore_pmdown_time
:
1
;
/* pmdown_time is ignored at stop */
unsigned
int
ignore_pmdown_time
:
1
;
/* pmdown_time is ignored at stop */
...
@@ -688,6 +712,7 @@ struct snd_soc_codec_driver {
...
@@ -688,6 +712,7 @@ struct snd_soc_codec_driver {
int
(
*
remove
)(
struct
snd_soc_codec
*
);
int
(
*
remove
)(
struct
snd_soc_codec
*
);
int
(
*
suspend
)(
struct
snd_soc_codec
*
);
int
(
*
suspend
)(
struct
snd_soc_codec
*
);
int
(
*
resume
)(
struct
snd_soc_codec
*
);
int
(
*
resume
)(
struct
snd_soc_codec
*
);
struct
snd_soc_component_driver
component_driver
;
/* Default control and setup, added after probe() is run */
/* Default control and setup, added after probe() is run */
const
struct
snd_kcontrol_new
*
controls
;
const
struct
snd_kcontrol_new
*
controls
;
...
@@ -801,20 +826,6 @@ struct snd_soc_platform {
...
@@ -801,20 +826,6 @@ struct snd_soc_platform {
#endif
#endif
};
};
struct
snd_soc_component_driver
{
const
char
*
name
;
};
struct
snd_soc_component
{
const
char
*
name
;
int
id
;
int
num_dai
;
struct
device
*
dev
;
struct
list_head
list
;
const
struct
snd_soc_component_driver
*
driver
;
};
struct
snd_soc_dai_link
{
struct
snd_soc_dai_link
{
/* config - must be set by machine driver */
/* config - must be set by machine driver */
const
char
*
name
;
/* Codec name */
const
char
*
name
;
/* Codec name */
...
@@ -1145,6 +1156,8 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
...
@@ -1145,6 +1156,8 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
const
char
*
propname
);
const
char
*
propname
);
unsigned
int
snd_soc_of_parse_daifmt
(
struct
device_node
*
np
,
unsigned
int
snd_soc_of_parse_daifmt
(
struct
device_node
*
np
,
const
char
*
prefix
);
const
char
*
prefix
);
int
snd_soc_of_get_dai_name
(
struct
device_node
*
of_node
,
const
char
**
dai_name
);
#include <sound/soc-dai.h>
#include <sound/soc-dai.h>
...
...
sound/soc/soc-core.c
浏览文件 @
7d930ce2
...
@@ -3995,6 +3995,112 @@ static void snd_soc_unregister_dais(struct device *dev, size_t count)
...
@@ -3995,6 +3995,112 @@ static void snd_soc_unregister_dais(struct device *dev, size_t count)
snd_soc_unregister_dai
(
dev
);
snd_soc_unregister_dai
(
dev
);
}
}
/**
* snd_soc_register_component - Register a component with the ASoC core
*
*/
static
int
__snd_soc_register_component
(
struct
device
*
dev
,
struct
snd_soc_component
*
cmpnt
,
const
struct
snd_soc_component_driver
*
cmpnt_drv
,
struct
snd_soc_dai_driver
*
dai_drv
,
int
num_dai
,
bool
allow_single_dai
)
{
int
ret
;
dev_dbg
(
dev
,
"component register %s
\n
"
,
dev_name
(
dev
));
if
(
!
cmpnt
)
{
dev_err
(
dev
,
"ASoC: Failed to connecting component
\n
"
);
return
-
ENOMEM
;
}
cmpnt
->
name
=
fmt_single_name
(
dev
,
&
cmpnt
->
id
);
if
(
!
cmpnt
->
name
)
{
dev_err
(
dev
,
"ASoC: Failed to simplifying name
\n
"
);
return
-
ENOMEM
;
}
cmpnt
->
dev
=
dev
;
cmpnt
->
driver
=
cmpnt_drv
;
cmpnt
->
num_dai
=
num_dai
;
/*
* snd_soc_register_dai() uses fmt_single_name(), and
* snd_soc_register_dais() uses fmt_multiple_name()
* for dai->name which is used for name based matching
*
* this function is used from cpu/codec.
* allow_single_dai flag can ignore "codec" driver reworking
* since it had been used snd_soc_register_dais(),
*/
if
((
1
==
num_dai
)
&&
allow_single_dai
)
ret
=
snd_soc_register_dai
(
dev
,
dai_drv
);
else
ret
=
snd_soc_register_dais
(
dev
,
dai_drv
,
num_dai
);
if
(
ret
<
0
)
{
dev_err
(
dev
,
"ASoC: Failed to regster DAIs: %d
\n
"
,
ret
);
goto
error_component_name
;
}
mutex_lock
(
&
client_mutex
);
list_add
(
&
cmpnt
->
list
,
&
component_list
);
mutex_unlock
(
&
client_mutex
);
dev_dbg
(
cmpnt
->
dev
,
"ASoC: Registered component '%s'
\n
"
,
cmpnt
->
name
);
return
ret
;
error_component_name:
kfree
(
cmpnt
->
name
);
return
ret
;
}
int
snd_soc_register_component
(
struct
device
*
dev
,
const
struct
snd_soc_component_driver
*
cmpnt_drv
,
struct
snd_soc_dai_driver
*
dai_drv
,
int
num_dai
)
{
struct
snd_soc_component
*
cmpnt
;
cmpnt
=
devm_kzalloc
(
dev
,
sizeof
(
*
cmpnt
),
GFP_KERNEL
);
if
(
!
cmpnt
)
{
dev_err
(
dev
,
"ASoC: Failed to allocate memory
\n
"
);
return
-
ENOMEM
;
}
return
__snd_soc_register_component
(
dev
,
cmpnt
,
cmpnt_drv
,
dai_drv
,
num_dai
,
true
);
}
EXPORT_SYMBOL_GPL
(
snd_soc_register_component
);
/**
* snd_soc_unregister_component - Unregister a component from the ASoC core
*
*/
void
snd_soc_unregister_component
(
struct
device
*
dev
)
{
struct
snd_soc_component
*
cmpnt
;
list_for_each_entry
(
cmpnt
,
&
component_list
,
list
)
{
if
(
dev
==
cmpnt
->
dev
)
goto
found
;
}
return
;
found:
snd_soc_unregister_dais
(
dev
,
cmpnt
->
num_dai
);
mutex_lock
(
&
client_mutex
);
list_del
(
&
cmpnt
->
list
);
mutex_unlock
(
&
client_mutex
);
dev_dbg
(
dev
,
"ASoC: Unregistered component '%s'
\n
"
,
cmpnt
->
name
);
kfree
(
cmpnt
->
name
);
}
EXPORT_SYMBOL_GPL
(
snd_soc_unregister_component
);
/**
/**
* snd_soc_add_platform - Add a platform to the ASoC core
* snd_soc_add_platform - Add a platform to the ASoC core
* @dev: The parent device for the platform
* @dev: The parent device for the platform
...
@@ -4182,10 +4288,12 @@ int snd_soc_register_codec(struct device *dev,
...
@@ -4182,10 +4288,12 @@ int snd_soc_register_codec(struct device *dev,
list_add
(
&
codec
->
list
,
&
codec_list
);
list_add
(
&
codec
->
list
,
&
codec_list
);
mutex_unlock
(
&
client_mutex
);
mutex_unlock
(
&
client_mutex
);
/* register any DAIs */
/* register component */
ret
=
snd_soc_register_dais
(
dev
,
dai_drv
,
num_dai
);
ret
=
__snd_soc_register_component
(
dev
,
&
codec
->
component
,
&
codec_drv
->
component_driver
,
dai_drv
,
num_dai
,
false
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
dev_err
(
codec
->
dev
,
"ASoC: Failed to regster
DAIs
: %d
\n
"
,
ret
);
dev_err
(
codec
->
dev
,
"ASoC: Failed to regster
component
: %d
\n
"
,
ret
);
goto
fail_codec_name
;
goto
fail_codec_name
;
}
}
...
@@ -4220,7 +4328,7 @@ void snd_soc_unregister_codec(struct device *dev)
...
@@ -4220,7 +4328,7 @@ void snd_soc_unregister_codec(struct device *dev)
return
;
return
;
found:
found:
snd_soc_unregister_
dais
(
dev
,
codec
->
num_dai
);
snd_soc_unregister_
component
(
dev
);
mutex_lock
(
&
client_mutex
);
mutex_lock
(
&
client_mutex
);
list_del
(
&
codec
->
list
);
list_del
(
&
codec
->
list
);
...
@@ -4234,92 +4342,6 @@ void snd_soc_unregister_codec(struct device *dev)
...
@@ -4234,92 +4342,6 @@ void snd_soc_unregister_codec(struct device *dev)
}
}
EXPORT_SYMBOL_GPL
(
snd_soc_unregister_codec
);
EXPORT_SYMBOL_GPL
(
snd_soc_unregister_codec
);
/**
* snd_soc_register_component - Register a component with the ASoC core
*
*/
int
snd_soc_register_component
(
struct
device
*
dev
,
const
struct
snd_soc_component_driver
*
cmpnt_drv
,
struct
snd_soc_dai_driver
*
dai_drv
,
int
num_dai
)
{
struct
snd_soc_component
*
cmpnt
;
int
ret
;
dev_dbg
(
dev
,
"component register %s
\n
"
,
dev_name
(
dev
));
cmpnt
=
devm_kzalloc
(
dev
,
sizeof
(
*
cmpnt
),
GFP_KERNEL
);
if
(
!
cmpnt
)
{
dev_err
(
dev
,
"ASoC: Failed to allocate memory
\n
"
);
return
-
ENOMEM
;
}
cmpnt
->
name
=
fmt_single_name
(
dev
,
&
cmpnt
->
id
);
if
(
!
cmpnt
->
name
)
{
dev_err
(
dev
,
"ASoC: Failed to simplifying name
\n
"
);
return
-
ENOMEM
;
}
cmpnt
->
dev
=
dev
;
cmpnt
->
driver
=
cmpnt_drv
;
cmpnt
->
num_dai
=
num_dai
;
/*
* snd_soc_register_dai() uses fmt_single_name(), and
* snd_soc_register_dais() uses fmt_multiple_name()
* for dai->name which is used for name based matching
*/
if
(
1
==
num_dai
)
ret
=
snd_soc_register_dai
(
dev
,
dai_drv
);
else
ret
=
snd_soc_register_dais
(
dev
,
dai_drv
,
num_dai
);
if
(
ret
<
0
)
{
dev_err
(
dev
,
"ASoC: Failed to regster DAIs: %d
\n
"
,
ret
);
goto
error_component_name
;
}
mutex_lock
(
&
client_mutex
);
list_add
(
&
cmpnt
->
list
,
&
component_list
);
mutex_unlock
(
&
client_mutex
);
dev_dbg
(
cmpnt
->
dev
,
"ASoC: Registered component '%s'
\n
"
,
cmpnt
->
name
);
return
ret
;
error_component_name:
kfree
(
cmpnt
->
name
);
return
ret
;
}
EXPORT_SYMBOL_GPL
(
snd_soc_register_component
);
/**
* snd_soc_unregister_component - Unregister a component from the ASoC core
*
*/
void
snd_soc_unregister_component
(
struct
device
*
dev
)
{
struct
snd_soc_component
*
cmpnt
;
list_for_each_entry
(
cmpnt
,
&
component_list
,
list
)
{
if
(
dev
==
cmpnt
->
dev
)
goto
found
;
}
return
;
found:
snd_soc_unregister_dais
(
dev
,
cmpnt
->
num_dai
);
mutex_lock
(
&
client_mutex
);
list_del
(
&
cmpnt
->
list
);
mutex_unlock
(
&
client_mutex
);
dev_dbg
(
dev
,
"ASoC: Unregistered component '%s'
\n
"
,
cmpnt
->
name
);
kfree
(
cmpnt
->
name
);
}
EXPORT_SYMBOL_GPL
(
snd_soc_unregister_component
);
/* Retrieve a card's name from device tree */
/* Retrieve a card's name from device tree */
int
snd_soc_of_parse_card_name
(
struct
snd_soc_card
*
card
,
int
snd_soc_of_parse_card_name
(
struct
snd_soc_card
*
card
,
const
char
*
propname
)
const
char
*
propname
)
...
@@ -4507,6 +4529,41 @@ unsigned int snd_soc_of_parse_daifmt(struct device_node *np,
...
@@ -4507,6 +4529,41 @@ unsigned int snd_soc_of_parse_daifmt(struct device_node *np,
}
}
EXPORT_SYMBOL_GPL
(
snd_soc_of_parse_daifmt
);
EXPORT_SYMBOL_GPL
(
snd_soc_of_parse_daifmt
);
int
snd_soc_of_get_dai_name
(
struct
device_node
*
of_node
,
const
char
**
dai_name
)
{
struct
snd_soc_component
*
pos
;
struct
of_phandle_args
args
;
int
ret
;
ret
=
of_parse_phandle_with_args
(
of_node
,
"sound-dai"
,
"#sound-dai-cells"
,
0
,
&
args
);
if
(
ret
)
return
ret
;
ret
=
-
EPROBE_DEFER
;
mutex_lock
(
&
client_mutex
);
list_for_each_entry
(
pos
,
&
component_list
,
list
)
{
if
(
pos
->
dev
->
of_node
!=
args
.
np
)
continue
;
if
(
!
pos
->
driver
->
of_xlate_dai_name
)
{
ret
=
-
ENOSYS
;
break
;
}
ret
=
pos
->
driver
->
of_xlate_dai_name
(
pos
,
&
args
,
dai_name
);
break
;
}
mutex_unlock
(
&
client_mutex
);
of_node_put
(
args
.
np
);
return
ret
;
}
EXPORT_SYMBOL_GPL
(
snd_soc_of_get_dai_name
);
static
int
__init
snd_soc_init
(
void
)
static
int
__init
snd_soc_init
(
void
)
{
{
#ifdef CONFIG_DEBUG_FS
#ifdef CONFIG_DEBUG_FS
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录