aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2009-12-22 05:56:32 -0500
committerTakashi Iwai <tiwai@suse.de>2009-12-22 05:56:32 -0500
commit75d1aeb9d6899b10420d10284e8ea894b2794224 (patch)
tree91ef92451d09dcbecabc035fb174779f429de177
parent0c2fd1bf4c6cb6095d8b3088d285167e66c12147 (diff)
ALSA: hda - Add Bass Speaker switch for HP dv7
The bass speaker is controlled via GPIO5. Tested-by: Wael Nasreddine <mla@nasreddine.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/pci/hda/patch_sigmatel.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 0bafea9d5106..a4526d008042 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -5402,6 +5402,54 @@ static int stac92hd71bxx_connected_smuxes(struct hda_codec *codec,
5402 return 0; 5402 return 0;
5403} 5403}
5404 5404
5405/* HP dv7 bass switch - GPIO5 */
5406#define stac_hp_bass_gpio_info snd_ctl_boolean_mono_info
5407static int stac_hp_bass_gpio_get(struct snd_kcontrol *kcontrol,
5408 struct snd_ctl_elem_value *ucontrol)
5409{
5410 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5411 struct sigmatel_spec *spec = codec->spec;
5412 ucontrol->value.integer.value[0] = !!(spec->gpio_data & 0x20);
5413 return 0;
5414}
5415
5416static int stac_hp_bass_gpio_put(struct snd_kcontrol *kcontrol,
5417 struct snd_ctl_elem_value *ucontrol)
5418{
5419 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5420 struct sigmatel_spec *spec = codec->spec;
5421 unsigned int gpio_data;
5422
5423 gpio_data = (spec->gpio_data & ~0x20) |
5424 (ucontrol->value.integer.value[0] ? 0x20 : 0);
5425 if (gpio_data == spec->gpio_data)
5426 return 0;
5427 spec->gpio_data = gpio_data;
5428 stac_gpio_set(codec, spec->gpio_mask, spec->gpio_dir, spec->gpio_data);
5429 return 1;
5430}
5431
5432static struct snd_kcontrol_new stac_hp_bass_sw_ctrl = {
5433 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5434 .info = stac_hp_bass_gpio_info,
5435 .get = stac_hp_bass_gpio_get,
5436 .put = stac_hp_bass_gpio_put,
5437};
5438
5439static int stac_add_hp_bass_switch(struct hda_codec *codec)
5440{
5441 struct sigmatel_spec *spec = codec->spec;
5442
5443 if (!stac_control_new(spec, &stac_hp_bass_sw_ctrl,
5444 "Bass Speaker Playback Switch", 0))
5445 return -ENOMEM;
5446
5447 spec->gpio_mask |= 0x20;
5448 spec->gpio_dir |= 0x20;
5449 spec->gpio_data |= 0x20;
5450 return 0;
5451}
5452
5405static int patch_stac92hd71bxx(struct hda_codec *codec) 5453static int patch_stac92hd71bxx(struct hda_codec *codec)
5406{ 5454{
5407 struct sigmatel_spec *spec; 5455 struct sigmatel_spec *spec;
@@ -5642,6 +5690,15 @@ again:
5642 return err; 5690 return err;
5643 } 5691 }
5644 5692
5693 /* enable bass on HP dv7 */
5694 if (spec->board_config == STAC_HP_DV5) {
5695 unsigned int cap;
5696 cap = snd_hda_param_read(codec, 0x1, AC_PAR_GPIO_CAP);
5697 cap &= AC_GPIO_IO_COUNT;
5698 if (cap >= 6)
5699 stac_add_hp_bass_switch(codec);
5700 }
5701
5645 codec->proc_widget_hook = stac92hd7x_proc_hook; 5702 codec->proc_widget_hook = stac92hd7x_proc_hook;
5646 5703
5647 return 0; 5704 return 0;