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
008a03c0
Commit
008a03c0
authored
Feb 07, 2018
by
Mark Brown
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'asoc/topic/compress' into asoc-next
parents
aa726454
141dfc9e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
30 deletions
+41
-30
sound/soc/soc-compress.c
sound/soc/soc-compress.c
+41
-30
No files found.
sound/soc/soc-compress.c
View file @
008a03c0
...
@@ -40,7 +40,8 @@ static int soc_compr_open(struct snd_compr_stream *cstream)
...
@@ -40,7 +40,8 @@ static int soc_compr_open(struct snd_compr_stream *cstream)
if
(
cpu_dai
->
driver
->
cops
&&
cpu_dai
->
driver
->
cops
->
startup
)
{
if
(
cpu_dai
->
driver
->
cops
&&
cpu_dai
->
driver
->
cops
->
startup
)
{
ret
=
cpu_dai
->
driver
->
cops
->
startup
(
cstream
,
cpu_dai
);
ret
=
cpu_dai
->
driver
->
cops
->
startup
(
cstream
,
cpu_dai
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
dev_err
(
cpu_dai
->
dev
,
"Compress ASoC: can't open interface %s: %d
\n
"
,
dev_err
(
cpu_dai
->
dev
,
"Compress ASoC: can't open interface %s: %d
\n
"
,
cpu_dai
->
name
,
ret
);
cpu_dai
->
name
,
ret
);
goto
out
;
goto
out
;
}
}
...
@@ -49,8 +50,9 @@ static int soc_compr_open(struct snd_compr_stream *cstream)
...
@@ -49,8 +50,9 @@ static int soc_compr_open(struct snd_compr_stream *cstream)
if
(
platform
&&
platform
->
driver
->
compr_ops
&&
platform
->
driver
->
compr_ops
->
open
)
{
if
(
platform
&&
platform
->
driver
->
compr_ops
&&
platform
->
driver
->
compr_ops
->
open
)
{
ret
=
platform
->
driver
->
compr_ops
->
open
(
cstream
);
ret
=
platform
->
driver
->
compr_ops
->
open
(
cstream
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
pr_err
(
"compress asoc: can't open platform %s
\n
"
,
dev_err
(
platform
->
dev
,
platform
->
component
.
name
);
"Compress ASoC: can't open platform %s: %d
\n
"
,
platform
->
component
.
name
,
ret
);
goto
plat_err
;
goto
plat_err
;
}
}
}
}
...
@@ -68,8 +70,9 @@ static int soc_compr_open(struct snd_compr_stream *cstream)
...
@@ -68,8 +70,9 @@ static int soc_compr_open(struct snd_compr_stream *cstream)
__ret
=
component
->
driver
->
compr_ops
->
open
(
cstream
);
__ret
=
component
->
driver
->
compr_ops
->
open
(
cstream
);
if
(
__ret
<
0
)
{
if
(
__ret
<
0
)
{
pr_err
(
"compress asoc: can't open platform %s
\n
"
,
dev_err
(
component
->
dev
,
component
->
name
);
"Compress ASoC: can't open platform %s: %d
\n
"
,
component
->
name
,
__ret
);
ret
=
__ret
;
ret
=
__ret
;
}
}
}
}
...
@@ -79,7 +82,9 @@ static int soc_compr_open(struct snd_compr_stream *cstream)
...
@@ -79,7 +82,9 @@ static int soc_compr_open(struct snd_compr_stream *cstream)
if
(
rtd
->
dai_link
->
compr_ops
&&
rtd
->
dai_link
->
compr_ops
->
startup
)
{
if
(
rtd
->
dai_link
->
compr_ops
&&
rtd
->
dai_link
->
compr_ops
->
startup
)
{
ret
=
rtd
->
dai_link
->
compr_ops
->
startup
(
cstream
);
ret
=
rtd
->
dai_link
->
compr_ops
->
startup
(
cstream
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
pr_err
(
"compress asoc: %s startup failed
\n
"
,
rtd
->
dai_link
->
name
);
dev_err
(
rtd
->
dev
,
"Compress ASoC: %s startup failed: %d
\n
"
,
rtd
->
dai_link
->
name
,
ret
);
goto
machine_err
;
goto
machine_err
;
}
}
}
}
...
@@ -139,18 +144,19 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream)
...
@@ -139,18 +144,19 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream)
if
(
cpu_dai
->
driver
->
cops
&&
cpu_dai
->
driver
->
cops
->
startup
)
{
if
(
cpu_dai
->
driver
->
cops
&&
cpu_dai
->
driver
->
cops
->
startup
)
{
ret
=
cpu_dai
->
driver
->
cops
->
startup
(
cstream
,
cpu_dai
);
ret
=
cpu_dai
->
driver
->
cops
->
startup
(
cstream
,
cpu_dai
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
dev_err
(
cpu_dai
->
dev
,
"Compress ASoC: can't open interface %s: %d
\n
"
,
dev_err
(
cpu_dai
->
dev
,
"Compress ASoC: can't open interface %s: %d
\n
"
,
cpu_dai
->
name
,
ret
);
cpu_dai
->
name
,
ret
);
goto
out
;
goto
out
;
}
}
}
}
if
(
platform
&&
platform
->
driver
->
compr_ops
&&
platform
->
driver
->
compr_ops
->
open
)
{
if
(
platform
&&
platform
->
driver
->
compr_ops
&&
platform
->
driver
->
compr_ops
->
open
)
{
ret
=
platform
->
driver
->
compr_ops
->
open
(
cstream
);
ret
=
platform
->
driver
->
compr_ops
->
open
(
cstream
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
pr_err
(
"compress asoc: can't open platform %s
\n
"
,
dev_err
(
platform
->
dev
,
platform
->
component
.
name
);
"Compress ASoC: can't open platform %s: %d
\n
"
,
platform
->
component
.
name
,
ret
);
goto
plat_err
;
goto
plat_err
;
}
}
}
}
...
@@ -168,8 +174,9 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream)
...
@@ -168,8 +174,9 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream)
__ret
=
component
->
driver
->
compr_ops
->
open
(
cstream
);
__ret
=
component
->
driver
->
compr_ops
->
open
(
cstream
);
if
(
__ret
<
0
)
{
if
(
__ret
<
0
)
{
pr_err
(
"compress asoc: can't open platform %s
\n
"
,
dev_err
(
component
->
dev
,
component
->
name
);
"Compress ASoC: can't open platform %s: %d
\n
"
,
component
->
name
,
__ret
);
ret
=
__ret
;
ret
=
__ret
;
}
}
}
}
...
@@ -179,7 +186,8 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream)
...
@@ -179,7 +186,8 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream)
if
(
fe
->
dai_link
->
compr_ops
&&
fe
->
dai_link
->
compr_ops
->
startup
)
{
if
(
fe
->
dai_link
->
compr_ops
&&
fe
->
dai_link
->
compr_ops
->
startup
)
{
ret
=
fe
->
dai_link
->
compr_ops
->
startup
(
cstream
);
ret
=
fe
->
dai_link
->
compr_ops
->
startup
(
cstream
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
pr_err
(
"compress asoc: %s startup failed
\n
"
,
fe
->
dai_link
->
name
);
pr_err
(
"Compress ASoC: %s startup failed: %d
\n
"
,
fe
->
dai_link
->
name
,
ret
);
goto
machine_err
;
goto
machine_err
;
}
}
}
}
...
@@ -190,7 +198,7 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream)
...
@@ -190,7 +198,7 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream)
if
(
ret
<
0
)
if
(
ret
<
0
)
goto
fe_err
;
goto
fe_err
;
else
if
(
ret
==
0
)
else
if
(
ret
==
0
)
dev_dbg
(
fe
->
dev
,
"ASoC: %s no valid %s route
\n
"
,
dev_dbg
(
fe
->
dev
,
"
Compress
ASoC: %s no valid %s route
\n
"
,
fe
->
dai_link
->
name
,
stream
?
"capture"
:
"playback"
);
fe
->
dai_link
->
name
,
stream
?
"capture"
:
"playback"
);
/* calculate valid and active FE <-> BE dpcms */
/* calculate valid and active FE <-> BE dpcms */
...
@@ -265,10 +273,11 @@ static void close_delayed_work(struct work_struct *work)
...
@@ -265,10 +273,11 @@ 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
);
dev_dbg
(
rtd
->
dev
,
"ASoC: pop wq checking: %s status: %s waiting: %s
\n
"
,
dev_dbg
(
rtd
->
dev
,
codec_dai
->
driver
->
playback
.
stream_name
,
"Compress ASoC: pop wq checking: %s status: %s waiting: %s
\n
"
,
codec_dai
->
playback_active
?
"active"
:
"inactive"
,
codec_dai
->
driver
->
playback
.
stream_name
,
rtd
->
pop_wait
?
"yes"
:
"no"
);
codec_dai
->
playback_active
?
"active"
:
"inactive"
,
rtd
->
pop_wait
?
"yes"
:
"no"
);
/* are we waiting on this codec DAI stream */
/* are we waiting on this codec DAI stream */
if
(
rtd
->
pop_wait
==
1
)
{
if
(
rtd
->
pop_wait
==
1
)
{
...
@@ -307,7 +316,6 @@ static int soc_compr_free(struct snd_compr_stream *cstream)
...
@@ -307,7 +316,6 @@ static int soc_compr_free(struct snd_compr_stream *cstream)
if
(
!
codec_dai
->
active
)
if
(
!
codec_dai
->
active
)
codec_dai
->
rate
=
0
;
codec_dai
->
rate
=
0
;
if
(
rtd
->
dai_link
->
compr_ops
&&
rtd
->
dai_link
->
compr_ops
->
shutdown
)
if
(
rtd
->
dai_link
->
compr_ops
&&
rtd
->
dai_link
->
compr_ops
->
shutdown
)
rtd
->
dai_link
->
compr_ops
->
shutdown
(
cstream
);
rtd
->
dai_link
->
compr_ops
->
shutdown
(
cstream
);
...
@@ -376,7 +384,7 @@ static int soc_compr_free_fe(struct snd_compr_stream *cstream)
...
@@ -376,7 +384,7 @@ static int soc_compr_free_fe(struct snd_compr_stream *cstream)
ret
=
dpcm_be_dai_hw_free
(
fe
,
stream
);
ret
=
dpcm_be_dai_hw_free
(
fe
,
stream
);
if
(
ret
<
0
)
if
(
ret
<
0
)
dev_err
(
fe
->
dev
,
"
compressed hw_free failed
%d
\n
"
,
ret
);
dev_err
(
fe
->
dev
,
"
Compressed ASoC: hw_free failed:
%d
\n
"
,
ret
);
ret
=
dpcm_be_dai_shutdown
(
fe
,
stream
);
ret
=
dpcm_be_dai_shutdown
(
fe
,
stream
);
...
@@ -460,7 +468,6 @@ static int soc_compr_trigger(struct snd_compr_stream *cstream, int cmd)
...
@@ -460,7 +468,6 @@ static int soc_compr_trigger(struct snd_compr_stream *cstream, int cmd)
if
(
cpu_dai
->
driver
->
cops
&&
cpu_dai
->
driver
->
cops
->
trigger
)
if
(
cpu_dai
->
driver
->
cops
&&
cpu_dai
->
driver
->
cops
->
trigger
)
cpu_dai
->
driver
->
cops
->
trigger
(
cstream
,
cmd
,
cpu_dai
);
cpu_dai
->
driver
->
cops
->
trigger
(
cstream
,
cmd
,
cpu_dai
);
switch
(
cmd
)
{
switch
(
cmd
)
{
case
SNDRV_PCM_TRIGGER_START
:
case
SNDRV_PCM_TRIGGER_START
:
snd_soc_dai_digital_mute
(
codec_dai
,
0
,
cstream
->
direction
);
snd_soc_dai_digital_mute
(
codec_dai
,
0
,
cstream
->
direction
);
...
@@ -1108,7 +1115,8 @@ int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num)
...
@@ -1108,7 +1115,8 @@ int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num)
int
playback
=
0
,
capture
=
0
;
int
playback
=
0
,
capture
=
0
;
if
(
rtd
->
num_codecs
>
1
)
{
if
(
rtd
->
num_codecs
>
1
)
{
dev_err
(
rtd
->
card
->
dev
,
"Multicodec not supported for compressed stream
\n
"
);
dev_err
(
rtd
->
card
->
dev
,
"Compress ASoC: Multicodec not supported
\n
"
);
return
-
EINVAL
;
return
-
EINVAL
;
}
}
...
@@ -1126,8 +1134,9 @@ int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num)
...
@@ -1126,8 +1134,9 @@ int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num)
* should be set, check for that (xor)
* should be set, check for that (xor)
*/
*/
if
(
playback
+
capture
!=
1
)
{
if
(
playback
+
capture
!=
1
)
{
dev_err
(
rtd
->
card
->
dev
,
"Invalid direction for compress P %d, C %d
\n
"
,
dev_err
(
rtd
->
card
->
dev
,
playback
,
capture
);
"Compress ASoC: Invalid direction for P %d, C %d
\n
"
,
playback
,
capture
);
return
-
EINVAL
;
return
-
EINVAL
;
}
}
...
@@ -1155,8 +1164,9 @@ int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num)
...
@@ -1155,8 +1164,9 @@ int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num)
rtd
->
dai_link
->
dpcm_playback
,
rtd
->
dai_link
->
dpcm_playback
,
rtd
->
dai_link
->
dpcm_capture
,
&
be_pcm
);
rtd
->
dai_link
->
dpcm_capture
,
&
be_pcm
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
dev_err
(
rtd
->
card
->
dev
,
"ASoC: can't create compressed for %s
\n
"
,
dev_err
(
rtd
->
card
->
dev
,
rtd
->
dai_link
->
name
);
"Compress ASoC: can't create compressed for %s: %d
\n
"
,
rtd
->
dai_link
->
name
,
ret
);
goto
compr_err
;
goto
compr_err
;
}
}
...
@@ -1199,8 +1209,9 @@ int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num)
...
@@ -1199,8 +1209,9 @@ int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num)
new_name
,
compr
);
new_name
,
compr
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
component
=
rtd
->
codec_dai
->
component
;
component
=
rtd
->
codec_dai
->
component
;
pr_err
(
"compress asoc: can't create compress for codec %s
\n
"
,
dev_err
(
component
->
dev
,
component
->
name
);
"Compress ASoC: can't create compress for codec %s: %d
\n
"
,
component
->
name
,
ret
);
goto
compr_err
;
goto
compr_err
;
}
}
...
@@ -1210,8 +1221,8 @@ int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num)
...
@@ -1210,8 +1221,8 @@ int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num)
rtd
->
compr
=
compr
;
rtd
->
compr
=
compr
;
compr
->
private_data
=
rtd
;
compr
->
private_data
=
rtd
;
printk
(
KERN_INFO
"compress asoc: %s <-> %s mapping ok
\n
"
,
codec_dai
->
name
,
dev_info
(
rtd
->
card
->
dev
,
"Compress ASoC: %s <-> %s mapping ok
\n
"
,
cpu_dai
->
name
);
codec_dai
->
name
,
cpu_dai
->
name
);
return
ret
;
return
ret
;
compr_err:
compr_err:
...
...
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