Beispiel #1
0
static int __devinit s5p_tv_probe(struct platform_device *pdev)
{
	int	irq_num;
	int	ret;
	int 	i;

	s5ptv_status.dev_fb = &pdev->dev;
	 suspend_resume_sync = 0;
	is_tv_clk_on = false;
	is_tv_phy_enable = false;
	//enable power	
	/* Get csis power domain regulator */
	s5ptv_status.tv_regulator = regulator_get(&pdev->dev, "pd");
	if (IS_ERR(s5ptv_status.tv_regulator)) {
		printk(KERN_ERR "%s %d: failed to get resource %s\n",
				__func__, __LINE__, "s3c-tv20 pd");
		return PTR_ERR(s5ptv_status.tv_regulator);
	}

	s5ptv_status.tv_tvout = regulator_get(NULL, "tvout");
	if (IS_ERR(s5ptv_status.tv_tvout)) {
		printk(KERN_ERR "%s %d: failed to get resource %s\n",
				__func__, __LINE__, "s3c-tv20 tvout");
		return PTR_ERR(s5ptv_status.tv_tvout);
	}

	s5ptv_status.tv_tv = regulator_get(NULL, "hdmi");
	if (IS_ERR(s5ptv_status.tv_tv)) {
		printk(KERN_ERR "%s %d: failed to get resource %s\n",
				__func__, __LINE__, "s3c-tv20 tv");
		return PTR_ERR(s5ptv_status.tv_tv);
	}
	
	regulator_enable(s5ptv_status.tv_tv);
	regulator_enable(s5ptv_status.tv_tvout);
	

	s5ptv_status.dev_fb = &pdev->dev;

	__s5p_sdout_probe(pdev, 0);
	__s5p_vp_probe(pdev, 1);
	__s5p_mixer_probe(pdev, 2);

#ifdef CONFIG_CPU_S5PV210
	tv_clk_get(pdev, &s5ptv_status);
	s5p_tv_clk_gate(true);
#endif
#ifdef CONFIG_CPU_S5PV210	
	__s5p_hdmi_probe(pdev, 3, 4);
	__s5p_hdcp_init();
#endif

#ifdef FIX_27M_UNSTABLE_ISSUE /* for smdkc100 pop */
	writel(0x1, S5PC1XX_GPA0_BASE + 0x56c);
#endif

#ifdef I2C_BASE
	/* for dev_dbg err. */
	spin_lock_init(&slock_hpd);


	/* for bh */
	INIT_WORK(&ws_hpd, (void *)set_ddc_port);
#endif
	/* check EINT init state */
#ifdef CONFIG_MACH_STEALTHV
	gpio_set_value(GPIO_HDMI_EN1, 1);
#endif
	s5ptv_status.hpd_status= 0;
	
	dev_info(&pdev->dev, "hpd status is cable %s\n", 
		s5ptv_status.hpd_status ? "inserted":"removed");


	/* interrupt */
	TVOUT_IRQ_INIT(irq_num, ret, pdev, 0, out, __s5p_mixer_irq, "mixer");
	TVOUT_IRQ_INIT(irq_num, ret, pdev, 1, out_hdmi_irq, __s5p_hdmi_irq , "hdmi");
	TVOUT_IRQ_INIT(irq_num, ret, pdev, 2, out_tvenc_irq, s5p_tvenc_irq, "tvenc");
	
	/* v4l2 video device registration */
	for (i = 0; i < S5P_TVMAX_CTRLS; i++) {
		s5ptv_status.video_dev[i] = &s5p_tvout[i];

		if (video_register_device(s5ptv_status.video_dev[i],
				VFL_TYPE_GRABBER, s5p_tvout[i].minor) != 0) {

			dev_err(&pdev->dev,
				"Couldn't register tvout driver.\n");
			return 0;
		}
	}

#ifdef CONFIG_TV_FB
	mutex_init(&s5ptv_status.fb_lock);

	/* for default start up */
	_s5p_tv_if_init_param();

	s5ptv_status.tvout_param.disp_mode = TVOUT_720P_60;
	s5ptv_status.tvout_param.out_mode  = TVOUT_OUTPUT_HDMI;

#ifndef CONFIG_USER_ALLOC_TVOUT
	s5p_tv_clk_gate(true);
	if(s5ptv_status.tvout_param.out_mode == TVOUT_OUTPUT_HDMI || s5ptv_status.tvout_param.out_mode == TVOUT_OUTPUT_HDMI_RGB
		|| s5ptv_status.tvout_param.out_mode == TVOUT_OUTPUT_DVI)
		tv_phy_power(true);
	_s5p_tv_if_set_disp();
#endif

	s5ptvfb_set_lcd_info(&s5ptv_status);

	/* prepare memory */
	if (s5ptvfb_alloc_framebuffer())
		goto err_alloc;

	if (s5ptvfb_register_framebuffer())
		goto err_alloc;
#ifndef CONFIG_USER_ALLOC_TVOUT
	s5ptvfb_display_on(&s5ptv_status);
#endif
#endif

	mutex_for_fo = kmalloc(sizeof(struct mutex),
		GFP_KERNEL);

	if (mutex_for_fo == NULL) {
		dev_err(&pdev->dev,
			"failed to create mutex handle\n");
		goto out;
	}

#ifdef I2C_BASE
	mutex_for_i2c = kmalloc(sizeof(struct mutex),
		GFP_KERNEL);

	if (mutex_for_i2c == NULL) {
		dev_err(&pdev->dev,
			"failed to create mutex handle\n");
		goto out;
	}
	mutex_init(mutex_for_i2c);
#endif
	mutex_init(mutex_for_fo);

#ifdef CONFIG_CPU_S5PV210
	/* added for phy cut off when boot up */
	clk_enable(s5ptv_status.i2c_phy_clk);
	__s5p_hdmi_phy_power(false);
	clk_disable(s5ptv_status.i2c_phy_clk);
	s5p_tv_clk_gate(false);
#endif
	regulator_disable(s5ptv_status.tv_tv);
	regulator_disable(s5ptv_status.tv_tvout);
	printk("tv_base_probe is successfully\n");

	return 0;

#ifdef CONFIG_TV_FB
err_alloc:
#endif

out_tvenc_irq:
	free_irq(IRQ_HDMI, pdev);

out_hdmi_irq:
	free_irq(IRQ_MIXER, pdev);

out:
	printk(KERN_ERR "not found (%d). \n", ret);

	return ret;
}
Beispiel #2
0
/*
 *  Probe
 */
