Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 342629
b: refs/heads/master
c: d847ce0
h: refs/heads/master
i:
  342627: 1a0fc96
v: v3
  • Loading branch information
Eldad Zack authored and Takashi Iwai committed Nov 29, 2012
1 parent bee57e4 commit 6fcf131
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5dae5fd24071319bb67d3375217d5b0b6d16cb0b
refs/heads/master: d847ce0e9a9031a3a62bbbe3ad8f37769a1a6f59
24 changes: 16 additions & 8 deletions trunk/sound/usb/mixer_quirks.c
Original file line number Diff line number Diff line change
Expand Up @@ -635,11 +635,13 @@ static int snd_nativeinstruments_create_mixer(struct usb_mixer_interface *mixer,
}

/* M-Audio FastTrack Ultra quirks */
/* FTU Effect switch */
/* FTU Effect switch (also used by C400) */
struct snd_ftu_eff_switch_priv_val {
struct usb_mixer_interface *mixer;
int cached_value;
int is_cached;
int bUnitID;
int validx;
};

static int snd_ftu_eff_switch_info(struct snd_kcontrol *kcontrol,
Expand Down Expand Up @@ -674,9 +676,8 @@ static int snd_ftu_eff_switch_get(struct snd_kcontrol *kctl,
struct snd_ftu_eff_switch_priv_val *pval;
int err;
unsigned char value[2];
int id, validx;

const int id = 6;
const int validx = 1;
const int val_len = 2;

value[0] = 0x00;
Expand All @@ -698,6 +699,8 @@ static int snd_ftu_eff_switch_get(struct snd_kcontrol *kctl,
if (snd_BUG_ON(!chip))
return -EINVAL;

id = pval->bUnitID;
validx = pval->validx;

down_read(&mixer->chip->shutdown_rwsem);
if (mixer->chip->shutdown)
Expand Down Expand Up @@ -728,10 +731,8 @@ static int snd_ftu_eff_switch_put(struct snd_kcontrol *kctl,
struct usb_mixer_interface *mixer;
int changed, cur_val, err, new_val;
unsigned char value[2];
int id, validx;


const int id = 6;
const int validx = 1;
const int val_len = 2;

changed = 0;
Expand All @@ -749,6 +750,9 @@ static int snd_ftu_eff_switch_put(struct snd_kcontrol *kctl,
if (snd_BUG_ON(!chip))
return -EINVAL;

id = pval->bUnitID;
validx = pval->validx;

if (!pval->is_cached) {
/* Read current value */
down_read(&mixer->chip->shutdown_rwsem);
Expand Down Expand Up @@ -793,7 +797,8 @@ static int snd_ftu_eff_switch_put(struct snd_kcontrol *kctl,
return changed;
}

static int snd_ftu_create_effect_switch(struct usb_mixer_interface *mixer)
static int snd_ftu_create_effect_switch(struct usb_mixer_interface *mixer,
int validx, int bUnitID)
{
static struct snd_kcontrol_new template = {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
Expand All @@ -816,6 +821,8 @@ static int snd_ftu_create_effect_switch(struct usb_mixer_interface *mixer)
pval->cached_value = 0;
pval->is_cached = 0;
pval->mixer = mixer;
pval->bUnitID = bUnitID;
pval->validx = validx;

template.private_value = (unsigned long) pval;
kctl = snd_ctl_new1(&template, mixer->chip);
Expand Down Expand Up @@ -974,9 +981,10 @@ static int snd_ftu_create_mixer(struct usb_mixer_interface *mixer)
if (err < 0)
return err;

err = snd_ftu_create_effect_switch(mixer);
err = snd_ftu_create_effect_switch(mixer, 1, 6);
if (err < 0)
return err;

err = snd_ftu_create_effect_volume_ctl(mixer);
if (err < 0)
return err;
Expand Down

0 comments on commit 6fcf131

Please sign in to comment.