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
ed87aabf
Commit
ed87aabf
authored
Oct 24, 2013
by
Mark Brown
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'asoc/topic/max9850' into asoc-next
parents
4131770d
06841662
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
10 deletions
+29
-10
sound/soc/codecs/max9850.c
sound/soc/codecs/max9850.c
+29
-10
No files found.
sound/soc/codecs/max9850.c
View file @
ed87aabf
...
...
@@ -18,6 +18,7 @@
#include <linux/module.h>
#include <linux/init.h>
#include <linux/i2c.h>
#include <linux/regmap.h>
#include <linux/slab.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
...
...
@@ -27,18 +28,26 @@
#include "max9850.h"
struct
max9850_priv
{
struct
regmap
*
regmap
;
unsigned
int
sysclk
;
};
/* max9850 register cache */
static
const
u8
max9850_reg
[
MAX9850_CACHEREGNUM
]
=
{
0x00
,
0x00
,
0x0c
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
static
const
struct
reg_default
max9850_reg
[]
=
{
{
2
,
0x0c
},
{
3
,
0x00
},
{
4
,
0x00
},
{
5
,
0x00
},
{
6
,
0x00
},
{
7
,
0x00
},
{
8
,
0x00
},
{
9
,
0x00
},
{
10
,
0x00
},
};
/* these registers are not used at the moment but provided for the sake of
* completeness */
static
int
max9850_volatile_register
(
struct
snd_soc_codec
*
codec
,
unsigned
int
reg
)
static
bool
max9850_volatile_register
(
struct
device
*
dev
,
unsigned
int
reg
)
{
switch
(
reg
)
{
case
MAX9850_STATUSA
:
...
...
@@ -49,6 +58,15 @@ static int max9850_volatile_register(struct snd_soc_codec *codec,
}
}
static
const
struct
regmap_config
max9850_regmap
=
{
.
reg_bits
=
8
,
.
val_bits
=
8
,
.
max_register
=
MAX9850_DIGITAL_AUDIO
,
.
volatile_reg
=
max9850_volatile_register
,
.
cache_type
=
REGCACHE_RBTREE
,
};
static
const
unsigned
int
max9850_tlv
[]
=
{
TLV_DB_RANGE_HEAD
(
4
),
0x18
,
0x1f
,
TLV_DB_SCALE_ITEM
(
-
7450
,
400
,
0
),
...
...
@@ -225,6 +243,7 @@ static int max9850_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
static
int
max9850_set_bias_level
(
struct
snd_soc_codec
*
codec
,
enum
snd_soc_bias_level
level
)
{
struct
max9850_priv
*
max9850
=
snd_soc_codec_get_drvdata
(
codec
);
int
ret
;
switch
(
level
)
{
...
...
@@ -234,7 +253,7 @@ static int max9850_set_bias_level(struct snd_soc_codec *codec,
break
;
case
SND_SOC_BIAS_STANDBY
:
if
(
codec
->
dapm
.
bias_level
==
SND_SOC_BIAS_OFF
)
{
ret
=
snd_soc_cache_sync
(
codec
);
ret
=
regcache_sync
(
max9850
->
regmap
);
if
(
ret
)
{
dev_err
(
codec
->
dev
,
"Failed to sync cache: %d
\n
"
,
ret
);
...
...
@@ -295,7 +314,7 @@ static int max9850_probe(struct snd_soc_codec *codec)
{
int
ret
;
ret
=
snd_soc_codec_set_cache_io
(
codec
,
8
,
8
,
SND_SOC_
I2C
);
ret
=
snd_soc_codec_set_cache_io
(
codec
,
8
,
8
,
SND_SOC_
REGMAP
);
if
(
ret
<
0
)
{
dev_err
(
codec
->
dev
,
"Failed to set cache I/O: %d
\n
"
,
ret
);
return
ret
;
...
...
@@ -316,10 +335,6 @@ static struct snd_soc_codec_driver soc_codec_dev_max9850 = {
.
suspend
=
max9850_suspend
,
.
resume
=
max9850_resume
,
.
set_bias_level
=
max9850_set_bias_level
,
.
reg_cache_size
=
ARRAY_SIZE
(
max9850_reg
),
.
reg_word_size
=
sizeof
(
u8
),
.
reg_cache_default
=
max9850_reg
,
.
volatile_register
=
max9850_volatile_register
,
.
controls
=
max9850_controls
,
.
num_controls
=
ARRAY_SIZE
(
max9850_controls
),
...
...
@@ -340,6 +355,10 @@ static int max9850_i2c_probe(struct i2c_client *i2c,
if
(
max9850
==
NULL
)
return
-
ENOMEM
;
max9850
->
regmap
=
devm_regmap_init_i2c
(
i2c
,
&
max9850_regmap
);
if
(
IS_ERR
(
max9850
->
regmap
))
return
PTR_ERR
(
max9850
->
regmap
);
i2c_set_clientdata
(
i2c
,
max9850
);
ret
=
snd_soc_register_codec
(
&
i2c
->
dev
,
...
...
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