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
302e9c5a
Commit
302e9c5a
authored
Jul 05, 2006
by
Jaroslav Kysela
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ALSA] HDA codec & CA0106 - add/fix TLV support
Signed-off-by:
Jaroslav Kysela
<
perex@suse.cz
>
parent
7f0e2f8b
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
58 additions
and
1 deletion
+58
-1
sound/pci/ca0106/ca0106_mixer.c
sound/pci/ca0106/ca0106_mixer.c
+3
-1
sound/pci/hda/hda_codec.c
sound/pci/hda/hda_codec.c
+33
-0
sound/pci/hda/hda_local.h
sound/pci/hda/hda_local.h
+5
-0
sound/pci/hda/patch_analog.c
sound/pci/hda/patch_analog.c
+17
-0
No files found.
sound/pci/ca0106/ca0106_mixer.c
View file @
302e9c5a
...
@@ -472,10 +472,12 @@ static int snd_ca0106_i2c_volume_put(struct snd_kcontrol *kcontrol,
...
@@ -472,10 +472,12 @@ static int snd_ca0106_i2c_volume_put(struct snd_kcontrol *kcontrol,
#define CA_VOLUME(xname,chid,reg) \
#define CA_VOLUME(xname,chid,reg) \
{ \
{ \
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE | \
SNDRV_CTL_ELEM_ACCESS_TLV_READ, \
.info = snd_ca0106_volume_info, \
.info = snd_ca0106_volume_info, \
.get = snd_ca0106_volume_get, \
.get = snd_ca0106_volume_get, \
.put = snd_ca0106_volume_put, \
.put = snd_ca0106_volume_put, \
.tlv
=
snd_ca0106_db_scale, \
.tlv
.p =
snd_ca0106_db_scale, \
.private_value = ((chid) << 8) | (reg) \
.private_value = ((chid) << 8) | (reg) \
}
}
...
...
sound/pci/hda/hda_codec.c
View file @
302e9c5a
...
@@ -29,6 +29,7 @@
...
@@ -29,6 +29,7 @@
#include <sound/core.h>
#include <sound/core.h>
#include "hda_codec.h"
#include "hda_codec.h"
#include <sound/asoundef.h>
#include <sound/asoundef.h>
#include <sound/tlv.h>
#include <sound/initval.h>
#include <sound/initval.h>
#include "hda_local.h"
#include "hda_local.h"
...
@@ -841,6 +842,38 @@ int snd_hda_mixer_amp_volume_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e
...
@@ -841,6 +842,38 @@ int snd_hda_mixer_amp_volume_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e
return
change
;
return
change
;
}
}
int
snd_hda_mixer_amp_tlv
(
struct
snd_kcontrol
*
kcontrol
,
int
op_flag
,
unsigned
int
size
,
unsigned
int
__user
*
_tlv
)
{
struct
hda_codec
*
codec
=
snd_kcontrol_chip
(
kcontrol
);
hda_nid_t
nid
=
get_amp_nid
(
kcontrol
);
int
dir
=
get_amp_direction
(
kcontrol
);
u32
caps
,
val1
,
val2
;
if
(
size
<
4
*
sizeof
(
unsigned
int
))
return
-
ENOMEM
;
caps
=
query_amp_caps
(
codec
,
nid
,
dir
);
val2
=
(((
caps
&
AC_AMPCAP_STEP_SIZE
)
>>
AC_AMPCAP_STEP_SIZE_SHIFT
)
+
1
)
*
25
;
val1
=
-
((
caps
&
AC_AMPCAP_OFFSET
)
>>
AC_AMPCAP_OFFSET_SHIFT
);
val1
=
((
int
)
val1
)
*
((
int
)
val2
);
if
(
caps
&
AC_AMPCAP_MUTE
)
val2
|=
0x10000
;
if
((
val2
&
0x10000
)
==
0
&&
dir
==
HDA_OUTPUT
)
{
caps
=
query_amp_caps
(
codec
,
nid
,
HDA_INPUT
);
if
(
caps
&
AC_AMPCAP_MUTE
)
val2
|=
0x10000
;
}
if
(
put_user
(
SNDRV_CTL_TLVT_DB_SCALE
,
_tlv
))
return
-
EFAULT
;
if
(
put_user
(
2
*
sizeof
(
unsigned
int
),
_tlv
+
1
))
return
-
EFAULT
;
if
(
put_user
(
val1
,
_tlv
+
2
))
return
-
EFAULT
;
if
(
put_user
(
val2
,
_tlv
+
3
))
return
-
EFAULT
;
return
0
;
}
/* switch */
/* switch */
int
snd_hda_mixer_amp_switch_info
(
struct
snd_kcontrol
*
kcontrol
,
struct
snd_ctl_elem_info
*
uinfo
)
int
snd_hda_mixer_amp_switch_info
(
struct
snd_kcontrol
*
kcontrol
,
struct
snd_ctl_elem_info
*
uinfo
)
{
{
...
...
sound/pci/hda/hda_local.h
View file @
302e9c5a
...
@@ -30,9 +30,13 @@
...
@@ -30,9 +30,13 @@
/* mono volume with index (index=0,1,...) (channel=1,2) */
/* mono volume with index (index=0,1,...) (channel=1,2) */
#define HDA_CODEC_VOLUME_MONO_IDX(xname, xcidx, nid, channel, xindex, direction) \
#define HDA_CODEC_VOLUME_MONO_IDX(xname, xcidx, nid, channel, xindex, direction) \
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xcidx, \
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xcidx, \
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE | \
SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK, \
.info = snd_hda_mixer_amp_volume_info, \
.info = snd_hda_mixer_amp_volume_info, \
.get = snd_hda_mixer_amp_volume_get, \
.get = snd_hda_mixer_amp_volume_get, \
.put = snd_hda_mixer_amp_volume_put, \
.put = snd_hda_mixer_amp_volume_put, \
.tlv.c = snd_hda_mixer_amp_tlv, \
.private_value = HDA_COMPOSE_AMP_VAL(nid, channel, xindex, direction) }
.private_value = HDA_COMPOSE_AMP_VAL(nid, channel, xindex, direction) }
/* stereo volume with index */
/* stereo volume with index */
#define HDA_CODEC_VOLUME_IDX(xname, xcidx, nid, xindex, direction) \
#define HDA_CODEC_VOLUME_IDX(xname, xcidx, nid, xindex, direction) \
...
@@ -63,6 +67,7 @@
...
@@ -63,6 +67,7 @@
int
snd_hda_mixer_amp_volume_info
(
struct
snd_kcontrol
*
kcontrol
,
struct
snd_ctl_elem_info
*
uinfo
);
int
snd_hda_mixer_amp_volume_info
(
struct
snd_kcontrol
*
kcontrol
,
struct
snd_ctl_elem_info
*
uinfo
);
int
snd_hda_mixer_amp_volume_get
(
struct
snd_kcontrol
*
kcontrol
,
struct
snd_ctl_elem_value
*
ucontrol
);
int
snd_hda_mixer_amp_volume_get
(
struct
snd_kcontrol
*
kcontrol
,
struct
snd_ctl_elem_value
*
ucontrol
);
int
snd_hda_mixer_amp_volume_put
(
struct
snd_kcontrol
*
kcontrol
,
struct
snd_ctl_elem_value
*
ucontrol
);
int
snd_hda_mixer_amp_volume_put
(
struct
snd_kcontrol
*
kcontrol
,
struct
snd_ctl_elem_value
*
ucontrol
);
int
snd_hda_mixer_amp_tlv
(
struct
snd_kcontrol
*
kcontrol
,
int
op_flag
,
unsigned
int
size
,
unsigned
int
__user
*
tlv
);
int
snd_hda_mixer_amp_switch_info
(
struct
snd_kcontrol
*
kcontrol
,
struct
snd_ctl_elem_info
*
uinfo
);
int
snd_hda_mixer_amp_switch_info
(
struct
snd_kcontrol
*
kcontrol
,
struct
snd_ctl_elem_info
*
uinfo
);
int
snd_hda_mixer_amp_switch_get
(
struct
snd_kcontrol
*
kcontrol
,
struct
snd_ctl_elem_value
*
ucontrol
);
int
snd_hda_mixer_amp_switch_get
(
struct
snd_kcontrol
*
kcontrol
,
struct
snd_ctl_elem_value
*
ucontrol
);
int
snd_hda_mixer_amp_switch_put
(
struct
snd_kcontrol
*
kcontrol
,
struct
snd_ctl_elem_value
*
ucontrol
);
int
snd_hda_mixer_amp_switch_put
(
struct
snd_kcontrol
*
kcontrol
,
struct
snd_ctl_elem_value
*
ucontrol
);
...
...
sound/pci/hda/patch_analog.c
View file @
302e9c5a
...
@@ -452,6 +452,19 @@ static int ad1986a_pcm_amp_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl
...
@@ -452,6 +452,19 @@ static int ad1986a_pcm_amp_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl
return
change
;
return
change
;
}
}
static
int
ad1986a_pcm_amp_tlv
(
struct
snd_kcontrol
*
kcontrol
,
int
op_flag
,
unsigned
int
size
,
unsigned
int
__user
*
_tlv
)
{
struct
hda_codec
*
codec
=
snd_kcontrol_chip
(
kcontrol
);
struct
ad198x_spec
*
ad
=
codec
->
spec
;
mutex_lock
(
&
ad
->
amp_mutex
);
snd_hda_mixer_amp_tlv
(
kcontrol
,
op_flag
,
size
,
_tlv
);
mutex_unlock
(
&
ad
->
amp_mutex
);
return
0
;
}
#define ad1986a_pcm_amp_sw_info snd_hda_mixer_amp_switch_info
#define ad1986a_pcm_amp_sw_info snd_hda_mixer_amp_switch_info
static
int
ad1986a_pcm_amp_sw_get
(
struct
snd_kcontrol
*
kcontrol
,
struct
snd_ctl_elem_value
*
ucontrol
)
static
int
ad1986a_pcm_amp_sw_get
(
struct
snd_kcontrol
*
kcontrol
,
struct
snd_ctl_elem_value
*
ucontrol
)
...
@@ -488,9 +501,13 @@ static struct snd_kcontrol_new ad1986a_mixers[] = {
...
@@ -488,9 +501,13 @@ static struct snd_kcontrol_new ad1986a_mixers[] = {
{
{
.
iface
=
SNDRV_CTL_ELEM_IFACE_MIXER
,
.
iface
=
SNDRV_CTL_ELEM_IFACE_MIXER
,
.
name
=
"PCM Playback Volume"
,
.
name
=
"PCM Playback Volume"
,
.
access
=
SNDRV_CTL_ELEM_ACCESS_READWRITE
|
SNDRV_CTL_ELEM_ACCESS_TLV_READ
|
SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK
,
.
info
=
ad1986a_pcm_amp_vol_info
,
.
info
=
ad1986a_pcm_amp_vol_info
,
.
get
=
ad1986a_pcm_amp_vol_get
,
.
get
=
ad1986a_pcm_amp_vol_get
,
.
put
=
ad1986a_pcm_amp_vol_put
,
.
put
=
ad1986a_pcm_amp_vol_put
,
.
tlv
.
c
=
ad1986a_pcm_amp_tlv
,
.
private_value
=
HDA_COMPOSE_AMP_VAL
(
AD1986A_FRONT_DAC
,
3
,
0
,
HDA_OUTPUT
)
.
private_value
=
HDA_COMPOSE_AMP_VAL
(
AD1986A_FRONT_DAC
,
3
,
0
,
HDA_OUTPUT
)
},
},
{
{
...
...
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