예제 #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);
}
예제 #2
0
/* Insert the contents of the selection buffer into the
 * queue of the tty associated with the current console.
 * Invoked by ioctl().
 */
int paste_selection(struct tty_struct *tty)
{
	struct vc_data *vc = (struct vc_data *)tty->driver_data;
	int	pasted = 0;
	unsigned int count;
	struct  tty_ldisc *ld;
	DECLARE_WAITQUEUE(wait, current);

	acquire_console_sem();
	poke_blanked_console();
	release_console_sem();

	ld = tty_ldisc_ref_wait(tty);
	
	add_wait_queue(&vc->paste_wait, &wait);
	while (sel_buffer && sel_buffer_lth > pasted) {
		set_current_state(TASK_INTERRUPTIBLE);
		if (test_bit(TTY_THROTTLED, &tty->flags)) {
			schedule();
			continue;
		}
		count = sel_buffer_lth - pasted;
		count = min(count, tty->receive_room);
		tty->ldisc.receive_buf(tty, sel_buffer + pasted, NULL, count);
		pasted += count;
	}
	remove_wait_queue(&vc->paste_wait, &wait);
	current->state = TASK_RUNNING;

	tty_ldisc_deref(ld);
	return 0;
}
예제 #3
0
int unregister_console(struct console *console)
{
        struct console *a, *b;
	int res = 1;

#ifdef CONFIG_A11Y_BRAILLE_CONSOLE
	if (console->flags & CON_BRL)
		return braille_unregister_console(console);
#endif

	acquire_console_sem();
	if (console_drivers == console) {
		console_drivers=console->next;
		res = 0;
	} else if (console_drivers) {
		for (a=console_drivers->next, b=console_drivers ;
		     a; b=a, a=b->next) {
			if (a == console) {
				b->next = a->next;
				res = 0;
				break;
			}
		}
	}

	/*
	 * If this isn't the last console and it has CON_CONSDEV set, we
	 * need to set it on the next preferred console.
	 */
	if (console_drivers != NULL && console->flags & CON_CONSDEV)
		console_drivers->flags |= CON_CONSDEV;

	release_console_sem();
	return res;
}
예제 #4
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;

	acquire_console_sem();
	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;
	}
	release_console_sem();
	return 0;
}
예제 #5
0
static void OMAPLFBDeInitFBDev(OMAPLFB_DEVINFO *psDevInfo)
{
	struct fb_info *psLINFBInfo = psDevInfo->psLINFBInfo;
	struct module *psLINFBOwner;

	#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
		console_lock();	
	#else
		acquire_console_sem();
	#endif 

	psLINFBOwner = psLINFBInfo->fbops->owner;

	if (psLINFBInfo->fbops->fb_release != NULL) 
	{
		(void) psLINFBInfo->fbops->fb_release(psLINFBInfo, 0);
	}

	module_put(psLINFBOwner);
	
	#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
                console_unlock();
        #else
                release_console_sem();
        #endif
}
예제 #6
0
static void console_early_suspend(struct early_suspend *h)
{
#ifdef CONFIG_SHLCDC_BOARD
	char ev[128];
#endif
	acquire_console_sem();
	orig_fgconsole = fg_console;
	if (vc_allocate(EARLY_SUSPEND_CONSOLE))
		goto err;
	if (set_console(EARLY_SUSPEND_CONSOLE))
		goto err;
#ifdef CONFIG_SHLCDC_BOARD
	vt_waitactive_queue((void *)ev);
#endif
	release_console_sem();

#ifdef CONFIG_SHLCDC_BOARD
	if (vt_waitactive_wait_dequeue((void *)ev, EARLY_SUSPEND_CONSOLE + 1))
#else
	if (vt_waitactive(EARLY_SUSPEND_CONSOLE + 1))
#endif
		pr_warning("console_early_suspend: Can't switch VCs.\n");
	return;
err:
	pr_warning("console_early_suspend: Can't set console\n");
	release_console_sem();
}
예제 #7
0
void __pmac register_backlight_controller(struct backlight_controller *ctrler,
					  void *data, char *type)
{
	struct device_node* bk_node;
	char *prop;
	int valid = 0;

	/* There's already a matching controller, bail out */
	if (backlighter != NULL)
		return;

	bk_node = find_devices("backlight");

#ifdef CONFIG_ADB_PMU
	/* Special case for the old PowerBook since I can't test on it */
	backlight_autosave = machine_is_compatible("AAPL,3400/2400")
		|| machine_is_compatible("AAPL,3500");
	if ((backlight_autosave
	     || machine_is_compatible("AAPL,PowerBook1998")
	     || machine_is_compatible("PowerBook1,1"))
	    && !strcmp(type, "pmu"))
		valid = 1;
#endif
	if (bk_node) {
		prop = get_property(bk_node, "backlight-control", NULL);
		if (prop && !strncmp(prop, type, strlen(type)))
			valid = 1;
	}
	if (!valid)
		return;
	backlighter = ctrler;
	backlighter_data = data;

	if (bk_node && !backlight_autosave)
		prop = get_property(bk_node, "bklt", NULL);
	else
		prop = NULL;
	if (prop) {
		backlight_level = ((*prop)+1) >> 1;
		if (backlight_level > BACKLIGHT_MAX)
			backlight_level = BACKLIGHT_MAX;
	}

#ifdef CONFIG_ADB_PMU
	if (backlight_autosave) {
		struct adb_request req;
		pmu_request(&req, NULL, 2, 0xd9, 0);
		while (!req.complete)
			pmu_poll();
		backlight_level = req.reply[0] >> 4;
	}
#endif
	acquire_console_sem();
	if (!backlighter->set_enable(1, backlight_level, data))
		backlight_enabled = 1;
	release_console_sem();

	printk(KERN_INFO "Registered \"%s\" backlight controller,"
	       "level: %d/15\n", type, backlight_level);
}
예제 #8
0
static void console_late_resume(struct early_suspend *h)
{
	int ret;
#ifdef CONFIG_SHLCDC_BOARD
	char ev[128];
#endif
	acquire_console_sem();
	ret = set_console(orig_fgconsole);
#ifdef CONFIG_SHLCDC_BOARD
	if (!ret)
		vt_waitactive_queue((void *)ev);
#endif
	release_console_sem();
	if (ret) {
		pr_warning("console_late_resume: Can't set console.\n");
		return;
	}

#ifdef CONFIG_SHLCDC_BOARD
	if (vt_waitactive_wait_dequeue((void *)ev, orig_fgconsole + 1))
#else
	if (vt_waitactive(orig_fgconsole + 1))
#endif
		pr_warning("console_late_resume: Can't switch VCs.\n");
}
예제 #9
0
int unregister_console(struct console * console)
{
        struct console *a,*b;
	int res = 1;

	acquire_console_sem();
	if (console_drivers == console) {
		console_drivers=console->next;
		res = 0;
	} else {
		for (a=console_drivers->next, b=console_drivers ;
		     a; b=a, a=b->next) {
			if (a == console) {
				b->next = a->next;
				res = 0;
				break;
			}  
		}
	}
	
	/* If last console is removed, we re-enable picking the first
	 * one that gets registered. Without that, pmac early boot console
	 * would prevent fbcon from taking over.
	 */
	if (console_drivers == NULL)
		preferred_console = selected_console;
		

	release_console_sem();
	return res;
}
예제 #10
0
static int i915_drm_freeze(struct drm_device *dev)
{
	struct drm_i915_private *dev_priv = dev->dev_private;

	drm_kms_helper_poll_disable(dev);

	pci_save_state(dev->pdev);

	/* If KMS is active, we do the leavevt stuff here */
	if (drm_core_check_feature(dev, DRIVER_MODESET)) {
		int error = i915_gem_idle(dev);
		if (error) {
			dev_err(&dev->pdev->dev,
				"GEM idle failed, resume might fail\n");
			return error;
		}
		drm_irq_uninstall(dev);
	}

	i915_save_state(dev);

	intel_opregion_fini(dev);

	/* Modeset on resume, not lid events */
	dev_priv->modeset_on_lid = 0;

	acquire_console_sem();
	intel_fbdev_set_suspend(dev, 1);
	release_console_sem();

	return 0;
}
int unregister_console(struct console *console)
{
        struct console *a, *b;
	int res = 1;

	acquire_console_sem();
	if (console_drivers == console) {
		console_drivers=console->next;
		res = 0;
	} else if (console_drivers) {
		for (a=console_drivers->next, b=console_drivers ;
		     a; b=a, a=b->next) {
			if (a == console) {
				b->next = a->next;
				res = 0;
				break;
			}
		}
	}

	/* If last console is removed, we re-enable picking the first
	 * one that gets registered. Without that, pmac early boot console
	 * would prevent fbcon from taking over.
	 *
	 * If this isn't the last console and it has CON_CONSDEV set, we
	 * need to set it on the next preferred console.
	 */
	if (console_drivers == NULL)
		preferred_console = selected_console;
	else if (console->flags & CON_CONSDEV)
		console_drivers->flags |= CON_CONSDEV;

	release_console_sem();
	return res;
}
예제 #12
0
파일: selection.c 프로젝트: wxlong/Test
/* Insert the contents of the selection buffer into the
 * queue of the tty associated with the current console.
 * Invoked by ioctl().
 */
