rpms/kernel/devel linux-2.6-sony-laptop-rfkill.patch, NONE, 1.1 kernel.spec, 1.1451, 1.1452 linux-2.6-acpi-video-didl-intel-outputs.patch, 1.1, 1.2

Matthew Garrett mjg59 at fedoraproject.org
Thu Mar 19 22:31:41 UTC 2009


Author: mjg59

Update of /cvs/pkgs/rpms/kernel/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv23135

Modified Files:
	kernel.spec linux-2.6-acpi-video-didl-intel-outputs.patch 
Added Files:
	linux-2.6-sony-laptop-rfkill.patch 
Log Message:
* Thu Mar 19 2009 Matthew Garrett <mjg at redhat.com>
- linux-2.6-acpi-video-didl-intel-outputs.patch
   don't attempt to re-register the backlight device on resume
- linux-2.6-sony-laptop-rfkill.patch
   provide rfkill control on current vaios


linux-2.6-sony-laptop-rfkill.patch:

--- NEW FILE linux-2.6-sony-laptop-rfkill.patch ---
commit dc128f85f7967a6472bb58762748ccffe722f707
Author: Matthew Garrett <mjg at redhat.com>
Date:   Thu Mar 19 21:12:50 2009 +0000

    Enable events on all Vaios with the new-style ACPI interface, and use
    it to support rfkill where available.
    
    Signed-off-by: Matthew Garrett <mjg at redhat.com>

diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
index 537959d..c57f54c 100644
--- a/drivers/platform/x86/sony-laptop.c
+++ b/drivers/platform/x86/sony-laptop.c
@@ -64,6 +64,7 @@
 #include <asm/uaccess.h>
 #include <linux/sonypi.h>
 #include <linux/sony-laptop.h>
+#include <linux/rfkill.h>
 #ifdef CONFIG_SONYPI_COMPAT
 #include <linux/poll.h>
 #include <linux/miscdevice.h>
@@ -143,6 +144,11 @@ struct sony_laptop_keypress {
 	int key;
 };
 
+static struct rfkill *sony_wifi_rfkill;
+static struct rfkill *sony_bluetooth_rfkill;
+static struct rfkill *sony_wwan_rfkill;
+static struct rfkill *sony_wimax_rfkill;
+
 /* Correspondance table between sonypi events
  * and input layer indexes in the keymap
  */
@@ -981,6 +987,145 @@ static int sony_nc_resume(struct acpi_device *device)
 	return 0;
 }
 
