static int mipi_samsung_disp_off(struct platform_device *pdev)
{
	struct msm_fb_data_type *mfd;

#ifdef READ_REGISTER_ESD
	cancel_delayed_work(&(msd.mpd->esd_work));
#endif

#if defined(CONFIG_MIPI_SAMSUNG_ESD_REFRESH)
#if defined(CONFIG_MACH_JAGUAR)
	if  (system_rev >= 16)
		set_esd_disable();
#else
	set_esd_disable();
#endif

#endif
	mfd = platform_get_drvdata(pdev);
	if (unlikely(!mfd))
		return -ENODEV;
	if (unlikely(mfd->key != MFD_KEY))
		return -EINVAL;

	mipi_samsung_disp_send_cmd(mfd, PANEL_READY_TO_OFF, false);
	mipi_samsung_disp_send_cmd(mfd, PANEL_OFF, false);

	msd.mpd->ldi_acl_stat = false;

	return 0;
}
static void mipi_samsung_disp_early_suspend(struct early_suspend *h)
{
	struct msm_fb_data_type *mfd;
	pr_info("%s", __func__);

#ifdef READ_REGISTER_ESD
	mfd = platform_get_drvdata(msd.msm_pdev);
	if (unlikely(!mfd)) {
		pr_info("%s NO PDEV.\n", __func__);
		return;
	}
	if (unlikely(mfd->key != MFD_KEY)) {
		pr_info("%s MFD_KEY is not matched.\n", __func__);
		return;
	}

	mfd->resume_state = MIPI_SUSPEND_STATE;
	cancel_delayed_work_sync(&(msd.mpd->esd_work));
	wake_unlock(&(msd.mpd->esd_wake_lock));

#if defined(CONFIG_MIPI_SAMSUNG_ESD_REFRESH)
		set_esd_disable();
#endif
#else
#if defined(CONFIG_MIPI_SAMSUNG_ESD_REFRESH)
	set_esd_disable();
#endif

	mfd = platform_get_drvdata(msd.msm_pdev);
	if (unlikely(!mfd)) {
		pr_info("%s NO PDEV.\n", __func__);
		return;
	}
	if (unlikely(mfd->key != MFD_KEY)) {
		pr_info("%s MFD_KEY is not matched.\n", __func__);
		return;
	}
#endif

#if !defined(CONFIG_FB_MSM_MIPI_SAMSUNG_OLED_VIDEO_HD_PT) && \
	!defined(CONFIG_FB_MSM_MIPI_MAGNA_OLED_VIDEO_QHD_PT) && \
	!defined(CONFIG_FB_MSM_MIPI_MAGNA_OLED_VIDEO_WVGA_PT)

	mipi_samsung_disp_send_cmd(mfd, PANEL_EARLY_OFF, true);
#else
	mipi_samsung_disp_send_cmd(mfd, PANEL_READY_TO_OFF, true);
#endif
	mfd->resume_state = MIPI_SUSPEND_STATE;
}
Example #3
0
static int mipi_novatek_disp_off(struct platform_device *pdev)
{
	int disp_bl_cont_gpio;
	struct msm_fb_data_type *mfd;

#if defined(CONFIG_MIPI_SAMSUNG_ESD_REFRESH)
	set_esd_disable();
#endif	
	disp_bl_cont_gpio = (system_rev>1)?GPIO_LCD_BOOSTER_EN:GPIO_LCD_BOOSTER_EN_EMUL;
	mfd = platform_get_drvdata(pdev);
	
	if (unlikely(!mfd))
		return -ENODEV;
	if (unlikely(mfd->key != MFD_KEY))
		return -EINVAL;
	pr_debug("%s: DISP_BL_CONT_GPIO low\n", __func__);
	gpio_set_value(disp_bl_cont_gpio, 0);

	mipi_novatek_disp_send_cmd(mfd, PANEL_READY_TO_OFF, false);
	mipi_novatek_disp_send_cmd(mfd, PANEL_OFF, false);


	pr_info("%s:Display off completed\n", __func__);
	is_lcd_on = LCD_STATUS_OFF;

	return 0;
}
Example #4
0
static void mipi_novatek_disp_early_suspend(struct early_suspend *h)
{
	struct msm_fb_data_type *mfd;
	pr_info("%s", __func__);

	mfd = platform_get_drvdata(msd.msm_pdev);
	if (unlikely(!mfd)) {
		pr_info("%s NO PDEV.\n", __func__);
		return;
	}
	if (unlikely(mfd->key != MFD_KEY)) {
		pr_info("%s MFD_KEY is not matched.\n", __func__);
		return;
	}

	mipi_novatek_disp_send_cmd(mfd, PANEL_EARLY_OFF, true);

	mfd->resume_state = MIPI_SUSPEND_STATE;
	
#if defined(CONFIG_MIPI_SAMSUNG_ESD_REFRESH)
	set_esd_disable();
#endif	
}
Example #5
0
static int __devinit mipi_esd_refresh_probe(struct platform_device *pdev)
{
	struct esd_data_t *p_esd_data;
	struct sec_esd_platform_data *pdata = pdev->dev.platform_data;
	unsigned int irq_type;
#ifdef ESD_DEBUG
	struct device  *esd_device;
#endif
	int ret = 0;
	if (pdata == NULL) {
		pr_err("ESD Platform data is Null !!!!!\n");
		return -1;
	}
#ifndef ESD_DEBUG
	if (pdata->esd_gpio_irq == -1) {
		/* Do nothing ESD not supported in this revision */
		return 0;
	}
#endif
#if defined(CONFIG_HAS_EARLYSUSPEND)
	mipi_control.early_suspend.suspend = mipi_samsung_esd_early_suspend;
	mipi_control.early_suspend.resume = mipi_samsung_esd_late_resume;
	mipi_control.early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN - 5;
	register_early_suspend(&mipi_control.early_suspend);
#endif

#if defined(CONFIG_MACH_MELIUS_EUR_OPEN) || defined(CONFIG_MACH_MELIUS_EUR_LTE)\
	|| defined(CONFIG_MACH_MELIUS_SKT) || defined(CONFIG_MACH_MELIUS_KTT)\
	|| defined(CONFIG_MACH_MELIUS_LGT) || defined(CONFIG_MACH_MELIUS_CHN_CTC)\
	|| defined(CONFIG_MACH_MELIUS_SPR) || defined(CONFIG_MACH_MELIUS_USC) \
	|| defined(CONFIG_MACH_MELIUS_ATT) || defined(CONFIG_MACH_MELIUS_MTR)

#if defined(CONFIG_MACH_MELIUS_SPR)
	if(system_rev >= 3) {		
#elif defined(CONFIG_MACH_MELIUS_USC)
	if(system_rev >= 2) {
#else
	if(system_rev >= 11) {	
#endif
		/* ESD irq through VGH, irq trigger is LOW....HIGH....LOW */
		irq_type = IRQF_TRIGGER_RISING;
	} else {
		/* ESD irq through VGH, irq trigger is HIGH....low....HIGH */
		irq_type = IRQF_TRIGGER_FALLING;
	}
#else
	/* ESD irq through VGH, irq trigger is HIGH....low....HIGH */
	irq_type = IRQF_TRIGGER_FALLING;

#endif


#ifdef READ_REGISTER_ESD
		init_completion(&esd_completion);
#endif

	p_esd_data = kzalloc(sizeof(struct esd_data_t), GFP_KERNEL);
	if (p_esd_data == NULL) {
		pr_err("%s : Failed to allocate memory.\n", __func__);
		return -ENOMEM;
	}
	esd_enable = p_esd_data;
	p_esd_data->pdata = pdata;
	p_esd_data->esd_count = 0;
	p_esd_data->esd_ignore = false;
	p_esd_data->esd_irq_enable = true;
	p_esd_data->esd_processed_count = 0;

	wake_lock_init(&p_esd_data->det_wake_lock,
		 WAKE_LOCK_SUSPEND, "esd_det");

	INIT_WORK(&p_esd_data->det_work, sec_esd_work_func);
	INIT_DELAYED_WORK(&p_esd_data->esd_enable_delay,\
					set_esd_enable_work_func);
	dev_set_drvdata(&pdev->dev, p_esd_data);
#ifdef ESD_DEBUG
	esd_device = device_create(sec_class, NULL, 0, p_esd_data, "sec_esd");
	if (IS_ERR(esd_device)) {
		pr_err("Failed to create device for the factory test\n");
		ret = -ENODEV;
	}

	ret = sysfs_create_file(&esd_device->kobj,
					&dev_attr_esd_check.attr);
	if (ret) {
		pr_err("sysfs create fail-%s\n",
				dev_attr_esd_check.attr.name);
	}
#endif
	ret = request_threaded_irq(pdata->esd_gpio_irq, NULL,
			sec_esd_irq_handler,
			 irq_type |
			IRQF_ONESHOT, "esd_detect", p_esd_data);
	if (ret) {
		pr_err("%s : Failed to request_irq.:ret=%d", __func__, ret);
		goto err_request_detect_irq;
	}

	set_esd_disable();
	return 0;

err_request_detect_irq:
	wake_lock_destroy(&p_esd_data->det_wake_lock);
	kfree(p_esd_data);
	esd_enable = NULL;
	dev_set_drvdata(&pdev->dev, NULL);

	return -1;
}

static int sec_esd_remove(struct platform_device *pdev)
{

	struct esd_data_t *p_esd_data = dev_get_drvdata(&pdev->dev);
	free_irq(p_esd_data->pdata->esd_gpio_irq, p_esd_data);
	disable_irq_wake(p_esd_data->pdata->esd_gpio_irq);
	wake_lock_destroy(&p_esd_data->det_wake_lock);
	kfree(p_esd_data);
	return 0;
}

static struct platform_driver samsung_esd_refresh_driver = {
	.probe  = mipi_esd_refresh_probe,
	.remove = sec_esd_remove,
	.driver = {
		.name   = "samsung_mipi_esd_refresh",
	},
};

static void __exit samsung_mipi_esd_refresh_exit(void)
{
	platform_driver_unregister(&samsung_esd_refresh_driver);
}

static int __init samsung_mipi_esd_refresh_init(void)
{
	return platform_driver_register(&samsung_esd_refresh_driver);
}

MODULE_DESCRIPTION("Samsung ESD refresh driver");
MODULE_AUTHOR("Krishna Kishor Jha <*****@*****.**>");
MODULE_LICENSE("GPL");
module_init(samsung_mipi_esd_refresh_init);
module_exit(samsung_mipi_esd_refresh_exit);
static int __devinit mipi_esd_refresh_probe(struct platform_device *pdev)
{
	struct esd_data_t *p_esd_data;
	struct sec_esd_platform_data *pdata = pdev->dev.platform_data;
	unsigned int irq_type;
#ifdef ESD_DEBUG
	struct device  *esd_device;
#endif
	int ret = 0;
	if (pdata == NULL) {
		pr_err("ESD Platform data is Null !!!!!\n");
		return -1;
	}
#ifndef ESD_DEBUG
	if (pdata->esd_gpio_irq == -1) {
		/* Do nothing ESD not supported in this revision */
		return 0;
	}
#endif

#if defined(CONFIG_MACH_GOGH)
	if (system_rev > 0x01)
		irq_type = IRQF_TRIGGER_FALLING;
	else     {
		/* Gogh 0.1rev  has ESD protection chip irq
			trigger is low.....HIGH...low */
		irq_type = IRQF_TRIGGER_RISING;
	}
#else
	/* ESD irq through VGH, irq trigger is HIGH....low....HIGH */
	irq_type = IRQF_TRIGGER_FALLING;
#endif

	p_esd_data = kzalloc(sizeof(struct esd_data_t), GFP_KERNEL);
	if (p_esd_data == NULL) {
		pr_err("%s : Failed to allocate memory.\n", __func__);
		return -ENOMEM;
	}
	esd_enable = p_esd_data;
	p_esd_data->pdata = pdata;
	p_esd_data->esd_count = 0;
	p_esd_data->esd_ignore = false;
	p_esd_data->esd_irq_enable = true;
	p_esd_data->esd_processed_count = 0;

	wake_lock_init(&p_esd_data->det_wake_lock,
		 WAKE_LOCK_SUSPEND, "esd_det");

	INIT_WORK(&p_esd_data->det_work, sec_esd_work_func);
	INIT_DELAYED_WORK(&p_esd_data->esd_enable_delay,\
					set_esd_enable_work_func);
	dev_set_drvdata(&pdev->dev, p_esd_data);
#ifdef ESD_DEBUG
	esd_device = device_create(sec_class, NULL, 0, p_esd_data, "sec_esd");
	if (IS_ERR(esd_device)) {
		pr_err("Failed to create device for the factory test\n");
		ret = -ENODEV;
	}

	ret = sysfs_create_file(&esd_device->kobj,
					&dev_attr_esd_check.attr);
	if (ret) {
		pr_err("sysfs create fail-%s\n",
				dev_attr_esd_check.attr.name);
	}
#endif
	ret = request_threaded_irq(pdata->esd_gpio_irq, NULL,
			sec_esd_irq_handler,
			 irq_type |
			IRQF_ONESHOT, "esd_detect", p_esd_data);
	if (ret) {
		pr_err("%s : Failed to request_irq.:ret=%d", __func__, ret);
		goto err_request_detect_irq;
	}
#if defined(CONFIG_SAMSUNG_CMC624)
	if (samsung_has_cmc624()) {
		ret = request_threaded_irq(pdata->esd_gpio_cmc_irq, NULL,
			sec_esd_irq_handler,
			IRQF_TRIGGER_RISING |
			IRQF_ONESHOT, "esd_detect2", p_esd_data);
		if (ret) {
			pr_err("%s:Fail to request_irq.:ret=%d", __func__, ret);
			goto err_request_detect_irq2;
		}
	}
#endif
	set_esd_disable();
	return 0;

#if defined(CONFIG_SAMSUNG_CMC624)
err_request_detect_irq2:
	free_irq(pdata->esd_gpio_irq, p_esd_data);
#endif

err_request_detect_irq:
	wake_lock_destroy(&p_esd_data->det_wake_lock);
	kfree(p_esd_data);
	esd_enable = NULL;
	dev_set_drvdata(&pdev->dev, NULL);

	return -1;
}