Beispiel #1
0
static int __init s5p_hpd_probe(struct platform_device *pdev)
{
	struct s5p_platform_hpd *pdata;

	if (misc_register(&hpd_misc_device)) {
		printk(KERN_WARNING " Couldn't register device 10, %d.\n", \
							HPD_MINOR);
		return -EBUSY;
	}

	init_waitqueue_head(&hpd_struct.waitq);

	spin_lock_init(&hpd_struct.lock);

	atomic_set(&hpd_struct.state, -1);

	atomic_set(&hdmi_status, HDMI_OFF);

	printk(KERN_INFO "initialised variables\n");

	pdata = to_tvout_plat(&pdev->dev);

	if (pdata->int_src_hdmi_hpd)
		hpd_struct.int_src_hdmi_hpd = \
			(void (*)(void))pdata->int_src_hdmi_hpd;

	if (pdata->int_src_ext_hpd)
		hpd_struct.int_src_ext_hpd = \
			(void (*)(void))pdata->int_src_ext_hpd;

	if (pdata->read_gpio)
		hpd_struct.read_gpio = \
				(int (*)(void))pdata->read_gpio;

	hpd_struct.irq_n = platform_get_irq(pdev, 0);

	hpd_struct.int_src_ext_hpd();
	if (hpd_struct.read_gpio()) {
		atomic_set(&hpd_struct.state, HPD_HI);
		last_hpd_state = HPD_HI;
	} else {
		atomic_set(&hpd_struct.state, HPD_LO);
		last_hpd_state = HPD_LO;
	}

	irq_set_irq_type(hpd_struct.irq_n, IRQ_TYPE_EDGE_BOTH);

	if (request_irq(hpd_struct.irq_n, (irq_handler_t)s5p_hpd_irq_handler,
				IRQF_DISABLED, "hpd", (void *)(&pdev->dev))) {
		printk(KERN_ERR  "failed to install hpd irq\n");
		return -EBUSY;
	}

	s5p_hdmi_reg_intc_set_isr(s5p_hpd_irq_handler, (u8)HDMI_IRQ_HPD_PLUG);
	s5p_hdmi_reg_intc_set_isr(s5p_hpd_irq_handler, \
						(u8)HDMI_IRQ_HPD_UNPLUG);

	return 0;
}
Beispiel #2
0
static int s5p_cec_probe(struct platform_device *pdev)
{
	struct s5p_platform_cec *pdata;
	u8 *buffer;
	int irq_num;
	int ret;

	/*
	 * CEC GPIO number is changed.
	 */
	#if 0
	s3c_gpio_cfgpin(S5PV210_GPH1(4), S3C_GPIO_SFN(0x4));
	s3c_gpio_setpull(S5PV210_GPH1(4), S3C_GPIO_PULL_NONE);
	#endif
	pdata = to_tvout_plat(&pdev->dev);

	if (pdata->cfg_gpio)
		pdata->cfg_gpio(pdev);


	/* get ioremap addr */
	s5p_cec_mem_probe(pdev);

	if (misc_register(&cec_misc_device)) {
		printk(KERN_WARNING " Couldn't register device 10, %d.\n",
			CEC_MINOR);

		return -EBUSY;
	}

	irq_num = platform_get_irq(pdev, 0);

	if (irq_num < 0) {
		printk(KERN_ERR  "failed to get %s irq resource\n", "cec");
		ret = -ENOENT;

		return ret;
	}

	ret = request_irq(irq_num, s5p_cec_irq_handler, IRQF_DISABLED,
		pdev->name, &pdev->id);

	if (ret != 0) {
		printk(KERN_ERR  "failed to install %s irq (%d)\n", "cec", ret);

		return ret;
	}

	init_waitqueue_head(&cec_rx_struct.waitq);
	spin_lock_init(&cec_rx_struct.lock);
	init_waitqueue_head(&cec_tx_struct.waitq);

	buffer = kmalloc(CEC_TX_BUFF_SIZE, GFP_KERNEL);

	if (!buffer) {
		printk(KERN_ERR " kmalloc() failed!\n");
		misc_deregister(&cec_misc_device);

		return -EIO;
	}

	cec_rx_struct.buffer = buffer;

	cec_rx_struct.size   = 0;
	TV_CLK_GET_WITH_ERR_CHECK(hdmi_cec_clk, pdev, "hdmicec");


	return 0;
}
Beispiel #3
0
static int __devinit s5p_hpd_probe(struct platform_device *pdev)
{
	struct s5p_platform_hpd *pdata;
	int ret;

	if (misc_register(&hpd_misc_device)) {
		printk(KERN_WARNING " Couldn't register device 10, %d.\n",
		       HPD_MINOR);

		return -EBUSY;
	}

	init_waitqueue_head(&hpd_struct.waitq);

	spin_lock_init(&hpd_struct.lock);

	atomic_set(&hpd_struct.state, -1);

	atomic_set(&hdmi_status, HDMI_OFF);

	pdata = to_tvout_plat(&pdev->dev);

	if (pdata->int_src_hdmi_hpd)
		hpd_struct.int_src_hdmi_hpd =
		    (void (*)(void))pdata->int_src_hdmi_hpd;
	if (pdata->int_src_ext_hpd)
		hpd_struct.int_src_ext_hpd =
		    (void (*)(void))pdata->int_src_ext_hpd;
	if (pdata->read_gpio)
		hpd_struct.read_gpio = (int (*)(void))pdata->read_gpio;
#ifdef CONFIG_HDMI_CONTROLLED_BY_EXT_IC
	if (pdata->ext_ic_control)
		hpd_struct.ext_ic_control = pdata->ext_ic_control;
#endif
	hpd_struct.irq_n = platform_get_irq(pdev, 0);

	hpd_struct.int_src_ext_hpd();
	if (hpd_struct.read_gpio()) {
		atomic_set(&hpd_struct.state, HPD_HI);
		last_hpd_state = HPD_HI;
#ifdef CONFIG_HDMI_CONTROLLED_BY_EXT_IC
		hpd_struct.ext_ic_control(true);
#endif
	} else {
		atomic_set(&hpd_struct.state, HPD_LO);
		last_hpd_state = HPD_LO;
	}

#ifdef CONFIG_HDMI_SWITCH_HPD
	hpd_struct.hpd_switch.name = "hdmi";
	switch_dev_register(&hpd_struct.hpd_switch);
#endif
	switch_set_state(&hpd_struct.hpd_switch, last_hpd_state);
	irq_set_irq_type(hpd_struct.irq_n, IRQ_TYPE_EDGE_BOTH);

	ret = request_irq(hpd_struct.irq_n, (irq_handler_t) s5p_hpd_irq_handler,
			  IRQF_DISABLED, "hpd", (void *)(&pdev->dev));

	if (ret) {
		printk(KERN_ERR "failed to install hpd irq\n");
		misc_deregister(&hpd_misc_device);
		return -EIO;
	}
#ifdef	CONFIG_SAMSUNG_WORKAROUND_HPD_GLANCE
	disable_irq(hpd_struct.irq_n);
#endif

	s5p_hdmi_reg_intc_set_isr(s5p_hpd_irq_handler, (u8) HDMI_IRQ_HPD_PLUG);
	s5p_hdmi_reg_intc_set_isr(s5p_hpd_irq_handler,
				  (u8) HDMI_IRQ_HPD_UNPLUG);

	last_uevent_state = -1;

#ifdef CONFIG_LSI_HDMI_AUDIO_CH_EVENT
	g_audio_ch_switch.name = "ch_hdmi_audio";
	switch_dev_register(&g_audio_ch_switch);
#endif
	return 0;
}
Beispiel #4
0
static int __devinit s5p_cec_probe(struct platform_device *pdev)
{
	struct s5p_platform_cec *pdata;
	u8 *buffer;
	int ret;
	struct resource *res;

	pdata = to_tvout_plat(&pdev->dev);

	if (pdata->cfg_gpio)
		pdata->cfg_gpio(pdev);


	s5p_cec_mem_probe(pdev);

	if (misc_register(&cec_misc_device)) {
		printk(KERN_WARNING " Couldn't register device 10, %d.\n",
			CEC_MINOR);

		return -EBUSY;
	}

#if 0
	irq_num = platform_get_irq(pdev, 0);

	if (irq_num < 0) {
		printk(KERN_ERR  "failed to get %s irq resource\n", "cec");
		ret = -ENOENT;

		return ret;
	}
#endif

	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
	if (res == NULL) {
		dev_err(&pdev->dev, "failed to get irq resource.\n");
		ret = -ENOENT;
		return ret;
	}

	ret = request_irq(res->start, s5p_cec_irq_handler, IRQF_DISABLED,
		pdev->name, &pdev->id);

	if (ret != 0) {
		printk(KERN_ERR  "failed to install %s irq (%d)\n", "cec", ret);

		return ret;
	}

	init_waitqueue_head(&cec_rx_struct.waitq);
	spin_lock_init(&cec_rx_struct.lock);
	init_waitqueue_head(&cec_tx_struct.waitq);

	buffer = kmalloc(CEC_TX_BUFF_SIZE, GFP_KERNEL);

	if (!buffer) {
		printk(KERN_ERR " kmalloc() failed!\n");
		misc_deregister(&cec_misc_device);

		return -EIO;
	}

	cec_rx_struct.buffer = buffer;

	cec_rx_struct.size   = 0;
	TV_CLK_GET_WITH_ERR_CHECK(hdmi_cec_clk, pdev, "sclk_cec");

	dev_info(&pdev->dev, "probe successful\n");

	return 0;
}