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
e4cf86a3
Commit
e4cf86a3
authored
Sep 29, 2016
by
Mark Brown
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'asoc/fix/tpa6130a2' into asoc-linus
parents
b669010e
a114580f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
23 deletions
+26
-23
sound/soc/codecs/tpa6130a2.c
sound/soc/codecs/tpa6130a2.c
+26
-23
No files found.
sound/soc/codecs/tpa6130a2.c
View file @
e4cf86a3
...
@@ -52,7 +52,7 @@ struct tpa6130a2_data {
...
@@ -52,7 +52,7 @@ struct tpa6130a2_data {
static
int
tpa6130a2_power
(
struct
tpa6130a2_data
*
data
,
bool
enable
)
static
int
tpa6130a2_power
(
struct
tpa6130a2_data
*
data
,
bool
enable
)
{
{
int
ret
;
int
ret
=
0
,
ret2
;
if
(
enable
)
{
if
(
enable
)
{
ret
=
regulator_enable
(
data
->
supply
);
ret
=
regulator_enable
(
data
->
supply
);
...
@@ -64,20 +64,34 @@ static int tpa6130a2_power(struct tpa6130a2_data *data, bool enable)
...
@@ -64,20 +64,34 @@ static int tpa6130a2_power(struct tpa6130a2_data *data, bool enable)
/* Power on */
/* Power on */
if
(
data
->
power_gpio
>=
0
)
if
(
data
->
power_gpio
>=
0
)
gpio_set_value
(
data
->
power_gpio
,
1
);
gpio_set_value
(
data
->
power_gpio
,
1
);
/* Sync registers */
regcache_cache_only
(
data
->
regmap
,
false
);
ret
=
regcache_sync
(
data
->
regmap
);
if
(
ret
!=
0
)
{
dev_err
(
data
->
dev
,
"Failed to sync registers: %d
\n
"
,
ret
);
goto
regcache_sync_failed
;
}
}
else
{
}
else
{
/* Powered off device does not retain registers. While device
* is off, any register updates (i.e. volume changes) should
* happen in cache only.
*/
regcache_mark_dirty
(
data
->
regmap
);
regcache_sync_failed:
regcache_cache_only
(
data
->
regmap
,
true
);
/* Power off */
/* Power off */
if
(
data
->
power_gpio
>=
0
)
if
(
data
->
power_gpio
>=
0
)
gpio_set_value
(
data
->
power_gpio
,
0
);
gpio_set_value
(
data
->
power_gpio
,
0
);
ret
=
regulator_disable
(
data
->
supply
);
ret
2
=
regulator_disable
(
data
->
supply
);
if
(
ret
!=
0
)
{
if
(
ret
2
!=
0
)
{
dev_err
(
data
->
dev
,
dev_err
(
data
->
dev
,
"Failed to disable supply: %d
\n
"
,
ret
);
"Failed to disable supply: %d
\n
"
,
ret
2
);
return
ret
;
return
ret
?
ret
:
ret2
;
}
}
/* device regs does not match the cache state anymore */
regcache_mark_dirty
(
data
->
regmap
);
}
}
return
ret
;
return
ret
;
...
@@ -88,25 +102,14 @@ static int tpa6130a2_power_event(struct snd_soc_dapm_widget *w,
...
@@ -88,25 +102,14 @@ static int tpa6130a2_power_event(struct snd_soc_dapm_widget *w,
{
{
struct
snd_soc_component
*
c
=
snd_soc_dapm_to_component
(
w
->
dapm
);
struct
snd_soc_component
*
c
=
snd_soc_dapm_to_component
(
w
->
dapm
);
struct
tpa6130a2_data
*
data
=
snd_soc_component_get_drvdata
(
c
);
struct
tpa6130a2_data
*
data
=
snd_soc_component_get_drvdata
(
c
);
int
ret
;
/* before widget power up */
if
(
SND_SOC_DAPM_EVENT_ON
(
event
))
{
if
(
SND_SOC_DAPM_EVENT_ON
(
event
))
{
/* Turn on the chip */
/* Before widget power up: turn chip on, sync registers */
tpa6130a2_power
(
data
,
true
);
return
tpa6130a2_power
(
data
,
true
);
/* Sync the registers */
ret
=
regcache_sync
(
data
->
regmap
);
if
(
ret
<
0
)
{
dev_err
(
c
->
dev
,
"Failed to initialize chip
\n
"
);
tpa6130a2_power
(
data
,
false
);
return
ret
;
}
/* after widget power down */
}
else
{
}
else
{
tpa6130a2_power
(
data
,
false
);
/* After widget power down: turn chip off */
return
tpa6130a2_power
(
data
,
false
);
}
}
return
0
;
}
}
/*
/*
...
...
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