+static void sony_rfkill_cleanup(void)
+{
+	if (sony_wifi_rfkill)
+		rfkill_unregister(sony_wifi_rfkill);
+	if (sony_bluetooth_rfkill)
+		rfkill_unregister(sony_bluetooth_rfkill);
+	if (sony_wwan_rfkill)
+		rfkill_unregister(sony_wwan_rfkill);
+	if (sony_wimax_rfkill)
+		rfkill_unregister(sony_wimax_rfkill);
+}
+
+static int sony_nc_rfkill_get(void *data, enum rfkill_state *state)
+{
+	int result;
+
+	acpi_callsetfunc(sony_nc_acpi_handle, "SN07", 0x3 | ((long) data << 8),
+			 &result);
+	if (result & 0xf)
+		*state = RFKILL_STATE_UNBLOCKED;
+	else
+		*state = RFKILL_STATE_SOFT_BLOCKED;
+	return 0;
+}
+
+static int sony_nc_rfkill_set(void *data, enum rfkill_state state)
+{
+	int result;
+	int call = 0x3 | (((long) data + 1) << 8);
+
+	if (state == RFKILL_STATE_UNBLOCKED)
+		call |= 0xff0000;
+
+	return acpi_callsetfunc(sony_nc_acpi_handle, "SN07", call, &result);
+}
+
+static int sony_nc_setup_wifi_rfkill(struct acpi_device *device)
+{
+	int err = 0;
+
+	sony_wifi_rfkill = rfkill_allocate(&device->dev, RFKILL_TYPE_WLAN);
+	if (!sony_wifi_rfkill)
+		return -1;
+	sony_wifi_rfkill->name = "sony-wifi";
+	sony_wifi_rfkill->toggle_radio = sony_nc_rfkill_set;
+	sony_wifi_rfkill->get_state = sony_nc_rfkill_get;
+	sony_wifi_rfkill->user_claim_unsupported = 1;
+	sony_wifi_rfkill->data = (void *)3;
+	err = rfkill_register(sony_wifi_rfkill);
+	if (err)
+		rfkill_unregister(sony_wifi_rfkill);
+	return err;
+}
+
+static int sony_nc_setup_bluetooth_rfkill(struct acpi_device *device)
+{
+	int err = 0;
+
+	sony_bluetooth_rfkill = rfkill_allocate(&device->dev,
+						RFKILL_TYPE_BLUETOOTH);
+	if (!sony_bluetooth_rfkill)
+		return -1;
+	sony_bluetooth_rfkill->name = "sony-bluetooth";
+	sony_bluetooth_rfkill->toggle_radio = sony_nc_rfkill_set;
+	sony_bluetooth_rfkill->get_state = sony_nc_rfkill_get;
+	sony_bluetooth_rfkill->user_claim_unsupported = 1;
+	sony_bluetooth_rfkill->data = (void *)5;
+	err = rfkill_register(sony_bluetooth_rfkill);
+	if (err)
+		rfkill_unregister(sony_bluetooth_rfkill);
+	return err;
+}
+
+static int sony_nc_setup_wwan_rfkill(struct acpi_device *device)
+{
+	int err = 0;
+
+	sony_wwan_rfkill = rfkill_allocate(&device->dev, RFKILL_TYPE_WWAN);
+	if (!sony_wwan_rfkill)
+		return -1;
+	sony_wwan_rfkill->name = "sony-wwan";
+	sony_wwan_rfkill->toggle_radio = sony_nc_rfkill_set;
+	sony_wwan_rfkill->get_state = sony_nc_rfkill_get;
+	sony_wwan_rfkill->user_claim_unsupported = 1;
+	sony_wwan_rfkill->data = (void *)7;
+	err = rfkill_register(sony_wwan_rfkill);
+	if (err)
+		rfkill_unregister(sony_wwan_rfkill);
+	return err;
+}
+
+static int sony_nc_setup_wimax_rfkill(struct acpi_device *device)
+{
+	int err = 0;
+
+	sony_wimax_rfkill = rfkill_allocate(&device->dev, RFKILL_TYPE_WIMAX);
+	if (!sony_wimax_rfkill)
+		return -1;
+	sony_wimax_rfkill->name = "sony-wimax";
+	sony_wimax_rfkill->toggle_radio = sony_nc_rfkill_set;
+	sony_wimax_rfkill->get_state = sony_nc_rfkill_get;
+	sony_wimax_rfkill->user_claim_unsupported = 1;
+	sony_wimax_rfkill->data = (void *)9;
+	err = rfkill_register(sony_wimax_rfkill);
+	if (err)
+		rfkill_unregister(sony_wimax_rfkill);
+	return err;
+}
+
+static int sony_nc_function_setup(struct acpi_device *device)
+{
+	int result;
+
+	/* Enable all events */
+	acpi_callsetfunc(sony_nc_acpi_handle, "SN02", 0xffff, &result);
+
+	/* Setup hotkey decoding */
+	acpi_callsetfunc(sony_nc_acpi_handle, "SN07", 0x2, &result);
+
+	/* Eaable hotkey event generation */
+	acpi_callsetfunc(sony_nc_acpi_handle, "SN07", 0, &result);
+
+	/* Set BCHA, whatever /that/ does */
+	acpi_callsetfunc(sony_nc_acpi_handle, "SN07", 0x101, &result);
+
+	acpi_callsetfunc(sony_nc_acpi_handle, "SN07", 0xb03, &result);
+
+	if (result & 0x1)
+		sony_nc_setup_wifi_rfkill(device);
+	if (result & 0x2)
+		sony_nc_setup_bluetooth_rfkill(device);
+	if (result & 0x1c)
+		sony_nc_setup_wwan_rfkill(device);
+	if (result & 0x20)
+		sony_nc_setup_wimax_rfkill(device);
+
+	return 0;
+}
+
 static int sony_nc_add(struct acpi_device *device)
 {
 	acpi_status status;
@@ -1024,6 +1169,12 @@ static int sony_nc_add(struct acpi_device *device)
 			dprintk("_INI Method failed\n");
 	}
 
+	if (ACPI_SUCCESS(acpi_get_handle(sony_nc_acpi_handle, "SN07",
+					 &handle))) {
+		dprintk("Doing SNC setup\n");
+		sony_nc_function_setup(device);
+	}
+
 	/* setup input devices and helper fifo */
 	result = sony_laptop_setup_input(device);
 	if (result) {
@@ -1131,6 +1282,7 @@ static int sony_nc_add(struct acpi_device *device)
 	sony_laptop_remove_input();
 
       outwalk:
+	sony_rfkill_cleanup();
 	return result;
 }
 
@@ -1156,6 +1308,7 @@ static int sony_nc_remove(struct acpi_device *device, int type)
 
 	sony_pf_remove();
 	sony_laptop_remove_input();
+	sony_rfkill_cleanup();
 	dprintk(SONY_NC_DRIVER_NAME " removed.\n");
 
 	return 0;


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/kernel.spec,v
retrieving revision 1.1451
retrieving revision 1.1452
diff -u -r1.1451 -r1.1452
--- kernel.spec	19 Mar 2009 20:43:22 -0000	1.1451
+++ kernel.spec	19 Mar 2009 22:31:11 -0000	1.1452
@@ -623,6 +623,7 @@
 Patch392: linux-2.6-acpi-strict-resources.patch
 Patch393: linux-2.6-hwmon-atk0110.patch
 Patch394: linux-2.6-acpi-video-didl-intel-outputs.patch
+Patch395: linux-2.6-sony-laptop-rfkill.patch
 Patch400: linux-2.6-scsi-cpqarray-set-master.patch
 Patch450: linux-2.6-input-kill-stupid-messages.patch
 Patch451: linux-2.6-input-fix-toshiba-hotkeys.patch
@@ -1120,6 +1121,7 @@
 ApplyPatch linux-2.6-acpi-strict-resources.patch
 ApplyPatch linux-2.6-hwmon-atk0110.patch
 ApplyPatch linux-2.6-acpi-video-didl-intel-outputs.patch
+ApplyPatch linux-2.6-sony-laptop-rfkill.patch
 
 # Various low-impact patches to aid debugging.
 ApplyPatch linux-2.6-debug-sizeof-structs.patch
@@ -1817,6 +1819,12 @@
 # and build.
 
 %changelog
+* Thu Mar 19 2009 Matthew Garrett <mjg at redhat.com>
+- linux-2.6-acpi-video-didl-intel-outputs.patch
+   don't attempt to re-register the backlight device on resume
+- linux-2.6-sony-laptop-rfkill.patch
+   provide rfkill control on current vaios
+
 * Thu Mar 19 2009 Dave Jones <davej at redhat.com>
 - Switch x86-32 back to using 8k stacks.
 

linux-2.6-acpi-video-didl-intel-outputs.patch:

Index: linux-2.6-acpi-video-didl-intel-outputs.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/linux-2.6-acpi-video-didl-intel-outputs.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- linux-2.6-acpi-video-didl-intel-outputs.patch	11 Mar 2009 23:09:31 -0000	1.1
+++ linux-2.6-acpi-video-didl-intel-outputs.patch	19 Mar 2009 22:31:11 -0000	1.2
@@ -1,4 +1,4 @@
-commit a0fdbca7264432e073f5cdde8bebbcba96165337
+commit e889ecd58e4f710ff48dd84272130f19ac577ee6
 Author: Matthew Garrett <mjg at redhat.com>
 Date:   Wed Mar 11 16:39:36 2009 +0000
 
@@ -78,7 +78,7 @@
  static void __exit acpi_video_exit(void)
  {
 diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
-index 6dab63b..70a9904 100644
+index 6dab63b..5881b6a 100644
 --- a/drivers/gpu/drm/i915/i915_dma.c
 +++ b/drivers/gpu/drm/i915/i915_dma.c
 @@ -1144,8 +1144,6 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
@@ -95,13 +95,39 @@
  	}
  
 +	/* Must be done after probing outputs */
-+	intel_opregion_init(dev);
++	intel_opregion_init(dev, 0);
 +
  	return 0;
  
  out_iomapfree:
+diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
+index b293ef0..209592f 100644
+--- a/drivers/gpu/drm/i915/i915_drv.c
++++ b/drivers/gpu/drm/i915/i915_drv.c
+@@ -99,7 +99,7 @@ static int i915_resume(struct drm_device *dev)
+ 
+ 	i915_restore_state(dev);
+ 
+-	intel_opregion_init(dev);
++	intel_opregion_init(dev, 1);
+ 
+ 	/* KMS EnterVT equivalent */
+ 	if (drm_core_check_feature(dev, DRIVER_MODESET)) {
+diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
+index 17fa408..aee6f9e 100644
+--- a/drivers/gpu/drm/i915/i915_drv.h
++++ b/drivers/gpu/drm/i915/i915_drv.h
+@@ -654,7 +654,7 @@ extern int i915_restore_state(struct drm_device *dev);
+ 
+ #ifdef CONFIG_ACPI
+ /* i915_opregion.c */
+-extern int intel_opregion_init(struct drm_device *dev);
++extern int intel_opregion_init(struct drm_device *dev, int resume);
+ extern void intel_opregion_free(struct drm_device *dev);
+ extern void opregion_asle_intr(struct drm_device *dev);
+ extern void opregion_enable_asle(struct drm_device *dev);
 diff --git a/drivers/gpu/drm/i915/i915_opregion.c b/drivers/gpu/drm/i915/i915_opregion.c
-index ff01283..60b746f 100644
+index ff01283..6942772 100644
 --- a/drivers/gpu/drm/i915/i915_opregion.c
 +++ b/drivers/gpu/drm/i915/i915_opregion.c
 @@ -26,6 +26,7 @@
@@ -125,10 +151,11 @@
  static u32 asle_set_backlight(struct drm_device *dev, u32 bclp)
  {
  	struct drm_i915_private *dev_priv = dev->dev_private;
-@@ -282,6 +289,57 @@ static struct notifier_block intel_opregion_notifier = {
+@@ -282,7 +289,58 @@ static struct notifier_block intel_opregion_notifier = {
  	.notifier_call = intel_opregion_video_event,
  };
  
+-int intel_opregion_init(struct drm_device *dev)
 +/*
 + * Initialise the DIDL field in opregion. This passes a list of devices to
 + * the firmware. Values are defined by section B.4.2 of the ACPI specification
@@ -180,16 +207,18 @@
 +		opregion->acpi->didl[i] = 0;
 +}
 +
- int intel_opregion_init(struct drm_device *dev)
++int intel_opregion_init(struct drm_device *dev, int resume)
  {
  	struct drm_i915_private *dev_priv = dev->dev_private;
-@@ -312,6 +370,10 @@ int intel_opregion_init(struct drm_device *dev)
+ 	struct intel_opregion *opregion = &dev_priv->opregion;
+@@ -312,6 +370,11 @@ int intel_opregion_init(struct drm_device *dev)
  	if (mboxes & MBOX_ACPI) {
  		DRM_DEBUG("Public ACPI methods supported\n");
  		opregion->acpi = base + OPREGION_ACPI_OFFSET;
 +		if (drm_core_check_feature(dev, DRIVER_MODESET)) {
 +			intel_didl_outputs(dev);
-+			acpi_video_register();
++			if (!resume)
++				acpi_video_register();
 +		}
  	} else {
  		DRM_DEBUG("Public ACPI methods not supported\n");




More information about the fedora-extras-commits mailing list