Skip to content

Commit

Permalink
Merge branch 'topic/vga-switcheroo' of git://git.kernel.org/pub/scm/l…
Browse files Browse the repository at this point in the history
…inux/kernel/git/tiwai/sound into drm-core-next

* 'topic/vga-switcheroo' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
  vga_switcheroo: Add the support for audio clients
  vga_switcheroo: Introduce struct vga_switcheroo_client_ops
  vga_switcheroo: Refactor using linked list
  • Loading branch information
Dave Airlie committed May 13, 2012
2 parents a366e39 + 3e9e63d commit f3b7e17
Show file tree
Hide file tree
Showing 5 changed files with 195 additions and 132 deletions.
11 changes: 7 additions & 4 deletions drivers/gpu/drm/i915/i915_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -1271,6 +1271,12 @@ static bool i915_switcheroo_can_switch(struct pci_dev *pdev)
return can_switch;
}

static const struct vga_switcheroo_client_ops i915_switcheroo_ops = {
.set_gpu_state = i915_switcheroo_set_state,
.reprobe = NULL,
.can_switch = i915_switcheroo_can_switch,
};

static int i915_load_modeset_init(struct drm_device *dev)
{
struct drm_i915_private *dev_priv = dev->dev_private;
Expand All @@ -1293,10 +1299,7 @@ static int i915_load_modeset_init(struct drm_device *dev)

intel_register_dsm_handler();

ret = vga_switcheroo_register_client(dev->pdev,
i915_switcheroo_set_state,
NULL,
i915_switcheroo_can_switch);
ret = vga_switcheroo_register_client(dev->pdev, &i915_switcheroo_ops);
if (ret)
goto cleanup_vga_client;

Expand Down
10 changes: 7 additions & 3 deletions drivers/gpu/drm/nouveau/nouveau_state.c
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,12 @@ nouveau_card_channel_init(struct drm_device *dev)
return ret;
}

static const struct vga_switcheroo_client_ops nouveau_switcheroo_ops = {
.set_gpu_state = nouveau_switcheroo_set_state,
.reprobe = nouveau_switcheroo_reprobe,
.can_switch = nouveau_switcheroo_can_switch,
};

int
nouveau_card_init(struct drm_device *dev)
{
Expand All @@ -670,9 +676,7 @@ nouveau_card_init(struct drm_device *dev)
int ret, e = 0;

vga_client_register(dev->pdev, dev, NULL, nouveau_vga_set_decode);
vga_switcheroo_register_client(dev->pdev, nouveau_switcheroo_set_state,
nouveau_switcheroo_reprobe,
nouveau_switcheroo_can_switch);
vga_switcheroo_register_client(dev->pdev, &nouveau_switcheroo_ops);

/* Initialise internal driver API hooks */
ret = nouveau_init_engine_ptrs(dev);
Expand Down
10 changes: 6 additions & 4 deletions drivers/gpu/drm/radeon/radeon_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,11 @@ static bool radeon_switcheroo_can_switch(struct pci_dev *pdev)
return can_switch;
}

static const struct vga_switcheroo_client_ops radeon_switcheroo_ops = {
.set_gpu_state = radeon_switcheroo_set_state,
.reprobe = NULL,
.can_switch = radeon_switcheroo_can_switch,
};

int radeon_device_init(struct radeon_device *rdev,
struct drm_device *ddev,
Expand Down Expand Up @@ -809,10 +814,7 @@ int radeon_device_init(struct radeon_device *rdev,
/* this will fail for cards that aren't VGA class devices, just
* ignore it */
vga_client_register(rdev->pdev, rdev, NULL, radeon_vga_set_decode);
vga_switcheroo_register_client(rdev->pdev,
radeon_switcheroo_set_state,
NULL,
radeon_switcheroo_can_switch);
vga_switcheroo_register_client(rdev->pdev, &radeon_switcheroo_ops);

r = radeon_init(rdev);
if (r)
Expand Down
Loading

0 comments on commit f3b7e17

Please sign in to comment.