linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 08/15] sonypi: Enable ACPI events for Sony laptop hotkeys
@ 2006-01-04 22:00 Ben Collins
  2006-01-05  7:55 ` Jan Engelhardt
  2006-01-05  9:25 ` Matthew Garrett
  0 siblings, 2 replies; 6+ messages in thread
From: Ben Collins @ 2006-01-04 22:00 UTC (permalink / raw)
  To: linux-kernel

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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 08/15] sonypi: Enable ACPI events for Sony laptop hotkeys
  2006-01-04 22:00 [PATCH 08/15] sonypi: Enable ACPI events for Sony laptop hotkeys Ben Collins
@ 2006-01-05  7:55 ` Jan Engelhardt
  2006-01-05  9:25 ` Matthew Garrett
  1 sibling, 0 replies; 6+ messages in thread
From: Jan Engelhardt @ 2006-01-05  7:55 UTC (permalink / raw)
  To: Ben Collins; +Cc: linux-kernel

>Date: Wed, 04 Jan 2006 17:00:38 -0500
>From: Ben Collins <bcollins@ubuntu.com>
>To: linux-kernel@vger.kernel.org
>Subject: [PATCH 08/15] sonypi: Enable ACPI events for Sony laptop hotkeys
>

Yay, will this make the Fn+F5 (brightness) and Fn+F7 (LCD/VGA switch) etc.
work? Currently, they just give a keycode in the 450-460 area (`showkey`).



Jan Engelhardt
-- 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 08/15] sonypi: Enable ACPI events for Sony laptop hotkeys
  2006-01-04 22:00 [PATCH 08/15] sonypi: Enable ACPI events for Sony laptop hotkeys Ben Collins
  2006-01-05  7:55 ` Jan Engelhardt
@ 2006-01-05  9:25 ` Matthew Garrett
  2006-01-15 20:49   ` Jan Engelhardt
  1 sibling, 1 reply; 6+ messages in thread
From: Matthew Garrett @ 2006-01-05  9:25 UTC (permalink / raw)
  To: Ben Collins; +Cc: linux-kernel

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

This one's a bit of a hack - it pushes Sony hotkey magic stuff through
the ACPI layer for the sake of consistency, despite the fact that
there's not actually any ACPI involved. 

The "right" way is probably actually to push ACPI hotkey events through
the input layer (like the Sony code does without this patch), but that's
currently a bit more awkward to handle in userspace. Since the right
answer here is clearly "Fix userspace", we probably don't want to be
merging this.

(Disclaimer: I wrote it originally because it was easier than fixing
userspace...)
-- 
Matthew Garrett | mjg59-chiark.mail.linux-rutgers.kernel@srcf.ucam.org

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 08/15] sonypi: Enable ACPI events for Sony laptop hotkeys
  2006-01-05  9:25 ` Matthew Garrett
@ 2006-01-15 20:49   ` Jan Engelhardt
  2006-01-16  0:21     ` Matthew Garrett
  0 siblings, 1 reply; 6+ messages in thread
From: Jan Engelhardt @ 2006-01-15 20:49 UTC (permalink / raw)
  To: Matthew Garrett; +Cc: Ben Collins, linux-kernel

>> Signed-off-by: Ben Collins <bcollins@ubuntu.com>
>
>The "right" way is probably actually to push ACPI hotkey events through
>the input layer (like the Sony code does without this patch), but that's
>currently a bit more awkward to handle in userspace. Since the right
>answer here is clearly "Fix userspace", we probably don't want to be
>merging this.
>

I certainly need this patch though, because it allows me to set the LCD 
brightness via /proc/acpi/sony/brightness.



Jan Engelhardt
-- 
| Alphagate Systems, http://alphagate.hopto.org/
| jengelh's site, http://jengelh.hopto.org/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 08/15] sonypi: Enable ACPI events for Sony laptop hotkeys
  2006-01-15 20:49   ` Jan Engelhardt
@ 2006-01-16  0:21     ` Matthew Garrett
  2006-01-16 12:00       ` Jan Engelhardt
  0 siblings, 1 reply; 6+ messages in thread
From: Matthew Garrett @ 2006-01-16  0:21 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: Ben Collins, linux-kernel

On Sun, Jan 15, 2006 at 09:49:47PM +0100, Jan Engelhardt wrote:

> I certainly need this patch though, because it allows me to set the LCD 
> brightness via /proc/acpi/sony/brightness.

No, that's sony_acpi. They're different drivers.

-- 
Matthew Garrett | mjg59@srcf.ucam.org

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 08/15] sonypi: Enable ACPI events for Sony laptop hotkeys
  2006-01-16  0:21     ` Matthew Garrett
@ 2006-01-16 12:00       ` Jan Engelhardt
  0 siblings, 0 replies; 6+ messages in thread
From: Jan Engelhardt @ 2006-01-16 12:00 UTC (permalink / raw)
  To: Matthew Garrett; +Cc: Ben Collins, linux-kernel

>> I certainly need this patch though, because it allows me to set the LCD 
>> brightness via /proc/acpi/sony/brightness.
>
>No, that's sony_acpi. They're different drivers.

My bad.


Jan Engelhardt
-- 

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-01-16 12:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-04 22:00 [PATCH 08/15] sonypi: Enable ACPI events for Sony laptop hotkeys Ben Collins
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).