Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 182641
b: refs/heads/master
c: 75d1aeb
h: refs/heads/master
i:
  182639: 00be9a1
v: v3
  • Loading branch information
Takashi Iwai committed Dec 22, 2009
1 parent af7c209 commit 711c56c
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0c2fd1bf4c6cb6095d8b3088d285167e66c12147
refs/heads/master: 75d1aeb9d6899b10420d10284e8ea894b2794224
57 changes: 57 additions & 0 deletions trunk/sound/pci/hda/patch_sigmatel.c
Original file line number Diff line number Diff line change
Expand Up @@ -5402,6 +5402,54 @@ static int stac92hd71bxx_connected_smuxes(struct hda_codec *codec,
return 0;
}

/* HP dv7 bass switch - GPIO5 */
#define stac_hp_bass_gpio_info snd_ctl_boolean_mono_info
static int stac_hp_bass_gpio_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
struct sigmatel_spec *spec = codec->spec;
ucontrol->value.integer.value[0] = !!(spec->gpio_data & 0x20);
return 0;
}

static int stac_hp_bass_gpio_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
struct sigmatel_spec *spec = codec->spec;
unsigned int gpio_data;

gpio_data = (spec->gpio_data & ~0x20) |
(ucontrol->value.integer.value[0] ? 0x20 : 0);
if (gpio_data == spec->gpio_data)
return 0;
spec->gpio_data = gpio_data;
stac_gpio_set(codec, spec->gpio_mask, spec->gpio_dir, spec->gpio_data);
return 1;
}

static struct snd_kcontrol_new stac_hp_bass_sw_ctrl = {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.info = stac_hp_bass_gpio_info,
.get = stac_hp_bass_gpio_get,
.put = stac_hp_bass_gpio_put,
};

static int stac_add_hp_bass_switch(struct hda_codec *codec)
{
struct sigmatel_spec *spec = codec->spec;

if (!stac_control_new(spec, &stac_hp_bass_sw_ctrl,
"Bass Speaker Playback Switch", 0))
return -ENOMEM;

spec->gpio_mask |= 0x20;
spec->gpio_dir |= 0x20;
spec->gpio_data |= 0x20;
return 0;
}

static int patch_stac92hd71bxx(struct hda_codec *codec)
{
struct sigmatel_spec *spec;
Expand Down Expand Up @@ -5642,6 +5690,15 @@ static int patch_stac92hd71bxx(struct hda_codec *codec)
return err;
}

/* enable bass on HP dv7 */
if (spec->board_config == STAC_HP_DV5) {
unsigned int cap;
cap = snd_hda_param_read(codec, 0x1, AC_PAR_GPIO_CAP);
cap &= AC_GPIO_IO_COUNT;
if (cap >= 6)
stac_add_hp_bass_switch(codec);
}

codec->proc_widget_hook = stac92hd7x_proc_hook;

return 0;
Expand Down

0 comments on commit 711c56c

Please sign in to comment.