38 psb_pipestat(
int pipe)
50 mid_pipe_event(
int pipe)
62 mid_pipe_vsync(
int pipe)
74 mid_pipeconf(
int pipe)
88 if ((dev_priv->
pipestat[pipe] & mask) != mask) {
89 u32 reg = psb_pipestat(pipe);
94 writeVal |= (mask | (mask >> 16));
105 if ((dev_priv->
pipestat[pipe] & mask) != 0) {
106 u32 reg = psb_pipestat(pipe);
121 u32 pipe_event = mid_pipe_event(pipe);
129 static void mid_disable_pipe_event(
struct drm_psb_private *dev_priv,
int pipe)
131 if (dev_priv->
pipestat[pipe] == 0) {
133 u32 pipe_event = mid_pipe_event(pipe);
146 static void mid_pipe_event_handler(
struct drm_device *
dev,
int pipe)
152 uint32_t pipe_stat_reg = psb_pipestat(pipe);
161 pipe_stat_val &= pipe_enable | pipe_status;
162 pipe_stat_val &= pipe_stat_val >> 16;
168 for (i = 0; i < 0xffff; i++) {
170 pipe_clear =
PSB_RVDC32(pipe_stat_reg) & pipe_status;
178 "%s, can't clear status bits for pipe %d, its value = 0x%x.\n",
197 mid_pipe_event_handler(dev, 0);
200 mid_pipe_event_handler(dev, 1);
207 uint32_t vdc_stat, dsp_int = 0, sgx_int = 0, hotplug_int = 0;
231 psb_vdc_interrupt(dev, vdc_stat);
249 if (hotplug_int && dev_priv->
ops->hotplug) {
250 handled = dev_priv->
ops->hotplug(dev);
268 unsigned long irqflags;
274 if (dev->vblank_enabled[0])
276 if (dev->vblank_enabled[1])
287 if (dev_priv->
ops->hotplug)
293 spin_unlock_irqrestore(&dev_priv->
irqmask_lock, irqflags);
300 unsigned long irqflags;
308 if (dev->vblank_enabled[0])
313 if (dev->vblank_enabled[1])
318 if (dev->vblank_enabled[2])
323 if (dev_priv->
ops->hotplug_enable)
324 dev_priv->
ops->hotplug_enable(dev,
true);
326 spin_unlock_irqrestore(&dev_priv->
irqmask_lock, irqflags);
333 unsigned long irqflags;
337 if (dev_priv->
ops->hotplug_enable)
338 dev_priv->
ops->hotplug_enable(dev,
false);
342 if (dev->vblank_enabled[0])
345 if (dev->vblank_enabled[1])
348 if (dev->vblank_enabled[2])
363 spin_unlock_irqrestore(&dev_priv->
irqmask_lock, irqflags);
403 unsigned long irqflags;
408 mid_enable_pipe_event(dev_priv, 0);
411 spin_unlock_irqrestore(&dev_priv->
irqmask_lock, irqflags);
441 unsigned long irqflags;
445 mid_disable_pipe_event(dev_priv, 0);
448 spin_unlock_irqrestore(&dev_priv->
irqmask_lock, irqflags);
454 static int psb_vblank_do_wait(
struct drm_device *dev,
457 unsigned int cur_vblank;
461 - *sequence) <= (1 << 23)));
462 *sequence = cur_vblank;
474 unsigned long irqflags;
476 uint32_t pipeconf_reg = mid_pipeconf(pipe);
502 spin_unlock_irqrestore(&dev_priv->
irqmask_lock, irqflags);
513 unsigned long irqflags;
528 spin_unlock_irqrestore(&dev_priv->
irqmask_lock, irqflags);
538 unsigned long irqflags;
540 uint32_t pipeconf_reg = mid_pipeconf(pipe);
552 mid_enable_pipe_event(dev_priv, pipe);
555 spin_unlock_irqrestore(&dev_priv->
irqmask_lock, irqflags);
567 unsigned long irqflags;
574 mid_disable_pipe_event(dev_priv, pipe);
577 spin_unlock_irqrestore(&dev_priv->
irqmask_lock, irqflags);
605 dev_err(dev->dev,
"%s, invalid pipe.\n", __func__);
615 dev_err(dev->dev,
"trying to get vblank count for disabled pipe %d\n",
617 goto psb_get_vblank_counter_exit;
632 }
while (high1 != high2);
636 psb_get_vblank_counter_exit: