For more information, join the team subscribe to the mailing list 
at the bottom of the Launchpad page

    http://launchpad.net/~hybrid-graphics-linux 

Please join this team if you are new by clicking on the "Join 
Team" link at the right of the Launchpad page. It's important to 
have as many users in the community as possible to request for 
appropriate support.

Tuesday, 20 July 2010

nvidia-pre-optimus: David Airlie's 0001-nouveau-mux-switching-test-patch-1.patch

[Hybrid-graphics-linux] finishing intel/nvidia support (with open drivers)
This is a patch to apply on top of current Linux tree, with a dmesg from a pre-optimus nvidia hybrid machine should bring up some info on the current state of the switchable toggle.
Testers welcomed, please report back at mailing list https://launchpad.net/~hybrid-graphics-linux, this email is repeated there:
http://people.freedesktop.org/~airlied/scratch/0001-nouveau-mux-switching-test-patch-1.patch
Also, if you have time to package the patched kernel for your favourite distro, please post it somewhere so that other people can install it and try it.

From d2049202567dcb83ef9b8bbf34a3bccc10d90477 Mon Sep 17 00:00:00 2001
From: Dave Airlie <airlied@redhat.com>
Date: Tue, 20 Jul 2010 09:06:09 +1000
Subject: [PATCH] nouveau: mux-switching test patch 1

---
drivers/gpu/drm/nouveau/nouveau_acpi.c | 20 +++++++++++++++++++-
1 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_acpi.c b/drivers/gpu/drm/nouveau/nouveau_acpi.c
index d4bcca8..dfb3b5b 100644
--- a/drivers/gpu/drm/nouveau/nouveau_acpi.c
+++ b/drivers/gpu/drm/nouveau/nouveau_acpi.c
@@ -31,6 +31,8 @@
#define NOUVEAU_DSM_POWER_SPEED 0x01
#define NOUVEAU_DSM_POWER_STAMINA 0x02

+#define NOUVEAU_DSM_TOGGLE 0x05
+
static struct nouveau_dsm_priv {
bool dsm_detected;
acpi_handle dhandle;
@@ -90,7 +92,12 @@ static int nouveau_dsm(acpi_handle handle, int func, int arg, int *result)

static int nouveau_dsm_switch_mux(acpi_handle handle, int mux_id)
{
- return nouveau_dsm(handle, NOUVEAU_DSM_LED, mux_id, NULL);
+ int result, ret;
+ ret = nouveau_dsm(handle, NOUVEAU_DSM_LED, mux_id, NULL);
+
+ ret = nouveau_dsm(handle, NOUVEAU_DSM_TOGGLE, (mux_id | (1<<31)), &result);
+ printk("mux switch toggle returned %d\n", result);
+ return ret;
}

static int nouveau_dsm_set_discrete_state(acpi_handle handle, enum vga_switcheroo_state state)
@@ -181,10 +188,21 @@ static bool nouveau_dsm_detect(void)
}

if (vga_count == 2 && has_dsm) {
+ u32 result;
+ int ret;
acpi_get_name(nouveau_dsm_priv.dhandle, ACPI_FULL_PATHNAME, &buffer);
printk(KERN_INFO "VGA switcheroo: detected DSM switching method %s handle\n",
acpi_method_name);
nouveau_dsm_priv.dsm_detected = true;
+ /* get current power state */
+ ret = nouveau_dsm(nouveau_dsm_priv.dhandle, NOUVEAU_DSM_POWER, NOUVEAU_DSM_POWER_STATE, &result);
+ if (ret == 0) {
+ printk("VGA switchreoo: current power state is %d\n", result);
+ }
+ ret = nouveau_dsm(nouveau_dsm_priv.dhandle, NOUVEAU_DSM_TOGGLE, 0, &result);
+ if (ret == 0) {
+ printk("VGA switchreoo: current toggle state is %d\n", result);
+ }
return true;
}
return false;
--
1.7.1

Followers