static int wm8993_put_dc_servo(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); struct wm_hubs_data *hubs = snd_soc_codec_get_drvdata(codec); int ret; ret = snd_soc_put_volsw(kcontrol, ucontrol); /* */ hubs->class_w_dcs = 0; /* */ if (hubs->dcs_codes_l || hubs->dcs_codes_r || hubs->no_series_update) return ret; /* */ if (snd_soc_read(codec, WM8993_POWER_MANAGEMENT_1) & (WM8993_HPOUT1L_ENA | WM8993_HPOUT1R_ENA)) snd_soc_update_bits(codec, WM8993_DC_SERVO_0, WM8993_DCS_TRIG_SINGLE_0 | WM8993_DCS_TRIG_SINGLE_1, WM8993_DCS_TRIG_SINGLE_0 | WM8993_DCS_TRIG_SINGLE_1); return ret; }
/* * Update the DC servo calibration on gain changes */ static int wm8993_put_dc_servo(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); struct wm_hubs_data *hubs = snd_soc_codec_get_drvdata(codec); int ret; ret = snd_soc_put_volsw(kcontrol, ucontrol); /* Updating the analogue gains invalidates the DC servo cache */ hubs->class_w_dcs = 0; /* If we're applying an offset correction then updating the * callibration would be likely to introduce further offsets. */ if (hubs->dcs_codes_l || hubs->dcs_codes_r || hubs->no_series_update) return ret; /* Only need to do this if the outputs are active */ if (snd_soc_read(codec, WM8993_POWER_MANAGEMENT_1) & (WM8993_HPOUT1L_ENA | WM8993_HPOUT1R_ENA)) snd_soc_update_bits(codec, WM8993_DC_SERVO_0, WM8993_DCS_TRIG_SINGLE_0 | WM8993_DCS_TRIG_SINGLE_1, WM8993_DCS_TRIG_SINGLE_0 | WM8993_DCS_TRIG_SINGLE_1); return ret; }
/** * cs4270_soc_put_mute - put callback for the 'Master Playback switch' * alsa control. * @kcontrol: mixer control * @ucontrol: control element information * * This function basically passes the arguments on to the generic * snd_soc_put_volsw() function and saves the mute information in * our private data structure. This is because we want to prevent * cs4270_dai_mute() neglecting the user's decision to manually * mute the codec's output. * * Returns 0 for success. */ static int cs4270_soc_put_mute(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec); int left = !ucontrol->value.integer.value[0]; int right = !ucontrol->value.integer.value[1]; cs4270->manual_mute = (left ? CS4270_MUTE_DAC_A : 0) | (right ? CS4270_MUTE_DAC_B : 0); return snd_soc_put_volsw(kcontrol, ucontrol); }
static int s5m8751_outpga_put_volsw_vu(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); int reg = kcontrol->private_value & 0xff; int ret; u16 val; ret = snd_soc_put_volsw(kcontrol, ucontrol); if (ret < 0) return ret; val = s5m8751_codec_read(codec, reg); return s5m8751_codec_write(codec, reg, val); }
static int wm899x_outpga_put_volsw_vu(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); int reg = kcontrol->private_value & 0xff; int ret; u16 val; ret = snd_soc_put_volsw(kcontrol, ucontrol); if (ret < 0) return ret; /* now hit the volume update bits (always bit 8) */ val = snd_soc_read(codec, reg); return snd_soc_write(codec, reg, val | 0x0100); }
static int wm8400_outpga_put_volsw_vu(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); struct soc_mixer_control *mc = (struct soc_mixer_control *)kcontrol->private_value; int reg = mc->reg; int ret; u16 val; ret = snd_soc_put_volsw(kcontrol, ucontrol); if (ret < 0) return ret; /* */ val = wm8400_read(codec, reg); return wm8400_write(codec, reg, val | 0x0100); }
static int wm8400_outpga_put_volsw_vu(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); struct soc_mixer_control *mc = (struct soc_mixer_control *)kcontrol->private_value; int reg = mc->reg; int ret; u16 val; ret = snd_soc_put_volsw(kcontrol, ucontrol); if (ret < 0) return ret; /* now hit the volume update bits (always bit 8) */ val = snd_soc_read(codec, reg); return snd_soc_write(codec, reg, val | 0x0100); }
static int wm8904_adc_osr_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); unsigned int val; int ret; ret = snd_soc_put_volsw(kcontrol, ucontrol); if (ret < 0) return ret; if (ucontrol->value.integer.value[0]) val = 0; else val = WM8904_ADC_128_OSR_TST_MODE | WM8904_ADC_BIASX1P5; snd_soc_update_bits(codec, WM8904_ADC_TEST_0, WM8904_ADC_128_OSR_TST_MODE | WM8904_ADC_BIASX1P5, val); return ret; }