Exemple #1
0
static void ch7025_early_resume(struct early_suspend *h)
{
	DBG("ch7025 exit early resume");
	if( ch7025.cvbs && (ch7025.mode < TVOUT_YPbPr_720x480p_60) ) {
		rk_display_device_enable((ch7025.cvbs)->ddev);
	}
	else if( ch7025.ypbpr && (ch7025.mode > TVOUT_CVBS_PAL) ) {
		rk_display_device_enable((ch7025.ypbpr)->ddev);
	}
	return;
}
void lcd_register_display_sysfs(void *devdata)
{
	INIT_LIST_HEAD(&lcd_modelist);
	fb_add_videomode(&rk29_lcd_mode, &lcd_modelist);
	display_device_lcd = rk_display_device_register(&display_lcd, NULL, devdata);
	rk_display_device_enable(display_device_lcd);
}
int rk1000_register_display_cvbs(struct device *parent)
{
	int i;
	
	memset(&cvbs_monspecs, 0, sizeof(struct rk1000_monspecs));
	INIT_LIST_HEAD(&cvbs_monspecs.modelist);
	for(i = 0; i < ARRAY_SIZE(rk1000_cvbs_mode); i++)
		fb_add_videomode(&rk1000_cvbs_mode[i], &cvbs_monspecs.modelist);
	if(rk1000.mode < TVOUT_YPbPr_720x480p_60) {
		cvbs_monspecs.mode = (struct fb_videomode *)&(rk1000_cvbs_mode[rk1000.mode - 1]);
		cvbs_monspecs.mode_set = rk1000.mode;
	}
	else {
		cvbs_monspecs.mode = (struct fb_videomode *)&(rk1000_cvbs_mode[0]);
		cvbs_monspecs.mode_set = TVOUT_CVBS_NTSC;
	}
	cvbs_monspecs.ddev = rk_display_device_register(&display_rk1000_cvbs, parent, NULL);
	rk1000.cvbs = &cvbs_monspecs;
	if(rk1000.mode < TVOUT_YPbPr_720x480p_60)
		rk_display_device_enable(cvbs_monspecs.ddev);
	return 0;
}
Exemple #4
0
static int ch7025_probe(struct i2c_client *client, const struct i2c_device_id *id)
{
	int ret;
	struct rkdisplay_platform_data *tv_data;
	
	memset(&ch7025, 0, sizeof(struct ch7025));
	ch7025.client = client;
	ch7025.dev = &client->dev;
	ch7025.mode = CH7025_DEFAULT_MODE;

	if(client->dev.platform_data) {
		tv_data = client->dev.platform_data;
		ch7025.io_pwr_pin = tv_data->io_pwr_pin;
		ch7025.io_rst_pin = tv_data->io_reset_pin;
		ch7025.io_switch_pin = tv_data->io_switch_pin;
		ch7025.video_source = tv_data->video_source;
		ch7025.property = tv_data->property;
	}
	else {
		ch7025.video_source = DISPLAY_SOURCE_LCDC0;
		ch7025.property = DISPLAY_MAIN;
	}

	// Reset
	if(ch7025.io_rst_pin != INVALID_GPIO) {
		ret = gpio_request(ch7025.io_rst_pin, NULL);
		if(ret) {
			printk(KERN_ERR "ch7025/7026 request reset gpio error\n");
			return -1;
		}
		gpio_direction_output(ch7025.io_rst_pin, GPIO_LOW);
		msleep(1);
		gpio_direction_output(ch7025.io_rst_pin, GPIO_HIGH);
	}
	if(ch7025.io_switch_pin != INVALID_GPIO) {
		ret = gpio_request(ch7025.io_switch_pin, NULL);
		if(ret) {
			gpio_free(ch7025.io_switch_pin);
			printk(KERN_ERR "ch7025/7026 request video switch gpio error\n");
			return -1;
		}
	}
	//Read Chip ID
	ch7025.chip_id = ch7025_read_reg(DEVICE_ID);
	DBG("chip id is 0x%02x revision id %02x", ch7025.chip_id, ch7025_read_reg(REVISION_ID)&0xFF);
	
	#ifdef CONFIG_CH7025_7026_TVOUT_CVBS
	ch7025_register_display_cvbs(&client->dev);
	if( ch7025.cvbs && (ch7025.mode < TVOUT_YPbPr_720x480p_60) )
		rk_display_device_enable((ch7025.cvbs)->ddev);
	#endif
	
	#ifdef CONFIG_CH7025_7026_TVOUT_YPBPR
	ch7025_register_display_ypbpr(&client->dev);
	if( ch7025.ypbpr && (ch7025.mode > TVOUT_CVBS_PAL) ) 
		rk_display_device_enable((ch7025.ypbpr)->ddev);
	#endif
	
	#ifdef CONFIG_HAS_EARLYSUSPEND
	ch7025.early_suspend.suspend = ch7025_early_suspend;
	ch7025.early_suspend.resume = ch7025_early_resume;
	ch7025.early_suspend.level = EARLY_SUSPEND_LEVEL_DISABLE_FB - 10;
	register_early_suspend(&(ch7025.early_suspend));
	#endif
	
	printk(KERN_INFO "ch7025/7026 probe sucess.\n");
	return 0;
}
static int rk3036_tve_probe(struct platform_device *pdev)
{
	struct device_node *np = pdev->dev.of_node;
	struct resource *res;
	const struct of_device_id *match;
	int i;
	int val = 0;

	match = of_match_node(rk3036_tve_dt_ids, np);
	if (!match)
		return PTR_ERR(match);

	rk3036_tve = devm_kzalloc(&pdev->dev,
				  sizeof(struct rk3036_tve), GFP_KERNEL);
	if (!rk3036_tve) {
		dev_err(&pdev->dev, "rk3036 tv encoder device kmalloc fail!");
		return -ENOMEM;
	}

	if (of_property_read_u32(np, "test_mode", &val))
		rk3036_tve->test_mode = 0;
	else
		rk3036_tve->test_mode = val;

	if (!strcmp(match->compatible, "rockchip,rk3036-tve")) {
		rk3036_tve->soctype = SOC_RK3036;
		rk3036_tve->inputformat = INPUT_FORMAT_RGB;
	} else if (!strcmp(match->compatible, "rockchip,rk312x-tve")) {
		rk3036_tve->soctype = SOC_RK312X;
		rk3036_tve->inputformat = INPUT_FORMAT_YUV;
	} else {
		dev_err(&pdev->dev, "It is not a valid tv encoder!");
		kfree(rk3036_tve);
		return -ENOMEM;
	}

	platform_set_drvdata(pdev, rk3036_tve);
	rk3036_tve->dev = &pdev->dev;
	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
	rk3036_tve->reg_phy_base = res->start;
	rk3036_tve->len = resource_size(res);
	rk3036_tve->regbase = ioremap(res->start, rk3036_tve->len);
	if (IS_ERR(rk3036_tve->regbase)) {
		dev_err(&pdev->dev,
			"rk3036 tv encoder device map registers failed!");
		return PTR_ERR(rk3036_tve->regbase);
	}

	INIT_LIST_HEAD(&(rk3036_tve->modelist));
	for (i = 0; i < ARRAY_SIZE(rk3036_cvbs_mode); i++)
		fb_add_videomode(&rk3036_cvbs_mode[i], &(rk3036_tve->modelist));
	 if (cvbsformat >= 0) {
		rk3036_tve->mode =
			(struct fb_videomode *)&rk3036_cvbs_mode[cvbsformat];
		rk3036_tve->enable = 1;
		tve_switch_fb(rk3036_tve->mode, 1);
	} else {
		rk3036_tve->mode = (struct fb_videomode *)&rk3036_cvbs_mode[1];
	}
	rk3036_tve->ddev =
		rk_display_device_register(&display_cvbs, &pdev->dev, NULL);
	rk_display_device_enable(rk3036_tve->ddev);

	fb_register_client(&tve_fb_notifier);
	cvbsformat = -1;
	dev_info(&pdev->dev, "%s tv encoder probe ok\n", match->compatible);
	return 0;
}