Ejemplo n.º 1
0
/* Hotplug interrupt occurred, read EDID */
static void edid_work_fn(struct work_struct *work)
{
	struct sh_hdmi *hdmi = container_of(work, struct sh_hdmi, edid_work.work);
	struct sh_mobile_hdmi_info *pdata = hdmi->dev->platform_data;

	pr_debug("%s(%p): begin, hotplug status %d\n", __func__,
		 pdata->lcd_dev, hdmi->hp_state);

	if (!pdata->lcd_dev)
		return;

	if (hdmi->hp_state == HDMI_HOTPLUG_EDID_DONE) {
		pm_runtime_get_sync(hdmi->dev);
		/* A device has been plugged in */
		sh_hdmi_read_edid(hdmi);
		msleep(10);
		sh_hdmi_configure(hdmi);
		/* Switched to another (d) power-save mode */
		msleep(10);

		if (!hdmi->info)
			return;

		acquire_console_sem();

		/* HDMI plug in */
		hdmi->info->var = hdmi->var;
		if (hdmi->info->state != FBINFO_STATE_RUNNING)
			fb_set_suspend(hdmi->info, 0);
		else
			hdmi_display_on(hdmi, hdmi->info);

		release_console_sem();
	} else {
		if (!hdmi->info)
			return;

		acquire_console_sem();

		/* HDMI disconnect */
		fb_set_suspend(hdmi->info, 1);

		release_console_sem();
		pm_runtime_put(hdmi->dev);
	}

	pr_debug("%s(%p): end\n", __func__, pdata->lcd_dev);
}
Ejemplo n.º 2
0
static int mxc_elcdif_fb_suspend(struct platform_device *pdev,
			       pm_message_t state)
{
	struct fb_info *fbi = platform_get_drvdata(pdev);
	struct mxc_elcdif_fb_data *data = (struct mxc_elcdif_fb_data *)fbi->par;
	int saved_blank;

	console_lock();
	fb_set_suspend(fbi, 1);
	saved_blank = data->cur_blank;
	mxc_elcdif_fb_blank(FB_BLANK_POWERDOWN, fbi);
	data->next_blank = saved_blank;
	if (!g_elcdif_pix_clk_enable) {
		clk_enable(g_elcdif_pix_clk);
		g_elcdif_pix_clk_enable = true;
	}
	mxc_elcdif_stop();
	mxc_elcdif_dma_release();
	if (g_elcdif_pix_clk_enable) {
		clk_disable(g_elcdif_pix_clk);
		g_elcdif_pix_clk_enable = false;
	}
	if (g_elcdif_axi_clk_enable) {
		clk_disable(g_elcdif_axi_clk);
		g_elcdif_axi_clk_enable = false;
	}
	console_unlock();
	return 0;
}
Ejemplo n.º 3
0
void intel_fbdev_set_suspend(struct drm_device *dev, int state)
{
    drm_i915_private_t *dev_priv = dev->dev_private;
    if (!dev_priv->fbdev)
        return;

    fb_set_suspend(dev_priv->fbdev->helper.fbdev, state);
}
Ejemplo n.º 4
0
void nouveau_fbcon_set_suspend(struct drm_device *dev, int state)
{
	struct drm_nouveau_private *dev_priv = dev->dev_private;
	console_lock();
	if (state == 0)
		nouveau_fbcon_save_disable_accel(dev);
	fb_set_suspend(dev_priv->nfbdev->helper.fbdev, state);
	if (state == 1)
		nouveau_fbcon_restore_accel(dev);
	console_unlock();
}
Ejemplo n.º 5
0
static int mxc_elcdif_fb_resume(struct platform_device *pdev)
{
	struct fb_info *fbi = platform_get_drvdata(pdev);
	struct mxc_elcdif_fb_data *data = (struct mxc_elcdif_fb_data *)fbi->par;

	console_lock();
	mxc_elcdif_fb_blank(data->next_blank, fbi);
	fb_set_suspend(fbi, 0);
	console_unlock();

	return 0;
}
Ejemplo n.º 6
0
Archivo: chipsfb.c Proyecto: 7799/linux
static int chipsfb_pci_resume(struct pci_dev *pdev)
{
        struct fb_info *p = pci_get_drvdata(pdev);

	console_lock();
	fb_set_suspend(p, 0);
	chipsfb_blank(0, p);
	console_unlock();

	pdev->dev.power.power_state = PMSG_ON;
	return 0;
}
Ejemplo n.º 7
0
int radeonfb_pci_suspend(struct pci_dev *pdev, u32 state)
{
        struct fb_info *info = pci_get_drvdata(pdev);
        struct radeonfb_info *rinfo = info->par;

	/* We don't do anything but D2, for now we return 0, but
	 * we may want to change that. How do we know if the BIOS
	 * can properly take care of D3 ? Also, with swsusp, we
	 * know we'll be rebooted, ...
	 */

	printk(KERN_DEBUG "radeonfb: suspending to state: %d...\n", state);
	
	acquire_console_sem();

	/* Userland should do this but doesn't... bridge gets suspended
	 * too late. Unfortunately, that works only when AGP is built-in,
	 * not for a module.
	 */
#ifdef CONFIG_AGP
	agp_enable(0);
#endif

	fb_set_suspend(info, 1);

	if (!radeon_accel_disabled()) {
		/* Make sure engine is reset */
		radeon_engine_idle();
		radeonfb_engine_reset(rinfo);
		radeon_engine_idle();
	}

	/* Blank display and LCD */
	radeonfb_blank(VESA_POWERDOWN+1, info);

	/* Sleep */
	rinfo->asleep = 1;
	rinfo->lock_blank = 1;

	/* Suspend the chip to D2 state when supported
	 */
#ifdef CONFIG_RADEON_HAS_D2
	if (radeon_suspend_to_d2(rinfo, state))
		radeon_set_suspend(rinfo, 1);
#endif /* CONFIG_RADEON_HAS_D2 */

	release_console_sem();

	pdev->dev.power_state = state;

	return 0;
}
Ejemplo n.º 8
0
static void sprdfb_early_suspend (struct early_suspend* es)
{
	struct sprdfb_device *dev = container_of(es, struct sprdfb_device, early_suspend);
	struct fb_info *fb = dev->fb;
	printk("sprdfb: [%s]\n",__FUNCTION__);

	fb_set_suspend(fb, FBINFO_STATE_SUSPENDED);

	if (!lock_fb_info(fb)) {
		return ;
	}
	dev->ctrl->suspend(dev);
	unlock_fb_info(fb);
}
Ejemplo n.º 9
0
static void sprdfb_late_resume (struct early_suspend* es)
{
	struct sprdfb_device *dev = container_of(es, struct sprdfb_device, early_suspend);
	struct fb_info *fb = dev->fb;
	pr_debug("sprdfb: [%s]\n",__FUNCTION__);

	if (!lock_fb_info(fb)) {
		return ;
	}
	dev->ctrl->resume(dev);
	unlock_fb_info(fb);

	fb_set_suspend(fb, FBINFO_STATE_RUNNING);
}
Ejemplo n.º 10
0
static int sprdfb_power(struct sprdfb_device *dev, int on)
{
	static DEFINE_MUTEX(lock);
	struct fb_info *fb = dev->fb;

	mutex_lock(&lock);
	if (dev->enable == !!on) {
		pr_info("[LCD] %s, already %s\n", __func__,
				dev->enable ? "on" : "off");
		mutex_unlock(&lock);
		return 0;
	}

	if (on) {
		dev->ctrl->resume(dev);
		fb_set_suspend(fb, FBINFO_STATE_RUNNING);
	} else {
		fb_set_suspend(fb, FBINFO_STATE_SUSPENDED);
		dev->ctrl->suspend(dev);
	}
	mutex_unlock(&lock);

	return 0;
}
Ejemplo n.º 11
0
static int bochs_pm_suspend(struct device *dev)
{
    struct pci_dev *pdev = to_pci_dev(dev);
    struct drm_device *drm_dev = pci_get_drvdata(pdev);
    struct bochs_device *bochs = drm_dev->dev_private;

    drm_kms_helper_poll_disable(drm_dev);

    if (bochs->fb.initialized) {
        console_lock();
        fb_set_suspend(bochs->fb.helper.fbdev, 1);
        console_unlock();
    }

    return 0;
}
Ejemplo n.º 12
0
static int cirrus_pm_suspend(struct device *dev)
{
	struct pci_dev *pdev = to_pci_dev(dev);
	struct drm_device *drm_dev = pci_get_drvdata(pdev);
	struct cirrus_device *cdev = drm_dev->dev_private;

	drm_kms_helper_poll_disable(drm_dev);

	if (cdev->mode_info.gfbdev) {
		console_lock();
		fb_set_suspend(cdev->mode_info.gfbdev->helper.fbdev, 1);
		console_unlock();
	}

	return 0;
}
Ejemplo n.º 13
0
Archivo: chipsfb.c Proyecto: 7799/linux
static int chipsfb_pci_suspend(struct pci_dev *pdev, pm_message_t state)
{
        struct fb_info *p = pci_get_drvdata(pdev);

	if (state.event == pdev->dev.power.power_state.event)
		return 0;
	if (!(state.event & PM_EVENT_SLEEP))
		goto done;

	console_lock();
	chipsfb_blank(1, p);
	fb_set_suspend(p, 1);
	console_unlock();
 done:
	pdev->dev.power.power_state = state;
	return 0;
}
Ejemplo n.º 14
0
static int chipsfb_pci_suspend(struct pci_dev *pdev, pm_message_t state)
{
        struct fb_info *p = pci_get_drvdata(pdev);

	if (state.event == pdev->dev.power.power_state.event)
		return 0;
	if (state.event != PM_SUSPEND_MEM)
		goto done;

	acquire_console_sem();
	chipsfb_blank(1, p);
	fb_set_suspend(p, 1);
	release_console_sem();
 done:
	pdev->dev.power.power_state = state;
	return 0;
}
Ejemplo n.º 15
0
void intel_fbdev_set_suspend(struct drm_device *dev, int state)
{
	struct drm_i915_private *dev_priv = dev->dev_private;
	struct intel_fbdev *ifbdev = dev_priv->fbdev;
	struct fb_info *info;

	if (!ifbdev)
		return;

	info = ifbdev->helper.fbdev;

	/* On resume from hibernation: If the object is shmemfs backed, it has
	 * been restored from swap. If the object is stolen however, it will be
	 * full of whatever garbage was left in there.
	 */
	if (state == FBINFO_STATE_RUNNING && ifbdev->ifb.obj->stolen)
		memset_io(info->screen_base, 0, info->screen_size);

	fb_set_suspend(info, state);
}
Ejemplo n.º 16
0
static int stmfb_resume(struct platform_device *pdev)
{
  struct stmfb_info *i = (struct stmfb_info *)platform_get_drvdata(pdev);

  DPRINTK("\n");

  if(!i)
    return 0;

  if(pdev->dev.power.power_state.event == PM_EVENT_ON)
    return 0;

  acquire_console_sem();

  if(down_interruptible(&i->framebufferLock))
  {
    release_console_sem();
    return -EINTR;
  }

  if(i->pFBMainOutput)
    stm_display_output_resume(i->pFBMainOutput);

  if(i->pFBDVO)
    stm_display_output_resume(i->pFBDVO);

  up(&i->framebufferLock);

  /*
   * Now the hardware is back, kick the framebuffer into life
   */
  fb_pan_display(&i->info, &i->info.var);
  fb_set_cmap(&i->info.cmap, &i->info);
  fb_set_suspend(&i->info, 0);

  release_console_sem();

  DPRINTK("resumed\n");

  return 0;
}
Ejemplo n.º 17
0
int radeonfb_pci_resume(struct pci_dev *pdev)
{
        struct fb_info *info = pci_get_drvdata(pdev);
        struct radeonfb_info *rinfo = info->par;

	if (pdev->dev.power_state == 0)
		return 0;

	acquire_console_sem();

	/* Wakeup chip */
#ifdef CONFIG_RADEON_HAS_D2
	if (radeon_suspend_to_d2(rinfo, 0))
		radeon_set_suspend(rinfo, 0);
#endif /* CONFIG_RADEON_HAS_D2 */

	rinfo->asleep = 0;

	/* Restore display & engine */
	radeonfb_set_par(info);
	fb_pan_display(info, &info->var);
	fb_set_cmap(&info->cmap, 1, info);

	/* Refresh */
	fb_set_suspend(info, 0);

	/* Unblank */
	rinfo->lock_blank = 0;
	radeonfb_blank(0, info);

	release_console_sem();

	pdev->dev.power_state = 0;

	printk(KERN_DEBUG "radeonfb: resumed !\n");

	return 0;
}
Ejemplo n.º 18
0
static int stmfb_suspend(struct platform_device *pdev, pm_message_t state)
{
  struct stmfb_info *i = (struct stmfb_info *)platform_get_drvdata(pdev);

  DPRINTK("\n");

  if(!i)
    return 0;

  if (state.event == pdev->dev.power.power_state.event)
    return 0;

  acquire_console_sem();

  if(down_interruptible(&i->framebufferLock))
  {
    release_console_sem();
    return -EINTR;
  }

  if(i->pBlitter)
  {
    if(stm_display_blitter_sync(i->pBlitter)<0)
    {
      release_console_sem();
      up(&i->framebufferLock);
      return -EINTR;
    }
  }

  /*
   * Suspend the main output first (there must be one!) which will stop the
   * timing generator, hence any more vsync interrupts.
   */
  if(i->pFBMainOutput)
    stm_display_output_suspend(i->pFBMainOutput);

  if(i->pFBDVO)
    stm_display_output_suspend(i->pFBDVO);

  /*
   * HDMI is different, we need to stop it completely, which will force
   * the display state to NEEDS_RESTART. Once we resume the main output and
   * get a new VSYNC interrupt the ISR will spot this state change and signal
   * the HDMI thread which will look to see if the connected device has changed
   * (i.e. someone plugged in a different TV) while we were suspended and bring
   * the HDMI output back up again (if required at all) in the correct state.
   */
  if(i->hdmi)
    stm_display_output_stop(i->hdmi->hdmi_output);

  /*
   * We release the framebuffer lock here as the fb_set_suspend callbacks
   * might call back into the driver.
   */
  up(&i->framebufferLock);

  fb_set_suspend(&i->info, 1);

  release_console_sem();

  DPRINTK("finished suspending\n");
  return 0;
}
Ejemplo n.º 19
0
void nouveau_fbcon_set_suspend(struct drm_device *dev, int state)
{
	struct drm_nouveau_private *dev_priv = dev->dev_private;
	fb_set_suspend(dev_priv->nfbdev->helper.fbdev, state);
}
Ejemplo n.º 20
0
void radeon_fbdev_set_suspend(struct radeon_device *rdev, int state)
{
	fb_set_suspend(rdev->mode_info.rfbdev->helper.fbdev, state);
}