Exemple #1
0
static int snd_cs4236_put_double1(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
    struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol);
    unsigned long flags;
    int left_reg = kcontrol->private_value & 0xff;
    int right_reg = (kcontrol->private_value >> 8) & 0xff;
    int shift_left = (kcontrol->private_value >> 16) & 0x07;
    int shift_right = (kcontrol->private_value >> 19) & 0x07;
    int mask = (kcontrol->private_value >> 24) & 0xff;
    int invert = (kcontrol->private_value >> 22) & 1;
    int change;
    unsigned short val1, val2;
    
    val1 = ucontrol->value.integer.value[0] & mask;
    val2 = ucontrol->value.integer.value[1] & mask;
    if (invert) {
        val1 = mask - val1;
        val2 = mask - val2;
    }
    val1 <<= shift_left;
    val2 <<= shift_right;
    spin_lock_irqsave(&chip->reg_lock, flags);
    val1 = (chip->image[left_reg] & ~(mask << shift_left)) | val1;
    val2 = (chip->eimage[CS4236_REG(right_reg)] & ~(mask << shift_right)) | val2;
    change = val1 != chip->image[left_reg] || val2 != chip->eimage[CS4236_REG(right_reg)];
    snd_cs4231_out(chip, left_reg, val1);
    snd_cs4236_ext_out(chip, right_reg, val2);
    spin_unlock_irqrestore(&chip->reg_lock, flags);
    return change;
}
Exemple #2
0
static int snd_cs4236_put_master_digital(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
    struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol);
    unsigned long flags;
    int change;
    unsigned short val1, val2;
    
    val1 = snd_cs4236_mixer_master_digital_invert_volume(ucontrol->value.integer.value[0] & 0x7f);
    val2 = snd_cs4236_mixer_master_digital_invert_volume(ucontrol->value.integer.value[1] & 0x7f);
    spin_lock_irqsave(&chip->reg_lock, flags);
    val1 = (chip->eimage[CS4236_REG(CS4236_LEFT_MASTER)] & ~0x7f) | val1;
    val2 = (chip->eimage[CS4236_REG(CS4236_RIGHT_MASTER)] & ~0x7f) | val2;
    change = val1 != chip->eimage[CS4236_REG(CS4236_LEFT_MASTER)] || val2 != chip->eimage[CS4236_REG(CS4236_RIGHT_MASTER)];
    snd_cs4236_ext_out(chip, CS4236_LEFT_MASTER, val1);
    snd_cs4236_ext_out(chip, CS4236_RIGHT_MASTER, val2);
    spin_unlock_irqrestore(&chip->reg_lock, flags);
    return change;
}
Exemple #3
0
static int snd_cs4236_get_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
    struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol);
    unsigned long flags;
    int left_reg = kcontrol->private_value & 0xff;
    int right_reg = (kcontrol->private_value >> 8) & 0xff;
    int shift_left = (kcontrol->private_value >> 16) & 0x07;
    int shift_right = (kcontrol->private_value >> 19) & 0x07;
    int mask = (kcontrol->private_value >> 24) & 0xff;
    int invert = (kcontrol->private_value >> 22) & 1;
    
    spin_lock_irqsave(&chip->reg_lock, flags);
    ucontrol->value.integer.value[0] = (chip->eimage[CS4236_REG(left_reg)] >> shift_left) & mask;
    ucontrol->value.integer.value[1] = (chip->eimage[CS4236_REG(right_reg)] >> shift_right) & mask;
    spin_unlock_irqrestore(&chip->reg_lock, flags);
    if (invert) {
        ucontrol->value.integer.value[0] = mask - ucontrol->value.integer.value[0];
        ucontrol->value.integer.value[1] = mask - ucontrol->value.integer.value[1];
    }
    return 0;
}
Exemple #4
0
static int snd_cs4236_put_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
    struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol);
    unsigned long flags;
    int reg = kcontrol->private_value & 0xff;
    int shift = (kcontrol->private_value >> 8) & 0xff;
    int mask = (kcontrol->private_value >> 16) & 0xff;
    int invert = (kcontrol->private_value >> 24) & 0xff;
    int change;
    unsigned short val;
    
    val = (ucontrol->value.integer.value[0] & mask);
    if (invert)
        val = mask - val;
    val <<= shift;
    spin_lock_irqsave(&chip->reg_lock, flags);
    val = (chip->eimage[CS4236_REG(reg)] & ~(mask << shift)) | val;
    change = val != chip->eimage[CS4236_REG(reg)];
    snd_cs4236_ext_out(chip, reg, val);
    spin_unlock_irqrestore(&chip->reg_lock, flags);
    return change;
}
Exemple #5
0
static int snd_cs4236_get_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
	struct snd_wss *chip = snd_kcontrol_chip(kcontrol);
	unsigned long flags;
	int reg = kcontrol->private_value & 0xff;
	int shift = (kcontrol->private_value >> 8) & 0xff;
	int mask = (kcontrol->private_value >> 16) & 0xff;
	int invert = (kcontrol->private_value >> 24) & 0xff;
	
	spin_lock_irqsave(&chip->reg_lock, flags);
	ucontrol->value.integer.value[0] = (chip->eimage[CS4236_REG(reg)] >> shift) & mask;
	spin_unlock_irqrestore(&chip->reg_lock, flags);
	if (invert)
		ucontrol->value.integer.value[0] = mask - ucontrol->value.integer.value[0];
	return 0;
}
Exemple #6
0
static int snd_cs4236_get_master_digital(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
    struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol);
    unsigned long flags;
    
    spin_lock_irqsave(&chip->reg_lock, flags);
    ucontrol->value.integer.value[0] = snd_cs4236_mixer_master_digital_invert_volume(chip->eimage[CS4236_REG(CS4236_LEFT_MASTER)] & 0x7f);
    ucontrol->value.integer.value[1] = snd_cs4236_mixer_master_digital_invert_volume(chip->eimage[CS4236_REG(CS4236_RIGHT_MASTER)] & 0x7f);
    spin_unlock_irqrestore(&chip->reg_lock, flags);
    return 0;
}