Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-davinci
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linux
linux-davinci
Commits
42768a12
Commit
42768a12
authored
Apr 22, 2009
by
Mark Brown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ASoC: Use DAPM supply widget for WM8903 charge pump
Signed-off-by:
Mark Brown
<
broonie@opensource.wolfsonmicro.com
>
parent
246d0a17
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
33 deletions
+20
-33
sound/soc/codecs/wm8903.c
sound/soc/codecs/wm8903.c
+20
-33
No files found.
sound/soc/codecs/wm8903.c
View file @
42768a12
...
...
@@ -217,7 +217,6 @@ struct wm8903_priv {
int
sysclk
;
/* Reference counts */
int
charge_pump_users
;
int
class_w_users
;
int
playback_active
;
int
capture_active
;
...
...
@@ -373,6 +372,15 @@ static void wm8903_reset(struct snd_soc_codec *codec)
#define WM8903_OUTPUT_INT 0x2
#define WM8903_OUTPUT_IN 0x1
static
int
wm8903_cp_event
(
struct
snd_soc_dapm_widget
*
w
,
struct
snd_kcontrol
*
kcontrol
,
int
event
)
{
WARN_ON
(
event
!=
SND_SOC_DAPM_POST_PMU
);
mdelay
(
4
);
return
0
;
}
/*
* Event for headphone and line out amplifier power changes. Special
* power up/down sequences are required in order to maximise pop/click
...
...
@@ -382,12 +390,9 @@ static int wm8903_output_event(struct snd_soc_dapm_widget *w,
struct
snd_kcontrol
*
kcontrol
,
int
event
)
{
struct
snd_soc_codec
*
codec
=
w
->
codec
;
struct
wm8903_priv
*
wm8903
=
codec
->
private_data
;
struct
i2c_client
*
i2c
=
codec
->
control_data
;
u16
val
;
u16
reg
;
int
shift
;
u16
cp_reg
=
wm8903_read
(
codec
,
WM8903_CHARGE_PUMP_0
);
switch
(
w
->
reg
)
{
case
WM8903_POWER_MANAGEMENT_2
:
...
...
@@ -419,18 +424,6 @@ static int wm8903_output_event(struct snd_soc_dapm_widget *w,
/* Short the output */
val
&=
~
(
WM8903_OUTPUT_SHORT
<<
shift
);
wm8903_write
(
codec
,
reg
,
val
);
wm8903
->
charge_pump_users
++
;
dev_dbg
(
&
i2c
->
dev
,
"Charge pump use count now %d
\n
"
,
wm8903
->
charge_pump_users
);
if
(
wm8903
->
charge_pump_users
==
1
)
{
dev_dbg
(
&
i2c
->
dev
,
"Enabling charge pump
\n
"
);
wm8903_write
(
codec
,
WM8903_CHARGE_PUMP_0
,
cp_reg
|
WM8903_CP_ENA
);
mdelay
(
4
);
}
}
if
(
event
&
SND_SOC_DAPM_POST_PMU
)
{
...
...
@@ -464,19 +457,6 @@ static int wm8903_output_event(struct snd_soc_dapm_widget *w,
wm8903_write
(
codec
,
reg
,
val
);
}
if
(
event
&
SND_SOC_DAPM_POST_PMD
)
{
wm8903
->
charge_pump_users
--
;
dev_dbg
(
&
i2c
->
dev
,
"Charge pump use count now %d
\n
"
,
wm8903
->
charge_pump_users
);
if
(
wm8903
->
charge_pump_users
==
0
)
{
dev_dbg
(
&
i2c
->
dev
,
"Disabling charge pump
\n
"
);
wm8903_write
(
codec
,
WM8903_CHARGE_PUMP_0
,
cp_reg
&
~
WM8903_CP_ENA
);
}
}
return
0
;
}
...
...
@@ -844,26 +824,28 @@ SND_SOC_DAPM_MIXER("Right Speaker Mixer", WM8903_POWER_MANAGEMENT_4, 0, 0,
SND_SOC_DAPM_PGA_E
(
"Left Headphone Output PGA"
,
WM8903_POWER_MANAGEMENT_2
,
1
,
0
,
NULL
,
0
,
wm8903_output_event
,
SND_SOC_DAPM_PRE_PMU
|
SND_SOC_DAPM_POST_PMU
|
SND_SOC_DAPM_PRE_PMD
|
SND_SOC_DAPM_POST_PMD
),
SND_SOC_DAPM_PRE_PMD
),
SND_SOC_DAPM_PGA_E
(
"Right Headphone Output PGA"
,
WM8903_POWER_MANAGEMENT_2
,
0
,
0
,
NULL
,
0
,
wm8903_output_event
,
SND_SOC_DAPM_PRE_PMU
|
SND_SOC_DAPM_POST_PMU
|
SND_SOC_DAPM_PRE_PMD
|
SND_SOC_DAPM_POST_PMD
),
SND_SOC_DAPM_PRE_PMD
),
SND_SOC_DAPM_PGA_E
(
"Left Line Output PGA"
,
WM8903_POWER_MANAGEMENT_3
,
1
,
0
,
NULL
,
0
,
wm8903_output_event
,
SND_SOC_DAPM_PRE_PMU
|
SND_SOC_DAPM_POST_PMU
|
SND_SOC_DAPM_PRE_PMD
|
SND_SOC_DAPM_POST_PMD
),
SND_SOC_DAPM_PRE_PMD
),
SND_SOC_DAPM_PGA_E
(
"Right Line Output PGA"
,
WM8903_POWER_MANAGEMENT_3
,
0
,
0
,
NULL
,
0
,
wm8903_output_event
,
SND_SOC_DAPM_PRE_PMU
|
SND_SOC_DAPM_POST_PMU
|
SND_SOC_DAPM_PRE_PMD
|
SND_SOC_DAPM_POST_PMD
),
SND_SOC_DAPM_PRE_PMD
),
SND_SOC_DAPM_PGA
(
"Left Speaker PGA"
,
WM8903_POWER_MANAGEMENT_5
,
1
,
0
,
NULL
,
0
),
SND_SOC_DAPM_PGA
(
"Right Speaker PGA"
,
WM8903_POWER_MANAGEMENT_5
,
0
,
0
,
NULL
,
0
),
SND_SOC_DAPM_SUPPLY
(
"Charge Pump"
,
WM8903_CHARGE_PUMP_0
,
0
,
0
,
wm8903_cp_event
,
SND_SOC_DAPM_POST_PMU
),
};
static
const
struct
snd_soc_dapm_route
intercon
[]
=
{
...
...
@@ -951,6 +933,11 @@ static const struct snd_soc_dapm_route intercon[] = {
{
"ROP"
,
NULL
,
"Right Speaker PGA"
},
{
"RON"
,
NULL
,
"Right Speaker PGA"
},
{
"Left Headphone Output PGA"
,
NULL
,
"Charge Pump"
},
{
"Right Headphone Output PGA"
,
NULL
,
"Charge Pump"
},
{
"Left Line Output PGA"
,
NULL
,
"Charge Pump"
},
{
"Right Line Output PGA"
,
NULL
,
"Charge Pump"
},
};
static
int
wm8903_add_widgets
(
struct
snd_soc_codec
*
codec
)
...
...
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