int paste_selection(struct tty_struct *tty)
{
	struct vt_struct *vt = (struct vt_struct *) tty->driver_data;
	int	pasted = 0, count;
	DECLARE_WAITQUEUE(wait, current);

	acquire_console_sem();
	poke_blanked_console();
	release_console_sem();

	add_wait_queue(&vt->paste_wait, &wait);
	while (sel_buffer && sel_buffer_lth > pasted) {
		set_current_state(TASK_INTERRUPTIBLE);
		if (test_bit(TTY_THROTTLED, &tty->flags)) {
			schedule();
			continue;
		}
		count = sel_buffer_lth - pasted;
		count = MIN(count, tty->ldisc.receive_room(tty));
		tty->ldisc.receive_buf(tty, sel_buffer + pasted, 0, count);
		pasted += count;
	}
	remove_wait_queue(&vt->paste_wait, &wait);
	current->state = TASK_RUNNING;
	return 0;
}
예제 #13
0
int pm_prepare_console(void)
{
	orig_loglevel = console_loglevel;
	console_loglevel = new_loglevel;

#ifdef SUSPEND_CONSOLE
	acquire_console_sem();

	orig_fgconsole = fg_console;

	if (vc_allocate(SUSPEND_CONSOLE)) {
	  /* we can't have a free VC for now. Too bad,
	   * we don't want to mess the screen for now. */
		release_console_sem();
		return 1;
	}

	set_console(SUSPEND_CONSOLE);
	release_console_sem();

	if (vt_waitactive(SUSPEND_CONSOLE)) {
		pr_debug("Suspend: Can't switch VCs.");
		return 1;
	}
	orig_kmsg = kmsg_redirect;
	kmsg_redirect = SUSPEND_CONSOLE;
#endif
	return 0;
}
예제 #14
0
/**
 * suspend_console - suspend the console subsystem
 *
 * This disables printk() while we go into suspend states
 */
void suspend_console(void)
{
	if (!console_suspend_enabled)
		return;
	printk("Suspending console(s) (use no_console_suspend to debug)\n");
	acquire_console_sem();
	console_suspended = 1;
}
예제 #15
0
/**
 * suspend_console - suspend the console subsystem
 *
 * This disables printk() while we go into suspend states
 */
void suspend_console(void)
{
	if (!console_suspend_enabled)
		return;
	//printk("Suspending console(s)\n");
	acquire_console_sem();

	console_suspended = 1;
}
예제 #16
0
void console_unblank(void)
{
	struct console *c;

	acquire_console_sem();
	for (c = console_drivers; c != NULL; c = c->next)
		if ((c->flags & CON_ENABLED) && c->unblank)
			c->unblank();
	release_console_sem();
}
예제 #17
0
void pm_restore_console(void)
{
	console_loglevel = orig_loglevel;
#ifdef SUSPEND_CONSOLE
	acquire_console_sem();
	set_console(orig_fgconsole);
	release_console_sem();
	kmsg_redirect = orig_kmsg;
#endif
	return;
}
예제 #18
0
파일: console.c 프로젝트: 274914765/C
void pm_restore_console(void)
{
    acquire_console_sem();
    if (disable_vt_switch) {
        release_console_sem();
        return;
    }
    set_console(orig_fgconsole);
    release_console_sem();
    kmsg_redirect = orig_kmsg;
}
예제 #19
0
static int chipsfb_pci_resume(struct pci_dev *pdev)
{
    struct fb_info *p = pci_get_drvdata(pdev);

    acquire_console_sem();
    fb_set_suspend(p, 0);
    chipsfb_blank(0, p);
    release_console_sem();

    pdev->dev.power.power_state = PMSG_ON;
    return 0;
}
예제 #20
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;

	acquire_console_sem();
	mxc_elcdif_fb_blank(data->next_blank, fbi);
	fb_set_suspend(fbi, 0);
	release_console_sem();

	return 0;
}
예제 #21
0
파일: radeon_pm.c 프로젝트: wxlong/Test
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;
}
static void console_late_resume(struct early_suspend *h)
{
	int ret;
	acquire_console_sem();
	ret = set_console(orig_fgconsole);
	release_console_sem();
	if (ret) {
		pr_warning("console_late_resume: Can't set console.\n");
		return;
	}

	if (vt_waitactive(orig_fgconsole + 1))
		pr_warning("console_late_resume: Can't switch VCs.\n");
}
예제 #23
0
static int __pmac __set_backlight_enable(int enable)
{
	int rc;

	if (!backlighter)
		return -ENODEV;
	acquire_console_sem();
	rc = backlighter->set_enable(enable, backlight_level,
				     backlighter_data);
	if (!rc)
		backlight_enabled = enable;
	release_console_sem();
	return rc;
}
예제 #24
0
파일: gta02-pm-gsm.c 프로젝트: 7LK/McWRT
static struct console *find_s3c24xx_console(void)
{
	struct console *con;

