Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 34867
b: refs/heads/master
c: 30ba6e2
h: refs/heads/master
i:
  34865: 65e3c93
  34863: a42f45d
v: v3
  • Loading branch information
Jochen Voss authored and Jaroslav Kysela committed Sep 23, 2006
1 parent c17c0e8 commit 1afde62
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 2 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: 96d9e9347c9c5ca980bef22b4add7d437d79034f
refs/heads/master: 30ba6e207a915a6c70f22ccb3f9169d1cce88466
72 changes: 72 additions & 0 deletions trunk/sound/i2c/other/ak4xxx-adda.c
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,57 @@ static int snd_akm4xxx_deemphasis_put(struct snd_kcontrol *kcontrol,
return change;
}

static int ak4xxx_switch_info(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
{
uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
uinfo->count = 1;
uinfo->value.integer.min = 0;
uinfo->value.integer.max = 1;
return 0;
}

static int ak4xxx_switch_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_akm4xxx *ak = snd_kcontrol_chip(kcontrol);
int chip = AK_GET_CHIP(kcontrol->private_value);
int addr = AK_GET_ADDR(kcontrol->private_value);
int shift = AK_GET_SHIFT(kcontrol->private_value);
int invert = AK_GET_INVERT(kcontrol->private_value);
unsigned char val = snd_akm4xxx_get(ak, chip, addr);

if (invert)
val = ! val;
ucontrol->value.integer.value[0] = (val & (1<<shift)) != 0;
return 0;
}

static int ak4xxx_switch_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_akm4xxx *ak = snd_kcontrol_chip(kcontrol);
int chip = AK_GET_CHIP(kcontrol->private_value);
int addr = AK_GET_ADDR(kcontrol->private_value);
int shift = AK_GET_SHIFT(kcontrol->private_value);
int invert = AK_GET_INVERT(kcontrol->private_value);
long flag = ucontrol->value.integer.value[0];
unsigned char val, oval;
int change;

if (invert)
flag = ! flag;
oval = snd_akm4xxx_get(ak, chip, addr);
if (flag)
val = oval | (1<<shift);
else
val = oval & ~(1<<shift);
change = (oval != val);
if (change)
snd_akm4xxx_write(ak, chip, addr, val);
return change;
}

/*
* build AK4xxx controls
*/
Expand Down Expand Up @@ -621,6 +672,27 @@ int snd_akm4xxx_build_controls(struct snd_akm4xxx *ak)
SNDRV_CTL_ELEM_ACCESS_WRITE));
if (err < 0)
goto __error;

memset(ctl, 0, sizeof(*ctl));
if (ak->channel_names == NULL)
strcpy(ctl->id.name, "Capture Switch");
else
strcpy(ctl->id.name, ak->channel_names[1]);
ctl->id.index = ak->idx_offset * 2;
ctl->id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
ctl->count = 1;
ctl->info = ak4xxx_switch_info;
ctl->get = ak4xxx_switch_get;
ctl->put = ak4xxx_switch_put;
/* register 2, bit 0 (SMUTE): 0 = normal operation, 1 = mute */
ctl->private_value =
AK_COMPOSE(0, 2, 0, 0) | AK_INVERT;
ctl->private_data = ak;
err = snd_ctl_add(ak->card,
snd_ctl_new(ctl, SNDRV_CTL_ELEM_ACCESS_READ|
SNDRV_CTL_ELEM_ACCESS_WRITE));
if (err < 0)
goto __error;
}

if (ak->type == SND_AK4355 || ak->type == SND_AK4358)
Expand Down
2 changes: 1 addition & 1 deletion trunk/sound/pci/ice1712/revo.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ static char *revo51_channel_names[] = {"PCM Playback Volume", "PCM Center Playba
"PCM LFE Playback Volume", "PCM Rear Playback Volume"};

static unsigned int revo51_adc_num_stereo[] = {2};
static char *revo51_adc_channel_names[] = {"PCM Capture Volume"};
static char *revo51_adc_channel_names[] = {"PCM Capture Volume","PCM Capture Switch"};

static struct snd_akm4xxx akm_revo_front __devinitdata = {
.type = SND_AK4381,
Expand Down

0 comments on commit 1afde62

Please sign in to comment.