Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 185082
b: refs/heads/master
c: 88cc837
h: refs/heads/master
v: v3
  • Loading branch information
Henrique de Moraes Holschuh committed Feb 27, 2010
1 parent 51991cd commit 9d6813f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b525c06cdbd8a3963f0173ccd23f9147d4c384b5
refs/heads/master: 88cc83772a3c7756b9f2b4ba835545ad90a08409
39 changes: 29 additions & 10 deletions trunk/drivers/platform/x86/thinkpad_acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -6541,7 +6541,8 @@ static int volume_set_status(const u8 status)
return volume_set_status_ec(status);
}

static int volume_set_mute_ec(const bool mute)
/* returns < 0 on error, 0 on no change, 1 on change */
static int __volume_set_mute_ec(const bool mute)
{
int rc;
u8 s, n;
Expand All @@ -6556,22 +6557,37 @@ static int volume_set_mute_ec(const bool mute)
n = (mute) ? s | TP_EC_AUDIO_MUTESW_MSK :
s & ~TP_EC_AUDIO_MUTESW_MSK;

if (n != s)
if (n != s) {
rc = volume_set_status_ec(n);
if (!rc)
rc = 1;
}

unlock:
mutex_unlock(&volume_mutex);
return rc;
}

static int volume_alsa_set_mute(const bool mute)
{
dbg_printk(TPACPI_DBG_MIXER, "ALSA: trying to %smute\n",
(mute) ? "" : "un");
return __volume_set_mute_ec(mute);
}

static int volume_set_mute(const bool mute)
{
int rc;

dbg_printk(TPACPI_DBG_MIXER, "trying to %smute\n",
(mute) ? "" : "un");
return volume_set_mute_ec(mute);

rc = __volume_set_mute_ec(mute);
return (rc < 0) ? rc : 0;
}

static int volume_set_volume_ec(const u8 vol)
/* returns < 0 on error, 0 on no change, 1 on change */
static int __volume_set_volume_ec(const u8 vol)
{
int rc;
u8 s, n;
Expand All @@ -6588,19 +6604,22 @@ static int volume_set_volume_ec(const u8 vol)

n = (s & ~TP_EC_AUDIO_LVL_MSK) | vol;

if (n != s)
if (n != s) {
rc = volume_set_status_ec(n);
if (!rc)
rc = 1;
}

unlock:
mutex_unlock(&volume_mutex);
return rc;
}

static int volume_set_volume(const u8 vol)
static int volume_alsa_set_volume(const u8 vol)
{
dbg_printk(TPACPI_DBG_MIXER,
"trying to set volume level to %hu\n", vol);
return volume_set_volume_ec(vol);
"ALSA: trying to set volume level to %hu\n", vol);
return __volume_set_volume_ec(vol);
}

static void volume_alsa_notify_change(void)
Expand Down Expand Up @@ -6647,7 +6666,7 @@ static int volume_alsa_vol_get(struct snd_kcontrol *kcontrol,
static int volume_alsa_vol_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
return volume_set_volume(ucontrol->value.integer.value[0]);
return volume_alsa_set_volume(ucontrol->value.integer.value[0]);
}

#define volume_alsa_mute_info snd_ctl_boolean_mono_info
Expand All @@ -6670,7 +6689,7 @@ static int volume_alsa_mute_get(struct snd_kcontrol *kcontrol,
static int volume_alsa_mute_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
return volume_set_mute(!ucontrol->value.integer.value[0]);
return volume_alsa_set_mute(!ucontrol->value.integer.value[0]);
}

static struct snd_kcontrol_new volume_alsa_control_vol __devinitdata = {
Expand Down

0 comments on commit 9d6813f

Please sign in to comment.