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
674b3663
Commit
674b3663
authored
Dec 02, 2012
by
Mark Brown
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'asoc/topic/log' into asoc-next
parents
ca7e5cb2
b1bc7b3c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
309 additions
and
284 deletions
+309
-284
sound/soc/soc-cache.c
sound/soc/soc-cache.c
+5
-5
sound/soc/soc-core.c
sound/soc/soc-core.c
+123
-118
sound/soc/soc-dapm.c
sound/soc/soc-dapm.c
+74
-60
sound/soc/soc-jack.c
sound/soc/soc-jack.c
+7
-6
sound/soc/soc-pcm.c
sound/soc/soc-pcm.c
+100
-95
No files found.
sound/soc/soc-cache.c
View file @
674b3663
...
@@ -88,7 +88,7 @@ static int snd_soc_flat_cache_sync(struct snd_soc_codec *codec)
...
@@ -88,7 +88,7 @@ static int snd_soc_flat_cache_sync(struct snd_soc_codec *codec)
ret
=
snd_soc_write
(
codec
,
i
,
val
);
ret
=
snd_soc_write
(
codec
,
i
,
val
);
if
(
ret
)
if
(
ret
)
return
ret
;
return
ret
;
dev_dbg
(
codec
->
dev
,
"Synced register %#x, value = %#x
\n
"
,
dev_dbg
(
codec
->
dev
,
"
ASoC:
Synced register %#x, value = %#x
\n
"
,
i
,
val
);
i
,
val
);
}
}
return
0
;
return
0
;
...
@@ -156,7 +156,7 @@ int snd_soc_cache_init(struct snd_soc_codec *codec)
...
@@ -156,7 +156,7 @@ int snd_soc_cache_init(struct snd_soc_codec *codec)
/* Fall back to flat compression */
/* Fall back to flat compression */
if
(
i
==
ARRAY_SIZE
(
cache_types
))
{
if
(
i
==
ARRAY_SIZE
(
cache_types
))
{
dev_warn
(
codec
->
dev
,
"Could not match compress type: %d
\n
"
,
dev_warn
(
codec
->
dev
,
"
ASoC:
Could not match compress type: %d
\n
"
,
codec
->
compress_type
);
codec
->
compress_type
);
i
=
0
;
i
=
0
;
}
}
...
@@ -166,7 +166,7 @@ int snd_soc_cache_init(struct snd_soc_codec *codec)
...
@@ -166,7 +166,7 @@ int snd_soc_cache_init(struct snd_soc_codec *codec)
if
(
codec
->
cache_ops
->
init
)
{
if
(
codec
->
cache_ops
->
init
)
{
if
(
codec
->
cache_ops
->
name
)
if
(
codec
->
cache_ops
->
name
)
dev_dbg
(
codec
->
dev
,
"Initializing %s cache for %s codec
\n
"
,
dev_dbg
(
codec
->
dev
,
"
ASoC:
Initializing %s cache for %s codec
\n
"
,
codec
->
cache_ops
->
name
,
codec
->
name
);
codec
->
cache_ops
->
name
,
codec
->
name
);
return
codec
->
cache_ops
->
init
(
codec
);
return
codec
->
cache_ops
->
init
(
codec
);
}
}
...
@@ -181,7 +181,7 @@ int snd_soc_cache_exit(struct snd_soc_codec *codec)
...
@@ -181,7 +181,7 @@ int snd_soc_cache_exit(struct snd_soc_codec *codec)
{
{
if
(
codec
->
cache_ops
&&
codec
->
cache_ops
->
exit
)
{
if
(
codec
->
cache_ops
&&
codec
->
cache_ops
->
exit
)
{
if
(
codec
->
cache_ops
->
name
)
if
(
codec
->
cache_ops
->
name
)
dev_dbg
(
codec
->
dev
,
"Destroying %s cache for %s codec
\n
"
,
dev_dbg
(
codec
->
dev
,
"
ASoC:
Destroying %s cache for %s codec
\n
"
,
codec
->
cache_ops
->
name
,
codec
->
name
);
codec
->
cache_ops
->
name
,
codec
->
name
);
return
codec
->
cache_ops
->
exit
(
codec
);
return
codec
->
cache_ops
->
exit
(
codec
);
}
}
...
@@ -265,7 +265,7 @@ int snd_soc_cache_sync(struct snd_soc_codec *codec)
...
@@ -265,7 +265,7 @@ int snd_soc_cache_sync(struct snd_soc_codec *codec)
name
=
"unknown"
;
name
=
"unknown"
;
if
(
codec
->
cache_ops
->
name
)
if
(
codec
->
cache_ops
->
name
)
dev_dbg
(
codec
->
dev
,
"Syncing %s cache for %s codec
\n
"
,
dev_dbg
(
codec
->
dev
,
"
ASoC:
Syncing %s cache for %s codec
\n
"
,
codec
->
cache_ops
->
name
,
codec
->
name
);
codec
->
cache_ops
->
name
,
codec
->
name
);
trace_snd_soc_cache_sync
(
codec
,
name
,
"start"
);
trace_snd_soc_cache_sync
(
codec
,
name
,
"start"
);
ret
=
codec
->
cache_ops
->
sync
(
codec
);
ret
=
codec
->
cache_ops
->
sync
(
codec
);
...
...
sound/soc/soc-core.c
View file @
674b3663
...
@@ -271,7 +271,8 @@ static void soc_init_codec_debugfs(struct snd_soc_codec *codec)
...
@@ -271,7 +271,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
,
"Failed to create codec debugfs directory
\n
"
);
dev_warn
(
codec
->
dev
,
"ASoC: Failed to create codec debugfs"
" directory
\n
"
);
return
;
return
;
}
}
...
@@ -284,7 +285,8 @@ static void soc_init_codec_debugfs(struct snd_soc_codec *codec)
...
@@ -284,7 +285,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
,
"Failed to create codec register debugfs file
\n
"
);
dev_warn
(
codec
->
dev
,
"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
);
}
}
...
@@ -302,7 +304,7 @@ static void soc_init_platform_debugfs(struct snd_soc_platform *platform)
...
@@ -302,7 +304,7 @@ static void soc_init_platform_debugfs(struct snd_soc_platform *platform)
debugfs_card_root
);
debugfs_card_root
);
if
(
!
platform
->
debugfs_platform_root
)
{
if
(
!
platform
->
debugfs_platform_root
)
{
dev_warn
(
platform
->
dev
,
dev_warn
(
platform
->
dev
,
"Failed to create platform debugfs directory
\n
"
);
"
ASoC:
Failed to create platform debugfs directory
\n
"
);
return
;
return
;
}
}
...
@@ -430,7 +432,7 @@ static void soc_init_card_debugfs(struct snd_soc_card *card)
...
@@ -430,7 +432,7 @@ static void soc_init_card_debugfs(struct snd_soc_card *card)
&
card
->
pop_time
);
&
card
->
pop_time
);
if
(
!
card
->
debugfs_pop_time
)
if
(
!
card
->
debugfs_pop_time
)
dev_warn
(
card
->
dev
,
dev_warn
(
card
->
dev
,
"Failed to create pop time debugfs file
\n
"
);
"
ASoC:
Failed to create pop time debugfs file
\n
"
);
}
}
static
void
soc_cleanup_card_debugfs
(
struct
snd_soc_card
*
card
)
static
void
soc_cleanup_card_debugfs
(
struct
snd_soc_card
*
card
)
...
@@ -475,7 +477,7 @@ struct snd_pcm_substream *snd_soc_get_dai_substream(struct snd_soc_card *card,
...
@@ -475,7 +477,7 @@ struct snd_pcm_substream *snd_soc_get_dai_substream(struct snd_soc_card *card,
!
strcmp
(
card
->
rtd
[
i
].
dai_link
->
name
,
dai_link
))
!
strcmp
(
card
->
rtd
[
i
].
dai_link
->
name
,
dai_link
))
return
card
->
rtd
[
i
].
pcm
->
streams
[
stream
].
substream
;
return
card
->
rtd
[
i
].
pcm
->
streams
[
stream
].
substream
;
}
}
dev_dbg
(
card
->
dev
,
"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
);
...
@@ -489,7 +491,7 @@ struct snd_soc_pcm_runtime *snd_soc_get_pcm_runtime(struct snd_soc_card *card,
...
@@ -489,7 +491,7 @@ struct snd_soc_pcm_runtime *snd_soc_get_pcm_runtime(struct snd_soc_card *card,
if
(
!
strcmp
(
card
->
rtd
[
i
].
dai_link
->
name
,
dai_link
))
if
(
!
strcmp
(
card
->
rtd
[
i
].
dai_link
->
name
,
dai_link
))
return
&
card
->
rtd
[
i
];
return
&
card
->
rtd
[
i
];
}
}
dev_dbg
(
card
->
dev
,
"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
;
}
}
EXPORT_SYMBOL_GPL
(
snd_soc_get_pcm_runtime
);
EXPORT_SYMBOL_GPL
(
snd_soc_get_pcm_runtime
);
...
@@ -519,7 +521,7 @@ static int soc_ac97_dev_register(struct snd_soc_codec *codec)
...
@@ -519,7 +521,7 @@ static int soc_ac97_dev_register(struct snd_soc_codec *codec)
codec
->
card
->
snd_card
->
number
,
0
,
codec
->
name
);
codec
->
card
->
snd_card
->
number
,
0
,
codec
->
name
);
err
=
device_register
(
&
codec
->
ac97
->
dev
);
err
=
device_register
(
&
codec
->
ac97
->
dev
);
if
(
err
<
0
)
{
if
(
err
<
0
)
{
snd_printk
(
KERN_ERR
"
Can't register ac97 bus
\n
"
);
dev_err
(
codec
->
dev
,
"ASoC:
Can't register ac97 bus
\n
"
);
codec
->
ac97
->
dev
.
bus
=
NULL
;
codec
->
ac97
->
dev
.
bus
=
NULL
;
return
err
;
return
err
;
}
}
...
@@ -628,7 +630,8 @@ int snd_soc_suspend(struct device *dev)
...
@@ -628,7 +630,8 @@ 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
,
"idle_bias_off CODEC on over suspend
\n
"
);
"ASoC: idle_bias_off CODEC on"
" over suspend
\n
"
);
break
;
break
;
}
}
case
SND_SOC_BIAS_OFF
:
case
SND_SOC_BIAS_OFF
:
...
@@ -639,7 +642,8 @@ int snd_soc_suspend(struct device *dev)
...
@@ -639,7 +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
,
"CODEC is on over suspend
\n
"
);
dev_dbg
(
codec
->
dev
,
"ASoC: CODEC is on"
" over suspend
\n
"
);
break
;
break
;
}
}
}
}
...
@@ -676,7 +680,7 @@ static void soc_resume_deferred(struct work_struct *work)
...
@@ -676,7 +680,7 @@ static void soc_resume_deferred(struct work_struct *work)
* so userspace apps are blocked from touching us
* so userspace apps are blocked from touching us
*/
*/
dev_dbg
(
card
->
dev
,
"starting resume work
\n
"
);
dev_dbg
(
card
->
dev
,
"
ASoC:
starting resume work
\n
"
);
/* Bring us up into D2 so that DAPM starts enabling things */
/* Bring us up into D2 so that DAPM starts enabling things */
snd_power_change_state
(
card
->
snd_card
,
SNDRV_CTL_POWER_D2
);
snd_power_change_state
(
card
->
snd_card
,
SNDRV_CTL_POWER_D2
);
...
@@ -708,7 +712,8 @@ static void soc_resume_deferred(struct work_struct *work)
...
@@ -708,7 +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
,
"CODEC was on over suspend
\n
"
);
dev_dbg
(
codec
->
dev
,
"ASoC: CODEC was on over"
" suspend
\n
"
);
break
;
break
;
}
}
}
}
...
@@ -758,7 +763,7 @@ static void soc_resume_deferred(struct work_struct *work)
...
@@ -758,7 +763,7 @@ static void soc_resume_deferred(struct work_struct *work)
if
(
card
->
resume_post
)
if
(
card
->
resume_post
)
card
->
resume_post
(
card
);
card
->
resume_post
(
card
);
dev_dbg
(
card
->
dev
,
"resume work completed
\n
"
);
dev_dbg
(
card
->
dev
,
"
ASoC:
resume work completed
\n
"
);
/* userspace can access us now we are back as we were before */
/* userspace can access us now we are back as we were before */
snd_power_change_state
(
card
->
snd_card
,
SNDRV_CTL_POWER_D0
);
snd_power_change_state
(
card
->
snd_card
,
SNDRV_CTL_POWER_D0
);
...
@@ -790,12 +795,12 @@ int snd_soc_resume(struct device *dev)
...
@@ -790,12 +795,12 @@ int snd_soc_resume(struct device *dev)
ac97_control
|=
cpu_dai
->
driver
->
ac97_control
;
ac97_control
|=
cpu_dai
->
driver
->
ac97_control
;
}
}
if
(
ac97_control
)
{
if
(
ac97_control
)
{
dev_dbg
(
dev
,
"Resuming AC97 immediately
\n
"
);
dev_dbg
(
dev
,
"
ASoC:
Resuming AC97 immediately
\n
"
);
soc_resume_deferred
(
&
card
->
deferred_resume_work
);
soc_resume_deferred
(
&
card
->
deferred_resume_work
);
}
else
{
}
else
{
dev_dbg
(
dev
,
"Scheduling resume work
\n
"
);
dev_dbg
(
dev
,
"
ASoC:
Scheduling resume work
\n
"
);
if
(
!
schedule_work
(
&
card
->
deferred_resume_work
))
if
(
!
schedule_work
(
&
card
->
deferred_resume_work
))
dev_err
(
dev
,
"resume work item may be lost
\n
"
);
dev_err
(
dev
,
"
ASoC:
resume work item may be lost
\n
"
);
}
}
return
0
;
return
0
;
...
@@ -818,7 +823,7 @@ static int soc_bind_dai_link(struct snd_soc_card *card, int num)
...
@@ -818,7 +823,7 @@ static int soc_bind_dai_link(struct snd_soc_card *card, int num)
struct
snd_soc_dai
*
codec_dai
,
*
cpu_dai
;
struct
snd_soc_dai
*
codec_dai
,
*
cpu_dai
;
const
char
*
platform_name
;
const
char
*
platform_name
;
dev_dbg
(
card
->
dev
,
"binding %s at idx %d
\n
"
,
dai_link
->
name
,
num
);
dev_dbg
(
card
->
dev
,
"
ASoC:
binding %s at idx %d
\n
"
,
dai_link
->
name
,
num
);
/* Find CPU DAI from registered DAIs*/
/* Find CPU DAI from registered DAIs*/
list_for_each_entry
(
cpu_dai
,
&
dai_list
,
list
)
{
list_for_each_entry
(
cpu_dai
,
&
dai_list
,
list
)
{
...
@@ -836,7 +841,7 @@ static int soc_bind_dai_link(struct snd_soc_card *card, int num)
...
@@ -836,7 +841,7 @@ 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
,
"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
;
return
-
EPROBE_DEFER
;
}
}
...
@@ -867,14 +872,14 @@ static int soc_bind_dai_link(struct snd_soc_card *card, int num)
...
@@ -867,14 +872,14 @@ static int soc_bind_dai_link(struct snd_soc_card *card, int num)
}
}
if
(
!
rtd
->
codec_dai
)
{
if
(
!
rtd
->
codec_dai
)
{
dev_err
(
card
->
dev
,
"CODEC DAI %s not registered
\n
"
,
dev_err
(
card
->
dev
,
"
ASoC:
CODEC DAI %s not registered
\n
"
,
dai_link
->
codec_dai_name
);
dai_link
->
codec_dai_name
);
return
-
EPROBE_DEFER
;
return
-
EPROBE_DEFER
;
}
}
}
}
if
(
!
rtd
->
codec
)
{
if
(
!
rtd
->
codec
)
{
dev_err
(
card
->
dev
,
"CODEC %s not registered
\n
"
,
dev_err
(
card
->
dev
,
"
ASoC:
CODEC %s not registered
\n
"
,
dai_link
->
codec_name
);
dai_link
->
codec_name
);
return
-
EPROBE_DEFER
;
return
-
EPROBE_DEFER
;
}
}
...
@@ -898,7 +903,7 @@ static int soc_bind_dai_link(struct snd_soc_card *card, int num)
...
@@ -898,7 +903,7 @@ static int soc_bind_dai_link(struct snd_soc_card *card, int num)
rtd
->
platform
=
platform
;
rtd
->
platform
=
platform
;
}
}
if
(
!
rtd
->
platform
)
{
if
(
!
rtd
->
platform
)
{
dev_err
(
card
->
dev
,
"platform %s not registered
\n
"
,
dev_err
(
card
->
dev
,
"
ASoC:
platform %s not registered
\n
"
,
dai_link
->
platform_name
);
dai_link
->
platform_name
);
return
-
EPROBE_DEFER
;
return
-
EPROBE_DEFER
;
}
}
...
@@ -915,8 +920,8 @@ static int soc_remove_platform(struct snd_soc_platform *platform)
...
@@ -915,8 +920,8 @@ static int soc_remove_platform(struct snd_soc_platform *platform)
if
(
platform
->
driver
->
remove
)
{
if
(
platform
->
driver
->
remove
)
{
ret
=
platform
->
driver
->
remove
(
platform
);
ret
=
platform
->
driver
->
remove
(
platform
);
if
(
ret
<
0
)
if
(
ret
<
0
)
pr_err
(
"asoc: failed to remove %s:
%d
\n
"
,
dev_err
(
platform
->
dev
,
"ASoC: failed to remove
%d
\n
"
,
platform
->
name
,
ret
);
ret
);
}
}
/* Make sure all DAPM widgets are freed */
/* Make sure all DAPM widgets are freed */
...
@@ -937,9 +942,7 @@ static void soc_remove_codec(struct snd_soc_codec *codec)
...
@@ -937,9 +942,7 @@ static void soc_remove_codec(struct snd_soc_codec *codec)
if
(
codec
->
driver
->
remove
)
{
if
(
codec
->
driver
->
remove
)
{
err
=
codec
->
driver
->
remove
(
codec
);
err
=
codec
->
driver
->
remove
(
codec
);
if
(
err
<
0
)
if
(
err
<
0
)
dev_err
(
codec
->
dev
,
dev_err
(
codec
->
dev
,
"ASoC: failed to remove %d
\n
"
,
err
);
"asoc: failed to remove %s: %d
\n
"
,
codec
->
name
,
err
);
}
}
/* Make sure all DAPM widgets are freed */
/* Make sure all DAPM widgets are freed */
...
@@ -971,8 +974,9 @@ static void soc_remove_link_dais(struct snd_soc_card *card, int num, int order)
...
@@ -971,8 +974,9 @@ static void soc_remove_link_dais(struct snd_soc_card *card, int num, int order)
if
(
codec_dai
->
driver
->
remove
)
{
if
(
codec_dai
->
driver
->
remove
)
{
err
=
codec_dai
->
driver
->
remove
(
codec_dai
);
err
=
codec_dai
->
driver
->
remove
(
codec_dai
);
if
(
err
<
0
)
if
(
err
<
0
)
pr_err
(
"asoc: failed to remove %s: %d
\n
"
,
dev_err
(
codec_dai
->
dev
,
codec_dai
->
name
,
err
);
"ASoC: failed to remove %s: %d
\n
"
,
codec_dai
->
name
,
err
);
}
}
codec_dai
->
probed
=
0
;
codec_dai
->
probed
=
0
;
list_del
(
&
codec_dai
->
card_list
);
list_del
(
&
codec_dai
->
card_list
);
...
@@ -984,8 +988,9 @@ static void soc_remove_link_dais(struct snd_soc_card *card, int num, int order)
...
@@ -984,8 +988,9 @@ static void soc_remove_link_dais(struct snd_soc_card *card, int num, int order)
if
(
cpu_dai
->
driver
->
remove
)
{
if
(
cpu_dai
->
driver
->
remove
)
{
err
=
cpu_dai
->
driver
->
remove
(
cpu_dai
);
err
=
cpu_dai
->
driver
->
remove
(
cpu_dai
);
if
(
err
<
0
)
if
(
err
<
0
)
pr_err
(
"asoc: failed to remove %s: %d
\n
"
,
dev_err
(
cpu_dai
->
dev
,
cpu_dai
->
name
,
err
);
"ASoC: failed to remove %s: %d
\n
"
,
cpu_dai
->
name
,
err
);
}
}
cpu_dai
->
probed
=
0
;
cpu_dai
->
probed
=
0
;
list_del
(
&
cpu_dai
->
card_list
);
list_del
(
&
cpu_dai
->
card_list
);
...
@@ -1099,8 +1104,7 @@ static int soc_probe_codec(struct snd_soc_card *card,
...
@@ -1099,8 +1104,7 @@ static int soc_probe_codec(struct snd_soc_card *card,
ret
=
driver
->
probe
(
codec
);
ret
=
driver
->
probe
(
codec
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
dev_err
(
codec
->
dev
,
dev_err
(
codec
->
dev
,
"asoc: failed to probe CODEC %s: %d
\n
"
,
"ASoC: failed to probe CODEC %d
\n
"
,
ret
);
codec
->
name
,
ret
);
goto
err_probe
;
goto
err_probe
;
}
}
}
}
...
@@ -1163,8 +1167,7 @@ static int soc_probe_platform(struct snd_soc_card *card,
...
@@ -1163,8 +1167,7 @@ static int soc_probe_platform(struct snd_soc_card *card,
ret
=
driver
->
probe
(
platform
);
ret
=
driver
->
probe
(
platform
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
dev_err
(
platform
->
dev
,
dev_err
(
platform
->
dev
,
"asoc: failed to probe platform %s: %d
\n
"
,
"ASoC: failed to probe platform %d
\n
"
,
ret
);
platform
->
name
,
ret
);
goto
err_probe
;
goto
err_probe
;
}
}
}
}
...
@@ -1229,7 +1232,7 @@ static int soc_post_component_init(struct snd_soc_card *card,
...
@@ -1229,7 +1232,7 @@ static int soc_post_component_init(struct snd_soc_card *card,
else
if
(
dailess
&&
aux_dev
->
init
)
else
if
(
dailess
&&
aux_dev
->
init
)
ret
=
aux_dev
->
init
(
&
codec
->
dapm
);
ret
=
aux_dev
->
init
(
&
codec
->
dapm
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
dev_err
(
card
->
dev
,
"
asoc
: failed to init %s: %d
\n
"
,
name
,
ret
);
dev_err
(
card
->
dev
,
"
ASoC
: failed to init %s: %d
\n
"
,
name
,
ret
);
return
ret
;
return
ret
;
}
}
codec
->
name_prefix
=
temp
;
codec
->
name_prefix
=
temp
;
...
@@ -1253,7 +1256,7 @@ static int soc_post_component_init(struct snd_soc_card *card,
...
@@ -1253,7 +1256,7 @@ static int soc_post_component_init(struct snd_soc_card *card,
ret
=
device_add
(
rtd
->
dev
);
ret
=
device_add
(
rtd
->
dev
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
dev_err
(
card
->
dev
,
dev_err
(
card
->
dev
,
"
asoc
: failed to register runtime device: %d
\n
"
,
ret
);
"
ASoC
: failed to register runtime device: %d
\n
"
,
ret
);
return
ret
;
return
ret
;
}
}
rtd
->
dev_registered
=
1
;
rtd
->
dev_registered
=
1
;
...
@@ -1262,14 +1265,13 @@ static int soc_post_component_init(struct snd_soc_card *card,
...
@@ -1262,14 +1265,13 @@ static int soc_post_component_init(struct snd_soc_card *card,
ret
=
snd_soc_dapm_sys_add
(
rtd
->
dev
);
ret
=
snd_soc_dapm_sys_add
(
rtd
->
dev
);
if
(
ret
<
0
)
if
(
ret
<
0
)
dev_err
(
codec
->
dev
,
dev_err
(
codec
->
dev
,
"asoc: failed to add codec dapm sysfs entries: %d
\n
"
,
"ASoC: failed to add codec dapm sysfs entries: %d
\n
"
,
ret
);
ret
);
/* add codec sysfs entries */
/* add codec sysfs entries */
ret
=
device_create_file
(
rtd
->
dev
,
&
dev_attr_codec_reg
);
ret
=
device_create_file
(
rtd
->
dev
,
&
dev_attr_codec_reg
);
if
(
ret
<
0
)
if
(
ret
<
0
)
dev_err
(
codec
->
dev
,
dev_err
(
codec
->
dev
,
"
asoc
: failed to add codec sysfs files: %d
\n
"
,
ret
);
"
ASoC
: failed to add codec sysfs files: %d
\n
"
,
ret
);
#ifdef CONFIG_DEBUG_FS
#ifdef CONFIG_DEBUG_FS
/* add DPCM sysfs entries */
/* add DPCM sysfs entries */
...
@@ -1278,7 +1280,7 @@ static int soc_post_component_init(struct snd_soc_card *card,
...
@@ -1278,7 +1280,7 @@ static int soc_post_component_init(struct snd_soc_card *card,
ret
=
soc_dpcm_debugfs_add
(
rtd
);
ret
=
soc_dpcm_debugfs_add
(
rtd
);
if
(
ret
<
0
)
if
(
ret
<
0
)
dev_err
(
rtd
->
dev
,
"
asoc
: failed to add dpcm sysfs entries: %d
\n
"
,
ret
);
dev_err
(
rtd
->
dev
,
"
ASoC
: failed to add dpcm sysfs entries: %d
\n
"
,
ret
);
out:
out:
#endif
#endif
...
@@ -1333,7 +1335,7 @@ static int soc_probe_link_dais(struct snd_soc_card *card, int num, int order)
...
@@ -1333,7 +1335,7 @@ static int soc_probe_link_dais(struct snd_soc_card *card, int num, int order)
struct
snd_soc_dapm_widget
*
play_w
,
*
capture_w
;
struct
snd_soc_dapm_widget
*
play_w
,
*
capture_w
;
int
ret
;
int
ret
;
dev_dbg
(
card
->
dev
,
"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
,
num
,
order
);
/* config components */
/* config components */
...
@@ -1359,8 +1361,9 @@ static int soc_probe_link_dais(struct snd_soc_card *card, int num, int order)
...
@@ -1359,8 +1361,9 @@ static int soc_probe_link_dais(struct snd_soc_card *card, int num, int order)
if
(
cpu_dai
->
driver
->
probe
)
{
if
(
cpu_dai
->
driver
->
probe
)
{
ret
=
cpu_dai
->
driver
->
probe
(
cpu_dai
);
ret
=
cpu_dai
->
driver
->
probe
(
cpu_dai
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
pr_err
(
"asoc: failed to probe CPU DAI %s: %d
\n
"
,
dev_err
(
cpu_dai
->
dev
,
cpu_dai
->
name
,
ret
);
"ASoC: failed to probe CPU DAI %s: %d
\n
"
,
cpu_dai
->
name
,
ret
);
module_put
(
cpu_dai
->
dev
->
driver
->
owner
);
module_put
(
cpu_dai
->
dev
->
driver
->
owner
);
return
ret
;
return
ret
;
}
}
...
@@ -1375,8 +1378,9 @@ static int soc_probe_link_dais(struct snd_soc_card *card, int num, int order)
...
@@ -1375,8 +1378,9 @@ static int soc_probe_link_dais(struct snd_soc_card *card, int num, int order)
if
(
codec_dai
->
driver
->
probe
)
{
if
(
codec_dai
->
driver
->
probe
)
{
ret
=
codec_dai
->
driver
->
probe
(
codec_dai
);
ret
=
codec_dai
->
driver
->
probe
(
codec_dai
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
pr_err
(
"asoc: failed to probe CODEC DAI %s: %d
\n
"
,
dev_err
(
codec_dai
->
dev
,
codec_dai
->
name
,
ret
);
"ASoC: failed to probe CODEC DAI %s: %d
\n
"
,
codec_dai
->
name
,
ret
);
return
ret
;
return
ret
;
}
}
}
}
...
@@ -1396,13 +1400,14 @@ static int soc_probe_link_dais(struct snd_soc_card *card, int num, int order)
...
@@ -1396,13 +1400,14 @@ static int soc_probe_link_dais(struct snd_soc_card *card, int num, int order)
ret
=
device_create_file
(
rtd
->
dev
,
&
dev_attr_pmdown_time
);
ret
=
device_create_file
(
rtd
->
dev
,
&
dev_attr_pmdown_time
);
if
(
ret
<
0
)
if
(
ret
<
0
)
pr_warn
(
"asoc: failed to add pmdown_time sysfs:%d
\n
"
,
ret
);
dev_warn
(
rtd
->
dev
,
"ASoC: failed to add pmdown_time sysfs: %d
\n
"
,
ret
);
if
(
cpu_dai
->
driver
->
compress_dai
)
{
if
(
cpu_dai
->
driver
->
compress_dai
)
{
/*create compress_device"*/
/*create compress_device"*/
ret
=
soc_new_compress
(
rtd
,
num
);
ret
=
soc_new_compress
(
rtd
,
num
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
pr_err
(
"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
);
return
ret
;
return
ret
;
}
}
...
@@ -1412,7 +1417,7 @@ static int soc_probe_link_dais(struct snd_soc_card *card, int num, int order)
...
@@ -1412,7 +1417,7 @@ static int soc_probe_link_dais(struct snd_soc_card *card, int num, int order)
/* create the pcm */
/* create the pcm */
ret
=
soc_new_pcm
(
rtd
,
num
);
ret
=
soc_new_pcm
(
rtd
,
num
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
pr_err
(
"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
);
return
ret
;
return
ret
;
}
}
...
@@ -1424,7 +1429,7 @@ static int soc_probe_link_dais(struct snd_soc_card *card, int num, int order)
...
@@ -1424,7 +1429,7 @@ static int soc_probe_link_dais(struct snd_soc_card *card, int num, int order)
ret
=
snd_soc_dapm_new_pcm
(
card
,
dai_link
->
params
,
ret
=
snd_soc_dapm_new_pcm
(
card
,
dai_link
->
params
,
capture_w
,
play_w
);
capture_w
,
play_w
);
if
(
ret
!=
0
)
{
if
(
ret
!=
0
)
{
dev_err
(
card
->
dev
,
"Can't link %s to %s: %d
\n
"
,
dev_err
(
card
->
dev
,
"
ASoC:
Can't link %s to %s: %d
\n
"
,
play_w
->
name
,
capture_w
->
name
,
ret
);
play_w
->
name
,
capture_w
->
name
,
ret
);
return
ret
;
return
ret
;
}
}
...
@@ -1436,7 +1441,7 @@ static int soc_probe_link_dais(struct snd_soc_card *card, int num, int order)
...
@@ -1436,7 +1441,7 @@ static int soc_probe_link_dais(struct snd_soc_card *card, int num, int order)
ret
=
snd_soc_dapm_new_pcm
(
card
,
dai_link
->
params
,
ret
=
snd_soc_dapm_new_pcm
(
card
,
dai_link
->
params
,
capture_w
,
play_w
);
capture_w
,
play_w
);
if
(
ret
!=
0
)
{
if
(
ret
!=
0
)
{
dev_err
(
card
->
dev
,
"Can't link %s to %s: %d
\n
"
,
dev_err
(
card
->
dev
,
"
ASoC:
Can't link %s to %s: %d
\n
"
,
play_w
->
name
,
capture_w
->
name
,
ret
);
play_w
->
name
,
capture_w
->
name
,
ret
);
return
ret
;
return
ret
;
}
}
...
@@ -1473,7 +1478,8 @@ static int soc_register_ac97_dai_link(struct snd_soc_pcm_runtime *rtd)
...
@@ -1473,7 +1478,8 @@ static int soc_register_ac97_dai_link(struct snd_soc_pcm_runtime *rtd)
ret
=
soc_ac97_dev_register
(
rtd
->
codec
);
ret
=
soc_ac97_dev_register
(
rtd
->
codec
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
pr_err
(
"asoc: AC97 device register failed:%d
\n
"
,
ret
);
dev_err
(
rtd
->
codec
->
dev
,
"ASoC: AC97 device register failed: %d
\n
"
,
ret
);
return
ret
;
return
ret
;
}
}
...
@@ -1502,7 +1508,7 @@ static int soc_check_aux_dev(struct snd_soc_card *card, int num)
...
@@ -1502,7 +1508,7 @@ static int soc_check_aux_dev(struct snd_soc_card *card, int num)
return
0
;
return
0
;
}
}
dev_err
(
card
->
dev
,
"%s not registered
\n
"
,
aux_dev
->
codec_name
);
dev_err
(
card
->
dev
,
"
ASoC:
%s not registered
\n
"
,
aux_dev
->
codec_name
);
return
-
EPROBE_DEFER
;
return
-
EPROBE_DEFER
;
}
}
...
@@ -1518,7 +1524,7 @@ static int soc_probe_aux_dev(struct snd_soc_card *card, int num)
...
@@ -1518,7 +1524,7 @@ static int soc_probe_aux_dev(struct snd_soc_card *card, int num)
if
(
!
strcmp
(
codec
->
name
,
aux_dev
->
codec_name
))
{
if
(
!
strcmp
(
codec
->
name
,
aux_dev
->
codec_name
))
{
if
(
codec
->
probed
)
{
if
(
codec
->
probed
)
{
dev_err
(
codec
->
dev
,
dev_err
(
codec
->
dev
,
"
asoc
: codec already probed"
);
"
ASoC
: codec already probed"
);
ret
=
-
EBUSY
;
ret
=
-
EBUSY
;
goto
out
;
goto
out
;
}
}
...
@@ -1526,7 +1532,7 @@ static int soc_probe_aux_dev(struct snd_soc_card *card, int num)
...
@@ -1526,7 +1532,7 @@ static int soc_probe_aux_dev(struct snd_soc_card *card, int num)
}
}
}
}
/* codec not found */
/* codec not found */
dev_err
(
card
->
dev
,
"
asoc
: codec %s not found"
,
aux_dev
->
codec_name
);
dev_err
(
card
->
dev
,
"
ASoC
: codec %s not found"
,
aux_dev
->
codec_name
);
return
-
EPROBE_DEFER
;
return
-
EPROBE_DEFER
;
found:
found:
...
@@ -1569,8 +1575,8 @@ static int snd_soc_init_codec_cache(struct snd_soc_codec *codec,
...
@@ -1569,8 +1575,8 @@ 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
,
"
Failed to set cache compression type: %d
\n
"
,
dev_err
(
codec
->
dev
,
"
ASoC: Failed to set cache compression"
ret
);
" type: %d
\n
"
,
ret
);
return
ret
;
return
ret
;
}
}
codec
->
cache_init
=
1
;
codec
->
cache_init
=
1
;
...
@@ -1626,8 +1632,8 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
...
@@ -1626,8 +1632,8 @@ 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
)
{
pr_err
(
"asoc: can't create sound card for card %s: %d
\n
"
,
dev_err
(
card
->
dev
,
"ASoC: can't create sound card for"
card
->
name
,
ret
);
" 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
;
...
@@ -1663,8 +1669,9 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
...
@@ -1663,8 +1669,9 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
for
(
i
=
0
;
i
<
card
->
num_links
;
i
++
)
{
for
(
i
=
0
;
i
<
card
->
num_links
;
i
++
)
{
ret
=
soc_probe_link_components
(
card
,
i
,
order
);
ret
=
soc_probe_link_components
(
card
,
i
,
order
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
pr_err
(
"asoc: failed to instantiate card %s: %d
\n
"
,
dev_err
(
card
->
dev
,
card
->
name
,
ret
);
"ASoC: failed to instantiate card %d
\n
"
,
ret
);
goto
probe_dai_err
;
goto
probe_dai_err
;
}
}
}
}
...
@@ -1676,8 +1683,9 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
...
@@ -1676,8 +1683,9 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
for
(
i
=
0
;
i
<
card
->
num_links
;
i
++
)
{
for
(
i
=
0
;
i
<
card
->
num_links
;
i
++
)
{
ret
=
soc_probe_link_dais
(
card
,
i
,
order
);
ret
=
soc_probe_link_dais
(
card
,
i
,
order
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
pr_err
(
"asoc: failed to instantiate card %s: %d
\n
"
,
dev_err
(
card
->
dev
,
card
->
name
,
ret
);
"ASoC: failed to instantiate card %d
\n
"
,
ret
);
goto
probe_dai_err
;
goto
probe_dai_err
;
}
}
}
}
...
@@ -1686,8 +1694,9 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
...
@@ -1686,8 +1694,9 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
for
(
i
=
0
;
i
<
card
->
num_aux_devs
;
i
++
)
{
for
(
i
=
0
;
i
<
card
->
num_aux_devs
;
i
++
)
{
ret
=
soc_probe_aux_dev
(
card
,
i
);
ret
=
soc_probe_aux_dev
(
card
,
i
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
pr_err
(
"asoc: failed to add auxiliary devices %s: %d
\n
"
,
dev_err
(
card
->
dev
,
card
->
name
,
ret
);
"ASoC: failed to add auxiliary devices %d
\n
"
,
ret
);
goto
probe_aux_dev_err
;
goto
probe_aux_dev_err
;
}
}
}
}
...
@@ -1712,7 +1721,7 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
...
@@ -1712,7 +1721,7 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
dai_fmt
);
dai_fmt
);
if
(
ret
!=
0
&&
ret
!=
-
ENOTSUPP
)
if
(
ret
!=
0
&&
ret
!=
-
ENOTSUPP
)
dev_warn
(
card
->
rtd
[
i
].
codec_dai
->
dev
,
dev_warn
(
card
->
rtd
[
i
].
codec_dai
->
dev
,
"Failed to set DAI format: %d
\n
"
,
"
ASoC:
Failed to set DAI format: %d
\n
"
,
ret
);
ret
);
}
}
...
@@ -1723,7 +1732,7 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
...
@@ -1723,7 +1732,7 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
dai_fmt
);
dai_fmt
);
if
(
ret
!=
0
&&
ret
!=
-
ENOTSUPP
)
if
(
ret
!=
0
&&
ret
!=
-
ENOTSUPP
)
dev_warn
(
card
->
rtd
[
i
].
cpu_dai
->
dev
,
dev_warn
(
card
->
rtd
[
i
].
cpu_dai
->
dev
,
"Failed to set DAI format: %d
\n
"
,
"
ASoC:
Failed to set DAI format: %d
\n
"
,
ret
);
ret
);
}
else
if
(
dai_fmt
)
{
}
else
if
(
dai_fmt
)
{
/* Flip the polarity for the "CPU" end */
/* Flip the polarity for the "CPU" end */
...
@@ -1748,7 +1757,7 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
...
@@ -1748,7 +1757,7 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
dai_fmt
);
dai_fmt
);
if
(
ret
!=
0
&&
ret
!=
-
ENOTSUPP
)
if
(
ret
!=
0
&&
ret
!=
-
ENOTSUPP
)
dev_warn
(
card
->
rtd
[
i
].
cpu_dai
->
dev
,
dev_warn
(
card
->
rtd
[
i
].
cpu_dai
->
dev
,
"Failed to set DAI format: %d
\n
"
,
"
ASoC:
Failed to set DAI format: %d
\n
"
,
ret
);
ret
);
}
}
}
}
...
@@ -1775,7 +1784,7 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
...
@@ -1775,7 +1784,7 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
if
(
card
->
late_probe
)
{
if
(
card
->
late_probe
)
{
ret
=
card
->
late_probe
(
card
);
ret
=
card
->
late_probe
(
card
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
dev_err
(
card
->
dev
,
"%s late_probe() failed: %d
\n
"
,
dev_err
(
card
->
dev
,
"
ASoC:
%s late_probe() failed: %d
\n
"
,
card
->
name
,
ret
);
card
->
name
,
ret
);
goto
probe_aux_dev_err
;
goto
probe_aux_dev_err
;
}
}
...
@@ -1789,8 +1798,8 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
...
@@ -1789,8 +1798,8 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
ret
=
snd_card_register
(
card
->
snd_card
);
ret
=
snd_card_register
(
card
->
snd_card
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
pr_err
(
"asoc: failed to register soundcard for %s:
%d
\n
"
,
dev_err
(
card
->
dev
,
"ASoC: failed to register soundcard
%d
\n
"
,
card
->
name
,
ret
);
ret
);
goto
probe_aux_dev_err
;
goto
probe_aux_dev_err
;
}
}
...
@@ -1799,8 +1808,8 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
...
@@ -1799,8 +1808,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
)
{
pr_err
(
"asoc: failed to register AC97 %s: %d
\n
"
,
dev_err
(
card
->
dev
,
"ASoC: failed to register AC97:"
card
->
name
,
ret
);
" %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
;
...
@@ -1846,7 +1855,7 @@ static int soc_probe(struct platform_device *pdev)
...
@@ -1846,7 +1855,7 @@ static int soc_probe(struct platform_device *pdev)
return
-
EINVAL
;
return
-
EINVAL
;
dev_warn
(
&
pdev
->
dev
,
dev_warn
(
&
pdev
->
dev
,
"ASoC machine %s should use snd_soc_register_card()
\n
"
,
"ASoC
:
machine %s should use snd_soc_register_card()
\n
"
,
card
->
name
);
card
->
name
);
/* Bodge while we unpick instantiation */
/* Bodge while we unpick instantiation */
...
@@ -1996,7 +2005,7 @@ int snd_soc_platform_read(struct snd_soc_platform *platform,
...
@@ -1996,7 +2005,7 @@ int snd_soc_platform_read(struct snd_soc_platform *platform,
unsigned
int
ret
;
unsigned
int
ret
;
if
(
!
platform
->
driver
->
read
)
{
if
(
!
platform
->
driver
->
read
)
{
dev_err
(
platform
->
dev
,
"platform has no read back
\n
"
);
dev_err
(
platform
->
dev
,
"
ASoC:
platform has no read back
\n
"
);
return
-
1
;
return
-
1
;
}
}
...
@@ -2012,7 +2021,7 @@ int snd_soc_platform_write(struct snd_soc_platform *platform,
...
@@ -2012,7 +2021,7 @@ int snd_soc_platform_write(struct snd_soc_platform *platform,
unsigned
int
reg
,
unsigned
int
val
)
unsigned
int
reg
,
unsigned
int
val
)
{
{
if
(
!
platform
->
driver
->
write
)
{
if
(
!
platform
->
driver
->
write
)
{
dev_err
(
platform
->
dev
,
"platform has no write back
\n
"
);
dev_err
(
platform
->
dev
,
"
ASoC:
platform has no write back
\n
"
);
return
-
1
;
return
-
1
;
}
}
...
@@ -2283,7 +2292,8 @@ static int snd_soc_add_controls(struct snd_card *card, struct device *dev,
...
@@ -2283,7 +2292,8 @@ static int snd_soc_add_controls(struct snd_card *card, struct device *dev,
err
=
snd_ctl_add
(
card
,
snd_soc_cnew
(
control
,
data
,
err
=
snd_ctl_add
(
card
,
snd_soc_cnew
(
control
,
data
,
control
->
name
,
prefix
));
control
->
name
,
prefix
));
if
(
err
<
0
)
{
if
(
err
<
0
)
{
dev_err
(
dev
,
"Failed to add %s: %d
\n
"
,
control
->
name
,
err
);
dev_err
(
dev
,
"ASoC: Failed to add %s: %d
\n
"
,
control
->
name
,
err
);
return
err
;
return
err
;
}
}
}
}
...
@@ -3534,15 +3544,14 @@ int snd_soc_register_card(struct snd_soc_card *card)
...
@@ -3534,15 +3544,14 @@ 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
,
dev_err
(
card
->
dev
,
"ASoC: Neither/both codec"
"Neither/both codec name/of_node are set for %s
\n
"
,
" name/of_node are set for %s
\n
"
,
link
->
name
);
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
,
"
codec_dai_name not set for %s
\n
"
,
dev_err
(
card
->
dev
,
"
ASoC: codec_dai_name not"
link
->
name
);
" set for %s
\n
"
,
link
->
name
);
return
-
EINVAL
;
return
-
EINVAL
;
}
}
...
@@ -3551,8 +3560,8 @@ int snd_soc_register_card(struct snd_soc_card *card)
...
@@ -3551,8 +3560,8 @@ 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
,
dev_err
(
card
->
dev
,
"ASoC: Both platform name/of_node"
"
Both platform name/of_node
are set for %s
\n
"
,
link
->
name
);
" are set for %s
\n
"
,
link
->
name
);
return
-
EINVAL
;
return
-
EINVAL
;
}
}
...
@@ -3562,9 +3571,8 @@ int snd_soc_register_card(struct snd_soc_card *card)
...
@@ -3562,9 +3571,8 @@ 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
,
dev_err
(
card
->
dev
,
"ASoC: Neither/both "
"Neither/both cpu name/of_node are set for %s
\n
"
,
"cpu name/of_node are set for %s
\n
"
,
link
->
name
);
link
->
name
);
return
-
EINVAL
;
return
-
EINVAL
;
}
}
/*
/*
...
@@ -3573,9 +3581,8 @@ int snd_soc_register_card(struct snd_soc_card *card)
...
@@ -3573,9 +3581,8 @@ 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
,
dev_err
(
card
->
dev
,
"ASoC: Neither cpu_dai_name nor "
"Neither cpu_dai_name nor cpu_name/of_node are set for %s
\n
"
,
"cpu_name/of_node are set for %s
\n
"
,
link
->
name
);
link
->
name
);
return
-
EINVAL
;
return
-
EINVAL
;
}
}
}
}
...
@@ -3622,7 +3629,7 @@ int snd_soc_unregister_card(struct snd_soc_card *card)
...
@@ -3622,7 +3629,7 @@ int snd_soc_unregister_card(struct snd_soc_card *card)
{
{
if
(
card
->
instantiated
)
if
(
card
->
instantiated
)
soc_cleanup_card_resources
(
card
);
soc_cleanup_card_resources
(
card
);
dev_dbg
(
card
->
dev
,
"Unregistered card '%s'
\n
"
,
card
->
name
);
dev_dbg
(
card
->
dev
,
"
ASoC:
Unregistered card '%s'
\n
"
,
card
->
name
);
return
0
;
return
0
;
}
}
...
@@ -3679,8 +3686,8 @@ static inline char *fmt_multiple_name(struct device *dev,
...
@@ -3679,8 +3686,8 @@ 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
)
{
pr_err
(
"asoc: error - multiple DAI %s registered with no name
\n
"
,
dev_err
(
dev
,
"ASoC: error - multiple DAI %s registered with"
dev_name
(
dev
));
" no name
\n
"
,
dev_name
(
dev
));
return
NULL
;
return
NULL
;
}
}
...
@@ -3698,7 +3705,7 @@ int snd_soc_register_dai(struct device *dev,
...
@@ -3698,7 +3705,7 @@ int snd_soc_register_dai(struct device *dev,
struct
snd_soc_codec
*
codec
;
struct
snd_soc_codec
*
codec
;
struct
snd_soc_dai
*
dai
;
struct
snd_soc_dai
*
dai
;
dev_dbg
(
dev
,
"dai register %s
\n
"
,
dev_name
(
dev
));
dev_dbg
(
dev
,
"
ASoC:
dai register %s
\n
"
,
dev_name
(
dev
));
dai
=
kzalloc
(
sizeof
(
struct
snd_soc_dai
),
GFP_KERNEL
);
dai
=
kzalloc
(
sizeof
(
struct
snd_soc_dai
),
GFP_KERNEL
);
if
(
dai
==
NULL
)
if
(
dai
==
NULL
)
...
@@ -3721,7 +3728,7 @@ int snd_soc_register_dai(struct device *dev,
...
@@ -3721,7 +3728,7 @@ int snd_soc_register_dai(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
,
"Mapped DAI %s to CODEC %s
\n
"
,
dev_dbg
(
dev
,
"
ASoC:
Mapped DAI %s to CODEC %s
\n
"
,
dai
->
name
,
codec
->
name
);
dai
->
name
,
codec
->
name
);
dai
->
codec
=
codec
;
dai
->
codec
=
codec
;
break
;
break
;
...
@@ -3735,7 +3742,7 @@ int snd_soc_register_dai(struct device *dev,
...
@@ -3735,7 +3742,7 @@ int snd_soc_register_dai(struct device *dev,
mutex_unlock
(
&
client_mutex
);
mutex_unlock
(
&
client_mutex
);
pr_debug
(
"
Registered DAI '%s'
\n
"
,
dai
->
name
);
dev_dbg
(
dev
,
"ASoC:
Registered DAI '%s'
\n
"
,
dai
->
name
);
return
0
;
return
0
;
}
}
...
@@ -3761,7 +3768,7 @@ void snd_soc_unregister_dai(struct device *dev)
...
@@ -3761,7 +3768,7 @@ void snd_soc_unregister_dai(struct device *dev)
list_del
(
&
dai
->
list
);
list_del
(
&
dai
->
list
);
mutex_unlock
(
&
client_mutex
);
mutex_unlock
(
&
client_mutex
);
pr_debug
(
"
Unregistered DAI '%s'
\n
"
,
dai
->
name
);
dev_dbg
(
dev
,
"ASoC:
Unregistered DAI '%s'
\n
"
,
dai
->
name
);
kfree
(
dai
->
name
);
kfree
(
dai
->
name
);
kfree
(
dai
);
kfree
(
dai
);
}
}
...
@@ -3780,7 +3787,7 @@ int snd_soc_register_dais(struct device *dev,
...
@@ -3780,7 +3787,7 @@ int snd_soc_register_dais(struct device *dev,
struct
snd_soc_dai
*
dai
;
struct
snd_soc_dai
*
dai
;
int
i
,
ret
=
0
;
int
i
,
ret
=
0
;
dev_dbg
(
dev
,
"dai register %s #%Zu
\n
"
,
dev_name
(
dev
),
count
);
dev_dbg
(
dev
,
"
ASoC:
dai register %s #%Zu
\n
"
,
dev_name
(
dev
),
count
);
for
(
i
=
0
;
i
<
count
;
i
++
)
{
for
(
i
=
0
;
i
<
count
;
i
++
)
{
...
@@ -3812,8 +3819,8 @@ int snd_soc_register_dais(struct device *dev,
...
@@ -3812,8 +3819,8 @@ 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
,
"
Mapped DAI %s to CODEC %s
\n
"
,
dev_dbg
(
dev
,
"
ASoC: Mapped DAI %s to "
dai
->
name
,
codec
->
name
);
"CODEC %s
\n
"
,
dai
->
name
,
codec
->
name
);
dai
->
codec
=
codec
;
dai
->
codec
=
codec
;
break
;
break
;
}
}
...
@@ -3826,7 +3833,7 @@ int snd_soc_register_dais(struct device *dev,
...
@@ -3826,7 +3833,7 @@ int snd_soc_register_dais(struct device *dev,
mutex_unlock
(
&
client_mutex
);
mutex_unlock
(
&
client_mutex
);
pr_debug
(
"
Registered DAI '%s'
\n
"
,
dai
->
name
);
dev_dbg
(
dai
->
dev
,
"ASoC:
Registered DAI '%s'
\n
"
,
dai
->
name
);
}
}
return
0
;
return
0
;
...
@@ -3864,7 +3871,7 @@ int snd_soc_register_platform(struct device *dev,
...
@@ -3864,7 +3871,7 @@ int snd_soc_register_platform(struct device *dev,
{
{
struct
snd_soc_platform
*
platform
;
struct
snd_soc_platform
*
platform
;
dev_dbg
(
dev
,
"platform register %s
\n
"
,
dev_name
(
dev
));
dev_dbg
(
dev
,
"
ASoC:
platform register %s
\n
"
,
dev_name
(
dev
));
platform
=
kzalloc
(
sizeof
(
struct
snd_soc_platform
),
GFP_KERNEL
);
platform
=
kzalloc
(
sizeof
(
struct
snd_soc_platform
),
GFP_KERNEL
);
if
(
platform
==
NULL
)
if
(
platform
==
NULL
)
...
@@ -3888,7 +3895,7 @@ int snd_soc_register_platform(struct device *dev,
...
@@ -3888,7 +3895,7 @@ int snd_soc_register_platform(struct device *dev,
list_add
(
&
platform
->
list
,
&
platform_list
);
list_add
(
&
platform
->
list
,
&
platform_list
);
mutex_unlock
(
&
client_mutex
);
mutex_unlock
(
&
client_mutex
);
pr_debug
(
"
Registered platform '%s'
\n
"
,
platform
->
name
);
dev_dbg
(
dev
,
"ASoC:
Registered platform '%s'
\n
"
,
platform
->
name
);
return
0
;
return
0
;
}
}
...
@@ -3914,7 +3921,7 @@ void snd_soc_unregister_platform(struct device *dev)
...
@@ -3914,7 +3921,7 @@ void snd_soc_unregister_platform(struct device *dev)
list_del
(
&
platform
->
list
);
list_del
(
&
platform
->
list
);
mutex_unlock
(
&
client_mutex
);
mutex_unlock
(
&
client_mutex
);
pr_debug
(
"
Unregistered platform '%s'
\n
"
,
platform
->
name
);
dev_dbg
(
dev
,
"ASoC:
Unregistered platform '%s'
\n
"
,
platform
->
name
);
kfree
(
platform
->
name
);
kfree
(
platform
->
name
);
kfree
(
platform
);
kfree
(
platform
);
}
}
...
@@ -4043,11 +4050,11 @@ int snd_soc_register_codec(struct device *dev,
...
@@ -4043,11 +4050,11 @@ int snd_soc_register_codec(struct device *dev,
if
(
num_dai
)
{
if
(
num_dai
)
{
ret
=
snd_soc_register_dais
(
dev
,
dai_drv
,
num_dai
);
ret
=
snd_soc_register_dais
(
dev
,
dai_drv
,
num_dai
);
if
(
ret
<
0
)
if
(
ret
<
0
)
dev_err
(
codec
->
dev
,
"
Failed to regster DAIs: %d
\n
"
,
dev_err
(
codec
->
dev
,
"
ASoC: Failed to regster"
ret
);
" DAIs: %d
\n
"
,
ret
);
}
}
pr_debug
(
"
Registered codec '%s'
\n
"
,
codec
->
name
);
dev_dbg
(
codec
->
dev
,
"ASoC:
Registered codec '%s'
\n
"
,
codec
->
name
);
return
0
;
return
0
;
fail:
fail:
...
@@ -4082,7 +4089,7 @@ void snd_soc_unregister_codec(struct device *dev)
...
@@ -4082,7 +4089,7 @@ void snd_soc_unregister_codec(struct device *dev)
list_del
(
&
codec
->
list
);
list_del
(
&
codec
->
list
);
mutex_unlock
(
&
client_mutex
);
mutex_unlock
(
&
client_mutex
);
pr_debug
(
"
Unregistered codec '%s'
\n
"
,
codec
->
name
);
dev_dbg
(
codec
->
dev
,
"ASoC:
Unregistered codec '%s'
\n
"
,
codec
->
name
);
snd_soc_cache_exit
(
codec
);
snd_soc_cache_exit
(
codec
);
kfree
(
codec
->
reg_def_copy
);
kfree
(
codec
->
reg_def_copy
);
...
@@ -4106,7 +4113,7 @@ int snd_soc_of_parse_card_name(struct snd_soc_card *card,
...
@@ -4106,7 +4113,7 @@ int snd_soc_of_parse_card_name(struct snd_soc_card *card,
*/
*/
if
(
ret
<
0
&&
ret
!=
-
EINVAL
)
{
if
(
ret
<
0
&&
ret
!=
-
EINVAL
)
{
dev_err
(
card
->
dev
,
dev_err
(
card
->
dev
,
"Property '%s' could not be read: %d
\n
"
,
"
ASoC:
Property '%s' could not be read: %d
\n
"
,
propname
,
ret
);
propname
,
ret
);
return
ret
;
return
ret
;
}
}
...
@@ -4125,15 +4132,13 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
...
@@ -4125,15 +4132,13 @@ 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
,
dev_err
(
card
->
dev
,
"ASoC: Property '%s' does not exist or its"
"Property '%s' does not exist or its length is not even
\n
"
,
" length is not even
\n
"
,
propname
);
propname
);
return
-
EINVAL
;
return
-
EINVAL
;
}
}
num_routes
/=
2
;
num_routes
/=
2
;
if
(
!
num_routes
)
{
if
(
!
num_routes
)
{
dev_err
(
card
->
dev
,
dev_err
(
card
->
dev
,
"ASoC: Property '%s's length is zero
\n
"
,
"Property '%s's length is zero
\n
"
,
propname
);
propname
);
return
-
EINVAL
;
return
-
EINVAL
;
}
}
...
@@ -4142,7 +4147,7 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
...
@@ -4142,7 +4147,7 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
GFP_KERNEL
);
GFP_KERNEL
);
if
(
!
routes
)
{
if
(
!
routes
)
{
dev_err
(
card
->
dev
,
dev_err
(
card
->
dev
,
"Could not allocate DAPM route table
\n
"
);
"
ASoC:
Could not allocate DAPM route table
\n
"
);
return
-
EINVAL
;
return
-
EINVAL
;
}
}
...
@@ -4150,9 +4155,9 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
...
@@ -4150,9 +4155,9 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
ret
=
of_property_read_string_index
(
np
,
propname
,
ret
=
of_property_read_string_index
(
np
,
propname
,
2
*
i
,
&
routes
[
i
].
sink
);
2
*
i
,
&
routes
[
i
].
sink
);
if
(
ret
)
{
if
(
ret
)
{
dev_err
(
card
->
dev
,
dev_err
(
card
->
dev
,
"ASoC: Property '%s' index %d"
"
Property '%s' index %d could not be read: %d
\n
"
,
"
could not be read: %d
\n
"
,
propname
,
2
*
i
,
propname
,
2
*
i
,
ret
);
ret
);
kfree
(
routes
);
kfree
(
routes
);
return
-
EINVAL
;
return
-
EINVAL
;
}
}
...
@@ -4160,8 +4165,8 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
...
@@ -4160,8 +4165,8 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
(
2
*
i
)
+
1
,
&
routes
[
i
].
source
);
(
2
*
i
)
+
1
,
&
routes
[
i
].
source
);
if
(
ret
)
{
if
(
ret
)
{
dev_err
(
card
->
dev
,
dev_err
(
card
->
dev
,
"
Property '%s' index %d could not be read: %d
\n
"
,
"
ASoC: Property '%s' index %d could not be"
propname
,
(
2
*
i
)
+
1
,
ret
);
" read: %d
\n
"
,
propname
,
(
2
*
i
)
+
1
,
ret
);
kfree
(
routes
);
kfree
(
routes
);
return
-
EINVAL
;
return
-
EINVAL
;
}
}
...
...
sound/soc/soc-dapm.c
View file @
674b3663
...
@@ -220,7 +220,7 @@ static int soc_widget_read(struct snd_soc_dapm_widget *w, int reg)
...
@@ -220,7 +220,7 @@ static int soc_widget_read(struct snd_soc_dapm_widget *w, int reg)
else
if
(
w
->
platform
)
else
if
(
w
->
platform
)
return
snd_soc_platform_read
(
w
->
platform
,
reg
);
return
snd_soc_platform_read
(
w
->
platform
,
reg
);
dev_err
(
w
->
dapm
->
dev
,
"no valid widget read method
\n
"
);
dev_err
(
w
->
dapm
->
dev
,
"
ASoC:
no valid widget read method
\n
"
);
return
-
1
;
return
-
1
;
}
}
...
@@ -231,7 +231,7 @@ static int soc_widget_write(struct snd_soc_dapm_widget *w, int reg, int val)
...
@@ -231,7 +231,7 @@ static int soc_widget_write(struct snd_soc_dapm_widget *w, int reg, int val)
else
if
(
w
->
platform
)
else
if
(
w
->
platform
)
return
snd_soc_platform_write
(
w
->
platform
,
reg
,
val
);
return
snd_soc_platform_write
(
w
->
platform
,
reg
,
val
);
dev_err
(
w
->
dapm
->
dev
,
"no valid widget write method
\n
"
);
dev_err
(
w
->
dapm
->
dev
,
"
ASoC:
no valid widget write method
\n
"
);
return
-
1
;
return
-
1
;
}
}
...
@@ -546,7 +546,7 @@ static int dapm_new_mixer(struct snd_soc_dapm_widget *w)
...
@@ -546,7 +546,7 @@ static int dapm_new_mixer(struct snd_soc_dapm_widget *w)
wlist
=
kzalloc
(
wlistsize
,
GFP_KERNEL
);
wlist
=
kzalloc
(
wlistsize
,
GFP_KERNEL
);
if
(
wlist
==
NULL
)
{
if
(
wlist
==
NULL
)
{
dev_err
(
dapm
->
dev
,
dev_err
(
dapm
->
dev
,
"
asoc
: can't allocate widget list for %s
\n
"
,
"
ASoC
: can't allocate widget list for %s
\n
"
,
w
->
name
);
w
->
name
);
return
-
ENOMEM
;
return
-
ENOMEM
;
}
}
...
@@ -595,9 +595,9 @@ static int dapm_new_mixer(struct snd_soc_dapm_widget *w)
...
@@ -595,9 +595,9 @@ static int dapm_new_mixer(struct snd_soc_dapm_widget *w)
prefix
);
prefix
);
ret
=
snd_ctl_add
(
card
,
path
->
kcontrol
);
ret
=
snd_ctl_add
(
card
,
path
->
kcontrol
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
dev_err
(
dapm
->
dev
,
dev_err
(
dapm
->
dev
,
"ASoC: failed to add widget"
"
asoc: failed to add
dapm kcontrol %s: %d
\n
"
,
"
%s
dapm kcontrol %s: %d
\n
"
,
path
->
long_name
,
ret
);
w
->
name
,
path
->
long_name
,
ret
);
kfree
(
wlist
);
kfree
(
wlist
);
kfree
(
path
->
long_name
);
kfree
(
path
->
long_name
);
path
->
long_name
=
NULL
;
path
->
long_name
=
NULL
;
...
@@ -626,7 +626,7 @@ static int dapm_new_mux(struct snd_soc_dapm_widget *w)
...
@@ -626,7 +626,7 @@ static int dapm_new_mux(struct snd_soc_dapm_widget *w)
if
(
w
->
num_kcontrols
!=
1
)
{
if
(
w
->
num_kcontrols
!=
1
)
{
dev_err
(
dapm
->
dev
,
dev_err
(
dapm
->
dev
,
"
asoc
: mux %s has incorrect number of controls
\n
"
,
"
ASoC
: mux %s has incorrect number of controls
\n
"
,
w
->
name
);
w
->
name
);
return
-
EINVAL
;
return
-
EINVAL
;
}
}
...
@@ -645,7 +645,7 @@ static int dapm_new_mux(struct snd_soc_dapm_widget *w)
...
@@ -645,7 +645,7 @@ static int dapm_new_mux(struct snd_soc_dapm_widget *w)
wlist
=
krealloc
(
wlist
,
wlistsize
,
GFP_KERNEL
);
wlist
=
krealloc
(
wlist
,
wlistsize
,
GFP_KERNEL
);
if
(
wlist
==
NULL
)
{
if
(
wlist
==
NULL
)
{
dev_err
(
dapm
->
dev
,
dev_err
(
dapm
->
dev
,
"
asoc
: can't allocate widget list for %s
\n
"
,
w
->
name
);
"
ASoC
: can't allocate widget list for %s
\n
"
,
w
->
name
);
return
-
ENOMEM
;
return
-
ENOMEM
;
}
}
wlist
->
num_widgets
=
wlistentries
;
wlist
->
num_widgets
=
wlistentries
;
...
@@ -677,7 +677,7 @@ static int dapm_new_mux(struct snd_soc_dapm_widget *w)
...
@@ -677,7 +677,7 @@ static int dapm_new_mux(struct snd_soc_dapm_widget *w)
name
+
prefix_len
,
prefix
);
name
+
prefix_len
,
prefix
);
ret
=
snd_ctl_add
(
card
,
kcontrol
);
ret
=
snd_ctl_add
(
card
,
kcontrol
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
dev_err
(
dapm
->
dev
,
"failed to add kcontrol %s: %d
\n
"
,
dev_err
(
dapm
->
dev
,
"
ASoC:
failed to add kcontrol %s: %d
\n
"
,
w
->
name
,
ret
);
w
->
name
,
ret
);
kfree
(
wlist
);
kfree
(
wlist
);
return
ret
;
return
ret
;
...
@@ -699,7 +699,7 @@ static int dapm_new_pga(struct snd_soc_dapm_widget *w)
...
@@ -699,7 +699,7 @@ static int dapm_new_pga(struct snd_soc_dapm_widget *w)
{
{
if
(
w
->
num_kcontrols
)
if
(
w
->
num_kcontrols
)
dev_err
(
w
->
dapm
->
dev
,
dev_err
(
w
->
dapm
->
dev
,
"
asoc
: PGA controls not supported: '%s'
\n
"
,
w
->
name
);
"
ASoC
: PGA controls not supported: '%s'
\n
"
,
w
->
name
);
return
0
;
return
0
;
}
}
...
@@ -725,7 +725,7 @@ static int snd_soc_dapm_suspend_check(struct snd_soc_dapm_widget *widget)
...
@@ -725,7 +725,7 @@ static int snd_soc_dapm_suspend_check(struct snd_soc_dapm_widget *widget)
case
SNDRV_CTL_POWER_D3hot
:
case
SNDRV_CTL_POWER_D3hot
:
case
SNDRV_CTL_POWER_D3cold
:
case
SNDRV_CTL_POWER_D3cold
:
if
(
widget
->
ignore_suspend
)
if
(
widget
->
ignore_suspend
)
dev_dbg
(
widget
->
dapm
->
dev
,
"%s ignoring suspend
\n
"
,
dev_dbg
(
widget
->
dapm
->
dev
,
"
ASoC:
%s ignoring suspend
\n
"
,
widget
->
name
);
widget
->
name
);
return
widget
->
ignore_suspend
;
return
widget
->
ignore_suspend
;
default:
default:
...
@@ -757,14 +757,14 @@ static int dapm_list_add_widget(struct snd_soc_dapm_widget_list **list,
...
@@ -757,14 +757,14 @@ static int dapm_list_add_widget(struct snd_soc_dapm_widget_list **list,
wlistentries
*
sizeof
(
struct
snd_soc_dapm_widget
*
);
wlistentries
*
sizeof
(
struct
snd_soc_dapm_widget
*
);
*
list
=
krealloc
(
wlist
,
wlistsize
,
GFP_KERNEL
);
*
list
=
krealloc
(
wlist
,
wlistsize
,
GFP_KERNEL
);
if
(
*
list
==
NULL
)
{
if
(
*
list
==
NULL
)
{
dev_err
(
w
->
dapm
->
dev
,
"can't allocate widget list for %s
\n
"
,
dev_err
(
w
->
dapm
->
dev
,
"
ASoC:
can't allocate widget list for %s
\n
"
,
w
->
name
);
w
->
name
);
return
-
ENOMEM
;
return
-
ENOMEM
;
}
}
wlist
=
*
list
;
wlist
=
*
list
;
/* insert the widget */
/* insert the widget */
dev_dbg
(
w
->
dapm
->
dev
,
"added %s in widget list pos %d
\n
"
,
dev_dbg
(
w
->
dapm
->
dev
,
"
ASoC:
added %s in widget list pos %d
\n
"
,
w
->
name
,
wlist
->
num_widgets
);
w
->
name
,
wlist
->
num_widgets
);
wlist
->
widgets
[
wlist
->
num_widgets
]
=
w
;
wlist
->
widgets
[
wlist
->
num_widgets
]
=
w
;
...
@@ -844,7 +844,8 @@ static int is_connected_output_ep(struct snd_soc_dapm_widget *widget,
...
@@ -844,7 +844,8 @@ static int is_connected_output_ep(struct snd_soc_dapm_widget *widget,
int
err
;
int
err
;
err
=
dapm_list_add_widget
(
list
,
path
->
sink
);
err
=
dapm_list_add_widget
(
list
,
path
->
sink
);
if
(
err
<
0
)
{
if
(
err
<
0
)
{
dev_err
(
widget
->
dapm
->
dev
,
"could not add widget %s
\n
"
,
dev_err
(
widget
->
dapm
->
dev
,
"ASoC: could not add widget %s
\n
"
,
widget
->
name
);
widget
->
name
);
return
con
;
return
con
;
}
}
...
@@ -943,7 +944,8 @@ static int is_connected_input_ep(struct snd_soc_dapm_widget *widget,
...
@@ -943,7 +944,8 @@ static int is_connected_input_ep(struct snd_soc_dapm_widget *widget,
int
err
;
int
err
;
err
=
dapm_list_add_widget
(
list
,
path
->
source
);
err
=
dapm_list_add_widget
(
list
,
path
->
source
);
if
(
err
<
0
)
{
if
(
err
<
0
)
{
dev_err
(
widget
->
dapm
->
dev
,
"could not add widget %s
\n
"
,
dev_err
(
widget
->
dapm
->
dev
,
"ASoC: could not add widget %s
\n
"
,
widget
->
name
);
widget
->
name
);
return
con
;
return
con
;
}
}
...
@@ -1024,7 +1026,7 @@ int dapm_regulator_event(struct snd_soc_dapm_widget *w,
...
@@ -1024,7 +1026,7 @@ int dapm_regulator_event(struct snd_soc_dapm_widget *w,
ret
=
regulator_allow_bypass
(
w
->
regulator
,
true
);
ret
=
regulator_allow_bypass
(
w
->
regulator
,
true
);
if
(
ret
!=
0
)
if
(
ret
!=
0
)
dev_warn
(
w
->
dapm
->
dev
,
dev_warn
(
w
->
dapm
->
dev
,
"Failed to bypass %s: %d
\n
"
,
"
ASoC:
Failed to bypass %s: %d
\n
"
,
w
->
name
,
ret
);
w
->
name
,
ret
);
}
}
...
@@ -1034,7 +1036,7 @@ int dapm_regulator_event(struct snd_soc_dapm_widget *w,
...
@@ -1034,7 +1036,7 @@ int dapm_regulator_event(struct snd_soc_dapm_widget *w,
ret
=
regulator_allow_bypass
(
w
->
regulator
,
false
);
ret
=
regulator_allow_bypass
(
w
->
regulator
,
false
);
if
(
ret
!=
0
)
if
(
ret
!=
0
)
dev_warn
(
w
->
dapm
->
dev
,
dev_warn
(
w
->
dapm
->
dev
,
"Failed to unbypass %s: %d
\n
"
,
"
ASoC:
Failed to unbypass %s: %d
\n
"
,
w
->
name
,
ret
);
w
->
name
,
ret
);
}
}
...
@@ -1253,7 +1255,7 @@ static void dapm_seq_check_event(struct snd_soc_dapm_context *dapm,
...
@@ -1253,7 +1255,7 @@ static void dapm_seq_check_event(struct snd_soc_dapm_context *dapm,
ret
=
w
->
event
(
w
,
NULL
,
event
);
ret
=
w
->
event
(
w
,
NULL
,
event
);
trace_snd_soc_dapm_widget_event_done
(
w
,
event
);
trace_snd_soc_dapm_widget_event_done
(
w
,
event
);
if
(
ret
<
0
)
if
(
ret
<
0
)
pr_err
(
"
%s: %s event failed: %d
\n
"
,
dev_err
(
dapm
->
dev
,
"ASoC:
%s: %s event failed: %d
\n
"
,
ev_name
,
w
->
name
,
ret
);
ev_name
,
w
->
name
,
ret
);
}
}
}
}
...
@@ -1402,7 +1404,7 @@ static void dapm_seq_run(struct snd_soc_dapm_context *dapm,
...
@@ -1402,7 +1404,7 @@ static void dapm_seq_run(struct snd_soc_dapm_context *dapm,
if
(
ret
<
0
)
if
(
ret
<
0
)
dev_err
(
w
->
dapm
->
dev
,
dev_err
(
w
->
dapm
->
dev
,
"Failed to apply widget power: %d
\n
"
,
ret
);
"
ASoC:
Failed to apply widget power: %d
\n
"
,
ret
);
}
}
if
(
!
list_empty
(
&
pending
))
if
(
!
list_empty
(
&
pending
))
...
@@ -1431,20 +1433,21 @@ static void dapm_widget_update(struct snd_soc_dapm_context *dapm)
...
@@ -1431,20 +1433,21 @@ static void dapm_widget_update(struct snd_soc_dapm_context *dapm)
(
w
->
event_flags
&
SND_SOC_DAPM_PRE_REG
))
{
(
w
->
event_flags
&
SND_SOC_DAPM_PRE_REG
))
{
ret
=
w
->
event
(
w
,
update
->
kcontrol
,
SND_SOC_DAPM_PRE_REG
);
ret
=
w
->
event
(
w
,
update
->
kcontrol
,
SND_SOC_DAPM_PRE_REG
);
if
(
ret
!=
0
)
if
(
ret
!=
0
)
pr_err
(
"
%s DAPM pre-event failed: %d
\n
"
,
dev_err
(
dapm
->
dev
,
"ASoC:
%s DAPM pre-event failed: %d
\n
"
,
w
->
name
,
ret
);
w
->
name
,
ret
);
}
}
ret
=
soc_widget_update_bits_locked
(
w
,
update
->
reg
,
update
->
mask
,
ret
=
soc_widget_update_bits_locked
(
w
,
update
->
reg
,
update
->
mask
,
update
->
val
);
update
->
val
);
if
(
ret
<
0
)
if
(
ret
<
0
)
pr_err
(
"%s DAPM update failed: %d
\n
"
,
w
->
name
,
ret
);
dev_err
(
dapm
->
dev
,
"ASoC: %s DAPM update failed: %d
\n
"
,
w
->
name
,
ret
);
if
(
w
->
event
&&
if
(
w
->
event
&&
(
w
->
event_flags
&
SND_SOC_DAPM_POST_REG
))
{
(
w
->
event_flags
&
SND_SOC_DAPM_POST_REG
))
{
ret
=
w
->
event
(
w
,
update
->
kcontrol
,
SND_SOC_DAPM_POST_REG
);
ret
=
w
->
event
(
w
,
update
->
kcontrol
,
SND_SOC_DAPM_POST_REG
);
if
(
ret
!=
0
)
if
(
ret
!=
0
)
pr_err
(
"
%s DAPM post-event failed: %d
\n
"
,
dev_err
(
dapm
->
dev
,
"ASoC:
%s DAPM post-event failed: %d
\n
"
,
w
->
name
,
ret
);
w
->
name
,
ret
);
}
}
}
}
...
@@ -1466,7 +1469,7 @@ static void dapm_pre_sequence_async(void *data, async_cookie_t cookie)
...
@@ -1466,7 +1469,7 @@ static void dapm_pre_sequence_async(void *data, async_cookie_t cookie)
ret
=
snd_soc_dapm_set_bias_level
(
d
,
SND_SOC_BIAS_STANDBY
);
ret
=
snd_soc_dapm_set_bias_level
(
d
,
SND_SOC_BIAS_STANDBY
);
if
(
ret
!=
0
)
if
(
ret
!=
0
)
dev_err
(
d
->
dev
,
dev_err
(
d
->
dev
,
"Failed to turn on bias: %d
\n
"
,
ret
);
"
ASoC:
Failed to turn on bias: %d
\n
"
,
ret
);
}
}
/* Prepare for a STADDBY->ON or ON->STANDBY transition */
/* Prepare for a STADDBY->ON or ON->STANDBY transition */
...
@@ -1474,7 +1477,7 @@ static void dapm_pre_sequence_async(void *data, async_cookie_t cookie)
...
@@ -1474,7 +1477,7 @@ static void dapm_pre_sequence_async(void *data, async_cookie_t cookie)
ret
=
snd_soc_dapm_set_bias_level
(
d
,
SND_SOC_BIAS_PREPARE
);
ret
=
snd_soc_dapm_set_bias_level
(
d
,
SND_SOC_BIAS_PREPARE
);
if
(
ret
!=
0
)
if
(
ret
!=
0
)
dev_err
(
d
->
dev
,
dev_err
(
d
->
dev
,
"Failed to prepare bias: %d
\n
"
,
ret
);
"
ASoC:
Failed to prepare bias: %d
\n
"
,
ret
);
}
}
}
}
...
@@ -1492,7 +1495,7 @@ static void dapm_post_sequence_async(void *data, async_cookie_t cookie)
...
@@ -1492,7 +1495,7 @@ static void dapm_post_sequence_async(void *data, async_cookie_t cookie)
d
->
target_bias_level
==
SND_SOC_BIAS_OFF
))
{
d
->
target_bias_level
==
SND_SOC_BIAS_OFF
))
{
ret
=
snd_soc_dapm_set_bias_level
(
d
,
SND_SOC_BIAS_STANDBY
);
ret
=
snd_soc_dapm_set_bias_level
(
d
,
SND_SOC_BIAS_STANDBY
);
if
(
ret
!=
0
)
if
(
ret
!=
0
)
dev_err
(
d
->
dev
,
"Failed to apply standby bias: %d
\n
"
,
dev_err
(
d
->
dev
,
"
ASoC:
Failed to apply standby bias: %d
\n
"
,
ret
);
ret
);
}
}
...
@@ -1501,7 +1504,8 @@ static void dapm_post_sequence_async(void *data, async_cookie_t cookie)
...
@@ -1501,7 +1504,8 @@ static void dapm_post_sequence_async(void *data, async_cookie_t cookie)
d
->
target_bias_level
==
SND_SOC_BIAS_OFF
)
{
d
->
target_bias_level
==
SND_SOC_BIAS_OFF
)
{
ret
=
snd_soc_dapm_set_bias_level
(
d
,
SND_SOC_BIAS_OFF
);
ret
=
snd_soc_dapm_set_bias_level
(
d
,
SND_SOC_BIAS_OFF
);
if
(
ret
!=
0
)
if
(
ret
!=
0
)
dev_err
(
d
->
dev
,
"Failed to turn off bias: %d
\n
"
,
ret
);
dev_err
(
d
->
dev
,
"ASoC: Failed to turn off bias: %d
\n
"
,
ret
);
if
(
d
->
dev
)
if
(
d
->
dev
)
pm_runtime_put
(
d
->
dev
);
pm_runtime_put
(
d
->
dev
);
...
@@ -1512,7 +1516,7 @@ static void dapm_post_sequence_async(void *data, async_cookie_t cookie)
...
@@ -1512,7 +1516,7 @@ static void dapm_post_sequence_async(void *data, async_cookie_t cookie)
d
->
target_bias_level
==
SND_SOC_BIAS_ON
)
{
d
->
target_bias_level
==
SND_SOC_BIAS_ON
)
{
ret
=
snd_soc_dapm_set_bias_level
(
d
,
SND_SOC_BIAS_ON
);
ret
=
snd_soc_dapm_set_bias_level
(
d
,
SND_SOC_BIAS_ON
);
if
(
ret
!=
0
)
if
(
ret
!=
0
)
dev_err
(
d
->
dev
,
"Failed to apply active bias: %d
\n
"
,
dev_err
(
d
->
dev
,
"
ASoC:
Failed to apply active bias: %d
\n
"
,
ret
);
ret
);
}
}
}
}
...
@@ -1838,7 +1842,7 @@ void snd_soc_dapm_debugfs_init(struct snd_soc_dapm_context *dapm,
...
@@ -1838,7 +1842,7 @@ void snd_soc_dapm_debugfs_init(struct snd_soc_dapm_context *dapm,
if
(
!
dapm
->
debugfs_dapm
)
{
if
(
!
dapm
->
debugfs_dapm
)
{
dev_warn
(
dapm
->
dev
,
dev_warn
(
dapm
->
dev
,
"Failed to create DAPM debugfs directory
\n
"
);
"
ASoC:
Failed to create DAPM debugfs directory
\n
"
);
return
;
return
;
}
}
...
@@ -2123,7 +2127,7 @@ static int snd_soc_dapm_set_pin(struct snd_soc_dapm_context *dapm,
...
@@ -2123,7 +2127,7 @@ static int snd_soc_dapm_set_pin(struct snd_soc_dapm_context *dapm,
struct
snd_soc_dapm_widget
*
w
=
dapm_find_widget
(
dapm
,
pin
,
true
);
struct
snd_soc_dapm_widget
*
w
=
dapm_find_widget
(
dapm
,
pin
,
true
);
if
(
!
w
)
{
if
(
!
w
)
{
dev_err
(
dapm
->
dev
,
"
dapm:
unknown pin %s
\n
"
,
pin
);
dev_err
(
dapm
->
dev
,
"
ASoC: DAPM
unknown pin %s
\n
"
,
pin
);
return
-
EINVAL
;
return
-
EINVAL
;
}
}
...
@@ -2212,8 +2216,16 @@ static int snd_soc_dapm_add_route(struct snd_soc_dapm_context *dapm,
...
@@ -2212,8 +2216,16 @@ static int snd_soc_dapm_add_route(struct snd_soc_dapm_context *dapm,
if
(
!
wsource
)
if
(
!
wsource
)
wsource
=
wtsource
;
wsource
=
wtsource
;
if
(
wsource
==
NULL
||
wsink
==
NULL
)
if
(
wsource
==
NULL
)
{
dev_err
(
dapm
->
dev
,
"ASoC: no source widget found for %s
\n
"
,
route
->
source
);
return
-
ENODEV
;
return
-
ENODEV
;
}
if
(
wsink
==
NULL
)
{
dev_err
(
dapm
->
dev
,
"ASoC: no sink widget found for %s
\n
"
,
route
->
sink
);
return
-
ENODEV
;
}
path
=
kzalloc
(
sizeof
(
struct
snd_soc_dapm_path
),
GFP_KERNEL
);
path
=
kzalloc
(
sizeof
(
struct
snd_soc_dapm_path
),
GFP_KERNEL
);
if
(
!
path
)
if
(
!
path
)
...
@@ -2308,7 +2320,7 @@ static int snd_soc_dapm_add_route(struct snd_soc_dapm_context *dapm,
...
@@ -2308,7 +2320,7 @@ static int snd_soc_dapm_add_route(struct snd_soc_dapm_context *dapm,
return
0
;
return
0
;
err:
err:
dev_warn
(
dapm
->
dev
,
"
asoc
: no dapm match for %s --> %s --> %s
\n
"
,
dev_warn
(
dapm
->
dev
,
"
ASoC
: no dapm match for %s --> %s --> %s
\n
"
,
source
,
control
,
sink
);
source
,
control
,
sink
);
kfree
(
path
);
kfree
(
path
);
return
ret
;
return
ret
;
...
@@ -2325,7 +2337,7 @@ static int snd_soc_dapm_del_route(struct snd_soc_dapm_context *dapm,
...
@@ -2325,7 +2337,7 @@ static int snd_soc_dapm_del_route(struct snd_soc_dapm_context *dapm,
if
(
route
->
control
)
{
if
(
route
->
control
)
{
dev_err
(
dapm
->
dev
,
dev_err
(
dapm
->
dev
,
"Removal of routes with controls not supported
\n
"
);
"
ASoC:
Removal of routes with controls not supported
\n
"
);
return
-
EINVAL
;
return
-
EINVAL
;
}
}
...
@@ -2360,7 +2372,7 @@ static int snd_soc_dapm_del_route(struct snd_soc_dapm_context *dapm,
...
@@ -2360,7 +2372,7 @@ static int snd_soc_dapm_del_route(struct snd_soc_dapm_context *dapm,
list_del
(
&
path
->
list_source
);
list_del
(
&
path
->
list_source
);
kfree
(
path
);
kfree
(
path
);
}
else
{
}
else
{
dev_warn
(
dapm
->
dev
,
"Route %s->%s does not exist
\n
"
,
dev_warn
(
dapm
->
dev
,
"
ASoC:
Route %s->%s does not exist
\n
"
,
source
,
sink
);
source
,
sink
);
}
}
...
@@ -2389,8 +2401,10 @@ int snd_soc_dapm_add_routes(struct snd_soc_dapm_context *dapm,
...
@@ -2389,8 +2401,10 @@ int snd_soc_dapm_add_routes(struct snd_soc_dapm_context *dapm,
for
(
i
=
0
;
i
<
num
;
i
++
)
{
for
(
i
=
0
;
i
<
num
;
i
++
)
{
r
=
snd_soc_dapm_add_route
(
dapm
,
route
);
r
=
snd_soc_dapm_add_route
(
dapm
,
route
);
if
(
r
<
0
)
{
if
(
r
<
0
)
{
dev_err
(
dapm
->
dev
,
"Failed to add route %s->%s
\n
"
,
dev_err
(
dapm
->
dev
,
"ASoC: Failed to add route %s -> %s -> %s
\n
"
,
route
->
source
,
route
->
sink
);
route
->
source
,
route
->
control
?
route
->
control
:
"direct"
,
route
->
sink
);
ret
=
r
;
ret
=
r
;
}
}
route
++
;
route
++
;
...
@@ -2438,19 +2452,19 @@ static int snd_soc_dapm_weak_route(struct snd_soc_dapm_context *dapm,
...
@@ -2438,19 +2452,19 @@ static int snd_soc_dapm_weak_route(struct snd_soc_dapm_context *dapm,
int
count
=
0
;
int
count
=
0
;
if
(
!
source
)
{
if
(
!
source
)
{
dev_err
(
dapm
->
dev
,
"Unable to find source %s for weak route
\n
"
,
dev_err
(
dapm
->
dev
,
"
ASoC:
Unable to find source %s for weak route
\n
"
,
route
->
source
);
route
->
source
);
return
-
ENODEV
;
return
-
ENODEV
;
}
}
if
(
!
sink
)
{
if
(
!
sink
)
{
dev_err
(
dapm
->
dev
,
"Unable to find sink %s for weak route
\n
"
,
dev_err
(
dapm
->
dev
,
"
ASoC:
Unable to find sink %s for weak route
\n
"
,
route
->
sink
);
route
->
sink
);
return
-
ENODEV
;
return
-
ENODEV
;
}
}
if
(
route
->
control
||
route
->
connected
)
if
(
route
->
control
||
route
->
connected
)
dev_warn
(
dapm
->
dev
,
"Ignoring control for weak route %s->%s
\n
"
,
dev_warn
(
dapm
->
dev
,
"
ASoC:
Ignoring control for weak route %s->%s
\n
"
,
route
->
source
,
route
->
sink
);
route
->
source
,
route
->
sink
);
list_for_each_entry
(
path
,
&
source
->
sinks
,
list_source
)
{
list_for_each_entry
(
path
,
&
source
->
sinks
,
list_source
)
{
...
@@ -2461,10 +2475,10 @@ static int snd_soc_dapm_weak_route(struct snd_soc_dapm_context *dapm,
...
@@ -2461,10 +2475,10 @@ static int snd_soc_dapm_weak_route(struct snd_soc_dapm_context *dapm,
}
}
if
(
count
==
0
)
if
(
count
==
0
)
dev_err
(
dapm
->
dev
,
"No path found for weak route %s->%s
\n
"
,
dev_err
(
dapm
->
dev
,
"
ASoC:
No path found for weak route %s->%s
\n
"
,
route
->
source
,
route
->
sink
);
route
->
source
,
route
->
sink
);
if
(
count
>
1
)
if
(
count
>
1
)
dev_warn
(
dapm
->
dev
,
"%d paths found for weak route %s->%s
\n
"
,
dev_warn
(
dapm
->
dev
,
"
ASoC:
%d paths found for weak route %s->%s
\n
"
,
count
,
route
->
source
,
route
->
sink
);
count
,
route
->
source
,
route
->
sink
);
return
0
;
return
0
;
...
@@ -2601,7 +2615,7 @@ int snd_soc_dapm_get_volsw(struct snd_kcontrol *kcontrol,
...
@@ -2601,7 +2615,7 @@ int snd_soc_dapm_get_volsw(struct snd_kcontrol *kcontrol,
if
(
snd_soc_volsw_is_stereo
(
mc
))
if
(
snd_soc_volsw_is_stereo
(
mc
))
dev_warn
(
widget
->
dapm
->
dev
,
dev_warn
(
widget
->
dapm
->
dev
,
"Control '%s' is stereo, which is not supported
\n
"
,
"
ASoC:
Control '%s' is stereo, which is not supported
\n
"
,
kcontrol
->
id
.
name
);
kcontrol
->
id
.
name
);
ucontrol
->
value
.
integer
.
value
[
0
]
=
ucontrol
->
value
.
integer
.
value
[
0
]
=
...
@@ -2644,7 +2658,7 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol,
...
@@ -2644,7 +2658,7 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol,
if
(
snd_soc_volsw_is_stereo
(
mc
))
if
(
snd_soc_volsw_is_stereo
(
mc
))
dev_warn
(
widget
->
dapm
->
dev
,
dev_warn
(
widget
->
dapm
->
dev
,
"Control '%s' is stereo, which is not supported
\n
"
,
"
ASoC:
Control '%s' is stereo, which is not supported
\n
"
,
kcontrol
->
id
.
name
);
kcontrol
->
id
.
name
);
val
=
(
ucontrol
->
value
.
integer
.
value
[
0
]
&
mask
);
val
=
(
ucontrol
->
value
.
integer
.
value
[
0
]
&
mask
);
...
@@ -3021,7 +3035,7 @@ snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm,
...
@@ -3021,7 +3035,7 @@ snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm,
w
->
regulator
=
devm_regulator_get
(
dapm
->
dev
,
w
->
name
);
w
->
regulator
=
devm_regulator_get
(
dapm
->
dev
,
w
->
name
);
if
(
IS_ERR
(
w
->
regulator
))
{
if
(
IS_ERR
(
w
->
regulator
))
{
ret
=
PTR_ERR
(
w
->
regulator
);
ret
=
PTR_ERR
(
w
->
regulator
);
dev_err
(
dapm
->
dev
,
"Failed to request %s: %d
\n
"
,
dev_err
(
dapm
->
dev
,
"
ASoC:
Failed to request %s: %d
\n
"
,
w
->
name
,
ret
);
w
->
name
,
ret
);
return
NULL
;
return
NULL
;
}
}
...
@@ -3031,7 +3045,7 @@ snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm,
...
@@ -3031,7 +3045,7 @@ snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm,
w
->
clk
=
devm_clk_get
(
dapm
->
dev
,
w
->
name
);
w
->
clk
=
devm_clk_get
(
dapm
->
dev
,
w
->
name
);
if
(
IS_ERR
(
w
->
clk
))
{
if
(
IS_ERR
(
w
->
clk
))
{
ret
=
PTR_ERR
(
w
->
clk
);
ret
=
PTR_ERR
(
w
->
clk
);
dev_err
(
dapm
->
dev
,
"Failed to request %s: %d
\n
"
,
dev_err
(
dapm
->
dev
,
"
ASoC:
Failed to request %s: %d
\n
"
,
w
->
name
,
ret
);
w
->
name
,
ret
);
return
NULL
;
return
NULL
;
}
}
...
@@ -3182,7 +3196,7 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w,
...
@@ -3182,7 +3196,7 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w,
if
(
config
->
formats
)
{
if
(
config
->
formats
)
{
fmt
=
ffs
(
config
->
formats
)
-
1
;
fmt
=
ffs
(
config
->
formats
)
-
1
;
}
else
{
}
else
{
dev_warn
(
w
->
dapm
->
dev
,
"Invalid format %llx specified
\n
"
,
dev_warn
(
w
->
dapm
->
dev
,
"
ASoC:
Invalid format %llx specified
\n
"
,
config
->
formats
);
config
->
formats
);
fmt
=
0
;
fmt
=
0
;
}
}
...
@@ -3215,7 +3229,7 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w,
...
@@ -3215,7 +3229,7 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w,
params
,
source
);
params
,
source
);
if
(
ret
!=
0
)
{
if
(
ret
!=
0
)
{
dev_err
(
source
->
dev
,
dev_err
(
source
->
dev
,
"hw_params() failed: %d
\n
"
,
ret
);
"
ASoC:
hw_params() failed: %d
\n
"
,
ret
);
goto
out
;
goto
out
;
}
}
}
}
...
@@ -3226,7 +3240,7 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w,
...
@@ -3226,7 +3240,7 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w,
sink
);
sink
);
if
(
ret
!=
0
)
{
if
(
ret
!=
0
)
{
dev_err
(
sink
->
dev
,
dev_err
(
sink
->
dev
,
"hw_params() failed: %d
\n
"
,
ret
);
"
ASoC:
hw_params() failed: %d
\n
"
,
ret
);
goto
out
;
goto
out
;
}
}
}
}
...
@@ -3235,14 +3249,14 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w,
...
@@ -3235,14 +3249,14 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w,
case
SND_SOC_DAPM_POST_PMU
:
case
SND_SOC_DAPM_POST_PMU
:
ret
=
snd_soc_dai_digital_mute
(
sink
,
0
);
ret
=
snd_soc_dai_digital_mute
(
sink
,
0
);
if
(
ret
!=
0
&&
ret
!=
-
ENOTSUPP
)
if
(
ret
!=
0
&&
ret
!=
-
ENOTSUPP
)
dev_warn
(
sink
->
dev
,
"Failed to unmute: %d
\n
"
,
ret
);
dev_warn
(
sink
->
dev
,
"
ASoC:
Failed to unmute: %d
\n
"
,
ret
);
ret
=
0
;
ret
=
0
;
break
;
break
;
case
SND_SOC_DAPM_PRE_PMD
:
case
SND_SOC_DAPM_PRE_PMD
:
ret
=
snd_soc_dai_digital_mute
(
sink
,
1
);
ret
=
snd_soc_dai_digital_mute
(
sink
,
1
);
if
(
ret
!=
0
&&
ret
!=
-
ENOTSUPP
)
if
(
ret
!=
0
&&
ret
!=
-
ENOTSUPP
)
dev_warn
(
sink
->
dev
,
"Failed to mute: %d
\n
"
,
ret
);
dev_warn
(
sink
->
dev
,
"
ASoC:
Failed to mute: %d
\n
"
,
ret
);
ret
=
0
;
ret
=
0
;
break
;
break
;
...
@@ -3281,11 +3295,11 @@ int snd_soc_dapm_new_pcm(struct snd_soc_card *card,
...
@@ -3281,11 +3295,11 @@ int snd_soc_dapm_new_pcm(struct snd_soc_card *card,
template
.
event_flags
=
SND_SOC_DAPM_PRE_PMU
|
SND_SOC_DAPM_POST_PMU
|
template
.
event_flags
=
SND_SOC_DAPM_PRE_PMU
|
SND_SOC_DAPM_POST_PMU
|
SND_SOC_DAPM_PRE_PMD
;
SND_SOC_DAPM_PRE_PMD
;
dev_dbg
(
card
->
dev
,
"adding %s widget
\n
"
,
link_name
);
dev_dbg
(
card
->
dev
,
"
ASoC:
adding %s widget
\n
"
,
link_name
);
w
=
snd_soc_dapm_new_control
(
&
card
->
dapm
,
&
template
);
w
=
snd_soc_dapm_new_control
(
&
card
->
dapm
,
&
template
);
if
(
!
w
)
{
if
(
!
w
)
{
dev_err
(
card
->
dev
,
"Failed to create %s widget
\n
"
,
dev_err
(
card
->
dev
,
"
ASoC:
Failed to create %s widget
\n
"
,
link_name
);
link_name
);
return
-
ENOMEM
;
return
-
ENOMEM
;
}
}
...
@@ -3319,12 +3333,12 @@ int snd_soc_dapm_new_dai_widgets(struct snd_soc_dapm_context *dapm,
...
@@ -3319,12 +3333,12 @@ int snd_soc_dapm_new_dai_widgets(struct snd_soc_dapm_context *dapm,
template
.
name
=
dai
->
driver
->
playback
.
stream_name
;
template
.
name
=
dai
->
driver
->
playback
.
stream_name
;
template
.
sname
=
dai
->
driver
->
playback
.
stream_name
;
template
.
sname
=
dai
->
driver
->
playback
.
stream_name
;
dev_dbg
(
dai
->
dev
,
"adding %s widget
\n
"
,
dev_dbg
(
dai
->
dev
,
"
ASoC:
adding %s widget
\n
"
,
template
.
name
);
template
.
name
);
w
=
snd_soc_dapm_new_control
(
dapm
,
&
template
);
w
=
snd_soc_dapm_new_control
(
dapm
,
&
template
);
if
(
!
w
)
{
if
(
!
w
)
{
dev_err
(
dapm
->
dev
,
"Failed to create %s widget
\n
"
,
dev_err
(
dapm
->
dev
,
"
ASoC:
Failed to create %s widget
\n
"
,
dai
->
driver
->
playback
.
stream_name
);
dai
->
driver
->
playback
.
stream_name
);
}
}
...
@@ -3337,12 +3351,12 @@ int snd_soc_dapm_new_dai_widgets(struct snd_soc_dapm_context *dapm,
...
@@ -3337,12 +3351,12 @@ int snd_soc_dapm_new_dai_widgets(struct snd_soc_dapm_context *dapm,
template
.
name
=
dai
->
driver
->
capture
.
stream_name
;
template
.
name
=
dai
->
driver
->
capture
.
stream_name
;
template
.
sname
=
dai
->
driver
->
capture
.
stream_name
;
template
.
sname
=
dai
->
driver
->
capture
.
stream_name
;
dev_dbg
(
dai
->
dev
,
"adding %s widget
\n
"
,
dev_dbg
(
dai
->
dev
,
"
ASoC:
adding %s widget
\n
"
,
template
.
name
);
template
.
name
);
w
=
snd_soc_dapm_new_control
(
dapm
,
&
template
);
w
=
snd_soc_dapm_new_control
(
dapm
,
&
template
);
if
(
!
w
)
{
if
(
!
w
)
{
dev_err
(
dapm
->
dev
,
"Failed to create %s widget
\n
"
,
dev_err
(
dapm
->
dev
,
"
ASoC:
Failed to create %s widget
\n
"
,
dai
->
driver
->
capture
.
stream_name
);
dai
->
driver
->
capture
.
stream_name
);
}
}
...
@@ -3518,11 +3532,11 @@ int snd_soc_dapm_force_enable_pin(struct snd_soc_dapm_context *dapm,
...
@@ -3518,11 +3532,11 @@ int snd_soc_dapm_force_enable_pin(struct snd_soc_dapm_context *dapm,
struct
snd_soc_dapm_widget
*
w
=
dapm_find_widget
(
dapm
,
pin
,
true
);
struct
snd_soc_dapm_widget
*
w
=
dapm_find_widget
(
dapm
,
pin
,
true
);
if
(
!
w
)
{
if
(
!
w
)
{
dev_err
(
dapm
->
dev
,
"
dapm
: unknown pin %s
\n
"
,
pin
);
dev_err
(
dapm
->
dev
,
"
ASoC
: unknown pin %s
\n
"
,
pin
);
return
-
EINVAL
;
return
-
EINVAL
;
}
}
dev_dbg
(
w
->
dapm
->
dev
,
"
dapm
: force enable pin %s
\n
"
,
pin
);
dev_dbg
(
w
->
dapm
->
dev
,
"
ASoC
: force enable pin %s
\n
"
,
pin
);
w
->
connected
=
1
;
w
->
connected
=
1
;
w
->
force
=
1
;
w
->
force
=
1
;
dapm_mark_dirty
(
w
,
"force enable"
);
dapm_mark_dirty
(
w
,
"force enable"
);
...
@@ -3605,7 +3619,7 @@ int snd_soc_dapm_ignore_suspend(struct snd_soc_dapm_context *dapm,
...
@@ -3605,7 +3619,7 @@ int snd_soc_dapm_ignore_suspend(struct snd_soc_dapm_context *dapm,
struct
snd_soc_dapm_widget
*
w
=
dapm_find_widget
(
dapm
,
pin
,
false
);
struct
snd_soc_dapm_widget
*
w
=
dapm_find_widget
(
dapm
,
pin
,
false
);
if
(
!
w
)
{
if
(
!
w
)
{
dev_err
(
dapm
->
dev
,
"
dapm
: unknown pin %s
\n
"
,
pin
);
dev_err
(
dapm
->
dev
,
"
ASoC
: unknown pin %s
\n
"
,
pin
);
return
-
EINVAL
;
return
-
EINVAL
;
}
}
...
@@ -3664,7 +3678,7 @@ void snd_soc_dapm_auto_nc_codec_pins(struct snd_soc_codec *codec)
...
@@ -3664,7 +3678,7 @@ void snd_soc_dapm_auto_nc_codec_pins(struct snd_soc_codec *codec)
struct
snd_soc_dapm_context
*
dapm
=
&
codec
->
dapm
;
struct
snd_soc_dapm_context
*
dapm
=
&
codec
->
dapm
;
struct
snd_soc_dapm_widget
*
w
;
struct
snd_soc_dapm_widget
*
w
;
dev_dbg
(
codec
->
dev
,
"Auto NC: DAPMs: card:%p codec:%p
\n
"
,
dev_dbg
(
codec
->
dev
,
"A
SoC: A
uto NC: DAPMs: card:%p codec:%p
\n
"
,
&
card
->
dapm
,
&
codec
->
dapm
);
&
card
->
dapm
,
&
codec
->
dapm
);
list_for_each_entry
(
w
,
&
card
->
widgets
,
list
)
{
list_for_each_entry
(
w
,
&
card
->
widgets
,
list
)
{
...
@@ -3674,7 +3688,7 @@ void snd_soc_dapm_auto_nc_codec_pins(struct snd_soc_codec *codec)
...
@@ -3674,7 +3688,7 @@ void snd_soc_dapm_auto_nc_codec_pins(struct snd_soc_codec *codec)
case
snd_soc_dapm_input
:
case
snd_soc_dapm_input
:
case
snd_soc_dapm_output
:
case
snd_soc_dapm_output
:
case
snd_soc_dapm_micbias
:
case
snd_soc_dapm_micbias
:
dev_dbg
(
codec
->
dev
,
"Auto NC: Checking widget %s
\n
"
,
dev_dbg
(
codec
->
dev
,
"A
SoC: A
uto NC: Checking widget %s
\n
"
,
w
->
name
);
w
->
name
);
if
(
!
snd_soc_dapm_widget_in_card_paths
(
card
,
w
))
{
if
(
!
snd_soc_dapm_widget_in_card_paths
(
card
,
w
))
{
dev_dbg
(
codec
->
dev
,
dev_dbg
(
codec
->
dev
,
...
...
sound/soc/soc-jack.c
View file @
674b3663
...
@@ -169,12 +169,13 @@ int snd_soc_jack_add_pins(struct snd_soc_jack *jack, int count,
...
@@ -169,12 +169,13 @@ int snd_soc_jack_add_pins(struct snd_soc_jack *jack, int count,
for
(
i
=
0
;
i
<
count
;
i
++
)
{
for
(
i
=
0
;
i
<
count
;
i
++
)
{
if
(
!
pins
[
i
].
pin
)
{
if
(
!
pins
[
i
].
pin
)
{
printk
(
KERN_ERR
"No name for pin %d
\n
"
,
i
);
dev_err
(
jack
->
codec
->
dev
,
"ASoC: No name for pin %d
\n
"
,
i
);
return
-
EINVAL
;
return
-
EINVAL
;
}
}
if
(
!
pins
[
i
].
mask
)
{
if
(
!
pins
[
i
].
mask
)
{
printk
(
KERN_ERR
"No mask for pin %d (%s)
\n
"
,
i
,
dev_err
(
jack
->
codec
->
dev
,
"ASoC: No mask for pin %d"
pins
[
i
].
pin
);
" (%s)
\n
"
,
i
,
pins
[
i
].
pin
);
return
-
EINVAL
;
return
-
EINVAL
;
}
}
...
@@ -294,13 +295,13 @@ int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
...
@@ -294,13 +295,13 @@ int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
for
(
i
=
0
;
i
<
count
;
i
++
)
{
for
(
i
=
0
;
i
<
count
;
i
++
)
{
if
(
!
gpio_is_valid
(
gpios
[
i
].
gpio
))
{
if
(
!
gpio_is_valid
(
gpios
[
i
].
gpio
))
{
printk
(
KERN_ERR
"
Invalid gpio %d
\n
"
,
dev_err
(
jack
->
codec
->
dev
,
"ASoC:
Invalid gpio %d
\n
"
,
gpios
[
i
].
gpio
);
gpios
[
i
].
gpio
);
ret
=
-
EINVAL
;
ret
=
-
EINVAL
;
goto
undo
;
goto
undo
;
}
}
if
(
!
gpios
[
i
].
name
)
{
if
(
!
gpios
[
i
].
name
)
{
printk
(
KERN_ERR
"
No name for gpio %d
\n
"
,
dev_err
(
jack
->
codec
->
dev
,
"ASoC:
No name for gpio %d
\n
"
,
gpios
[
i
].
gpio
);
gpios
[
i
].
gpio
);
ret
=
-
EINVAL
;
ret
=
-
EINVAL
;
goto
undo
;
goto
undo
;
...
@@ -329,7 +330,7 @@ int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
...
@@ -329,7 +330,7 @@ int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
if
(
gpios
[
i
].
wake
)
{
if
(
gpios
[
i
].
wake
)
{
ret
=
irq_set_irq_wake
(
gpio_to_irq
(
gpios
[
i
].
gpio
),
1
);
ret
=
irq_set_irq_wake
(
gpio_to_irq
(
gpios
[
i
].
gpio
),
1
);
if
(
ret
!=
0
)
if
(
ret
!=
0
)
printk
(
KERN_ERR
dev_err
(
jack
->
codec
->
dev
,
"ASoC: "
"Failed to mark GPIO %d as wake source: %d
\n
"
,
"Failed to mark GPIO %d as wake source: %d
\n
"
,
gpios
[
i
].
gpio
,
ret
);
gpios
[
i
].
gpio
,
ret
);
}
}
...
...
sound/soc/soc-pcm.c
View file @
674b3663
...
@@ -43,7 +43,7 @@ static int dpcm_dapm_stream_event(struct snd_soc_pcm_runtime *fe, int dir,
...
@@ -43,7 +43,7 @@ static int dpcm_dapm_stream_event(struct snd_soc_pcm_runtime *fe, int dir,
struct
snd_soc_pcm_runtime
*
be
=
dpcm
->
be
;
struct
snd_soc_pcm_runtime
*
be
=
dpcm
->
be
;
dev_dbg
(
be
->
dev
,
"
pm
: BE %s event %d dir %d
\n
"
,
dev_dbg
(
be
->
dev
,
"
ASoC
: BE %s event %d dir %d
\n
"
,
be
->
dai_link
->
name
,
event
,
dir
);
be
->
dai_link
->
name
,
event
,
dir
);
snd_soc_dapm_stream_event
(
be
,
dir
,
event
);
snd_soc_dapm_stream_event
(
be
,
dir
,
event
);
...
@@ -70,18 +70,19 @@ static int soc_pcm_apply_symmetry(struct snd_pcm_substream *substream,
...
@@ -70,18 +70,19 @@ static int soc_pcm_apply_symmetry(struct snd_pcm_substream *substream,
*/
*/
if
(
!
soc_dai
->
rate
)
{
if
(
!
soc_dai
->
rate
)
{
dev_warn
(
soc_dai
->
dev
,
dev_warn
(
soc_dai
->
dev
,
"Not enforcing symmetric_rates due to race
\n
"
);
"
ASoC:
Not enforcing symmetric_rates due to race
\n
"
);
return
0
;
return
0
;
}
}
dev_dbg
(
soc_dai
->
dev
,
"Symmetry forces %dHz rate
\n
"
,
soc_dai
->
rate
);
dev_dbg
(
soc_dai
->
dev
,
"
ASoC:
Symmetry forces %dHz rate
\n
"
,
soc_dai
->
rate
);
ret
=
snd_pcm_hw_constraint_minmax
(
substream
->
runtime
,
ret
=
snd_pcm_hw_constraint_minmax
(
substream
->
runtime
,
SNDRV_PCM_HW_PARAM_RATE
,
SNDRV_PCM_HW_PARAM_RATE
,
soc_dai
->
rate
,
soc_dai
->
rate
);
soc_dai
->
rate
,
soc_dai
->
rate
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
dev_err
(
soc_dai
->
dev
,
dev_err
(
soc_dai
->
dev
,
"Unable to apply rate symmetry constraint: %d
\n
"
,
ret
);
"ASoC: Unable to apply rate symmetry constraint: %d
\n
"
,
ret
);
return
ret
;
return
ret
;
}
}
...
@@ -118,7 +119,7 @@ static void soc_pcm_apply_msb(struct snd_pcm_substream *substream,
...
@@ -118,7 +119,7 @@ static void soc_pcm_apply_msb(struct snd_pcm_substream *substream,
sample_sizes
[
i
],
bits
);
sample_sizes
[
i
],
bits
);
if
(
ret
!=
0
)
if
(
ret
!=
0
)
dev_warn
(
dai
->
dev
,
dev_warn
(
dai
->
dev
,
"Failed to set MSB %d/%d: %d
\n
"
,
"
ASoC:
Failed to set MSB %d/%d: %d
\n
"
,
bits
,
sample_sizes
[
i
],
ret
);
bits
,
sample_sizes
[
i
],
ret
);
}
}
}
}
...
@@ -149,8 +150,8 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
...
@@ -149,8 +150,8 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
if
(
cpu_dai
->
driver
->
ops
->
startup
)
{
if
(
cpu_dai
->
driver
->
ops
->
startup
)
{
ret
=
cpu_dai
->
driver
->
ops
->
startup
(
substream
,
cpu_dai
);
ret
=
cpu_dai
->
driver
->
ops
->
startup
(
substream
,
cpu_dai
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
dev_err
(
cpu_dai
->
dev
,
"
can't open interface %s: %d
\n
"
,
dev_err
(
cpu_dai
->
dev
,
"
ASoC: can't open interface"
cpu_dai
->
name
,
ret
);
" %s: %d
\n
"
,
cpu_dai
->
name
,
ret
);
goto
out
;
goto
out
;
}
}
}
}
...
@@ -158,8 +159,8 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
...
@@ -158,8 +159,8 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
if
(
platform
->
driver
->
ops
&&
platform
->
driver
->
ops
->
open
)
{
if
(
platform
->
driver
->
ops
&&
platform
->
driver
->
ops
->
open
)
{
ret
=
platform
->
driver
->
ops
->
open
(
substream
);
ret
=
platform
->
driver
->
ops
->
open
(
substream
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
dev_err
(
platform
->
dev
,
"
can't open platform %s: %d
\n
"
,
dev_err
(
platform
->
dev
,
"
ASoC: can't open platform"
platform
->
name
,
ret
);
" %s: %d
\n
"
,
platform
->
name
,
ret
);
goto
platform_err
;
goto
platform_err
;
}
}
}
}
...
@@ -167,8 +168,8 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
...
@@ -167,8 +168,8 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
if
(
codec_dai
->
driver
->
ops
->
startup
)
{
if
(
codec_dai
->
driver
->
ops
->
startup
)
{
ret
=
codec_dai
->
driver
->
ops
->
startup
(
substream
,
codec_dai
);
ret
=
codec_dai
->
driver
->
ops
->
startup
(
substream
,
codec_dai
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
dev_err
(
codec_dai
->
dev
,
"
can't open codec %s: %d
\n
"
,
dev_err
(
codec_dai
->
dev
,
"
ASoC: can't open codec"
codec_dai
->
name
,
ret
);
" %s: %d
\n
"
,
codec_dai
->
name
,
ret
);
goto
codec_dai_err
;
goto
codec_dai_err
;
}
}
}
}
...
@@ -176,7 +177,7 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
...
@@ -176,7 +177,7 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
if
(
rtd
->
dai_link
->
ops
&&
rtd
->
dai_link
->
ops
->
startup
)
{
if
(
rtd
->
dai_link
->
ops
&&
rtd
->
dai_link
->
ops
->
startup
)
{
ret
=
rtd
->
dai_link
->
ops
->
startup
(
substream
);
ret
=
rtd
->
dai_link
->
ops
->
startup
(
substream
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
pr_err
(
"
asoc
: %s startup failed: %d
\n
"
,
pr_err
(
"
ASoC
: %s startup failed: %d
\n
"
,
rtd
->
dai_link
->
name
,
ret
);
rtd
->
dai_link
->
name
,
ret
);
goto
machine_err
;
goto
machine_err
;
}
}
...
@@ -238,18 +239,18 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
...
@@ -238,18 +239,18 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
ret
=
-
EINVAL
;
ret
=
-
EINVAL
;
snd_pcm_limit_hw_rates
(
runtime
);
snd_pcm_limit_hw_rates
(
runtime
);
if
(
!
runtime
->
hw
.
rates
)
{
if
(
!
runtime
->
hw
.
rates
)
{
printk
(
KERN_ERR
"
asoc
: %s <-> %s No matching rates
\n
"
,
printk
(
KERN_ERR
"
ASoC
: %s <-> %s No matching rates
\n
"
,
codec_dai
->
name
,
cpu_dai
->
name
);
codec_dai
->
name
,
cpu_dai
->
name
);
goto
config_err
;
goto
config_err
;
}
}
if
(
!
runtime
->
hw
.
formats
)
{
if
(
!
runtime
->
hw
.
formats
)
{
printk
(
KERN_ERR
"
asoc
: %s <-> %s No matching formats
\n
"
,
printk
(
KERN_ERR
"
ASoC
: %s <-> %s No matching formats
\n
"
,
codec_dai
->
name
,
cpu_dai
->
name
);
codec_dai
->
name
,
cpu_dai
->
name
);
goto
config_err
;
goto
config_err
;
}
}
if
(
!
runtime
->
hw
.
channels_min
||
!
runtime
->
hw
.
channels_max
||
if
(
!
runtime
->
hw
.
channels_min
||
!
runtime
->
hw
.
channels_max
||
runtime
->
hw
.
channels_min
>
runtime
->
hw
.
channels_max
)
{
runtime
->
hw
.
channels_min
>
runtime
->
hw
.
channels_max
)
{
printk
(
KERN_ERR
"
asoc
: %s <-> %s No matching channels
\n
"
,
printk
(
KERN_ERR
"
ASoC
: %s <-> %s No matching channels
\n
"
,
codec_dai
->
name
,
cpu_dai
->
name
);
codec_dai
->
name
,
cpu_dai
->
name
);
goto
config_err
;
goto
config_err
;
}
}
...
@@ -270,12 +271,12 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
...
@@ -270,12 +271,12 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
goto
config_err
;
goto
config_err
;
}
}
pr_debug
(
"
asoc
: %s <-> %s info:
\n
"
,
pr_debug
(
"
ASoC
: %s <-> %s info:
\n
"
,
codec_dai
->
name
,
cpu_dai
->
name
);
codec_dai
->
name
,
cpu_dai
->
name
);
pr_debug
(
"
asoc
: rate mask 0x%x
\n
"
,
runtime
->
hw
.
rates
);
pr_debug
(
"
ASoC
: rate mask 0x%x
\n
"
,
runtime
->
hw
.
rates
);
pr_debug
(
"
asoc
: min ch %d max ch %d
\n
"
,
runtime
->
hw
.
channels_min
,
pr_debug
(
"
ASoC
: min ch %d max ch %d
\n
"
,
runtime
->
hw
.
channels_min
,
runtime
->
hw
.
channels_max
);
runtime
->
hw
.
channels_max
);
pr_debug
(
"
asoc
: min rate %d max rate %d
\n
"
,
runtime
->
hw
.
rate_min
,
pr_debug
(
"
ASoC
: min rate %d max rate %d
\n
"
,
runtime
->
hw
.
rate_min
,
runtime
->
hw
.
rate_max
);
runtime
->
hw
.
rate_max
);
dynamic:
dynamic:
...
@@ -330,7 +331,7 @@ static void close_delayed_work(struct work_struct *work)
...
@@ -330,7 +331,7 @@ static void close_delayed_work(struct work_struct *work)
mutex_lock_nested
(
&
rtd
->
pcm_mutex
,
rtd
->
pcm_subclass
);
mutex_lock_nested
(
&
rtd
->
pcm_mutex
,
rtd
->
pcm_subclass
);
pr_debug
(
"
pop wq checking: %s status: %s waiting: %s
\n
"
,
dev_dbg
(
rtd
->
dev
,
"ASoC:
pop wq checking: %s status: %s waiting: %s
\n
"
,
codec_dai
->
driver
->
playback
.
stream_name
,
codec_dai
->
driver
->
playback
.
stream_name
,
codec_dai
->
playback_active
?
"active"
:
"inactive"
,
codec_dai
->
playback_active
?
"active"
:
"inactive"
,
codec_dai
->
pop_wait
?
"yes"
:
"no"
);
codec_dai
->
pop_wait
?
"yes"
:
"no"
);
...
@@ -444,7 +445,8 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream)
...
@@ -444,7 +445,8 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream)
if
(
rtd
->
dai_link
->
ops
&&
rtd
->
dai_link
->
ops
->
prepare
)
{
if
(
rtd
->
dai_link
->
ops
&&
rtd
->
dai_link
->
ops
->
prepare
)
{
ret
=
rtd
->
dai_link
->
ops
->
prepare
(
substream
);
ret
=
rtd
->
dai_link
->
ops
->
prepare
(
substream
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
pr_err
(
"asoc: machine prepare error: %d
\n
"
,
ret
);
dev_err
(
rtd
->
card
->
dev
,
"ASoC: machine prepare error:"
" %d
\n
"
,
ret
);
goto
out
;
goto
out
;
}
}
}
}
...
@@ -452,8 +454,8 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream)
...
@@ -452,8 +454,8 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream)
if
(
platform
->
driver
->
ops
&&
platform
->
driver
->
ops
->
prepare
)
{
if
(
platform
->
driver
->
ops
&&
platform
->
driver
->
ops
->
prepare
)
{
ret
=
platform
->
driver
->
ops
->
prepare
(
substream
);
ret
=
platform
->
driver
->
ops
->
prepare
(
substream
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
dev_err
(
platform
->
dev
,
"
platform prepare error: %d
\n
"
,
dev_err
(
platform
->
dev
,
"
ASoC: platform prepare error:"
ret
);
" %d
\n
"
,
ret
);
goto
out
;
goto
out
;
}
}
}
}
...
@@ -461,7 +463,7 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream)
...
@@ -461,7 +463,7 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream)
if
(
codec_dai
->
driver
->
ops
->
prepare
)
{
if
(
codec_dai
->
driver
->
ops
->
prepare
)
{
ret
=
codec_dai
->
driver
->
ops
->
prepare
(
substream
,
codec_dai
);
ret
=
codec_dai
->
driver
->
ops
->
prepare
(
substream
,
codec_dai
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
dev_err
(
codec_dai
->
dev
,
"DAI prepare error: %d
\n
"
,
dev_err
(
codec_dai
->
dev
,
"
ASoC:
DAI prepare error: %d
\n
"
,
ret
);
ret
);
goto
out
;
goto
out
;
}
}
...
@@ -470,7 +472,7 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream)
...
@@ -470,7 +472,7 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream)
if
(
cpu_dai
->
driver
->
ops
->
prepare
)
{
if
(
cpu_dai
->
driver
->
ops
->
prepare
)
{
ret
=
cpu_dai
->
driver
->
ops
->
prepare
(
substream
,
cpu_dai
);
ret
=
cpu_dai
->
driver
->
ops
->
prepare
(
substream
,
cpu_dai
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
dev_err
(
cpu_dai
->
dev
,
"DAI prepare error: %d
\n
"
,
dev_err
(
cpu_dai
->
dev
,
"
ASoC:
DAI prepare error: %d
\n
"
,
ret
);
ret
);
goto
out
;
goto
out
;
}
}
...
@@ -512,7 +514,8 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream,
...
@@ -512,7 +514,8 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream,
if
(
rtd
->
dai_link
->
ops
&&
rtd
->
dai_link
->
ops
->
hw_params
)
{
if
(
rtd
->
dai_link
->
ops
&&
rtd
->
dai_link
->
ops
->
hw_params
)
{
ret
=
rtd
->
dai_link
->
ops
->
hw_params
(
substream
,
params
);
ret
=
rtd
->
dai_link
->
ops
->
hw_params
(
substream
,
params
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
pr_err
(
"asoc: machine hw_params failed: %d
\n
"
,
ret
);
dev_err
(
rtd
->
card
->
dev
,
"ASoC: machine hw_params"
" failed: %d
\n
"
,
ret
);
goto
out
;
goto
out
;
}
}
}
}
...
@@ -520,8 +523,8 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream,
...
@@ -520,8 +523,8 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream,
if
(
codec_dai
->
driver
->
ops
->
hw_params
)
{
if
(
codec_dai
->
driver
->
ops
->
hw_params
)
{
ret
=
codec_dai
->
driver
->
ops
->
hw_params
(
substream
,
params
,
codec_dai
);
ret
=
codec_dai
->
driver
->
ops
->
hw_params
(
substream
,
params
,
codec_dai
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
dev_err
(
codec_dai
->
dev
,
"
can't set %s hw params: %d
\n
"
,
dev_err
(
codec_dai
->
dev
,
"
ASoC: can't set %s hw params:"
codec_dai
->
name
,
ret
);
" %d
\n
"
,
codec_dai
->
name
,
ret
);
goto
codec_err
;
goto
codec_err
;
}
}
}
}
...
@@ -529,7 +532,7 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream,
...
@@ -529,7 +532,7 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream,
if
(
cpu_dai
->
driver
->
ops
->
hw_params
)
{
if
(
cpu_dai
->
driver
->
ops
->
hw_params
)
{
ret
=
cpu_dai
->
driver
->
ops
->
hw_params
(
substream
,
params
,
cpu_dai
);
ret
=
cpu_dai
->
driver
->
ops
->
hw_params
(
substream
,
params
,
cpu_dai
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
dev_err
(
cpu_dai
->
dev
,
"%s hw params failed: %d
\n
"
,
dev_err
(
cpu_dai
->
dev
,
"
ASoC:
%s hw params failed: %d
\n
"
,
cpu_dai
->
name
,
ret
);
cpu_dai
->
name
,
ret
);
goto
interface_err
;
goto
interface_err
;
}
}
...
@@ -538,7 +541,7 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream,
...
@@ -538,7 +541,7 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream,
if
(
platform
->
driver
->
ops
&&
platform
->
driver
->
ops
->
hw_params
)
{
if
(
platform
->
driver
->
ops
&&
platform
->
driver
->
ops
->
hw_params
)
{
ret
=
platform
->
driver
->
ops
->
hw_params
(
substream
,
params
);
ret
=
platform
->
driver
->
ops
->
hw_params
(
substream
,
params
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
dev_err
(
platform
->
dev
,
"%s hw params failed: %d
\n
"
,
dev_err
(
platform
->
dev
,
"
ASoC:
%s hw params failed: %d
\n
"
,
platform
->
name
,
ret
);
platform
->
name
,
ret
);
goto
platform_err
;
goto
platform_err
;
}
}
...
@@ -760,7 +763,7 @@ static void dpcm_be_disconnect(struct snd_soc_pcm_runtime *fe, int stream)
...
@@ -760,7 +763,7 @@ static void dpcm_be_disconnect(struct snd_soc_pcm_runtime *fe, int stream)
struct
snd_soc_dpcm
*
dpcm
,
*
d
;
struct
snd_soc_dpcm
*
dpcm
,
*
d
;
list_for_each_entry_safe
(
dpcm
,
d
,
&
fe
->
dpcm
[
stream
].
be_clients
,
list_be
)
{
list_for_each_entry_safe
(
dpcm
,
d
,
&
fe
->
dpcm
[
stream
].
be_clients
,
list_be
)
{
dev_dbg
(
fe
->
dev
,
"BE %s disconnect check for %s
\n
"
,
dev_dbg
(
fe
->
dev
,
"
ASoC:
BE %s disconnect check for %s
\n
"
,
stream
?
"capture"
:
"playback"
,
stream
?
"capture"
:
"playback"
,
dpcm
->
be
->
dai_link
->
name
);
dpcm
->
be
->
dai_link
->
name
);
...
@@ -815,7 +818,7 @@ static struct snd_soc_pcm_runtime *dpcm_get_be(struct snd_soc_card *card,
...
@@ -815,7 +818,7 @@ static struct snd_soc_pcm_runtime *dpcm_get_be(struct snd_soc_card *card,
}
}
}
}
dev_err
(
card
->
dev
,
"can't get %s BE for %s
\n
"
,
dev_err
(
card
->
dev
,
"
ASoC:
can't get %s BE for %s
\n
"
,
stream
?
"capture"
:
"playback"
,
widget
->
name
);
stream
?
"capture"
:
"playback"
,
widget
->
name
);
return
NULL
;
return
NULL
;
}
}
...
@@ -866,7 +869,7 @@ static int dpcm_path_get(struct snd_soc_pcm_runtime *fe,
...
@@ -866,7 +869,7 @@ static int dpcm_path_get(struct snd_soc_pcm_runtime *fe,
/* get number of valid DAI paths and their widgets */
/* get number of valid DAI paths and their widgets */
paths
=
snd_soc_dapm_dai_get_connected_widgets
(
cpu_dai
,
stream
,
&
list
);
paths
=
snd_soc_dapm_dai_get_connected_widgets
(
cpu_dai
,
stream
,
&
list
);
dev_dbg
(
fe
->
dev
,
"found %d audio %s paths
\n
"
,
paths
,
dev_dbg
(
fe
->
dev
,
"
ASoC:
found %d audio %s paths
\n
"
,
paths
,
stream
?
"capture"
:
"playback"
);
stream
?
"capture"
:
"playback"
);
*
list_
=
list
;
*
list_
=
list
;
...
@@ -903,7 +906,7 @@ static int dpcm_prune_paths(struct snd_soc_pcm_runtime *fe, int stream,
...
@@ -903,7 +906,7 @@ static int dpcm_prune_paths(struct snd_soc_pcm_runtime *fe, int stream,
if
(
widget
&&
widget_in_list
(
list
,
widget
))
if
(
widget
&&
widget_in_list
(
list
,
widget
))
continue
;
continue
;
dev_dbg
(
fe
->
dev
,
"pruning %s BE %s for %s
\n
"
,
dev_dbg
(
fe
->
dev
,
"
ASoC:
pruning %s BE %s for %s
\n
"
,
stream
?
"capture"
:
"playback"
,
stream
?
"capture"
:
"playback"
,
dpcm
->
be
->
dai_link
->
name
,
fe
->
dai_link
->
name
);
dpcm
->
be
->
dai_link
->
name
,
fe
->
dai_link
->
name
);
dpcm
->
state
=
SND_SOC_DPCM_LINK_STATE_FREE
;
dpcm
->
state
=
SND_SOC_DPCM_LINK_STATE_FREE
;
...
@@ -911,7 +914,7 @@ static int dpcm_prune_paths(struct snd_soc_pcm_runtime *fe, int stream,
...
@@ -911,7 +914,7 @@ static int dpcm_prune_paths(struct snd_soc_pcm_runtime *fe, int stream,
prune
++
;
prune
++
;
}
}
dev_dbg
(
fe
->
dev
,
"found %d old BE paths for pruning
\n
"
,
prune
);
dev_dbg
(
fe
->
dev
,
"
ASoC:
found %d old BE paths for pruning
\n
"
,
prune
);
return
prune
;
return
prune
;
}
}
...
@@ -932,7 +935,7 @@ static int dpcm_add_paths(struct snd_soc_pcm_runtime *fe, int stream,
...
@@ -932,7 +935,7 @@ static int dpcm_add_paths(struct snd_soc_pcm_runtime *fe, int stream,
/* is there a valid BE rtd for this widget */
/* is there a valid BE rtd for this widget */
be
=
dpcm_get_be
(
card
,
list
->
widgets
[
i
],
stream
);
be
=
dpcm_get_be
(
card
,
list
->
widgets
[
i
],
stream
);
if
(
!
be
)
{
if
(
!
be
)
{
dev_err
(
fe
->
dev
,
"no BE found for %s
\n
"
,
dev_err
(
fe
->
dev
,
"
ASoC:
no BE found for %s
\n
"
,
list
->
widgets
[
i
]
->
name
);
list
->
widgets
[
i
]
->
name
);
continue
;
continue
;
}
}
...
@@ -948,7 +951,7 @@ static int dpcm_add_paths(struct snd_soc_pcm_runtime *fe, int stream,
...
@@ -948,7 +951,7 @@ static int dpcm_add_paths(struct snd_soc_pcm_runtime *fe, int stream,
/* newly connected FE and BE */
/* newly connected FE and BE */
err
=
dpcm_be_connect
(
fe
,
be
,
stream
);
err
=
dpcm_be_connect
(
fe
,
be
,
stream
);
if
(
err
<
0
)
{
if
(
err
<
0
)
{
dev_err
(
fe
->
dev
,
"can't connect %s
\n
"
,
dev_err
(
fe
->
dev
,
"
ASoC:
can't connect %s
\n
"
,
list
->
widgets
[
i
]
->
name
);
list
->
widgets
[
i
]
->
name
);
break
;
break
;
}
else
if
(
err
==
0
)
/* already connected */
}
else
if
(
err
==
0
)
/* already connected */
...
@@ -959,7 +962,7 @@ static int dpcm_add_paths(struct snd_soc_pcm_runtime *fe, int stream,
...
@@ -959,7 +962,7 @@ static int dpcm_add_paths(struct snd_soc_pcm_runtime *fe, int stream,
new
++
;
new
++
;
}
}
dev_dbg
(
fe
->
dev
,
"found %d new BE paths
\n
"
,
new
);
dev_dbg
(
fe
->
dev
,
"
ASoC:
found %d new BE paths
\n
"
,
new
);
return
new
;
return
new
;
}
}
...
@@ -998,7 +1001,7 @@ static void dpcm_be_dai_startup_unwind(struct snd_soc_pcm_runtime *fe,
...
@@ -998,7 +1001,7 @@ static void dpcm_be_dai_startup_unwind(struct snd_soc_pcm_runtime *fe,
snd_soc_dpcm_get_substream
(
be
,
stream
);
snd_soc_dpcm_get_substream
(
be
,
stream
);
if
(
be
->
dpcm
[
stream
].
users
==
0
)
if
(
be
->
dpcm
[
stream
].
users
==
0
)
dev_err
(
be
->
dev
,
"no users %s at close - state %d
\n
"
,
dev_err
(
be
->
dev
,
"
ASoC:
no users %s at close - state %d
\n
"
,
stream
?
"capture"
:
"playback"
,
stream
?
"capture"
:
"playback"
,
be
->
dpcm
[
stream
].
state
);
be
->
dpcm
[
stream
].
state
);
...
@@ -1032,7 +1035,7 @@ static int dpcm_be_dai_startup(struct snd_soc_pcm_runtime *fe, int stream)
...
@@ -1032,7 +1035,7 @@ static int dpcm_be_dai_startup(struct snd_soc_pcm_runtime *fe, int stream)
/* first time the dpcm is open ? */
/* first time the dpcm is open ? */
if
(
be
->
dpcm
[
stream
].
users
==
DPCM_MAX_BE_USERS
)
if
(
be
->
dpcm
[
stream
].
users
==
DPCM_MAX_BE_USERS
)
dev_err
(
be
->
dev
,
"too many users %s at open %d
\n
"
,
dev_err
(
be
->
dev
,
"
ASoC:
too many users %s at open %d
\n
"
,
stream
?
"capture"
:
"playback"
,
stream
?
"capture"
:
"playback"
,
be
->
dpcm
[
stream
].
state
);
be
->
dpcm
[
stream
].
state
);
...
@@ -1043,15 +1046,15 @@ static int dpcm_be_dai_startup(struct snd_soc_pcm_runtime *fe, int stream)
...
@@ -1043,15 +1046,15 @@ static int dpcm_be_dai_startup(struct snd_soc_pcm_runtime *fe, int stream)
(
be
->
dpcm
[
stream
].
state
!=
SND_SOC_DPCM_STATE_CLOSE
))
(
be
->
dpcm
[
stream
].
state
!=
SND_SOC_DPCM_STATE_CLOSE
))
continue
;
continue
;
dev_dbg
(
be
->
dev
,
"
dpcm
: open BE %s
\n
"
,
be
->
dai_link
->
name
);
dev_dbg
(
be
->
dev
,
"
ASoC
: open BE %s
\n
"
,
be
->
dai_link
->
name
);
be_substream
->
runtime
=
be
->
dpcm
[
stream
].
runtime
;
be_substream
->
runtime
=
be
->
dpcm
[
stream
].
runtime
;
err
=
soc_pcm_open
(
be_substream
);
err
=
soc_pcm_open
(
be_substream
);
if
(
err
<
0
)
{
if
(
err
<
0
)
{
dev_err
(
be
->
dev
,
"BE open failed %d
\n
"
,
err
);
dev_err
(
be
->
dev
,
"
ASoC:
BE open failed %d
\n
"
,
err
);
be
->
dpcm
[
stream
].
users
--
;
be
->
dpcm
[
stream
].
users
--
;
if
(
be
->
dpcm
[
stream
].
users
<
0
)
if
(
be
->
dpcm
[
stream
].
users
<
0
)
dev_err
(
be
->
dev
,
"no users %s at unwind %d
\n
"
,
dev_err
(
be
->
dev
,
"
ASoC:
no users %s at unwind %d
\n
"
,
stream
?
"capture"
:
"playback"
,
stream
?
"capture"
:
"playback"
,
be
->
dpcm
[
stream
].
state
);
be
->
dpcm
[
stream
].
state
);
...
@@ -1076,7 +1079,7 @@ static int dpcm_be_dai_startup(struct snd_soc_pcm_runtime *fe, int stream)
...
@@ -1076,7 +1079,7 @@ static int dpcm_be_dai_startup(struct snd_soc_pcm_runtime *fe, int stream)
continue
;
continue
;
if
(
be
->
dpcm
[
stream
].
users
==
0
)
if
(
be
->
dpcm
[
stream
].
users
==
0
)
dev_err
(
be
->
dev
,
"no users %s at close %d
\n
"
,
dev_err
(
be
->
dev
,
"
ASoC:
no users %s at close %d
\n
"
,
stream
?
"capture"
:
"playback"
,
stream
?
"capture"
:
"playback"
,
be
->
dpcm
[
stream
].
state
);
be
->
dpcm
[
stream
].
state
);
...
@@ -1128,16 +1131,16 @@ static int dpcm_fe_dai_startup(struct snd_pcm_substream *fe_substream)
...
@@ -1128,16 +1131,16 @@ static int dpcm_fe_dai_startup(struct snd_pcm_substream *fe_substream)
ret
=
dpcm_be_dai_startup
(
fe
,
fe_substream
->
stream
);
ret
=
dpcm_be_dai_startup
(
fe
,
fe_substream
->
stream
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
dev_err
(
fe
->
dev
,
"
dpcm
: failed to start some BEs %d
\n
"
,
ret
);
dev_err
(
fe
->
dev
,
"
ASoC
: failed to start some BEs %d
\n
"
,
ret
);
goto
be_err
;
goto
be_err
;
}
}
dev_dbg
(
fe
->
dev
,
"
dpcm
: open FE %s
\n
"
,
fe
->
dai_link
->
name
);
dev_dbg
(
fe
->
dev
,
"
ASoC
: open FE %s
\n
"
,
fe
->
dai_link
->
name
);
/* start the DAI frontend */
/* start the DAI frontend */
ret
=
soc_pcm_open
(
fe_substream
);
ret
=
soc_pcm_open
(
fe_substream
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
dev_err
(
fe
->
dev
,
"
dpcm
: failed to start FE %d
\n
"
,
ret
);
dev_err
(
fe
->
dev
,
"
ASoC
: failed to start FE %d
\n
"
,
ret
);
goto
unwind
;
goto
unwind
;
}
}
...
@@ -1172,7 +1175,7 @@ static int dpcm_be_dai_shutdown(struct snd_soc_pcm_runtime *fe, int stream)
...
@@ -1172,7 +1175,7 @@ static int dpcm_be_dai_shutdown(struct snd_soc_pcm_runtime *fe, int stream)
continue
;
continue
;
if
(
be
->
dpcm
[
stream
].
users
==
0
)
if
(
be
->
dpcm
[
stream
].
users
==
0
)
dev_err
(
be
->
dev
,
"no users %s at close - state %d
\n
"
,
dev_err
(
be
->
dev
,
"
ASoC:
no users %s at close - state %d
\n
"
,
stream
?
"capture"
:
"playback"
,
stream
?
"capture"
:
"playback"
,
be
->
dpcm
[
stream
].
state
);
be
->
dpcm
[
stream
].
state
);
...
@@ -1183,7 +1186,7 @@ static int dpcm_be_dai_shutdown(struct snd_soc_pcm_runtime *fe, int stream)
...
@@ -1183,7 +1186,7 @@ static int dpcm_be_dai_shutdown(struct snd_soc_pcm_runtime *fe, int stream)
(
be
->
dpcm
[
stream
].
state
!=
SND_SOC_DPCM_STATE_OPEN
))
(
be
->
dpcm
[
stream
].
state
!=
SND_SOC_DPCM_STATE_OPEN
))
continue
;
continue
;
dev_dbg
(
be
->
dev
,
"
dpcm
: close BE %s
\n
"
,
dev_dbg
(
be
->
dev
,
"
ASoC
: close BE %s
\n
"
,
dpcm
->
fe
->
dai_link
->
name
);
dpcm
->
fe
->
dai_link
->
name
);
soc_pcm_close
(
be_substream
);
soc_pcm_close
(
be_substream
);
...
@@ -1204,7 +1207,7 @@ static int dpcm_fe_dai_shutdown(struct snd_pcm_substream *substream)
...
@@ -1204,7 +1207,7 @@ static int dpcm_fe_dai_shutdown(struct snd_pcm_substream *substream)
/* shutdown the BEs */
/* shutdown the BEs */
dpcm_be_dai_shutdown
(
fe
,
substream
->
stream
);
dpcm_be_dai_shutdown
(
fe
,
substream
->
stream
);
dev_dbg
(
fe
->
dev
,
"
dpcm
: close FE %s
\n
"
,
fe
->
dai_link
->
name
);
dev_dbg
(
fe
->
dev
,
"
ASoC
: close FE %s
\n
"
,
fe
->
dai_link
->
name
);
/* now shutdown the frontend */
/* now shutdown the frontend */
soc_pcm_close
(
substream
);
soc_pcm_close
(
substream
);
...
@@ -1243,7 +1246,7 @@ static int dpcm_be_dai_hw_free(struct snd_soc_pcm_runtime *fe, int stream)
...
@@ -1243,7 +1246,7 @@ static int dpcm_be_dai_hw_free(struct snd_soc_pcm_runtime *fe, int stream)
(
be
->
dpcm
[
stream
].
state
!=
SND_SOC_DPCM_STATE_STOP
))
(
be
->
dpcm
[
stream
].
state
!=
SND_SOC_DPCM_STATE_STOP
))
continue
;
continue
;
dev_dbg
(
be
->
dev
,
"
dpcm
: hw_free BE %s
\n
"
,
dev_dbg
(
be
->
dev
,
"
ASoC
: hw_free BE %s
\n
"
,
dpcm
->
fe
->
dai_link
->
name
);
dpcm
->
fe
->
dai_link
->
name
);
soc_pcm_hw_free
(
be_substream
);
soc_pcm_hw_free
(
be_substream
);
...
@@ -1262,12 +1265,12 @@ static int dpcm_fe_dai_hw_free(struct snd_pcm_substream *substream)
...
@@ -1262,12 +1265,12 @@ static int dpcm_fe_dai_hw_free(struct snd_pcm_substream *substream)
mutex_lock_nested
(
&
fe
->
card
->
mutex
,
SND_SOC_CARD_CLASS_RUNTIME
);
mutex_lock_nested
(
&
fe
->
card
->
mutex
,
SND_SOC_CARD_CLASS_RUNTIME
);
fe
->
dpcm
[
stream
].
runtime_update
=
SND_SOC_DPCM_UPDATE_FE
;
fe
->
dpcm
[
stream
].
runtime_update
=
SND_SOC_DPCM_UPDATE_FE
;
dev_dbg
(
fe
->
dev
,
"
dpcm
: hw_free FE %s
\n
"
,
fe
->
dai_link
->
name
);
dev_dbg
(
fe
->
dev
,
"
ASoC
: hw_free FE %s
\n
"
,
fe
->
dai_link
->
name
);
/* call hw_free on the frontend */
/* call hw_free on the frontend */
err
=
soc_pcm_hw_free
(
substream
);
err
=
soc_pcm_hw_free
(
substream
);
if
(
err
<
0
)
if
(
err
<
0
)
dev_err
(
fe
->
dev
,
"
dpcm
: hw_free FE %s failed
\n
"
,
dev_err
(
fe
->
dev
,
"
ASoC
: hw_free FE %s failed
\n
"
,
fe
->
dai_link
->
name
);
fe
->
dai_link
->
name
);
/* only hw_params backends that are either sinks or sources
/* only hw_params backends that are either sinks or sources
...
@@ -1305,7 +1308,7 @@ static int dpcm_be_dai_hw_params(struct snd_soc_pcm_runtime *fe, int stream)
...
@@ -1305,7 +1308,7 @@ static int dpcm_be_dai_hw_params(struct snd_soc_pcm_runtime *fe, int stream)
(
be
->
dpcm
[
stream
].
state
!=
SND_SOC_DPCM_STATE_HW_FREE
))
(
be
->
dpcm
[
stream
].
state
!=
SND_SOC_DPCM_STATE_HW_FREE
))
continue
;
continue
;
dev_dbg
(
be
->
dev
,
"
dpcm
: hw_params BE %s
\n
"
,
dev_dbg
(
be
->
dev
,
"
ASoC
: hw_params BE %s
\n
"
,
dpcm
->
fe
->
dai_link
->
name
);
dpcm
->
fe
->
dai_link
->
name
);
/* copy params for each dpcm */
/* copy params for each dpcm */
...
@@ -1318,7 +1321,7 @@ static int dpcm_be_dai_hw_params(struct snd_soc_pcm_runtime *fe, int stream)
...
@@ -1318,7 +1321,7 @@ static int dpcm_be_dai_hw_params(struct snd_soc_pcm_runtime *fe, int stream)
&
dpcm
->
hw_params
);
&
dpcm
->
hw_params
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
dev_err
(
be
->
dev
,
dev_err
(
be
->
dev
,
"
dpcm
: hw_params BE fixup failed %d
\n
"
,
"
ASoC
: hw_params BE fixup failed %d
\n
"
,
ret
);
ret
);
goto
unwind
;
goto
unwind
;
}
}
...
@@ -1327,7 +1330,7 @@ static int dpcm_be_dai_hw_params(struct snd_soc_pcm_runtime *fe, int stream)
...
@@ -1327,7 +1330,7 @@ static int dpcm_be_dai_hw_params(struct snd_soc_pcm_runtime *fe, int stream)
ret
=
soc_pcm_hw_params
(
be_substream
,
&
dpcm
->
hw_params
);
ret
=
soc_pcm_hw_params
(
be_substream
,
&
dpcm
->
hw_params
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
dev_err
(
dpcm
->
be
->
dev
,
dev_err
(
dpcm
->
be
->
dev
,
"
dpcm
: hw_params BE failed %d
\n
"
,
ret
);
"
ASoC
: hw_params BE failed %d
\n
"
,
ret
);
goto
unwind
;
goto
unwind
;
}
}
...
@@ -1374,18 +1377,18 @@ static int dpcm_fe_dai_hw_params(struct snd_pcm_substream *substream,
...
@@ -1374,18 +1377,18 @@ static int dpcm_fe_dai_hw_params(struct snd_pcm_substream *substream,
sizeof
(
struct
snd_pcm_hw_params
));
sizeof
(
struct
snd_pcm_hw_params
));
ret
=
dpcm_be_dai_hw_params
(
fe
,
substream
->
stream
);
ret
=
dpcm_be_dai_hw_params
(
fe
,
substream
->
stream
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
dev_err
(
fe
->
dev
,
"
dpcm
: hw_params BE failed %d
\n
"
,
ret
);
dev_err
(
fe
->
dev
,
"
ASoC
: hw_params BE failed %d
\n
"
,
ret
);
goto
out
;
goto
out
;
}
}
dev_dbg
(
fe
->
dev
,
"
dpcm
: hw_params FE %s rate %d chan %x fmt %d
\n
"
,
dev_dbg
(
fe
->
dev
,
"
ASoC
: hw_params FE %s rate %d chan %x fmt %d
\n
"
,
fe
->
dai_link
->
name
,
params_rate
(
params
),
fe
->
dai_link
->
name
,
params_rate
(
params
),
params_channels
(
params
),
params_format
(
params
));
params_channels
(
params
),
params_format
(
params
));
/* call hw_params on the frontend */
/* call hw_params on the frontend */
ret
=
soc_pcm_hw_params
(
substream
,
params
);
ret
=
soc_pcm_hw_params
(
substream
,
params
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
dev_err
(
fe
->
dev
,
"
dpcm
: hw_params FE failed %d
\n
"
,
ret
);
dev_err
(
fe
->
dev
,
"
ASoC
: hw_params FE failed %d
\n
"
,
ret
);
dpcm_be_dai_hw_free
(
fe
,
stream
);
dpcm_be_dai_hw_free
(
fe
,
stream
);
}
else
}
else
fe
->
dpcm
[
stream
].
state
=
SND_SOC_DPCM_STATE_HW_PARAMS
;
fe
->
dpcm
[
stream
].
state
=
SND_SOC_DPCM_STATE_HW_PARAMS
;
...
@@ -1401,12 +1404,12 @@ static int dpcm_do_trigger(struct snd_soc_dpcm *dpcm,
...
@@ -1401,12 +1404,12 @@ static int dpcm_do_trigger(struct snd_soc_dpcm *dpcm,
{
{
int
ret
;
int
ret
;
dev_dbg
(
dpcm
->
be
->
dev
,
"
dpcm
: trigger BE %s cmd %d
\n
"
,
dev_dbg
(
dpcm
->
be
->
dev
,
"
ASoC
: trigger BE %s cmd %d
\n
"
,
dpcm
->
fe
->
dai_link
->
name
,
cmd
);
dpcm
->
fe
->
dai_link
->
name
,
cmd
);
ret
=
soc_pcm_trigger
(
substream
,
cmd
);
ret
=
soc_pcm_trigger
(
substream
,
cmd
);
if
(
ret
<
0
)
if
(
ret
<
0
)
dev_err
(
dpcm
->
be
->
dev
,
"
dpcm
: trigger BE failed %d
\n
"
,
ret
);
dev_err
(
dpcm
->
be
->
dev
,
"
ASoC
: trigger BE failed %d
\n
"
,
ret
);
return
ret
;
return
ret
;
}
}
...
@@ -1517,12 +1520,12 @@ static int dpcm_fe_dai_trigger(struct snd_pcm_substream *substream, int cmd)
...
@@ -1517,12 +1520,12 @@ static int dpcm_fe_dai_trigger(struct snd_pcm_substream *substream, int cmd)
case
SND_SOC_DPCM_TRIGGER_PRE
:
case
SND_SOC_DPCM_TRIGGER_PRE
:
/* call trigger on the frontend before the backend. */
/* call trigger on the frontend before the backend. */
dev_dbg
(
fe
->
dev
,
"
dpcm
: pre trigger FE %s cmd %d
\n
"
,
dev_dbg
(
fe
->
dev
,
"
ASoC
: pre trigger FE %s cmd %d
\n
"
,
fe
->
dai_link
->
name
,
cmd
);
fe
->
dai_link
->
name
,
cmd
);
ret
=
soc_pcm_trigger
(
substream
,
cmd
);
ret
=
soc_pcm_trigger
(
substream
,
cmd
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
dev_err
(
fe
->
dev
,
"
dpcm
: trigger FE failed %d
\n
"
,
ret
);
dev_err
(
fe
->
dev
,
"
ASoC
: trigger FE failed %d
\n
"
,
ret
);
goto
out
;
goto
out
;
}
}
...
@@ -1533,11 +1536,11 @@ static int dpcm_fe_dai_trigger(struct snd_pcm_substream *substream, int cmd)
...
@@ -1533,11 +1536,11 @@ static int dpcm_fe_dai_trigger(struct snd_pcm_substream *substream, int cmd)
ret
=
dpcm_be_dai_trigger
(
fe
,
substream
->
stream
,
cmd
);
ret
=
dpcm_be_dai_trigger
(
fe
,
substream
->
stream
,
cmd
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
dev_err
(
fe
->
dev
,
"
dpcm
: trigger FE failed %d
\n
"
,
ret
);
dev_err
(
fe
->
dev
,
"
ASoC
: trigger FE failed %d
\n
"
,
ret
);
goto
out
;
goto
out
;
}
}
dev_dbg
(
fe
->
dev
,
"
dpcm
: post trigger FE %s cmd %d
\n
"
,
dev_dbg
(
fe
->
dev
,
"
ASoC
: post trigger FE %s cmd %d
\n
"
,
fe
->
dai_link
->
name
,
cmd
);
fe
->
dai_link
->
name
,
cmd
);
ret
=
soc_pcm_trigger
(
substream
,
cmd
);
ret
=
soc_pcm_trigger
(
substream
,
cmd
);
...
@@ -1545,17 +1548,17 @@ static int dpcm_fe_dai_trigger(struct snd_pcm_substream *substream, int cmd)
...
@@ -1545,17 +1548,17 @@ static int dpcm_fe_dai_trigger(struct snd_pcm_substream *substream, int cmd)
case
SND_SOC_DPCM_TRIGGER_BESPOKE
:
case
SND_SOC_DPCM_TRIGGER_BESPOKE
:
/* bespoke trigger() - handles both FE and BEs */
/* bespoke trigger() - handles both FE and BEs */
dev_dbg
(
fe
->
dev
,
"
dpcm
: bespoke trigger FE %s cmd %d
\n
"
,
dev_dbg
(
fe
->
dev
,
"
ASoC
: bespoke trigger FE %s cmd %d
\n
"
,
fe
->
dai_link
->
name
,
cmd
);
fe
->
dai_link
->
name
,
cmd
);
ret
=
soc_pcm_bespoke_trigger
(
substream
,
cmd
);
ret
=
soc_pcm_bespoke_trigger
(
substream
,
cmd
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
dev_err
(
fe
->
dev
,
"
dpcm
: trigger FE failed %d
\n
"
,
ret
);
dev_err
(
fe
->
dev
,
"
ASoC
: trigger FE failed %d
\n
"
,
ret
);
goto
out
;
goto
out
;
}
}
break
;
break
;
default:
default:
dev_err
(
fe
->
dev
,
"
dpcm
: invalid trigger cmd %d for %s
\n
"
,
cmd
,
dev_err
(
fe
->
dev
,
"
ASoC
: invalid trigger cmd %d for %s
\n
"
,
cmd
,
fe
->
dai_link
->
name
);
fe
->
dai_link
->
name
);
ret
=
-
EINVAL
;
ret
=
-
EINVAL
;
goto
out
;
goto
out
;
...
@@ -1598,12 +1601,12 @@ static int dpcm_be_dai_prepare(struct snd_soc_pcm_runtime *fe, int stream)
...
@@ -1598,12 +1601,12 @@ static int dpcm_be_dai_prepare(struct snd_soc_pcm_runtime *fe, int stream)
(
be
->
dpcm
[
stream
].
state
!=
SND_SOC_DPCM_STATE_STOP
))
(
be
->
dpcm
[
stream
].
state
!=
SND_SOC_DPCM_STATE_STOP
))
continue
;
continue
;
dev_dbg
(
be
->
dev
,
"
dpcm
: prepare BE %s
\n
"
,
dev_dbg
(
be
->
dev
,
"
ASoC
: prepare BE %s
\n
"
,
dpcm
->
fe
->
dai_link
->
name
);
dpcm
->
fe
->
dai_link
->
name
);
ret
=
soc_pcm_prepare
(
be_substream
);
ret
=
soc_pcm_prepare
(
be_substream
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
dev_err
(
be
->
dev
,
"
dpcm
: backend prepare failed %d
\n
"
,
dev_err
(
be
->
dev
,
"
ASoC
: backend prepare failed %d
\n
"
,
ret
);
ret
);
break
;
break
;
}
}
...
@@ -1620,13 +1623,13 @@ static int dpcm_fe_dai_prepare(struct snd_pcm_substream *substream)
...
@@ -1620,13 +1623,13 @@ static int dpcm_fe_dai_prepare(struct snd_pcm_substream *substream)
mutex_lock_nested
(
&
fe
->
card
->
mutex
,
SND_SOC_CARD_CLASS_RUNTIME
);
mutex_lock_nested
(
&
fe
->
card
->
mutex
,
SND_SOC_CARD_CLASS_RUNTIME
);
dev_dbg
(
fe
->
dev
,
"
dpcm
: prepare FE %s
\n
"
,
fe
->
dai_link
->
name
);
dev_dbg
(
fe
->
dev
,
"
ASoC
: prepare FE %s
\n
"
,
fe
->
dai_link
->
name
);
fe
->
dpcm
[
stream
].
runtime_update
=
SND_SOC_DPCM_UPDATE_FE
;
fe
->
dpcm
[
stream
].
runtime_update
=
SND_SOC_DPCM_UPDATE_FE
;
/* there is no point preparing this FE if there are no BEs */
/* there is no point preparing this FE if there are no BEs */
if
(
list_empty
(
&
fe
->
dpcm
[
stream
].
be_clients
))
{
if
(
list_empty
(
&
fe
->
dpcm
[
stream
].
be_clients
))
{
dev_err
(
fe
->
dev
,
"
dpcm
: no backend DAIs enabled for %s
\n
"
,
dev_err
(
fe
->
dev
,
"
ASoC
: no backend DAIs enabled for %s
\n
"
,
fe
->
dai_link
->
name
);
fe
->
dai_link
->
name
);
ret
=
-
EINVAL
;
ret
=
-
EINVAL
;
goto
out
;
goto
out
;
...
@@ -1639,7 +1642,7 @@ static int dpcm_fe_dai_prepare(struct snd_pcm_substream *substream)
...
@@ -1639,7 +1642,7 @@ static int dpcm_fe_dai_prepare(struct snd_pcm_substream *substream)
/* call prepare on the frontend */
/* call prepare on the frontend */
ret
=
soc_pcm_prepare
(
substream
);
ret
=
soc_pcm_prepare
(
substream
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
dev_err
(
fe
->
dev
,
"
dpcm
: prepare FE %s failed
\n
"
,
dev_err
(
fe
->
dev
,
"
ASoC
: prepare FE %s failed
\n
"
,
fe
->
dai_link
->
name
);
fe
->
dai_link
->
name
);
goto
out
;
goto
out
;
}
}
...
@@ -1673,33 +1676,33 @@ static int dpcm_run_update_shutdown(struct snd_soc_pcm_runtime *fe, int stream)
...
@@ -1673,33 +1676,33 @@ static int dpcm_run_update_shutdown(struct snd_soc_pcm_runtime *fe, int stream)
enum
snd_soc_dpcm_trigger
trigger
=
fe
->
dai_link
->
trigger
[
stream
];
enum
snd_soc_dpcm_trigger
trigger
=
fe
->
dai_link
->
trigger
[
stream
];
int
err
;
int
err
;
dev_dbg
(
fe
->
dev
,
"runtime %s close on FE %s
\n
"
,
dev_dbg
(
fe
->
dev
,
"
ASoC:
runtime %s close on FE %s
\n
"
,
stream
?
"capture"
:
"playback"
,
fe
->
dai_link
->
name
);
stream
?
"capture"
:
"playback"
,
fe
->
dai_link
->
name
);
if
(
trigger
==
SND_SOC_DPCM_TRIGGER_BESPOKE
)
{
if
(
trigger
==
SND_SOC_DPCM_TRIGGER_BESPOKE
)
{
/* call bespoke trigger - FE takes care of all BE triggers */
/* call bespoke trigger - FE takes care of all BE triggers */
dev_dbg
(
fe
->
dev
,
"
dpcm
: bespoke trigger FE %s cmd stop
\n
"
,
dev_dbg
(
fe
->
dev
,
"
ASoC
: bespoke trigger FE %s cmd stop
\n
"
,
fe
->
dai_link
->
name
);
fe
->
dai_link
->
name
);
err
=
soc_pcm_bespoke_trigger
(
substream
,
SNDRV_PCM_TRIGGER_STOP
);
err
=
soc_pcm_bespoke_trigger
(
substream
,
SNDRV_PCM_TRIGGER_STOP
);
if
(
err
<
0
)
if
(
err
<
0
)
dev_err
(
fe
->
dev
,
"
dpcm
: trigger FE failed %d
\n
"
,
err
);
dev_err
(
fe
->
dev
,
"
ASoC
: trigger FE failed %d
\n
"
,
err
);
}
else
{
}
else
{
dev_dbg
(
fe
->
dev
,
"
dpcm
: trigger FE %s cmd stop
\n
"
,
dev_dbg
(
fe
->
dev
,
"
ASoC
: trigger FE %s cmd stop
\n
"
,
fe
->
dai_link
->
name
);
fe
->
dai_link
->
name
);
err
=
dpcm_be_dai_trigger
(
fe
,
stream
,
SNDRV_PCM_TRIGGER_STOP
);
err
=
dpcm_be_dai_trigger
(
fe
,
stream
,
SNDRV_PCM_TRIGGER_STOP
);
if
(
err
<
0
)
if
(
err
<
0
)
dev_err
(
fe
->
dev
,
"
dpcm
: trigger FE failed %d
\n
"
,
err
);
dev_err
(
fe
->
dev
,
"
ASoC
: trigger FE failed %d
\n
"
,
err
);
}
}
err
=
dpcm_be_dai_hw_free
(
fe
,
stream
);
err
=
dpcm_be_dai_hw_free
(
fe
,
stream
);
if
(
err
<
0
)
if
(
err
<
0
)
dev_err
(
fe
->
dev
,
"
dpcm
: hw_free FE failed %d
\n
"
,
err
);
dev_err
(
fe
->
dev
,
"
ASoC
: hw_free FE failed %d
\n
"
,
err
);
err
=
dpcm_be_dai_shutdown
(
fe
,
stream
);
err
=
dpcm_be_dai_shutdown
(
fe
,
stream
);
if
(
err
<
0
)
if
(
err
<
0
)
dev_err
(
fe
->
dev
,
"
dpcm
: shutdown FE failed %d
\n
"
,
err
);
dev_err
(
fe
->
dev
,
"
ASoC
: shutdown FE failed %d
\n
"
,
err
);
/* run the stream event for each BE */
/* run the stream event for each BE */
dpcm_dapm_stream_event
(
fe
,
stream
,
SND_SOC_DAPM_STREAM_NOP
);
dpcm_dapm_stream_event
(
fe
,
stream
,
SND_SOC_DAPM_STREAM_NOP
);
...
@@ -1715,7 +1718,7 @@ static int dpcm_run_update_startup(struct snd_soc_pcm_runtime *fe, int stream)
...
@@ -1715,7 +1718,7 @@ static int dpcm_run_update_startup(struct snd_soc_pcm_runtime *fe, int stream)
enum
snd_soc_dpcm_trigger
trigger
=
fe
->
dai_link
->
trigger
[
stream
];
enum
snd_soc_dpcm_trigger
trigger
=
fe
->
dai_link
->
trigger
[
stream
];
int
ret
;
int
ret
;
dev_dbg
(
fe
->
dev
,
"runtime %s open on FE %s
\n
"
,
dev_dbg
(
fe
->
dev
,
"
ASoC:
runtime %s open on FE %s
\n
"
,
stream
?
"capture"
:
"playback"
,
fe
->
dai_link
->
name
);
stream
?
"capture"
:
"playback"
,
fe
->
dai_link
->
name
);
/* Only start the BE if the FE is ready */
/* Only start the BE if the FE is ready */
...
@@ -1761,22 +1764,22 @@ static int dpcm_run_update_startup(struct snd_soc_pcm_runtime *fe, int stream)
...
@@ -1761,22 +1764,22 @@ static int dpcm_run_update_startup(struct snd_soc_pcm_runtime *fe, int stream)
if
(
trigger
==
SND_SOC_DPCM_TRIGGER_BESPOKE
)
{
if
(
trigger
==
SND_SOC_DPCM_TRIGGER_BESPOKE
)
{
/* call trigger on the frontend - FE takes care of all BE triggers */
/* call trigger on the frontend - FE takes care of all BE triggers */
dev_dbg
(
fe
->
dev
,
"
dpcm
: bespoke trigger FE %s cmd start
\n
"
,
dev_dbg
(
fe
->
dev
,
"
ASoC
: bespoke trigger FE %s cmd start
\n
"
,
fe
->
dai_link
->
name
);
fe
->
dai_link
->
name
);
ret
=
soc_pcm_bespoke_trigger
(
substream
,
SNDRV_PCM_TRIGGER_START
);
ret
=
soc_pcm_bespoke_trigger
(
substream
,
SNDRV_PCM_TRIGGER_START
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
dev_err
(
fe
->
dev
,
"
dpcm
: bespoke trigger FE failed %d
\n
"
,
ret
);
dev_err
(
fe
->
dev
,
"
ASoC
: bespoke trigger FE failed %d
\n
"
,
ret
);
goto
hw_free
;
goto
hw_free
;
}
}
}
else
{
}
else
{
dev_dbg
(
fe
->
dev
,
"
dpcm
: trigger FE %s cmd start
\n
"
,
dev_dbg
(
fe
->
dev
,
"
ASoC
: trigger FE %s cmd start
\n
"
,
fe
->
dai_link
->
name
);
fe
->
dai_link
->
name
);
ret
=
dpcm_be_dai_trigger
(
fe
,
stream
,
ret
=
dpcm_be_dai_trigger
(
fe
,
stream
,
SNDRV_PCM_TRIGGER_START
);
SNDRV_PCM_TRIGGER_START
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
dev_err
(
fe
->
dev
,
"
dpcm
: trigger FE failed %d
\n
"
,
ret
);
dev_err
(
fe
->
dev
,
"
ASoC
: trigger FE failed %d
\n
"
,
ret
);
goto
hw_free
;
goto
hw_free
;
}
}
}
}
...
@@ -1805,7 +1808,7 @@ static int dpcm_run_new_update(struct snd_soc_pcm_runtime *fe, int stream)
...
@@ -1805,7 +1808,7 @@ static int dpcm_run_new_update(struct snd_soc_pcm_runtime *fe, int stream)
fe
->
dpcm
[
stream
].
runtime_update
=
SND_SOC_DPCM_UPDATE_BE
;
fe
->
dpcm
[
stream
].
runtime_update
=
SND_SOC_DPCM_UPDATE_BE
;
ret
=
dpcm_run_update_startup
(
fe
,
stream
);
ret
=
dpcm_run_update_startup
(
fe
,
stream
);
if
(
ret
<
0
)
if
(
ret
<
0
)
dev_err
(
fe
->
dev
,
"failed to startup some BEs
\n
"
);
dev_err
(
fe
->
dev
,
"
ASoC:
failed to startup some BEs
\n
"
);
fe
->
dpcm
[
stream
].
runtime_update
=
SND_SOC_DPCM_UPDATE_NO
;
fe
->
dpcm
[
stream
].
runtime_update
=
SND_SOC_DPCM_UPDATE_NO
;
return
ret
;
return
ret
;
...
@@ -1818,7 +1821,7 @@ static int dpcm_run_old_update(struct snd_soc_pcm_runtime *fe, int stream)
...
@@ -1818,7 +1821,7 @@ static int dpcm_run_old_update(struct snd_soc_pcm_runtime *fe, int stream)
fe
->
dpcm
[
stream
].
runtime_update
=
SND_SOC_DPCM_UPDATE_BE
;
fe
->
dpcm
[
stream
].
runtime_update
=
SND_SOC_DPCM_UPDATE_BE
;
ret
=
dpcm_run_update_shutdown
(
fe
,
stream
);
ret
=
dpcm_run_update_shutdown
(
fe
,
stream
);
if
(
ret
<
0
)
if
(
ret
<
0
)
dev_err
(
fe
->
dev
,
"failed to shutdown some BEs
\n
"
);
dev_err
(
fe
->
dev
,
"
ASoC:
failed to shutdown some BEs
\n
"
);
fe
->
dpcm
[
stream
].
runtime_update
=
SND_SOC_DPCM_UPDATE_NO
;
fe
->
dpcm
[
stream
].
runtime_update
=
SND_SOC_DPCM_UPDATE_NO
;
return
ret
;
return
ret
;
...
@@ -1853,7 +1856,7 @@ int soc_dpcm_runtime_update(struct snd_soc_dapm_widget *widget)
...
@@ -1853,7 +1856,7 @@ int soc_dpcm_runtime_update(struct snd_soc_dapm_widget *widget)
continue
;
continue
;
/* DAPM sync will call this to update DSP paths */
/* DAPM sync will call this to update DSP paths */
dev_dbg
(
fe
->
dev
,
"DPCM runtime update for FE %s
\n
"
,
dev_dbg
(
fe
->
dev
,
"
ASoC:
DPCM runtime update for FE %s
\n
"
,
fe
->
dai_link
->
name
);
fe
->
dai_link
->
name
);
/* skip if FE doesn't have playback capability */
/* skip if FE doesn't have playback capability */
...
@@ -1862,7 +1865,7 @@ int soc_dpcm_runtime_update(struct snd_soc_dapm_widget *widget)
...
@@ -1862,7 +1865,7 @@ int soc_dpcm_runtime_update(struct snd_soc_dapm_widget *widget)
paths
=
dpcm_path_get
(
fe
,
SNDRV_PCM_STREAM_PLAYBACK
,
&
list
);
paths
=
dpcm_path_get
(
fe
,
SNDRV_PCM_STREAM_PLAYBACK
,
&
list
);
if
(
paths
<
0
)
{
if
(
paths
<
0
)
{
dev_warn
(
fe
->
dev
,
"%s no valid %s path
\n
"
,
dev_warn
(
fe
->
dev
,
"
ASoC:
%s no valid %s path
\n
"
,
fe
->
dai_link
->
name
,
"playback"
);
fe
->
dai_link
->
name
,
"playback"
);
mutex_unlock
(
&
card
->
mutex
);
mutex_unlock
(
&
card
->
mutex
);
return
paths
;
return
paths
;
...
@@ -1891,7 +1894,7 @@ int soc_dpcm_runtime_update(struct snd_soc_dapm_widget *widget)
...
@@ -1891,7 +1894,7 @@ int soc_dpcm_runtime_update(struct snd_soc_dapm_widget *widget)
paths
=
dpcm_path_get
(
fe
,
SNDRV_PCM_STREAM_CAPTURE
,
&
list
);
paths
=
dpcm_path_get
(
fe
,
SNDRV_PCM_STREAM_CAPTURE
,
&
list
);
if
(
paths
<
0
)
{
if
(
paths
<
0
)
{
dev_warn
(
fe
->
dev
,
"%s no valid %s path
\n
"
,
dev_warn
(
fe
->
dev
,
"
ASoC:
%s no valid %s path
\n
"
,
fe
->
dai_link
->
name
,
"capture"
);
fe
->
dai_link
->
name
,
"capture"
);
mutex_unlock
(
&
card
->
mutex
);
mutex_unlock
(
&
card
->
mutex
);
return
paths
;
return
paths
;
...
@@ -1934,7 +1937,7 @@ int soc_dpcm_be_digital_mute(struct snd_soc_pcm_runtime *fe, int mute)
...
@@ -1934,7 +1937,7 @@ int soc_dpcm_be_digital_mute(struct snd_soc_pcm_runtime *fe, int mute)
if
(
be
->
dai_link
->
ignore_suspend
)
if
(
be
->
dai_link
->
ignore_suspend
)
continue
;
continue
;
dev_dbg
(
be
->
dev
,
"BE digital mute %s
\n
"
,
be
->
dai_link
->
name
);
dev_dbg
(
be
->
dev
,
"
ASoC:
BE digital mute %s
\n
"
,
be
->
dai_link
->
name
);
if
(
drv
->
ops
->
digital_mute
&&
dai
->
playback_active
)
if
(
drv
->
ops
->
digital_mute
&&
dai
->
playback_active
)
drv
->
ops
->
digital_mute
(
dai
,
mute
);
drv
->
ops
->
digital_mute
(
dai
,
mute
);
...
@@ -1955,7 +1958,7 @@ static int dpcm_fe_dai_open(struct snd_pcm_substream *fe_substream)
...
@@ -1955,7 +1958,7 @@ static int dpcm_fe_dai_open(struct snd_pcm_substream *fe_substream)
fe
->
dpcm
[
stream
].
runtime
=
fe_substream
->
runtime
;
fe
->
dpcm
[
stream
].
runtime
=
fe_substream
->
runtime
;
if
(
dpcm_path_get
(
fe
,
stream
,
&
list
)
<=
0
)
{
if
(
dpcm_path_get
(
fe
,
stream
,
&
list
)
<=
0
)
{
dev_dbg
(
fe
->
dev
,
"
asoc
: %s no valid %s route
\n
"
,
dev_dbg
(
fe
->
dev
,
"
ASoC
: %s no valid %s route
\n
"
,
fe
->
dai_link
->
name
,
stream
?
"capture"
:
"playback"
);
fe
->
dai_link
->
name
,
stream
?
"capture"
:
"playback"
);
}
}
...
@@ -2039,11 +2042,11 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)
...
@@ -2039,11 +2042,11 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)
capture
,
&
pcm
);
capture
,
&
pcm
);
}
}
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
dev_err
(
rtd
->
card
->
dev
,
"can't create pcm for %s
\n
"
,
dev_err
(
rtd
->
card
->
dev
,
"
ASoC:
can't create pcm for %s
\n
"
,
rtd
->
dai_link
->
name
);
rtd
->
dai_link
->
name
);
return
ret
;
return
ret
;
}
}
dev_dbg
(
rtd
->
card
->
dev
,
"registered pcm #%d %s
\n
"
,
num
,
new_name
);
dev_dbg
(
rtd
->
card
->
dev
,
"
ASoC:
registered pcm #%d %s
\n
"
,
num
,
new_name
);
/* DAPM dai link stream work */
/* DAPM dai link stream work */
INIT_DELAYED_WORK
(
&
rtd
->
delayed_work
,
close_delayed_work
);
INIT_DELAYED_WORK
(
&
rtd
->
delayed_work
,
close_delayed_work
);
...
@@ -2097,7 +2100,9 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)
...
@@ -2097,7 +2100,9 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)
if
(
platform
->
driver
->
pcm_new
)
{
if
(
platform
->
driver
->
pcm_new
)
{
ret
=
platform
->
driver
->
pcm_new
(
rtd
);
ret
=
platform
->
driver
->
pcm_new
(
rtd
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
dev_err
(
platform
->
dev
,
"pcm constructor failed
\n
"
);
dev_err
(
platform
->
dev
,
"ASoC: pcm constructor failed: %d
\n
"
,
ret
);
return
ret
;
return
ret
;
}
}
}
}
...
...
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