Beispiel #1
0
static int n8x0_bl_update_status(struct backlight_device *dev)
{
	struct omap_dss_device *dssdev = dev_get_drvdata(&dev->dev);
	struct panel_n8x0_data *bdata = get_board_data(dssdev);
	struct panel_drv_data *ddata = get_drv_data(dssdev);
	int r;
	int level;

	mutex_lock(&ddata->lock);

	if (dev->props.fb_blank == FB_BLANK_UNBLANK &&
			dev->props.power == FB_BLANK_UNBLANK)
		level = dev->props.brightness;
	else
		level = 0;

	dev_dbg(&dssdev->dev, "update brightness to %d\n", level);

	if (!bdata->set_backlight)
		r = -EINVAL;
	else
		r = bdata->set_backlight(dssdev, level);

	mutex_unlock(&ddata->lock);

	return r;
}
Beispiel #2
0
static unmap_t *get_server(read2ch_config_t *conf)
{
	unmap_t *hash = 0;
	unmap_t *board_map = 0;
	un2ch_t *get = un2ch_init();
	unstr_t *bl = 0;
	unstr_t *line = 0;
	unstr_t *server = 0;
	unstr_t *board = 0;
	size_t index = 0;
	
	/* 板一覧の更新確認 */
	un2ch_get_server(get);

	bl = unstr_file_get_contents(get->board_list);
	if(bl == NULL){
		un2ch_free(get);
		perror("板一覧ファイルが無いよ。\n");
	}
	board_map = get_board_data(conf->favolist_path);
	hash = unmap_init();
	server = unstr_init_memory(32);
	board = unstr_init_memory(32);
	while((line = unstr_strtok(bl, "\n", &index)) != NULL){
		if(unstr_sscanf(line, "$/$<>", server, board) == 2){
			switch(conf->type){
			case READ2CH_NORMAL:
				push_board(hash, server, board);
				break;
			case READ2CH_FAVO:
				if(unmap_find(board_map, board->data, unstr_strlen(board)) != NULL){
					push_board(hash, server, board);
				}
				break;
			case READ2CH_NOFAVO:
				if(unmap_find(board_map, board->data, unstr_strlen(board)) == NULL){
					push_board(hash, server, board);
				}
				break;
			}
		}
		unstr_free(line);
	}
	unstr_delete(4, bl, line, server, board);
	unmap_free(board_map, (void (*)(void *))unstr_free_func);
	un2ch_free(get);
	return hash;
}
Beispiel #3
0
static int n8x0_panel_probe(struct omap_dss_device *dssdev)
{
	struct panel_n8x0_data *bdata = get_board_data(dssdev);
	struct panel_drv_data *ddata;
	struct backlight_device *bldev;
	struct backlight_properties props;
	int r;

	dev_dbg(&dssdev->dev, "probe\n");

	if (!bdata)
		return -EINVAL;

	s_drv_data.dssdev = dssdev;

	ddata = &s_drv_data;

	mutex_init(&ddata->lock);

	dssdev->panel.config = OMAP_DSS_LCD_TFT;
	dssdev->panel.timings.x_res = 800;
	dssdev->panel.timings.y_res = 480;
	dssdev->ctrl.pixel_size = 16;
	dssdev->ctrl.rfbi_timings = n8x0_panel_timings;

	memset(&props, 0, sizeof(props));
	props.max_brightness = 127;
	props.type = BACKLIGHT_PLATFORM;
	bldev = backlight_device_register(dev_name(&dssdev->dev), &dssdev->dev,
			dssdev, &n8x0_bl_ops, &props);
	if (IS_ERR(bldev)) {
		r = PTR_ERR(bldev);
		dev_err(&dssdev->dev, "register backlight failed\n");
		return r;
	}

	ddata->bldev = bldev;

	bldev->props.fb_blank = FB_BLANK_UNBLANK;
	bldev->props.power = FB_BLANK_UNBLANK;
	bldev->props.brightness = 127;

	n8x0_bl_update_status(bldev);

	return 0;
}
static void n8x0_panel_power_off(struct omap_dss_device *dssdev)
{
	struct panel_n8x0_data *bdata = get_board_data(dssdev);
	struct panel_drv_data *ddata = get_drv_data(dssdev);
	struct spi_device *spi = ddata->spidev;

	if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
		return;

	send_display_off(spi);
	send_sleep_in(spi);

	if (bdata->platform_disable)
		bdata->platform_disable(dssdev);

	
	gpio_direction_output(bdata->ctrl_pwrdown, 0);
	omapdss_rfbi_display_disable(dssdev);
}
Beispiel #5
0
static void n8x0_panel_power_off(struct omap_dss_device *dssdev)
{
	struct panel_n8x0_data *bdata = get_board_data(dssdev);
	struct panel_drv_data *ddata = get_drv_data(dssdev);
	struct spi_device *spi = ddata->spidev;

	if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
		return;

	send_display_off(spi);
	send_sleep_in(spi);

	if (bdata->platform_disable)
		bdata->platform_disable(dssdev);

	/*
	 * HACK: we should turn off the panel here, but there is some problem
	 * with the initialization sequence, and we fail to init the panel if we
	 * have turned it off
	 */
	/* gpio_direction_output(bdata->panel_reset, 0); */
	gpio_direction_output(bdata->ctrl_pwrdown, 0);
	omapdss_rfbi_display_disable(dssdev);
}
Beispiel #6
0
static int n8x0_panel_power_on(struct omap_dss_device *dssdev)
{
	int r;
	struct panel_n8x0_data *bdata = get_board_data(dssdev);
	struct panel_drv_data *ddata = get_drv_data(dssdev);
	struct spi_device *spi = ddata->spidev;
	u8 rev, conf;
	u8 display_id[3];
	const char *panel_name;

	if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE)
		return 0;

	gpio_direction_output(bdata->ctrl_pwrdown, 1);

	if (bdata->platform_enable) {
		r = bdata->platform_enable(dssdev);
		if (r)
			goto err_plat_en;
	}

	r = omapdss_rfbi_display_enable(dssdev);
	if (r)
		goto err_rfbi_en;

	rev = blizzard_read_reg(BLIZZARD_REV_CODE);
	conf = blizzard_read_reg(BLIZZARD_CONFIG);

	switch (rev & 0xfc) {
	case 0x9c:
		ddata->blizzard_ver = BLIZZARD_VERSION_S1D13744;
		dev_info(&dssdev->dev, "s1d13744 LCD controller rev %d "
			"initialized (CNF pins %x)\n", rev & 0x03, conf & 0x07);
		break;
	case 0xa4:
		ddata->blizzard_ver = BLIZZARD_VERSION_S1D13745;
		dev_info(&dssdev->dev, "s1d13745 LCD controller rev %d "
			"initialized (CNF pins %x)\n", rev & 0x03, conf & 0x07);
		break;
	default:
		dev_err(&dssdev->dev, "invalid s1d1374x revision %02x\n", rev);
		r = -ENODEV;
		goto err_inv_chip;
	}

	/* panel */

	gpio_direction_output(bdata->panel_reset, 1);

	mipid_read(spi, MIPID_CMD_READ_DISP_ID, display_id, 3);
	dev_dbg(&spi->dev, "MIPI display ID: %02x%02x%02x\n",
			display_id[0], display_id[1], display_id[2]);

	switch (display_id[0]) {
	case 0x45:
		panel_name = "lph8923";
		break;
	case 0x83:
		panel_name = "ls041y3";
		break;
	default:
		dev_err(&dssdev->dev, "invalid display ID 0x%x\n",
				display_id[0]);
		r = -ENODEV;
		goto err_inv_panel;
	}

	dev_info(&dssdev->dev, "%s rev %02x LCD detected\n",
			panel_name, display_id[1]);

	send_sleep_out(spi);
	send_init_string(spi);
	set_data_lines(spi, 24);
	send_display_on(spi);

	return 0;

err_inv_panel:
	/*
	 * HACK: we should turn off the panel here, but there is some problem
	 * with the initialization sequence, and we fail to init the panel if we
	 * have turned it off
	 */
	/* gpio_direction_output(bdata->panel_reset, 0); */
err_inv_chip:
	omapdss_rfbi_display_disable(dssdev);
err_rfbi_en:
	if (bdata->platform_disable)
		bdata->platform_disable(dssdev);
err_plat_en:
	gpio_direction_output(bdata->ctrl_pwrdown, 0);
	return r;
}