static int __init s5p_tv_probe(struct platform_device *pdev)
{
	int 	irq_num;
	int 	ret;
	int 	i;
	int 	err;

	ref_count_tv = 0;
	ref_count_g0 = 0;
	ref_count_g1 = 0;
	__s5p_sdout_probe(pdev, 0);
	__s5p_vp_probe(pdev, 1);	
	__s5p_mixer_probe(pdev, 2);

#ifdef CONFIG_CPU_S5PC110	
	tv_clk_get(pdev, &s5ptv_status);
	s5p_tv_clk_gate( true );
#endif
#ifdef CONFIG_CPU_S5PC110	
	__s5p_hdmi_probe(pdev, 3, 4);
#endif

#ifdef CONFIG_CPU_S5PC100	
	__s5p_hdmi_probe(pdev, 3);
	__s5p_tvclk_probe(pdev, 4);
#endif

	/* for dev_dbg err. */

	/* clock */



#ifdef FIX_27M_UNSTABLE_ISSUE /* for smdkc100 pop */
	writel(0x1, S5PC1XX_GPA0_BASE + 0x56c);
#endif
	spin_lock_init(&slock_hpd);
	/* for bh */
	INIT_WORK(&ws_hpd, (void *)set_ddc_port);

	/* check EINT init state */
#ifdef CONFIG_SMDKC110_BOARD
 	s3c_gpio_cfgpin(S5PC11X_GPH1(5), S5PC11X_GPH1_5_HDMI_HPD);
        s3c_gpio_setpull(S5PC11X_GPH1(5), S3C_GPIO_PULL_DOWN);
          
	s5ptv_status.hpd_status = gpio_get_value(S5PC11X_GPH1(5))
                                     ? false:true;

	dev_info(&pdev->dev, "hpd status is cable %s\n", 
		s5ptv_status.hpd_status ? "inserted":"removed");
	
#endif
	/* interrupt */
	TVOUT_IRQ_INIT(irq_num, ret, pdev, 0, out, __s5p_mixer_irq, "mixer");
	TVOUT_IRQ_INIT(irq_num, ret, pdev, 1, out_hdmi_irq, __s5p_hdmi_irq , "hdmi");
	TVOUT_IRQ_INIT(irq_num, ret, pdev, 2, out_tvenc_irq, s5p_tvenc_irq, "tvenc");
	TVOUT_IRQ_INIT(irq_num, ret, pdev, 3, out_hpd_irq, __s5p_hpd_irq, "hpd");

#ifdef CONFIG_S5PC110_JUPITER_BOARD 
	set_irq_type(IRQ_EINT13, IRQ_TYPE_EDGE_RISING);
#endif
	/* v4l2 video device registration */
	for (i = 0;i < S5P_TVMAX_CTRLS;i++) {
		s5ptv_status.video_dev[i] = &s5p_tvout[i];

		if (video_register_device(s5ptv_status.video_dev[i],
				VFL_TYPE_GRABBER, s5p_tvout[i].minor) != 0) {
				
			dev_err(&pdev->dev, 
				"Couldn't register tvout driver.\n");
			return 0;
		}
		else
			dev_info(&pdev->dev, "%s registered successfully \n", s5p_tvout[i].name);
	}
//mkh:
//__s5p_hdmi_init_hpd_onoff(1);
	mutex_for_fo = (struct mutex *)kmalloc(sizeof(struct mutex), GFP_KERNEL);

	if (mutex_for_fo == NULL) {
		dev_err(&pdev->dev, 
			"failed to create mutex handle\n");
		goto out;
	}

	mutex_for_i2c= (struct mutex *)kmalloc(sizeof(struct mutex), GFP_KERNEL);
	
	if (mutex_for_i2c == NULL) {
		dev_err(&pdev->dev, 
			"failed to create mutex handle\n");
		goto out;
	}
	#ifdef CONFIG_CPU_S5PC110
	s5p_tv_clk_gate(false);
	#endif
	mutex_init(mutex_for_fo);
	mutex_init(mutex_for_i2c);
	
	return 0;

out_hpd_irq:
	free_irq(IRQ_TVENC, pdev);

out_tvenc_irq:
	free_irq(IRQ_HDMI, pdev);

out_hdmi_irq:
	free_irq(IRQ_MIXER, pdev);

out:
	printk(KERN_ERR "not found (%d). \n", ret);

	return ret;
}