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
338f803a
Commit
338f803a
authored
Mar 28, 2018
by
Mark Brown
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'asoc/topic/pcm1681' into asoc-next
parents
e22d7d54
7dbbaa51
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
33 deletions
+29
-33
sound/soc/codecs/pcm1681.c
sound/soc/codecs/pcm1681.c
+29
-33
No files found.
sound/soc/codecs/pcm1681.c
View file @
338f803a
...
...
@@ -90,9 +90,9 @@ struct pcm1681_private {
static
const
int
pcm1681_deemph
[]
=
{
44100
,
48000
,
32000
};
static
int
pcm1681_set_deemph
(
struct
snd_soc_co
dec
*
codec
)
static
int
pcm1681_set_deemph
(
struct
snd_soc_co
mponent
*
component
)
{
struct
pcm1681_private
*
priv
=
snd_soc_co
dec_get_drvdata
(
codec
);
struct
pcm1681_private
*
priv
=
snd_soc_co
mponent_get_drvdata
(
component
);
int
i
=
0
,
val
=
-
1
,
enable
=
0
;
if
(
priv
->
deemph
)
{
...
...
@@ -120,8 +120,8 @@ static int pcm1681_set_deemph(struct snd_soc_codec *codec)
static
int
pcm1681_get_deemph
(
struct
snd_kcontrol
*
kcontrol
,
struct
snd_ctl_elem_value
*
ucontrol
)
{
struct
snd_soc_co
dec
*
codec
=
snd_soc_kcontrol_codec
(
kcontrol
);
struct
pcm1681_private
*
priv
=
snd_soc_co
dec_get_drvdata
(
codec
);
struct
snd_soc_co
mponent
*
component
=
snd_soc_kcontrol_component
(
kcontrol
);
struct
pcm1681_private
*
priv
=
snd_soc_co
mponent_get_drvdata
(
component
);
ucontrol
->
value
.
integer
.
value
[
0
]
=
priv
->
deemph
;
...
...
@@ -131,23 +131,23 @@ static int pcm1681_get_deemph(struct snd_kcontrol *kcontrol,
static
int
pcm1681_put_deemph
(
struct
snd_kcontrol
*
kcontrol
,
struct
snd_ctl_elem_value
*
ucontrol
)
{
struct
snd_soc_co
dec
*
codec
=
snd_soc_kcontrol_codec
(
kcontrol
);
struct
pcm1681_private
*
priv
=
snd_soc_co
dec_get_drvdata
(
codec
);
struct
snd_soc_co
mponent
*
component
=
snd_soc_kcontrol_component
(
kcontrol
);
struct
pcm1681_private
*
priv
=
snd_soc_co
mponent_get_drvdata
(
component
);
priv
->
deemph
=
ucontrol
->
value
.
integer
.
value
[
0
];
return
pcm1681_set_deemph
(
co
dec
);
return
pcm1681_set_deemph
(
co
mponent
);
}
static
int
pcm1681_set_dai_fmt
(
struct
snd_soc_dai
*
codec_dai
,
unsigned
int
format
)
{
struct
snd_soc_co
dec
*
codec
=
codec_dai
->
codec
;
struct
pcm1681_private
*
priv
=
snd_soc_co
dec_get_drvdata
(
codec
);
struct
snd_soc_co
mponent
*
component
=
codec_dai
->
component
;
struct
pcm1681_private
*
priv
=
snd_soc_co
mponent_get_drvdata
(
component
);
/* The PCM1681 can only be slave to all clocks */
if
((
format
&
SND_SOC_DAIFMT_MASTER_MASK
)
!=
SND_SOC_DAIFMT_CBS_CFS
)
{
dev_err
(
co
dec
->
dev
,
"Invalid clocking mode
\n
"
);
dev_err
(
co
mponent
->
dev
,
"Invalid clocking mode
\n
"
);
return
-
EINVAL
;
}
...
...
@@ -158,8 +158,8 @@ static int pcm1681_set_dai_fmt(struct snd_soc_dai *codec_dai,
static
int
pcm1681_digital_mute
(
struct
snd_soc_dai
*
dai
,
int
mute
)
{
struct
snd_soc_co
dec
*
codec
=
dai
->
codec
;
struct
pcm1681_private
*
priv
=
snd_soc_co
dec_get_drvdata
(
codec
);
struct
snd_soc_co
mponent
*
component
=
dai
->
component
;
struct
pcm1681_private
*
priv
=
snd_soc_co
mponent_get_drvdata
(
component
);
int
val
;
if
(
mute
)
...
...
@@ -174,8 +174,8 @@ static int pcm1681_hw_params(struct snd_pcm_substream *substream,
struct
snd_pcm_hw_params
*
params
,
struct
snd_soc_dai
*
dai
)
{
struct
snd_soc_co
dec
*
codec
=
dai
->
codec
;
struct
pcm1681_private
*
priv
=
snd_soc_co
dec_get_drvdata
(
codec
);
struct
snd_soc_co
mponent
*
component
=
dai
->
component
;
struct
pcm1681_private
*
priv
=
snd_soc_co
mponent_get_drvdata
(
component
);
int
val
=
0
,
ret
;
priv
->
rate
=
params_rate
(
params
);
...
...
@@ -200,7 +200,7 @@ static int pcm1681_hw_params(struct snd_pcm_substream *substream,
val
=
0x05
;
break
;
default:
dev_err
(
co
dec
->
dev
,
"Invalid DAI format
\n
"
);
dev_err
(
co
mponent
->
dev
,
"Invalid DAI format
\n
"
);
return
-
EINVAL
;
}
...
...
@@ -208,7 +208,7 @@ static int pcm1681_hw_params(struct snd_pcm_substream *substream,
if
(
ret
<
0
)
return
ret
;
return
pcm1681_set_deemph
(
co
dec
);
return
pcm1681_set_deemph
(
co
mponent
);
}
static
const
struct
snd_soc_dai_ops
pcm1681_dai_ops
=
{
...
...
@@ -288,15 +288,17 @@ static const struct regmap_config pcm1681_regmap = {
.
readable_reg
=
pcm1681_accessible_reg
,
};
static
const
struct
snd_soc_codec_driver
soc_codec_dev_pcm1681
=
{
.
component_driver
=
{
static
const
struct
snd_soc_component_driver
soc_component_dev_pcm1681
=
{
.
controls
=
pcm1681_controls
,
.
num_controls
=
ARRAY_SIZE
(
pcm1681_controls
),
.
dapm_widgets
=
pcm1681_dapm_widgets
,
.
num_dapm_widgets
=
ARRAY_SIZE
(
pcm1681_dapm_widgets
),
.
dapm_routes
=
pcm1681_dapm_routes
,
.
num_dapm_routes
=
ARRAY_SIZE
(
pcm1681_dapm_routes
),
},
.
idle_bias_on
=
1
,
.
use_pmdown_time
=
1
,
.
endianness
=
1
,
.
non_legacy_dai_naming
=
1
,
};
static
const
struct
i2c_device_id
pcm1681_i2c_id
[]
=
{
...
...
@@ -324,16 +326,11 @@ static int pcm1681_i2c_probe(struct i2c_client *client,
i2c_set_clientdata
(
client
,
priv
);
return
snd_soc_register_codec
(
&
client
->
dev
,
&
soc_codec_dev_pcm1681
,
return
devm_snd_soc_register_component
(
&
client
->
dev
,
&
soc_component_dev_pcm1681
,
&
pcm1681_dai
,
1
);
}
static
int
pcm1681_i2c_remove
(
struct
i2c_client
*
client
)
{
snd_soc_unregister_codec
(
&
client
->
dev
);
return
0
;
}
static
struct
i2c_driver
pcm1681_i2c_driver
=
{
.
driver
=
{
.
name
=
"pcm1681"
,
...
...
@@ -341,7 +338,6 @@ static struct i2c_driver pcm1681_i2c_driver = {
},
.
id_table
=
pcm1681_i2c_id
,
.
probe
=
pcm1681_i2c_probe
,
.
remove
=
pcm1681_i2c_remove
,
};
module_i2c_driver
(
pcm1681_i2c_driver
);
...
...
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