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
nexedi
linux
Commits
f6b967ab
Commit
f6b967ab
authored
Oct 24, 2013
by
Mark Brown
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'asoc/topic/si476x' into asoc-next
parents
1f7f8e04
cfcff69a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
48 deletions
+16
-48
sound/soc/codecs/si476x.c
sound/soc/codecs/si476x.c
+16
-48
No files found.
sound/soc/codecs/si476x.c
View file @
f6b967ab
...
@@ -60,48 +60,6 @@ enum si476x_pcm_format {
...
@@ -60,48 +60,6 @@ enum si476x_pcm_format {
SI476X_PCM_FORMAT_S24_LE
=
6
,
SI476X_PCM_FORMAT_S24_LE
=
6
,
};
};
static
unsigned
int
si476x_codec_read
(
struct
snd_soc_codec
*
codec
,
unsigned
int
reg
)
{
int
err
;
unsigned
int
val
;
struct
si476x_core
*
core
=
codec
->
control_data
;
si476x_core_lock
(
core
);
if
(
!
si476x_core_is_powered_up
(
core
))
regcache_cache_only
(
core
->
regmap
,
true
);
err
=
regmap_read
(
core
->
regmap
,
reg
,
&
val
);
if
(
!
si476x_core_is_powered_up
(
core
))
regcache_cache_only
(
core
->
regmap
,
false
);
si476x_core_unlock
(
core
);
if
(
err
<
0
)
return
err
;
return
val
;
}
static
int
si476x_codec_write
(
struct
snd_soc_codec
*
codec
,
unsigned
int
reg
,
unsigned
int
val
)
{
int
err
;
struct
si476x_core
*
core
=
codec
->
control_data
;
si476x_core_lock
(
core
);
if
(
!
si476x_core_is_powered_up
(
core
))
regcache_cache_only
(
core
->
regmap
,
true
);
err
=
regmap_write
(
core
->
regmap
,
reg
,
val
);
if
(
!
si476x_core_is_powered_up
(
core
))
regcache_cache_only
(
core
->
regmap
,
false
);
si476x_core_unlock
(
core
);
return
err
;
}
static
const
struct
snd_soc_dapm_widget
si476x_dapm_widgets
[]
=
{
static
const
struct
snd_soc_dapm_widget
si476x_dapm_widgets
[]
=
{
SND_SOC_DAPM_OUTPUT
(
"LOUT"
),
SND_SOC_DAPM_OUTPUT
(
"LOUT"
),
SND_SOC_DAPM_OUTPUT
(
"ROUT"
),
SND_SOC_DAPM_OUTPUT
(
"ROUT"
),
...
@@ -115,6 +73,7 @@ static const struct snd_soc_dapm_route si476x_dapm_routes[] = {
...
@@ -115,6 +73,7 @@ static const struct snd_soc_dapm_route si476x_dapm_routes[] = {
static
int
si476x_codec_set_dai_fmt
(
struct
snd_soc_dai
*
codec_dai
,
static
int
si476x_codec_set_dai_fmt
(
struct
snd_soc_dai
*
codec_dai
,
unsigned
int
fmt
)
unsigned
int
fmt
)
{
{
struct
si476x_core
*
core
=
i2c_mfd_cell_to_core
(
codec_dai
->
dev
);
int
err
;
int
err
;
u16
format
=
0
;
u16
format
=
0
;
...
@@ -178,9 +137,14 @@ static int si476x_codec_set_dai_fmt(struct snd_soc_dai *codec_dai,
...
@@ -178,9 +137,14 @@ static int si476x_codec_set_dai_fmt(struct snd_soc_dai *codec_dai,
return
-
EINVAL
;
return
-
EINVAL
;
}
}
si476x_core_lock
(
core
);
err
=
snd_soc_update_bits
(
codec_dai
->
codec
,
SI476X_DIGITAL_IO_OUTPUT_FORMAT
,
err
=
snd_soc_update_bits
(
codec_dai
->
codec
,
SI476X_DIGITAL_IO_OUTPUT_FORMAT
,
SI476X_DIGITAL_IO_OUTPUT_FORMAT_MASK
,
SI476X_DIGITAL_IO_OUTPUT_FORMAT_MASK
,
format
);
format
);
si476x_core_unlock
(
core
);
if
(
err
<
0
)
{
if
(
err
<
0
)
{
dev_err
(
codec_dai
->
codec
->
dev
,
"Failed to set output format
\n
"
);
dev_err
(
codec_dai
->
codec
->
dev
,
"Failed to set output format
\n
"
);
return
err
;
return
err
;
...
@@ -193,6 +157,7 @@ static int si476x_codec_hw_params(struct snd_pcm_substream *substream,
...
@@ -193,6 +157,7 @@ static int si476x_codec_hw_params(struct snd_pcm_substream *substream,
struct
snd_pcm_hw_params
*
params
,
struct
snd_pcm_hw_params
*
params
,
struct
snd_soc_dai
*
dai
)
struct
snd_soc_dai
*
dai
)
{
{
struct
si476x_core
*
core
=
i2c_mfd_cell_to_core
(
dai
->
dev
);
int
rate
,
width
,
err
;
int
rate
,
width
,
err
;
rate
=
params_rate
(
params
);
rate
=
params_rate
(
params
);
...
@@ -218,11 +183,13 @@ static int si476x_codec_hw_params(struct snd_pcm_substream *substream,
...
@@ -218,11 +183,13 @@ static int si476x_codec_hw_params(struct snd_pcm_substream *substream,
return
-
EINVAL
;
return
-
EINVAL
;
}
}
si476x_core_lock
(
core
);
err
=
snd_soc_write
(
dai
->
codec
,
SI476X_DIGITAL_IO_OUTPUT_SAMPLE_RATE
,
err
=
snd_soc_write
(
dai
->
codec
,
SI476X_DIGITAL_IO_OUTPUT_SAMPLE_RATE
,
rate
);
rate
);
if
(
err
<
0
)
{
if
(
err
<
0
)
{
dev_err
(
dai
->
codec
->
dev
,
"Failed to set sample rate
\n
"
);
dev_err
(
dai
->
codec
->
dev
,
"Failed to set sample rate
\n
"
);
return
err
;
goto
out
;
}
}
err
=
snd_soc_update_bits
(
dai
->
codec
,
SI476X_DIGITAL_IO_OUTPUT_FORMAT
,
err
=
snd_soc_update_bits
(
dai
->
codec
,
SI476X_DIGITAL_IO_OUTPUT_FORMAT
,
...
@@ -231,15 +198,18 @@ static int si476x_codec_hw_params(struct snd_pcm_substream *substream,
...
@@ -231,15 +198,18 @@ static int si476x_codec_hw_params(struct snd_pcm_substream *substream,
(
width
<<
SI476X_DIGITAL_IO_SAMPLE_SIZE_SHIFT
));
(
width
<<
SI476X_DIGITAL_IO_SAMPLE_SIZE_SHIFT
));
if
(
err
<
0
)
{
if
(
err
<
0
)
{
dev_err
(
dai
->
codec
->
dev
,
"Failed to set output width
\n
"
);
dev_err
(
dai
->
codec
->
dev
,
"Failed to set output width
\n
"
);
return
err
;
goto
out
;
}
}
return
0
;
out:
si476x_core_unlock
(
core
);
return
err
;
}
}
static
int
si476x_codec_probe
(
struct
snd_soc_codec
*
codec
)
static
int
si476x_codec_probe
(
struct
snd_soc_codec
*
codec
)
{
{
codec
->
control_data
=
i2c_mfd_cell_to_core
(
codec
->
dev
);
codec
->
control_data
=
dev_get_regmap
(
codec
->
dev
->
parent
,
NULL
);
return
0
;
return
0
;
}
}
...
@@ -268,8 +238,6 @@ static struct snd_soc_dai_driver si476x_dai = {
...
@@ -268,8 +238,6 @@ static struct snd_soc_dai_driver si476x_dai = {
static
struct
snd_soc_codec_driver
soc_codec_dev_si476x
=
{
static
struct
snd_soc_codec_driver
soc_codec_dev_si476x
=
{
.
probe
=
si476x_codec_probe
,
.
probe
=
si476x_codec_probe
,
.
read
=
si476x_codec_read
,
.
write
=
si476x_codec_write
,
.
dapm_widgets
=
si476x_dapm_widgets
,
.
dapm_widgets
=
si476x_dapm_widgets
,
.
num_dapm_widgets
=
ARRAY_SIZE
(
si476x_dapm_widgets
),
.
num_dapm_widgets
=
ARRAY_SIZE
(
si476x_dapm_widgets
),
.
dapm_routes
=
si476x_dapm_routes
,
.
dapm_routes
=
si476x_dapm_routes
,
...
...
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