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
e3a4bd27
Commit
e3a4bd27
authored
Oct 24, 2013
by
Mark Brown
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'asoc/topic/twl4030' into asoc-next
parents
856de815
052901f4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
44 deletions
+36
-44
sound/soc/codecs/twl4030.c
sound/soc/codecs/twl4030.c
+36
-44
No files found.
sound/soc/codecs/twl4030.c
View file @
e3a4bd27
...
@@ -46,13 +46,7 @@
...
@@ -46,13 +46,7 @@
/* TWL4030 PMBR1 Register GPIO6 mux bits */
/* TWL4030 PMBR1 Register GPIO6 mux bits */
#define TWL4030_GPIO6_PWM0_MUTE(value) ((value & 0x03) << 2)
#define TWL4030_GPIO6_PWM0_MUTE(value) ((value & 0x03) << 2)
/* Shadow register used by the audio driver */
#define TWL4030_CACHEREGNUM (TWL4030_REG_MISC_SET_2 + 1)
#define TWL4030_REG_SW_SHADOW 0x4A
#define TWL4030_CACHEREGNUM (TWL4030_REG_SW_SHADOW + 1)
/* TWL4030_REG_SW_SHADOW (0x4A) Fields */
#define TWL4030_HFL_EN 0x01
#define TWL4030_HFR_EN 0x02
/*
/*
* twl4030 register cache & default register settings
* twl4030 register cache & default register settings
...
@@ -132,7 +126,6 @@ static const u8 twl4030_reg[TWL4030_CACHEREGNUM] = {
...
@@ -132,7 +126,6 @@ static const u8 twl4030_reg[TWL4030_CACHEREGNUM] = {
0x00
,
/* REG_VIBRA_PWM_SET (0x47) */
0x00
,
/* REG_VIBRA_PWM_SET (0x47) */
0x00
,
/* REG_ANAMIC_GAIN (0x48) */
0x00
,
/* REG_ANAMIC_GAIN (0x48) */
0x00
,
/* REG_MISC_SET_2 (0x49) */
0x00
,
/* REG_MISC_SET_2 (0x49) */
0x00
,
/* REG_SW_SHADOW (0x4A) - Shadow, non HW register */
};
};
/* codec private data */
/* codec private data */
...
@@ -198,42 +191,41 @@ static int twl4030_write(struct snd_soc_codec *codec,
...
@@ -198,42 +191,41 @@ static int twl4030_write(struct snd_soc_codec *codec,
int
write_to_reg
=
0
;
int
write_to_reg
=
0
;
twl4030_write_reg_cache
(
codec
,
reg
,
value
);
twl4030_write_reg_cache
(
codec
,
reg
,
value
);
if
(
likely
(
reg
<
TWL4030_REG_SW_SHADOW
))
{
/* Decide if the given register can be written */
/* Decide if the given register can be written */
switch
(
reg
)
{
switch
(
reg
)
{
case
TWL4030_REG_EAR_CTL
:
case
TWL4030_REG_EAR_CTL
:
if
(
twl4030
->
earpiece_enabled
)
if
(
twl4030
->
earpiece_enabled
)
write_to_reg
=
1
;
break
;
case
TWL4030_REG_PREDL_CTL
:
if
(
twl4030
->
predrivel_enabled
)
write_to_reg
=
1
;
break
;
case
TWL4030_REG_PREDR_CTL
:
if
(
twl4030
->
predriver_enabled
)
write_to_reg
=
1
;
break
;
case
TWL4030_REG_PRECKL_CTL
:
if
(
twl4030
->
carkitl_enabled
)
write_to_reg
=
1
;
break
;
case
TWL4030_REG_PRECKR_CTL
:
if
(
twl4030
->
carkitr_enabled
)
write_to_reg
=
1
;
break
;
case
TWL4030_REG_HS_GAIN_SET
:
if
(
twl4030
->
hsl_enabled
||
twl4030
->
hsr_enabled
)
write_to_reg
=
1
;
break
;
default:
/* All other register can be written */
write_to_reg
=
1
;
write_to_reg
=
1
;
break
;
break
;
}
case
TWL4030_REG_PREDL_CTL
:
if
(
write_to_reg
)
if
(
twl4030
->
predrivel_enabled
)
return
twl_i2c_write_u8
(
TWL4030_MODULE_AUDIO_VOICE
,
write_to_reg
=
1
;
value
,
reg
);
break
;
case
TWL4030_REG_PREDR_CTL
:
if
(
twl4030
->
predriver_enabled
)
write_to_reg
=
1
;
break
;
case
TWL4030_REG_PRECKL_CTL
:
if
(
twl4030
->
carkitl_enabled
)
write_to_reg
=
1
;
break
;
case
TWL4030_REG_PRECKR_CTL
:
if
(
twl4030
->
carkitr_enabled
)
write_to_reg
=
1
;
break
;
case
TWL4030_REG_HS_GAIN_SET
:
if
(
twl4030
->
hsl_enabled
||
twl4030
->
hsr_enabled
)
write_to_reg
=
1
;
break
;
default:
/* All other register can be written */
write_to_reg
=
1
;
break
;
}
}
if
(
write_to_reg
)
return
twl_i2c_write_u8
(
TWL4030_MODULE_AUDIO_VOICE
,
value
,
reg
);
return
0
;
return
0
;
}
}
...
@@ -532,7 +524,7 @@ SOC_DAPM_ENUM("Route", twl4030_handsfreel_enum);
...
@@ -532,7 +524,7 @@ SOC_DAPM_ENUM("Route", twl4030_handsfreel_enum);
/* Handsfree Left virtual mute */
/* Handsfree Left virtual mute */
static
const
struct
snd_kcontrol_new
twl4030_dapm_handsfreelmute_control
=
static
const
struct
snd_kcontrol_new
twl4030_dapm_handsfreelmute_control
=
SOC_DAPM_SINGLE
(
"Switch"
,
TWL4030_REG_SW_SHADOW
,
0
,
1
,
0
);
SOC_DAPM_SINGLE
_VIRT
(
"Switch"
,
1
);
/* Handsfree Right */
/* Handsfree Right */
static
const
char
*
twl4030_handsfreer_texts
[]
=
static
const
char
*
twl4030_handsfreer_texts
[]
=
...
@@ -548,7 +540,7 @@ SOC_DAPM_ENUM("Route", twl4030_handsfreer_enum);
...
@@ -548,7 +540,7 @@ SOC_DAPM_ENUM("Route", twl4030_handsfreer_enum);
/* Handsfree Right virtual mute */
/* Handsfree Right virtual mute */
static
const
struct
snd_kcontrol_new
twl4030_dapm_handsfreermute_control
=
static
const
struct
snd_kcontrol_new
twl4030_dapm_handsfreermute_control
=
SOC_DAPM_SINGLE
(
"Switch"
,
TWL4030_REG_SW_SHADOW
,
1
,
1
,
0
);
SOC_DAPM_SINGLE
_VIRT
(
"Switch"
,
1
);
/* Vibra */
/* Vibra */
/* Vibra audio path selection */
/* Vibra audio path selection */
...
...
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