From: Len Brown <lenb@kernel.org>
To: linux-acpi@vger.kernel.org
Cc: Darren Salt <linux@youmustbejoking.demon.co.uk>,
Corentin Chary <corentincj@iksaif.net>,
Len Brown <len.brown@intel.com>
Subject: [PATCH 07/19] eeepc-laptop: report brightness control events via the input layer
Date: Sat, 16 May 2009 02:02:04 -0400 [thread overview]
Message-ID: <64b86b6583db832b28bb54575e32b9e2a1a7d84f.1242453625.git.len.brown@intel.com> (raw)
In-Reply-To: <1242453736-20763-1-git-send-email-lenb@kernel.org>
In-Reply-To: <45cb50e646d1560eff01c5ad0f0df3c7fd6148dd.1242453625.git.len.brown@intel.com>
From: Darren Salt <linux@youmustbejoking.demon.co.uk>
This maps the brightness control events to one of two keys, either
KEY_BRIGHTNESSDOWN or KEY_BRIGHTNESSUP, as needed.
Some mapping has to be done due to the fact that the BIOS reports them as
<base value> + <current brightness index>; the selection is done according to
the sign of the change in brightness (if this is 0, no keypress is reported).
(Ref. http://lists.alioth.debian.org/pipermail/debian-eeepc-devel/2009-April/002001.html)
Signed-off-by: Darren Salt <linux@youmustbejoking.demon.co.uk>
Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Len Brown <len.brown@intel.com>
---
drivers/platform/x86/eeepc-laptop.c | 29 ++++++++++++++++++++++++++---
1 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c
index e21f7cd..f54cfea 100644
--- a/drivers/platform/x86/eeepc-laptop.c
+++ b/drivers/platform/x86/eeepc-laptop.c
@@ -166,6 +166,8 @@ static struct key_entry eeepc_keymap[] = {
{KE_KEY, 0x1b, KEY_ZOOM },
{KE_KEY, 0x1c, KEY_PROG2 },
{KE_KEY, 0x1d, KEY_PROG3 },
+ {KE_KEY, NOTIFY_BRN_MIN, KEY_BRIGHTNESSDOWN },
+ {KE_KEY, NOTIFY_BRN_MIN + 2, KEY_BRIGHTNESSUP },
{KE_KEY, 0x30, KEY_SWITCHVIDEOMODE },
{KE_KEY, 0x31, KEY_SWITCHVIDEOMODE },
{KE_KEY, 0x32, KEY_SWITCHVIDEOMODE },
@@ -512,11 +514,16 @@ static int eeepc_hotk_check(void)
return 0;
}
-static void notify_brn(void)
+static int notify_brn(void)
{
+ /* returns the *previous* brightness, or -1 */
struct backlight_device *bd = eeepc_backlight_device;
- if (bd)
+ if (bd) {
+ int old = bd->props.brightness;
bd->props.brightness = read_brightness(bd);
+ return old;
+ }
+ return -1;
}
static void eeepc_rfkill_notify(acpi_handle handle, u32 event, void *data)
@@ -558,17 +565,33 @@ static void eeepc_hotk_notify(acpi_handle handle, u32 event, void *data)
{
static struct key_entry *key;
u16 count;
+ int brn = -ENODEV;
if (!ehotk)
return;
if (event >= NOTIFY_BRN_MIN && event <= NOTIFY_BRN_MAX)
- notify_brn();
+ brn = notify_brn();
count = ehotk->event_count[event % 128]++;
acpi_bus_generate_proc_event(ehotk->device, event, count);
acpi_bus_generate_netlink_event(ehotk->device->pnp.device_class,
dev_name(&ehotk->device->dev), event,
count);
if (ehotk->inputdev) {
+ if (brn != -ENODEV) {
+ /* brightness-change events need special
+ * handling for conversion to key events
+ */
+ if (brn < 0)
+ brn = event;
+ else
+ brn += NOTIFY_BRN_MIN;
+ if (event < brn)
+ event = NOTIFY_BRN_MIN; /* brightness down */
+ else if (event > brn)
+ event = NOTIFY_BRN_MIN + 2; /* ... up */
+ else
+ event = NOTIFY_BRN_MIN + 1; /* ... unchanged */
+ }
key = eepc_get_entry_by_scancode(event);
if (key) {
switch (key->type) {
--
1.6.0.6
next prev parent reply other threads:[~2009-05-16 6:02 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-16 6:01 ACPI & driver patches for 2.6.30-rc5 Len Brown
2009-05-16 6:01 ` [PATCH 01/19] ACPI video: dmi check for broken _BQC on Acer Aspire 5720 Len Brown
2009-05-16 6:01 ` [PATCH 02/19] ACPICA: use acpi.* modparam namespace Len Brown
2009-05-16 6:02 ` [PATCH 03/19] ACPI: video: DMI workaround another broken Acer BIOS enabling display brightness Len Brown
2009-05-16 6:02 ` [PATCH 04/19] ACPI: power: update error message Len Brown
2009-05-16 6:02 ` [PATCH 05/19] ACPI: suspend: don't let device _PS3 failure prevent suspend Len Brown
2009-05-16 6:02 ` [PATCH 06/19] eeepc-laptop: fix wlan rfkill state change during init Len Brown
2009-05-16 6:02 ` Len Brown [this message]
2009-05-16 6:02 ` [PATCH 08/19] eeepc-laptop: Work around rfkill firmware bug Len Brown
2009-05-16 6:02 ` [PATCH 09/19] eeepc-laptop: support for super hybrid engine (SHE) Len Brown
2009-05-24 9:28 ` Alan Jenkins
2009-05-24 17:23 ` Corentin Chary
[not found] ` <4A198401.3040003@tuffmail.co.uk>
2009-05-25 8:12 ` Corentin Chary
2009-05-25 9:43 ` Alan Jenkins
2009-05-25 9:59 ` Corentin Chary
2009-05-25 10:07 ` Alan Jenkins
2009-05-25 11:19 ` Corentin Chary
2009-05-25 11:51 ` Alan Jenkins
2009-05-26 10:12 ` Corentin Chary
2009-05-26 10:15 ` Alan Jenkins
2009-05-26 17:29 ` Francesco Lattanzio
2009-05-26 17:43 ` Alan Jenkins
2009-05-26 18:05 ` Corentin Chary
2009-05-24 20:24 ` Corentin Chary
2009-05-16 6:02 ` [PATCH 10/19] asus-laptop: fix input keycode Len Brown
2009-05-16 6:02 ` [PATCH 11/19] eeepc-laptop: unregister_rfkill_notifier on failure Len Brown
2009-05-16 6:02 ` [PATCH 12/19] thermal: fix off-by-1 error in trip point trigger condition Len Brown
2009-05-16 6:02 ` [PATCH 13/19] ACPI: resume: re-enable SCI-enable workaround Len Brown
2009-05-16 6:02 ` [PATCH 14/19] ACPI: suspend: restore BM_RLD on resume Len Brown
2009-05-16 6:02 ` [PATCH 15/19] ACPI, i915: build fix Len Brown
2009-05-18 2:49 ` yakui_zhao
2009-05-16 6:02 ` [PATCH 16/19] ACPI processor: introduce module parameter processor.ignore_tpc Len Brown
2009-05-16 6:02 ` [PATCH 17/19] ACPI processor: reset the throttling state once it's invalid Len Brown
2009-05-16 6:02 ` [PATCH 18/19] ACPI: idle: fix init-time TSC check regression Len Brown
2009-05-16 6:02 ` [PATCH 19/19] ACPI: Idle C-states disabled by max_cstate should not disable the TSC Len Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=64b86b6583db832b28bb54575e32b9e2a1a7d84f.1242453625.git.len.brown@intel.com \
--to=lenb@kernel.org \
--cc=corentincj@iksaif.net \
--cc=len.brown@intel.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux@youmustbejoking.demon.co.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox