static int st_output_switch_put(struct snd_kcontrol *ctl, struct snd_ctl_elem_value *value) { struct oxygen *chip = ctl->private_data; struct xonar_pcm179x *data = chip->model_data; u16 gpio_old, gpio; mutex_lock(&chip->mutex); gpio_old = oxygen_read16(chip, OXYGEN_GPIO_DATA); gpio = gpio_old; switch (value->value.enumerated.item[0]) { case 0: gpio &= ~(GPIO_ST_HP | GPIO_ST_HP_REAR); break; case 1: gpio |= GPIO_ST_HP | GPIO_ST_HP_REAR; break; case 2: gpio = (gpio | GPIO_ST_HP) & ~GPIO_ST_HP_REAR; break; } oxygen_write16(chip, OXYGEN_GPIO_DATA, gpio); data->hp_active = gpio & GPIO_ST_HP; update_pcm1796_volume(chip); mutex_unlock(&chip->mutex); return gpio != gpio_old; }
static void pcm1796_init(struct oxygen *chip) { struct xonar_data *data = chip->model_data; unsigned int i; for (i = 0; i < data->dacs; ++i) { pcm1796_write(chip, i, 19, PCM1796_FLT_SHARP | PCM1796_ATS_1); pcm1796_write(chip, i, 20, data->pcm1796_oversampling); pcm1796_write(chip, i, 21, 0); } update_pcm1796_mute(chip); /* set ATLD before ATL/ATR */ update_pcm1796_volume(chip); }
static int st_hp_volume_offset_put(struct snd_kcontrol *ctl, struct snd_ctl_elem_value *value) { static const s8 offsets[] = { 2*-18, 2*-6, 0 }; struct oxygen *chip = ctl->private_data; struct xonar_pcm179x *data = chip->model_data; s8 offset; int changed; if (value->value.enumerated.item[0] > 2) return -EINVAL; offset = offsets[value->value.enumerated.item[0]]; mutex_lock(&chip->mutex); changed = offset != data->hp_gain_offset; if (changed) { data->hp_gain_offset = offset; update_pcm1796_volume(chip); } mutex_unlock(&chip->mutex); return changed; }