Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
a93202fa
Commit
a93202fa
authored
Dec 23, 2015
by
Mark Brown
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'asoc/topic/pcm-list' into asoc-next
parents
3b88210d
61b0088b
Changes
21
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
556 additions
and
281 deletions
+556
-281
include/sound/soc.h
include/sound/soc.h
+22
-3
sound/soc/fsl/fsl-asoc-card.c
sound/soc/fsl/fsl-asoc-card.c
+8
-3
sound/soc/fsl/imx-wm8962.c
sound/soc/fsl/imx-wm8962.c
+8
-2
sound/soc/generic/simple-card.c
sound/soc/generic/simple-card.c
+5
-7
sound/soc/intel/atom/sst-mfld-platform-pcm.c
sound/soc/intel/atom/sst-mfld-platform-pcm.c
+6
-6
sound/soc/intel/boards/cht_bsw_max98090_ti.c
sound/soc/intel/boards/cht_bsw_max98090_ti.c
+2
-5
sound/soc/intel/boards/cht_bsw_rt5645.c
sound/soc/intel/boards/cht_bsw_rt5645.c
+2
-5
sound/soc/intel/boards/cht_bsw_rt5672.c
sound/soc/intel/boards/cht_bsw_rt5672.c
+2
-5
sound/soc/pxa/mioa701_wm9713.c
sound/soc/pxa/mioa701_wm9713.c
+5
-1
sound/soc/samsung/bells.c
sound/soc/samsung/bells.c
+30
-10
sound/soc/samsung/littlemill.c
sound/soc/samsung/littlemill.c
+26
-6
sound/soc/samsung/odroidx2_max98090.c
sound/soc/samsung/odroidx2_max98090.c
+7
-2
sound/soc/samsung/snow.c
sound/soc/samsung/snow.c
+7
-2
sound/soc/samsung/speyside.c
sound/soc/samsung/speyside.c
+10
-2
sound/soc/samsung/tobermory.c
sound/soc/samsung/tobermory.c
+17
-4
sound/soc/sh/rcar/core.c
sound/soc/sh/rcar/core.c
+1
-2
sound/soc/sh/rcar/rsrc-card.c
sound/soc/sh/rcar/rsrc-card.c
+3
-3
sound/soc/soc-core.c
sound/soc/soc-core.c
+381
-195
sound/soc/soc-dapm.c
sound/soc/soc-dapm.c
+2
-5
sound/soc/soc-pcm.c
sound/soc/soc-pcm.c
+10
-12
sound/soc/tegra/tegra_wm8903.c
sound/soc/tegra/tegra_wm8903.c
+2
-1
No files found.
include/sound/soc.h
View file @
a93202fa
...
@@ -1040,6 +1040,9 @@ struct snd_soc_dai_link {
...
@@ -1040,6 +1040,9 @@ struct snd_soc_dai_link {
/* pmdown_time is ignored at stop */
/* pmdown_time is ignored at stop */
unsigned
int
ignore_pmdown_time
:
1
;
unsigned
int
ignore_pmdown_time
:
1
;
struct
list_head
list
;
/* DAI link list of the soc card */
struct
snd_soc_dobj
dobj
;
/* For topology */
};
};
struct
snd_soc_codec_conf
{
struct
snd_soc_codec_conf
{
...
@@ -1104,12 +1107,20 @@ struct snd_soc_card {
...
@@ -1104,12 +1107,20 @@ struct snd_soc_card {
struct
snd_soc_dapm_context
*
dapm
,
struct
snd_soc_dapm_context
*
dapm
,
enum
snd_soc_bias_level
level
);
enum
snd_soc_bias_level
level
);
int
(
*
add_dai_link
)(
struct
snd_soc_card
*
,
struct
snd_soc_dai_link
*
link
);
void
(
*
remove_dai_link
)(
struct
snd_soc_card
*
,
struct
snd_soc_dai_link
*
link
);
long
pmdown_time
;
long
pmdown_time
;
/* CPU <--> Codec DAI links */
/* CPU <--> Codec DAI links */
struct
snd_soc_dai_link
*
dai_link
;
struct
snd_soc_dai_link
*
dai_link
;
/* predefined links only */
int
num_links
;
int
num_links
;
/* predefined links only */
struct
snd_soc_pcm_runtime
*
rtd
;
struct
list_head
dai_link_list
;
/* all links */
int
num_dai_links
;
struct
list_head
rtd_list
;
int
num_rtd
;
int
num_rtd
;
/* optional codec specific configuration */
/* optional codec specific configuration */
...
@@ -1204,6 +1215,9 @@ struct snd_soc_pcm_runtime {
...
@@ -1204,6 +1215,9 @@ struct snd_soc_pcm_runtime {
struct
dentry
*
debugfs_dpcm_root
;
struct
dentry
*
debugfs_dpcm_root
;
struct
dentry
*
debugfs_dpcm_state
;
struct
dentry
*
debugfs_dpcm_state
;
#endif
#endif
unsigned
int
num
;
/* 0-based and monotonic increasing */
struct
list_head
list
;
/* rtd list of the soc card */
};
};
/* mixer control */
/* mixer control */
...
@@ -1647,6 +1661,11 @@ int snd_soc_of_get_dai_link_codecs(struct device *dev,
...
@@ -1647,6 +1661,11 @@ int snd_soc_of_get_dai_link_codecs(struct device *dev,
struct
device_node
*
of_node
,
struct
device_node
*
of_node
,
struct
snd_soc_dai_link
*
dai_link
);
struct
snd_soc_dai_link
*
dai_link
);
int
snd_soc_add_dai_link
(
struct
snd_soc_card
*
card
,
struct
snd_soc_dai_link
*
dai_link
);
void
snd_soc_remove_dai_link
(
struct
snd_soc_card
*
card
,
struct
snd_soc_dai_link
*
dai_link
);
#include <sound/soc-dai.h>
#include <sound/soc-dai.h>
#ifdef CONFIG_DEBUG_FS
#ifdef CONFIG_DEBUG_FS
...
...
sound/soc/fsl/fsl-asoc-card.c
View file @
a93202fa
...
@@ -222,12 +222,15 @@ static int fsl_asoc_card_set_bias_level(struct snd_soc_card *card,
...
@@ -222,12 +222,15 @@ static int fsl_asoc_card_set_bias_level(struct snd_soc_card *card,
enum
snd_soc_bias_level
level
)
enum
snd_soc_bias_level
level
)
{
{
struct
fsl_asoc_card_priv
*
priv
=
snd_soc_card_get_drvdata
(
card
);
struct
fsl_asoc_card_priv
*
priv
=
snd_soc_card_get_drvdata
(
card
);
struct
snd_soc_dai
*
codec_dai
=
card
->
rtd
[
0
].
codec_dai
;
struct
snd_soc_pcm_runtime
*
rtd
;
struct
snd_soc_dai
*
codec_dai
;
struct
codec_priv
*
codec_priv
=
&
priv
->
codec_priv
;
struct
codec_priv
*
codec_priv
=
&
priv
->
codec_priv
;
struct
device
*
dev
=
card
->
dev
;
struct
device
*
dev
=
card
->
dev
;
unsigned
int
pll_out
;
unsigned
int
pll_out
;
int
ret
;
int
ret
;
rtd
=
snd_soc_get_pcm_runtime
(
card
,
card
->
dai_link
[
0
].
name
);
codec_dai
=
rtd
->
codec_dai
;
if
(
dapm
->
dev
!=
codec_dai
->
dev
)
if
(
dapm
->
dev
!=
codec_dai
->
dev
)
return
0
;
return
0
;
...
@@ -414,14 +417,16 @@ static int fsl_asoc_card_audmux_init(struct device_node *np,
...
@@ -414,14 +417,16 @@ static int fsl_asoc_card_audmux_init(struct device_node *np,
static
int
fsl_asoc_card_late_probe
(
struct
snd_soc_card
*
card
)
static
int
fsl_asoc_card_late_probe
(
struct
snd_soc_card
*
card
)
{
{
struct
fsl_asoc_card_priv
*
priv
=
snd_soc_card_get_drvdata
(
card
);
struct
fsl_asoc_card_priv
*
priv
=
snd_soc_card_get_drvdata
(
card
);
struct
snd_soc_dai
*
codec_dai
=
card
->
rtd
[
0
].
codec_dai
;
struct
snd_soc_pcm_runtime
*
rtd
=
list_first_entry
(
&
card
->
rtd_list
,
struct
snd_soc_pcm_runtime
,
list
);
struct
snd_soc_dai
*
codec_dai
=
rtd
->
codec_dai
;
struct
codec_priv
*
codec_priv
=
&
priv
->
codec_priv
;
struct
codec_priv
*
codec_priv
=
&
priv
->
codec_priv
;
struct
device
*
dev
=
card
->
dev
;
struct
device
*
dev
=
card
->
dev
;
int
ret
;
int
ret
;
if
(
fsl_asoc_card_is_ac97
(
priv
))
{
if
(
fsl_asoc_card_is_ac97
(
priv
))
{
#if IS_ENABLED(CONFIG_SND_AC97_CODEC)
#if IS_ENABLED(CONFIG_SND_AC97_CODEC)
struct
snd_soc_codec
*
codec
=
card
->
rtd
[
0
].
codec
;
struct
snd_soc_codec
*
codec
=
rtd
->
codec
;
struct
snd_ac97
*
ac97
=
snd_soc_codec_get_drvdata
(
codec
);
struct
snd_ac97
*
ac97
=
snd_soc_codec_get_drvdata
(
codec
);
/*
/*
...
...
sound/soc/fsl/imx-wm8962.c
View file @
a93202fa
...
@@ -69,13 +69,16 @@ static int imx_wm8962_set_bias_level(struct snd_soc_card *card,
...
@@ -69,13 +69,16 @@ static int imx_wm8962_set_bias_level(struct snd_soc_card *card,
struct
snd_soc_dapm_context
*
dapm
,
struct
snd_soc_dapm_context
*
dapm
,
enum
snd_soc_bias_level
level
)
enum
snd_soc_bias_level
level
)
{
{
struct
snd_soc_dai
*
codec_dai
=
card
->
rtd
[
0
].
codec_dai
;
struct
snd_soc_pcm_runtime
*
rtd
;
struct
snd_soc_dai
*
codec_dai
;
struct
imx_priv
*
priv
=
&
card_priv
;
struct
imx_priv
*
priv
=
&
card_priv
;
struct
imx_wm8962_data
*
data
=
snd_soc_card_get_drvdata
(
card
);
struct
imx_wm8962_data
*
data
=
snd_soc_card_get_drvdata
(
card
);
struct
device
*
dev
=
&
priv
->
pdev
->
dev
;
struct
device
*
dev
=
&
priv
->
pdev
->
dev
;
unsigned
int
pll_out
;
unsigned
int
pll_out
;
int
ret
;
int
ret
;
rtd
=
snd_soc_get_pcm_runtime
(
card
,
card
->
dai_link
[
0
].
name
);
codec_dai
=
rtd
->
codec_dai
;
if
(
dapm
->
dev
!=
codec_dai
->
dev
)
if
(
dapm
->
dev
!=
codec_dai
->
dev
)
return
0
;
return
0
;
...
@@ -135,12 +138,15 @@ static int imx_wm8962_set_bias_level(struct snd_soc_card *card,
...
@@ -135,12 +138,15 @@ static int imx_wm8962_set_bias_level(struct snd_soc_card *card,
static
int
imx_wm8962_late_probe
(
struct
snd_soc_card
*
card
)
static
int
imx_wm8962_late_probe
(
struct
snd_soc_card
*
card
)
{
{
struct
snd_soc_dai
*
codec_dai
=
card
->
rtd
[
0
].
codec_dai
;
struct
snd_soc_pcm_runtime
*
rtd
;
struct
snd_soc_dai
*
codec_dai
;
struct
imx_priv
*
priv
=
&
card_priv
;
struct
imx_priv
*
priv
=
&
card_priv
;
struct
imx_wm8962_data
*
data
=
snd_soc_card_get_drvdata
(
card
);
struct
imx_wm8962_data
*
data
=
snd_soc_card_get_drvdata
(
card
);
struct
device
*
dev
=
&
priv
->
pdev
->
dev
;
struct
device
*
dev
=
&
priv
->
pdev
->
dev
;
int
ret
;
int
ret
;
rtd
=
snd_soc_get_pcm_runtime
(
card
,
card
->
dai_link
[
0
].
name
);
codec_dai
=
rtd
->
codec_dai
;
ret
=
snd_soc_dai_set_sysclk
(
codec_dai
,
WM8962_SYSCLK_MCLK
,
ret
=
snd_soc_dai_set_sysclk
(
codec_dai
,
WM8962_SYSCLK_MCLK
,
data
->
clk_frequency
,
SND_SOC_CLOCK_IN
);
data
->
clk_frequency
,
SND_SOC_CLOCK_IN
);
if
(
ret
<
0
)
if
(
ret
<
0
)
...
...
sound/soc/generic/simple-card.c
View file @
a93202fa
...
@@ -45,7 +45,7 @@ static int asoc_simple_card_startup(struct snd_pcm_substream *substream)
...
@@ -45,7 +45,7 @@ static int asoc_simple_card_startup(struct snd_pcm_substream *substream)
struct
snd_soc_pcm_runtime
*
rtd
=
substream
->
private_data
;
struct
snd_soc_pcm_runtime
*
rtd
=
substream
->
private_data
;
struct
simple_card_data
*
priv
=
snd_soc_card_get_drvdata
(
rtd
->
card
);
struct
simple_card_data
*
priv
=
snd_soc_card_get_drvdata
(
rtd
->
card
);
struct
simple_dai_props
*
dai_props
=
struct
simple_dai_props
*
dai_props
=
&
priv
->
dai_props
[
rtd
-
rtd
->
card
->
rtd
];
&
priv
->
dai_props
[
rtd
->
num
];
int
ret
;
int
ret
;
ret
=
clk_prepare_enable
(
dai_props
->
cpu_dai
.
clk
);
ret
=
clk_prepare_enable
(
dai_props
->
cpu_dai
.
clk
);
...
@@ -64,7 +64,7 @@ static void asoc_simple_card_shutdown(struct snd_pcm_substream *substream)
...
@@ -64,7 +64,7 @@ static void asoc_simple_card_shutdown(struct snd_pcm_substream *substream)
struct
snd_soc_pcm_runtime
*
rtd
=
substream
->
private_data
;
struct
snd_soc_pcm_runtime
*
rtd
=
substream
->
private_data
;
struct
simple_card_data
*
priv
=
snd_soc_card_get_drvdata
(
rtd
->
card
);
struct
simple_card_data
*
priv
=
snd_soc_card_get_drvdata
(
rtd
->
card
);
struct
simple_dai_props
*
dai_props
=
struct
simple_dai_props
*
dai_props
=
&
priv
->
dai_props
[
rtd
-
rtd
->
card
->
rtd
];
&
priv
->
dai_props
[
rtd
->
num
];
clk_disable_unprepare
(
dai_props
->
cpu_dai
.
clk
);
clk_disable_unprepare
(
dai_props
->
cpu_dai
.
clk
);
...
@@ -78,8 +78,7 @@ static int asoc_simple_card_hw_params(struct snd_pcm_substream *substream,
...
@@ -78,8 +78,7 @@ static int asoc_simple_card_hw_params(struct snd_pcm_substream *substream,
struct
snd_soc_dai
*
codec_dai
=
rtd
->
codec_dai
;
struct
snd_soc_dai
*
codec_dai
=
rtd
->
codec_dai
;
struct
snd_soc_dai
*
cpu_dai
=
rtd
->
cpu_dai
;
struct
snd_soc_dai
*
cpu_dai
=
rtd
->
cpu_dai
;
struct
simple_card_data
*
priv
=
snd_soc_card_get_drvdata
(
rtd
->
card
);
struct
simple_card_data
*
priv
=
snd_soc_card_get_drvdata
(
rtd
->
card
);
struct
simple_dai_props
*
dai_props
=
struct
simple_dai_props
*
dai_props
=
&
priv
->
dai_props
[
rtd
->
num
];
&
priv
->
dai_props
[
rtd
-
rtd
->
card
->
rtd
];
unsigned
int
mclk
,
mclk_fs
=
0
;
unsigned
int
mclk
,
mclk_fs
=
0
;
int
ret
=
0
;
int
ret
=
0
;
...
@@ -174,10 +173,9 @@ static int asoc_simple_card_dai_init(struct snd_soc_pcm_runtime *rtd)
...
@@ -174,10 +173,9 @@ static int asoc_simple_card_dai_init(struct snd_soc_pcm_runtime *rtd)
struct
snd_soc_dai
*
codec
=
rtd
->
codec_dai
;
struct
snd_soc_dai
*
codec
=
rtd
->
codec_dai
;
struct
snd_soc_dai
*
cpu
=
rtd
->
cpu_dai
;
struct
snd_soc_dai
*
cpu
=
rtd
->
cpu_dai
;
struct
simple_dai_props
*
dai_props
;
struct
simple_dai_props
*
dai_props
;
int
num
,
ret
;
int
ret
;
num
=
rtd
-
rtd
->
card
->
rtd
;
dai_props
=
&
priv
->
dai_props
[
rtd
->
num
];
dai_props
=
&
priv
->
dai_props
[
num
];
ret
=
__asoc_simple_card_dai_init
(
codec
,
&
dai_props
->
codec_dai
);
ret
=
__asoc_simple_card_dai_init
(
codec
,
&
dai_props
->
codec_dai
);
if
(
ret
<
0
)
if
(
ret
<
0
)
return
ret
;
return
ret
;
...
...
sound/soc/intel/atom/sst-mfld-platform-pcm.c
View file @
a93202fa
...
@@ -760,15 +760,15 @@ static int sst_platform_remove(struct platform_device *pdev)
...
@@ -760,15 +760,15 @@ static int sst_platform_remove(struct platform_device *pdev)
static
int
sst_soc_prepare
(
struct
device
*
dev
)
static
int
sst_soc_prepare
(
struct
device
*
dev
)
{
{
struct
sst_data
*
drv
=
dev_get_drvdata
(
dev
);
struct
sst_data
*
drv
=
dev_get_drvdata
(
dev
);
int
i
;
struct
snd_soc_pcm_runtime
*
rtd
;
/* suspend all pcms first */
/* suspend all pcms first */
snd_soc_suspend
(
drv
->
soc_card
->
dev
);
snd_soc_suspend
(
drv
->
soc_card
->
dev
);
snd_soc_poweroff
(
drv
->
soc_card
->
dev
);
snd_soc_poweroff
(
drv
->
soc_card
->
dev
);
/* set the SSPs to idle */
/* set the SSPs to idle */
for
(
i
=
0
;
i
<
drv
->
soc_card
->
num_rtd
;
i
++
)
{
list_for_each_entry
(
rtd
,
&
drv
->
soc_card
->
rtd_list
,
list
)
{
struct
snd_soc_dai
*
dai
=
drv
->
soc_card
->
rtd
[
i
].
cpu_dai
;
struct
snd_soc_dai
*
dai
=
rtd
->
cpu_dai
;
if
(
dai
->
active
)
{
if
(
dai
->
active
)
{
send_ssp_cmd
(
dai
,
dai
->
name
,
0
);
send_ssp_cmd
(
dai
,
dai
->
name
,
0
);
...
@@ -782,11 +782,11 @@ static int sst_soc_prepare(struct device *dev)
...
@@ -782,11 +782,11 @@ static int sst_soc_prepare(struct device *dev)
static
void
sst_soc_complete
(
struct
device
*
dev
)
static
void
sst_soc_complete
(
struct
device
*
dev
)
{
{
struct
sst_data
*
drv
=
dev_get_drvdata
(
dev
);
struct
sst_data
*
drv
=
dev_get_drvdata
(
dev
);
int
i
;
struct
snd_soc_pcm_runtime
*
rtd
;
/* restart SSPs */
/* restart SSPs */
for
(
i
=
0
;
i
<
drv
->
soc_card
->
num_rtd
;
i
++
)
{
list_for_each_entry
(
rtd
,
&
drv
->
soc_card
->
rtd_list
,
list
)
{
struct
snd_soc_dai
*
dai
=
drv
->
soc_card
->
rtd
[
i
].
cpu_dai
;
struct
snd_soc_dai
*
dai
=
rtd
->
cpu_dai
;
if
(
dai
->
active
)
{
if
(
dai
->
active
)
{
sst_handle_vb_timer
(
dai
,
true
);
sst_handle_vb_timer
(
dai
,
true
);
...
...
sound/soc/intel/boards/cht_bsw_max98090_ti.c
View file @
a93202fa
...
@@ -41,12 +41,9 @@ struct cht_mc_private {
...
@@ -41,12 +41,9 @@ struct cht_mc_private {
static
inline
struct
snd_soc_dai
*
cht_get_codec_dai
(
struct
snd_soc_card
*
card
)
static
inline
struct
snd_soc_dai
*
cht_get_codec_dai
(
struct
snd_soc_card
*
card
)
{
{
int
i
;
struct
snd_soc_pcm_runtime
*
rtd
;
for
(
i
=
0
;
i
<
card
->
num_rtd
;
i
++
)
{
list_for_each_entry
(
rtd
,
&
card
->
rtd_list
,
list
)
{
struct
snd_soc_pcm_runtime
*
rtd
;
rtd
=
card
->
rtd
+
i
;
if
(
!
strncmp
(
rtd
->
codec_dai
->
name
,
CHT_CODEC_DAI
,
if
(
!
strncmp
(
rtd
->
codec_dai
->
name
,
CHT_CODEC_DAI
,
strlen
(
CHT_CODEC_DAI
)))
strlen
(
CHT_CODEC_DAI
)))
return
rtd
->
codec_dai
;
return
rtd
->
codec_dai
;
...
...
sound/soc/intel/boards/cht_bsw_rt5645.c
View file @
a93202fa
...
@@ -47,12 +47,9 @@ struct cht_mc_private {
...
@@ -47,12 +47,9 @@ struct cht_mc_private {
static
inline
struct
snd_soc_dai
*
cht_get_codec_dai
(
struct
snd_soc_card
*
card
)
static
inline
struct
snd_soc_dai
*
cht_get_codec_dai
(
struct
snd_soc_card
*
card
)
{
{
int
i
;
struct
snd_soc_pcm_runtime
*
rtd
;
for
(
i
=
0
;
i
<
card
->
num_rtd
;
i
++
)
{
struct
snd_soc_pcm_runtime
*
rtd
;
rtd
=
card
->
rtd
+
i
;
list_for_each_entry
(
rtd
,
&
card
->
rtd_list
,
list
)
{
if
(
!
strncmp
(
rtd
->
codec_dai
->
name
,
CHT_CODEC_DAI
,
if
(
!
strncmp
(
rtd
->
codec_dai
->
name
,
CHT_CODEC_DAI
,
strlen
(
CHT_CODEC_DAI
)))
strlen
(
CHT_CODEC_DAI
)))
return
rtd
->
codec_dai
;
return
rtd
->
codec_dai
;
...
...
sound/soc/intel/boards/cht_bsw_rt5672.c
View file @
a93202fa
...
@@ -46,12 +46,9 @@ static struct snd_soc_jack_pin cht_bsw_headset_pins[] = {
...
@@ -46,12 +46,9 @@ static struct snd_soc_jack_pin cht_bsw_headset_pins[] = {
static
inline
struct
snd_soc_dai
*
cht_get_codec_dai
(
struct
snd_soc_card
*
card
)
static
inline
struct
snd_soc_dai
*
cht_get_codec_dai
(
struct
snd_soc_card
*
card
)
{
{
int
i
;
struct
snd_soc_pcm_runtime
*
rtd
;
for
(
i
=
0
;
i
<
card
->
num_rtd
;
i
++
)
{
list_for_each_entry
(
rtd
,
&
card
->
rtd_list
,
list
)
{
struct
snd_soc_pcm_runtime
*
rtd
;
rtd
=
card
->
rtd
+
i
;
if
(
!
strncmp
(
rtd
->
codec_dai
->
name
,
CHT_CODEC_DAI
,
if
(
!
strncmp
(
rtd
->
codec_dai
->
name
,
CHT_CODEC_DAI
,
strlen
(
CHT_CODEC_DAI
)))
strlen
(
CHT_CODEC_DAI
)))
return
rtd
->
codec_dai
;
return
rtd
->
codec_dai
;
...
...
sound/soc/pxa/mioa701_wm9713.c
View file @
a93202fa
...
@@ -81,8 +81,12 @@ static int rear_amp_power(struct snd_soc_codec *codec, int power)
...
@@ -81,8 +81,12 @@ static int rear_amp_power(struct snd_soc_codec *codec, int power)
static
int
rear_amp_event
(
struct
snd_soc_dapm_widget
*
widget
,
static
int
rear_amp_event
(
struct
snd_soc_dapm_widget
*
widget
,
struct
snd_kcontrol
*
kctl
,
int
event
)
struct
snd_kcontrol
*
kctl
,
int
event
)
{
{
struct
snd_soc_codec
*
codec
=
widget
->
dapm
->
card
->
rtd
[
0
].
codec
;
struct
snd_soc_card
*
card
=
widget
->
dapm
->
card
;
struct
snd_soc_pcm_runtime
*
rtd
;
struct
snd_soc_codec
*
codec
;
rtd
=
snd_soc_get_pcm_runtime
(
card
,
card
->
dai_link
[
0
].
name
);
codec
=
rtd
->
codec
;
return
rear_amp_power
(
codec
,
SND_SOC_DAPM_EVENT_ON
(
event
));
return
rear_amp_power
(
codec
,
SND_SOC_DAPM_EVENT_ON
(
event
));
}
}
...
...
sound/soc/samsung/bells.c
View file @
a93202fa
...
@@ -58,11 +58,16 @@ static int bells_set_bias_level(struct snd_soc_card *card,
...
@@ -58,11 +58,16 @@ static int bells_set_bias_level(struct snd_soc_card *card,
struct
snd_soc_dapm_context
*
dapm
,
struct
snd_soc_dapm_context
*
dapm
,
enum
snd_soc_bias_level
level
)
enum
snd_soc_bias_level
level
)
{
{
struct
snd_soc_dai
*
codec_dai
=
card
->
rtd
[
DAI_DSP_CODEC
].
codec_dai
;
struct
snd_soc_pcm_runtime
*
rtd
;
struct
snd_soc_codec
*
codec
=
codec_dai
->
codec
;
struct
snd_soc_dai
*
codec_dai
;
struct
snd_soc_codec
*
codec
;
struct
bells_drvdata
*
bells
=
card
->
drvdata
;
struct
bells_drvdata
*
bells
=
card
->
drvdata
;
int
ret
;
int
ret
;
rtd
=
snd_soc_get_pcm_runtime
(
card
,
card
->
dai_link
[
DAI_DSP_CODEC
].
name
);
codec_dai
=
rtd
->
codec_dai
;
codec
=
codec_dai
->
codec
;
if
(
dapm
->
dev
!=
codec_dai
->
dev
)
if
(
dapm
->
dev
!=
codec_dai
->
dev
)
return
0
;
return
0
;
...
@@ -99,11 +104,16 @@ static int bells_set_bias_level_post(struct snd_soc_card *card,
...
@@ -99,11 +104,16 @@ static int bells_set_bias_level_post(struct snd_soc_card *card,
struct
snd_soc_dapm_context
*
dapm
,
struct
snd_soc_dapm_context
*
dapm
,
enum
snd_soc_bias_level
level
)
enum
snd_soc_bias_level
level
)
{
{
struct
snd_soc_dai
*
codec_dai
=
card
->
rtd
[
DAI_DSP_CODEC
].
codec_dai
;
struct
snd_soc_pcm_runtime
*
rtd
;
struct
snd_soc_codec
*
codec
=
codec_dai
->
codec
;
struct
snd_soc_dai
*
codec_dai
;
struct
snd_soc_codec
*
codec
;
struct
bells_drvdata
*
bells
=
card
->
drvdata
;
struct
bells_drvdata
*
bells
=
card
->
drvdata
;
int
ret
;
int
ret
;
rtd
=
snd_soc_get_pcm_runtime
(
card
,
card
->
dai_link
[
DAI_DSP_CODEC
].
name
);
codec_dai
=
rtd
->
codec_dai
;
codec
=
codec_dai
->
codec
;
if
(
dapm
->
dev
!=
codec_dai
->
dev
)
if
(
dapm
->
dev
!=
codec_dai
->
dev
)
return
0
;
return
0
;
...
@@ -137,14 +147,22 @@ static int bells_set_bias_level_post(struct snd_soc_card *card,
...
@@ -137,14 +147,22 @@ static int bells_set_bias_level_post(struct snd_soc_card *card,
static
int
bells_late_probe
(
struct
snd_soc_card
*
card
)
static
int
bells_late_probe
(
struct
snd_soc_card
*
card
)
{
{
struct
bells_drvdata
*
bells
=
card
->
drvdata
;
struct
bells_drvdata
*
bells
=
card
->
drvdata
;
struct
snd_soc_codec
*
wm0010
=
card
->
rtd
[
DAI_AP_DSP
].
codec
;
struct
snd_soc_pcm_runtime
*
rtd
;
struct
snd_soc_codec
*
codec
=
card
->
rtd
[
DAI_DSP_CODEC
].
codec
;
struct
snd_soc_codec
*
wm0010
;
struct
snd_soc_dai
*
aif1_dai
=
card
->
rtd
[
DAI_DSP_CODEC
].
codec_dai
;
struct
snd_soc_codec
*
codec
;
struct
snd_soc_dai
*
aif1_dai
;
struct
snd_soc_dai
*
aif2_dai
;
struct
snd_soc_dai
*
aif2_dai
;
struct
snd_soc_dai
*
aif3_dai
;
struct
snd_soc_dai
*
aif3_dai
;
struct
snd_soc_dai
*
wm9081_dai
;
struct
snd_soc_dai
*
wm9081_dai
;
int
ret
;
int
ret
;
rtd
=
snd_soc_get_pcm_runtime
(
card
,
card
->
dai_link
[
DAI_AP_DSP
].
name
);
wm0010
=
rtd
->
codec
;
rtd
=
snd_soc_get_pcm_runtime
(
card
,
card
->
dai_link
[
DAI_DSP_CODEC
].
name
);
codec
=
rtd
->
codec
;
aif1_dai
=
rtd
->
codec_dai
;
ret
=
snd_soc_codec_set_sysclk
(
codec
,
ARIZONA_CLK_SYSCLK
,
ret
=
snd_soc_codec_set_sysclk
(
codec
,
ARIZONA_CLK_SYSCLK
,
ARIZONA_CLK_SRC_FLL1
,
ARIZONA_CLK_SRC_FLL1
,
bells
->
sysclk_rate
,
bells
->
sysclk_rate
,
...
@@ -181,7 +199,8 @@ static int bells_late_probe(struct snd_soc_card *card)
...
@@ -181,7 +199,8 @@ static int bells_late_probe(struct snd_soc_card *card)
return
ret
;
return
ret
;
}
}
aif2_dai
=
card
->
rtd
[
DAI_CODEC_CP
].
cpu_dai
;
rtd
=
snd_soc_get_pcm_runtime
(
card
,
card
->
dai_link
[
DAI_CODEC_CP
].
name
);
aif2_dai
=
rtd
->
cpu_dai
;
ret
=
snd_soc_dai_set_sysclk
(
aif2_dai
,
ARIZONA_CLK_ASYNCCLK
,
0
,
0
);
ret
=
snd_soc_dai_set_sysclk
(
aif2_dai
,
ARIZONA_CLK_ASYNCCLK
,
0
,
0
);
if
(
ret
!=
0
)
{
if
(
ret
!=
0
)
{
...
@@ -192,8 +211,9 @@ static int bells_late_probe(struct snd_soc_card *card)
...
@@ -192,8 +211,9 @@ static int bells_late_probe(struct snd_soc_card *card)
if
(
card
->
num_rtd
==
DAI_CODEC_SUB
)
if
(
card
->
num_rtd
==
DAI_CODEC_SUB
)
return
0
;
return
0
;
aif3_dai
=
card
->
rtd
[
DAI_CODEC_SUB
].
cpu_dai
;
rtd
=
snd_soc_get_pcm_runtime
(
card
,
card
->
dai_link
[
DAI_CODEC_SUB
].
name
);
wm9081_dai
=
card
->
rtd
[
DAI_CODEC_SUB
].
codec_dai
;
aif3_dai
=
rtd
->
cpu_dai
;
wm9081_dai
=
rtd
->
codec_dai
;
ret
=
snd_soc_dai_set_sysclk
(
aif3_dai
,
ARIZONA_CLK_SYSCLK
,
0
,
0
);
ret
=
snd_soc_dai_set_sysclk
(
aif3_dai
,
ARIZONA_CLK_SYSCLK
,
0
,
0
);
if
(
ret
!=
0
)
{
if
(
ret
!=
0
)
{
...
...
sound/soc/samsung/littlemill.c
View file @
a93202fa
...
@@ -23,9 +23,13 @@ static int littlemill_set_bias_level(struct snd_soc_card *card,
...
@@ -23,9 +23,13 @@ static int littlemill_set_bias_level(struct snd_soc_card *card,
struct
snd_soc_dapm_context
*
dapm
,
struct
snd_soc_dapm_context
*
dapm
,
enum
snd_soc_bias_level
level
)
enum
snd_soc_bias_level
level
)
{
{
struct
snd_soc_dai
*
aif1_dai
=
card
->
rtd
[
0
].
codec_dai
;
struct
snd_soc_pcm_runtime
*
rtd
;
struct
snd_soc_dai
*
aif1_dai
;
int
ret
;
int
ret
;
rtd
=
snd_soc_get_pcm_runtime
(
card
,
card
->
dai_link
[
0
].
name
);
aif1_dai
=
rtd
->
codec_dai
;
if
(
dapm
->
dev
!=
aif1_dai
->
dev
)
if
(
dapm
->
dev
!=
aif1_dai
->
dev
)
return
0
;
return
0
;
...
@@ -66,9 +70,13 @@ static int littlemill_set_bias_level_post(struct snd_soc_card *card,
...
@@ -66,9 +70,13 @@ static int littlemill_set_bias_level_post(struct snd_soc_card *card,
struct
snd_soc_dapm_context
*
dapm
,
struct
snd_soc_dapm_context
*
dapm
,
enum
snd_soc_bias_level
level
)
enum
snd_soc_bias_level
level
)
{
{
struct
snd_soc_dai
*
aif1_dai
=
card
->
rtd
[
0
].
codec_dai
;
struct
snd_soc_pcm_runtime
*
rtd
;
struct
snd_soc_dai
*
aif1_dai
;
int
ret
;
int
ret
;
rtd
=
snd_soc_get_pcm_runtime
(
card
,
card
->
dai_link
[
0
].
name
);
aif1_dai
=
rtd
->
codec_dai
;
if
(
dapm
->
dev
!=
aif1_dai
->
dev
)
if
(
dapm
->
dev
!=
aif1_dai
->
dev
)
return
0
;
return
0
;
...
@@ -168,9 +176,13 @@ static int bbclk_ev(struct snd_soc_dapm_widget *w,
...
@@ -168,9 +176,13 @@ static int bbclk_ev(struct snd_soc_dapm_widget *w,
struct
snd_kcontrol
*
kcontrol
,
int
event
)
struct
snd_kcontrol
*
kcontrol
,
int
event
)
{
{
struct
snd_soc_card
*
card
=
w
->
dapm
->
card
;
struct
snd_soc_card
*
card
=
w
->
dapm
->
card
;
struct
snd_soc_dai
*
aif2_dai
=
card
->
rtd
[
1
].
cpu_dai
;
struct
snd_soc_pcm_runtime
*
rtd
;
struct
snd_soc_dai
*
aif2_dai
;
int
ret
;
int
ret
;
rtd
=
snd_soc_get_pcm_runtime
(
card
,
card
->
dai_link
[
1
].
name
);
aif2_dai
=
rtd
->
cpu_dai
;
switch
(
event
)
{
switch
(
event
)
{
case
SND_SOC_DAPM_PRE_PMU
:
case
SND_SOC_DAPM_PRE_PMU
:
ret
=
snd_soc_dai_set_pll
(
aif2_dai
,
WM8994_FLL2
,
ret
=
snd_soc_dai_set_pll
(
aif2_dai
,
WM8994_FLL2
,
...
@@ -245,11 +257,19 @@ static struct snd_soc_jack littlemill_headset;
...
@@ -245,11 +257,19 @@ static struct snd_soc_jack littlemill_headset;
static
int
littlemill_late_probe
(
struct
snd_soc_card
*
card
)
static
int
littlemill_late_probe
(
struct
snd_soc_card
*
card
)
{
{
struct
snd_soc_codec
*
codec
=
card
->
rtd
[
0
].
codec
;
struct
snd_soc_pcm_runtime
*
rtd
;
struct
snd_soc_dai
*
aif1_dai
=
card
->
rtd
[
0
].
codec_dai
;
struct
snd_soc_codec
*
codec
;
struct
snd_soc_dai
*
aif2_dai
=
card
->
rtd
[
1
].
cpu_dai
;
struct
snd_soc_dai
*
aif1_dai
;
struct
snd_soc_dai
*
aif2_dai
;
int
ret
;
int
ret
;
rtd
=
snd_soc_get_pcm_runtime
(
card
,
card
->
dai_link
[
0
].
name
);
codec
=
rtd
->
codec
;
aif1_dai
=
rtd
->
codec_dai
;
rtd
=
snd_soc_get_pcm_runtime
(
card
,
card
->
dai_link
[
1
].
name
);
aif2_dai
=
rtd
->
cpu_dai
;
ret
=
snd_soc_dai_set_sysclk
(
aif1_dai
,
WM8994_SYSCLK_MCLK2
,
ret
=
snd_soc_dai_set_sysclk
(
aif1_dai
,
WM8994_SYSCLK_MCLK2
,
32768
,
SND_SOC_CLOCK_IN
);
32768
,
SND_SOC_CLOCK_IN
);
if
(
ret
<
0
)
if
(
ret
<
0
)
...
...
sound/soc/samsung/odroidx2_max98090.c
View file @
a93202fa
...
@@ -25,10 +25,15 @@ static struct snd_soc_dai_link odroidx2_dai[];
...
@@ -25,10 +25,15 @@ static struct snd_soc_dai_link odroidx2_dai[];
static
int
odroidx2_late_probe
(
struct
snd_soc_card
*
card
)
static
int
odroidx2_late_probe
(
struct
snd_soc_card
*
card
)
{
{
struct
snd_soc_dai
*
codec_dai
=
card
->
rtd
[
0
].
codec_dai
;
struct
snd_soc_pcm_runtime
*
rtd
;
struct
snd_soc_dai
*
cpu_dai
=
card
->
rtd
[
0
].
cpu_dai
;
struct
snd_soc_dai
*
codec_dai
;
struct
snd_soc_dai
*
cpu_dai
;
int
ret
;
int
ret
;
rtd
=
snd_soc_get_pcm_runtime
(
card
,
card
->
dai_link
[
0
].
name
);
codec_dai
=
rtd
->
codec_dai
;
cpu_dai
=
rtd
->
cpu_dai
;
ret
=
snd_soc_dai_set_sysclk
(
codec_dai
,
0
,
MAX98090_MCLK
,
ret
=
snd_soc_dai_set_sysclk
(
codec_dai
,
0
,
MAX98090_MCLK
,
SND_SOC_CLOCK_IN
);
SND_SOC_CLOCK_IN
);
...
...
sound/soc/samsung/snow.c
View file @
a93202fa
...
@@ -35,10 +35,15 @@ static struct snd_soc_dai_link snow_dai[] = {
...
@@ -35,10 +35,15 @@ static struct snd_soc_dai_link snow_dai[] = {
static
int
snow_late_probe
(
struct
snd_soc_card
*
card
)
static
int
snow_late_probe
(
struct
snd_soc_card
*
card
)
{
{
struct
snd_soc_dai
*
codec_dai
=
card
->
rtd
[
0
].
codec_dai
;
struct
snd_soc_pcm_runtime
*
rtd
;
struct
snd_soc_dai
*
cpu_dai
=
card
->
rtd
[
0
].
cpu_dai
;
struct
snd_soc_dai
*
codec_dai
;
struct
snd_soc_dai
*
cpu_dai
;
int
ret
;
int
ret
;
rtd
=
snd_soc_get_pcm_runtime
(
card
,
card
->
dai_link
[
0
].
name
);
codec_dai
=
rtd
->
codec_dai
;
cpu_dai
=
rtd
->
cpu_dai
;
/* Set the MCLK rate for the codec */
/* Set the MCLK rate for the codec */
ret
=
snd_soc_dai_set_sysclk
(
codec_dai
,
0
,
ret
=
snd_soc_dai_set_sysclk
(
codec_dai
,
0
,
FIN_PLL_RATE
,
SND_SOC_CLOCK_IN
);
FIN_PLL_RATE
,
SND_SOC_CLOCK_IN
);
...
...
sound/soc/samsung/speyside.c
View file @
a93202fa
...
@@ -25,9 +25,13 @@ static int speyside_set_bias_level(struct snd_soc_card *card,
...
@@ -25,9 +25,13 @@ static int speyside_set_bias_level(struct snd_soc_card *card,
struct
snd_soc_dapm_context
*
dapm
,
struct
snd_soc_dapm_context
*
dapm
,
enum
snd_soc_bias_level
level
)
enum
snd_soc_bias_level
level
)
{
{
struct
snd_soc_dai
*
codec_dai
=
card
->
rtd
[
1
].
codec_dai
;
struct
snd_soc_pcm_runtime
*
rtd
;
struct
snd_soc_dai
*
codec_dai
;
int
ret
;
int
ret
;
rtd
=
snd_soc_get_pcm_runtime
(
card
,
card
->
dai_link
[
1
].
name
);
codec_dai
=
rtd
->
codec_dai
;
if
(
dapm
->
dev
!=
codec_dai
->
dev
)
if
(
dapm
->
dev
!=
codec_dai
->
dev
)
return
0
;
return
0
;
...
@@ -57,9 +61,13 @@ static int speyside_set_bias_level_post(struct snd_soc_card *card,
...
@@ -57,9 +61,13 @@ static int speyside_set_bias_level_post(struct snd_soc_card *card,
struct
snd_soc_dapm_context
*
dapm
,
struct
snd_soc_dapm_context
*
dapm
,
enum
snd_soc_bias_level
level
)
enum
snd_soc_bias_level
level
)
{
{
struct
snd_soc_dai
*
codec_dai
=
card
->
rtd
[
1
].
codec_dai
;
struct
snd_soc_pcm_runtime
*
rtd
;
struct
snd_soc_dai
*
codec_dai
;
int
ret
;
int
ret
;
rtd
=
snd_soc_get_pcm_runtime
(
card
,
card
->
dai_link
[
1
].
name
);
codec_dai
=
rtd
->
codec_dai
;
if
(
dapm
->
dev
!=
codec_dai
->
dev
)
if
(
dapm
->
dev
!=
codec_dai
->
dev
)
return
0
;
return
0
;
...
...
sound/soc/samsung/tobermory.c
View file @
a93202fa
...
@@ -23,9 +23,13 @@ static int tobermory_set_bias_level(struct snd_soc_card *card,
...
@@ -23,9 +23,13 @@ static int tobermory_set_bias_level(struct snd_soc_card *card,
struct
snd_soc_dapm_context
*
dapm
,
struct
snd_soc_dapm_context
*
dapm
,
enum
snd_soc_bias_level
level
)
enum
snd_soc_bias_level
level
)
{
{
struct
snd_soc_dai
*
codec_dai
=
card
->
rtd
[
0
].
codec_dai
;
struct
snd_soc_pcm_runtime
*
rtd
;
struct
snd_soc_dai
*
codec_dai
;
int
ret
;
int
ret
;
rtd
=
snd_soc_get_pcm_runtime
(
card
,
card
->
dai_link
[
0
].
name
);
codec_dai
=
rtd
->
codec_dai
;
if
(
dapm
->
dev
!=
codec_dai
->
dev
)
if
(
dapm
->
dev
!=
codec_dai
->
dev
)
return
0
;
return
0
;
...
@@ -62,9 +66,13 @@ static int tobermory_set_bias_level_post(struct snd_soc_card *card,
...
@@ -62,9 +66,13 @@ static int tobermory_set_bias_level_post(struct snd_soc_card *card,
struct
snd_soc_dapm_context
*
dapm
,
struct
snd_soc_dapm_context
*
dapm
,
enum
snd_soc_bias_level
level
)
enum
snd_soc_bias_level
level
)
{
{
struct
snd_soc_dai
*
codec_dai
=
card
->
rtd
[
0
].
codec_dai
;
struct
snd_soc_pcm_runtime
*
rtd
;
struct
snd_soc_dai
*
codec_dai
;
int
ret
;
int
ret
;
rtd
=
snd_soc_get_pcm_runtime
(
card
,
card
->
dai_link
[
0
].
name
);
codec_dai
=
rtd
->
codec_dai
;
if
(
dapm
->
dev
!=
codec_dai
->
dev
)
if
(
dapm
->
dev
!=
codec_dai
->
dev
)
return
0
;
return
0
;
...
@@ -170,10 +178,15 @@ static struct snd_soc_jack_pin tobermory_headset_pins[] = {
...
@@ -170,10 +178,15 @@ static struct snd_soc_jack_pin tobermory_headset_pins[] = {
static
int
tobermory_late_probe
(
struct
snd_soc_card
*
card
)
static
int
tobermory_late_probe
(
struct
snd_soc_card
*
card
)
{
{
struct
snd_soc_codec
*
codec
=
card
->
rtd
[
0
].
codec
;
struct
snd_soc_pcm_runtime
*
rtd
;
struct
snd_soc_dai
*
codec_dai
=
card
->
rtd
[
0
].
codec_dai
;
struct
snd_soc_codec
*
codec
;
struct
snd_soc_dai
*
codec_dai
;
int
ret
;
int
ret
;
rtd
=
snd_soc_get_pcm_runtime
(
card
,
card
->
dai_link
[
0
].
name
);
codec
=
rtd
->
codec
;
codec_dai
=
rtd
->
codec_dai
;
ret
=
snd_soc_dai_set_sysclk
(
codec_dai
,
WM8962_SYSCLK_MCLK
,
ret
=
snd_soc_dai_set_sysclk
(
codec_dai
,
WM8962_SYSCLK_MCLK
,
32768
,
SND_SOC_CLOCK_IN
);
32768
,
SND_SOC_CLOCK_IN
);
if
(
ret
<
0
)
if
(
ret
<
0
)
...
...
sound/soc/sh/rcar/core.c
View file @
a93202fa
...
@@ -1033,14 +1033,13 @@ static int __rsnd_kctrl_new(struct rsnd_mod *mod,
...
@@ -1033,14 +1033,13 @@ static int __rsnd_kctrl_new(struct rsnd_mod *mod,
void
(
*
update
)(
struct
rsnd_dai_stream
*
io
,
void
(
*
update
)(
struct
rsnd_dai_stream
*
io
,
struct
rsnd_mod
*
mod
))
struct
rsnd_mod
*
mod
))
{
{
struct
snd_soc_card
*
soc_card
=
rtd
->
card
;
struct
snd_card
*
card
=
rtd
->
card
->
snd_card
;
struct
snd_card
*
card
=
rtd
->
card
->
snd_card
;
struct
snd_kcontrol
*
kctrl
;
struct
snd_kcontrol
*
kctrl
;
struct
snd_kcontrol_new
knew
=
{
struct
snd_kcontrol_new
knew
=
{
.
iface
=
SNDRV_CTL_ELEM_IFACE_MIXER
,
.
iface
=
SNDRV_CTL_ELEM_IFACE_MIXER
,
.
name
=
name
,
.
name
=
name
,
.
info
=
rsnd_kctrl_info
,
.
info
=
rsnd_kctrl_info
,
.
index
=
rtd
-
soc_card
->
rtd
,
.
index
=
rtd
->
num
,
.
get
=
rsnd_kctrl_get
,
.
get
=
rsnd_kctrl_get
,
.
put
=
rsnd_kctrl_put
,
.
put
=
rsnd_kctrl_put
,
.
private_value
=
(
unsigned
long
)
cfg
,
.
private_value
=
(
unsigned
long
)
cfg
,
...
...
sound/soc/sh/rcar/rsrc-card.c
View file @
a93202fa
...
@@ -75,7 +75,7 @@ static int rsrc_card_startup(struct snd_pcm_substream *substream)
...
@@ -75,7 +75,7 @@ static int rsrc_card_startup(struct snd_pcm_substream *substream)
struct
snd_soc_pcm_runtime
*
rtd
=
substream
->
private_data
;
struct
snd_soc_pcm_runtime
*
rtd
=
substream
->
private_data
;
struct
rsrc_card_priv
*
priv
=
snd_soc_card_get_drvdata
(
rtd
->
card
);
struct
rsrc_card_priv
*
priv
=
snd_soc_card_get_drvdata
(
rtd
->
card
);
struct
rsrc_card_dai
*
dai_props
=
struct
rsrc_card_dai
*
dai_props
=
rsrc_priv_to_props
(
priv
,
rtd
-
rtd
->
card
->
rtd
);
rsrc_priv_to_props
(
priv
,
rtd
->
num
);
return
clk_prepare_enable
(
dai_props
->
clk
);
return
clk_prepare_enable
(
dai_props
->
clk
);
}
}
...
@@ -85,7 +85,7 @@ static void rsrc_card_shutdown(struct snd_pcm_substream *substream)
...
@@ -85,7 +85,7 @@ static void rsrc_card_shutdown(struct snd_pcm_substream *substream)
struct
snd_soc_pcm_runtime
*
rtd
=
substream
->
private_data
;
struct
snd_soc_pcm_runtime
*
rtd
=
substream
->
private_data
;
struct
rsrc_card_priv
*
priv
=
snd_soc_card_get_drvdata
(
rtd
->
card
);
struct
rsrc_card_priv
*
priv
=
snd_soc_card_get_drvdata
(
rtd
->
card
);
struct
rsrc_card_dai
*
dai_props
=
struct
rsrc_card_dai
*
dai_props
=
rsrc_priv_to_props
(
priv
,
rtd
-
rtd
->
card
->
rtd
);
rsrc_priv_to_props
(
priv
,
rtd
->
num
);
clk_disable_unprepare
(
dai_props
->
clk
);
clk_disable_unprepare
(
dai_props
->
clk
);
}
}
...
@@ -101,7 +101,7 @@ static int rsrc_card_dai_init(struct snd_soc_pcm_runtime *rtd)
...
@@ -101,7 +101,7 @@ static int rsrc_card_dai_init(struct snd_soc_pcm_runtime *rtd)
struct
snd_soc_dai
*
dai
;
struct
snd_soc_dai
*
dai
;
struct
snd_soc_dai_link
*
dai_link
;
struct
snd_soc_dai_link
*
dai_link
;
struct
rsrc_card_dai
*
dai_props
;
struct
rsrc_card_dai
*
dai_props
;
int
num
=
rtd
-
rtd
->
card
->
rtd
;
int
num
=
rtd
->
num
;
int
ret
;
int
ret
;
dai_link
=
rsrc_priv_to_link
(
priv
,
num
);
dai_link
=
rsrc_priv_to_link
(
priv
,
num
);
...
...
sound/soc/soc-core.c
View file @
a93202fa
...
@@ -537,26 +537,75 @@ static inline void snd_soc_debugfs_exit(void)
...
@@ -537,26 +537,75 @@ static inline void snd_soc_debugfs_exit(void)
struct
snd_pcm_substream
*
snd_soc_get_dai_substream
(
struct
snd_soc_card
*
card
,
struct
snd_pcm_substream
*
snd_soc_get_dai_substream
(
struct
snd_soc_card
*
card
,
const
char
*
dai_link
,
int
stream
)
const
char
*
dai_link
,
int
stream
)
{
{
int
i
;
struct
snd_soc_pcm_runtime
*
rtd
;
for
(
i
=
0
;
i
<
card
->
num_links
;
i
++
)
{
list_for_each_entry
(
rtd
,
&
card
->
rtd_list
,
list
)
{
if
(
card
->
rtd
[
i
].
dai_link
->
no_pcm
&&
if
(
rtd
->
dai_link
->
no_pcm
&&
!
strcmp
(
card
->
rtd
[
i
].
dai_link
->
name
,
dai_link
))
!
strcmp
(
rtd
->
dai_link
->
name
,
dai_link
))
return
card
->
rtd
[
i
].
pcm
->
streams
[
stream
].
substream
;
return
rtd
->
pcm
->
streams
[
stream
].
substream
;
}
}
dev_dbg
(
card
->
dev
,
"ASoC: failed to find dai link %s
\n
"
,
dai_link
);
dev_dbg
(
card
->
dev
,
"ASoC: failed to find dai link %s
\n
"
,
dai_link
);
return
NULL
;
return
NULL
;
}
}
EXPORT_SYMBOL_GPL
(
snd_soc_get_dai_substream
);
EXPORT_SYMBOL_GPL
(
snd_soc_get_dai_substream
);
static
struct
snd_soc_pcm_runtime
*
soc_new_pcm_runtime
(
struct
snd_soc_card
*
card
,
struct
snd_soc_dai_link
*
dai_link
)
{
struct
snd_soc_pcm_runtime
*
rtd
;
rtd
=
kzalloc
(
sizeof
(
struct
snd_soc_pcm_runtime
),
GFP_KERNEL
);
if
(
!
rtd
)
return
NULL
;
rtd
->
card
=
card
;
rtd
->
dai_link
=
dai_link
;
rtd
->
codec_dais
=
kzalloc
(
sizeof
(
struct
snd_soc_dai
*
)
*
dai_link
->
num_codecs
,
GFP_KERNEL
);
if
(
!
rtd
->
codec_dais
)
{
kfree
(
rtd
);
return
NULL
;
}
return
rtd
;
}
static
void
soc_free_pcm_runtime
(
struct
snd_soc_pcm_runtime
*
rtd
)
{
if
(
rtd
&&
rtd
->
codec_dais
)
kfree
(
rtd
->
codec_dais
);
kfree
(
rtd
);
}
static
void
soc_add_pcm_runtime
(
struct
snd_soc_card
*
card
,
struct
snd_soc_pcm_runtime
*
rtd
)
{
list_add_tail
(
&
rtd
->
list
,
&
card
->
rtd_list
);
rtd
->
num
=
card
->
num_rtd
;
card
->
num_rtd
++
;
}
static
void
soc_remove_pcm_runtimes
(
struct
snd_soc_card
*
card
)
{
struct
snd_soc_pcm_runtime
*
rtd
,
*
_rtd
;
list_for_each_entry_safe
(
rtd
,
_rtd
,
&
card
->
rtd_list
,
list
)
{
list_del
(
&
rtd
->
list
);
soc_free_pcm_runtime
(
rtd
);
}
card
->
num_rtd
=
0
;
}
struct
snd_soc_pcm_runtime
*
snd_soc_get_pcm_runtime
(
struct
snd_soc_card
*
card
,
struct
snd_soc_pcm_runtime
*
snd_soc_get_pcm_runtime
(
struct
snd_soc_card
*
card
,
const
char
*
dai_link
)
const
char
*
dai_link
)
{
{
int
i
;
struct
snd_soc_pcm_runtime
*
rtd
;
for
(
i
=
0
;
i
<
card
->
num_links
;
i
++
)
{
list_for_each_entry
(
rtd
,
&
card
->
rtd_list
,
list
)
{
if
(
!
strcmp
(
card
->
rtd
[
i
].
dai_link
->
name
,
dai_link
))
if
(
!
strcmp
(
rtd
->
dai_link
->
name
,
dai_link
))
return
&
card
->
rtd
[
i
]
;
return
rtd
;
}
}
dev_dbg
(
card
->
dev
,
"ASoC: failed to find rtd %s
\n
"
,
dai_link
);
dev_dbg
(
card
->
dev
,
"ASoC: failed to find rtd %s
\n
"
,
dai_link
);
return
NULL
;
return
NULL
;
...
@@ -578,7 +627,8 @@ int snd_soc_suspend(struct device *dev)
...
@@ -578,7 +627,8 @@ int snd_soc_suspend(struct device *dev)
{
{
struct
snd_soc_card
*
card
=
dev_get_drvdata
(
dev
);
struct
snd_soc_card
*
card
=
dev_get_drvdata
(
dev
);
struct
snd_soc_codec
*
codec
;
struct
snd_soc_codec
*
codec
;
int
i
,
j
;
struct
snd_soc_pcm_runtime
*
rtd
;
int
i
;
/* If the card is not initialized yet there is nothing to do */
/* If the card is not initialized yet there is nothing to do */
if
(
!
card
->
instantiated
)
if
(
!
card
->
instantiated
)
...
@@ -595,13 +645,13 @@ int snd_soc_suspend(struct device *dev)
...
@@ -595,13 +645,13 @@ int snd_soc_suspend(struct device *dev)
snd_power_change_state
(
card
->
snd_card
,
SNDRV_CTL_POWER_D3hot
);
snd_power_change_state
(
card
->
snd_card
,
SNDRV_CTL_POWER_D3hot
);
/* mute any active DACs */
/* mute any active DACs */
for
(
i
=
0
;
i
<
card
->
num_rtd
;
i
++
)
{
list_for_each_entry
(
rtd
,
&
card
->
rtd_list
,
list
)
{
if
(
card
->
rtd
[
i
].
dai_link
->
ignore_suspend
)
if
(
rtd
->
dai_link
->
ignore_suspend
)
continue
;
continue
;
for
(
j
=
0
;
j
<
card
->
rtd
[
i
].
num_codecs
;
j
++
)
{
for
(
i
=
0
;
i
<
rtd
->
num_codecs
;
i
++
)
{
struct
snd_soc_dai
*
dai
=
card
->
rtd
[
i
].
codec_dais
[
j
];
struct
snd_soc_dai
*
dai
=
rtd
->
codec_dais
[
i
];
struct
snd_soc_dai_driver
*
drv
=
dai
->
driver
;
struct
snd_soc_dai_driver
*
drv
=
dai
->
driver
;
if
(
drv
->
ops
->
digital_mute
&&
dai
->
playback_active
)
if
(
drv
->
ops
->
digital_mute
&&
dai
->
playback_active
)
...
@@ -610,20 +660,20 @@ int snd_soc_suspend(struct device *dev)
...
@@ -610,20 +660,20 @@ int snd_soc_suspend(struct device *dev)
}
}
/* suspend all pcms */
/* suspend all pcms */
for
(
i
=
0
;
i
<
card
->
num_rtd
;
i
++
)
{
list_for_each_entry
(
rtd
,
&
card
->
rtd_list
,
list
)
{
if
(
card
->
rtd
[
i
].
dai_link
->
ignore_suspend
)
if
(
rtd
->
dai_link
->
ignore_suspend
)
continue
;
continue
;
snd_pcm_suspend_all
(
card
->
rtd
[
i
].
pcm
);
snd_pcm_suspend_all
(
rtd
->
pcm
);
}
}
if
(
card
->
suspend_pre
)
if
(
card
->
suspend_pre
)
card
->
suspend_pre
(
card
);
card
->
suspend_pre
(
card
);
for
(
i
=
0
;
i
<
card
->
num_rtd
;
i
++
)
{
list_for_each_entry
(
rtd
,
&
card
->
rtd_list
,
list
)
{
struct
snd_soc_dai
*
cpu_dai
=
card
->
rtd
[
i
].
cpu_dai
;
struct
snd_soc_dai
*
cpu_dai
=
rtd
->
cpu_dai
;
if
(
card
->
rtd
[
i
].
dai_link
->
ignore_suspend
)
if
(
rtd
->
dai_link
->
ignore_suspend
)
continue
;
continue
;
if
(
cpu_dai
->
driver
->
suspend
&&
!
cpu_dai
->
driver
->
bus_control
)
if
(
cpu_dai
->
driver
->
suspend
&&
!
cpu_dai
->
driver
->
bus_control
)
...
@@ -631,19 +681,19 @@ int snd_soc_suspend(struct device *dev)
...
@@ -631,19 +681,19 @@ int snd_soc_suspend(struct device *dev)
}
}
/* close any waiting streams */
/* close any waiting streams */
for
(
i
=
0
;
i
<
card
->
num_rtd
;
i
++
)
list_for_each_entry
(
rtd
,
&
card
->
rtd_list
,
list
)
flush_delayed_work
(
&
card
->
rtd
[
i
].
delayed_work
);
flush_delayed_work
(
&
rtd
->
delayed_work
);
for
(
i
=
0
;
i
<
card
->
num_rtd
;
i
++
)
{
list_for_each_entry
(
rtd
,
&
card
->
rtd_list
,
list
)
{
if
(
card
->
rtd
[
i
].
dai_link
->
ignore_suspend
)
if
(
rtd
->
dai_link
->
ignore_suspend
)
continue
;
continue
;
snd_soc_dapm_stream_event
(
&
card
->
rtd
[
i
]
,
snd_soc_dapm_stream_event
(
rtd
,
SNDRV_PCM_STREAM_PLAYBACK
,
SNDRV_PCM_STREAM_PLAYBACK
,
SND_SOC_DAPM_STREAM_SUSPEND
);
SND_SOC_DAPM_STREAM_SUSPEND
);
snd_soc_dapm_stream_event
(
&
card
->
rtd
[
i
]
,
snd_soc_dapm_stream_event
(
rtd
,
SNDRV_PCM_STREAM_CAPTURE
,
SNDRV_PCM_STREAM_CAPTURE
,
SND_SOC_DAPM_STREAM_SUSPEND
);
SND_SOC_DAPM_STREAM_SUSPEND
);
}
}
...
@@ -690,10 +740,10 @@ int snd_soc_suspend(struct device *dev)
...
@@ -690,10 +740,10 @@ int snd_soc_suspend(struct device *dev)
}
}
}
}
for
(
i
=
0
;
i
<
card
->
num_rtd
;
i
++
)
{
list_for_each_entry
(
rtd
,
&
card
->
rtd_list
,
list
)
{
struct
snd_soc_dai
*
cpu_dai
=
card
->
rtd
[
i
].
cpu_dai
;
struct
snd_soc_dai
*
cpu_dai
=
rtd
->
cpu_dai
;
if
(
card
->
rtd
[
i
].
dai_link
->
ignore_suspend
)
if
(
rtd
->
dai_link
->
ignore_suspend
)
continue
;
continue
;
if
(
cpu_dai
->
driver
->
suspend
&&
cpu_dai
->
driver
->
bus_control
)
if
(
cpu_dai
->
driver
->
suspend
&&
cpu_dai
->
driver
->
bus_control
)
...
@@ -717,8 +767,9 @@ static void soc_resume_deferred(struct work_struct *work)
...
@@ -717,8 +767,9 @@ static void soc_resume_deferred(struct work_struct *work)
{
{
struct
snd_soc_card
*
card
=
struct
snd_soc_card
*
card
=
container_of
(
work
,
struct
snd_soc_card
,
deferred_resume_work
);
container_of
(
work
,
struct
snd_soc_card
,
deferred_resume_work
);
struct
snd_soc_pcm_runtime
*
rtd
;
struct
snd_soc_codec
*
codec
;
struct
snd_soc_codec
*
codec
;
int
i
,
j
;
int
i
;
/* our power state is still SNDRV_CTL_POWER_D3hot from suspend time,
/* our power state is still SNDRV_CTL_POWER_D3hot from suspend time,
* so userspace apps are blocked from touching us
* so userspace apps are blocked from touching us
...
@@ -733,10 +784,10 @@ static void soc_resume_deferred(struct work_struct *work)
...
@@ -733,10 +784,10 @@ static void soc_resume_deferred(struct work_struct *work)
card
->
resume_pre
(
card
);
card
->
resume_pre
(
card
);
/* resume control bus DAIs */
/* resume control bus DAIs */
for
(
i
=
0
;
i
<
card
->
num_rtd
;
i
++
)
{
list_for_each_entry
(
rtd
,
&
card
->
rtd_list
,
list
)
{
struct
snd_soc_dai
*
cpu_dai
=
card
->
rtd
[
i
].
cpu_dai
;
struct
snd_soc_dai
*
cpu_dai
=
rtd
->
cpu_dai
;
if
(
card
->
rtd
[
i
].
dai_link
->
ignore_suspend
)
if
(
rtd
->
dai_link
->
ignore_suspend
)
continue
;
continue
;
if
(
cpu_dai
->
driver
->
resume
&&
cpu_dai
->
driver
->
bus_control
)
if
(
cpu_dai
->
driver
->
resume
&&
cpu_dai
->
driver
->
bus_control
)
...
@@ -751,28 +802,28 @@ static void soc_resume_deferred(struct work_struct *work)
...
@@ -751,28 +802,28 @@ static void soc_resume_deferred(struct work_struct *work)
}
}
}
}
for
(
i
=
0
;
i
<
card
->
num_rtd
;
i
++
)
{
list_for_each_entry
(
rtd
,
&
card
->
rtd_list
,
list
)
{
if
(
card
->
rtd
[
i
].
dai_link
->
ignore_suspend
)
if
(
rtd
->
dai_link
->
ignore_suspend
)
continue
;
continue
;
snd_soc_dapm_stream_event
(
&
card
->
rtd
[
i
]
,
snd_soc_dapm_stream_event
(
rtd
,
SNDRV_PCM_STREAM_PLAYBACK
,
SNDRV_PCM_STREAM_PLAYBACK
,
SND_SOC_DAPM_STREAM_RESUME
);
SND_SOC_DAPM_STREAM_RESUME
);
snd_soc_dapm_stream_event
(
&
card
->
rtd
[
i
]
,
snd_soc_dapm_stream_event
(
rtd
,
SNDRV_PCM_STREAM_CAPTURE
,
SNDRV_PCM_STREAM_CAPTURE
,
SND_SOC_DAPM_STREAM_RESUME
);
SND_SOC_DAPM_STREAM_RESUME
);
}
}
/* unmute any active DACs */
/* unmute any active DACs */
for
(
i
=
0
;
i
<
card
->
num_rtd
;
i
++
)
{
list_for_each_entry
(
rtd
,
&
card
->
rtd_list
,
list
)
{
if
(
card
->
rtd
[
i
].
dai_link
->
ignore_suspend
)
if
(
rtd
->
dai_link
->
ignore_suspend
)
continue
;
continue
;
for
(
j
=
0
;
j
<
card
->
rtd
[
i
].
num_codecs
;
j
++
)
{
for
(
i
=
0
;
i
<
rtd
->
num_codecs
;
i
++
)
{
struct
snd_soc_dai
*
dai
=
card
->
rtd
[
i
].
codec_dais
[
j
];
struct
snd_soc_dai
*
dai
=
rtd
->
codec_dais
[
i
];
struct
snd_soc_dai_driver
*
drv
=
dai
->
driver
;
struct
snd_soc_dai_driver
*
drv
=
dai
->
driver
;
if
(
drv
->
ops
->
digital_mute
&&
dai
->
playback_active
)
if
(
drv
->
ops
->
digital_mute
&&
dai
->
playback_active
)
...
@@ -780,10 +831,10 @@ static void soc_resume_deferred(struct work_struct *work)
...
@@ -780,10 +831,10 @@ static void soc_resume_deferred(struct work_struct *work)
}
}
}
}
for
(
i
=
0
;
i
<
card
->
num_rtd
;
i
++
)
{
list_for_each_entry
(
rtd
,
&
card
->
rtd_list
,
list
)
{
struct
snd_soc_dai
*
cpu_dai
=
card
->
rtd
[
i
].
cpu_dai
;
struct
snd_soc_dai
*
cpu_dai
=
rtd
->
cpu_dai
;
if
(
card
->
rtd
[
i
].
dai_link
->
ignore_suspend
)
if
(
rtd
->
dai_link
->
ignore_suspend
)
continue
;
continue
;
if
(
cpu_dai
->
driver
->
resume
&&
!
cpu_dai
->
driver
->
bus_control
)
if
(
cpu_dai
->
driver
->
resume
&&
!
cpu_dai
->
driver
->
bus_control
)
...
@@ -808,15 +859,14 @@ int snd_soc_resume(struct device *dev)
...
@@ -808,15 +859,14 @@ int snd_soc_resume(struct device *dev)
{
{
struct
snd_soc_card
*
card
=
dev_get_drvdata
(
dev
);
struct
snd_soc_card
*
card
=
dev_get_drvdata
(
dev
);
bool
bus_control
=
false
;
bool
bus_control
=
false
;
int
i
;
struct
snd_soc_pcm_runtime
*
rtd
;
/* If the card is not initialized yet there is nothing to do */
/* If the card is not initialized yet there is nothing to do */
if
(
!
card
->
instantiated
)
if
(
!
card
->
instantiated
)
return
0
;
return
0
;
/* activate pins from sleep state */
/* activate pins from sleep state */
for
(
i
=
0
;
i
<
card
->
num_rtd
;
i
++
)
{
list_for_each_entry
(
rtd
,
&
card
->
rtd_list
,
list
)
{
struct
snd_soc_pcm_runtime
*
rtd
=
&
card
->
rtd
[
i
];
struct
snd_soc_dai
**
codec_dais
=
rtd
->
codec_dais
;
struct
snd_soc_dai
**
codec_dais
=
rtd
->
codec_dais
;
struct
snd_soc_dai
*
cpu_dai
=
rtd
->
cpu_dai
;
struct
snd_soc_dai
*
cpu_dai
=
rtd
->
cpu_dai
;
int
j
;
int
j
;
...
@@ -837,8 +887,8 @@ int snd_soc_resume(struct device *dev)
...
@@ -837,8 +887,8 @@ int snd_soc_resume(struct device *dev)
* have that problem and may take a substantial amount of time to resume
* have that problem and may take a substantial amount of time to resume
* due to I/O costs and anti-pop so handle them out of line.
* due to I/O costs and anti-pop so handle them out of line.
*/
*/
for
(
i
=
0
;
i
<
card
->
num_rtd
;
i
++
)
{
list_for_each_entry
(
rtd
,
&
card
->
rtd_list
,
list
)
{
struct
snd_soc_dai
*
cpu_dai
=
card
->
rtd
[
i
].
cpu_dai
;
struct
snd_soc_dai
*
cpu_dai
=
rtd
->
cpu_dai
;
bus_control
|=
cpu_dai
->
driver
->
bus_control
;
bus_control
|=
cpu_dai
->
driver
->
bus_control
;
}
}
if
(
bus_control
)
{
if
(
bus_control
)
{
...
@@ -910,18 +960,41 @@ static struct snd_soc_dai *snd_soc_find_dai(
...
@@ -910,18 +960,41 @@ static struct snd_soc_dai *snd_soc_find_dai(
return
NULL
;
return
NULL
;
}
}
static
int
soc_bind_dai_link
(
struct
snd_soc_card
*
card
,
int
num
)
static
bool
soc_is_dai_link_bound
(
struct
snd_soc_card
*
card
,
struct
snd_soc_dai_link
*
dai_link
)
{
struct
snd_soc_pcm_runtime
*
rtd
;
list_for_each_entry
(
rtd
,
&
card
->
rtd_list
,
list
)
{
if
(
rtd
->
dai_link
==
dai_link
)
return
true
;
}
return
false
;
}
static
int
soc_bind_dai_link
(
struct
snd_soc_card
*
card
,
struct
snd_soc_dai_link
*
dai_link
)
{
{
struct
snd_soc_dai_link
*
dai_link
=
&
card
->
dai_link
[
num
];
struct
snd_soc_pcm_runtime
*
rtd
;
struct
snd_soc_pcm_runtime
*
rtd
=
&
card
->
rtd
[
num
];
struct
snd_soc_dai_link_component
*
codecs
=
dai_link
->
codecs
;
struct
snd_soc_dai_link_component
*
codecs
=
dai_link
->
codecs
;
struct
snd_soc_dai_link_component
cpu_dai_component
;
struct
snd_soc_dai_link_component
cpu_dai_component
;
struct
snd_soc_dai
**
codec_dais
=
rtd
->
codec_dais
;
struct
snd_soc_dai
**
codec_dais
;
struct
snd_soc_platform
*
platform
;
struct
snd_soc_platform
*
platform
;
const
char
*
platform_name
;
const
char
*
platform_name
;
int
i
;
int
i
;
dev_dbg
(
card
->
dev
,
"ASoC: binding %s at idx %d
\n
"
,
dai_link
->
name
,
num
);
dev_dbg
(
card
->
dev
,
"ASoC: binding %s
\n
"
,
dai_link
->
name
);
rtd
=
soc_new_pcm_runtime
(
card
,
dai_link
);
if
(
!
rtd
)
return
-
ENOMEM
;
if
(
soc_is_dai_link_bound
(
card
,
dai_link
))
{
dev_dbg
(
card
->
dev
,
"ASoC: dai link %s already bound
\n
"
,
dai_link
->
name
);
return
0
;
}
cpu_dai_component
.
name
=
dai_link
->
cpu_name
;
cpu_dai_component
.
name
=
dai_link
->
cpu_name
;
cpu_dai_component
.
of_node
=
dai_link
->
cpu_of_node
;
cpu_dai_component
.
of_node
=
dai_link
->
cpu_of_node
;
...
@@ -930,18 +1003,19 @@ static int soc_bind_dai_link(struct snd_soc_card *card, int num)
...
@@ -930,18 +1003,19 @@ static int soc_bind_dai_link(struct snd_soc_card *card, int num)
if
(
!
rtd
->
cpu_dai
)
{
if
(
!
rtd
->
cpu_dai
)
{
dev_err
(
card
->
dev
,
"ASoC: CPU DAI %s not registered
\n
"
,
dev_err
(
card
->
dev
,
"ASoC: CPU DAI %s not registered
\n
"
,
dai_link
->
cpu_dai_name
);
dai_link
->
cpu_dai_name
);
return
-
EPROBE_DEFER
;
goto
_err_defer
;
}
}
rtd
->
num_codecs
=
dai_link
->
num_codecs
;
rtd
->
num_codecs
=
dai_link
->
num_codecs
;
/* Find CODEC from registered CODECs */
/* Find CODEC from registered CODECs */
codec_dais
=
rtd
->
codec_dais
;
for
(
i
=
0
;
i
<
rtd
->
num_codecs
;
i
++
)
{
for
(
i
=
0
;
i
<
rtd
->
num_codecs
;
i
++
)
{
codec_dais
[
i
]
=
snd_soc_find_dai
(
&
codecs
[
i
]);
codec_dais
[
i
]
=
snd_soc_find_dai
(
&
codecs
[
i
]);
if
(
!
codec_dais
[
i
])
{
if
(
!
codec_dais
[
i
])
{
dev_err
(
card
->
dev
,
"ASoC: CODEC DAI %s not registered
\n
"
,
dev_err
(
card
->
dev
,
"ASoC: CODEC DAI %s not registered
\n
"
,
codecs
[
i
].
dai_name
);
codecs
[
i
].
dai_name
);
return
-
EPROBE_DEFER
;
goto
_err_defer
;
}
}
}
}
...
@@ -973,9 +1047,12 @@ static int soc_bind_dai_link(struct snd_soc_card *card, int num)
...
@@ -973,9 +1047,12 @@ static int soc_bind_dai_link(struct snd_soc_card *card, int num)
return
-
EPROBE_DEFER
;
return
-
EPROBE_DEFER
;
}
}
card
->
num_rtd
++
;
soc_add_pcm_runtime
(
card
,
rtd
);
return
0
;
return
0
;
_err_defer:
soc_free_pcm_runtime
(
rtd
);
return
-
EPROBE_DEFER
;
}
}
static
void
soc_remove_component
(
struct
snd_soc_component
*
component
)
static
void
soc_remove_component
(
struct
snd_soc_component
*
component
)
...
@@ -1014,9 +1091,9 @@ static void soc_remove_dai(struct snd_soc_dai *dai, int order)
...
@@ -1014,9 +1091,9 @@ static void soc_remove_dai(struct snd_soc_dai *dai, int order)
}
}
}
}
static
void
soc_remove_link_dais
(
struct
snd_soc_card
*
card
,
int
num
,
int
order
)
static
void
soc_remove_link_dais
(
struct
snd_soc_card
*
card
,
struct
snd_soc_pcm_runtime
*
rtd
,
int
order
)
{
{
struct
snd_soc_pcm_runtime
*
rtd
=
&
card
->
rtd
[
num
];
int
i
;
int
i
;
/* unregister the rtd device */
/* unregister the rtd device */
...
@@ -1032,10 +1109,9 @@ static void soc_remove_link_dais(struct snd_soc_card *card, int num, int order)
...
@@ -1032,10 +1109,9 @@ static void soc_remove_link_dais(struct snd_soc_card *card, int num, int order)
soc_remove_dai
(
rtd
->
cpu_dai
,
order
);
soc_remove_dai
(
rtd
->
cpu_dai
,
order
);
}
}
static
void
soc_remove_link_components
(
struct
snd_soc_card
*
card
,
int
num
,
static
void
soc_remove_link_components
(
struct
snd_soc_card
*
card
,
int
order
)
struct
snd_soc_pcm_runtime
*
rtd
,
int
order
)
{
{
struct
snd_soc_pcm_runtime
*
rtd
=
&
card
->
rtd
[
num
];
struct
snd_soc_dai
*
cpu_dai
=
rtd
->
cpu_dai
;
struct
snd_soc_dai
*
cpu_dai
=
rtd
->
cpu_dai
;
struct
snd_soc_platform
*
platform
=
rtd
->
platform
;
struct
snd_soc_platform
*
platform
=
rtd
->
platform
;
struct
snd_soc_component
*
component
;
struct
snd_soc_component
*
component
;
...
@@ -1061,23 +1137,200 @@ static void soc_remove_link_components(struct snd_soc_card *card, int num,
...
@@ -1061,23 +1137,200 @@ static void soc_remove_link_components(struct snd_soc_card *card, int num,
static
void
soc_remove_dai_links
(
struct
snd_soc_card
*
card
)
static
void
soc_remove_dai_links
(
struct
snd_soc_card
*
card
)
{
{
int
dai
,
order
;
int
order
;
struct
snd_soc_pcm_runtime
*
rtd
;
struct
snd_soc_dai_link
*
link
,
*
_link
;
for
(
order
=
SND_SOC_COMP_ORDER_FIRST
;
order
<=
SND_SOC_COMP_ORDER_LAST
;
for
(
order
=
SND_SOC_COMP_ORDER_FIRST
;
order
<=
SND_SOC_COMP_ORDER_LAST
;
order
++
)
{
order
++
)
{
for
(
dai
=
0
;
dai
<
card
->
num_rtd
;
dai
++
)
list_for_each_entry
(
rtd
,
&
card
->
rtd_list
,
list
)
soc_remove_link_dais
(
card
,
dai
,
order
);
soc_remove_link_dais
(
card
,
rtd
,
order
);
}
}
for
(
order
=
SND_SOC_COMP_ORDER_FIRST
;
order
<=
SND_SOC_COMP_ORDER_LAST
;
for
(
order
=
SND_SOC_COMP_ORDER_FIRST
;
order
<=
SND_SOC_COMP_ORDER_LAST
;
order
++
)
{
order
++
)
{
for
(
dai
=
0
;
dai
<
card
->
num_rtd
;
dai
++
)
list_for_each_entry
(
rtd
,
&
card
->
rtd_list
,
list
)
soc_remove_link_components
(
card
,
dai
,
order
);
soc_remove_link_components
(
card
,
rtd
,
order
);
}
}
card
->
num_rtd
=
0
;
list_for_each_entry_safe
(
link
,
_link
,
&
card
->
dai_link_list
,
list
)
{
if
(
link
->
dobj
.
type
==
SND_SOC_DOBJ_DAI_LINK
)
dev_warn
(
card
->
dev
,
"Topology forgot to remove link %s?
\n
"
,
link
->
name
);
list_del
(
&
link
->
list
);
card
->
num_dai_links
--
;
}
}
static
int
snd_soc_init_multicodec
(
struct
snd_soc_card
*
card
,
struct
snd_soc_dai_link
*
dai_link
)
{
/* Legacy codec/codec_dai link is a single entry in multicodec */
if
(
dai_link
->
codec_name
||
dai_link
->
codec_of_node
||
dai_link
->
codec_dai_name
)
{
dai_link
->
num_codecs
=
1
;
dai_link
->
codecs
=
devm_kzalloc
(
card
->
dev
,
sizeof
(
struct
snd_soc_dai_link_component
),
GFP_KERNEL
);
if
(
!
dai_link
->
codecs
)
return
-
ENOMEM
;
dai_link
->
codecs
[
0
].
name
=
dai_link
->
codec_name
;
dai_link
->
codecs
[
0
].
of_node
=
dai_link
->
codec_of_node
;
dai_link
->
codecs
[
0
].
dai_name
=
dai_link
->
codec_dai_name
;
}
if
(
!
dai_link
->
codecs
)
{
dev_err
(
card
->
dev
,
"ASoC: DAI link has no CODECs
\n
"
);
return
-
EINVAL
;
}
return
0
;
}
static
int
soc_init_dai_link
(
struct
snd_soc_card
*
card
,
struct
snd_soc_dai_link
*
link
)
{
int
i
,
ret
;
ret
=
snd_soc_init_multicodec
(
card
,
link
);
if
(
ret
)
{
dev_err
(
card
->
dev
,
"ASoC: failed to init multicodec
\n
"
);
return
ret
;
}
for
(
i
=
0
;
i
<
link
->
num_codecs
;
i
++
)
{
/*
* Codec must be specified by 1 of name or OF node,
* not both or neither.
*/
if
(
!!
link
->
codecs
[
i
].
name
==
!!
link
->
codecs
[
i
].
of_node
)
{
dev_err
(
card
->
dev
,
"ASoC: Neither/both codec name/of_node are set for %s
\n
"
,
link
->
name
);
return
-
EINVAL
;
}
/* Codec DAI name must be specified */
if
(
!
link
->
codecs
[
i
].
dai_name
)
{
dev_err
(
card
->
dev
,
"ASoC: codec_dai_name not set for %s
\n
"
,
link
->
name
);
return
-
EINVAL
;
}
}
/*
* Platform may be specified by either name or OF node, but
* can be left unspecified, and a dummy platform will be used.
*/
if
(
link
->
platform_name
&&
link
->
platform_of_node
)
{
dev_err
(
card
->
dev
,
"ASoC: Both platform name/of_node are set for %s
\n
"
,
link
->
name
);
return
-
EINVAL
;
}
/*
* CPU device may be specified by either name or OF node, but
* can be left unspecified, and will be matched based on DAI
* name alone..
*/
if
(
link
->
cpu_name
&&
link
->
cpu_of_node
)
{
dev_err
(
card
->
dev
,
"ASoC: Neither/both cpu name/of_node are set for %s
\n
"
,
link
->
name
);
return
-
EINVAL
;
}
/*
* At least one of CPU DAI name or CPU device name/node must be
* specified
*/
if
(
!
link
->
cpu_dai_name
&&
!
(
link
->
cpu_name
||
link
->
cpu_of_node
))
{
dev_err
(
card
->
dev
,
"ASoC: Neither cpu_dai_name nor cpu_name/of_node are set for %s
\n
"
,
link
->
name
);
return
-
EINVAL
;
}
return
0
;
}
}
/**
* snd_soc_add_dai_link - Add a DAI link dynamically
* @card: The ASoC card to which the DAI link is added
* @dai_link: The new DAI link to add
*
* This function adds a DAI link to the ASoC card's link list.
*
* Note: Topology can use this API to add DAI links when probing the
* topology component. And machine drivers can still define static
* DAI links in dai_link array.
*/
int
snd_soc_add_dai_link
(
struct
snd_soc_card
*
card
,
struct
snd_soc_dai_link
*
dai_link
)
{
if
(
dai_link
->
dobj
.
type
&&
dai_link
->
dobj
.
type
!=
SND_SOC_DOBJ_DAI_LINK
)
{
dev_err
(
card
->
dev
,
"Invalid dai link type %d
\n
"
,
dai_link
->
dobj
.
type
);
return
-
EINVAL
;
}
lockdep_assert_held
(
&
client_mutex
);
/* Notify the machine driver for extra initialization
* on the link created by topology.
*/
if
(
dai_link
->
dobj
.
type
&&
card
->
add_dai_link
)
card
->
add_dai_link
(
card
,
dai_link
);
list_add_tail
(
&
dai_link
->
list
,
&
card
->
dai_link_list
);
card
->
num_dai_links
++
;
return
0
;
}
EXPORT_SYMBOL_GPL
(
snd_soc_add_dai_link
);
/**
* snd_soc_remove_dai_link - Remove a DAI link from the list
* @card: The ASoC card that owns the link
* @dai_link: The DAI link to remove
*
* This function removes a DAI link from the ASoC card's link list.
*
* For DAI links previously added by topology, topology should
* remove them by using the dobj embedded in the link.
*/
void
snd_soc_remove_dai_link
(
struct
snd_soc_card
*
card
,
struct
snd_soc_dai_link
*
dai_link
)
{
struct
snd_soc_dai_link
*
link
,
*
_link
;
if
(
dai_link
->
dobj
.
type
&&
dai_link
->
dobj
.
type
!=
SND_SOC_DOBJ_DAI_LINK
)
{
dev_err
(
card
->
dev
,
"Invalid dai link type %d
\n
"
,
dai_link
->
dobj
.
type
);
return
;
}
lockdep_assert_held
(
&
client_mutex
);
/* Notify the machine driver for extra destruction
* on the link created by topology.
*/
if
(
dai_link
->
dobj
.
type
&&
card
->
remove_dai_link
)
card
->
remove_dai_link
(
card
,
dai_link
);
list_for_each_entry_safe
(
link
,
_link
,
&
card
->
dai_link_list
,
list
)
{
if
(
link
==
dai_link
)
{
list_del
(
&
link
->
list
);
card
->
num_dai_links
--
;
return
;
}
}
}
EXPORT_SYMBOL_GPL
(
snd_soc_remove_dai_link
);
static
void
soc_set_name_prefix
(
struct
snd_soc_card
*
card
,
static
void
soc_set_name_prefix
(
struct
snd_soc_card
*
card
,
struct
snd_soc_component
*
component
)
struct
snd_soc_component
*
component
)
{
{
...
@@ -1220,10 +1473,10 @@ static int soc_post_component_init(struct snd_soc_pcm_runtime *rtd,
...
@@ -1220,10 +1473,10 @@ static int soc_post_component_init(struct snd_soc_pcm_runtime *rtd,
return
0
;
return
0
;
}
}
static
int
soc_probe_link_components
(
struct
snd_soc_card
*
card
,
int
num
,
static
int
soc_probe_link_components
(
struct
snd_soc_card
*
card
,
struct
snd_soc_pcm_runtime
*
rtd
,
int
order
)
int
order
)
{
{
struct
snd_soc_pcm_runtime
*
rtd
=
&
card
->
rtd
[
num
];
struct
snd_soc_platform
*
platform
=
rtd
->
platform
;
struct
snd_soc_platform
*
platform
=
rtd
->
platform
;
struct
snd_soc_component
*
component
;
struct
snd_soc_component
*
component
;
int
i
,
ret
;
int
i
,
ret
;
...
@@ -1319,15 +1572,15 @@ static int soc_link_dai_widgets(struct snd_soc_card *card,
...
@@ -1319,15 +1572,15 @@ static int soc_link_dai_widgets(struct snd_soc_card *card,
return
0
;
return
0
;
}
}
static
int
soc_probe_link_dais
(
struct
snd_soc_card
*
card
,
int
num
,
int
order
)
static
int
soc_probe_link_dais
(
struct
snd_soc_card
*
card
,
struct
snd_soc_pcm_runtime
*
rtd
,
int
order
)
{
{
struct
snd_soc_dai_link
*
dai_link
=
&
card
->
dai_link
[
num
];
struct
snd_soc_dai_link
*
dai_link
=
rtd
->
dai_link
;
struct
snd_soc_pcm_runtime
*
rtd
=
&
card
->
rtd
[
num
];
struct
snd_soc_dai
*
cpu_dai
=
rtd
->
cpu_dai
;
struct
snd_soc_dai
*
cpu_dai
=
rtd
->
cpu_dai
;
int
i
,
ret
;
int
i
,
ret
;
dev_dbg
(
card
->
dev
,
"ASoC: probe %s dai link %d late %d
\n
"
,
dev_dbg
(
card
->
dev
,
"ASoC: probe %s dai link %d late %d
\n
"
,
card
->
name
,
num
,
order
);
card
->
name
,
rtd
->
num
,
order
);
/* set default power off timeout */
/* set default power off timeout */
rtd
->
pmdown_time
=
pmdown_time
;
rtd
->
pmdown_time
=
pmdown_time
;
...
@@ -1372,7 +1625,7 @@ static int soc_probe_link_dais(struct snd_soc_card *card, int num, int order)
...
@@ -1372,7 +1625,7 @@ static int soc_probe_link_dais(struct snd_soc_card *card, int num, int order)
if
(
cpu_dai
->
driver
->
compress_new
)
{
if
(
cpu_dai
->
driver
->
compress_new
)
{
/*create compress_device"*/
/*create compress_device"*/
ret
=
cpu_dai
->
driver
->
compress_new
(
rtd
,
num
);
ret
=
cpu_dai
->
driver
->
compress_new
(
rtd
,
rtd
->
num
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
dev_err
(
card
->
dev
,
"ASoC: can't create compress %s
\n
"
,
dev_err
(
card
->
dev
,
"ASoC: can't create compress %s
\n
"
,
dai_link
->
stream_name
);
dai_link
->
stream_name
);
...
@@ -1382,7 +1635,7 @@ static int soc_probe_link_dais(struct snd_soc_card *card, int num, int order)
...
@@ -1382,7 +1635,7 @@ static int soc_probe_link_dais(struct snd_soc_card *card, int num, int order)
if
(
!
dai_link
->
params
)
{
if
(
!
dai_link
->
params
)
{
/* create the pcm */
/* create the pcm */
ret
=
soc_new_pcm
(
rtd
,
num
);
ret
=
soc_new_pcm
(
rtd
,
rtd
->
num
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
dev_err
(
card
->
dev
,
"ASoC: can't create pcm %s :%d
\n
"
,
dev_err
(
card
->
dev
,
"ASoC: can't create pcm %s :%d
\n
"
,
dai_link
->
stream_name
,
ret
);
dai_link
->
stream_name
,
ret
);
...
@@ -1552,6 +1805,8 @@ EXPORT_SYMBOL_GPL(snd_soc_runtime_set_dai_fmt);
...
@@ -1552,6 +1805,8 @@ EXPORT_SYMBOL_GPL(snd_soc_runtime_set_dai_fmt);
static
int
snd_soc_instantiate_card
(
struct
snd_soc_card
*
card
)
static
int
snd_soc_instantiate_card
(
struct
snd_soc_card
*
card
)
{
{
struct
snd_soc_codec
*
codec
;
struct
snd_soc_codec
*
codec
;
struct
snd_soc_pcm_runtime
*
rtd
;
struct
snd_soc_dai_link
*
dai_link
;
int
ret
,
i
,
order
;
int
ret
,
i
,
order
;
mutex_lock
(
&
client_mutex
);
mutex_lock
(
&
client_mutex
);
...
@@ -1559,7 +1814,7 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
...
@@ -1559,7 +1814,7 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
/* bind DAIs */
/* bind DAIs */
for
(
i
=
0
;
i
<
card
->
num_links
;
i
++
)
{
for
(
i
=
0
;
i
<
card
->
num_links
;
i
++
)
{
ret
=
soc_bind_dai_link
(
card
,
i
);
ret
=
soc_bind_dai_link
(
card
,
&
card
->
dai_link
[
i
]
);
if
(
ret
!=
0
)
if
(
ret
!=
0
)
goto
base_error
;
goto
base_error
;
}
}
...
@@ -1571,6 +1826,10 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
...
@@ -1571,6 +1826,10 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
goto
base_error
;
goto
base_error
;
}
}
/* add predefined DAI links to the list */
for
(
i
=
0
;
i
<
card
->
num_links
;
i
++
)
snd_soc_add_dai_link
(
card
,
card
->
dai_link
+
i
);
/* initialize the register cache for each available codec */
/* initialize the register cache for each available codec */
list_for_each_entry
(
codec
,
&
codec_list
,
list
)
{
list_for_each_entry
(
codec
,
&
codec_list
,
list
)
{
if
(
codec
->
cache_init
)
if
(
codec
->
cache_init
)
...
@@ -1624,8 +1883,8 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
...
@@ -1624,8 +1883,8 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
/* probe all components used by DAI links on this card */
/* probe all components used by DAI links on this card */
for
(
order
=
SND_SOC_COMP_ORDER_FIRST
;
order
<=
SND_SOC_COMP_ORDER_LAST
;
for
(
order
=
SND_SOC_COMP_ORDER_FIRST
;
order
<=
SND_SOC_COMP_ORDER_LAST
;
order
++
)
{
order
++
)
{
for
(
i
=
0
;
i
<
card
->
num_links
;
i
++
)
{
list_for_each_entry
(
rtd
,
&
card
->
rtd_list
,
list
)
{
ret
=
soc_probe_link_components
(
card
,
i
,
order
);
ret
=
soc_probe_link_components
(
card
,
rtd
,
order
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
dev_err
(
card
->
dev
,
dev_err
(
card
->
dev
,
"ASoC: failed to instantiate card %d
\n
"
,
"ASoC: failed to instantiate card %d
\n
"
,
...
@@ -1635,11 +1894,26 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
...
@@ -1635,11 +1894,26 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
}
}
}
}
/* Find new DAI links added during probing components and bind them.
* Components with topology may bring new DAIs and DAI links.
*/
list_for_each_entry
(
dai_link
,
&
card
->
dai_link_list
,
list
)
{
if
(
soc_is_dai_link_bound
(
card
,
dai_link
))
continue
;
ret
=
soc_init_dai_link
(
card
,
dai_link
);
if
(
ret
)
goto
probe_dai_err
;
ret
=
soc_bind_dai_link
(
card
,
dai_link
);
if
(
ret
)
goto
probe_dai_err
;
}
/* probe all DAI links on this card */
/* probe all DAI links on this card */
for
(
order
=
SND_SOC_COMP_ORDER_FIRST
;
order
<=
SND_SOC_COMP_ORDER_LAST
;
for
(
order
=
SND_SOC_COMP_ORDER_FIRST
;
order
<=
SND_SOC_COMP_ORDER_LAST
;
order
++
)
{
order
++
)
{
for
(
i
=
0
;
i
<
card
->
num_links
;
i
++
)
{
list_for_each_entry
(
rtd
,
&
card
->
rtd_list
,
list
)
{
ret
=
soc_probe_link_dais
(
card
,
i
,
order
);
ret
=
soc_probe_link_dais
(
card
,
rtd
,
order
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
dev_err
(
card
->
dev
,
dev_err
(
card
->
dev
,
"ASoC: failed to instantiate card %d
\n
"
,
"ASoC: failed to instantiate card %d
\n
"
,
...
@@ -1733,6 +2007,7 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
...
@@ -1733,6 +2007,7 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
snd_card_free
(
card
->
snd_card
);
snd_card_free
(
card
->
snd_card
);
base_error:
base_error:
soc_remove_pcm_runtimes
(
card
);
mutex_unlock
(
&
card
->
mutex
);
mutex_unlock
(
&
card
->
mutex
);
mutex_unlock
(
&
client_mutex
);
mutex_unlock
(
&
client_mutex
);
...
@@ -1763,13 +2038,12 @@ static int soc_probe(struct platform_device *pdev)
...
@@ -1763,13 +2038,12 @@ static int soc_probe(struct platform_device *pdev)
static
int
soc_cleanup_card_resources
(
struct
snd_soc_card
*
card
)
static
int
soc_cleanup_card_resources
(
struct
snd_soc_card
*
card
)
{
{
struct
snd_soc_pcm_runtime
*
rtd
;
int
i
;
int
i
;
/* make sure any delayed work runs */
/* make sure any delayed work runs */
for
(
i
=
0
;
i
<
card
->
num_rtd
;
i
++
)
{
list_for_each_entry
(
rtd
,
&
card
->
rtd_list
,
list
)
struct
snd_soc_pcm_runtime
*
rtd
=
&
card
->
rtd
[
i
];
flush_delayed_work
(
&
rtd
->
delayed_work
);
flush_delayed_work
(
&
rtd
->
delayed_work
);
}
/* remove auxiliary devices */
/* remove auxiliary devices */
for
(
i
=
0
;
i
<
card
->
num_aux_devs
;
i
++
)
for
(
i
=
0
;
i
<
card
->
num_aux_devs
;
i
++
)
...
@@ -1777,6 +2051,7 @@ static int soc_cleanup_card_resources(struct snd_soc_card *card)
...
@@ -1777,6 +2051,7 @@ static int soc_cleanup_card_resources(struct snd_soc_card *card)
/* remove and free each DAI */
/* remove and free each DAI */
soc_remove_dai_links
(
card
);
soc_remove_dai_links
(
card
);
soc_remove_pcm_runtimes
(
card
);
soc_cleanup_card_debugfs
(
card
);
soc_cleanup_card_debugfs
(
card
);
...
@@ -1803,29 +2078,26 @@ static int soc_remove(struct platform_device *pdev)
...
@@ -1803,29 +2078,26 @@ static int soc_remove(struct platform_device *pdev)
int
snd_soc_poweroff
(
struct
device
*
dev
)
int
snd_soc_poweroff
(
struct
device
*
dev
)
{
{
struct
snd_soc_card
*
card
=
dev_get_drvdata
(
dev
);
struct
snd_soc_card
*
card
=
dev_get_drvdata
(
dev
);
int
i
;
struct
snd_soc_pcm_runtime
*
rtd
;
if
(
!
card
->
instantiated
)
if
(
!
card
->
instantiated
)
return
0
;
return
0
;
/* Flush out pmdown_time work - we actually do want to run it
/* Flush out pmdown_time work - we actually do want to run it
* now, we're shutting down so no imminent restart. */
* now, we're shutting down so no imminent restart. */
for
(
i
=
0
;
i
<
card
->
num_rtd
;
i
++
)
{
list_for_each_entry
(
rtd
,
&
card
->
rtd_list
,
list
)
struct
snd_soc_pcm_runtime
*
rtd
=
&
card
->
rtd
[
i
];
flush_delayed_work
(
&
rtd
->
delayed_work
);
flush_delayed_work
(
&
rtd
->
delayed_work
);
}
snd_soc_dapm_shutdown
(
card
);
snd_soc_dapm_shutdown
(
card
);
/* deactivate pins to sleep state */
/* deactivate pins to sleep state */
for
(
i
=
0
;
i
<
card
->
num_rtd
;
i
++
)
{
list_for_each_entry
(
rtd
,
&
card
->
rtd_list
,
list
)
{
struct
snd_soc_pcm_runtime
*
rtd
=
&
card
->
rtd
[
i
];
struct
snd_soc_dai
*
cpu_dai
=
rtd
->
cpu_dai
;
struct
snd_soc_dai
*
cpu_dai
=
rtd
->
cpu_dai
;
int
j
;
int
i
;
pinctrl_pm_select_sleep_state
(
cpu_dai
->
dev
);
pinctrl_pm_select_sleep_state
(
cpu_dai
->
dev
);
for
(
j
=
0
;
j
<
rtd
->
num_codecs
;
j
++
)
{
for
(
i
=
0
;
i
<
rtd
->
num_codecs
;
i
++
)
{
struct
snd_soc_dai
*
codec_dai
=
rtd
->
codec_dais
[
j
];
struct
snd_soc_dai
*
codec_dai
=
rtd
->
codec_dais
[
i
];
pinctrl_pm_select_sleep_state
(
codec_dai
->
dev
);
pinctrl_pm_select_sleep_state
(
codec_dai
->
dev
);
}
}
}
}
...
@@ -2301,33 +2573,6 @@ int snd_soc_dai_digital_mute(struct snd_soc_dai *dai, int mute,
...
@@ -2301,33 +2573,6 @@ int snd_soc_dai_digital_mute(struct snd_soc_dai *dai, int mute,
}
}
EXPORT_SYMBOL_GPL
(
snd_soc_dai_digital_mute
);
EXPORT_SYMBOL_GPL
(
snd_soc_dai_digital_mute
);
static
int
snd_soc_init_multicodec
(
struct
snd_soc_card
*
card
,
struct
snd_soc_dai_link
*
dai_link
)
{
/* Legacy codec/codec_dai link is a single entry in multicodec */
if
(
dai_link
->
codec_name
||
dai_link
->
codec_of_node
||
dai_link
->
codec_dai_name
)
{
dai_link
->
num_codecs
=
1
;
dai_link
->
codecs
=
devm_kzalloc
(
card
->
dev
,
sizeof
(
struct
snd_soc_dai_link_component
),
GFP_KERNEL
);
if
(
!
dai_link
->
codecs
)
return
-
ENOMEM
;
dai_link
->
codecs
[
0
].
name
=
dai_link
->
codec_name
;
dai_link
->
codecs
[
0
].
of_node
=
dai_link
->
codec_of_node
;
dai_link
->
codecs
[
0
].
dai_name
=
dai_link
->
codec_dai_name
;
}
if
(
!
dai_link
->
codecs
)
{
dev_err
(
card
->
dev
,
"ASoC: DAI link has no CODECs
\n
"
);
return
-
EINVAL
;
}
return
0
;
}
/**
/**
* snd_soc_register_card - Register a card with the ASoC core
* snd_soc_register_card - Register a card with the ASoC core
*
*
...
@@ -2336,7 +2581,8 @@ static int snd_soc_init_multicodec(struct snd_soc_card *card,
...
@@ -2336,7 +2581,8 @@ static int snd_soc_init_multicodec(struct snd_soc_card *card,
*/
*/
int
snd_soc_register_card
(
struct
snd_soc_card
*
card
)
int
snd_soc_register_card
(
struct
snd_soc_card
*
card
)
{
{
int
i
,
j
,
ret
;
int
i
,
ret
;
struct
snd_soc_pcm_runtime
*
rtd
;
if
(
!
card
->
name
||
!
card
->
dev
)
if
(
!
card
->
name
||
!
card
->
dev
)
return
-
EINVAL
;
return
-
EINVAL
;
...
@@ -2344,63 +2590,11 @@ int snd_soc_register_card(struct snd_soc_card *card)
...
@@ -2344,63 +2590,11 @@ int snd_soc_register_card(struct snd_soc_card *card)
for
(
i
=
0
;
i
<
card
->
num_links
;
i
++
)
{
for
(
i
=
0
;
i
<
card
->
num_links
;
i
++
)
{
struct
snd_soc_dai_link
*
link
=
&
card
->
dai_link
[
i
];
struct
snd_soc_dai_link
*
link
=
&
card
->
dai_link
[
i
];
ret
=
s
nd_soc_init_multicodec
(
card
,
link
);
ret
=
s
oc_init_dai_link
(
card
,
link
);
if
(
ret
)
{
if
(
ret
)
{
dev_err
(
card
->
dev
,
"ASoC: failed to init multicodec
\n
"
);
dev_err
(
card
->
dev
,
"ASoC: failed to init link %s
\n
"
,
return
ret
;
}
for
(
j
=
0
;
j
<
link
->
num_codecs
;
j
++
)
{
/*
* Codec must be specified by 1 of name or OF node,
* not both or neither.
*/
if
(
!!
link
->
codecs
[
j
].
name
==
!!
link
->
codecs
[
j
].
of_node
)
{
dev_err
(
card
->
dev
,
"ASoC: Neither/both codec name/of_node are set for %s
\n
"
,
link
->
name
);
return
-
EINVAL
;
}
/* Codec DAI name must be specified */
if
(
!
link
->
codecs
[
j
].
dai_name
)
{
dev_err
(
card
->
dev
,
"ASoC: codec_dai_name not set for %s
\n
"
,
link
->
name
);
return
-
EINVAL
;
}
}
/*
* Platform may be specified by either name or OF node, but
* can be left unspecified, and a dummy platform will be used.
*/
if
(
link
->
platform_name
&&
link
->
platform_of_node
)
{
dev_err
(
card
->
dev
,
"ASoC: Both platform name/of_node are set for %s
\n
"
,
link
->
name
);
return
-
EINVAL
;
}
/*
* CPU device may be specified by either name or OF node, but
* can be left unspecified, and will be matched based on DAI
* name alone..
*/
if
(
link
->
cpu_name
&&
link
->
cpu_of_node
)
{
dev_err
(
card
->
dev
,
"ASoC: Neither/both cpu name/of_node are set for %s
\n
"
,
link
->
name
);
return
-
EINVAL
;
}
/*
* At least one of CPU DAI name or CPU device name/node must be
* specified
*/
if
(
!
link
->
cpu_dai_name
&&
!
(
link
->
cpu_name
||
link
->
cpu_of_node
))
{
dev_err
(
card
->
dev
,
"ASoC: Neither cpu_dai_name nor cpu_name/of_node are set for %s
\n
"
,
link
->
name
);
link
->
name
);
return
-
EINVAL
;
return
ret
;
}
}
}
}
...
@@ -2408,25 +2602,18 @@ int snd_soc_register_card(struct snd_soc_card *card)
...
@@ -2408,25 +2602,18 @@ int snd_soc_register_card(struct snd_soc_card *card)
snd_soc_initialize_card_lists
(
card
);
snd_soc_initialize_card_lists
(
card
);
card
->
rtd
=
devm_kzalloc
(
card
->
dev
,
INIT_LIST_HEAD
(
&
card
->
dai_link_list
);
card
->
num_dai_links
=
0
;
INIT_LIST_HEAD
(
&
card
->
rtd_list
);
card
->
num_rtd
=
0
;
card
->
rtd_aux
=
devm_kzalloc
(
card
->
dev
,
sizeof
(
struct
snd_soc_pcm_runtime
)
*
sizeof
(
struct
snd_soc_pcm_runtime
)
*
(
card
->
num_links
+
card
->
num_aux_devs
)
,
card
->
num_aux_devs
,
GFP_KERNEL
);
GFP_KERNEL
);
if
(
card
->
rtd
==
NULL
)
if
(
card
->
rtd
_aux
==
NULL
)
return
-
ENOMEM
;
return
-
ENOMEM
;
card
->
num_rtd
=
0
;
card
->
rtd_aux
=
&
card
->
rtd
[
card
->
num_links
];
for
(
i
=
0
;
i
<
card
->
num_links
;
i
++
)
{
card
->
rtd
[
i
].
card
=
card
;
card
->
rtd
[
i
].
dai_link
=
&
card
->
dai_link
[
i
];
card
->
rtd
[
i
].
codec_dais
=
devm_kzalloc
(
card
->
dev
,
sizeof
(
struct
snd_soc_dai
*
)
*
(
card
->
rtd
[
i
].
dai_link
->
num_codecs
),
GFP_KERNEL
);
if
(
card
->
rtd
[
i
].
codec_dais
==
NULL
)
return
-
ENOMEM
;
}
for
(
i
=
0
;
i
<
card
->
num_aux_devs
;
i
++
)
for
(
i
=
0
;
i
<
card
->
num_aux_devs
;
i
++
)
card
->
rtd_aux
[
i
].
card
=
card
;
card
->
rtd_aux
[
i
].
card
=
card
;
...
@@ -2442,8 +2629,7 @@ int snd_soc_register_card(struct snd_soc_card *card)
...
@@ -2442,8 +2629,7 @@ int snd_soc_register_card(struct snd_soc_card *card)
return
ret
;
return
ret
;
/* deactivate pins to sleep state */
/* deactivate pins to sleep state */
for
(
i
=
0
;
i
<
card
->
num_rtd
;
i
++
)
{
list_for_each_entry
(
rtd
,
&
card
->
rtd_list
,
list
)
{
struct
snd_soc_pcm_runtime
*
rtd
=
&
card
->
rtd
[
i
];
struct
snd_soc_dai
*
cpu_dai
=
rtd
->
cpu_dai
;
struct
snd_soc_dai
*
cpu_dai
=
rtd
->
cpu_dai
;
int
j
;
int
j
;
...
...
sound/soc/soc-dapm.c
View file @
a93202fa
...
@@ -3905,13 +3905,10 @@ static void soc_dapm_dai_stream_event(struct snd_soc_dai *dai, int stream,
...
@@ -3905,13 +3905,10 @@ static void soc_dapm_dai_stream_event(struct snd_soc_dai *dai, int stream,
void
snd_soc_dapm_connect_dai_link_widgets
(
struct
snd_soc_card
*
card
)
void
snd_soc_dapm_connect_dai_link_widgets
(
struct
snd_soc_card
*
card
)
{
{
struct
snd_soc_pcm_runtime
*
rtd
=
card
->
rtd
;
struct
snd_soc_pcm_runtime
*
rtd
;
int
i
;
/* for each BE DAI link... */
/* for each BE DAI link... */
for
(
i
=
0
;
i
<
card
->
num_rtd
;
i
++
)
{
list_for_each_entry
(
rtd
,
&
card
->
rtd_list
,
list
)
{
rtd
=
&
card
->
rtd
[
i
];
/*
/*
* dynamic FE links have no fixed DAI mapping.
* dynamic FE links have no fixed DAI mapping.
* CODEC<->CODEC links have no direct connection.
* CODEC<->CODEC links have no direct connection.
...
...
sound/soc/soc-pcm.c
View file @
a93202fa
...
@@ -1213,11 +1213,10 @@ static struct snd_soc_pcm_runtime *dpcm_get_be(struct snd_soc_card *card,
...
@@ -1213,11 +1213,10 @@ static struct snd_soc_pcm_runtime *dpcm_get_be(struct snd_soc_card *card,
struct
snd_soc_dapm_widget
*
widget
,
int
stream
)
struct
snd_soc_dapm_widget
*
widget
,
int
stream
)
{
{
struct
snd_soc_pcm_runtime
*
be
;
struct
snd_soc_pcm_runtime
*
be
;
int
i
,
j
;
int
i
;
if
(
stream
==
SNDRV_PCM_STREAM_PLAYBACK
)
{
if
(
stream
==
SNDRV_PCM_STREAM_PLAYBACK
)
{
for
(
i
=
0
;
i
<
card
->
num_links
;
i
++
)
{
list_for_each_entry
(
be
,
&
card
->
rtd_list
,
list
)
{
be
=
&
card
->
rtd
[
i
];
if
(
!
be
->
dai_link
->
no_pcm
)
if
(
!
be
->
dai_link
->
no_pcm
)
continue
;
continue
;
...
@@ -1225,16 +1224,15 @@ static struct snd_soc_pcm_runtime *dpcm_get_be(struct snd_soc_card *card,
...
@@ -1225,16 +1224,15 @@ static struct snd_soc_pcm_runtime *dpcm_get_be(struct snd_soc_card *card,
if
(
be
->
cpu_dai
->
playback_widget
==
widget
)
if
(
be
->
cpu_dai
->
playback_widget
==
widget
)
return
be
;
return
be
;
for
(
j
=
0
;
j
<
be
->
num_codecs
;
j
++
)
{
for
(
i
=
0
;
i
<
be
->
num_codecs
;
i
++
)
{
struct
snd_soc_dai
*
dai
=
be
->
codec_dais
[
j
];
struct
snd_soc_dai
*
dai
=
be
->
codec_dais
[
i
];
if
(
dai
->
playback_widget
==
widget
)
if
(
dai
->
playback_widget
==
widget
)
return
be
;
return
be
;
}
}
}
}
}
else
{
}
else
{
for
(
i
=
0
;
i
<
card
->
num_links
;
i
++
)
{
list_for_each_entry
(
be
,
&
card
->
rtd_list
,
list
)
{
be
=
&
card
->
rtd
[
i
];
if
(
!
be
->
dai_link
->
no_pcm
)
if
(
!
be
->
dai_link
->
no_pcm
)
continue
;
continue
;
...
@@ -1242,8 +1240,8 @@ static struct snd_soc_pcm_runtime *dpcm_get_be(struct snd_soc_card *card,
...
@@ -1242,8 +1240,8 @@ static struct snd_soc_pcm_runtime *dpcm_get_be(struct snd_soc_card *card,
if
(
be
->
cpu_dai
->
capture_widget
==
widget
)
if
(
be
->
cpu_dai
->
capture_widget
==
widget
)
return
be
;
return
be
;
for
(
j
=
0
;
j
<
be
->
num_codecs
;
j
++
)
{
for
(
i
=
0
;
i
<
be
->
num_codecs
;
i
++
)
{
struct
snd_soc_dai
*
dai
=
be
->
codec_dais
[
j
];
struct
snd_soc_dai
*
dai
=
be
->
codec_dais
[
i
];
if
(
dai
->
capture_widget
==
widget
)
if
(
dai
->
capture_widget
==
widget
)
return
be
;
return
be
;
}
}
...
@@ -2343,12 +2341,12 @@ static int dpcm_run_old_update(struct snd_soc_pcm_runtime *fe, int stream)
...
@@ -2343,12 +2341,12 @@ static int dpcm_run_old_update(struct snd_soc_pcm_runtime *fe, int stream)
*/
*/
int
soc_dpcm_runtime_update
(
struct
snd_soc_card
*
card
)
int
soc_dpcm_runtime_update
(
struct
snd_soc_card
*
card
)
{
{
int
i
,
old
,
new
,
paths
;
struct
snd_soc_pcm_runtime
*
fe
;
int
old
,
new
,
paths
;
mutex_lock_nested
(
&
card
->
mutex
,
SND_SOC_CARD_CLASS_RUNTIME
);
mutex_lock_nested
(
&
card
->
mutex
,
SND_SOC_CARD_CLASS_RUNTIME
);
for
(
i
=
0
;
i
<
card
->
num_rtd
;
i
++
)
{
list_for_each_entry
(
fe
,
&
card
->
rtd_list
,
list
)
{
struct
snd_soc_dapm_widget_list
*
list
;
struct
snd_soc_dapm_widget_list
*
list
;
struct
snd_soc_pcm_runtime
*
fe
=
&
card
->
rtd
[
i
];
/* make sure link is FE */
/* make sure link is FE */
if
(
!
fe
->
dai_link
->
dynamic
)
if
(
!
fe
->
dai_link
->
dynamic
)
...
...
sound/soc/tegra/tegra_wm8903.c
View file @
a93202fa
...
@@ -199,7 +199,8 @@ static int tegra_wm8903_init(struct snd_soc_pcm_runtime *rtd)
...
@@ -199,7 +199,8 @@ static int tegra_wm8903_init(struct snd_soc_pcm_runtime *rtd)
static
int
tegra_wm8903_remove
(
struct
snd_soc_card
*
card
)
static
int
tegra_wm8903_remove
(
struct
snd_soc_card
*
card
)
{
{
struct
snd_soc_pcm_runtime
*
rtd
=
&
(
card
->
rtd
[
0
]);
struct
snd_soc_pcm_runtime
*
rtd
=
snd_soc_get_pcm_runtime
(
card
,
card
->
dai_link
[
0
].
name
);
struct
snd_soc_dai
*
codec_dai
=
rtd
->
codec_dai
;
struct
snd_soc_dai
*
codec_dai
=
rtd
->
codec_dai
;
struct
snd_soc_codec
*
codec
=
codec_dai
->
codec
;
struct
snd_soc_codec
*
codec
=
codec_dai
->
codec
;
struct
tegra_wm8903
*
machine
=
snd_soc_card_get_drvdata
(
card
);
struct
tegra_wm8903
*
machine
=
snd_soc_card_get_drvdata
(
card
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment