Skip to content

Commit

Permalink
[ALSA] Clean up with common snd_ctl_boolean_*_info callbacks
Browse files Browse the repository at this point in the history
Clean up codes using the new common snd_ctl_boolean_*_info() callbacks.

Signed-off-by: Takashi Iwai <[email protected]>
Signed-off-by: Jaroslav Kysela <[email protected]>
  • Loading branch information
tiwai authored and perexg committed Oct 16, 2007
1 parent b9ed4f2 commit a5ce889
Show file tree
Hide file tree
Showing 60 changed files with 119 additions and 973 deletions.
3 changes: 1 addition & 2 deletions include/sound/soc.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,7 @@ int snd_soc_info_volsw(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo);
int snd_soc_info_volsw_ext(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo);
int snd_soc_info_bool_ext(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo);
#define snd_soc_info_bool_ext snd_ctl_boolean_mono
int snd_soc_get_volsw(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol);
int snd_soc_put_volsw(struct snd_kcontrol *kcontrol,
Expand Down
20 changes: 2 additions & 18 deletions sound/aoa/codecs/snd-aoa-codec-onyx.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,15 +297,7 @@ static struct snd_kcontrol_new capture_source_control = {
.put = onyx_snd_capture_source_put,
};

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

static int onyx_snd_mute_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
Expand Down Expand Up @@ -359,15 +351,7 @@ static struct snd_kcontrol_new mute_control = {
};


static int onyx_snd_single_bit_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;
}
#define onyx_snd_single_bit_info snd_ctl_boolean_mono_info

#define FLAG_POLARITY_INVERT 1
#define FLAG_SPDIFLOCK 2
Expand Down
20 changes: 2 additions & 18 deletions sound/aoa/codecs/snd-aoa-codec-tas.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,15 +272,7 @@ static struct snd_kcontrol_new volume_control = {
.put = tas_snd_vol_put,
};

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

static int tas_snd_mute_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
Expand Down Expand Up @@ -431,15 +423,7 @@ static struct snd_kcontrol_new drc_range_control = {
.put = tas_snd_drc_range_put,
};

static int tas_snd_drc_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;
}
#define tas_snd_drc_switch_info snd_ctl_boolean_mono_info

static int tas_snd_drc_switch_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
Expand Down
10 changes: 1 addition & 9 deletions sound/aoa/fabrics/snd-aoa-fabric-layout.c
Original file line number Diff line number Diff line change
Expand Up @@ -582,15 +582,7 @@ static int layouts_list_items;
* make the fabric handle all the card stuff, etc... */
static struct layout_dev *layout_device;

static int control_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;
}
#define control_info snd_ctl_boolean_mono_info

#define AMP_CONTROL(n, description) \
static int n##_control_get(struct snd_kcontrol *kcontrol, \
Expand Down
10 changes: 1 addition & 9 deletions sound/drivers/dummy.c
Original file line number Diff line number Diff line change
Expand Up @@ -510,15 +510,7 @@ static const DECLARE_TLV_DB_SCALE(db_scale_dummy, -4500, 30, 0);
.get = snd_dummy_capsrc_get, .put = snd_dummy_capsrc_put, \
.private_value = addr }

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

static int snd_dummy_capsrc_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
Expand Down
10 changes: 1 addition & 9 deletions sound/drivers/mts64.c
Original file line number Diff line number Diff line change
Expand Up @@ -440,15 +440,7 @@ static void mts64_write_midi(struct mts64 *mts, u8 c,
*********************************************************************/

/* SMPTE Switch */
static int snd_mts64_ctl_smpte_switch_info(struct snd_kcontrol *kctl,
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;
}
#define snd_mts64_ctl_smpte_switch_info snd_ctl_boolean_mono_info

static int snd_mts64_ctl_smpte_switch_get(struct snd_kcontrol* kctl,
struct snd_ctl_elem_value *uctl)
Expand Down
18 changes: 2 additions & 16 deletions sound/drivers/vx/vx_mixer.c
Original file line number Diff line number Diff line change
Expand Up @@ -647,14 +647,7 @@ static int vx_audio_monitor_put(struct snd_kcontrol *kcontrol, struct snd_ctl_el
return 0;
}

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

static int vx_audio_sw_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
Expand Down Expand Up @@ -865,14 +858,7 @@ static int vx_peak_meter_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_
return 0;
}

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

static int vx_saturation_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
Expand Down
10 changes: 1 addition & 9 deletions sound/i2c/other/ak4114.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,15 +200,7 @@ static int snd_ak4114_in_error_get(struct snd_kcontrol *kcontrol,
return 0;
}

static int snd_ak4114_in_bit_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;
}
#define snd_ak4114_in_bit_info snd_ctl_boolean_mono_info

static int snd_ak4114_in_bit_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
Expand Down
10 changes: 1 addition & 9 deletions sound/i2c/other/ak4117.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,15 +181,7 @@ static int snd_ak4117_in_error_get(struct snd_kcontrol *kcontrol,
return 0;
}

static int snd_ak4117_in_bit_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;
}
#define snd_ak4117_in_bit_info snd_ctl_boolean_mono_info

static int snd_ak4117_in_bit_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
Expand Down
10 changes: 1 addition & 9 deletions sound/i2c/other/ak4xxx-adda.c
Original file line number Diff line number Diff line change
Expand Up @@ -463,15 +463,7 @@ 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;
}
#define ak4xxx_switch_info snd_ctl_boolean_mono_info

static int ak4xxx_switch_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
Expand Down
10 changes: 1 addition & 9 deletions sound/i2c/other/pt2258.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,7 @@ static int pt2258_stereo_volume_put(struct snd_kcontrol *kcontrol,
return -EIO;
}

static int pt2258_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;
}
#define pt2258_switch_info snd_ctl_boolean_mono_info

static int pt2258_switch_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
Expand Down
10 changes: 1 addition & 9 deletions sound/i2c/tea6330t.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,15 +142,7 @@ static int snd_tea6330t_put_master_volume(struct snd_kcontrol *kcontrol,
.info = snd_tea6330t_info_master_switch, \
.get = snd_tea6330t_get_master_switch, .put = snd_tea6330t_put_master_switch }

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

static int snd_tea6330t_get_master_switch(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
Expand Down
18 changes: 2 additions & 16 deletions sound/isa/es18xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1071,14 +1071,7 @@ static int snd_es18xx_put_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem
return (snd_es18xx_mixer_bits(chip, 0x1c, 0x07, val) != val) || retVal;
}

static int snd_es18xx_info_spatializer_enable(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;
}
#define snd_es18xx_info_spatializer_enable snd_ctl_boolean_mono_info

static int snd_es18xx_get_spatializer_enable(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
Expand Down Expand Up @@ -1120,14 +1113,7 @@ static int snd_es18xx_get_hw_volume(struct snd_kcontrol *kcontrol, struct snd_ct
return 0;
}

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

static int snd_es18xx_get_hw_switch(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
Expand Down
9 changes: 1 addition & 8 deletions sound/isa/gus/gus_mixer.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,7 @@
.get = snd_gf1_get_single, .put = snd_gf1_put_single, \
.private_value = shift | (invert << 8) }

static int snd_gf1_info_single(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;
}
#define snd_gf1_info_single snd_ctl_boolean_mono_info

static int snd_gf1_get_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
Expand Down
18 changes: 2 additions & 16 deletions sound/isa/opti9xx/miro.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,14 +242,7 @@ static int aci_setvalue(struct snd_miro * miro, unsigned char index, int value)
* MIXER part
*/

static int snd_miro_info_capture(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
{
uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
uinfo->count = 1;

return 0;
}
#define snd_miro_info_capture snd_ctl_boolean_mono_info

static int snd_miro_get_capture(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
Expand Down Expand Up @@ -344,14 +337,7 @@ static int snd_miro_put_preamp(struct snd_kcontrol *kcontrol,
return change;
}

static int snd_miro_info_amp(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
{
uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
uinfo->count = 1;

return 0;
}
#define snd_miro_info_amp snd_ctl_boolean_mono_info

static int snd_miro_get_amp(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
Expand Down
9 changes: 1 addition & 8 deletions sound/isa/sb/sb16_csp.c
Original file line number Diff line number Diff line change
Expand Up @@ -979,14 +979,7 @@ static int snd_sb_csp_restart(struct snd_sb_csp * p)
* QSound mixer control for PCM
*/

static int snd_sb_qsound_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;
}
#define snd_sb_qsound_switch_info snd_ctl_boolean_mono_info

static int snd_sb_qsound_switch_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
Expand Down
19 changes: 2 additions & 17 deletions sound/pci/ac97/ac97_patch.c
Original file line number Diff line number Diff line change
Expand Up @@ -1880,14 +1880,7 @@ static int patch_ad1981b(struct snd_ac97 *ac97)
return 0;
}

static int snd_ac97_ad1888_lohpsel_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;
}
#define snd_ac97_ad1888_lohpsel_info snd_ctl_boolean_mono_info

static int snd_ac97_ad1888_lohpsel_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
Expand Down Expand Up @@ -2186,15 +2179,7 @@ static int patch_ad1985(struct snd_ac97 * ac97)
return 0;
}

static int snd_ac97_ad1986_bool_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;
}
#define snd_ac97_ad1986_bool_info snd_ctl_boolean_mono_info

static int snd_ac97_ad1986_lososel_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
Expand Down
10 changes: 1 addition & 9 deletions sound/pci/ali5451/ali5451.c
Original file line number Diff line number Diff line change
Expand Up @@ -1804,15 +1804,7 @@ static int __devinit snd_ali_build_pcms(struct snd_ali *codec)
.info = snd_ali5451_spdif_info, .get = snd_ali5451_spdif_get, \
.put = snd_ali5451_spdif_put, .private_value = value}

static int snd_ali5451_spdif_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;
}
#define snd_ali5451_spdif_info snd_ctl_boolean_mono_info

static int snd_ali5451_spdif_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
Expand Down
Loading

0 comments on commit a5ce889

Please sign in to comment.