mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ben Collins <bcollins@ubuntu.com>
To: linux-kernel@vger.kernel.org
Subject: [PATCH 08/15] sonypi: Enable ACPI events for Sony laptop hotkeys
Date: Wed, 04 Jan 2006 17:00:38 -0500	[thread overview]
Message-ID: <0ISL001SM95JWW@a34-mta01.direcway.com> (raw)

Signed-off-by: Ben Collins <bcollins@ubuntu.com>

---

 drivers/char/sonypi.c |   45 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 45 insertions(+), 0 deletions(-)

487226fc8285a99f10b68c06938e77570aaf1c6a
diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c
index 51a0737..b375da5 100644
--- a/drivers/char/sonypi.c
+++ b/drivers/char/sonypi.c
@@ -511,6 +511,11 @@ static struct sonypi_device {
 #define SONYPI_ACPI_ACTIVE 0
 #endif				/* CONFIG_ACPI */
 
+#ifdef CONFIG_ACPI
+static struct acpi_device *sonypi_acpi_device;
+static int acpi_enabled;
+#endif
+
 static int sonypi_ec_write(u8 addr, u8 value)
 {
 #ifdef CONFIG_ACPI_EC
@@ -864,6 +869,11 @@ found:
 	if (useinput)
 		sonypi_report_input_event(event);
 
+#ifdef CONFIG_ACPI
+	if (acpi_enabled)
+		acpi_bus_generate_event(sonypi_acpi_device, 1, event);
+#endif
+
 	kfifo_put(sonypi_device.fifo, (unsigned char *)&event, sizeof(event));
 	kill_fasync(&sonypi_device.fifo_async, SIGIO, POLL_IN);
 	wake_up_interruptible(&sonypi_device.fifo_proc_list);
@@ -1199,6 +1209,32 @@ static struct platform_driver sonypi_dri
 	},
 };
 
+#ifdef CONFIG_ACPI
+static int sonypi_acpi_add (struct acpi_device *device)
+{
+	sonypi_acpi_device = device;
+	strcpy(acpi_device_name(device), "Sony laptop hotkeys");
+	strcpy(acpi_device_class(device), "sony/hotkey");
+	return 0;
+}
+
+static int sonypi_acpi_remove (struct acpi_device *device, int type)
+{
+	sonypi_acpi_device = NULL;
+	return 0;
+}
+
+static struct acpi_driver sonypi_acpi_driver = {
+	.name           = "sonypi",
+	.class          = "hkey",
+	.ids            = "SNY6001",
+	.ops            = {
+		           .add = sonypi_acpi_add,
+			   .remove = sonypi_acpi_remove,
+	},
+};
+#endif
+
 static int __devinit sonypi_create_input_devices(void)
 {
 	struct input_dev *jog_dev;
@@ -1464,11 +1500,20 @@ static int __init sonypi_init(void)
 	if (ret)
 		platform_driver_unregister(&sonypi_driver);
 
+#ifdef CONFIG_ACPI
+	if (acpi_bus_register_driver(&sonypi_acpi_driver) > 0)
+		acpi_enabled=1;
+#endif
+
 	return ret;
 }
 
 static void __exit sonypi_exit(void)
 {
+#ifdef CONFIG_ACPI
+	if (acpi_enabled)
+		acpi_bus_unregister_driver(&sonypi_acpi_driver);
+#endif
 	platform_driver_unregister(&sonypi_driver);
 	sonypi_remove();
 }
-- 
1.0.5

             reply	other threads:[~2006-01-04 22:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-04 22:00 Ben Collins [this message]
2006-01-05  7:55 ` Jan Engelhardt
2006-01-05  9:25 ` Matthew Garrett
2006-01-15 20:49   ` Jan Engelhardt
2006-01-16  0:21     ` Matthew Garrett
2006-01-16 12:00       ` Jan Engelhardt

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=0ISL001SM95JWW@a34-mta01.direcway.com \
    --to=bcollins@ubuntu.com \
    --cc=linux-kernel@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

Powered by JetHome