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
1a55b3f6
Commit
1a55b3f6
authored
May 23, 2009
by
Mark Brown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ASoC: WM8974 checkpatch cleanups
Signed-off-by:
Mark Brown
<
broonie@opensource.wolfsonmicro.com
>
parent
0a1bf553
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
54 deletions
+52
-54
sound/soc/codecs/wm8974.c
sound/soc/codecs/wm8974.c
+38
-40
sound/soc/codecs/wm8974.h
sound/soc/codecs/wm8974.h
+14
-14
No files found.
sound/soc/codecs/wm8974.c
View file @
1a55b3f6
...
@@ -28,9 +28,6 @@
...
@@ -28,9 +28,6 @@
#include "wm8974.h"
#include "wm8974.h"
#define AUDIO_NAME "wm8974"
#define WM8974_VERSION "0.6"
struct
snd_soc_codec_device
soc_codec_dev_wm8974
;
struct
snd_soc_codec_device
soc_codec_dev_wm8974
;
/*
/*
...
@@ -39,27 +36,27 @@ struct snd_soc_codec_device soc_codec_dev_wm8974;
...
@@ -39,27 +36,27 @@ struct snd_soc_codec_device soc_codec_dev_wm8974;
* using 2 wire for device control, so we cache them instead.
* using 2 wire for device control, so we cache them instead.
*/
*/
static
const
u16
wm8974_reg
[
WM8974_CACHEREGNUM
]
=
{
static
const
u16
wm8974_reg
[
WM8974_CACHEREGNUM
]
=
{
0x0000
,
0x0000
,
0x0000
,
0x0000
,
0x0000
,
0x0000
,
0x0000
,
0x0000
,
0x0050
,
0x0000
,
0x0140
,
0x0000
,
0x0050
,
0x0000
,
0x0140
,
0x0000
,
0x0000
,
0x0000
,
0x0000
,
0x00ff
,
0x0000
,
0x0000
,
0x0000
,
0x00ff
,
0x0000
,
0x0000
,
0x0100
,
0x00ff
,
0x0000
,
0x0000
,
0x0100
,
0x00ff
,
0x0000
,
0x0000
,
0x012c
,
0x002c
,
0x0000
,
0x0000
,
0x012c
,
0x002c
,
0x002c
,
0x002c
,
0x002c
,
0x0000
,
0x002c
,
0x002c
,
0x002c
,
0x0000
,
0x0032
,
0x0000
,
0x0000
,
0x0000
,
0x0032
,
0x0000
,
0x0000
,
0x0000
,
0x0000
,
0x0000
,
0x0000
,
0x0000
,
0x0000
,
0x0000
,
0x0000
,
0x0000
,
0x0038
,
0x000b
,
0x0032
,
0x0000
,
0x0038
,
0x000b
,
0x0032
,
0x0000
,
0x0008
,
0x000c
,
0x0093
,
0x00e9
,
0x0008
,
0x000c
,
0x0093
,
0x00e9
,
0x0000
,
0x0000
,
0x0000
,
0x0000
,
0x0000
,
0x0000
,
0x0000
,
0x0000
,
0x0003
,
0x0010
,
0x0000
,
0x0000
,
0x0003
,
0x0010
,
0x0000
,
0x0000
,
0x0000
,
0x0002
,
0x0000
,
0x0000
,
0x0000
,
0x0002
,
0x0000
,
0x0000
,
0x0000
,
0x0000
,
0x0039
,
0x0000
,
0x0000
,
0x0000
,
0x0039
,
0x0000
,
0x0000
,
0x0000
,
};
};
/*
/*
* read wm8974 register cache
* read wm8974 register cache
*/
*/
static
inline
unsigned
int
wm8974_read_reg_cache
(
struct
snd_soc_codec
*
codec
,
static
inline
unsigned
int
wm8974_read_reg_cache
(
struct
snd_soc_codec
*
codec
,
unsigned
int
reg
)
unsigned
int
reg
)
{
{
u16
*
cache
=
codec
->
reg_cache
;
u16
*
cache
=
codec
->
reg_cache
;
...
@@ -97,7 +94,7 @@ static int wm8974_write(struct snd_soc_codec *codec, unsigned int reg,
...
@@ -97,7 +94,7 @@ static int wm8974_write(struct snd_soc_codec *codec, unsigned int reg,
data
[
0
]
=
(
reg
<<
1
)
|
((
value
>>
8
)
&
0x0001
);
data
[
0
]
=
(
reg
<<
1
)
|
((
value
>>
8
)
&
0x0001
);
data
[
1
]
=
value
&
0x00ff
;
data
[
1
]
=
value
&
0x00ff
;
wm8974_write_reg_cache
(
codec
,
reg
,
value
);
wm8974_write_reg_cache
(
codec
,
reg
,
value
);
if
(
codec
->
hw_write
(
codec
->
control_data
,
data
,
2
)
==
2
)
if
(
codec
->
hw_write
(
codec
->
control_data
,
data
,
2
)
==
2
)
return
0
;
return
0
;
else
else
...
@@ -215,7 +212,8 @@ static int wm8974_add_controls(struct snd_soc_codec *codec)
...
@@ -215,7 +212,8 @@ static int wm8974_add_controls(struct snd_soc_codec *codec)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
wm8974_snd_controls
);
i
++
)
{
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
wm8974_snd_controls
);
i
++
)
{
err
=
snd_ctl_add
(
codec
->
card
,
err
=
snd_ctl_add
(
codec
->
card
,
snd_soc_cnew
(
&
wm8974_snd_controls
[
i
],
codec
,
NULL
));
snd_soc_cnew
(
&
wm8974_snd_controls
[
i
],
codec
,
NULL
));
if
(
err
<
0
)
if
(
err
<
0
)
return
err
;
return
err
;
}
}
...
@@ -347,13 +345,14 @@ struct pll_ {
...
@@ -347,13 +345,14 @@ struct pll_ {
};
};
static
struct
pll_
pll
[]
=
{
static
struct
pll_
pll
[]
=
{
{
12000000
,
11289600
,
0
,
7
,
0x86c220
},
{
12000000
,
11289600
,
0
,
7
,
0x86c220
},
{
12000000
,
12288000
,
0
,
8
,
0x3126e8
},
{
12000000
,
12288000
,
0
,
8
,
0x3126e8
},
{
13000000
,
11289600
,
0
,
6
,
0xf28bd4
},
{
13000000
,
11289600
,
0
,
6
,
0xf28bd4
},
{
13000000
,
12288000
,
0
,
7
,
0x8fd525
},
{
13000000
,
12288000
,
0
,
7
,
0x8fd525
},
{
12288000
,
11289600
,
0
,
7
,
0x59999a
},
{
12288000
,
11289600
,
0
,
7
,
0x59999a
},
{
11289600
,
12288000
,
0
,
8
,
0x80dee9
},
{
11289600
,
12288000
,
0
,
8
,
0x80dee9
},
/* liam - add more entries */
{
25000000
,
11289600
,
1
,
7
,
0x39B024
},
{
25000000
,
24576000
,
1
,
7
,
0xdd4413
}
};
};
static
int
wm8974_set_dai_pll
(
struct
snd_soc_dai
*
codec_dai
,
static
int
wm8974_set_dai_pll
(
struct
snd_soc_dai
*
codec_dai
,
...
@@ -363,23 +362,26 @@ static int wm8974_set_dai_pll(struct snd_soc_dai *codec_dai,
...
@@ -363,23 +362,26 @@ static int wm8974_set_dai_pll(struct snd_soc_dai *codec_dai,
int
i
;
int
i
;
u16
reg
;
u16
reg
;
if
(
freq_in
==
0
||
freq_out
==
0
)
{
if
(
freq_in
==
0
||
freq_out
==
0
)
{
reg
=
wm8974_read_reg_cache
(
codec
,
WM8974_POWER1
);
reg
=
wm8974_read_reg_cache
(
codec
,
WM8974_POWER1
);
wm8974_write
(
codec
,
WM8974_POWER1
,
reg
&
0x1df
);
wm8974_write
(
codec
,
WM8974_POWER1
,
reg
&
0x1df
);
return
0
;
return
0
;
}
}
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
pll
);
i
++
)
{
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
pll
);
i
++
)
{
if
(
freq_in
==
pll
[
i
].
in_hz
&&
freq_out
==
pll
[
i
].
out_hz
)
{
if
(
freq_in
==
pll
[
i
].
in_hz
&&
freq_out
==
pll
[
i
].
out_hz
)
{
wm8974_write
(
codec
,
WM8974_PLLN
,
(
pll
[
i
].
pre
<<
4
)
|
pll
[
i
].
n
);
wm8974_write
(
codec
,
WM8974_PLLN
,
(
pll
[
i
].
pre
<<
4
)
|
pll
[
i
].
n
);
wm8974_write
(
codec
,
WM8974_PLLK1
,
pll
[
i
].
k
>>
18
);
wm8974_write
(
codec
,
WM8974_PLLK1
,
pll
[
i
].
k
>>
18
);
wm8974_write
(
codec
,
WM8974_PLLK2
,
(
pll
[
i
].
k
>>
9
)
&
0x1ff
);
wm8974_write
(
codec
,
WM8974_PLLK2
,
(
pll
[
i
].
k
>>
9
)
&
0x1ff
);
wm8974_write
(
codec
,
WM8974_PLLK3
,
pll
[
i
].
k
&
0x1ff
);
wm8974_write
(
codec
,
WM8974_PLLK3
,
pll
[
i
].
k
&
0x1ff
);
reg
=
wm8974_read_reg_cache
(
codec
,
WM8974_POWER1
);
reg
=
wm8974_read_reg_cache
(
codec
,
WM8974_POWER1
);
wm8974_write
(
codec
,
WM8974_POWER1
,
reg
|
0x020
);
wm8974_write
(
codec
,
WM8974_POWER1
,
reg
|
0x020
);
return
0
;
return
0
;
}
}
}
}
return
-
EINVAL
;
return
-
EINVAL
;
}
}
...
@@ -394,7 +396,7 @@ static int wm8974_set_dai_clkdiv(struct snd_soc_dai *codec_dai,
...
@@ -394,7 +396,7 @@ static int wm8974_set_dai_clkdiv(struct snd_soc_dai *codec_dai,
switch
(
div_id
)
{
switch
(
div_id
)
{
case
WM8974_OPCLKDIV
:
case
WM8974_OPCLKDIV
:
reg
=
wm8974_read_reg_cache
(
codec
,
WM8974_GPIO
)
&
0x1cf
;
reg
=
wm8974_read_reg_cache
(
codec
,
WM8974_GPIO
)
&
0x1cf
;
wm8974_write
(
codec
,
WM8974_GPIO
,
reg
|
div
);
wm8974_write
(
codec
,
WM8974_GPIO
,
reg
|
div
);
break
;
break
;
case
WM8974_MCLKDIV
:
case
WM8974_MCLKDIV
:
...
@@ -531,7 +533,7 @@ static int wm8974_mute(struct snd_soc_dai *dai, int mute)
...
@@ -531,7 +533,7 @@ static int wm8974_mute(struct snd_soc_dai *dai, int mute)
struct
snd_soc_codec
*
codec
=
dai
->
codec
;
struct
snd_soc_codec
*
codec
=
dai
->
codec
;
u16
mute_reg
=
wm8974_read_reg_cache
(
codec
,
WM8974_DAC
)
&
0xffbf
;
u16
mute_reg
=
wm8974_read_reg_cache
(
codec
,
WM8974_DAC
)
&
0xffbf
;
if
(
mute
)
if
(
mute
)
wm8974_write
(
codec
,
WM8974_DAC
,
mute_reg
|
0x40
);
wm8974_write
(
codec
,
WM8974_DAC
,
mute_reg
|
0x40
);
else
else
wm8974_write
(
codec
,
WM8974_DAC
,
mute_reg
);
wm8974_write
(
codec
,
WM8974_DAC
,
mute_reg
);
...
@@ -562,9 +564,7 @@ static int wm8974_set_bias_level(struct snd_soc_codec *codec,
...
@@ -562,9 +564,7 @@ static int wm8974_set_bias_level(struct snd_soc_codec *codec,
return
0
;
return
0
;
}
}
#define WM8974_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 |\
#define WM8974_RATES (SNDRV_PCM_RATE_8000_48000)
SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_44100 | \
SNDRV_PCM_RATE_48000)
#define WM8974_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
#define WM8974_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
SNDRV_PCM_FMTBIT_S24_LE)
SNDRV_PCM_FMTBIT_S24_LE)
...
@@ -649,7 +649,7 @@ static int wm8974_init(struct snd_soc_device *socdev)
...
@@ -649,7 +649,7 @@ static int wm8974_init(struct snd_soc_device *socdev)
/* register pcms */
/* register pcms */
ret
=
snd_soc_new_pcms
(
socdev
,
SNDRV_DEFAULT_IDX1
,
SNDRV_DEFAULT_STR1
);
ret
=
snd_soc_new_pcms
(
socdev
,
SNDRV_DEFAULT_IDX1
,
SNDRV_DEFAULT_STR1
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
printk
(
KERN_ERR
"wm8974: failed to create pcms
\n
"
);
printk
(
KERN_ERR
"wm8974: failed to create pcms
\n
"
);
goto
pcm_err
;
goto
pcm_err
;
}
}
...
@@ -773,8 +773,6 @@ static int wm8974_probe(struct platform_device *pdev)
...
@@ -773,8 +773,6 @@ static int wm8974_probe(struct platform_device *pdev)
struct
snd_soc_codec
*
codec
;
struct
snd_soc_codec
*
codec
;
int
ret
=
0
;
int
ret
=
0
;
pr_info
(
"WM8974 Audio Codec %s"
,
WM8974_VERSION
);
setup
=
socdev
->
codec_data
;
setup
=
socdev
->
codec_data
;
codec
=
kzalloc
(
sizeof
(
struct
snd_soc_codec
),
GFP_KERNEL
);
codec
=
kzalloc
(
sizeof
(
struct
snd_soc_codec
),
GFP_KERNEL
);
if
(
codec
==
NULL
)
if
(
codec
==
NULL
)
...
...
sound/soc/codecs/wm8974.h
View file @
1a55b3f6
...
@@ -16,30 +16,30 @@
...
@@ -16,30 +16,30 @@
#define WM8974_POWER2 0x2
#define WM8974_POWER2 0x2
#define WM8974_POWER3 0x3
#define WM8974_POWER3 0x3
#define WM8974_IFACE 0x4
#define WM8974_IFACE 0x4
#define WM8974_COMP
0x5
#define WM8974_COMP 0x5
#define WM8974_CLOCK 0x6
#define WM8974_CLOCK 0x6
#define WM8974_ADD
0x7
#define WM8974_ADD 0x7
#define WM8974_GPIO
0x8
#define WM8974_GPIO 0x8
#define WM8974_DAC
0xa
#define WM8974_DAC 0xa
#define WM8974_DACVOL 0xb
#define WM8974_DACVOL 0xb
#define WM8974_ADC
0xe
#define WM8974_ADC 0xe
#define WM8974_ADCVOL 0xf
#define WM8974_ADCVOL 0xf
#define WM8974_EQ1
0x12
#define WM8974_EQ1 0x12
#define WM8974_EQ2
0x13
#define WM8974_EQ2 0x13
#define WM8974_EQ3
0x14
#define WM8974_EQ3 0x14
#define WM8974_EQ4
0x15
#define WM8974_EQ4 0x15
#define WM8974_EQ5
0x16
#define WM8974_EQ5 0x16
#define WM8974_DACLIM1 0x18
#define WM8974_DACLIM1 0x18
#define WM8974_DACLIM2 0x19
#define WM8974_DACLIM2 0x19
#define WM8974_NOTCH1 0x1b
#define WM8974_NOTCH1 0x1b
#define WM8974_NOTCH2 0x1c
#define WM8974_NOTCH2 0x1c
#define WM8974_NOTCH3 0x1d
#define WM8974_NOTCH3 0x1d
#define WM8974_NOTCH4 0x1e
#define WM8974_NOTCH4 0x1e
#define WM8974_ALC1
0x20
#define WM8974_ALC1 0x20
#define WM8974_ALC2
0x21
#define WM8974_ALC2 0x21
#define WM8974_ALC3
0x22
#define WM8974_ALC3 0x22
#define WM8974_NGATE 0x23
#define WM8974_NGATE 0x23
#define WM8974_PLLN
0x24
#define WM8974_PLLN 0x24
#define WM8974_PLLK1 0x25
#define WM8974_PLLK1 0x25
#define WM8974_PLLK2 0x26
#define WM8974_PLLK2 0x26
#define WM8974_PLLK3 0x27
#define WM8974_PLLK3 0x27
...
...
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