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
70fe99d8
Commit
70fe99d8
authored
Jun 17, 2013
by
Mark Brown
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'asoc/topic/core' into asoc-next
parents
87fd83fd
cf1f7c6e
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
123 additions
and
136 deletions
+123
-136
include/sound/soc-dapm.h
include/sound/soc-dapm.h
+2
-0
sound/soc/soc-core.c
sound/soc/soc-core.c
+44
-62
sound/soc/soc-dapm.c
sound/soc/soc-dapm.c
+26
-21
sound/soc/soc-pcm.c
sound/soc/soc-pcm.c
+47
-44
sound/soc/soc-utils.c
sound/soc/soc-utils.c
+4
-9
No files found.
include/sound/soc-dapm.h
View file @
70fe99d8
...
@@ -311,6 +311,8 @@ struct device;
...
@@ -311,6 +311,8 @@ struct device;
#define SND_SOC_DAPM_POST_PMD 0x8
/* after widget power down */
#define SND_SOC_DAPM_POST_PMD 0x8
/* after widget power down */
#define SND_SOC_DAPM_PRE_REG 0x10
/* before audio path setup */
#define SND_SOC_DAPM_PRE_REG 0x10
/* before audio path setup */
#define SND_SOC_DAPM_POST_REG 0x20
/* after audio path setup */
#define SND_SOC_DAPM_POST_REG 0x20
/* after audio path setup */
#define SND_SOC_DAPM_WILL_PMU 0x40
/* called at start of sequence */
#define SND_SOC_DAPM_WILL_PMD 0x80
/* called at start of sequence */
#define SND_SOC_DAPM_PRE_POST_PMD \
#define SND_SOC_DAPM_PRE_POST_PMD \
(SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD)
(SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD)
...
...
sound/soc/soc-core.c
View file @
70fe99d8
...
@@ -272,8 +272,8 @@ static void soc_init_codec_debugfs(struct snd_soc_codec *codec)
...
@@ -272,8 +272,8 @@ static void soc_init_codec_debugfs(struct snd_soc_codec *codec)
codec
->
debugfs_codec_root
=
debugfs_create_dir
(
codec
->
name
,
codec
->
debugfs_codec_root
=
debugfs_create_dir
(
codec
->
name
,
debugfs_card_root
);
debugfs_card_root
);
if
(
!
codec
->
debugfs_codec_root
)
{
if
(
!
codec
->
debugfs_codec_root
)
{
dev_warn
(
codec
->
dev
,
"ASoC: Failed to create codec debugfs"
dev_warn
(
codec
->
dev
,
" directory
\n
"
);
"
ASoC: Failed to create codec debugfs
directory
\n
"
);
return
;
return
;
}
}
...
@@ -286,8 +286,8 @@ static void soc_init_codec_debugfs(struct snd_soc_codec *codec)
...
@@ -286,8 +286,8 @@ static void soc_init_codec_debugfs(struct snd_soc_codec *codec)
codec
->
debugfs_codec_root
,
codec
->
debugfs_codec_root
,
codec
,
&
codec_reg_fops
);
codec
,
&
codec_reg_fops
);
if
(
!
codec
->
debugfs_reg
)
if
(
!
codec
->
debugfs_reg
)
dev_warn
(
codec
->
dev
,
"ASoC: Failed to create codec register"
dev_warn
(
codec
->
dev
,
" debugfs file
\n
"
);
"
ASoC: Failed to create codec register
debugfs file
\n
"
);
snd_soc_dapm_debugfs_init
(
&
codec
->
dapm
,
codec
->
debugfs_codec_root
);
snd_soc_dapm_debugfs_init
(
&
codec
->
dapm
,
codec
->
debugfs_codec_root
);
}
}
...
@@ -631,8 +631,7 @@ int snd_soc_suspend(struct device *dev)
...
@@ -631,8 +631,7 @@ int snd_soc_suspend(struct device *dev)
*/
*/
if
(
codec
->
dapm
.
idle_bias_off
)
{
if
(
codec
->
dapm
.
idle_bias_off
)
{
dev_dbg
(
codec
->
dev
,
dev_dbg
(
codec
->
dev
,
"ASoC: idle_bias_off CODEC on"
"ASoC: idle_bias_off CODEC on over suspend
\n
"
);
" over suspend
\n
"
);
break
;
break
;
}
}
case
SND_SOC_BIAS_OFF
:
case
SND_SOC_BIAS_OFF
:
...
@@ -643,8 +642,8 @@ int snd_soc_suspend(struct device *dev)
...
@@ -643,8 +642,8 @@ int snd_soc_suspend(struct device *dev)
regcache_mark_dirty
(
codec
->
control_data
);
regcache_mark_dirty
(
codec
->
control_data
);
break
;
break
;
default:
default:
dev_dbg
(
codec
->
dev
,
"ASoC: CODEC is on"
dev_dbg
(
codec
->
dev
,
" over suspend
\n
"
);
"
ASoC: CODEC is on
over suspend
\n
"
);
break
;
break
;
}
}
}
}
...
@@ -713,8 +712,8 @@ static void soc_resume_deferred(struct work_struct *work)
...
@@ -713,8 +712,8 @@ static void soc_resume_deferred(struct work_struct *work)
codec
->
suspended
=
0
;
codec
->
suspended
=
0
;
break
;
break
;
default:
default:
dev_dbg
(
codec
->
dev
,
"ASoC: CODEC was on over"
dev_dbg
(
codec
->
dev
,
" suspend
\n
"
);
"
ASoC: CODEC was on over
suspend
\n
"
);
break
;
break
;
}
}
}
}
...
@@ -1110,8 +1109,8 @@ static int soc_probe_codec(struct snd_soc_card *card,
...
@@ -1110,8 +1109,8 @@ static int soc_probe_codec(struct snd_soc_card *card,
}
}
WARN
(
codec
->
dapm
.
idle_bias_off
&&
WARN
(
codec
->
dapm
.
idle_bias_off
&&
codec
->
dapm
.
bias_level
!=
SND_SOC_BIAS_OFF
,
codec
->
dapm
.
bias_level
!=
SND_SOC_BIAS_OFF
,
"codec %s can not start from non-off bias
"
"codec %s can not start from non-off bias
with idle_bias_off==1
\n
"
,
" with idle_bias_off==1
\n
"
,
codec
->
name
);
codec
->
name
);
}
}
/* If the driver didn't set I/O up try regmap */
/* If the driver didn't set I/O up try regmap */
...
@@ -1582,8 +1581,9 @@ static int snd_soc_init_codec_cache(struct snd_soc_codec *codec,
...
@@ -1582,8 +1581,9 @@ static int snd_soc_init_codec_cache(struct snd_soc_codec *codec,
codec
->
compress_type
=
compress_type
;
codec
->
compress_type
=
compress_type
;
ret
=
snd_soc_cache_init
(
codec
);
ret
=
snd_soc_cache_init
(
codec
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
dev_err
(
codec
->
dev
,
"ASoC: Failed to set cache compression"
dev_err
(
codec
->
dev
,
" type: %d
\n
"
,
ret
);
"ASoC: Failed to set cache compression type: %d
\n
"
,
ret
);
return
ret
;
return
ret
;
}
}
codec
->
cache_init
=
1
;
codec
->
cache_init
=
1
;
...
@@ -1639,8 +1639,9 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
...
@@ -1639,8 +1639,9 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
ret
=
snd_card_create
(
SNDRV_DEFAULT_IDX1
,
SNDRV_DEFAULT_STR1
,
ret
=
snd_card_create
(
SNDRV_DEFAULT_IDX1
,
SNDRV_DEFAULT_STR1
,
card
->
owner
,
0
,
&
card
->
snd_card
);
card
->
owner
,
0
,
&
card
->
snd_card
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
dev_err
(
card
->
dev
,
"ASoC: can't create sound card for"
dev_err
(
card
->
dev
,
" card %s: %d
\n
"
,
card
->
name
,
ret
);
"ASoC: can't create sound card for card %s: %d
\n
"
,
card
->
name
,
ret
);
goto
base_error
;
goto
base_error
;
}
}
card
->
snd_card
->
dev
=
card
->
dev
;
card
->
snd_card
->
dev
=
card
->
dev
;
...
@@ -1815,8 +1816,8 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
...
@@ -1815,8 +1816,8 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
for
(
i
=
0
;
i
<
card
->
num_rtd
;
i
++
)
{
for
(
i
=
0
;
i
<
card
->
num_rtd
;
i
++
)
{
ret
=
soc_register_ac97_dai_link
(
&
card
->
rtd
[
i
]);
ret
=
soc_register_ac97_dai_link
(
&
card
->
rtd
[
i
]);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
dev_err
(
card
->
dev
,
"ASoC: failed to register AC97:"
dev_err
(
card
->
dev
,
" %d
\n
"
,
ret
);
"
ASoC: failed to register AC97:
%d
\n
"
,
ret
);
while
(
--
i
>=
0
)
while
(
--
i
>=
0
)
soc_unregister_ac97_dai_link
(
card
->
rtd
[
i
].
codec
);
soc_unregister_ac97_dai_link
(
card
->
rtd
[
i
].
codec
);
goto
probe_aux_dev_err
;
goto
probe_aux_dev_err
;
...
@@ -2218,29 +2219,6 @@ int snd_soc_test_bits(struct snd_soc_codec *codec, unsigned short reg,
...
@@ -2218,29 +2219,6 @@ int snd_soc_test_bits(struct snd_soc_codec *codec, unsigned short reg,
}
}
EXPORT_SYMBOL_GPL
(
snd_soc_test_bits
);
EXPORT_SYMBOL_GPL
(
snd_soc_test_bits
);
/**
* snd_soc_set_runtime_hwparams - set the runtime hardware parameters
* @substream: the pcm substream
* @hw: the hardware parameters
*
* Sets the substream runtime hardware parameters.
*/
int
snd_soc_set_runtime_hwparams
(
struct
snd_pcm_substream
*
substream
,
const
struct
snd_pcm_hardware
*
hw
)
{
struct
snd_pcm_runtime
*
runtime
=
substream
->
runtime
;
runtime
->
hw
.
info
=
hw
->
info
;
runtime
->
hw
.
formats
=
hw
->
formats
;
runtime
->
hw
.
period_bytes_min
=
hw
->
period_bytes_min
;
runtime
->
hw
.
period_bytes_max
=
hw
->
period_bytes_max
;
runtime
->
hw
.
periods_min
=
hw
->
periods_min
;
runtime
->
hw
.
periods_max
=
hw
->
periods_max
;
runtime
->
hw
.
buffer_bytes_max
=
hw
->
buffer_bytes_max
;
runtime
->
hw
.
fifo_size
=
hw
->
fifo_size
;
return
0
;
}
EXPORT_SYMBOL_GPL
(
snd_soc_set_runtime_hwparams
);
/**
/**
* snd_soc_cnew - create new control
* snd_soc_cnew - create new control
* @_template: control template
* @_template: control template
...
@@ -2259,7 +2237,6 @@ struct snd_kcontrol *snd_soc_cnew(const struct snd_kcontrol_new *_template,
...
@@ -2259,7 +2237,6 @@ struct snd_kcontrol *snd_soc_cnew(const struct snd_kcontrol_new *_template,
struct
snd_kcontrol_new
template
;
struct
snd_kcontrol_new
template
;
struct
snd_kcontrol
*
kcontrol
;
struct
snd_kcontrol
*
kcontrol
;
char
*
name
=
NULL
;
char
*
name
=
NULL
;
int
name_len
;
memcpy
(
&
template
,
_template
,
sizeof
(
template
));
memcpy
(
&
template
,
_template
,
sizeof
(
template
));
template
.
index
=
0
;
template
.
index
=
0
;
...
@@ -2268,13 +2245,10 @@ struct snd_kcontrol *snd_soc_cnew(const struct snd_kcontrol_new *_template,
...
@@ -2268,13 +2245,10 @@ struct snd_kcontrol *snd_soc_cnew(const struct snd_kcontrol_new *_template,
long_name
=
template
.
name
;
long_name
=
template
.
name
;
if
(
prefix
)
{
if
(
prefix
)
{
name_len
=
strlen
(
long_name
)
+
strlen
(
prefix
)
+
2
;
name
=
kasprintf
(
GFP_KERNEL
,
"%s %s"
,
prefix
,
long_name
);
name
=
kmalloc
(
name_len
,
GFP_KERNEL
);
if
(
!
name
)
if
(
!
name
)
return
NULL
;
return
NULL
;
snprintf
(
name
,
name_len
,
"%s %s"
,
prefix
,
long_name
);
template
.
name
=
name
;
template
.
name
=
name
;
}
else
{
}
else
{
template
.
name
=
long_name
;
template
.
name
=
long_name
;
...
@@ -3586,14 +3560,16 @@ int snd_soc_register_card(struct snd_soc_card *card)
...
@@ -3586,14 +3560,16 @@ int snd_soc_register_card(struct snd_soc_card *card)
* not both or neither.
* not both or neither.
*/
*/
if
(
!!
link
->
codec_name
==
!!
link
->
codec_of_node
)
{
if
(
!!
link
->
codec_name
==
!!
link
->
codec_of_node
)
{
dev_err
(
card
->
dev
,
"ASoC: Neither/both codec"
dev_err
(
card
->
dev
,
" name/of_node are set for %s
\n
"
,
link
->
name
);
"ASoC: Neither/both codec name/of_node are set for %s
\n
"
,
link
->
name
);
return
-
EINVAL
;
return
-
EINVAL
;
}
}
/* Codec DAI name must be specified */
/* Codec DAI name must be specified */
if
(
!
link
->
codec_dai_name
)
{
if
(
!
link
->
codec_dai_name
)
{
dev_err
(
card
->
dev
,
"ASoC: codec_dai_name not"
dev_err
(
card
->
dev
,
" set for %s
\n
"
,
link
->
name
);
"ASoC: codec_dai_name not set for %s
\n
"
,
link
->
name
);
return
-
EINVAL
;
return
-
EINVAL
;
}
}
...
@@ -3602,8 +3578,9 @@ int snd_soc_register_card(struct snd_soc_card *card)
...
@@ -3602,8 +3578,9 @@ int snd_soc_register_card(struct snd_soc_card *card)
* can be left unspecified, and a dummy platform will be used.
* can be left unspecified, and a dummy platform will be used.
*/
*/
if
(
link
->
platform_name
&&
link
->
platform_of_node
)
{
if
(
link
->
platform_name
&&
link
->
platform_of_node
)
{
dev_err
(
card
->
dev
,
"ASoC: Both platform name/of_node"
dev_err
(
card
->
dev
,
" are set for %s
\n
"
,
link
->
name
);
"ASoC: Both platform name/of_node are set for %s
\n
"
,
link
->
name
);
return
-
EINVAL
;
return
-
EINVAL
;
}
}
...
@@ -3613,8 +3590,9 @@ int snd_soc_register_card(struct snd_soc_card *card)
...
@@ -3613,8 +3590,9 @@ int snd_soc_register_card(struct snd_soc_card *card)
* name alone..
* name alone..
*/
*/
if
(
link
->
cpu_name
&&
link
->
cpu_of_node
)
{
if
(
link
->
cpu_name
&&
link
->
cpu_of_node
)
{
dev_err
(
card
->
dev
,
"ASoC: Neither/both "
dev_err
(
card
->
dev
,
"cpu name/of_node are set for %s
\n
"
,
link
->
name
);
"ASoC: Neither/both cpu name/of_node are set for %s
\n
"
,
link
->
name
);
return
-
EINVAL
;
return
-
EINVAL
;
}
}
/*
/*
...
@@ -3623,8 +3601,9 @@ int snd_soc_register_card(struct snd_soc_card *card)
...
@@ -3623,8 +3601,9 @@ int snd_soc_register_card(struct snd_soc_card *card)
*/
*/
if
(
!
link
->
cpu_dai_name
&&
if
(
!
link
->
cpu_dai_name
&&
!
(
link
->
cpu_name
||
link
->
cpu_of_node
))
{
!
(
link
->
cpu_name
||
link
->
cpu_of_node
))
{
dev_err
(
card
->
dev
,
"ASoC: Neither cpu_dai_name nor "
dev_err
(
card
->
dev
,
"cpu_name/of_node are set for %s
\n
"
,
link
->
name
);
"ASoC: Neither cpu_dai_name nor cpu_name/of_node are set for %s
\n
"
,
link
->
name
);
return
-
EINVAL
;
return
-
EINVAL
;
}
}
}
}
...
@@ -3728,8 +3707,9 @@ static inline char *fmt_multiple_name(struct device *dev,
...
@@ -3728,8 +3707,9 @@ static inline char *fmt_multiple_name(struct device *dev,
struct
snd_soc_dai_driver
*
dai_drv
)
struct
snd_soc_dai_driver
*
dai_drv
)
{
{
if
(
dai_drv
->
name
==
NULL
)
{
if
(
dai_drv
->
name
==
NULL
)
{
dev_err
(
dev
,
"ASoC: error - multiple DAI %s registered with"
dev_err
(
dev
,
" no name
\n
"
,
dev_name
(
dev
));
"ASoC: error - multiple DAI %s registered with no name
\n
"
,
dev_name
(
dev
));
return
NULL
;
return
NULL
;
}
}
...
@@ -3859,8 +3839,9 @@ static int snd_soc_register_dais(struct device *dev,
...
@@ -3859,8 +3839,9 @@ static int snd_soc_register_dais(struct device *dev,
list_for_each_entry
(
codec
,
&
codec_list
,
list
)
{
list_for_each_entry
(
codec
,
&
codec_list
,
list
)
{
if
(
codec
->
dev
==
dev
)
{
if
(
codec
->
dev
==
dev
)
{
dev_dbg
(
dev
,
"ASoC: Mapped DAI %s to "
dev_dbg
(
dev
,
"CODEC %s
\n
"
,
dai
->
name
,
codec
->
name
);
"ASoC: Mapped DAI %s to CODEC %s
\n
"
,
dai
->
name
,
codec
->
name
);
dai
->
codec
=
codec
;
dai
->
codec
=
codec
;
break
;
break
;
}
}
...
@@ -4296,8 +4277,9 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
...
@@ -4296,8 +4277,9 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
num_routes
=
of_property_count_strings
(
np
,
propname
);
num_routes
=
of_property_count_strings
(
np
,
propname
);
if
(
num_routes
<
0
||
num_routes
&
1
)
{
if
(
num_routes
<
0
||
num_routes
&
1
)
{
dev_err
(
card
->
dev
,
"ASoC: Property '%s' does not exist or its"
dev_err
(
card
->
dev
,
" length is not even
\n
"
,
propname
);
"ASoC: Property '%s' does not exist or its length is not even
\n
"
,
propname
);
return
-
EINVAL
;
return
-
EINVAL
;
}
}
num_routes
/=
2
;
num_routes
/=
2
;
...
...
sound/soc/soc-dapm.c
View file @
70fe99d8
...
@@ -526,7 +526,6 @@ static int dapm_create_or_share_mixmux_kcontrol(struct snd_soc_dapm_widget *w,
...
@@ -526,7 +526,6 @@ static int dapm_create_or_share_mixmux_kcontrol(struct snd_soc_dapm_widget *w,
int
wlistentries
;
int
wlistentries
;
size_t
wlistsize
;
size_t
wlistsize
;
bool
wname_in_long_name
,
kcname_in_long_name
;
bool
wname_in_long_name
,
kcname_in_long_name
;
size_t
name_len
;
char
*
long_name
;
char
*
long_name
;
const
char
*
name
;
const
char
*
name
;
int
ret
;
int
ret
;
...
@@ -591,25 +590,19 @@ static int dapm_create_or_share_mixmux_kcontrol(struct snd_soc_dapm_widget *w,
...
@@ -591,25 +590,19 @@ static int dapm_create_or_share_mixmux_kcontrol(struct snd_soc_dapm_widget *w,
}
}
if
(
wname_in_long_name
&&
kcname_in_long_name
)
{
if
(
wname_in_long_name
&&
kcname_in_long_name
)
{
name_len
=
strlen
(
w
->
name
)
-
prefix_len
+
1
+
strlen
(
w
->
kcontrol_news
[
kci
].
name
)
+
1
;
long_name
=
kmalloc
(
name_len
,
GFP_KERNEL
);
if
(
long_name
==
NULL
)
{
kfree
(
wlist
);
return
-
ENOMEM
;
}
/*
/*
* The control will get a prefix from the control
* The control will get a prefix from the control
* creation process but we're also using the same
* creation process but we're also using the same
* prefix for widgets so cut the prefix off the
* prefix for widgets so cut the prefix off the
* front of the widget name.
* front of the widget name.
*/
*/
snprintf
(
long_name
,
name_len
,
"%s %s"
,
long_name
=
kasprintf
(
GFP_KERNEL
,
"%s %s"
,
w
->
name
+
prefix_len
,
w
->
name
+
prefix_len
,
w
->
kcontrol_news
[
kci
].
name
);
w
->
kcontrol_news
[
kci
].
name
);
long_name
[
name_len
-
1
]
=
'\0'
;
if
(
long_name
==
NULL
)
{
kfree
(
wlist
);
return
-
ENOMEM
;
}
name
=
long_name
;
name
=
long_name
;
}
else
if
(
wname_in_long_name
)
{
}
else
if
(
wname_in_long_name
)
{
...
@@ -1272,6 +1265,14 @@ static void dapm_seq_check_event(struct snd_soc_dapm_context *dapm,
...
@@ -1272,6 +1265,14 @@ static void dapm_seq_check_event(struct snd_soc_dapm_context *dapm,
ev_name
=
"POST_PMD"
;
ev_name
=
"POST_PMD"
;
power
=
0
;
power
=
0
;
break
;
break
;
case
SND_SOC_DAPM_WILL_PMU
:
ev_name
=
"WILL_PMU"
;
power
=
1
;
break
;
case
SND_SOC_DAPM_WILL_PMD
:
ev_name
=
"WILL_PMD"
;
power
=
0
;
break
;
default:
default:
BUG
();
BUG
();
return
;
return
;
...
@@ -1732,6 +1733,14 @@ static int dapm_power_widgets(struct snd_soc_dapm_context *dapm, int event)
...
@@ -1732,6 +1733,14 @@ static int dapm_power_widgets(struct snd_soc_dapm_context *dapm, int event)
&
async_domain
);
&
async_domain
);
async_synchronize_full_domain
(
&
async_domain
);
async_synchronize_full_domain
(
&
async_domain
);
list_for_each_entry
(
w
,
&
down_list
,
power_list
)
{
dapm_seq_check_event
(
dapm
,
w
,
SND_SOC_DAPM_WILL_PMD
);
}
list_for_each_entry
(
w
,
&
up_list
,
power_list
)
{
dapm_seq_check_event
(
dapm
,
w
,
SND_SOC_DAPM_WILL_PMU
);
}
/* Power down widgets first; try to avoid amplifying pops. */
/* Power down widgets first; try to avoid amplifying pops. */
dapm_seq_run
(
dapm
,
&
down_list
,
event
,
false
);
dapm_seq_run
(
dapm
,
&
down_list
,
event
,
false
);
...
@@ -3057,7 +3066,6 @@ snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm,
...
@@ -3057,7 +3066,6 @@ snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm,
const
struct
snd_soc_dapm_widget
*
widget
)
const
struct
snd_soc_dapm_widget
*
widget
)
{
{
struct
snd_soc_dapm_widget
*
w
;
struct
snd_soc_dapm_widget
*
w
;
size_t
name_len
;
int
ret
;
int
ret
;
if
((
w
=
dapm_cnew_widget
(
widget
))
==
NULL
)
if
((
w
=
dapm_cnew_widget
(
widget
))
==
NULL
)
...
@@ -3098,19 +3106,16 @@ snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm,
...
@@ -3098,19 +3106,16 @@ snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm,
break
;
break
;
}
}
name_len
=
strlen
(
widget
->
name
)
+
1
;
if
(
dapm
->
codec
&&
dapm
->
codec
->
name_prefix
)
if
(
dapm
->
codec
&&
dapm
->
codec
->
name_prefix
)
name_len
+=
1
+
strlen
(
dapm
->
codec
->
name_prefix
);
w
->
name
=
kasprintf
(
GFP_KERNEL
,
"%s %s"
,
w
->
name
=
kmalloc
(
name_len
,
GFP_KERNEL
);
dapm
->
codec
->
name_prefix
,
widget
->
name
);
else
w
->
name
=
kasprintf
(
GFP_KERNEL
,
"%s"
,
widget
->
name
);
if
(
w
->
name
==
NULL
)
{
if
(
w
->
name
==
NULL
)
{
kfree
(
w
);
kfree
(
w
);
return
NULL
;
return
NULL
;
}
}
if
(
dapm
->
codec
&&
dapm
->
codec
->
name_prefix
)
snprintf
((
char
*
)
w
->
name
,
name_len
,
"%s %s"
,
dapm
->
codec
->
name_prefix
,
widget
->
name
);
else
snprintf
((
char
*
)
w
->
name
,
name_len
,
"%s"
,
widget
->
name
);
switch
(
w
->
id
)
{
switch
(
w
->
id
)
{
case
snd_soc_dapm_switch
:
case
snd_soc_dapm_switch
:
...
...
sound/soc/soc-pcm.c
View file @
70fe99d8
...
@@ -33,6 +33,29 @@
...
@@ -33,6 +33,29 @@
#define DPCM_MAX_BE_USERS 8
#define DPCM_MAX_BE_USERS 8
/**
* snd_soc_set_runtime_hwparams - set the runtime hardware parameters
* @substream: the pcm substream
* @hw: the hardware parameters
*
* Sets the substream runtime hardware parameters.
*/
int
snd_soc_set_runtime_hwparams
(
struct
snd_pcm_substream
*
substream
,
const
struct
snd_pcm_hardware
*
hw
)
{
struct
snd_pcm_runtime
*
runtime
=
substream
->
runtime
;
runtime
->
hw
.
info
=
hw
->
info
;
runtime
->
hw
.
formats
=
hw
->
formats
;
runtime
->
hw
.
period_bytes_min
=
hw
->
period_bytes_min
;
runtime
->
hw
.
period_bytes_max
=
hw
->
period_bytes_max
;
runtime
->
hw
.
periods_min
=
hw
->
periods_min
;
runtime
->
hw
.
periods_max
=
hw
->
periods_max
;
runtime
->
hw
.
buffer_bytes_max
=
hw
->
buffer_bytes_max
;
runtime
->
hw
.
fifo_size
=
hw
->
fifo_size
;
return
0
;
}
EXPORT_SYMBOL_GPL
(
snd_soc_set_runtime_hwparams
);
/* DPCM stream event, send event to FE and all active BEs. */
/* DPCM stream event, send event to FE and all active BEs. */
static
int
dpcm_dapm_stream_event
(
struct
snd_soc_pcm_runtime
*
fe
,
int
dir
,
static
int
dpcm_dapm_stream_event
(
struct
snd_soc_pcm_runtime
*
fe
,
int
dir
,
int
event
)
int
event
)
...
@@ -124,6 +147,26 @@ static void soc_pcm_apply_msb(struct snd_pcm_substream *substream,
...
@@ -124,6 +147,26 @@ static void soc_pcm_apply_msb(struct snd_pcm_substream *substream,
}
}
}
}
static
void
soc_pcm_init_runtime_hw
(
struct
snd_pcm_hardware
*
hw
,
struct
snd_soc_pcm_stream
*
codec_stream
,
struct
snd_soc_pcm_stream
*
cpu_stream
)
{
hw
->
rate_min
=
max
(
codec_stream
->
rate_min
,
cpu_stream
->
rate_min
);
hw
->
rate_max
=
max
(
codec_stream
->
rate_max
,
cpu_stream
->
rate_max
);
hw
->
channels_min
=
max
(
codec_stream
->
channels_min
,
cpu_stream
->
channels_min
);
hw
->
channels_max
=
min
(
codec_stream
->
channels_max
,
cpu_stream
->
channels_max
);
hw
->
formats
=
codec_stream
->
formats
&
cpu_stream
->
formats
;
hw
->
rates
=
codec_stream
->
rates
&
cpu_stream
->
rates
;
if
(
codec_stream
->
rates
&
(
SNDRV_PCM_RATE_KNOT
|
SNDRV_PCM_RATE_CONTINUOUS
))
hw
->
rates
|=
cpu_stream
->
rates
;
if
(
cpu_stream
->
rates
&
(
SNDRV_PCM_RATE_KNOT
|
SNDRV_PCM_RATE_CONTINUOUS
))
hw
->
rates
|=
codec_stream
->
rates
;
}
/*
/*
* Called by ALSA when a PCM substream is opened, the runtime->hw record is
* Called by ALSA when a PCM substream is opened, the runtime->hw record is
* then initialized and any private data can be allocated. This also calls
* then initialized and any private data can be allocated. This also calls
...
@@ -189,51 +232,11 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
...
@@ -189,51 +232,11 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
/* Check that the codec and cpu DAIs are compatible */
/* Check that the codec and cpu DAIs are compatible */
if
(
substream
->
stream
==
SNDRV_PCM_STREAM_PLAYBACK
)
{
if
(
substream
->
stream
==
SNDRV_PCM_STREAM_PLAYBACK
)
{
runtime
->
hw
.
rate_min
=
soc_pcm_init_runtime_hw
(
&
runtime
->
hw
,
&
codec_dai_drv
->
playback
,
max
(
codec_dai_drv
->
playback
.
rate_min
,
&
cpu_dai_drv
->
playback
);
cpu_dai_drv
->
playback
.
rate_min
);
runtime
->
hw
.
rate_max
=
min
(
codec_dai_drv
->
playback
.
rate_max
,
cpu_dai_drv
->
playback
.
rate_max
);
runtime
->
hw
.
channels_min
=
max
(
codec_dai_drv
->
playback
.
channels_min
,
cpu_dai_drv
->
playback
.
channels_min
);
runtime
->
hw
.
channels_max
=
min
(
codec_dai_drv
->
playback
.
channels_max
,
cpu_dai_drv
->
playback
.
channels_max
);
runtime
->
hw
.
formats
=
codec_dai_drv
->
playback
.
formats
&
cpu_dai_drv
->
playback
.
formats
;
runtime
->
hw
.
rates
=
codec_dai_drv
->
playback
.
rates
&
cpu_dai_drv
->
playback
.
rates
;
if
(
codec_dai_drv
->
playback
.
rates
&
(
SNDRV_PCM_RATE_KNOT
|
SNDRV_PCM_RATE_CONTINUOUS
))
runtime
->
hw
.
rates
|=
cpu_dai_drv
->
playback
.
rates
;
if
(
cpu_dai_drv
->
playback
.
rates
&
(
SNDRV_PCM_RATE_KNOT
|
SNDRV_PCM_RATE_CONTINUOUS
))
runtime
->
hw
.
rates
|=
codec_dai_drv
->
playback
.
rates
;
}
else
{
}
else
{
runtime
->
hw
.
rate_min
=
soc_pcm_init_runtime_hw
(
&
runtime
->
hw
,
&
codec_dai_drv
->
capture
,
max
(
codec_dai_drv
->
capture
.
rate_min
,
&
cpu_dai_drv
->
capture
);
cpu_dai_drv
->
capture
.
rate_min
);
runtime
->
hw
.
rate_max
=
min
(
codec_dai_drv
->
capture
.
rate_max
,
cpu_dai_drv
->
capture
.
rate_max
);
runtime
->
hw
.
channels_min
=
max
(
codec_dai_drv
->
capture
.
channels_min
,
cpu_dai_drv
->
capture
.
channels_min
);
runtime
->
hw
.
channels_max
=
min
(
codec_dai_drv
->
capture
.
channels_max
,
cpu_dai_drv
->
capture
.
channels_max
);
runtime
->
hw
.
formats
=
codec_dai_drv
->
capture
.
formats
&
cpu_dai_drv
->
capture
.
formats
;
runtime
->
hw
.
rates
=
codec_dai_drv
->
capture
.
rates
&
cpu_dai_drv
->
capture
.
rates
;
if
(
codec_dai_drv
->
capture
.
rates
&
(
SNDRV_PCM_RATE_KNOT
|
SNDRV_PCM_RATE_CONTINUOUS
))
runtime
->
hw
.
rates
|=
cpu_dai_drv
->
capture
.
rates
;
if
(
cpu_dai_drv
->
capture
.
rates
&
(
SNDRV_PCM_RATE_KNOT
|
SNDRV_PCM_RATE_CONTINUOUS
))
runtime
->
hw
.
rates
|=
codec_dai_drv
->
capture
.
rates
;
}
}
ret
=
-
EINVAL
;
ret
=
-
EINVAL
;
...
...
sound/soc/soc-utils.c
View file @
70fe99d8
...
@@ -159,15 +159,10 @@ int __init snd_soc_util_init(void)
...
@@ -159,15 +159,10 @@ int __init snd_soc_util_init(void)
{
{
int
ret
;
int
ret
;
soc_dummy_dev
=
platform_device_alloc
(
"snd-soc-dummy"
,
-
1
);
soc_dummy_dev
=
if
(
!
soc_dummy_dev
)
platform_device_register_simple
(
"snd-soc-dummy"
,
-
1
,
NULL
,
0
);
return
-
ENOMEM
;
if
(
IS_ERR
(
soc_dummy_dev
))
return
PTR_ERR
(
soc_dummy_dev
);
ret
=
platform_device_add
(
soc_dummy_dev
);
if
(
ret
!=
0
)
{
platform_device_put
(
soc_dummy_dev
);
return
ret
;
}
ret
=
platform_driver_register
(
&
soc_dummy_driver
);
ret
=
platform_driver_register
(
&
soc_dummy_driver
);
if
(
ret
!=
0
)
if
(
ret
!=
0
)
...
...
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