Lines Matching refs:rdev
56 struct radeon_device *rdev = dev->dev_private; in radeon_driver_irq_handler_kms() local
59 ret = radeon_irq_process(rdev); in radeon_driver_irq_handler_kms()
81 struct radeon_device *rdev = container_of(work, struct radeon_device, in radeon_hotplug_work_func() local
83 struct drm_device *dev = rdev_to_drm(rdev); in radeon_hotplug_work_func()
89 if (!rdev->mode_info.mode_config_initialized) in radeon_hotplug_work_func()
102 struct radeon_device *rdev = container_of(work, struct radeon_device, in radeon_dp_work_func() local
104 struct drm_device *dev = rdev_to_drm(rdev); in radeon_dp_work_func()
124 struct radeon_device *rdev = dev->dev_private; in radeon_driver_irq_preinstall_kms() local
128 spin_lock_irqsave(&rdev->irq.lock, irqflags); in radeon_driver_irq_preinstall_kms()
131 atomic_set(&rdev->irq.ring_int[i], 0); in radeon_driver_irq_preinstall_kms()
132 rdev->irq.dpm_thermal = false; in radeon_driver_irq_preinstall_kms()
134 rdev->irq.hpd[i] = false; in radeon_driver_irq_preinstall_kms()
136 rdev->irq.crtc_vblank_int[i] = false; in radeon_driver_irq_preinstall_kms()
137 atomic_set(&rdev->irq.pflip[i], 0); in radeon_driver_irq_preinstall_kms()
138 rdev->irq.afmt[i] = false; in radeon_driver_irq_preinstall_kms()
140 radeon_irq_set(rdev); in radeon_driver_irq_preinstall_kms()
141 spin_unlock_irqrestore(&rdev->irq.lock, irqflags); in radeon_driver_irq_preinstall_kms()
143 radeon_irq_process(rdev); in radeon_driver_irq_preinstall_kms()
156 struct radeon_device *rdev = dev->dev_private; in radeon_driver_irq_postinstall_kms() local
158 if (ASIC_IS_AVIVO(rdev)) in radeon_driver_irq_postinstall_kms()
175 struct radeon_device *rdev = dev->dev_private; in radeon_driver_irq_uninstall_kms() local
179 if (rdev == NULL) { in radeon_driver_irq_uninstall_kms()
182 spin_lock_irqsave(&rdev->irq.lock, irqflags); in radeon_driver_irq_uninstall_kms()
185 atomic_set(&rdev->irq.ring_int[i], 0); in radeon_driver_irq_uninstall_kms()
186 rdev->irq.dpm_thermal = false; in radeon_driver_irq_uninstall_kms()
188 rdev->irq.hpd[i] = false; in radeon_driver_irq_uninstall_kms()
190 rdev->irq.crtc_vblank_int[i] = false; in radeon_driver_irq_uninstall_kms()
191 atomic_set(&rdev->irq.pflip[i], 0); in radeon_driver_irq_uninstall_kms()
192 rdev->irq.afmt[i] = false; in radeon_driver_irq_uninstall_kms()
194 radeon_irq_set(rdev); in radeon_driver_irq_uninstall_kms()
195 spin_unlock_irqrestore(&rdev->irq.lock, irqflags); in radeon_driver_irq_uninstall_kms()
198 static int radeon_irq_install(struct radeon_device *rdev, int irq) in radeon_irq_install() argument
200 struct drm_device *dev = rdev_to_drm(rdev); in radeon_irq_install()
219 static void radeon_irq_uninstall(struct radeon_device *rdev) in radeon_irq_uninstall() argument
221 struct drm_device *dev = rdev_to_drm(rdev); in radeon_irq_uninstall()
238 static bool radeon_msi_ok(struct radeon_device *rdev) in radeon_msi_ok() argument
241 if (rdev->family < CHIP_RV380) in radeon_msi_ok()
245 if (rdev->flags & RADEON_IS_AGP) in radeon_msi_ok()
253 if (rdev->family < CHIP_BONAIRE) { in radeon_msi_ok()
254 dev_info(rdev->dev, "radeon: MSI limited to 32-bit\n"); in radeon_msi_ok()
255 rdev->pdev->no_64bit_msi = 1; in radeon_msi_ok()
266 if ((rdev->pdev->device == 0x791f) && in radeon_msi_ok()
267 (rdev->pdev->subsystem_vendor == 0x103c) && in radeon_msi_ok()
268 (rdev->pdev->subsystem_device == 0x30c2)) in radeon_msi_ok()
272 if ((rdev->pdev->device == 0x791f) && in radeon_msi_ok()
273 (rdev->pdev->subsystem_vendor == 0x1028) && in radeon_msi_ok()
274 (rdev->pdev->subsystem_device == 0x01fc)) in radeon_msi_ok()
278 if ((rdev->pdev->device == 0x791f) && in radeon_msi_ok()
279 (rdev->pdev->subsystem_vendor == 0x1028) && in radeon_msi_ok()
280 (rdev->pdev->subsystem_device == 0x01fd)) in radeon_msi_ok()
284 if ((rdev->pdev->device == 0x791f) && in radeon_msi_ok()
285 (rdev->pdev->subsystem_vendor == 0x107b) && in radeon_msi_ok()
286 (rdev->pdev->subsystem_device == 0x0185)) in radeon_msi_ok()
290 if (rdev->family == CHIP_RS690) in radeon_msi_ok()
297 if (rdev->family == CHIP_RV515) in radeon_msi_ok()
299 if (rdev->flags & RADEON_IS_IGP) { in radeon_msi_ok()
301 if (rdev->family >= CHIP_PALM) in radeon_msi_ok()
318 int radeon_irq_kms_init(struct radeon_device *rdev) in radeon_irq_kms_init() argument
322 spin_lock_init(&rdev->irq.lock); in radeon_irq_kms_init()
325 rdev_to_drm(rdev)->vblank_disable_immediate = true; in radeon_irq_kms_init()
327 r = drm_vblank_init(rdev_to_drm(rdev), rdev->num_crtc); in radeon_irq_kms_init()
333 rdev->msi_enabled = 0; in radeon_irq_kms_init()
335 if (radeon_msi_ok(rdev)) { in radeon_irq_kms_init()
336 int ret = pci_enable_msi(rdev->pdev); in radeon_irq_kms_init()
338 rdev->msi_enabled = 1; in radeon_irq_kms_init()
339 dev_info(rdev->dev, "radeon: using MSI.\n"); in radeon_irq_kms_init()
343 INIT_DELAYED_WORK(&rdev->hotplug_work, radeon_hotplug_work_func); in radeon_irq_kms_init()
344 INIT_WORK(&rdev->dp_work, radeon_dp_work_func); in radeon_irq_kms_init()
345 INIT_WORK(&rdev->audio_work, r600_audio_update_hdmi); in radeon_irq_kms_init()
347 rdev->irq.installed = true; in radeon_irq_kms_init()
348 r = radeon_irq_install(rdev, rdev->pdev->irq); in radeon_irq_kms_init()
350 rdev->irq.installed = false; in radeon_irq_kms_init()
351 flush_delayed_work(&rdev->hotplug_work); in radeon_irq_kms_init()
366 void radeon_irq_kms_fini(struct radeon_device *rdev) in radeon_irq_kms_fini() argument
368 if (rdev->irq.installed) { in radeon_irq_kms_fini()
369 radeon_irq_uninstall(rdev); in radeon_irq_kms_fini()
370 rdev->irq.installed = false; in radeon_irq_kms_fini()
371 if (rdev->msi_enabled) in radeon_irq_kms_fini()
372 pci_disable_msi(rdev->pdev); in radeon_irq_kms_fini()
373 flush_delayed_work(&rdev->hotplug_work); in radeon_irq_kms_fini()
387 void radeon_irq_kms_sw_irq_get(struct radeon_device *rdev, int ring) in radeon_irq_kms_sw_irq_get() argument
391 if (!rdev->irq.installed) in radeon_irq_kms_sw_irq_get()
394 if (atomic_inc_return(&rdev->irq.ring_int[ring]) == 1) { in radeon_irq_kms_sw_irq_get()
395 spin_lock_irqsave(&rdev->irq.lock, irqflags); in radeon_irq_kms_sw_irq_get()
396 radeon_irq_set(rdev); in radeon_irq_kms_sw_irq_get()
397 spin_unlock_irqrestore(&rdev->irq.lock, irqflags); in radeon_irq_kms_sw_irq_get()
411 bool radeon_irq_kms_sw_irq_get_delayed(struct radeon_device *rdev, int ring) in radeon_irq_kms_sw_irq_get_delayed() argument
413 return atomic_inc_return(&rdev->irq.ring_int[ring]) == 1; in radeon_irq_kms_sw_irq_get_delayed()
426 void radeon_irq_kms_sw_irq_put(struct radeon_device *rdev, int ring) in radeon_irq_kms_sw_irq_put() argument
430 if (!rdev->irq.installed) in radeon_irq_kms_sw_irq_put()
433 if (atomic_dec_and_test(&rdev->irq.ring_int[ring])) { in radeon_irq_kms_sw_irq_put()
434 spin_lock_irqsave(&rdev->irq.lock, irqflags); in radeon_irq_kms_sw_irq_put()
435 radeon_irq_set(rdev); in radeon_irq_kms_sw_irq_put()
436 spin_unlock_irqrestore(&rdev->irq.lock, irqflags); in radeon_irq_kms_sw_irq_put()
449 void radeon_irq_kms_pflip_irq_get(struct radeon_device *rdev, int crtc) in radeon_irq_kms_pflip_irq_get() argument
453 if (crtc < 0 || crtc >= rdev->num_crtc) in radeon_irq_kms_pflip_irq_get()
456 if (!rdev->irq.installed) in radeon_irq_kms_pflip_irq_get()
459 if (atomic_inc_return(&rdev->irq.pflip[crtc]) == 1) { in radeon_irq_kms_pflip_irq_get()
460 spin_lock_irqsave(&rdev->irq.lock, irqflags); in radeon_irq_kms_pflip_irq_get()
461 radeon_irq_set(rdev); in radeon_irq_kms_pflip_irq_get()
462 spin_unlock_irqrestore(&rdev->irq.lock, irqflags); in radeon_irq_kms_pflip_irq_get()
475 void radeon_irq_kms_pflip_irq_put(struct radeon_device *rdev, int crtc) in radeon_irq_kms_pflip_irq_put() argument
479 if (crtc < 0 || crtc >= rdev->num_crtc) in radeon_irq_kms_pflip_irq_put()
482 if (!rdev->irq.installed) in radeon_irq_kms_pflip_irq_put()
485 if (atomic_dec_and_test(&rdev->irq.pflip[crtc])) { in radeon_irq_kms_pflip_irq_put()
486 spin_lock_irqsave(&rdev->irq.lock, irqflags); in radeon_irq_kms_pflip_irq_put()
487 radeon_irq_set(rdev); in radeon_irq_kms_pflip_irq_put()
488 spin_unlock_irqrestore(&rdev->irq.lock, irqflags); in radeon_irq_kms_pflip_irq_put()
500 void radeon_irq_kms_enable_afmt(struct radeon_device *rdev, int block) in radeon_irq_kms_enable_afmt() argument
504 if (!rdev->irq.installed) in radeon_irq_kms_enable_afmt()
507 spin_lock_irqsave(&rdev->irq.lock, irqflags); in radeon_irq_kms_enable_afmt()
508 rdev->irq.afmt[block] = true; in radeon_irq_kms_enable_afmt()
509 radeon_irq_set(rdev); in radeon_irq_kms_enable_afmt()
510 spin_unlock_irqrestore(&rdev->irq.lock, irqflags); in radeon_irq_kms_enable_afmt()
522 void radeon_irq_kms_disable_afmt(struct radeon_device *rdev, int block) in radeon_irq_kms_disable_afmt() argument
526 if (!rdev->irq.installed) in radeon_irq_kms_disable_afmt()
529 spin_lock_irqsave(&rdev->irq.lock, irqflags); in radeon_irq_kms_disable_afmt()
530 rdev->irq.afmt[block] = false; in radeon_irq_kms_disable_afmt()
531 radeon_irq_set(rdev); in radeon_irq_kms_disable_afmt()
532 spin_unlock_irqrestore(&rdev->irq.lock, irqflags); in radeon_irq_kms_disable_afmt()
543 void radeon_irq_kms_enable_hpd(struct radeon_device *rdev, unsigned hpd_mask) in radeon_irq_kms_enable_hpd() argument
548 if (!rdev->irq.installed) in radeon_irq_kms_enable_hpd()
551 spin_lock_irqsave(&rdev->irq.lock, irqflags); in radeon_irq_kms_enable_hpd()
553 rdev->irq.hpd[i] |= !!(hpd_mask & (1 << i)); in radeon_irq_kms_enable_hpd()
554 radeon_irq_set(rdev); in radeon_irq_kms_enable_hpd()
555 spin_unlock_irqrestore(&rdev->irq.lock, irqflags); in radeon_irq_kms_enable_hpd()
566 void radeon_irq_kms_disable_hpd(struct radeon_device *rdev, unsigned hpd_mask) in radeon_irq_kms_disable_hpd() argument
571 if (!rdev->irq.installed) in radeon_irq_kms_disable_hpd()
574 spin_lock_irqsave(&rdev->irq.lock, irqflags); in radeon_irq_kms_disable_hpd()
576 rdev->irq.hpd[i] &= !(hpd_mask & (1 << i)); in radeon_irq_kms_disable_hpd()
577 radeon_irq_set(rdev); in radeon_irq_kms_disable_hpd()
578 spin_unlock_irqrestore(&rdev->irq.lock, irqflags); in radeon_irq_kms_disable_hpd()
598 void radeon_irq_kms_set_irq_n_enabled(struct radeon_device *rdev, in radeon_irq_kms_set_irq_n_enabled() argument