示例#1
0
int s3cfb_reset_lcd(struct platform_device *pdev)
{
	int err;

	err = gpio_request(S5PC1XX_GPH0(6), "GPH0");

	if (err) {
		printk(KERN_ERR "failed to request GPH0 for "
			"lcd reset control\n");
		return err;
	}

	gpio_direction_output(S5PC1XX_GPH0(6), 1);

	mdelay(100);

	gpio_set_value(S5PC1XX_GPH0(6), 0);
	mdelay(10);

	gpio_set_value(S5PC1XX_GPH0(6), 1);
	mdelay(10);

	gpio_free(S5PC1XX_GPH0(6));

	return 0;
}
示例#2
0
static irqreturn_t __s5p_hpd_irq(int irq, void *dev_id)
{

	spin_lock_irq(&slock_hpd);
	
	s5ptv_status.hpd_status = gpio_get_value(S5PC1XX_GPH0(5)) 
		? false:true;

	if(s5ptv_status.hpd_status){
		
		set_irq_type(IRQ_EINT5, IRQ_TYPE_EDGE_RISING);
		
	}else{
		set_irq_type(IRQ_EINT5, IRQ_TYPE_EDGE_FALLING);			

	}

	if (s5ptv_status.hdcp_en)
		schedule_work(&ws_hpd);

	spin_unlock_irq(&slock_hpd);

	BASEPRINTK("hpd_status = %d\n", s5ptv_status.hpd_status);
			
	return IRQ_HANDLED;
}
示例#3
0
int s3cfb_set_gpio(void)
{
	int i, err;

	/* LCD_HSYNC, LCD_VSYNC, LCD_VDEN, LCD_VCLK, VD[23:0] */
	for (i = 0; i < 8; i++)
		s3c_gpio_cfgpin(S5PC1XX_GPF0(i), S3C_GPIO_SFN(2));

	for (i = 0; i < 8; i++)
		s3c_gpio_cfgpin(S5PC1XX_GPF1(i), S3C_GPIO_SFN(2));

	for (i = 0; i < 8; i++)
		s3c_gpio_cfgpin(S5PC1XX_GPF2(i), S3C_GPIO_SFN(2));

	for (i = 0; i < 4; i++)
		s3c_gpio_cfgpin(S5PC1XX_GPF3(i), S3C_GPIO_SFN(2));

#ifndef CONFIG_BACKLIGHT_PWM
	/* backlight ON */
	if (gpio_is_valid(S5PC1XX_GPD(0))) {
		err = gpio_request(S5PC1XX_GPD(0), "GPD");

		if (err) {
			printk(KERN_ERR "failed to request GPD for "
				"lcd backlight control\n");
			return err;
		}

		gpio_direction_output(S5PC1XX_GPD(0), 1);
	}
#endif

	/* module reset */
	if (gpio_is_valid(S5PC1XX_GPH0(6))) {
		err = gpio_request(S5PC1XX_GPH0(6), "GPH0");

		if (err) {
			printk(KERN_ERR "failed to request GPH0 for "
				"lcd reset control\n");
			return err;
		}

		gpio_direction_output(S5PC1XX_GPH0(6), 1);
	}

	mdelay(100);

	gpio_set_value(S5PC1XX_GPH0(6), 0);
	mdelay(10);

	gpio_set_value(S5PC1XX_GPH0(6), 1);
	mdelay(10);

	gpio_free(S5PC1XX_GPH0(6));
#ifndef CONFIG_BACKLIGHT_PWM
	gpio_free(S5PC1XX_GPD(0));
#endif

	return 0;
}
示例#4
0
static irqreturn_t __s5p_hpd_irq(int irq, void *dev_id)
{



	if(gpio_get_value(S5PC11X_GPH1(5)))
	{
	printk("\n cable inserted \n");
	set_irq_type(IRQ_EINT13, IRQ_TYPE_EDGE_FALLING);
	}
	else
	{
	printk("\n cable removed\n");
	set_irq_type(IRQ_EINT13,IRQ_TYPE_EDGE_RISING);
	}

#if 0
	spin_lock_irq(&slock_hpd);
	
#ifdef CONFIG_CPU_S5PC110
//mkh:
s5ptv_status.hpd_status = gpio_get_value(S5PC11X_GPH0(5))
                ? false:true;
#else
	s5ptv_status.hpd_status = gpio_get_value(S5PC1XX_GPH0(5)) 
		? false:true;
#endif	
	if(s5ptv_status.hpd_status){
		
		set_irq_type(IRQ_EINT5, IRQ_TYPE_EDGE_RISING);
		
	}else{
		set_irq_type(IRQ_EINT5, IRQ_TYPE_EDGE_FALLING);			

	}

	if (s5ptv_status.hdcp_en)
		schedule_work(&ws_hpd);

	spin_unlock_irq(&slock_hpd);

	BASEPRINTK("hpd_status = %d\n", s5ptv_status.hpd_status);
#endif		
	return IRQ_HANDLED;
}
示例#5
0
static int s5pc1xx_12s1_resume(struct snd_soc_dai *dai)
{
	struct s3c_i2sv2_info *i2s = to_info(dai);
	unsigned int gpio, err;

	s3cdbg("Entered %s\n", __FUNCTION__);

	// Configure the I2S pins : GPC[n] -> I2S1
    for (gpio = S5PC1XX_GPC(0); gpio <= S5PC1XX_GPC(4); gpio++)
    {
        s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
        s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP);
    }

	if (gpio_is_valid(S5PC1XX_GPH0(7)))
	{
		err = gpio_request( S5PC1XX_GPH0(7), "GPH0");
		if(err)
		{
			s3cdbg(KERN_ERR "failed to request GPJ0 for wm8991 i2c clk..\n");
			return err;
		}
		gpio_direction_input(S5PC1XX_GPH0(7));
		s3c_gpio_setpull(S5PC1XX_GPH0(7), S3C_GPIO_PULL_UP);
		
		if(gpio_get_value(S5PC1XX_GPH0(7))) g_current_out=WM8991_SPK;
		else 								g_current_out=WM8991_HP;
		gpio_free(S5PC1XX_GPH0(7));
	}
	err = request_irq(IRQ_HPJACK, odroid_hpjack_isr, IRQF_DISABLED, "hkc100-hpjack-irq", NULL);
	if(err) s3cdbg("\nDEBUG -> IRQ_HPJACK request error!!!\n\n");
	set_irq_type(IRQ_HPJACK, IRQ_TYPE_EDGE_FALLING);

	init_timer(&detect_timer);
	detect_timer.function = odroid_detect_handle;

	wm8991_set_outpath(g_current_out);
	clk_enable(i2s->iis_clk);

	enable_irq(IRQ_HPJACK);
	g_probe_done=true;

	return 0;
}
示例#6
0
static int __devinit s5p_tv_probe(struct platform_device *pdev)
{
	int 	irq_num;
	int 	ret;
	int 	i,retval;

	s5ptv_status.dev_fb = &pdev->dev;

	//enable power	
	max8998_ldo3_8_control(1,LDO_TV_OUT); //ldo 3,8 on
	printk("%s: LDO3_8 is enabled by TV \n", __func__);

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

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


#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_CPU_S5PC100
	s3c_gpio_cfgpin(S5PC1XX_GPH0(5), S3C_GPIO_SFN(2));
	s3c_gpio_setpull(S5PC1XX_GPH0(5), S3C_GPIO_PULL_UP);

	s5ptv_status.hpd_status = gpio_get_value(S5PC1XX_GPH0(5)) 
		? false:true;
#endif

#ifdef CONFIG_CPU_S5PV210
#ifdef CONFIG_HDMI_HPD
	if(0 == gpio_get_value(GPIO_ACCESSORY_INT))  //docking station attached
    s5ptv_status.hpd_status= s5p_hpd_get_state();
	else 
		s5ptv_status.hpd_status= 0;
#else
    s5ptv_status.hpd_status= 0;
#endif    
#endif
	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");
	
#ifdef CONFIG_CPU_S5PC100	
	TVOUT_IRQ_INIT(irq_num, ret, pdev, 3, out_hpd_irq, __s5p_hpd_irq, "hpd");
	set_irq_type(IRQ_EINT5, IRQ_TYPE_LEVEL_LOW);
#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;
		}
	}


