* [PATCH v2 1/3] eeepc-laptop: Add support for extended hotkeys
@ 2008-11-20 15:36 Matthew Garrett
2008-11-20 15:37 ` [PATCH v2 2/3] eeepc-laptop: Check return values from rfkill_register Matthew Garrett
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Matthew Garrett @ 2008-11-20 15:36 UTC (permalink / raw)
To: linux-kernel; +Cc: Alan Jenkins, Corentin Chary, ecc, linux acpi
Newer Eees have extra hotkeys above the function keys. This patch adds support
for sending them through the input layer.
Signed-off-by: Matthew Garrett <mjg@redhat.com>
---
drivers/misc/eeepc-laptop.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/drivers/misc/eeepc-laptop.c b/drivers/misc/eeepc-laptop.c
index 9ef98b2..e81ef18 100644
--- a/drivers/misc/eeepc-laptop.c
+++ b/drivers/misc/eeepc-laptop.c
@@ -161,6 +161,10 @@ static struct key_entry eeepc_keymap[] = {
{KE_KEY, 0x13, KEY_MUTE },
{KE_KEY, 0x14, KEY_VOLUMEDOWN },
{KE_KEY, 0x15, KEY_VOLUMEUP },
+ {KE_KEY, 0x1a, KEY_COFFEE },
+ {KE_KEY, 0x1b, KEY_ZOOM },
+ {KE_KEY, 0x1c, KEY_PROG2 },
+ {KE_KEY, 0x1d, KEY_PROG3 },
{KE_KEY, 0x30, KEY_SWITCHVIDEOMODE },
{KE_KEY, 0x31, KEY_SWITCHVIDEOMODE },
{KE_KEY, 0x32, KEY_SWITCHVIDEOMODE },
--
Matthew Garrett | mjg59@srcf.ucam.org
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 2/3] eeepc-laptop: Check return values from rfkill_register
2008-11-20 15:36 [PATCH v2 1/3] eeepc-laptop: Add support for extended hotkeys Matthew Garrett
@ 2008-11-20 15:37 ` Matthew Garrett
2008-11-20 15:37 ` [PATCH v2 3/3] eeepc-laptop: Implement rfkill hotplugging in eeepc-laptop Matthew Garrett
2008-12-28 15:20 ` [PATCH v2 1/3] eeepc-laptop: Add support for extended hotkeys Matthew Garrett
2 siblings, 0 replies; 7+ messages in thread
From: Matthew Garrett @ 2008-11-20 15:37 UTC (permalink / raw)
To: linux-kernel; +Cc: Alan Jenkins, Corentin Chary, ecc, linux acpi
Error out if rfkill registration fails, and also set the default system state
appropriately on boot
Signed-off-by: Matthew Garrett <mjg@redhat.com>
---
Includes Alan's suggested cleanup for the failure path
drivers/misc/eeepc-laptop.c | 51 +++++++++++++++++++++++++++++++-----------
1 files changed, 37 insertions(+), 14 deletions(-)
diff --git a/drivers/misc/eeepc-laptop.c b/drivers/misc/eeepc-laptop.c
index e81ef18..3de44fb 100644
--- a/drivers/misc/eeepc-laptop.c
+++ b/drivers/misc/eeepc-laptop.c
@@ -562,7 +562,7 @@ static int eeepc_hotk_add(struct acpi_device *device)
ehotk->device = device;
result = eeepc_hotk_check();
if (result)
- goto end;
+ goto ehotk_fail;
status = acpi_install_notify_handler(ehotk->handle, ACPI_SYSTEM_NOTIFY,
eeepc_hotk_notify, ehotk);
if (ACPI_FAILURE(status))
@@ -573,18 +573,25 @@ static int eeepc_hotk_add(struct acpi_device *device)
RFKILL_TYPE_WLAN);
if (!ehotk->eeepc_wlan_rfkill)
- goto end;
+ goto wlan_fail;
ehotk->eeepc_wlan_rfkill->name = "eeepc-wlan";
ehotk->eeepc_wlan_rfkill->toggle_radio = eeepc_wlan_rfkill_set;
ehotk->eeepc_wlan_rfkill->get_state = eeepc_wlan_rfkill_state;
- if (get_acpi(CM_ASL_WLAN) == 1)
+ if (get_acpi(CM_ASL_WLAN) == 1) {
ehotk->eeepc_wlan_rfkill->state =
RFKILL_STATE_UNBLOCKED;
- else
+ rfkill_set_default(RFKILL_TYPE_WLAN,
+ RFKILL_STATE_UNBLOCKED);
+ } else {
ehotk->eeepc_wlan_rfkill->state =
RFKILL_STATE_SOFT_BLOCKED;
- rfkill_register(ehotk->eeepc_wlan_rfkill);
+ rfkill_set_default(RFKILL_TYPE_WLAN,
+ RFKILL_STATE_SOFT_BLOCKED);
+ }
+ result = rfkill_register(ehotk->eeepc_wlan_rfkill);
+ if (result)
+ goto wlan_fail;
}
if (get_acpi(CM_ASL_BLUETOOTH) != -1) {
@@ -592,27 +599,43 @@ static int eeepc_hotk_add(struct acpi_device *device)
rfkill_allocate(&device->dev, RFKILL_TYPE_BLUETOOTH);
if (!ehotk->eeepc_bluetooth_rfkill)
- goto end;
+ goto bluetooth_fail;
ehotk->eeepc_bluetooth_rfkill->name = "eeepc-bluetooth";
ehotk->eeepc_bluetooth_rfkill->toggle_radio =
eeepc_bluetooth_rfkill_set;
ehotk->eeepc_bluetooth_rfkill->get_state =
eeepc_bluetooth_rfkill_state;
- if (get_acpi(CM_ASL_BLUETOOTH) == 1)
+ if (get_acpi(CM_ASL_BLUETOOTH) == 1) {
ehotk->eeepc_bluetooth_rfkill->state =
RFKILL_STATE_UNBLOCKED;
- else
+ rfkill_set_default(RFKILL_TYPE_BLUETOOTH,
+ RFKILL_STATE_UNBLOCKED);
+ } else {
ehotk->eeepc_bluetooth_rfkill->state =
RFKILL_STATE_SOFT_BLOCKED;
- rfkill_register(ehotk->eeepc_bluetooth_rfkill);
+ rfkill_set_default(RFKILL_TYPE_BLUETOOTH,
+ RFKILL_STATE_SOFT_BLOCKED);
+ }
+
+ result = rfkill_register(ehotk->eeepc_bluetooth_rfkill);
+ if (result)
+ goto bluetooth_fail;
}
+ return 0;
+
+ bluetooth_fail:
+ if (ehotk->eeepc_bluetooth_rfkill)
+ rfkill_free(ehotk->eeepc_bluetooth_rfkill);
+ rfkill_unregister(ehotk->eeepc_wlan_rfkill);
+ ehotk->eeepc_wlan_rfkill = NULL;
+ wlan_fail:
+ if (ehotk->eeepc_wlan_rfkill)
+ rfkill_free(ehotk->eeepc_wlan_rfkill);
+ ehotk_fail:
+ kfree(ehotk);
+ ehotk = NULL;
- end:
- if (result) {
- kfree(ehotk);
- ehotk = NULL;
- }
return result;
}
--
Matthew Garrett | mjg59@srcf.ucam.org
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 3/3] eeepc-laptop: Implement rfkill hotplugging in eeepc-laptop
2008-11-20 15:36 [PATCH v2 1/3] eeepc-laptop: Add support for extended hotkeys Matthew Garrett
2008-11-20 15:37 ` [PATCH v2 2/3] eeepc-laptop: Check return values from rfkill_register Matthew Garrett
@ 2008-11-20 15:37 ` Matthew Garrett
2008-12-28 15:20 ` [PATCH v2 1/3] eeepc-laptop: Add support for extended hotkeys Matthew Garrett
2 siblings, 0 replies; 7+ messages in thread
From: Matthew Garrett @ 2008-11-20 15:37 UTC (permalink / raw)
To: linux-kernel; +Cc: Alan Jenkins, Corentin Chary, ecc, linux acpi
The Eee implements rfkill by logically unplugging the wireless card from the
PCI bus. Despite sending ACPI notifications, this does not appear to be
implemented using standard ACPI hotplug - nor does the firmware provide the
_OSC method required to support native PCIe hotplug. The only sensible choice
appears to be to handle the hotplugging directly in the eeepc-laptop driver.
Tested successfully on a 700, 900 and 901.
Signed-off-by: Matthew Garrett <mjg@redhat.com>
---
drivers/misc/eeepc-laptop.c | 83 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 83 insertions(+), 0 deletions(-)
diff --git a/drivers/misc/eeepc-laptop.c b/drivers/misc/eeepc-laptop.c
index 3de44fb..1dcf637 100644
--- a/drivers/misc/eeepc-laptop.c
+++ b/drivers/misc/eeepc-laptop.c
@@ -30,6 +30,7 @@
#include <linux/uaccess.h>
#include <linux/input.h>
#include <linux/rfkill.h>
+#include <linux/pci.h>
#define EEEPC_LAPTOP_VERSION "0.1"
@@ -517,6 +518,41 @@ static void notify_brn(void)
bd->props.brightness = read_brightness(bd);
}
+static void eeepc_rfkill_notify(acpi_handle handle, u32 event, void *data)
+{
+ struct pci_dev *dev;
+ struct pci_bus *bus = pci_find_bus(0, 1);
+
+ if (event != ACPI_NOTIFY_BUS_CHECK)
+ return;
+
+ if (!bus) {
+ printk(EEEPC_WARNING "Unable to find PCI bus 1?\n");
+ return;
+ }
+
+ if (get_acpi(CM_ASL_WLAN) == 1) {
+ dev = pci_get_slot(bus, 0);
+ if (dev) {
+ /* Device already present */
+ pci_dev_put(dev);
+ return;
+ }
+ dev = pci_scan_single_device(bus, 0);
+ if (dev) {
+ pci_bus_assign_resources(bus);
+ if (pci_bus_add_device(dev))
+ printk(EEEPC_ERR "Unable to hotplug wifi\n");
+ }
+ } else {
+ dev = pci_get_slot(bus, 0);
+ if (dev) {
+ pci_remove_bus_device(dev);
+ pci_dev_put(dev);
+ }
+ }
+}
+
static void eeepc_hotk_notify(acpi_handle handle, u32 event, void *data)
{
static struct key_entry *key;
@@ -543,6 +579,45 @@ static void eeepc_hotk_notify(acpi_handle handle, u32 event, void *data)
}
}
+static int eeepc_register_rfkill_notifier(char *node)
+{
+ acpi_status status = AE_OK;
+ acpi_handle handle;
+
+ status = acpi_get_handle(NULL, node, &handle);
+
+ if (ACPI_SUCCESS(status)) {
+ status = acpi_install_notify_handler(handle,
+ ACPI_SYSTEM_NOTIFY,
+ eeepc_rfkill_notify,
+ NULL);
+ if (ACPI_FAILURE(status))
+ printk(EEEPC_WARNING
+ "Failed to register notify on %s\n", node);
+ } else
+ return -ENODEV;
+
+ return 0;
+}
+
+static void eeepc_unregister_rfkill_notifier(char *node)
+{
+ acpi_status status = AE_OK;
+ acpi_handle handle;
+
+ status = acpi_get_handle(NULL, node, &handle);
+
+ if (ACPI_SUCCESS(status)) {
+ status = acpi_remove_notify_handler(handle,
+ ACPI_SYSTEM_NOTIFY,
+ eeepc_rfkill_notify);
+ if (ACPI_FAILURE(status))
+ printk(EEEPC_ERR
+ "Error removing rfkill notify handler %s\n",
+ node);
+ }
+}
+
static int eeepc_hotk_add(struct acpi_device *device)
{
acpi_status status = AE_OK;
@@ -622,6 +697,10 @@ static int eeepc_hotk_add(struct acpi_device *device)
if (result)
goto bluetooth_fail;
}
+
+ eeepc_register_rfkill_notifier("\\_SB.PCI0.P0P6");
+ eeepc_register_rfkill_notifier("\\_SB.PCI0.P0P7");
+
return 0;
bluetooth_fail:
@@ -649,6 +728,10 @@ static int eeepc_hotk_remove(struct acpi_device *device, int type)
eeepc_hotk_notify);
if (ACPI_FAILURE(status))
printk(EEEPC_ERR "Error removing notify handler\n");
+
+ eeepc_unregister_rfkill_notifier("\\_SB.PCI0.P0P6");
+ eeepc_unregister_rfkill_notifier("\\_SB.PCI0.P0P7");
+
kfree(ehotk);
return 0;
}
--
Matthew Garrett | mjg59@srcf.ucam.org
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 1/3] eeepc-laptop: Add support for extended hotkeys
2008-11-20 15:36 [PATCH v2 1/3] eeepc-laptop: Add support for extended hotkeys Matthew Garrett
2008-11-20 15:37 ` [PATCH v2 2/3] eeepc-laptop: Check return values from rfkill_register Matthew Garrett
2008-11-20 15:37 ` [PATCH v2 3/3] eeepc-laptop: Implement rfkill hotplugging in eeepc-laptop Matthew Garrett
@ 2008-12-28 15:20 ` Matthew Garrett
2008-12-29 11:12 ` Corentin Chary
2 siblings, 1 reply; 7+ messages in thread
From: Matthew Garrett @ 2008-12-28 15:20 UTC (permalink / raw)
To: linux-kernel; +Cc: Alan Jenkins, Corentin Chary, ecc, linux acpi, lenb
Hi Len,
Can these be merged for .29?
--
Matthew Garrett | mjg59@srcf.ucam.org
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 1/3] eeepc-laptop: Add support for extended hotkeys
2008-12-28 15:20 ` [PATCH v2 1/3] eeepc-laptop: Add support for extended hotkeys Matthew Garrett
@ 2008-12-29 11:12 ` Corentin Chary
2009-01-18 10:04 ` Alan Jenkins
0 siblings, 1 reply; 7+ messages in thread
From: Corentin Chary @ 2008-12-29 11:12 UTC (permalink / raw)
To: Matthew Garrett; +Cc: linux-kernel, Alan Jenkins, ecc, linux acpi, lenb
On Sun, Dec 28, 2008 at 4:20 PM, Matthew Garrett <mjg59@srcf.ucam.org> wrote:
> Hi Len,
>
> Can these be merged for .29?
Acked-by: Corentin Chary <corentincj@iksaif.net>
--
Corentin Chary
http://xf.iksaif.net
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 1/3] eeepc-laptop: Add support for extended hotkeys
2008-12-29 11:12 ` Corentin Chary
@ 2009-01-18 10:04 ` Alan Jenkins
2009-01-20 15:08 ` Corentin Chary
0 siblings, 1 reply; 7+ messages in thread
From: Alan Jenkins @ 2009-01-18 10:04 UTC (permalink / raw)
To: lenb; +Cc: Matthew Garrett, Corentin Chary, linux-kernel, ecc, linux acpi
On 12/29/08, Corentin Chary <corentin.chary@gmail.com> wrote:
> On Sun, Dec 28, 2008 at 4:20 PM, Matthew Garrett <mjg59@srcf.ucam.org>
> wrote:
>> Hi Len,
>>
>> Can these be merged for .29?
>
> Acked-by: Corentin Chary <corentincj@iksaif.net>
They're not present in 2.6.29-rc2. Have they just missed the boat?
Thanks
Alan
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 1/3] eeepc-laptop: Add support for extended hotkeys
2009-01-18 10:04 ` Alan Jenkins
@ 2009-01-20 15:08 ` Corentin Chary
0 siblings, 0 replies; 7+ messages in thread
From: Corentin Chary @ 2009-01-20 15:08 UTC (permalink / raw)
To: Alan Jenkins; +Cc: lenb, Matthew Garrett, linux-kernel, ecc, linux acpi
On Sunday 18 January 2009 11:04:01 Alan Jenkins wrote:
> On 12/29/08, Corentin Chary <corentin.chary@gmail.com> wrote:
> > On Sun, Dec 28, 2008 at 4:20 PM, Matthew Garrett <mjg59@srcf.ucam.org>
> >
> > wrote:
> >> Hi Len,
> >>
> >> Can these be merged for .29?
> >
> > Acked-by: Corentin Chary <corentincj@iksaif.net>
>
> They're not present in 2.6.29-rc2. Have they just missed the boat?
>
> Thanks
> Alan
They are now in git://git.iksaif.net/acpi4asus.git acpi4asus and I'll re-send
them soon to Len because this serie is a litle outdated now that the drivers
have been moved into drivers/platform/x86/ .
--
--
Corentin Chary
http://xf.iksaif.net
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2009-01-20 15:08 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-20 15:36 [PATCH v2 1/3] eeepc-laptop: Add support for extended hotkeys Matthew Garrett
2008-11-20 15:37 ` [PATCH v2 2/3] eeepc-laptop: Check return values from rfkill_register Matthew Garrett
2008-11-20 15:37 ` [PATCH v2 3/3] eeepc-laptop: Implement rfkill hotplugging in eeepc-laptop Matthew Garrett
2008-12-28 15:20 ` [PATCH v2 1/3] eeepc-laptop: Add support for extended hotkeys Matthew Garrett
2008-12-29 11:12 ` Corentin Chary
2009-01-18 10:04 ` Alan Jenkins
2009-01-20 15:08 ` Corentin Chary
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox