コード例 #1
0
ファイル: fb.c プロジェクト: Keripo/linux-ipod
static int ipod_blank(int blank_mode, const struct fb_info *info)
{
	static int backlight_on = -1;

	switch (blank_mode) {
	case VESA_NO_BLANKING:
		/* printk(KERN_ERR "VESA_NO_BLANKING\n"); */

		/* start oscillation
		 * wait 10ms
		 * cancel standby
		 * turn on LCD power
		 */
		lcd_cmd_and_data(0x0, 0x0, 0x1);
		udelay(10000);
		lcd_cmd_and_data(0x3, 0x15, 0x0);
		lcd_cmd_and_data(0x3, 0x15, 0xc);

		if (backlight_on != -1) {
			set_backlight(backlight_on);
		}
		backlight_on = -1;
		break;

	case VESA_VSYNC_SUSPEND:
	case VESA_HSYNC_SUSPEND:
		/* printk(KERN_ERR "VESA_XSYNC_BLANKING\n"); */
		if (backlight_on == -1) {
			backlight_on = get_backlight();
			set_backlight(0);
		}

		/* go to SLP = 1 */
		/* 10101 00001100 */
		lcd_cmd_and_data(0x3, 0x15, 0x0);
		lcd_cmd_and_data(0x3, 0x15, 0x2);
		break;

	case VESA_POWERDOWN:
		/* printk(KERN_ERR "VESA_POWERDOWN\n"); */
		if (backlight_on == -1) {
			backlight_on = get_backlight();
			set_backlight(0);
		}

		/* got to standby */
		lcd_cmd_and_data(0x3, 0x15, 0x1);
		break;

	default:
		/* printk(KERN_ERR "unknown blank value %d\n", blank_mode); */
		return -EINVAL;
	}

	return 0;
}
コード例 #2
0
ファイル: statusline.c プロジェクト: sammy8806/statusline
int main() {
    savepoint("==========================");

    char buf_bat[200] = {0};
    char buf_back[200] = {0};
    char buf_net[200] = {0};
    char buf_audio[200] = {0};
    char buf_date[200] = {0};
    char buf_ws[300] = {0};
    savepoint("allocation");

    get_workspace(buf_ws);
    savepoint("workspace");

    get_battery(buf_bat);
    savepoint("battery");

    get_audio(buf_audio);
    savepoint("audio");

    get_date(buf_date);
    savepoint("date");

    if (get_network(buf_net) == 1) {
        get_backlight(buf_back, COLOR_BG_NET);
        savepoint("backlight");

        printf("%%{l}%s %%{r}%s %s %s %s %s%%{F%s}%%{B%s}\n", buf_ws, buf_audio, buf_net, buf_back, buf_bat, buf_date, COLOR_BG, COLOR_BG);
    } else {
        get_backlight(buf_back, COLOR_BG_AUDIO);
        savepoint("backlight");

        printf("%%{F%s}%%{B%s}%%{l}%s%%{F%s}%%{B%s} %%{r}%s %s %s %s%%{F%s}%%{B%s}\n",COLOR_BG, COLOR_BG,  buf_ws, COLOR_BG, COLOR_BG, buf_audio, buf_back, buf_bat, buf_date, COLOR_BG, COLOR_BG);
    }
    savepoint("print");
    savepoint("==========================");
    return 0;
}
コード例 #3
0
ファイル: fb.c プロジェクト: Keripo/linux-ipod
static int ipod_fb_ioctl(struct inode *inode, struct file *file, u_int cmd,
	u_long arg, int con, struct fb_info *info)

{
	int val;

	switch (cmd) {
	case FBIOGET_CONTRAST:
		val = get_contrast();
		if (put_user(val, (int *)arg))
			return -EFAULT;
		break;

	case FBIOPUT_CONTRAST:
		val = (int)arg;
		if (val < IPOD_MIN_CONTRAST || val > IPOD_MAX_CONTRAST)
			return -EINVAL;
		set_contrast(val);
		break;

	case FBIOGET_BACKLIGHT:
		val = get_backlight();
		if (put_user(val, (int *)arg))
			return -EFAULT;
		break;

	case FBIOPUT_BACKLIGHT:
		val = (int)arg;
		set_backlight(val);
		break;

	default:
		return -EINVAL;
	}

	return 0;
}