static ssize_t mipi_samsung_esd_check_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size) { struct esd_data_t *p_esd_data = dev_get_drvdata(dev); sec_esd_irq_handler(0, p_esd_data); return 1; }
static void sec_esd_work_func(struct work_struct *work) { #if defined(CONFIG_FB_MSM_MIPI_NOVATEK_VIDEO_HD_PT_PANEL) #define LCD_ESD_GPIO_CHECK_DELAY 300 int gpio_value = 0; #endif struct esd_data_t *p_esd_data = container_of(work, struct esd_data_t, det_work); p_esd_data->esd_count++; if (p_esd_data->esd_count <= ESD_EXCEPT_CNT) pr_info("%s : %d ignore Cnt(%d)\n", __func__, p_esd_data->esd_count, ESD_EXCEPT_CNT); else if (p_esd_data->esd_ignore) pr_info("%s : %d ignore FLAG,esd_processed:%d\n", __func__, p_esd_data->esd_count, p_esd_data->esd_processed_count); else { #if defined(CONFIG_FB_MSM_MIPI_NOVATEK_VIDEO_HD_PT_PANEL) gpio_value = gpio_get_value(GPIO_LCD_ESD_DET); pr_info("%s : GPIO_LCD_ESD_DET :%d\n",__func__, gpio_value); msleep(LCD_ESD_GPIO_CHECK_DELAY); gpio_value = gpio_get_value(GPIO_LCD_ESD_DET); pr_info("%s : GPIO_LCD_ESD_DET :%d After Delay %d ms \n",__func__, gpio_value,LCD_ESD_GPIO_CHECK_DELAY); #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 if(gpio_value) lcd_esd_seq(p_esd_data); } else { if(!gpio_value) lcd_esd_seq(p_esd_data); } #else lcd_esd_seq(p_esd_data); #endif } p_esd_data->esd_irq_enable = true; return; } #ifdef ESD_DEBUG static ssize_t mipi_samsung_esd_check_show(struct device *dev, struct device_attribute *attr, char *buf) { struct esd_data_t *p_esd_data = dev_get_drvdata(dev); char temp[20]; snprintf(temp, 20, "ESD Status:%d\n", p_esd_data->refresh_ongoing); strncat(buf, temp, 20); return strnlen(buf, 20); } static ssize_t mipi_samsung_esd_check_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size) { struct esd_data_t *p_esd_data = dev_get_drvdata(dev); sec_esd_irq_handler(0, p_esd_data); return 1; } static DEVICE_ATTR(esd_check, S_IRUGO , mipi_samsung_esd_check_show,\ mipi_samsung_esd_check_store); #endif static irqreturn_t sec_esd_irq_handler(int irq, void *handle) { struct esd_data_t *p_esd_data = (struct esd_data_t *) handle; struct msm_fb_data_type *mfd; if (!mipi_control.mipi_dev) return IRQ_HANDLED; else mfd = platform_get_drvdata(mipi_control.mipi_dev); if (!mfd->panel_power_on || p_esd_data->refresh_ongoing || p_esd_data->esd_irq_enable == false) { /* Panel is not powered ON So bogus ESD/ ESD Already executing*/ return IRQ_HANDLED; } #if defined(CONFIG_FB_MSM_MIPI_NOVATEK_VIDEO_HD_PT_PANEL) /* ESD occurred during Wakeup/Suspend, So ignore */ if (mfd->resume_state) return IRQ_HANDLED; #endif p_esd_data->esd_irq_enable = false; schedule_work(&p_esd_data->det_work); return IRQ_HANDLED; } #ifdef READ_REGISTER_ESD void esd_execute(void) { if (esd_enable->esd_irq_enable) { if (work_busy(&esd_enable->det_work)) pr_info("%s ESD work queue is working", __func__); else { pr_info("%s start", __func__); INIT_COMPLETION(esd_completion); schedule_work(&esd_enable->det_work); wait_for_completion_timeout(&esd_completion, 10 * HZ); pr_info("%s end", __func__); } } else pr_info("%s ESD is armed from ISR", __func__); } #endif void register_mipi_dev(struct platform_device *mipi_dev) { mipi_control.mipi_dev = mipi_dev; } static void set_esd_enable_work_func(struct work_struct *work) { pr_info("%s is called\n", __func__); esd_enable->esd_ignore = false; } void set_esd_enable(void) { pr_info("%s is called\n", __func__); if (!esd_enable) { pr_err("ESD Driver data is NULL!!\n"); return; } #if defined(CONFIG_FB_MSM_MIPI_NOVATEK_VIDEO_HD_PT_PANEL) schedule_delayed_work(&esd_enable->esd_enable_delay,\ msecs_to_jiffies(100)); #else schedule_delayed_work(&esd_enable->esd_enable_delay,\ msecs_to_jiffies(500)); #endif }