#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
	//disable power
	max8998_ldo3_8_control(0,LDO_TV_OUT);  //ldo 3,8 off
	printk("%s: LDO3_8 is disabled by TV \n", __func__);

	return 0;

#ifdef CONFIG_TV_FB
err_alloc:
#endif

#ifdef CONFIG_CPU_S5PC100
out_hpd_irq:
	free_irq(IRQ_TVENC, pdev);
#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;
}
示例#7
0
static int __devinit s5p_tv_probe(struct platform_device *pdev)
{
	int	irq_num;
	int	ret;
	int	i, retval;


	/* 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);
	}

#ifdef CONFIG_MACH_P1
	s5ptv_status.tv_tv = regulator_get(NULL, "tv");
	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);
#endif
	s5ptv_status.dev_fb = &pdev->dev;

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

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

#ifdef CONFIG_CPU_S5PV210
	tv_clk_get(pdev, &s5ptv_status);
	s5p_tv_clk_gate(true);
	__s5p_hdmi_probe(pdev, 3, 4);
	__s5p_hdcp_init();
#endif
#if defined(CONFIG_MACH_P1)
	retval = i2c_add_driver(&SII9234A_i2c_driver);
	if (retval != 0)
		printk(KERN_ERR "[MHL SII9234A] can't add i2c driver");

	retval = i2c_add_driver(&SII9234B_i2c_driver);
	if (retval != 0)
		printk(KERN_ERR "[MHL SII9234B] can't add i2c driver");

	retval = i2c_add_driver(&SII9234C_i2c_driver);
	if (retval != 0)
		printk(KERN_ERR "[MHL SII9234C] can't add i2c driver");

	retval = i2c_add_driver(&SII9234_i2c_driver);
	if (retval != 0)
		printk(KERN_ERR "[MHL SII9234] can't add i2c driver");
#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_CPU_S5PC100
	s3c_gpio_cfgpin(S5PC1XX_GPH0(5), S3C_GPIO_SFN(2));
	s3c_gpio_setpull(S5PC1XX_GPH0(5), S3C_GPIO_PULL_UP);

	s5ptv_status.hpd_status = gpio_get_value(S5PC1XX_GPH0(5)) ? \
							false : true;
#endif

#ifdef CONFIG_CPU_S5PV210
#ifdef CONFIG_HDMI_HPD
	s5ptv_status.hpd_status = 0;
#else
	s5ptv_status.hpd_status = 0;
#endif
#endif
	dev_info(&pdev->dev, "hpd status: cable %s\n",\
		s5ptv_status.hpd_status ? "inserted":"removed/not connected");

	/* 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");

#ifdef CONFIG_CPU_S5PC100
	TVOUT_IRQ_INIT(irq_num, ret, pdev, 3, out_hpd_irq, __s5p_hpd_irq, \
									"hpd");
	set_irq_type(IRQ_EINT5, IRQ_TYPE_LEVEL_LOW);
#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;
		}
	}

#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))
*/
		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
	printk(KERN_INFO "%s TV Probing is done\n", __func__);
	return 0;

#ifdef CONFIG_TV_FB
err_alloc:
#endif

#ifdef CONFIG_CPU_S5PC100
out_hpd_irq:
	free_irq(IRQ_TVENC, pdev);
#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;
}
示例#8
0
static int s3c_irq_eint_set_type(unsigned int irq, unsigned int type)
{
	int offs = eint_offset(irq);
	int shift;
	u32 ctrl, mask;
	u32 newvalue = 0;

	switch (type) {
	case IRQ_TYPE_NONE:
		printk(KERN_WARNING "No edge setting!\n");
		break;

	case IRQ_TYPE_EDGE_RISING:
		newvalue = S3C2410_EXTINT_RISEEDGE;
		break;

	case IRQ_TYPE_EDGE_FALLING:
		newvalue = S3C2410_EXTINT_FALLEDGE;
		break;

	case IRQ_TYPE_EDGE_BOTH:
		newvalue = S3C2410_EXTINT_BOTHEDGE;
		break;

	case IRQ_TYPE_LEVEL_LOW:
		newvalue = S3C2410_EXTINT_LOWLEV;
		break;

	case IRQ_TYPE_LEVEL_HIGH:
		newvalue = S3C2410_EXTINT_HILEV;
		break;

	default:
		printk(KERN_ERR "No such irq type %d", type);
		return -1;
	}

	shift = (offs & 0x7) * 4;
	mask = 0x7 << shift;

#if 0
	int flt_shift;
	int target_offset;
	flt_shift = (offs & 0x7)*8;
	target_offset = flt_shift/32;
	flt_shift = flt_shift%32;
	ctrl = __raw_readl((S5PC1XX_EINT30FLTCON0+target_offset));
	ctrl &= ~(0xff<<flt_shift);
	ctrl |= (0x80 | 0x40 | 0x1) << flt_shift;  //0x80:filter enable, 0x40:digital filter, 0x1: delay clocks
	__raw_writel(ctrl, (S5PC1XX_EINT30FLTCON0+target_offset));
#endif

	ctrl = __raw_readl(S5PC1XX_EINTCON(eint_conf_reg(irq)));
	ctrl &= ~mask;
	ctrl |= newvalue << shift;
	__raw_writel(ctrl, S5PC1XX_EINTCON(eint_conf_reg(irq)));

#if defined(CONFIG_CPU_S5PC100)
	if((0 <= offs) && (offs < 8))
		s3c_gpio_cfgpin(S5PC1XX_GPH0(offs&0x7), 0x2<<((offs&0x7)*4));
	else if((8 <= offs) && (offs < 16))
		s3c_gpio_cfgpin(S5PC1XX_GPH1(offs&0x7), 0x2<<((offs&0x7)*4));
	else if((16 <= offs) && (offs < 24))
		s3c_gpio_cfgpin(S5PC1XX_GPH2(offs&0x7), 0x2<<((offs&0x7)*4));
	else if((24 <= offs) && (offs < 32))
		s3c_gpio_cfgpin(S5PC1XX_GPH3(offs&0x7), 0x2<<((offs&0x7)*4));
	else
		printk(KERN_ERR "No such irq number %d", offs);
#elif defined(CONFIG_CPU_S5PC110)
	if((0 <= offs) && (offs < 8))
		s3c_gpio_cfgpin(S5PC1XX_GPH0(offs&0x7), 0xf<<((offs&0x7)*4));
	else if((8 <= offs) && (offs < 16))
		s3c_gpio_cfgpin(S5PC1XX_GPH1(offs&0x7), 0xf<<((offs&0x7)*4));
	else if((16 <= offs) && (offs < 24))
		s3c_gpio_cfgpin(S5PC1XX_GPH2(offs&0x7), 0xf<<((offs&0x7)*4));
	else if((24 <= offs) && (offs < 32))
		s3c_gpio_cfgpin(S5PC1XX_GPH3(offs&0x7), 0xf<<((offs&0x7)*4));
	else
		printk(KERN_ERR "No such irq number %d", offs);
#endif
	return 0;
}