Beispiel #1
0
static void check_ddi_work(struct work_struct *work)
{
    int ret;
    unsigned char	ddi_status[DDI_STATUS_LEN];
    unsigned long	ms_jiffies = msecs_to_jiffies(3000);
    struct lcd_info *lcd =
        container_of(work, struct lcd_info, check_ddi.work);

    if (!lcd->connected) {
        printk(KERN_INFO "%s, lcd is disconnected\n", __func__);
        return;
    }

    /* check ldi status - should be ldi enabled.*/
    if (lcd->ldi_enable != 1) {
        printk(KERN_INFO "%s, ldi is disabled\n", __func__);
        goto out;
    }

    if (lcd->current_bl < GAMMA_100CD) {
        printk(KERN_INFO "%s, bl=%d\n", __func__, lcd->current_bl);
        goto out;
    }

    ret = s6e8ax0_read_ddi_status_reg(lcd, ddi_status);
    if (!ret) {
        printk(KERN_INFO "%s, read failed\n", __func__);
        set_dsim_hs_clk_toggle_count(0);
        s3cfb_reinitialize_lcd();
        return;
    }

    if (0x00 != ddi_status[0]) {/*0x9c*/
        /*printk(KERN_INFO "%s,
        normal ddi_status 0x%02x \n",__func__, ddi_status[0]);*/
        if (lcd->oled_detection_count)
            set_dsim_hs_clk_toggle_count(0);

        lcd->oled_detection_count = 0;
        ms_jiffies = msecs_to_jiffies(3000);
    } else {
        printk(KERN_INFO "%s, invalid ddi_status [0]=0x%02x\n",
               __func__, ddi_status[0]);
        if (lcd->oled_detection_count < 3) {
            lcd->oled_detection_count++;
            set_dsim_hs_clk_toggle_count(15);
            ms_jiffies = msecs_to_jiffies(500);
        } else {
            set_dsim_hs_clk_toggle_count(0);
            s3cfb_reinitialize_lcd();
            return;
        }
    }
out:
    schedule_delayed_work(&lcd->check_ddi, ms_jiffies);
    return;
}
Beispiel #2
0
static void check_ddi_work(struct work_struct *work)
{
	int ret;
	static int reinit_lcd_cnt = 0;
	unsigned char	ddi_status[DDI_STATUS_LEN];
	unsigned long	ms_jiffies = msecs_to_jiffies(1000);
	struct lcd_info *lcd =
		container_of(work, struct lcd_info, check_ddi.work);
	int oled_det_level = gpio_get_value(GPIO_OLED_DET);

	if (!lcd->connected) {
		printk(KERN_INFO "%s, lcd is disconnected\n", __func__);
		return;
	}

	if (lpcharge) {
		printk(KERN_INFO "%s, do not detect esd in lpcharge mode\n", __func__);
		return;
	}

	mutex_lock(&s3cfb_lock);

	// check ldi status - should be ldi enabled.
	if (lcd->ldi_enable != 1) {
		printk(KERN_INFO "%s, ldi is disabled\n", __func__);
		goto out;
	}

	if (!oled_det_level) {
		printk(KERN_INFO "%s, oled_det_pin detect esd\n", __func__);
		s3cfb_esd_detected = true;
		if (lcd->oled_detection_count < 10) {
			lcd->oled_detection_count++;
			set_dsim_hs_clk_toggle_count(15);
			ms_jiffies = HZ/8;
		} else {
			set_dsim_hs_clk_toggle_count(0);
			s3cfb_reinitialize_lcd();
			reinit_lcd_cnt++;
			ms_jiffies = msecs_to_jiffies(1000);
		}
		goto out;
	}

	if (oled_det_cnt++ < 3) goto out;

	/* if esd has been detected once, read ddi status periodically */
	if (!s3cfb_esd_detected) goto out;

	/* Do not read ddi status with low brightness */
	if (lcd->bl < LOW_GAMMA_LEVEL) goto out;

	ret = s6e8ax0_read_ddi_status_reg(lcd, ddi_status);
	if (!ret) {
		printk(KERN_INFO "%s, read failed\n", __func__);
		set_dsim_hs_clk_toggle_count(0);
		s3cfb_reinitialize_lcd();
		reinit_lcd_cnt++;
		ms_jiffies = msecs_to_jiffies(1000);
	}
	if (0x9C != ddi_status[0]) {
		printk(KERN_INFO "%s, invalid ddi_status 0x%x\n", __func__, ddi_status[0]);
		if (lcd->oled_detection_count < 3) {
			lcd->oled_detection_count++;
			set_dsim_hs_clk_toggle_count(15);
			ms_jiffies = msecs_to_jiffies(500);
		} else {
			set_dsim_hs_clk_toggle_count(0);
			s3cfb_reinitialize_lcd();
			reinit_lcd_cnt++;
			ms_jiffies = msecs_to_jiffies(1000);
		}
	} else {
		printk(KERN_INFO "%s, normal ddi_status 0x%x\n", __func__, ddi_status[0]);
		if (lcd->oled_detection_count) {
			set_dsim_hs_clk_toggle_count(0);
		}
		lcd->oled_detection_count = 0;
		reinit_lcd_cnt = 0;
		ms_jiffies = msecs_to_jiffies(1000);
	}
	oled_det_cnt = 0;
out:
	if (reinit_lcd_cnt < MAX_REINIT_CNT) {
//		printk(KERN_INFO "%s, schedule_delayed_work(%u msec)\n", __func__, jiffies_to_msecs(ms_jiffies));
		schedule_delayed_work(&lcd->check_ddi, ms_jiffies);
	}
	mutex_unlock(&s3cfb_lock);
	return;
}