From: Matthew Garrett <mjg59@srcf.ucam.org>
To: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Cc: linux-kernel <linux-kernel@vger.kernel.org>, linux-pci@vger.kernel.org
Subject: Re: Add option to passively listen for PCIE hotplug events
Date: Fri, 14 Nov 2008 16:16:31 +0000 [thread overview]
Message-ID: <20081114161631.GA28234@srcf.ucam.org> (raw)
In-Reply-To: <49170B16.4010909@tuffmail.co.uk>
On Sun, Nov 09, 2008 at 04:08:54PM +0000, Alan Jenkins wrote:
> Bump. In case you're still slightly confused, I've found out why. It
> skips the slot power check because POWER_CTRL(ctrl) == 0. (See "Power
> Controller" in the debug output below).
Ok. I'm beginning to think that this approach is misguided. The Aspire
One should be handled by the acpiphp changes I've posted. The Eee makes
significantly less sense to me. It runs XP, so it can't depend on native
PCIe hotplugging. It sends ACPI notifications when the kill state
changes but there's no topological relationship between the device that
receives them and the device that needs to be hotplugged.
What I'm actually beginning to suspect is that this should be handled by
eee-laptop. Can you give the following patch a go, without any pciehp
code loaded?
diff --git a/drivers/misc/eeepc-laptop.c b/drivers/misc/eeepc-laptop.c
index 9ef98b2..6317ee6 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"
@@ -123,6 +124,7 @@ static const char *cm_setv[] = {
struct eeepc_hotk {
struct acpi_device *device; /* the device we are in */
acpi_handle handle; /* the handle of the hotk device */
+ acpi_handle rfkill_handle; /* the handle of the rfkill notifier */
u32 cm_supported; /* the control methods supported
by this BIOS */
uint init_flag; /* Init flags */
@@ -513,6 +515,35 @@ 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 (!bus) {
+ printk(KERN_WARNING "Unable to find wifi bus!\n");
+ return;
+ }
+
+ if (get_acpi(CM_ASL_WLAN) == 1) {
+ printk("Adding wifi\n");
+
+ dev = pci_scan_single_device(bus, 0);
+ if (dev) {
+ printk("Found new wifi\n");
+ if (pci_bus_add_device(dev))
+ printk(KERN_WARNING "Unable to add wifi\n");
+ }
+ } else {
+ printk("Removing wifi\n");
+ 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;
@@ -604,6 +635,18 @@ static int eeepc_hotk_add(struct acpi_device *device)
rfkill_register(ehotk->eeepc_bluetooth_rfkill);
}
+ status = acpi_get_handle(NULL, "\\_SB.PCI0.P0P7", ehotk->rfkill_handle);
+
+ if (ACPI_FAILURE(status)) {
+ printk(KERN_WARNING "Unable to find rfkill port handle\n");
+ goto end;
+ }
+
+ status = acpi_install_notify_handler(ehotk->rfkill_handle,
+ ACPI_SYSTEM_NOTIFY,
+ eeepc_rfkill_notify, NULL);
+ if (ACPI_FAILURE(status))
+ printk(KERN_WARNING "Unable to register rfkill notifier\n");
end:
if (result) {
kfree(ehotk);
@@ -622,6 +665,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");
+ status = acpi_remove_notify_handler(ehotk->handle, ACPI_SYSTEM_NOTIFY,
+ eeepc_rfkill_notify);
+ if (ACPI_FAILURE(status))
+ printk(EEEPC_ERR "Error removing rfkill notify handler\n");
kfree(ehotk);
return 0;
}
--
Matthew Garrett | mjg59@srcf.ucam.org
next prev parent reply other threads:[~2008-11-14 16:16 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <bspwK-420-11@gated-at.bofh.it>
[not found] ` <bujnh-2fr-5@gated-at.bofh.it>
[not found] ` <bujwT-2Ew-5@gated-at.bofh.it>
[not found] ` <buml1-6du-3@gated-at.bofh.it>
2008-11-04 11:29 ` Add option to passively listen for PCIE hotplug events Alan Jenkins
2008-11-04 12:47 ` Matthew Garrett
2008-11-04 13:32 ` Matthew Garrett
2008-11-04 14:26 ` Alan Jenkins
2008-11-04 14:33 ` Matthew Garrett
2008-11-04 15:01 ` Alan Jenkins
2008-11-04 15:11 ` Matthew Garrett
2008-11-04 15:44 ` Alan Jenkins
2008-11-04 15:57 ` Matthew Garrett
2008-11-04 16:22 ` Alan Jenkins
2008-11-09 16:08 ` Alan Jenkins
2008-11-12 23:34 ` Matthew Garrett
2008-11-14 16:16 ` Matthew Garrett [this message]
2008-11-14 17:07 ` Alan Jenkins
2008-11-14 17:12 ` Matthew Garrett
2008-11-14 17:27 ` Alan Jenkins
2008-11-14 17:35 ` Matthew Garrett
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=20081114161631.GA28234@srcf.ucam.org \
--to=mjg59@srcf.ucam.org \
--cc=alan-jenkins@tuffmail.co.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
/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