	acquire_console_sem();

	for (con = console_drivers; con; con = con->next) {
		if (!strcmp(con->name, "ttySAC"))
			break;
	}

	release_console_sem();

	return con;
}
예제 #25
0
MTKLFB_ERROR MTKLFBUnblankDisplay(MTKLFB_DEVINFO *psDevInfo)
{
	int res;

	acquire_console_sem();
	res = fb_blank(psDevInfo->psLINFBInfo, 0);
	release_console_sem();
	if (res != 0 && res != -EINVAL)
	{
		printk(KERN_WARNING DRIVER_PREFIX
			": %s: Device %u: fb_blank failed (%d)\n", __FUNCTION__, psDevInfo->uiFBDevID, res);
		return (MTKLFB_ERROR_GENERIC);
	}

	return (MTKLFB_OK);
}
예제 #26
0
/*
 * Return the console tty driver structure and its associated index
 */
struct tty_driver *console_device(int *index)
{
	struct console *c;
	struct tty_driver *driver = NULL;

	acquire_console_sem();
	for (c = console_drivers; c != NULL; c = c->next) {
		if (!c->device)
			continue;
		driver = c->device(c, index);
		if (driver)
			break;
	}
	release_console_sem();
	return driver;
}
static OMAP_ERROR UnblankDisplay(OMAPLFB_DEVINFO *psDevInfo)
{
	int res;

	acquire_console_sem();
	res = fb_blank(psDevInfo->psLINFBInfo, 0);
	release_console_sem();
	if (res != 0)
	{
		printk(KERN_WARNING DRIVER_PREFIX
			": fb_blank failed (%d)", res);
		return (OMAP_ERROR_GENERIC);
	}

	return (OMAP_OK);
}
static S3C_BOOL InitDev(struct fb_info **s3c_fb_Info)
{
	struct fb_info *psLINFBInfo;
	struct module *psLINFBOwner;
	S3C_BOOL eError = S3C_TRUE;
	
	acquire_console_sem();

	if (fb_idx < 0 || fb_idx >= num_registered_fb)
	{
		eError = S3C_FALSE;
		goto errRelSem;
	}

	psLINFBInfo = registered_fb[fb_idx];

	psLINFBOwner = psLINFBInfo->fbops->owner;
	if (!try_module_get(psLINFBOwner))
	{
		printk("Couldn't get framebuffer module\n");
		eError = S3C_FALSE;
		goto errRelSem;
	}

	if (psLINFBInfo->fbops->fb_open != NULL)
	{
		int res;

		res = psLINFBInfo->fbops->fb_open(psLINFBInfo, 0);
		if (res != 0)
		{
			printk("Couldn't open framebuffer: %d\n", res);
			eError = S3C_FALSE;
			goto errModPut;
		}
	}

	*s3c_fb_Info = psLINFBInfo;

errModPut:
	module_put(psLINFBOwner);
errRelSem:
	release_console_sem();

	return eError;
}
예제 #29
0
static void lcd_init_fb(struct fb_info *info)
{
	struct fb_var_screeninfo var;

	memset(&var, 0, sizeof(var));

	fb_videomode_to_var(&var, &video_modes[0]);

	var.activate = FB_ACTIVATE_ALL;
	var.yres_virtual = var.yres * 3;

	acquire_console_sem();
	info->flags |= FBINFO_MISC_USEREVENT;
	fb_set_var(info, &var);
	info->flags &= ~FBINFO_MISC_USEREVENT;
	release_console_sem();
}
예제 #30
0
void pm_restore_console(void)
{
	acquire_console_sem();
	if (disable_vt_switch) {
		release_console_sem();
		return;
	}
	set_console(orig_fgconsole);
	release_console_sem();

	if (vt_waitactive(orig_fgconsole)) {
		pr_debug("Resume: Can't switch VCs.");
		return;
	}

	kmsg_redirect = orig_kmsg;
}