* [PATCH] thinkpad-acpi: fix return value of volume callbacks
@ 2010-02-22 9:45 Clemens Ladisch
2010-02-23 3:12 ` Henrique de Moraes Holschuh
0 siblings, 1 reply; 6+ messages in thread
From: Clemens Ladisch @ 2010-02-22 9:45 UTC (permalink / raw)
To: Henrique de Moraes Holschuh, ibm-acpi-devel, linux-kernel
Fix up the volume status setting functions to return a non-zero value if
the control value has changed, so that the ALSA framework can correctly
generate control change notifications.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
--- linux/drivers/platform/x86/thinkpad_acpi.c
+++ linux/drivers/platform/x86/thinkpad_acpi.c
@@ -6537,8 +6537,11 @@ static int volume_set_mute_ec(const bool
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);
@@ -6569,8 +6572,11 @@ static int volume_set_volume_ec(const u8
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);
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] thinkpad-acpi: fix return value of volume callbacks
2010-02-22 9:45 [PATCH] thinkpad-acpi: fix return value of volume callbacks Clemens Ladisch
@ 2010-02-23 3:12 ` Henrique de Moraes Holschuh
2010-02-23 7:36 ` Clemens Ladisch
0 siblings, 1 reply; 6+ messages in thread
From: Henrique de Moraes Holschuh @ 2010-02-23 3:12 UTC (permalink / raw)
To: Clemens Ladisch; +Cc: ibm-acpi-devel, linux-kernel
On Mon, 22 Feb 2010, Clemens Ladisch wrote:
> Fix up the volume status setting functions to return a non-zero value if
> the control value has changed, so that the ALSA framework can correctly
> generate control change notifications.
Please explain...
>
> Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
>
> --- linux/drivers/platform/x86/thinkpad_acpi.c
> +++ linux/drivers/platform/x86/thinkpad_acpi.c
> @@ -6537,8 +6537,11 @@ static int volume_set_mute_ec(const bool
> 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);
> @@ -6569,8 +6572,11 @@ static int volume_set_volume_ec(const u8
>
> 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);
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
--
"One disk to rule them all, One disk to find them. One disk to bring
them all and in the darkness grind them. In the Land of Redmond
where the shadows lie." -- The Silicon Valley Tarot
Henrique Holschuh
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] thinkpad-acpi: fix return value of volume callbacks
2010-02-23 3:12 ` Henrique de Moraes Holschuh
@ 2010-02-23 7:36 ` Clemens Ladisch
2010-02-26 0:30 ` Henrique de Moraes Holschuh
0 siblings, 1 reply; 6+ messages in thread
From: Clemens Ladisch @ 2010-02-23 7:36 UTC (permalink / raw)
To: Henrique de Moraes Holschuh; +Cc: ibm-acpi-devel, linux-kernel
Henrique de Moraes Holschuh wrote:
> On Mon, 22 Feb 2010, Clemens Ladisch wrote:
> > Fix up the volume status setting functions to return a non-zero value if
> > the control value has changed, so that the ALSA framework can correctly
> > generate control change notifications.
>
> Please explain...
ALSA sends notifications to all mixer application when the value of
any mixer control has changed. To be able to avoid sending them for
controls that did not actually change, it uses the return value of the
.put callback: 0 means the control value did not change; 1 means it has
changed (or might have changed), and a notification is to be sent.
<http://www.alsa-project.org/~tiwai/writing-an-alsa-driver/ch06s05.html#control-interface-callbacks-put>
Regards,
Clemens
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] thinkpad-acpi: fix return value of volume callbacks
2010-02-23 7:36 ` Clemens Ladisch
@ 2010-02-26 0:30 ` Henrique de Moraes Holschuh
2010-02-26 7:38 ` Clemens Ladisch
0 siblings, 1 reply; 6+ messages in thread
From: Henrique de Moraes Holschuh @ 2010-02-26 0:30 UTC (permalink / raw)
To: Clemens Ladisch; +Cc: ibm-acpi-devel, linux-kernel
On Tue, 23 Feb 2010, Clemens Ladisch wrote:
> Henrique de Moraes Holschuh wrote:
> > On Mon, 22 Feb 2010, Clemens Ladisch wrote:
> > > Fix up the volume status setting functions to return a non-zero value if
> > > the control value has changed, so that the ALSA framework can correctly
> > > generate control change notifications.
> >
> > Please explain...
>
> ALSA sends notifications to all mixer application when the value of
> any mixer control has changed. To be able to avoid sending them for
> controls that did not actually change, it uses the return value of the
> .put callback: 0 means the control value did not change; 1 means it has
> changed (or might have changed), and a notification is to be sent.
> <http://www.alsa-project.org/~tiwai/writing-an-alsa-driver/ch06s05.html#control-interface-callbacks-put>
I am looking at it. I think I had it like that on purpose, to trigger an
OSD when a volume-related hotkey is pressed even if it doesn't change the
state (mute when already mute, vol down when already at minimum, etc).
--
"One disk to rule them all, One disk to find them. One disk to bring
them all and in the darkness grind them. In the Land of Redmond
where the shadows lie." -- The Silicon Valley Tarot
Henrique Holschuh
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] thinkpad-acpi: fix return value of volume callbacks
2010-02-26 0:30 ` Henrique de Moraes Holschuh
@ 2010-02-26 7:38 ` Clemens Ladisch
2010-02-27 0:55 ` [ibm-acpi-devel] " Henrique de Moraes Holschuh
0 siblings, 1 reply; 6+ messages in thread
From: Clemens Ladisch @ 2010-02-26 7:38 UTC (permalink / raw)
To: Henrique de Moraes Holschuh; +Cc: ibm-acpi-devel, linux-kernel
Henrique de Moraes Holschuh wrote:
> On Tue, 23 Feb 2010, Clemens Ladisch wrote:
> > Henrique de Moraes Holschuh wrote:
> > > On Mon, 22 Feb 2010, Clemens Ladisch wrote:
> > > > Fix up the volume status setting functions to return a non-zero value if
> > > > the control value has changed, so that the ALSA framework can correctly
> > > > generate control change notifications.
> > >
> > > Please explain...
> >
> > ALSA sends notifications to all mixer application when the value of
> > any mixer control has changed. To be able to avoid sending them for
> > controls that did not actually change, it uses the return value of the
> > .put callback: 0 means the control value did not change; 1 means it has
> > changed (or might have changed), and a notification is to be sent.
> > <http://www.alsa-project.org/~tiwai/writing-an-alsa-driver/ch06s05.html#control-interface-callbacks-put>
>
> I am looking at it. I think I had it like that on purpose, to trigger an
> OSD when a volume-related hotkey is pressed even if it doesn't change the
> state (mute when already mute, vol down when already at minimum, etc).
This is not about changes initiated by key presses but changes made
through the ALSA mixer API. Or does the hardware generate a hotkey
event when software changes the volume?
Regards,
Clemens
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [ibm-acpi-devel] [PATCH] thinkpad-acpi: fix return value of volume callbacks
2010-02-26 7:38 ` Clemens Ladisch
@ 2010-02-27 0:55 ` Henrique de Moraes Holschuh
0 siblings, 0 replies; 6+ messages in thread
From: Henrique de Moraes Holschuh @ 2010-02-27 0:55 UTC (permalink / raw)
To: Clemens Ladisch; +Cc: ibm-acpi-devel, linux-kernel
On Fri, 26 Feb 2010, Clemens Ladisch wrote:
> > > ALSA sends notifications to all mixer application when the value of
> > > any mixer control has changed. To be able to avoid sending them for
> > > controls that did not actually change, it uses the return value of the
> > > .put callback: 0 means the control value did not change; 1 means it has
> > > changed (or might have changed), and a notification is to be sent.
> > > <http://www.alsa-project.org/~tiwai/writing-an-alsa-driver/ch06s05.html#control-interface-callbacks-put>
> >
> > I am looking at it. I think I had it like that on purpose, to trigger an
> > OSD when a volume-related hotkey is pressed even if it doesn't change the
> > state (mute when already mute, vol down when already at minimum, etc).
>
> This is not about changes initiated by key presses but changes made
> through the ALSA mixer API. Or does the hardware generate a hotkey
> event when software changes the volume?
The firmware doesn't send events for software changes, mostly because it
does not want, or, expect any. These mixers are read-only by default.
--
"One disk to rule them all, One disk to find them. One disk to bring
them all and in the darkness grind them. In the Land of Redmond
where the shadows lie." -- The Silicon Valley Tarot
Henrique Holschuh
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-02-27 0:55 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-22 9:45 [PATCH] thinkpad-acpi: fix return value of volume callbacks Clemens Ladisch
2010-02-23 3:12 ` Henrique de Moraes Holschuh
2010-02-23 7:36 ` Clemens Ladisch
2010-02-26 0:30 ` Henrique de Moraes Holschuh
2010-02-26 7:38 ` Clemens Ladisch
2010-02-27 0:55 ` [ibm-acpi-devel] " Henrique de Moraes Holschuh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox