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
c125ba3b
Commit
c125ba3b
authored
Apr 01, 2010
by
Takashi Iwai
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'topic/hda-alc-mute' into topic/hda
parents
7a2e38a5
a68d5a54
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
98 additions
and
12 deletions
+98
-12
sound/pci/hda/hda_codec.c
sound/pci/hda/hda_codec.c
+56
-12
sound/pci/hda/hda_codec.h
sound/pci/hda/hda_codec.h
+3
-0
sound/pci/hda/patch_realtek.c
sound/pci/hda/patch_realtek.c
+39
-0
No files found.
sound/pci/hda/hda_codec.c
View file @
c125ba3b
...
@@ -1209,8 +1209,7 @@ static void free_hda_cache(struct hda_cache_rec *cache)
...
@@ -1209,8 +1209,7 @@ static void free_hda_cache(struct hda_cache_rec *cache)
}
}
/* query the hash. allocate an entry if not found. */
/* query the hash. allocate an entry if not found. */
static
struct
hda_cache_head
*
get_alloc_hash
(
struct
hda_cache_rec
*
cache
,
static
struct
hda_cache_head
*
get_hash
(
struct
hda_cache_rec
*
cache
,
u32
key
)
u32
key
)
{
{
u16
idx
=
key
%
(
u16
)
ARRAY_SIZE
(
cache
->
hash
);
u16
idx
=
key
%
(
u16
)
ARRAY_SIZE
(
cache
->
hash
);
u16
cur
=
cache
->
hash
[
idx
];
u16
cur
=
cache
->
hash
[
idx
];
...
@@ -1222,17 +1221,27 @@ static struct hda_cache_head *get_alloc_hash(struct hda_cache_rec *cache,
...
@@ -1222,17 +1221,27 @@ static struct hda_cache_head *get_alloc_hash(struct hda_cache_rec *cache,
return
info
;
return
info
;
cur
=
info
->
next
;
cur
=
info
->
next
;
}
}
return
NULL
;
}
/* add a new hash entry */
/* query the hash. allocate an entry if not found. */
info
=
snd_array_new
(
&
cache
->
buf
);
static
struct
hda_cache_head
*
get_alloc_hash
(
struct
hda_cache_rec
*
cache
,
if
(
!
info
)
u32
key
)
return
NULL
;
{
cur
=
snd_array_index
(
&
cache
->
buf
,
info
);
struct
hda_cache_head
*
info
=
get_hash
(
cache
,
key
);
info
->
key
=
key
;
if
(
!
info
)
{
info
->
val
=
0
;
u16
idx
,
cur
;
info
->
next
=
cache
->
hash
[
idx
];
/* add a new hash entry */
cache
->
hash
[
idx
]
=
cur
;
info
=
snd_array_new
(
&
cache
->
buf
);
if
(
!
info
)
return
NULL
;
cur
=
snd_array_index
(
&
cache
->
buf
,
info
);
info
->
key
=
key
;
info
->
val
=
0
;
idx
=
key
%
(
u16
)
ARRAY_SIZE
(
cache
->
hash
);
info
->
next
=
cache
->
hash
[
idx
];
cache
->
hash
[
idx
]
=
cur
;
}
return
info
;
return
info
;
}
}
...
@@ -2721,6 +2730,41 @@ int snd_hda_codec_write_cache(struct hda_codec *codec, hda_nid_t nid,
...
@@ -2721,6 +2730,41 @@ int snd_hda_codec_write_cache(struct hda_codec *codec, hda_nid_t nid,
}
}
EXPORT_SYMBOL_HDA
(
snd_hda_codec_write_cache
);
EXPORT_SYMBOL_HDA
(
snd_hda_codec_write_cache
);
/**
* snd_hda_codec_update_cache - check cache and write the cmd only when needed
* @codec: the HDA codec
* @nid: NID to send the command
* @direct: direct flag
* @verb: the verb to send
* @parm: the parameter for the verb
*
* This function works like snd_hda_codec_write_cache(), but it doesn't send
* command if the parameter is already identical with the cached value.
* If not, it sends the command and refreshes the cache.
*
* Returns 0 if successful, or a negative error code.
*/
int
snd_hda_codec_update_cache
(
struct
hda_codec
*
codec
,
hda_nid_t
nid
,
int
direct
,
unsigned
int
verb
,
unsigned
int
parm
)
{
struct
hda_cache_head
*
c
;
u32
key
;
/* parm may contain the verb stuff for get/set amp */
verb
=
verb
|
(
parm
>>
8
);
parm
&=
0xff
;
key
=
build_cmd_cache_key
(
nid
,
verb
);
mutex_lock
(
&
codec
->
bus
->
cmd_mutex
);
c
=
get_hash
(
&
codec
->
cmd_cache
,
key
);
if
(
c
&&
c
->
val
==
parm
)
{
mutex_unlock
(
&
codec
->
bus
->
cmd_mutex
);
return
0
;
}
mutex_unlock
(
&
codec
->
bus
->
cmd_mutex
);
return
snd_hda_codec_write_cache
(
codec
,
nid
,
direct
,
verb
,
parm
);
}
EXPORT_SYMBOL_HDA
(
snd_hda_codec_update_cache
);
/**
/**
* snd_hda_codec_resume_cache - Resume the all commands from the cache
* snd_hda_codec_resume_cache - Resume the all commands from the cache
* @codec: HD-audio codec
* @codec: HD-audio codec
...
...
sound/pci/hda/hda_codec.h
View file @
c125ba3b
...
@@ -885,9 +885,12 @@ int snd_hda_codec_write_cache(struct hda_codec *codec, hda_nid_t nid,
...
@@ -885,9 +885,12 @@ int snd_hda_codec_write_cache(struct hda_codec *codec, hda_nid_t nid,
int
direct
,
unsigned
int
verb
,
unsigned
int
parm
);
int
direct
,
unsigned
int
verb
,
unsigned
int
parm
);
void
snd_hda_sequence_write_cache
(
struct
hda_codec
*
codec
,
void
snd_hda_sequence_write_cache
(
struct
hda_codec
*
codec
,
const
struct
hda_verb
*
seq
);
const
struct
hda_verb
*
seq
);
int
snd_hda_codec_update_cache
(
struct
hda_codec
*
codec
,
hda_nid_t
nid
,
int
direct
,
unsigned
int
verb
,
unsigned
int
parm
);
void
snd_hda_codec_resume_cache
(
struct
hda_codec
*
codec
);
void
snd_hda_codec_resume_cache
(
struct
hda_codec
*
codec
);
#else
#else
#define snd_hda_codec_write_cache snd_hda_codec_write
#define snd_hda_codec_write_cache snd_hda_codec_write
#define snd_hda_codec_update_cache snd_hda_codec_write
#define snd_hda_sequence_write_cache snd_hda_sequence_write
#define snd_hda_sequence_write_cache snd_hda_sequence_write
#endif
#endif
...
...
sound/pci/hda/patch_realtek.c
View file @
c125ba3b
...
@@ -3467,6 +3467,10 @@ static int alc_init(struct hda_codec *codec)
...
@@ -3467,6 +3467,10 @@ static int alc_init(struct hda_codec *codec)
if
(
spec
->
init_hook
)
if
(
spec
->
init_hook
)
spec
->
init_hook
(
codec
);
spec
->
init_hook
(
codec
);
#ifdef CONFIG_SND_HDA_POWER_SAVE
if
(
codec
->
patch_ops
.
check_power_status
)
codec
->
patch_ops
.
check_power_status
(
codec
,
0x01
);
#endif
return
0
;
return
0
;
}
}
...
@@ -3827,6 +3831,10 @@ static int alc_resume(struct hda_codec *codec)
...
@@ -3827,6 +3831,10 @@ static int alc_resume(struct hda_codec *codec)
codec
->
patch_ops
.
init
(
codec
);
codec
->
patch_ops
.
init
(
codec
);
snd_hda_codec_resume_amp
(
codec
);
snd_hda_codec_resume_amp
(
codec
);
snd_hda_codec_resume_cache
(
codec
);
snd_hda_codec_resume_cache
(
codec
);
#ifdef CONFIG_SND_HDA_POWER_SAVE
if
(
codec
->
patch_ops
.
check_power_status
)
codec
->
patch_ops
.
check_power_status
(
codec
,
0x01
);
#endif
return
0
;
return
0
;
}
}
#endif
#endif
...
@@ -13983,6 +13991,35 @@ static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
...
@@ -13983,6 +13991,35 @@ static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
/* NID is set in alc_build_pcms */
/* NID is set in alc_build_pcms */
};
};
#ifdef CONFIG_SND_HDA_POWER_SAVE
static
int
alc269_mic2_for_mute_led
(
struct
hda_codec
*
codec
)
{
switch
(
codec
->
subsystem_id
)
{
case
0x103c1586
:
return
1
;
}
return
0
;
}
static
int
alc269_mic2_mute_check_ps
(
struct
hda_codec
*
codec
,
hda_nid_t
nid
)
{
/* update mute-LED according to the speaker mute state */
if
(
nid
==
0x01
||
nid
==
0x14
)
{
int
pinval
;
if
(
snd_hda_codec_amp_read
(
codec
,
0x14
,
0
,
HDA_OUTPUT
,
0
)
&
HDA_AMP_MUTE
)
pinval
=
0x24
;
else
pinval
=
0x20
;
/* mic2 vref pin is used for mute LED control */
snd_hda_codec_update_cache
(
codec
,
0x19
,
0
,
AC_VERB_SET_PIN_WIDGET_CONTROL
,
pinval
);
}
return
alc_check_power_status
(
codec
,
nid
);
}
#endif
/* CONFIG_SND_HDA_POWER_SAVE */
/*
/*
* BIOS auto configuration
* BIOS auto configuration
*/
*/
...
@@ -14330,6 +14367,8 @@ static int patch_alc269(struct hda_codec *codec)
...
@@ -14330,6 +14367,8 @@ static int patch_alc269(struct hda_codec *codec)
#ifdef CONFIG_SND_HDA_POWER_SAVE
#ifdef CONFIG_SND_HDA_POWER_SAVE
if
(
!
spec
->
loopback
.
amplist
)
if
(
!
spec
->
loopback
.
amplist
)
spec
->
loopback
.
amplist
=
alc269_loopbacks
;
spec
->
loopback
.
amplist
=
alc269_loopbacks
;
if
(
alc269_mic2_for_mute_led
(
codec
))
codec
->
patch_ops
.
check_power_status
=
alc269_mic2_mute_check_ps
;
#endif
#endif
return
0
;
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