Lines Matching refs:rdev

57 	struct radeon_device *rdev = dev->dev_private;  in radeon_driver_irq_handler_kms()  local
60 ret = radeon_irq_process(rdev); in radeon_driver_irq_handler_kms()
82 struct radeon_device *rdev = container_of(work, struct radeon_device, in radeon_hotplug_work_func() local
84 struct drm_device *dev = rdev->ddev; in radeon_hotplug_work_func()
90 if (!rdev->mode_info.mode_config_initialized) in radeon_hotplug_work_func()
115 struct radeon_device *rdev = dev->dev_private; in radeon_driver_irq_preinstall_kms() local
119 spin_lock_irqsave(&rdev->irq.lock, irqflags); in radeon_driver_irq_preinstall_kms()
122 atomic_set(&rdev->irq.ring_int[i], 0); in radeon_driver_irq_preinstall_kms()
123 rdev->irq.dpm_thermal = false; in radeon_driver_irq_preinstall_kms()
125 rdev->irq.hpd[i] = false; in radeon_driver_irq_preinstall_kms()
127 rdev->irq.crtc_vblank_int[i] = false; in radeon_driver_irq_preinstall_kms()
128 atomic_set(&rdev->irq.pflip[i], 0); in radeon_driver_irq_preinstall_kms()
129 rdev->irq.afmt[i] = false; in radeon_driver_irq_preinstall_kms()
131 radeon_irq_set(rdev); in radeon_driver_irq_preinstall_kms()
132 spin_unlock_irqrestore(&rdev->irq.lock, irqflags); in radeon_driver_irq_preinstall_kms()
134 radeon_irq_process(rdev); in radeon_driver_irq_preinstall_kms()
147 struct radeon_device *rdev = dev->dev_private; in radeon_driver_irq_postinstall_kms() local
149 if (ASIC_IS_AVIVO(rdev)) in radeon_driver_irq_postinstall_kms()
166 struct radeon_device *rdev = dev->dev_private; in radeon_driver_irq_uninstall_kms() local
170 if (rdev == NULL) { in radeon_driver_irq_uninstall_kms()
173 spin_lock_irqsave(&rdev->irq.lock, irqflags); in radeon_driver_irq_uninstall_kms()
176 atomic_set(&rdev->irq.ring_int[i], 0); in radeon_driver_irq_uninstall_kms()
177 rdev->irq.dpm_thermal = false; in radeon_driver_irq_uninstall_kms()
179 rdev->irq.hpd[i] = false; in radeon_driver_irq_uninstall_kms()
181 rdev->irq.crtc_vblank_int[i] = false; in radeon_driver_irq_uninstall_kms()
182 atomic_set(&rdev->irq.pflip[i], 0); in radeon_driver_irq_uninstall_kms()
183 rdev->irq.afmt[i] = false; in radeon_driver_irq_uninstall_kms()
185 radeon_irq_set(rdev); in radeon_driver_irq_uninstall_kms()
186 spin_unlock_irqrestore(&rdev->irq.lock, irqflags); in radeon_driver_irq_uninstall_kms()
189 static int radeon_irq_install(struct radeon_device *rdev, int irq) in radeon_irq_install() argument
191 struct drm_device *dev = rdev->ddev; in radeon_irq_install()
210 static void radeon_irq_uninstall(struct radeon_device *rdev) in radeon_irq_uninstall() argument
212 struct drm_device *dev = rdev->ddev; in radeon_irq_uninstall()
229 static bool radeon_msi_ok(struct radeon_device *rdev) in radeon_msi_ok() argument
232 if (rdev->family < CHIP_RV380) in radeon_msi_ok()
236 if (rdev->flags & RADEON_IS_AGP) in radeon_msi_ok()
244 if (rdev->family < CHIP_BONAIRE) { in radeon_msi_ok()
245 dev_info(rdev->dev, "radeon: MSI limited to 32-bit\n"); in radeon_msi_ok()
246 rdev->pdev->no_64bit_msi = 1; in radeon_msi_ok()
257 if ((rdev->pdev->device == 0x791f) && in radeon_msi_ok()
258 (rdev->pdev->subsystem_vendor == 0x103c) && in radeon_msi_ok()
259 (rdev->pdev->subsystem_device == 0x30c2)) in radeon_msi_ok()
263 if ((rdev->pdev->device == 0x791f) && in radeon_msi_ok()
264 (rdev->pdev->subsystem_vendor == 0x1028) && in radeon_msi_ok()
265 (rdev->pdev->subsystem_device == 0x01fc)) in radeon_msi_ok()
269 if ((rdev->pdev->device == 0x791f) && in radeon_msi_ok()
270 (rdev->pdev->subsystem_vendor == 0x1028) && in radeon_msi_ok()
271 (rdev->pdev->subsystem_device == 0x01fd)) in radeon_msi_ok()
275 if ((rdev->pdev->device == 0x791f) && in radeon_msi_ok()
276 (rdev->pdev->subsystem_vendor == 0x107b) && in radeon_msi_ok()
277 (rdev->pdev->subsystem_device == 0x0185)) in radeon_msi_ok()
281 if (rdev->family == CHIP_RS690) in radeon_msi_ok()
288 if (rdev->family == CHIP_RV515) in radeon_msi_ok()
290 if (rdev->flags & RADEON_IS_IGP) { in radeon_msi_ok()
292 if (rdev->family >= CHIP_PALM) in radeon_msi_ok()
309 int radeon_irq_kms_init(struct radeon_device *rdev) in radeon_irq_kms_init() argument
313 spin_lock_init(&rdev->irq.lock); in radeon_irq_kms_init()
316 rdev->ddev->vblank_disable_immediate = true; in radeon_irq_kms_init()
318 r = drm_vblank_init(rdev->ddev, rdev->num_crtc); in radeon_irq_kms_init()
324 rdev->msi_enabled = 0; in radeon_irq_kms_init()
326 if (radeon_msi_ok(rdev)) { in radeon_irq_kms_init()
327 int ret = pci_enable_msi(rdev->pdev); in radeon_irq_kms_init()
329 rdev->msi_enabled = 1; in radeon_irq_kms_init()
330 dev_info(rdev->dev, "radeon: using MSI.\n"); in radeon_irq_kms_init()
334 INIT_DELAYED_WORK(&rdev->hotplug_work, radeon_hotplug_work_func); in radeon_irq_kms_init()
335 INIT_WORK(&rdev->dp_work, radeon_dp_work_func); in radeon_irq_kms_init()
336 INIT_WORK(&rdev->audio_work, r600_audio_update_hdmi); in radeon_irq_kms_init()
338 rdev->irq.installed = true; in radeon_irq_kms_init()
339 r = radeon_irq_install(rdev, rdev->pdev->irq); in radeon_irq_kms_init()
341 rdev->irq.installed = false; in radeon_irq_kms_init()
342 flush_delayed_work(&rdev->hotplug_work); in radeon_irq_kms_init()
357 void radeon_irq_kms_fini(struct radeon_device *rdev) in radeon_irq_kms_fini() argument
359 if (rdev->irq.installed) { in radeon_irq_kms_fini()
360 radeon_irq_uninstall(rdev); in radeon_irq_kms_fini()
361 rdev->irq.installed = false; in radeon_irq_kms_fini()
362 if (rdev->msi_enabled) in radeon_irq_kms_fini()
363 pci_disable_msi(rdev->pdev); in radeon_irq_kms_fini()
364 flush_delayed_work(&rdev->hotplug_work); in radeon_irq_kms_fini()
378 void radeon_irq_kms_sw_irq_get(struct radeon_device *rdev, int ring) in radeon_irq_kms_sw_irq_get() argument
382 if (!rdev->irq.installed) in radeon_irq_kms_sw_irq_get()
385 if (atomic_inc_return(&rdev->irq.ring_int[ring]) == 1) { in radeon_irq_kms_sw_irq_get()
386 spin_lock_irqsave(&rdev->irq.lock, irqflags); in radeon_irq_kms_sw_irq_get()
387 radeon_irq_set(rdev); in radeon_irq_kms_sw_irq_get()
388 spin_unlock_irqrestore(&rdev->irq.lock, irqflags); in radeon_irq_kms_sw_irq_get()
402 bool radeon_irq_kms_sw_irq_get_delayed(struct radeon_device *rdev, int ring) in radeon_irq_kms_sw_irq_get_delayed() argument
404 return atomic_inc_return(&rdev->irq.ring_int[ring]) == 1; in radeon_irq_kms_sw_irq_get_delayed()
417 void radeon_irq_kms_sw_irq_put(struct radeon_device *rdev, int ring) in radeon_irq_kms_sw_irq_put() argument
421 if (!rdev->irq.installed) in radeon_irq_kms_sw_irq_put()
424 if (atomic_dec_and_test(&rdev->irq.ring_int[ring])) { in radeon_irq_kms_sw_irq_put()
425 spin_lock_irqsave(&rdev->irq.lock, irqflags); in radeon_irq_kms_sw_irq_put()
426 radeon_irq_set(rdev); in radeon_irq_kms_sw_irq_put()
427 spin_unlock_irqrestore(&rdev->irq.lock, irqflags); in radeon_irq_kms_sw_irq_put()
440 void radeon_irq_kms_pflip_irq_get(struct radeon_device *rdev, int crtc) in radeon_irq_kms_pflip_irq_get() argument
444 if (crtc < 0 || crtc >= rdev->num_crtc) in radeon_irq_kms_pflip_irq_get()
447 if (!rdev->irq.installed) in radeon_irq_kms_pflip_irq_get()
450 if (atomic_inc_return(&rdev->irq.pflip[crtc]) == 1) { in radeon_irq_kms_pflip_irq_get()
451 spin_lock_irqsave(&rdev->irq.lock, irqflags); in radeon_irq_kms_pflip_irq_get()
452 radeon_irq_set(rdev); in radeon_irq_kms_pflip_irq_get()
453 spin_unlock_irqrestore(&rdev->irq.lock, irqflags); in radeon_irq_kms_pflip_irq_get()
466 void radeon_irq_kms_pflip_irq_put(struct radeon_device *rdev, int crtc) in radeon_irq_kms_pflip_irq_put() argument
470 if (crtc < 0 || crtc >= rdev->num_crtc) in radeon_irq_kms_pflip_irq_put()
473 if (!rdev->irq.installed) in radeon_irq_kms_pflip_irq_put()
476 if (atomic_dec_and_test(&rdev->irq.pflip[crtc])) { in radeon_irq_kms_pflip_irq_put()
477 spin_lock_irqsave(&rdev->irq.lock, irqflags); in radeon_irq_kms_pflip_irq_put()
478 radeon_irq_set(rdev); in radeon_irq_kms_pflip_irq_put()
479 spin_unlock_irqrestore(&rdev->irq.lock, irqflags); in radeon_irq_kms_pflip_irq_put()
491 void radeon_irq_kms_enable_afmt(struct radeon_device *rdev, int block) in radeon_irq_kms_enable_afmt() argument
495 if (!rdev->irq.installed) in radeon_irq_kms_enable_afmt()
498 spin_lock_irqsave(&rdev->irq.lock, irqflags); in radeon_irq_kms_enable_afmt()
499 rdev->irq.afmt[block] = true; in radeon_irq_kms_enable_afmt()
500 radeon_irq_set(rdev); in radeon_irq_kms_enable_afmt()
501 spin_unlock_irqrestore(&rdev->irq.lock, irqflags); in radeon_irq_kms_enable_afmt()
513 void radeon_irq_kms_disable_afmt(struct radeon_device *rdev, int block) in radeon_irq_kms_disable_afmt() argument
517 if (!rdev->irq.installed) in radeon_irq_kms_disable_afmt()
520 spin_lock_irqsave(&rdev->irq.lock, irqflags); in radeon_irq_kms_disable_afmt()
521 rdev->irq.afmt[block] = false; in radeon_irq_kms_disable_afmt()
522 radeon_irq_set(rdev); in radeon_irq_kms_disable_afmt()
523 spin_unlock_irqrestore(&rdev->irq.lock, irqflags); in radeon_irq_kms_disable_afmt()
534 void radeon_irq_kms_enable_hpd(struct radeon_device *rdev, unsigned hpd_mask) in radeon_irq_kms_enable_hpd() argument
539 if (!rdev->irq.installed) in radeon_irq_kms_enable_hpd()
542 spin_lock_irqsave(&rdev->irq.lock, irqflags); in radeon_irq_kms_enable_hpd()
544 rdev->irq.hpd[i] |= !!(hpd_mask & (1 << i)); in radeon_irq_kms_enable_hpd()
545 radeon_irq_set(rdev); in radeon_irq_kms_enable_hpd()
546 spin_unlock_irqrestore(&rdev->irq.lock, irqflags); in radeon_irq_kms_enable_hpd()
557 void radeon_irq_kms_disable_hpd(struct radeon_device *rdev, unsigned hpd_mask) in radeon_irq_kms_disable_hpd() argument
562 if (!rdev->irq.installed) in radeon_irq_kms_disable_hpd()
565 spin_lock_irqsave(&rdev->irq.lock, irqflags); in radeon_irq_kms_disable_hpd()
567 rdev->irq.hpd[i] &= !(hpd_mask & (1 << i)); in radeon_irq_kms_disable_hpd()
568 radeon_irq_set(rdev); in radeon_irq_kms_disable_hpd()
569 spin_unlock_irqrestore(&rdev->irq.lock, irqflags); in radeon_irq_kms_disable_hpd()
589 void radeon_irq_kms_set_irq_n_enabled(struct radeon_device *rdev, in radeon_irq_kms_set_irq_n_enabled() argument