Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jan 24th, 2011  |  syntax: None  |  size: 38.23 KB  |  views: 877  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. diff -urNp linux-2.6.37//drivers/gpu/drm/drm_fops.c linux-2.6.37-OPTIMUS//drivers/gpu/drm/drm_fops.c
  2. --- linux-2.6.37//drivers/gpu/drm/drm_fops.c    2011-01-04 22:50:19.000000000 -0200
  3. +++ linux-2.6.37-OPTIMUS//drivers/gpu/drm/drm_fops.c    2011-01-15 15:12:12.000000000 -0200
  4. @@ -236,6 +236,8 @@ static int drm_open_helper(struct inode
  5.                 return -EBUSY;  /* No exclusive opens */
  6.         if (!drm_cpu_valid())
  7.                 return -EINVAL;
  8. +        if (dev->switch_power_state != DRM_SWITCH_POWER_ON)
  9. +                return -EINVAL;
  10.  
  11.         DRM_DEBUG("pid = %d, minor = %d\n", task_pid_nr(current), minor_id);
  12.  
  13. diff -urNp linux-2.6.37//drivers/gpu/drm/i915/i915_dma.c linux-2.6.37-OPTIMUS//drivers/gpu/drm/i915/i915_dma.c
  14. --- linux-2.6.37//drivers/gpu/drm/i915/i915_dma.c       2011-01-04 22:50:19.000000000 -0200
  15. +++ linux-2.6.37-OPTIMUS//drivers/gpu/drm/i915/i915_dma.c       2011-01-15 15:13:34.000000000 -0200
  16. @@ -1176,12 +1176,16 @@ static void i915_switcheroo_set_state(st
  17.         pm_message_t pmm = { .event = PM_EVENT_SUSPEND };
  18.         if (state == VGA_SWITCHEROO_ON) {
  19.                 printk(KERN_INFO "i915: switched on\n");
  20. +                dev->switch_power_state = DRM_SWITCH_POWER_CHANGING;
  21.                 /* i915 resume handler doesn't set to D0 */
  22.                 pci_set_power_state(dev->pdev, PCI_D0);
  23.                 i915_resume(dev);
  24. +                dev->switch_power_state = DRM_SWITCH_POWER_ON;
  25.         } else {
  26.                 printk(KERN_ERR "i915: switched off\n");
  27. +                dev->switch_power_state = DRM_SWITCH_POWER_CHANGING;
  28.                 i915_suspend(dev, pmm);
  29. +                dev->switch_power_state = DRM_SWITCH_POWER_OFF;
  30.         }
  31.  }
  32.  
  33. @@ -1252,6 +1256,7 @@ static int i915_load_modeset_init(struct
  34.  
  35.         ret = vga_switcheroo_register_client(dev->pdev,
  36.                                              i915_switcheroo_set_state,
  37. +                                             NULL,
  38.                                              i915_switcheroo_can_switch);
  39.         if (ret)
  40.                 goto cleanup_vga_client;
  41. diff -urNp linux-2.6.37//drivers/gpu/drm/i915/i915_drv.c linux-2.6.37-OPTIMUS//drivers/gpu/drm/i915/i915_drv.c
  42. --- linux-2.6.37//drivers/gpu/drm/i915/i915_drv.c       2011-01-04 22:50:19.000000000 -0200
  43. +++ linux-2.6.37-OPTIMUS//drivers/gpu/drm/i915/i915_drv.c       2011-01-15 15:16:23.000000000 -0200
  44. @@ -248,6 +248,8 @@ static int i915_drm_freeze(struct drm_de
  45.  {
  46.         struct drm_i915_private *dev_priv = dev->dev_private;
  47.  
  48. +        drm_kms_helper_poll_disable(dev);
  49. +
  50.         pci_save_state(dev->pdev);
  51.  
  52.         /* If KMS is active, we do the leavevt stuff here */
  53. @@ -284,7 +286,8 @@ int i915_suspend(struct drm_device *dev,
  54.         if (state.event == PM_EVENT_PRETHAW)
  55.                 return 0;
  56.  
  57. -       drm_kms_helper_poll_disable(dev);
  58. +        if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
  59. +                return 0;
  60.  
  61.         error = i915_drm_freeze(dev);
  62.         if (error)
  63. @@ -332,6 +335,9 @@ int i915_resume(struct drm_device *dev)
  64.  {
  65.         int ret;
  66.  
  67. +        if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
  68. +                return 0;
  69. +
  70.         if (pci_enable_device(dev->pdev))
  71.                 return -EIO;
  72.  
  73. @@ -523,6 +529,9 @@ static int i915_pm_suspend(struct device
  74.                 return -ENODEV;
  75.         }
  76.  
  77. +        if (drm_dev->switch_power_state == DRM_SWITCH_POWER_OFF)
  78. +                return 0;
  79. +
  80.         error = i915_drm_freeze(drm_dev);
  81.         if (error)
  82.                 return error;
  83. diff -urNp linux-2.6.37//drivers/gpu/drm/i915/intel_acpi.c linux-2.6.37-OPTIMUS//drivers/gpu/drm/i915/intel_acpi.c
  84. --- linux-2.6.37//drivers/gpu/drm/i915/intel_acpi.c     2011-01-04 22:50:19.000000000 -0200
  85. +++ linux-2.6.37-OPTIMUS//drivers/gpu/drm/i915/intel_acpi.c     2011-01-15 14:53:53.000000000 -0200
  86. @@ -182,8 +182,12 @@ static void intel_dsm_platform_mux_info(
  87.                         DRM_DEBUG_DRIVER("  hpd mux info: %s\n",
  88.                                intel_dsm_mux_type(info->buffer.pointer[3]));
  89.                 }
  90. +        } else if (pkg->type == ACPI_TYPE_BUFFER) {
  91. +                DRM_ERROR("MUX INFO returned buffer %d %p\n", pkg->buffer.length, pkg->buffer.pointer);
  92. +                if (pkg->buffer.length == 4)
  93. +                        DRM_ERROR("returned %08x\n", *(uint32_t *)pkg->buffer.pointer);
  94.         } else {
  95. -               DRM_ERROR("MUX INFO call failed\n");
  96. +                DRM_ERROR("MUX INFO call failed %d\n", pkg->type);
  97.         }
  98.  
  99.  out:
  100. diff -urNp linux-2.6.37//drivers/gpu/drm/nouveau/Kconfig linux-2.6.37-OPTIMUS//drivers/gpu/drm/nouveau/Kconfig
  101. --- linux-2.6.37//drivers/gpu/drm/nouveau/Kconfig       2011-01-04 22:50:19.000000000 -0200
  102. +++ linux-2.6.37-OPTIMUS//drivers/gpu/drm/nouveau/Kconfig       2011-01-15 15:03:23.000000000 -0200
  103. @@ -11,6 +11,7 @@ config DRM_NOUVEAU
  104.         select FRAMEBUFFER_CONSOLE if !EMBEDDED
  105.         select FB_BACKLIGHT if DRM_NOUVEAU_BACKLIGHT
  106.         select ACPI_VIDEO if ACPI
  107. +        select MXM_WMI if ACPI
  108.         help
  109.           Choose this option for open-source nVidia support.
  110.  
  111. diff -urNp linux-2.6.37//drivers/gpu/drm/nouveau/nouveau_acpi.c linux-2.6.37-OPTIMUS//drivers/gpu/drm/nouveau/nouveau_acpi.c
  112. --- linux-2.6.37//drivers/gpu/drm/nouveau/nouveau_acpi.c        2011-01-04 22:50:19.000000000 -0200
  113. +++ linux-2.6.37-OPTIMUS//drivers/gpu/drm/nouveau/nouveau_acpi.c        2011-01-15 15:44:50.000000000 -0200
  114. @@ -4,6 +4,8 @@
  115.  #include <acpi/acpi_drivers.h>
  116.  #include <acpi/acpi_bus.h>
  117.  #include <acpi/video.h>
  118. +#include <acpi/acpi.h>
  119. +#include <linux/mxm-wmi.h>
  120.  
  121.  #include "drmP.h"
  122.  #include "drm.h"
  123. @@ -92,20 +94,13 @@ static int nouveau_dsm(acpi_handle handl
  124.  
  125.  static int nouveau_dsm_switch_mux(acpi_handle handle, int mux_id)
  126.  {
  127. +        int output_id = 0;
  128. +        //hack output id using acpi lcd id
  129. +        //sony vaio 0x80010100
  130. +        mxm_wmi_call_mxds(mux_id == NOUVEAU_DSM_LED_STAMINA ? MXM_MXDS_ADAPTER_IGD : MXM_MXDS_ADAPTER_0, output_id);
  131.         return nouveau_dsm(handle, NOUVEAU_DSM_LED, mux_id, NULL);
  132.  }
  133.  
  134. -static int nouveau_dsm_set_discrete_state(acpi_handle handle, enum vga_switcheroo_state state)
  135. -{
  136. -       int arg;
  137. -       if (state == VGA_SWITCHEROO_ON)
  138. -               arg = NOUVEAU_DSM_POWER_SPEED;
  139. -       else
  140. -               arg = NOUVEAU_DSM_POWER_STAMINA;
  141. -       nouveau_dsm(handle, NOUVEAU_DSM_POWER, arg, NULL);
  142. -       return 0;
  143. -}
  144. -
  145.  static int nouveau_dsm_switchto(enum vga_switcheroo_client_id id)
  146.  {
  147.         if (id == VGA_SWITCHEROO_IGD)
  148. @@ -114,15 +109,6 @@ static int nouveau_dsm_switchto(enum vga
  149.                 return nouveau_dsm_switch_mux(nouveau_dsm_priv.dhandle, NOUVEAU_DSM_LED_SPEED);
  150.  }
  151.  
  152. -static int nouveau_dsm_power_state(enum vga_switcheroo_client_id id,
  153. -                                  enum vga_switcheroo_state state)
  154. -{
  155. -       if (id == VGA_SWITCHEROO_IGD)
  156. -               return 0;
  157. -
  158. -       return nouveau_dsm_set_discrete_state(nouveau_dsm_priv.dhandle, state);
  159. -}
  160. -
  161.  static int nouveau_dsm_init(void)
  162.  {
  163.         return 0;
  164. @@ -130,15 +116,19 @@ static int nouveau_dsm_init(void)
  165.  
  166.  static int nouveau_dsm_get_client_id(struct pci_dev *pdev)
  167.  {
  168. -       if (nouveau_dsm_priv.dhandle == DEVICE_ACPI_HANDLE(&pdev->dev))
  169. +        /* easy option one - intel vendor ID means Integrated */
  170. +        if (pdev->vendor == PCI_VENDOR_ID_INTEL)
  171.                 return VGA_SWITCHEROO_IGD;
  172. -       else
  173. -               return VGA_SWITCHEROO_DIS;
  174. +
  175. +        /* is this device on Bus 0? - this may need improving */
  176. +        if (pdev->bus->number == 0)
  177. +                return VGA_SWITCHEROO_IGD;
  178. +
  179. +        return VGA_SWITCHEROO_DIS;
  180.  }
  181.  
  182.  static struct vga_switcheroo_handler nouveau_dsm_handler = {
  183.         .switchto = nouveau_dsm_switchto,
  184. -       .power_state = nouveau_dsm_power_state,
  185.         .init = nouveau_dsm_init,
  186.         .get_client_id = nouveau_dsm_get_client_id,
  187.  };
  188. @@ -175,6 +165,14 @@ static bool nouveau_dsm_detect(void)
  189.         struct pci_dev *pdev = NULL;
  190.         int has_dsm = 0;
  191.         int vga_count = 0;
  192. +        bool guid_valid;
  193. +
  194. +        /* lookup the GUID */
  195. +        guid_valid = mxm_wmi_supported();
  196. +        if (!guid_valid)
  197. +                return false;
  198. +
  199. +        printk("MXM GUID detected in BIOS\n");
  200.  
  201.         while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, pdev)) != NULL) {
  202.                 vga_count++;
  203. diff -urNp linux-2.6.37//drivers/gpu/drm/nouveau/nouveau_drv.c linux-2.6.37-OPTIMUS//drivers/gpu/drm/nouveau/nouveau_drv.c
  204. --- linux-2.6.37//drivers/gpu/drm/nouveau/nouveau_drv.c 2011-01-04 22:50:19.000000000 -0200
  205. +++ linux-2.6.37-OPTIMUS//drivers/gpu/drm/nouveau/nouveau_drv.c 2011-01-15 15:17:35.000000000 -0200
  206. @@ -167,6 +167,9 @@ nouveau_pci_suspend(struct pci_dev *pdev
  207.         if (pm_state.event == PM_EVENT_PRETHAW)
  208.                 return 0;
  209.  
  210. +        if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
  211. +                return 0;
  212. +
  213.         NV_INFO(dev, "Disabling fbcon acceleration...\n");
  214.         nouveau_fbcon_save_disable_accel(dev);
  215.  
  216. @@ -263,6 +266,9 @@ nouveau_pci_resume(struct pci_dev *pdev)
  217.         struct drm_crtc *crtc;
  218.         int ret, i;
  219.  
  220. +        if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
  221. +                return 0;
  222. +
  223.         nouveau_fbcon_save_disable_accel(dev);
  224.  
  225.         NV_INFO(dev, "We're back, enabling device...\n");
  226. diff -urNp linux-2.6.37//drivers/gpu/drm/nouveau/nouveau_drv.h linux-2.6.37-OPTIMUS//drivers/gpu/drm/nouveau/nouveau_drv.h
  227. --- linux-2.6.37//drivers/gpu/drm/nouveau/nouveau_drv.h 2011-01-04 22:50:19.000000000 -0200
  228. +++ linux-2.6.37-OPTIMUS//drivers/gpu/drm/nouveau/nouveau_drv.h 2011-01-15 15:18:35.000000000 -0200
  229. @@ -686,6 +686,8 @@ struct drm_nouveau_private {
  230.  
  231.         struct nouveau_fbdev *nfbdev;
  232.         struct apertures_struct *apertures;
  233. +
  234. +        bool powered_down;
  235.  };
  236.  
  237.  static inline struct drm_nouveau_private *
  238. diff -urNp linux-2.6.37//drivers/gpu/drm/nouveau/nouveau_state.c linux-2.6.37-OPTIMUS//drivers/gpu/drm/nouveau/nouveau_state.c
  239. --- linux-2.6.37//drivers/gpu/drm/nouveau/nouveau_state.c       2011-01-04 22:50:19.000000000 -0200
  240. +++ linux-2.6.37-OPTIMUS//drivers/gpu/drm/nouveau/nouveau_state.c       2011-01-15 15:38:42.000000000 -0200
  241. @@ -531,15 +531,25 @@ static void nouveau_switcheroo_set_state
  242.         pm_message_t pmm = { .event = PM_EVENT_SUSPEND };
  243.         if (state == VGA_SWITCHEROO_ON) {
  244.                 printk(KERN_ERR "VGA switcheroo: switched nouveau on\n");
  245. +                dev->switch_power_state = DRM_SWITCH_POWER_CHANGING;
  246.                 nouveau_pci_resume(pdev);
  247.                 drm_kms_helper_poll_enable(dev);
  248. +                dev->switch_power_state = DRM_SWITCH_POWER_ON;
  249.         } else {
  250.                 printk(KERN_ERR "VGA switcheroo: switched nouveau off\n");
  251. +                dev->switch_power_state = DRM_SWITCH_POWER_CHANGING;
  252.                 drm_kms_helper_poll_disable(dev);
  253.                 nouveau_pci_suspend(pdev, pmm);
  254. +                dev->switch_power_state = DRM_SWITCH_POWER_OFF;
  255.         }
  256.  }
  257.  
  258. +static void nouveau_switcheroo_reprobe(struct pci_dev *pdev)
  259. +{
  260. +        struct drm_device *dev = pci_get_drvdata(pdev);
  261. +        nouveau_fbcon_output_poll_changed(dev);
  262. +}
  263. +
  264.  static bool nouveau_switcheroo_can_switch(struct pci_dev *pdev)
  265.  {
  266.         struct drm_device *dev = pci_get_drvdata(pdev);
  267. @@ -560,6 +570,7 @@ nouveau_card_init(struct drm_device *dev
  268.  
  269.         vga_client_register(dev->pdev, dev, NULL, nouveau_vga_set_decode);
  270.         vga_switcheroo_register_client(dev->pdev, nouveau_switcheroo_set_state,
  271. +                                       nouveau_switcheroo_reprobe,
  272.                                        nouveau_switcheroo_can_switch);
  273.  
  274.         /* Initialise internal driver API hooks */
  275. @@ -980,6 +991,7 @@ err_out:
  276.  
  277.  void nouveau_lastclose(struct drm_device *dev)
  278.  {
  279. +        vga_switcheroo_process_delayed_switch();
  280.  }
  281.  
  282.  int nouveau_unload(struct drm_device *dev)
  283. diff -urNp linux-2.6.37//drivers/gpu/drm/radeon/radeon_device.c linux-2.6.37-OPTIMUS//drivers/gpu/drm/radeon/radeon_device.c
  284. --- linux-2.6.37//drivers/gpu/drm/radeon/radeon_device.c        2011-01-04 22:50:19.000000000 -0200
  285. +++ linux-2.6.37-OPTIMUS//drivers/gpu/drm/radeon/radeon_device.c        2011-01-15 15:23:55.000000000 -0200
  286. @@ -636,20 +636,20 @@ void radeon_check_arguments(struct radeo
  287.  static void radeon_switcheroo_set_state(struct pci_dev *pdev, enum vga_switcheroo_state state)
  288.  {
  289.         struct drm_device *dev = pci_get_drvdata(pdev);
  290. -       struct radeon_device *rdev = dev->dev_private;
  291.         pm_message_t pmm = { .event = PM_EVENT_SUSPEND };
  292.         if (state == VGA_SWITCHEROO_ON) {
  293.                 printk(KERN_INFO "radeon: switched on\n");
  294.                 /* don't suspend or resume card normally */
  295. -               rdev->powered_down = false;
  296. +                dev->switch_power_state = DRM_SWITCH_POWER_CHANGING;
  297.                 radeon_resume_kms(dev);
  298. +                dev->switch_power_state = DRM_SWITCH_POWER_ON;
  299.                 drm_kms_helper_poll_enable(dev);
  300.         } else {
  301.                 printk(KERN_INFO "radeon: switched off\n");
  302.                 drm_kms_helper_poll_disable(dev);
  303. +                dev->switch_power_state = DRM_SWITCH_POWER_CHANGING;
  304.                 radeon_suspend_kms(dev, pmm);
  305. -               /* don't suspend or resume card normally */
  306. -               rdev->powered_down = true;
  307. +                dev->switch_power_state = DRM_SWITCH_POWER_OFF;
  308.         }
  309.  }
  310.  
  311. @@ -773,6 +773,7 @@ int radeon_device_init(struct radeon_dev
  312.         vga_client_register(rdev->pdev, rdev, NULL, radeon_vga_set_decode);
  313.         vga_switcheroo_register_client(rdev->pdev,
  314.                                        radeon_switcheroo_set_state,
  315. +                                       NULL,
  316.                                        radeon_switcheroo_can_switch);
  317.  
  318.         r = radeon_init(rdev);
  319. @@ -835,7 +836,7 @@ int radeon_suspend_kms(struct drm_device
  320.         }
  321.         rdev = dev->dev_private;
  322.  
  323. -       if (rdev->powered_down)
  324. +        if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
  325.                 return 0;
  326.  
  327.         /* turn off display hw */
  328. @@ -893,7 +894,7 @@ int radeon_resume_kms(struct drm_device
  329.         struct drm_connector *connector;
  330.         struct radeon_device *rdev = dev->dev_private;
  331.  
  332. -       if (rdev->powered_down)
  333. +        if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
  334.                 return 0;
  335.  
  336.         acquire_console_sem();
  337. diff -urNp linux-2.6.37//drivers/gpu/drm/radeon/radeon.h linux-2.6.37-OPTIMUS//drivers/gpu/drm/radeon/radeon.h
  338. --- linux-2.6.37//drivers/gpu/drm/radeon/radeon.h       2011-01-04 22:50:19.000000000 -0200
  339. +++ linux-2.6.37-OPTIMUS//drivers/gpu/drm/radeon/radeon.h       2011-01-15 15:21:15.000000000 -0200
  340. @@ -1110,7 +1110,6 @@ struct radeon_device {
  341.         uint8_t                 audio_status_bits;
  342.         uint8_t                 audio_category_code;
  343.  
  344. -       bool powered_down;
  345.         struct notifier_block acpi_nb;
  346.         /* only one userspace can use Hyperz features at a time */
  347.         struct drm_file *hyperz_filp;
  348. diff -urNp linux-2.6.37//drivers/gpu/drm/radeon/radeon_kms.c linux-2.6.37-OPTIMUS//drivers/gpu/drm/radeon/radeon_kms.c
  349. --- linux-2.6.37//drivers/gpu/drm/radeon/radeon_kms.c   2011-01-04 22:50:19.000000000 -0200
  350. +++ linux-2.6.37-OPTIMUS//drivers/gpu/drm/radeon/radeon_kms.c   2011-01-15 15:24:36.000000000 -0200
  351. @@ -203,10 +203,6 @@ int radeon_info_ioctl(struct drm_device
  352.   */
  353.  int radeon_driver_firstopen_kms(struct drm_device *dev)
  354.  {
  355. -       struct radeon_device *rdev = dev->dev_private;
  356. -
  357. -       if (rdev->powered_down)
  358. -               return -EINVAL;
  359.         return 0;
  360.  }
  361.  
  362. diff -urNp linux-2.6.37//drivers/gpu/vga/vgaarb.c linux-2.6.37-OPTIMUS//drivers/gpu/vga/vgaarb.c
  363. --- linux-2.6.37//drivers/gpu/vga/vgaarb.c      2011-01-04 22:50:19.000000000 -0200
  364. +++ linux-2.6.37-OPTIMUS//drivers/gpu/vga/vgaarb.c      2011-01-15 15:34:05.000000000 -0200
  365. @@ -62,6 +62,7 @@ struct vga_device {
  366.         unsigned int io_norm_cnt;       /* normal IO count */
  367.         unsigned int mem_norm_cnt;      /* normal MEM count */
  368.  
  369. +        bool bridge_has_one_vga;
  370.         /* allow IRQ enable/disable hook */
  371.         void *cookie;
  372.         void (*irq_set_state)(void *cookie, bool enable);
  373. @@ -165,6 +166,8 @@ static struct vga_device *__vga_tryget(s
  374.         unsigned int wants, legacy_wants, match;
  375.         struct vga_device *conflict;
  376.         unsigned int pci_bits;
  377. +        u32 flags = 0;
  378. +
  379.         /* Account for "normal" resources to lock. If we decode the legacy,
  380.          * counterpart, we need to request it as well
  381.          */
  382. @@ -237,16 +240,22 @@ static struct vga_device *__vga_tryget(s
  383.                 /* looks like he doesn't have a lock, we can steal
  384.                  * them from him
  385.                  */
  386. -               vga_irq_set_state(conflict, false);
  387.  
  388. +                flags = 0;
  389.                 pci_bits = 0;
  390. -               if (lwants & (VGA_RSRC_LEGACY_MEM|VGA_RSRC_NORMAL_MEM))
  391. -                       pci_bits |= PCI_COMMAND_MEMORY;
  392. -               if (lwants & (VGA_RSRC_LEGACY_IO|VGA_RSRC_NORMAL_IO))
  393. -                       pci_bits |= PCI_COMMAND_IO;
  394. -
  395. -               pci_set_vga_state(conflict->pdev, false, pci_bits,
  396. -                                 change_bridge);
  397. +                if (!conflict->bridge_has_one_vga) {
  398. +                        vga_irq_set_state(conflict, false);
  399. +                        flags |= PCI_VGA_STATE_CHANGE_DECODES;
  400. +                        if (lwants & (VGA_RSRC_LEGACY_MEM|VGA_RSRC_NORMAL_MEM))
  401. +                                pci_bits |= PCI_COMMAND_MEMORY;
  402. +                        if (lwants & (VGA_RSRC_LEGACY_IO|VGA_RSRC_NORMAL_IO))
  403. +                                pci_bits |= PCI_COMMAND_IO;
  404. +                }
  405. +
  406. +                if (change_bridge)
  407. +                        flags |= PCI_VGA_STATE_CHANGE_BRIDGE;
  408. +
  409. +                pci_set_vga_state(conflict->pdev, false, pci_bits, flags);
  410.                 conflict->owns &= ~lwants;
  411.                 /* If he also owned non-legacy, that is no longer the case */
  412.                 if (lwants & VGA_RSRC_LEGACY_MEM)
  413. @@ -261,14 +270,23 @@ enable_them:
  414.          * also have in "decodes". We can lock resources we don't decode but
  415.          * not own them.
  416.          */
  417. +        flags = 0;
  418.         pci_bits = 0;
  419. -       if (wants & (VGA_RSRC_LEGACY_MEM|VGA_RSRC_NORMAL_MEM))
  420. -               pci_bits |= PCI_COMMAND_MEMORY;
  421. -       if (wants & (VGA_RSRC_LEGACY_IO|VGA_RSRC_NORMAL_IO))
  422. -               pci_bits |= PCI_COMMAND_IO;
  423. -       pci_set_vga_state(vgadev->pdev, true, pci_bits, !!(wants & VGA_RSRC_LEGACY_MASK));
  424. -
  425. -       vga_irq_set_state(vgadev, true);
  426. +        if (!vgadev->bridge_has_one_vga) {
  427. +                flags |= PCI_VGA_STATE_CHANGE_DECODES;
  428. +                if (wants & (VGA_RSRC_LEGACY_MEM|VGA_RSRC_NORMAL_MEM))
  429. +                        pci_bits |= PCI_COMMAND_MEMORY;
  430. +                if (wants & (VGA_RSRC_LEGACY_IO|VGA_RSRC_NORMAL_IO))
  431. +                        pci_bits |= PCI_COMMAND_IO;
  432. +        }
  433. +        if (!!(wants & VGA_RSRC_LEGACY_MASK))
  434. +                flags |= PCI_VGA_STATE_CHANGE_BRIDGE;
  435. +
  436. +        pci_set_vga_state(vgadev->pdev, true, pci_bits, flags);
  437. +
  438. +        if (!vgadev->bridge_has_one_vga) {
  439. +                vga_irq_set_state(vgadev, true);
  440. +        }
  441.         vgadev->owns |= (wants & vgadev->decodes);
  442.  lock_them:
  443.         vgadev->locks |= (rsrc & VGA_RSRC_LEGACY_MASK);
  444. @@ -421,6 +439,62 @@ bail:
  445.  }
  446.  EXPORT_SYMBOL(vga_put);
  447.  
  448. +/* Rules for using a bridge to control a VGA descendant decoding:
  449. +   if a bridge has only one VGA descendant then it can be used
  450. +   to control the VGA routing for that device.
  451. +   It should always use the bridge closest to the device to control it.
  452. +   If a bridge has a direct VGA descendant, but also have a sub-bridge
  453. +   VGA descendant then we cannot use that bridge to control the direct VGA descendant.
  454. +   So for every device we register, we need to iterate all its parent bridges
  455. +   so we can invalidate any devices using them properly.
  456. +*/
  457. +static void vga_arbiter_check_bridge_sharing(struct vga_device *vgadev)
  458. +{
  459. +       struct vga_device *same_bridge_vgadev;
  460. +       struct pci_bus *new_bus, *bus;
  461. +       struct pci_dev *new_bridge, *bridge;
  462. +
  463. +       vgadev->bridge_has_one_vga = true;
  464. +
  465. +       if (list_empty(&vga_list))
  466. +               return;
  467. +
  468. +       /* okay iterate the new devices bridge hierarachy */
  469. +       new_bus = vgadev->pdev->bus;
  470. +       while (new_bus) {
  471. +               new_bridge = new_bus->self;
  472. +
  473. +               if (new_bridge) {
  474. +                       /* go through list of devices already registered */
  475. +                       list_for_each_entry(same_bridge_vgadev, &vga_list, list) {
  476. +                               bus = same_bridge_vgadev->pdev->bus;
  477. +                               bridge = bus->self;
  478. +
  479. +                               /* see if the share a bridge with this device */
  480. +                               if (new_bridge == bridge) {
  481. +                                       /* if their direct parent bridge is the same
  482. +                                          as any bridge of this device then it can't be used
  483. +                                          for that device */
  484. +                                       same_bridge_vgadev->bridge_has_one_vga = false;
  485. +                               }
  486. +
  487. +                               /* now iterate the previous devices bridge hierarchy */
  488. +                               /* if the new devices parent bridge is in the other devices
  489. +                                  hierarchy then we can't use it to control this device */
  490. +                               while (bus) {
  491. +                                       bridge = bus->self;
  492. +                                       if (bridge) {
  493. +                                               if (bridge == vgadev->pdev->bus->self)
  494. +                                                       vgadev->bridge_has_one_vga = false;
  495. +                                       }
  496. +                                       bus = bus->parent;
  497. +                               }
  498. +                       }
  499. +               }
  500. +               new_bus = new_bus->parent;
  501. +       }
  502. +}
  503. +
  504.  /*
  505.   * Currently, we assume that the "initial" setup of the system is
  506.   * not sane, that is we come up with conflicting devices and let
  507. @@ -500,6 +574,8 @@ static bool vga_arbiter_add_pci_device(s
  508.                 vga_default = pci_dev_get(pdev);
  509.  #endif
  510.  
  511. +        vga_arbiter_check_bridge_sharing(vgadev);
  512. +
  513.         /* Add to the list */
  514.         list_add(&vgadev->list, &vga_list);
  515.         vga_count++;
  516. @@ -1222,6 +1298,7 @@ static int __init vga_arb_device_init(vo
  517.  {
  518.         int rc;
  519.         struct pci_dev *pdev;
  520. +        struct vga_device *vgadev;
  521.  
  522.         rc = misc_register(&vga_arb_device);
  523.         if (rc < 0)
  524. @@ -1238,6 +1315,13 @@ static int __init vga_arb_device_init(vo
  525.                 vga_arbiter_add_pci_device(pdev);
  526.  
  527.         pr_info("vgaarb: loaded\n");
  528. +
  529. +        list_for_each_entry(vgadev, &vga_list, list) {
  530. +                if (vgadev->bridge_has_one_vga)
  531. +                        pr_info("vgaarb: bridge control possible %s\n", pci_name(vgadev->pdev));
  532. +                else
  533. +                        pr_info("vgaarb: no bridge control possible %s\n", pci_name(vgadev->pdev));
  534. +        }
  535.         return rc;
  536.  }
  537.  subsys_initcall(vga_arb_device_init);
  538. diff -urNp linux-2.6.37//drivers/gpu/vga/vga_switcheroo.c linux-2.6.37-OPTIMUS//drivers/gpu/vga/vga_switcheroo.c
  539. --- linux-2.6.37//drivers/gpu/vga/vga_switcheroo.c      2011-01-04 22:50:19.000000000 -0200
  540. +++ linux-2.6.37-OPTIMUS//drivers/gpu/vga/vga_switcheroo.c      2011-01-15 15:43:37.000000000 -0200
  541. @@ -33,6 +33,7 @@ struct vga_switcheroo_client {
  542.         struct fb_info *fb_info;
  543.         int pwr_state;
  544.         void (*set_gpu_state)(struct pci_dev *pdev, enum vga_switcheroo_state);
  545. +        void (*reprobe)(struct pci_dev *pdev);
  546.         bool (*can_switch)(struct pci_dev *pdev);
  547.         int id;
  548.         bool active;
  549. @@ -103,6 +104,7 @@ static void vga_switcheroo_enable(void)
  550.  
  551.  int vga_switcheroo_register_client(struct pci_dev *pdev,
  552.                                    void (*set_gpu_state)(struct pci_dev *pdev, enum vga_switcheroo_state),
  553. +                                   void (*reprobe)(struct pci_dev *pdev),
  554.                                    bool (*can_switch)(struct pci_dev *pdev))
  555.  {
  556.         int index;
  557. @@ -117,6 +119,7 @@ int vga_switcheroo_register_client(struc
  558.         vgasr_priv.clients[index].pwr_state = VGA_SWITCHEROO_ON;
  559.         vgasr_priv.clients[index].pdev = pdev;
  560.         vgasr_priv.clients[index].set_gpu_state = set_gpu_state;
  561. +        vgasr_priv.clients[index].reprobe = reprobe;
  562.         vgasr_priv.clients[index].can_switch = can_switch;
  563.         vgasr_priv.clients[index].id = -1;
  564.         if (pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW)
  565. @@ -174,7 +177,8 @@ static int vga_switcheroo_show(struct se
  566.         int i;
  567.         mutex_lock(&vgasr_mutex);
  568.         for (i = 0; i < VGA_SWITCHEROO_MAX_CLIENTS; i++) {
  569. -               seq_printf(m, "%d:%c:%s:%s\n", i,
  570. +                seq_printf(m, "%d:%s:%c:%s:%s\n", i,
  571. +                           vgasr_priv.clients[i].id == VGA_SWITCHEROO_DIS ? "DIS" : "IGD",
  572.                            vgasr_priv.clients[i].active ? '+' : ' ',
  573.                            vgasr_priv.clients[i].pwr_state ? "Pwr" : "Off",
  574.                            pci_name(vgasr_priv.clients[i].pdev));
  575. @@ -190,9 +194,8 @@ static int vga_switcheroo_debugfs_open(s
  576.  
  577.  static int vga_switchon(struct vga_switcheroo_client *client)
  578.  {
  579. -       int ret;
  580. -
  581. -       ret = vgasr_priv.handler->power_state(client->id, VGA_SWITCHEROO_ON);
  582. +        if (vgasr_priv.handler->power_state)
  583. +                vgasr_priv.handler->power_state(client->id, VGA_SWITCHEROO_ON);
  584.         /* call the driver callback to turn on device */
  585.         client->set_gpu_state(client->pdev, VGA_SWITCHEROO_ON);
  586.         client->pwr_state = VGA_SWITCHEROO_ON;
  587. @@ -203,12 +206,14 @@ static int vga_switchoff(struct vga_swit
  588.  {
  589.         /* call the driver callback to turn off device */
  590.         client->set_gpu_state(client->pdev, VGA_SWITCHEROO_OFF);
  591. -       vgasr_priv.handler->power_state(client->id, VGA_SWITCHEROO_OFF);
  592. +        if (vgasr_priv.handler->power_state)
  593. +                vgasr_priv.handler->power_state(client->id, VGA_SWITCHEROO_OFF);
  594.         client->pwr_state = VGA_SWITCHEROO_OFF;
  595.         return 0;
  596.  }
  597.  
  598. -static int vga_switchto(struct vga_switcheroo_client *new_client)
  599. +/* stage one happens before delay */
  600. +static int vga_switchto_stage1(struct vga_switcheroo_client *new_client)
  601.  {
  602.         int ret;
  603.         int i;
  604. @@ -235,10 +240,28 @@ static int vga_switchto(struct vga_switc
  605.                 vga_switchon(new_client);
  606.  
  607.         /* swap shadow resource to denote boot VGA device has changed so X starts on new device */
  608. -       active->active = false;
  609. -
  610.         active->pdev->resource[PCI_ROM_RESOURCE].flags &= ~IORESOURCE_ROM_SHADOW;
  611.         new_client->pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW;
  612. +        return 0;
  613. +}
  614. +
  615. +/* post delay */
  616. +static int vga_switchto_stage2(struct vga_switcheroo_client *new_client)
  617. +{
  618. +        int ret;
  619. +        int i;
  620. +        struct vga_switcheroo_client *active = NULL;
  621. +
  622. +        for (i = 0; i < VGA_SWITCHEROO_MAX_CLIENTS; i++) {
  623. +                if (vgasr_priv.clients[i].active == true) {
  624. +                        active = &vgasr_priv.clients[i];
  625. +                        break;
  626. +                }
  627. +        }
  628. +        if (!active)
  629. +                return 0;
  630. +
  631. +        active->active = false;
  632.  
  633.         if (new_client->fb_info) {
  634.                 struct fb_event event;
  635. @@ -250,6 +273,9 @@ static int vga_switchto(struct vga_switc
  636.         if (ret)
  637.                 return ret;
  638.  
  639. +        if (new_client->reprobe)
  640. +                new_client->reprobe(new_client->pdev);
  641. +
  642.         if (active->pwr_state == VGA_SWITCHEROO_ON)
  643.                 vga_switchoff(active);
  644.  
  645. @@ -265,6 +291,7 @@ vga_switcheroo_debugfs_write(struct file
  646.         const char *pdev_name;
  647.         int i, ret;
  648.         bool delay = false, can_switch;
  649. +        bool just_mux = false;
  650.         int client_id = -1;
  651.         struct vga_switcheroo_client *client = NULL;
  652.  
  653. @@ -319,6 +346,15 @@ vga_switcheroo_debugfs_write(struct file
  654.         if (strncmp(usercmd, "DIS", 3) == 0)
  655.                 client_id = VGA_SWITCHEROO_DIS;
  656.  
  657. +        if (strncmp(usercmd, "MIGD", 3) == 0) {
  658. +                just_mux = true;
  659. +                client_id = VGA_SWITCHEROO_IGD;
  660. +        }
  661. +        if (strncmp(usercmd, "MDIS", 3) == 0) {
  662. +                just_mux = true;
  663. +                client_id = VGA_SWITCHEROO_DIS;
  664. +        }
  665. +
  666.         if (client_id == -1)
  667.                 goto out;
  668.  
  669. @@ -330,6 +366,12 @@ vga_switcheroo_debugfs_write(struct file
  670.         }
  671.  
  672.         vgasr_priv.delayed_switch_active = false;
  673. +
  674. +        if (just_mux) {
  675. +                ret = vgasr_priv.handler->switchto(client_id);
  676. +                goto out;
  677. +        }
  678. +
  679.         /* okay we want a switch - test if devices are willing to switch */
  680.         can_switch = true;
  681.         for (i = 0; i < VGA_SWITCHEROO_MAX_CLIENTS; i++) {
  682. @@ -345,18 +387,21 @@ vga_switcheroo_debugfs_write(struct file
  683.  
  684.         if (can_switch == true) {
  685.                 pdev_name = pci_name(client->pdev);
  686. -               ret = vga_switchto(client);
  687. +                ret = vga_switchto_stage1(client);
  688. +                if (ret)
  689. +                        printk(KERN_ERR "vga_switcheroo: switching failed stage 1 %d\n", ret);
  690. +
  691. +                ret = vga_switchto_stage2(client);
  692.                 if (ret)
  693. -                       printk(KERN_ERR "vga_switcheroo: switching failed %d\n", ret);
  694. ++                       printk(KERN_ERR "vga_switcheroo: switching failed stage 2 %d\n", ret);
  695.         } else {
  696.                 printk(KERN_INFO "vga_switcheroo: setting delayed switch to client %d\n", client->id);
  697.                 vgasr_priv.delayed_switch_active = true;
  698.                 vgasr_priv.delayed_client_id = client_id;
  699.  
  700. -               /* we should at least power up the card to
  701. -                  make the switch faster */
  702. -               if (client->pwr_state == VGA_SWITCHEROO_OFF)
  703. -                       vga_switchon(client);
  704. +                ret = vga_switchto_stage1(client);
  705. +                if (ret)
  706. +                        printk(KERN_ERR "vga_switcheroo: delayed switching stage 1 failed %d\n", ret);
  707.         }
  708.  
  709.  out:
  710. @@ -438,9 +483,9 @@ int vga_switcheroo_process_delayed_switc
  711.                 goto err;
  712.  
  713.         pdev_name = pci_name(client->pdev);
  714. -       ret = vga_switchto(client);
  715. +        ret = vga_switchto_stage2(client);
  716.         if (ret)
  717. -               printk(KERN_ERR "vga_switcheroo: delayed switching failed %d\n", ret);
  718. +                printk(KERN_ERR "vga_switcheroo: delayed switching failed stage 2 %d\n", ret);
  719.  
  720.         vgasr_priv.delayed_switch_active = false;
  721.         err = 0;
  722. diff -urNp linux-2.6.37//drivers/pci/pci.c linux-2.6.37-OPTIMUS//drivers/pci/pci.c
  723. --- linux-2.6.37//drivers/pci/pci.c     2011-01-04 22:50:19.000000000 -0200
  724. +++ linux-2.6.37-OPTIMUS//drivers/pci/pci.c     2011-01-15 15:36:29.000000000 -0200
  725. @@ -2888,31 +2888,34 @@ static int pci_set_vga_state_arch(struct
  726.   * @dev: the PCI device
  727.   * @decode: true = enable decoding, false = disable decoding
  728.   * @command_bits: PCI_COMMAND_IO and/or PCI_COMMAND_MEMORY
  729. - * @change_bridge: traverse ancestors and change bridges
  730. + * @change_bridge_flags: traverse ancestors and change bridges
  731. + * CHANGE_BRIDGE_ONLY / CHANGE_BRIDGE
  732.   */
  733.  int pci_set_vga_state(struct pci_dev *dev, bool decode,
  734. -                     unsigned int command_bits, bool change_bridge)
  735. +                      unsigned int command_bits, u32 flags)
  736.  {
  737.         struct pci_bus *bus;
  738.         struct pci_dev *bridge;
  739.         u16 cmd;
  740.         int rc;
  741.  
  742. -       WARN_ON(command_bits & ~(PCI_COMMAND_IO|PCI_COMMAND_MEMORY));
  743. +        WARN_ON((flags & PCI_VGA_STATE_CHANGE_DECODES) & (command_bits & ~(PCI_COMMAND_IO|PCI_COMMAND_MEMORY)));
  744.  
  745.         /* ARCH specific VGA enables */
  746. -       rc = pci_set_vga_state_arch(dev, decode, command_bits, change_bridge);
  747. +        rc = pci_set_vga_state_arch(dev, decode, command_bits, flags);
  748.         if (rc)
  749.                 return rc;
  750.  
  751. -       pci_read_config_word(dev, PCI_COMMAND, &cmd);
  752. -       if (decode == true)
  753. -               cmd |= command_bits;
  754. -       else
  755. -               cmd &= ~command_bits;
  756. -       pci_write_config_word(dev, PCI_COMMAND, cmd);
  757. +        if (flags & PCI_VGA_STATE_CHANGE_DECODES) {
  758. +                pci_read_config_word(dev, PCI_COMMAND, &cmd);
  759. +                if (decode == true)
  760. +                        cmd |= command_bits;
  761. +                else
  762. +                        cmd &= ~command_bits;
  763. +                pci_write_config_word(dev, PCI_COMMAND, cmd);
  764. +        }
  765.  
  766. -       if (change_bridge == false)
  767. +        if (!(flags & PCI_VGA_STATE_CHANGE_BRIDGE))
  768.                 return 0;
  769.  
  770.         bus = dev->bus;
  771. diff -urNp linux-2.6.37//drivers/platform/x86/Kconfig linux-2.6.37-OPTIMUS//drivers/platform/x86/Kconfig
  772. --- linux-2.6.37//drivers/platform/x86/Kconfig  2011-01-04 22:50:19.000000000 -0200
  773. +++ linux-2.6.37-OPTIMUS//drivers/platform/x86/Kconfig  2011-01-15 14:54:56.000000000 -0200
  774. @@ -639,4 +639,11 @@ config XO1_RFKILL
  775.           Support for enabling/disabling the WLAN interface on the OLPC XO-1
  776.           laptop.
  777.  
  778. +config MXM_WMI
  779. +        tristate "WMI support for MXM Laptop Graphics"
  780. +        depends on WMI
  781. +        ---help---
  782. +           MXM is a standard for laptop graphics cards, the WMI interface
  783. +           is required for switchable nvidia graphics machines
  784. +
  785.  endif # X86_PLATFORM_DEVICES
  786. diff -urNp linux-2.6.37//drivers/platform/x86/Makefile linux-2.6.37-OPTIMUS//drivers/platform/x86/Makefile
  787. --- linux-2.6.37//drivers/platform/x86/Makefile 2011-01-04 22:50:19.000000000 -0200
  788. +++ linux-2.6.37-OPTIMUS//drivers/platform/x86/Makefile 2011-01-15 14:55:33.000000000 -0200
  789. @@ -33,3 +33,4 @@ obj-$(CONFIG_INTEL_IPS)               += intel_ips.o
  790.  obj-$(CONFIG_GPIO_INTEL_PMIC)  += intel_pmic_gpio.o
  791.  obj-$(CONFIG_XO1_RFKILL)       += xo1-rfkill.o
  792.  obj-$(CONFIG_IBM_RTL)          += ibm_rtl.o
  793. +obj-$(CONFIG_MXM_WMI)           += mxm-wmi.o
  794. diff -urNp linux-2.6.37//drivers/platform/x86/mxm-wmi.c linux-2.6.37-OPTIMUS//drivers/platform/x86/mxm-wmi.c
  795. --- linux-2.6.37//drivers/platform/x86/mxm-wmi.c        1969-12-31 21:00:00.000000000 -0300
  796. +++ linux-2.6.37-OPTIMUS//drivers/platform/x86/mxm-wmi.c        2011-01-15 15:45:34.000000000 -0200
  797. @@ -0,0 +1,85 @@
  798. +/*
  799. + * MXM WMI driver
  800. + *
  801. + * Copyright(C) 2010 Red Hat.
  802. + *
  803. + *  This program is free software; you can redistribute it and/or modify
  804. + *  it under the terms of the GNU General Public License as published by
  805. + *  the Free Software Foundation; either version 2 of the License, or
  806. + *  (at your option) any later version.
  807. + *
  808. + *  This program is distributed in the hope that it will be useful,
  809. + *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  810. + *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  811. + *  GNU General Public License for more details.
  812. + *
  813. + *  You should have received a copy of the GNU General Public License
  814. + *  along with this program; if not, write to the Free Software
  815. + *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  816. +*/
  817. +#include <linux/kernel.h>
  818. +#include <linux/module.h>
  819. +#include <linux/init.h>
  820. +#include <acpi/acpi_bus.h>
  821. +#include <acpi/acpi_drivers.h>
  822. +
  823. +MODULE_AUTHOR("Dave Airlie");
  824. +MODULE_DESCRIPTION("MXM WMI Driver");
  825. +MODULE_LICENSE("GPL");
  826. +
  827. +#define MXM_WMMX_GUID "F6CB5C3C-9CAE-4EBD-B577-931EA32A2CC0"
  828. +
  829. +MODULE_ALIAS("wmi:"MXM_WMMX_GUID);
  830. +
  831. +#define MXM_WMMX_FUNC_MXDS 0x5344584D /* "MXDS" */
  832. +
  833. +struct mxds_args {
  834. +       u32 func;
  835. +       u32 args;
  836. +       u32 xarg;
  837. +};
  838. +
  839. +int mxm_wmi_call_mxds(int adapter, uint32_t output_id)
  840. +{
  841. +       struct mxds_args args = {
  842. +               .func = MXM_WMMX_FUNC_MXDS,
  843. +               .args = output_id,
  844. +               .xarg = 1,
  845. +       };
  846. +       struct acpi_buffer input = { (acpi_size)sizeof(args), &args };
  847. +       struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
  848. +       acpi_status status;
  849. +
  850. +       printk("calling mux switch %d\n", adapter);
  851. +      
  852. +       status = wmi_evaluate_method(MXM_WMMX_GUID, 0x1, adapter, &input,
  853. +                                    &output);
  854. +
  855. +       if (ACPI_FAILURE(status))
  856. +               return status;
  857. +
  858. +       printk("mux switched %d\n", status);
  859. +       return 0;
  860. +                          
  861. +}
  862. +EXPORT_SYMBOL_GPL(mxm_wmi_call_mxds);
  863. +
  864. +bool mxm_wmi_supported(void)
  865. +{
  866. +       bool guid_valid;
  867. +       guid_valid = wmi_has_guid(MXM_WMMX_GUID);
  868. +       return guid_valid;
  869. +}
  870. +EXPORT_SYMBOL_GPL(mxm_wmi_supported);
  871. +
  872. +static int __init mxm_wmi_init(void)
  873. +{
  874. +       return 0;
  875. +}
  876. +
  877. +static void __exit mxm_wmi_exit(void)
  878. +{
  879. +}
  880. +
  881. +module_init(mxm_wmi_init);
  882. +module_exit(mxm_wmi_exit);
  883. Os arquivos binários linux-2.6.37//drivers/staging/ft1000/ft1000-pcmcia/ft1000.img e linux-2.6.37-OPTIMUS//drivers/staging/ft1000/ft1000-pcmcia/ft1000.img são diferentes
  884. Os arquivos binários linux-2.6.37//drivers/staging/ft1000/ft1000-usb/ft3000.img e linux-2.6.37-OPTIMUS//drivers/staging/ft1000/ft1000-usb/ft3000.img são diferentes
  885. diff -urNp linux-2.6.37//include/drm/drmP.h linux-2.6.37-OPTIMUS//include/drm/drmP.h
  886. --- linux-2.6.37//include/drm/drmP.h    2011-01-04 22:50:19.000000000 -0200
  887. +++ linux-2.6.37-OPTIMUS//include/drm/drmP.h    2011-01-15 15:25:49.000000000 -0200
  888. @@ -1044,9 +1044,13 @@ struct drm_device {
  889.         uint32_t invalidate_domains;    /* domains pending invalidation */
  890.         uint32_t flush_domains;         /* domains pending flush */
  891.         /*@} */
  892. -
  893. +        int switch_power_state;
  894.  };
  895.  
  896. +#define DRM_SWITCH_POWER_ON 0
  897. +#define DRM_SWITCH_POWER_OFF 1
  898. +#define DRM_SWITCH_POWER_CHANGING 2
  899. +
  900.  static __inline__ int drm_core_check_feature(struct drm_device *dev,
  901.                                              int feature)
  902.  {
  903. diff -urNp linux-2.6.37//include/linux/mxm-wmi.h linux-2.6.37-OPTIMUS//include/linux/mxm-wmi.h
  904. --- linux-2.6.37//include/linux/mxm-wmi.h       1969-12-31 21:00:00.000000000 -0300
  905. +++ linux-2.6.37-OPTIMUS//include/linux/mxm-wmi.h       2011-01-15 15:46:03.000000000 -0200
  906. @@ -0,0 +1,32 @@
  907. +/*
  908. + * MXM WMI driver
  909. + *
  910. + * Copyright(C) 2010 Red Hat.
  911. + *
  912. + *  This program is free software; you can redistribute it and/or modify
  913. + *  it under the terms of the GNU General Public License as published by
  914. + *  the Free Software Foundation; either version 2 of the License, or
  915. + *  (at your option) any later version.
  916. + *
  917. + *  This program is distributed in the hope that it will be useful,
  918. + *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  919. + *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  920. + *  GNU General Public License for more details.
  921. + *
  922. + *  You should have received a copy of the GNU General Public License
  923. + *  along with this program; if not, write to the Free Software
  924. + *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  925. +*/
  926. +
  927. +#ifndef MXM_WMI_H
  928. +#define MXM_WMI_H
  929. +
  930. +/* discrete adapters */
  931. +#define MXM_MXDS_ADAPTER_0 0x0
  932. +#define MXM_MXDS_ADAPTER_1 0x0
  933. +/* integrated adapter */
  934. +#define MXM_MXDS_ADAPTER_IGD 0x10
  935. +int mxm_wmi_call_mxds(int adapter, u32 output_id);
  936. +bool mxm_wmi_supported(void);
  937. +
  938. +#endif
  939. diff -urNp linux-2.6.37//include/linux/pci.h linux-2.6.37-OPTIMUS//include/linux/pci.h
  940. --- linux-2.6.37//include/linux/pci.h   2011-01-04 22:50:19.000000000 -0200
  941. +++ linux-2.6.37-OPTIMUS//include/linux/pci.h   2011-01-15 15:37:50.000000000 -0200
  942. @@ -916,8 +916,11 @@ int pci_cfg_space_size_ext(struct pci_de
  943.  int pci_cfg_space_size(struct pci_dev *dev);
  944.  unsigned char pci_bus_max_busnr(struct pci_bus *bus);
  945.  
  946. +#define PCI_VGA_STATE_CHANGE_BRIDGE (1 << 0)
  947. +#define PCI_VGA_STATE_CHANGE_DECODES (1 << 1)
  948. +
  949.  int pci_set_vga_state(struct pci_dev *pdev, bool decode,
  950. -                     unsigned int command_bits, bool change_bridge);
  951. +                      unsigned int command_bits, u32 flags);
  952.  /* kmem_cache style wrapper around pci_alloc_consistent() */
  953.  
  954.  #include <linux/pci-dma.h>
  955. @@ -1047,7 +1050,7 @@ static inline int pci_proc_domain(struct
  956.  
  957.  /* some architectures require additional setup to direct VGA traffic */
  958.  typedef int (*arch_set_vga_state_t)(struct pci_dev *pdev, bool decode,
  959. -                     unsigned int command_bits, bool change_bridge);
  960. +                      unsigned int command_bits, u32 flags);
  961.  extern void pci_register_set_vga_state(arch_set_vga_state_t func);
  962.  
  963.  #else /* CONFIG_PCI is not enabled */
  964. diff -urNp linux-2.6.37//include/linux/vga_switcheroo.h linux-2.6.37-OPTIMUS//include/linux/vga_switcheroo.h
  965. --- linux-2.6.37//include/linux/vga_switcheroo.h        2011-01-04 22:50:19.000000000 -0200
  966. +++ linux-2.6.37-OPTIMUS//include/linux/vga_switcheroo.h        2011-01-15 15:11:26.000000000 -0200
  967. @@ -33,6 +33,7 @@ struct vga_switcheroo_handler {
  968.  void vga_switcheroo_unregister_client(struct pci_dev *dev);
  969.  int vga_switcheroo_register_client(struct pci_dev *dev,
  970.                                    void (*set_gpu_state)(struct pci_dev *dev, enum vga_switcheroo_state),
  971. +                                   void (*reprobe)(struct pci_dev *dev),
  972.                                    bool (*can_switch)(struct pci_dev *dev));
  973.  
  974.  void vga_switcheroo_client_fb_set(struct pci_dev *dev,
clone this paste RAW Paste Data