aboutsummaryrefslogtreecommitdiff
path: root/sound/pci/ice1712/se.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2008-01-18 13:36:07 +0100
committerJaroslav Kysela <perex@perex.cz>2008-01-31 17:30:05 +0100
commit7cda8ba9f4e471dfba914ecf67fd14ebffb17c16 (patch)
tree5786b450d9099809b974929ea356b444c9f2bc07 /sound/pci/ice1712/se.c
parent797760ab14db4e82a50c06a9916dd5c6147b415b (diff)
[ALSA] ice1712, ice1724 - Code clean up
Clean up ice1712/ice1724 codes. The board-specific data is allocated locally in each code instead of having an ungly union in struct ice1712. Also, fix coding issues in prodigy_hifi.c. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound/pci/ice1712/se.c')
-rw-r--r--sound/pci/ice1712/se.c61
1 files changed, 40 insertions, 21 deletions
diff --git a/sound/pci/ice1712/se.c b/sound/pci/ice1712/se.c
index 6661f65a6f2..69673b95869 100644
--- a/sound/pci/ice1712/se.c
+++ b/sound/pci/ice1712/se.c
@@ -34,6 +34,11 @@
#include "envy24ht.h"
#include "se.h"
+struct se_spec {
+ struct {
+ unsigned char ch1, ch2;
+ } vol[8];
+};
/****************************************************************************/
/* ONKYO WAVIO SE-200PCI */
@@ -462,9 +467,10 @@ static int se200pci_cont_volume_get(struct snd_kcontrol *kc,
struct snd_ctl_elem_value *uc)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kc);
+ struct se_spec *spec = ice->spec;
int n = kc->private_value;
- uc->value.integer.value[0] = ice->spec.se.vol[n].ch1;
- uc->value.integer.value[1] = ice->spec.se.vol[n].ch2;
+ uc->value.integer.value[0] = spec->vol[n].ch1;
+ uc->value.integer.value[1] = spec->vol[n].ch2;
return 0;
}
@@ -472,8 +478,9 @@ static int se200pci_cont_boolean_get(struct snd_kcontrol *kc,
struct snd_ctl_elem_value *uc)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kc);
+ struct se_spec *spec = ice->spec;
int n = kc->private_value;
- uc->value.integer.value[0] = ice->spec.se.vol[n].ch1;
+ uc->value.integer.value[0] = spec->vol[n].ch1;
return 0;
}
@@ -481,44 +488,46 @@ static int se200pci_cont_enum_get(struct snd_kcontrol *kc,
struct snd_ctl_elem_value *uc)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kc);
+ struct se_spec *spec = ice->spec;
int n = kc->private_value;
- uc->value.enumerated.item[0] = ice->spec.se.vol[n].ch1;
+ uc->value.enumerated.item[0] = spec->vol[n].ch1;
return 0;
}
static void se200pci_cont_update(struct snd_ice1712 *ice, int n)
{
+ struct se_spec *spec = ice->spec;
switch (se200pci_cont[n].target) {
case WM8766:
se200pci_WM8766_set_volume(ice,
se200pci_cont[n].ch,
- ice->spec.se.vol[n].ch1,
- ice->spec.se.vol[n].ch2);
+ spec->vol[n].ch1,
+ spec->vol[n].ch2);
break;
case WM8776in:
se200pci_WM8776_set_input_volume(ice,
- ice->spec.se.vol[n].ch1,
- ice->spec.se.vol[n].ch2);
+ spec->vol[n].ch1,
+ spec->vol[n].ch2);
break;
case WM8776out:
se200pci_WM8776_set_output_volume(ice,
- ice->spec.se.vol[n].ch1,
- ice->spec.se.vol[n].ch2);
+ spec->vol[n].ch1,
+ spec->vol[n].ch2);
break;
case WM8776sel:
se200pci_WM8776_set_input_selector(ice,
- ice->spec.se.vol[n].ch1);
+ spec->vol[n].ch1);
break;
case WM8776agc:
- se200pci_WM8776_set_agc(ice, ice->spec.se.vol[n].ch1);
+ se200pci_WM8776_set_agc(ice, spec->vol[n].ch1);
break;
case WM8776afl:
- se200pci_WM8776_set_afl(ice, ice->spec.se.vol[n].ch1);
+ se200pci_WM8776_set_afl(ice, spec->vol[n].ch1);
break;
default:
@@ -530,6 +539,7 @@ static int se200pci_cont_volume_put(struct snd_kcontrol *kc,
struct snd_ctl_elem_value *uc)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kc);
+ struct se_spec *spec = ice->spec;
int n = kc->private_value;
unsigned int vol1, vol2;
int changed;
@@ -537,12 +547,12 @@ static int se200pci_cont_volume_put(struct snd_kcontrol *kc,
changed = 0;
vol1 = uc->value.integer.value[0] & 0xff;
vol2 = uc->value.integer.value[1] & 0xff;
- if (ice->spec.se.vol[n].ch1 != vol1) {
- ice->spec.se.vol[n].ch1 = vol1;
+ if (spec->vol[n].ch1 != vol1) {
+ spec->vol[n].ch1 = vol1;
changed = 1;
}
- if (ice->spec.se.vol[n].ch2 != vol2) {
- ice->spec.se.vol[n].ch2 = vol2;
+ if (spec->vol[n].ch2 != vol2) {
+ spec->vol[n].ch2 = vol2;
changed = 1;
}
if (changed)
@@ -555,12 +565,13 @@ static int se200pci_cont_boolean_put(struct snd_kcontrol *kc,
struct snd_ctl_elem_value *uc)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kc);
+ struct se_spec *spec = ice->spec;
int n = kc->private_value;
unsigned int vol1;
vol1 = !!uc->value.integer.value[0];
- if (ice->spec.se.vol[n].ch1 != vol1) {
- ice->spec.se.vol[n].ch1 = vol1;
+ if (spec->vol[n].ch1 != vol1) {
+ spec->vol[n].ch1 = vol1;
se200pci_cont_update(ice, n);
return 1;
}
@@ -571,14 +582,15 @@ static int se200pci_cont_enum_put(struct snd_kcontrol *kc,
struct snd_ctl_elem_value *uc)
{
struct snd_ice1712 *ice = snd_kcontrol_chip(kc);
+ struct se_spec *spec = ice->spec;
int n = kc->private_value;
unsigned int vol1;
vol1 = uc->value.enumerated.item[0];
if (vol1 >= se200pci_get_enum_count(n))
return -EINVAL;
- if (ice->spec.se.vol[n].ch1 != vol1) {
- ice->spec.se.vol[n].ch1 = vol1;
+ if (spec->vol[n].ch1 != vol1) {
+ spec->vol[n].ch1 = vol1;
se200pci_cont_update(ice, n);
return 1;
}
@@ -668,6 +680,13 @@ static int __devinit se200pci_add_controls(struct snd_ice1712 *ice)
static int __devinit se_init(struct snd_ice1712 *ice)
{
+ struct se_spec *spec;
+
+ spec = kzalloc(sizeof(*spec), GFP_KERNEL);
+ if (!spec)
+ return -ENOMEM;
+ ice->spec = spec;
+
if (ice->eeprom.subvendor == VT1724_SUBDEVICE_SE90PCI) {
ice->num_total_dacs = 2;
ice->num_total_adcs = 0;