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
57ada4c5
Commit
57ada4c5
authored
Nov 08, 2013
by
Mark Brown
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'asoc/topic/ab8500' into asoc-next
parents
3d0be4a5
166a34d2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
47 deletions
+45
-47
sound/soc/codecs/ab8500-codec.c
sound/soc/codecs/ab8500-codec.c
+45
-47
No files found.
sound/soc/codecs/ab8500-codec.c
View file @
57ada4c5
...
@@ -126,6 +126,8 @@ struct ab8500_codec_drvdata_dbg {
...
@@ -126,6 +126,8 @@ struct ab8500_codec_drvdata_dbg {
/* Private data for AB8500 device-driver */
/* Private data for AB8500 device-driver */
struct
ab8500_codec_drvdata
{
struct
ab8500_codec_drvdata
{
struct
regmap
*
regmap
;
/* Sidetone */
/* Sidetone */
long
*
sid_fir_values
;
long
*
sid_fir_values
;
enum
sid_state
sid_status
;
enum
sid_state
sid_status
;
...
@@ -166,49 +168,35 @@ static inline const char *amic_type_str(enum amic_type type)
...
@@ -166,49 +168,35 @@ static inline const char *amic_type_str(enum amic_type type)
*/
*/
/* Read a register from the audio-bank of AB8500 */
/* Read a register from the audio-bank of AB8500 */
static
unsigned
int
ab8500_codec_read_reg
(
struct
snd_soc_codec
*
codec
,
static
int
ab8500_codec_read_reg
(
void
*
context
,
unsigned
int
reg
,
unsigned
int
reg
)
unsigned
int
*
value
)
{
{
struct
device
*
dev
=
context
;
int
status
;
int
status
;
unsigned
int
value
=
0
;
u8
value8
;
u8
value8
;
status
=
abx500_get_register_interruptible
(
codec
->
dev
,
AB8500_AUDIO
,
status
=
abx500_get_register_interruptible
(
dev
,
AB8500_AUDIO
,
reg
,
&
value8
);
reg
,
&
value8
);
if
(
status
<
0
)
{
*
value
=
(
unsigned
int
)
value8
;
dev_err
(
codec
->
dev
,
"%s: ERROR: Register (0x%02x:0x%02x) read failed (%d).
\n
"
,
__func__
,
(
u8
)
AB8500_AUDIO
,
(
u8
)
reg
,
status
);
}
else
{
dev_dbg
(
codec
->
dev
,
"%s: Read 0x%02x from register 0x%02x:0x%02x
\n
"
,
__func__
,
value8
,
(
u8
)
AB8500_AUDIO
,
(
u8
)
reg
);
value
=
(
unsigned
int
)
value8
;
}
return
value
;
return
status
;
}
}
/* Write to a register in the audio-bank of AB8500 */
/* Write to a register in the audio-bank of AB8500 */
static
int
ab8500_codec_write_reg
(
struct
snd_soc_codec
*
codec
,
static
int
ab8500_codec_write_reg
(
void
*
context
,
unsigned
int
reg
,
unsigned
int
reg
,
unsigned
int
value
)
unsigned
int
value
)
{
{
int
status
;
struct
device
*
dev
=
context
;
status
=
abx500_set_register_interruptible
(
codec
->
dev
,
AB8500_AUDIO
,
return
abx500_set_register_interruptible
(
dev
,
AB8500_AUDIO
,
reg
,
value
);
reg
,
value
);
if
(
status
<
0
)
dev_err
(
codec
->
dev
,
"%s: ERROR: Register (%02x:%02x) write failed (%d).
\n
"
,
__func__
,
(
u8
)
AB8500_AUDIO
,
(
u8
)
reg
,
status
);
else
dev_dbg
(
codec
->
dev
,
"%s: Wrote 0x%02x into register %02x:%02x
\n
"
,
__func__
,
(
u8
)
value
,
(
u8
)
AB8500_AUDIO
,
(
u8
)
reg
);
return
status
;
}
}
static
const
struct
regmap_config
ab8500_codec_regmap
=
{
.
reg_read
=
ab8500_codec_read_reg
,
.
reg_write
=
ab8500_codec_write_reg
,
};
/*
/*
* Controls - DAPM
* Controls - DAPM
*/
*/
...
@@ -2312,17 +2300,17 @@ static int ab8500_codec_set_dai_tdm_slot(struct snd_soc_dai *dai,
...
@@ -2312,17 +2300,17 @@ static int ab8500_codec_set_dai_tdm_slot(struct snd_soc_dai *dai,
case
0
:
case
0
:
break
;
break
;
case
1
:
case
1
:
slot
=
f
ind_first_bit
((
unsigned
long
*
)
&
tx_mask
,
32
);
slot
=
f
fs
(
tx_mask
);
snd_soc_update_bits
(
codec
,
AB8500_DASLOTCONF1
,
mask
,
slot
);
snd_soc_update_bits
(
codec
,
AB8500_DASLOTCONF1
,
mask
,
slot
);
snd_soc_update_bits
(
codec
,
AB8500_DASLOTCONF3
,
mask
,
slot
);
snd_soc_update_bits
(
codec
,
AB8500_DASLOTCONF3
,
mask
,
slot
);
snd_soc_update_bits
(
codec
,
AB8500_DASLOTCONF2
,
mask
,
slot
);
snd_soc_update_bits
(
codec
,
AB8500_DASLOTCONF2
,
mask
,
slot
);
snd_soc_update_bits
(
codec
,
AB8500_DASLOTCONF4
,
mask
,
slot
);
snd_soc_update_bits
(
codec
,
AB8500_DASLOTCONF4
,
mask
,
slot
);
break
;
break
;
case
2
:
case
2
:
slot
=
f
ind_first_bit
((
unsigned
long
*
)
&
tx_mask
,
32
);
slot
=
f
fs
(
tx_mask
);
snd_soc_update_bits
(
codec
,
AB8500_DASLOTCONF1
,
mask
,
slot
);
snd_soc_update_bits
(
codec
,
AB8500_DASLOTCONF1
,
mask
,
slot
);
snd_soc_update_bits
(
codec
,
AB8500_DASLOTCONF3
,
mask
,
slot
);
snd_soc_update_bits
(
codec
,
AB8500_DASLOTCONF3
,
mask
,
slot
);
slot
=
f
ind_next_bit
((
unsigned
long
*
)
&
tx_mask
,
32
,
slot
+
1
);
slot
=
f
ls
(
tx_mask
);
snd_soc_update_bits
(
codec
,
AB8500_DASLOTCONF2
,
mask
,
slot
);
snd_soc_update_bits
(
codec
,
AB8500_DASLOTCONF2
,
mask
,
slot
);
snd_soc_update_bits
(
codec
,
AB8500_DASLOTCONF4
,
mask
,
slot
);
snd_soc_update_bits
(
codec
,
AB8500_DASLOTCONF4
,
mask
,
slot
);
break
;
break
;
...
@@ -2353,18 +2341,18 @@ static int ab8500_codec_set_dai_tdm_slot(struct snd_soc_dai *dai,
...
@@ -2353,18 +2341,18 @@ static int ab8500_codec_set_dai_tdm_slot(struct snd_soc_dai *dai,
case
0
:
case
0
:
break
;
break
;
case
1
:
case
1
:
slot
=
f
ind_first_bit
((
unsigned
long
*
)
&
rx_mask
,
32
);
slot
=
f
fs
(
rx_mask
);
snd_soc_update_bits
(
codec
,
AB8500_ADSLOTSEL
(
slot
),
snd_soc_update_bits
(
codec
,
AB8500_ADSLOTSEL
(
slot
),
AB8500_MASK_SLOT
(
slot
),
AB8500_MASK_SLOT
(
slot
),
AB8500_ADSLOTSELX_AD_OUT_TO_SLOT
(
AB8500_AD_OUT3
,
slot
));
AB8500_ADSLOTSELX_AD_OUT_TO_SLOT
(
AB8500_AD_OUT3
,
slot
));
break
;
break
;
case
2
:
case
2
:
slot
=
f
ind_first_bit
((
unsigned
long
*
)
&
rx_mask
,
32
);
slot
=
f
fs
(
rx_mask
);
snd_soc_update_bits
(
codec
,
snd_soc_update_bits
(
codec
,
AB8500_ADSLOTSEL
(
slot
),
AB8500_ADSLOTSEL
(
slot
),
AB8500_MASK_SLOT
(
slot
),
AB8500_MASK_SLOT
(
slot
),
AB8500_ADSLOTSELX_AD_OUT_TO_SLOT
(
AB8500_AD_OUT3
,
slot
));
AB8500_ADSLOTSELX_AD_OUT_TO_SLOT
(
AB8500_AD_OUT3
,
slot
));
slot
=
f
ind_next_bit
((
unsigned
long
*
)
&
rx_mask
,
32
,
slot
+
1
);
slot
=
f
ls
(
rx_mask
);
snd_soc_update_bits
(
codec
,
snd_soc_update_bits
(
codec
,
AB8500_ADSLOTSEL
(
slot
),
AB8500_ADSLOTSEL
(
slot
),
AB8500_MASK_SLOT
(
slot
),
AB8500_MASK_SLOT
(
slot
),
...
@@ -2485,9 +2473,13 @@ static int ab8500_codec_probe(struct snd_soc_codec *codec)
...
@@ -2485,9 +2473,13 @@ static int ab8500_codec_probe(struct snd_soc_codec *codec)
dev_dbg
(
dev
,
"%s: Enter.
\n
"
,
__func__
);
dev_dbg
(
dev
,
"%s: Enter.
\n
"
,
__func__
);
snd_soc_codec_set_cache_io
(
codec
,
0
,
0
,
SND_SOC_REGMAP
);
/* Setup AB8500 according to board-settings */
/* Setup AB8500 according to board-settings */
pdata
=
dev_get_platdata
(
dev
->
parent
);
pdata
=
dev_get_platdata
(
dev
->
parent
);
codec
->
control_data
=
drvdata
->
regmap
;
if
(
np
)
{
if
(
np
)
{
if
(
!
pdata
)
if
(
!
pdata
)
pdata
=
devm_kzalloc
(
dev
,
pdata
=
devm_kzalloc
(
dev
,
...
@@ -2532,11 +2524,9 @@ static int ab8500_codec_probe(struct snd_soc_codec *codec)
...
@@ -2532,11 +2524,9 @@ static int ab8500_codec_probe(struct snd_soc_codec *codec)
}
}
/* Override HW-defaults */
/* Override HW-defaults */
ab8500_codec_write_reg
(
codec
,
snd_soc_write
(
codec
,
AB8500_ANACONF5
,
AB8500_ANACONF5
,
BIT
(
AB8500_ANACONF5_HSAUTOEN
));
BIT
(
AB8500_ANACONF5_HSAUTOEN
));
ab8500_codec_write_reg
(
codec
,
snd_soc_write
(
codec
,
AB8500_SHORTCIRCONF
,
AB8500_SHORTCIRCONF
,
BIT
(
AB8500_SHORTCIRCONF_HSZCDDIS
));
BIT
(
AB8500_SHORTCIRCONF_HSZCDDIS
));
/* Add filter controls */
/* Add filter controls */
...
@@ -2567,9 +2557,6 @@ static int ab8500_codec_probe(struct snd_soc_codec *codec)
...
@@ -2567,9 +2557,6 @@ static int ab8500_codec_probe(struct snd_soc_codec *codec)
static
struct
snd_soc_codec_driver
ab8500_codec_driver
=
{
static
struct
snd_soc_codec_driver
ab8500_codec_driver
=
{
.
probe
=
ab8500_codec_probe
,
.
probe
=
ab8500_codec_probe
,
.
read
=
ab8500_codec_read_reg
,
.
write
=
ab8500_codec_write_reg
,
.
reg_word_size
=
sizeof
(
u8
),
.
controls
=
ab8500_ctrls
,
.
controls
=
ab8500_ctrls
,
.
num_controls
=
ARRAY_SIZE
(
ab8500_ctrls
),
.
num_controls
=
ARRAY_SIZE
(
ab8500_ctrls
),
.
dapm_widgets
=
ab8500_dapm_widgets
,
.
dapm_widgets
=
ab8500_dapm_widgets
,
...
@@ -2588,10 +2575,21 @@ static int ab8500_codec_driver_probe(struct platform_device *pdev)
...
@@ -2588,10 +2575,21 @@ static int ab8500_codec_driver_probe(struct platform_device *pdev)
/* Create driver private-data struct */
/* Create driver private-data struct */
drvdata
=
devm_kzalloc
(
&
pdev
->
dev
,
sizeof
(
struct
ab8500_codec_drvdata
),
drvdata
=
devm_kzalloc
(
&
pdev
->
dev
,
sizeof
(
struct
ab8500_codec_drvdata
),
GFP_KERNEL
);
GFP_KERNEL
);
if
(
!
drvdata
)
return
-
ENOMEM
;
drvdata
->
sid_status
=
SID_UNCONFIGURED
;
drvdata
->
sid_status
=
SID_UNCONFIGURED
;
drvdata
->
anc_status
=
ANC_UNCONFIGURED
;
drvdata
->
anc_status
=
ANC_UNCONFIGURED
;
dev_set_drvdata
(
&
pdev
->
dev
,
drvdata
);
dev_set_drvdata
(
&
pdev
->
dev
,
drvdata
);
drvdata
->
regmap
=
devm_regmap_init
(
&
pdev
->
dev
,
NULL
,
&
pdev
->
dev
,
&
ab8500_codec_regmap
);
if
(
IS_ERR
(
drvdata
->
regmap
))
{
status
=
PTR_ERR
(
drvdata
->
regmap
);
dev_err
(
&
pdev
->
dev
,
"%s: Failed to allocate regmap: %d
\n
"
,
__func__
,
status
);
return
status
;
}
dev_dbg
(
&
pdev
->
dev
,
"%s: Register codec.
\n
"
,
__func__
);
dev_dbg
(
&
pdev
->
dev
,
"%s: Register codec.
\n
"
,
__func__
);
status
=
snd_soc_register_codec
(
&
pdev
->
dev
,
&
ab8500_codec_driver
,
status
=
snd_soc_register_codec
(
&
pdev
->
dev
,
&
ab8500_codec_driver
,
ab8500_codec_dai
,
ab8500_codec_dai
,
...
@@ -2606,7 +2604,7 @@ static int ab8500_codec_driver_probe(struct platform_device *pdev)
...
@@ -2606,7 +2604,7 @@ static int ab8500_codec_driver_probe(struct platform_device *pdev)
static
int
ab8500_codec_driver_remove
(
struct
platform_device
*
pdev
)
static
int
ab8500_codec_driver_remove
(
struct
platform_device
*
pdev
)
{
{
dev_
info
(
&
pdev
->
dev
,
"%s Enter.
\n
"
,
__func__
);
dev_
dbg
(
&
pdev
->
dev
,
"%s Enter.
\n
"
,
__func__
);
snd_soc_unregister_codec
(
&
pdev
->
dev
);
snd_soc_unregister_codec
(
&
pdev
->
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