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
556d8b55
Commit
556d8b55
authored
Feb 11, 2013
by
Mark Brown
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'asoc/topic/of' into asoc-next
parents
f0f3214e
8c2d6a9f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
110 additions
and
1 deletion
+110
-1
include/sound/soc-dai.h
include/sound/soc-dai.h
+1
-1
include/sound/soc.h
include/sound/soc.h
+2
-0
sound/soc/soc-core.c
sound/soc/soc-core.c
+107
-0
No files found.
include/sound/soc-dai.h
View file @
556d8b55
...
...
@@ -45,7 +45,7 @@ struct snd_compr_stream;
* sending or receiving PCM data in a frame. This can be used to save power.
*/
#define SND_SOC_DAIFMT_CONT (1 << 4)
/* continuous clock */
#define SND_SOC_DAIFMT_GATED (
2
<< 4)
/* clock is gated */
#define SND_SOC_DAIFMT_GATED (
0
<< 4)
/* clock is gated */
/*
* DAI hardware signal inversions.
...
...
include/sound/soc.h
View file @
556d8b55
...
...
@@ -1171,6 +1171,8 @@ int snd_soc_of_parse_card_name(struct snd_soc_card *card,
const
char
*
propname
);
int
snd_soc_of_parse_audio_routing
(
struct
snd_soc_card
*
card
,
const
char
*
propname
);
unsigned
int
snd_soc_of_parse_daifmt
(
struct
device_node
*
np
,
const
char
*
prefix
);
#include <sound/soc-dai.h>
...
...
sound/soc/soc-core.c
View file @
556d8b55
...
...
@@ -4218,6 +4218,113 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
}
EXPORT_SYMBOL_GPL
(
snd_soc_of_parse_audio_routing
);
unsigned
int
snd_soc_of_parse_daifmt
(
struct
device_node
*
np
,
const
char
*
prefix
)
{
int
ret
,
i
;
char
prop
[
128
];
unsigned
int
format
=
0
;
int
bit
,
frame
;
const
char
*
str
;
struct
{
char
*
name
;
unsigned
int
val
;
}
of_fmt_table
[]
=
{
{
"i2s"
,
SND_SOC_DAIFMT_I2S
},
{
"right_j"
,
SND_SOC_DAIFMT_RIGHT_J
},
{
"left_j"
,
SND_SOC_DAIFMT_LEFT_J
},
{
"dsp_a"
,
SND_SOC_DAIFMT_DSP_A
},
{
"dsp_b"
,
SND_SOC_DAIFMT_DSP_B
},
{
"ac97"
,
SND_SOC_DAIFMT_AC97
},
{
"pdm"
,
SND_SOC_DAIFMT_PDM
},
{
"msb"
,
SND_SOC_DAIFMT_MSB
},
{
"lsb"
,
SND_SOC_DAIFMT_LSB
},
};
if
(
!
prefix
)
prefix
=
""
;
/*
* check "[prefix]format = xxx"
* SND_SOC_DAIFMT_FORMAT_MASK area
*/
snprintf
(
prop
,
sizeof
(
prop
),
"%sformat"
,
prefix
);
ret
=
of_property_read_string
(
np
,
prop
,
&
str
);
if
(
ret
==
0
)
{
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
of_fmt_table
);
i
++
)
{
if
(
strcmp
(
str
,
of_fmt_table
[
i
].
name
)
==
0
)
{
format
|=
of_fmt_table
[
i
].
val
;
break
;
}
}
}
/*
* check "[prefix]continuous-clock"
* SND_SOC_DAIFMT_CLOCK_MASK area
*/
snprintf
(
prop
,
sizeof
(
prop
),
"%scontinuous-clock"
,
prefix
);
if
(
of_get_property
(
np
,
prop
,
NULL
))
format
|=
SND_SOC_DAIFMT_CONT
;
else
format
|=
SND_SOC_DAIFMT_GATED
;
/*
* check "[prefix]bitclock-inversion"
* check "[prefix]frame-inversion"
* SND_SOC_DAIFMT_INV_MASK area
*/
snprintf
(
prop
,
sizeof
(
prop
),
"%sbitclock-inversion"
,
prefix
);
bit
=
!!
of_get_property
(
np
,
prop
,
NULL
);
snprintf
(
prop
,
sizeof
(
prop
),
"%sframe-inversion"
,
prefix
);
frame
=
!!
of_get_property
(
np
,
prop
,
NULL
);
switch
((
bit
<<
4
)
+
frame
)
{
case
0x11
:
format
|=
SND_SOC_DAIFMT_IB_IF
;
break
;
case
0x10
:
format
|=
SND_SOC_DAIFMT_IB_NF
;
break
;
case
0x01
:
format
|=
SND_SOC_DAIFMT_NB_IF
;
break
;
default:
/* SND_SOC_DAIFMT_NB_NF is default */
break
;
}
/*
* check "[prefix]bitclock-master"
* check "[prefix]frame-master"
* SND_SOC_DAIFMT_MASTER_MASK area
*/
snprintf
(
prop
,
sizeof
(
prop
),
"%sbitclock-master"
,
prefix
);
bit
=
!!
of_get_property
(
np
,
prop
,
NULL
);
snprintf
(
prop
,
sizeof
(
prop
),
"%sframe-master"
,
prefix
);
frame
=
!!
of_get_property
(
np
,
prop
,
NULL
);
switch
((
bit
<<
4
)
+
frame
)
{
case
0x11
:
format
|=
SND_SOC_DAIFMT_CBM_CFM
;
break
;
case
0x10
:
format
|=
SND_SOC_DAIFMT_CBM_CFS
;
break
;
case
0x01
:
format
|=
SND_SOC_DAIFMT_CBS_CFM
;
break
;
default:
format
|=
SND_SOC_DAIFMT_CBS_CFS
;
break
;
}
return
format
;
}
EXPORT_SYMBOL_GPL
(
snd_soc_of_parse_daifmt
);
static
int
__init
snd_soc_init
(
void
)
{
#ifdef CONFIG_DEBUG_FS
...
...
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