コード例 #1
0
/**
  * Function called when the user closes file
  *
  * @return 0 on success, a negative value on failure.
  */
int
open_nfc_custom_release(struct inode *inode, struct file *filp)
{
	struct open_nfc_custom_device *p_device = filp->private_data;

	ENTER();
	
	if (!p_device) {
		printk("open_nfc_custom_release: Internal error p_device is missing\n");
		return -ENODEV;
	}

	mutex_lock(&p_device->mutex);

	opennfc_struct_cleanup(p_device);	/* Go back to PROBED state */

#ifndef WAKE_AND_PURGE_I2C_ON_LOAD
//	disable_irq(p_device->irqout);
    mt65xx_eint_mask(CUST_EINT_NFC_NUM);
#endif /* WAKE_AND_PURGE_I2C_ON_LOAD */

	mutex_unlock(&p_device->mutex);

	return 0;
}
コード例 #2
0
int hdmi_drv_power_on(void)
{
    int ret = 0;
	HDMI_FUNC();
	mt65xx_eint_mask(CUST_EINT_MHL_NUM);

#if 1
	SiiMhlTxHwGpioResume();
	//pmic_config_interface(0x87,0x1,0x01,0x0);
/* Vanzo:lubaoquan on: Tue, 21 May 2013 22:35:29 +0800
 * TODO: replace this line with your comment
 */
	hwPowerOn(MT65XX_POWER_LDO_VGP5, VOL_1200, "HDMI");
// End of Vanzo: lubaoquan
#endif

	//msleep(100);
    SiiMhlTxHwReset(5,5);

	//xuecheng
	HalInstallCheckDeviceCB(SiiCheckDevice);
    HalAcquireIsrLock();
    siHdmiTx_VideoSel(HDMI_720P60);
    siHdmiTx_AudioSel(I2S_44);
    ret = SiiMhlTxInitialize(EVENT_POLL_INTERVAL_MS);
    HalReleaseIsrLock();
	mt65xx_eint_unmask(CUST_EINT_MHL_NUM);
    return ret;
}
コード例 #3
0
/* Function to manage low power suspend */
void tpd_suspend(struct early_suspend *h)
{
	if(tpd_debuglog==1) {
		TPD_DMESG("[mtk-tpd] %s\n", __FUNCTION__); 
	}
  	tpd_halt = 1;	
	while(1){
		if(tpd_flag == 1) msleep(1000);
		else break;	
	}
    mt65xx_eint_mask(CUST_EINT_TOUCH_PANEL_NUM);

#ifdef TPD_POWER_SOURCE_CUSTOM
    hwPowerDown(TPD_POWER_SOURCE_CUSTOM, "TP");
#endif
#ifdef TPD_POWER_SOURCE_1800
    hwPowerDown(TPD_POWER_SOURCE_1800, "TP");
#endif
#ifdef GPIO_CTP_EN_PIN
    mt_set_gpio_mode(GPIO_CTP_EN_PIN, GPIO_CTP_EN_PIN_M_GPIO);
    mt_set_gpio_dir(GPIO_CTP_EN_PIN, GPIO_DIR_OUT);
    mt_set_gpio_out(GPIO_CTP_EN_PIN, GPIO_OUT_ZERO);
#endif
    mdelay(1);
    mt_set_gpio_mode(GPIO_CTP_RST_PIN, GPIO_CTP_RST_PIN_M_GPIO);
    mt_set_gpio_dir(GPIO_CTP_RST_PIN, GPIO_DIR_OUT);
    mt_set_gpio_out(GPIO_CTP_RST_PIN, GPIO_OUT_ZERO);    
}
コード例 #4
0
static void _mt8193_irq_handler(void)
{        
	MT8193_DRV_FUNC();
    atomic_set(&mt8193_nlh_event, 1);
    wake_up_interruptible(&mt8193_nlh_wq);
    
	mt65xx_eint_mask(CUST_EINT_EINT_HDMI_HPD_NUM);   
}
コード例 #5
0
void inno_irq_release(void)
{
	mt65xx_eint_mask(CUST_EINT_CMMB_NUM);   
	mt_set_gpio_pull_enable(GPIO_CMMB_EINT_PIN, 1);
	mt_set_gpio_pull_select(GPIO_CMMB_EINT_PIN,  0);
	mt_set_gpio_mode(GPIO_CMMB_EINT_PIN, GPIO_CMMB_EINT_PIN_M_GPIO);                 //set to eint MODE for enable eint function
	inno_msg("CMMB GPIO EINT PIN mode:num:%d, %d, dir:%d,pullen:%d,pullup%d",GPIO_CMMB_EINT_PIN,mt_get_gpio_mode(GPIO_CMMB_EINT_PIN),
			mt_get_gpio_dir(GPIO_CMMB_EINT_PIN),mt_get_gpio_pull_enable(GPIO_CMMB_EINT_PIN),mt_get_gpio_pull_select(GPIO_CMMB_EINT_PIN));    
//	mt_set_gpio_dir(GPIO_CMMB_EINT_PIN, GPIO_DIR_OUT);               // set to input avoid of leak power
}
コード例 #6
0
ファイル: oem.c プロジェクト: benoitm974/cink-peax
void oem_gpio_irq_mask(int gpio)
{
    int irq;

    irq = oem_gpio_to_irq(gpio);
    if(irq < 0){
        return ;
    }

    mt65xx_eint_mask(irq);
}
コード例 #7
0
static void pn544_disable_irq(struct pn544_dev *pn544_dev)
{
	unsigned long flags;

	spin_lock_irqsave(&pn544_dev->irq_enabled_lock, flags);
	if (pn544_dev->irq_enabled) {
        	mt65xx_eint_mask(EINT_NUM);
		pn544_dev->irq_enabled = false;
	}
	spin_unlock_irqrestore(&pn544_dev->irq_enabled_lock, flags);
}
コード例 #8
0
 static int touch_event_handler(void *para)
 {
 	int i;
	tinno_ts_point touch_point[TINNO_TOUCH_TRACK_IDS];
	struct sched_param param = { .sched_priority = RTPM_PRIO_TPD };
	tinno_ts_data *ts = (tinno_ts_data *)para;
	sched_setscheduler(current, SCHED_RR, &param);
	
	do {
		set_current_state(TASK_INTERRUPTIBLE); 
		wait_event_interruptible(waiter, tpd_flag!=0);
		tpd_flag = 0;
		memset(touch_point, FTS_INVALID_DATA, sizeof(touch_point));
		set_current_state(TASK_RUNNING);

            
            //LINE<JIRA_ID><DATE20130320><BUG_INFO>zenghaihui
            if(g_tp_charger_flag != g_pre_tp_charger_flag)
            {
                g_pre_tp_charger_flag = g_tp_charger_flag;
                g_need_refresh_tp_flag = 1;
            }

            if(g_need_refresh_tp_flag)
            {
                g_need_refresh_tp_flag = 0;
                fts_ft5316_switch_charger_status(g_tp_charger_flag);
            }
        
        
		if (!tpd_touchinfo(ts, &touch_point)) {

			if(ts->pcount > 0)
			{
				for ( i=0; i < ts->pcount; i++ )
				{
					tpd_down(ts, touch_point[i].x, touch_point[i].y, touch_point[i].pressure, touch_point[i].touch_id);//<20120714><for multi-touch id>wangyanhui
				}
				input_sync(tpd->dev);
			}
			else
			{
				tpd_up(ts, touch_point[0].x, touch_point[0].y, touch_point[0].pressure, touch_point[0].touch_id);
				input_sync(tpd->dev);
			}
            
            
		}
		
		mt65xx_eint_unmask(CUST_EINT_TOUCH_PANEL_NUM); 
	}while(!kthread_should_stop());
	mt65xx_eint_mask(CUST_EINT_TOUCH_PANEL_NUM); 
	return 0;
 }
コード例 #9
0
ファイル: board.c プロジェクト: nxglabs/mt6735-kernel-3.10.61
static void mt_combo_bgf_request_irq(void *data)
{
    mt65xx_eint_set_sens(CUST_EINT_COMBO_BGF_NUM, CUST_EINT_COMBO_BGF_SENSITIVE);
    mt65xx_eint_set_hw_debounce(CUST_EINT_COMBO_BGF_NUM, CUST_EINT_COMBO_BGF_DEBOUNCE_CN);
    mt65xx_eint_registration(CUST_EINT_COMBO_BGF_NUM,
        CUST_EINT_COMBO_BGF_DEBOUNCE_EN,
        CUST_EINT_COMBO_BGF_POLARITY,
        combo_bgf_eirq_handler,
        0);
    mt65xx_eint_mask(CUST_EINT_COMBO_BGF_NUM); /*2*/
    return;
}
コード例 #10
0
ファイル: pixcir168_driver.c プロジェクト: wufuyue/TCL_S820
//void tpd_suspend(struct i2c_client *client, pm_message_t message)
static void tpd_suspend( struct early_suspend *h )
{
    int ret = 0;
    unsigned char Wrbuf[2] = {0x14, 0x02};
    tpd_halt = 1;
    mt65xx_eint_mask(CUST_EINT_TOUCH_PANEL_NUM);

    i2c_client->addr = ( i2c_client->addr & I2C_MASK_FLAG ) | I2C_ENEXT_FLAG;
    ret = i2c_master_send(i2c_client, Wrbuf, 2);
    if(ret != sizeof(Wrbuf))
    {
        TPD_DEBUG("[mtk-tpd] i2c write communcate error during suspend: 0x%x\n", ret);
    }
}
コード例 #11
0
ファイル: board.c プロジェクト: nxglabs/mt6735-kernel-3.10.61
	static void combo_sdio_request_eirq(sdio_irq_handler_t irq_handler, void *data)
	{
	    mt65xx_eint_set_sens(combo_sdio_eint_num, CUST_EINT_WIFI_SENSITIVE); /*CUST_EINT_WIFI_NUM */
	    mt65xx_eint_set_hw_debounce(combo_sdio_eint_num, CUST_EINT_WIFI_DEBOUNCE_CN); /*CUST_EINT_WIFI_NUM */
	    mt65xx_eint_registration(combo_sdio_eint_num/*CUST_EINT_WIFI_NUM */,
	        CUST_EINT_WIFI_DEBOUNCE_EN,
	        CUST_EINT_WIFI_POLARITY,
	        combo_sdio_eirq_handler_stub,
	        0);
	    mt65xx_eint_mask(combo_sdio_eint_num);/*CUST_EINT_WIFI_NUM */
	
	    combo_sdio_eirq_handler = irq_handler;
	    combo_sdio_eirq_data    = data;
	}
コード例 #12
0
static ssize_t pn544_dev_write(struct file *filp, const char __user *buf, size_t count, loff_t *offset)
{
	struct pn544_dev *pn544_dev;
	int ret, i;
	char tmp[MAX_BUFFER_SIZE];

	pn544_dev = filp->private_data;

	if (count > MAX_BUFFER_SIZE)
		count = MAX_BUFFER_SIZE;

	if (copy_from_user(tmp, buf, count)) {
		pr_err("pn544 %s : failed to copy from user space\n", __func__);
		return -EFAULT;
	}

	printk("pn544 copy from user:"******" %02X", tmp[i]);
	}
	printk("\n");
    
	if (pn544_dev->irq_enabled) {
        	mt65xx_eint_mask(EINT_NUM);
		pn544_dev->irq_enabled = false;
        	printk("pn544 write mask eint\n");
	}

	printk("pn544 %s : writing %zu bytes.\n", __func__, count);
	/* Write data */
	ret = i2c_master_send(pn544_dev->client, tmp, count);
	if (ret != count) {
		pr_err("pn544 %s : i2c_master_send returned %d\n", __func__, ret);
		ret = -EIO;
	}
	printk("pn544 PC->IFD:");
	for(i = 0; i < count; i++) {
		printk(" %02X", tmp[i]);
	}
	printk("\n");
	
	if (!pn544_dev->irq_enabled) {
        	mt65xx_eint_unmask(EINT_NUM);
		pn544_dev->irq_enabled = true;
        	printk("pn544 write unmask eint\n");
	}

	return ret;
}
コード例 #13
0
ファイル: board.c プロジェクト: SiddheshK15/s9086b_wet_kk
static void mtk_wcn_cmb_sdio_request_eirq(sdio_irq_handler_t irq_handler, void *data)
{
    mtk_wcn_sdio_irq_flag_set (0);
    mtk_wcn_cmb_sdio_eirq_data    = data;
    mtk_wcn_cmb_sdio_eirq_handler = irq_handler;
    mt65xx_eint_set_sens(mtk_wcn_cmb_sdio_eint_num, CUST_EINT_WIFI_SENSITIVE); /*CUST_EINT_WIFI_NUM */
    mt65xx_eint_set_hw_debounce(mtk_wcn_cmb_sdio_eint_num, CUST_EINT_WIFI_DEBOUNCE_CN); /*CUST_EINT_WIFI_NUM */
    mt_set_gpio_pull_enable(mtk_wcn_cmb_sdio_eint_pin, GPIO_PULL_ENABLE);
    mt_set_gpio_pull_select(mtk_wcn_cmb_sdio_eint_pin, GPIO_PULL_UP);
    mt65xx_eint_registration(mtk_wcn_cmb_sdio_eint_num/*CUST_EINT_WIFI_NUM */,
        CUST_EINT_WIFI_DEBOUNCE_EN,
        CUST_EINT_WIFI_POLARITY,
        mtk_wcn_cmb_sdio_eirq_handler_stub,
        0);
    mt65xx_eint_mask(mtk_wcn_cmb_sdio_eint_num);/*CUST_EINT_WIFI_NUM */

}
コード例 #14
0
/**
  * Device/Driver binding: probe
  *
  * @return 0 if successfull, or error code
  */
static int
opennfc_probe(struct i2c_client *client, const struct i2c_device_id *idp)
{
	int             rc = 0;
	struct open_nfc_custom_device *p_device = open_nfc_p_device;

	ENTER();
	
	if (!p_device) {
		printk("opennfc_probe: Internal error p_device is missing\n");
		return -ENODEV;
	}

	mutex_lock(&p_device->mutex);

	if (p_device->state != CUSTOM_INIT) {
		rc = EEXIST;
		goto out;
	}

	p_device->i2c_client = client;
	i2c_set_clientdata(client, p_device);

#if 0
	rc = request_irq(p_device->irqout, open_nfc_i2c_interrupt, IRQF_TRIGGER_HIGH, "IRQOUT_input", p_device);
	if (rc < 0) {
		printk(KERN_ERR "opennfc_probe : failed to register IRQOUT\n");
		goto out;
	}
#endif
	
	/* The IRQ can be trigged here at most once, because we are holding the mutex (cannot be re-enabled after disable) */
	
#ifndef WAKE_AND_PURGE_I2C_ON_LOAD
//	disable_irq(p_device->irqout);
    mt65xx_eint_mask(CUST_EINT_NFC_NUM);
#endif /* WAKE_AND_PURGE_I2C_ON_LOAD */

	p_device->state = CUSTOM_PROBED;
	
      out:
	mutex_unlock(&p_device->mutex);

		
	return rc;
}
コード例 #15
0
void hdmi_drv_power_on(void)
{
	HDMI_FUNC();
	mt65xx_eint_mask(CUST_EINT_HDMI_HPD_NUM);
	SiiMhlTxHwGpioResume();
	pmic_config_interface(0x87,0x1,0x01,0x0);
	//msleep(100);
    SiiMhlTxHwReset(50,200);

	//xuecheng
	HalInstallCheckDeviceCB(SiiCheckDevice);
    HalAcquireIsrLock();
    siHdmiTx_VideoSel(HDMI_720P60);
    siHdmiTx_AudioSel(I2S_44);
    SiiMhlTxInitialize(EVENT_POLL_INTERVAL_MS);
    HalReleaseIsrLock();
	mt65xx_eint_unmask(CUST_EINT_HDMI_HPD_NUM);
}
コード例 #16
0
static          irqreturn_t
open_nfc_i2c_interrupt(int irq, void *dev_id)
{
	struct open_nfc_custom_device *p_device = open_nfc_p_device;

	ENTER();
	
//	disable_irq_nosync(irq);
    mt65xx_eint_mask(CUST_EINT_NFC_NUM);
	
	if (!p_device) {
		printk("open_nfc_i2c_interrupt: Internal error p_device is missing, disabing the IRQ\n");
	} else {
		/* continue the processing outside the irq handler */
		schedule_work(&p_device->irqout_event_work);
	}

	return IRQ_HANDLED;
}
コード例 #17
0
INT32 wmt_plat_wifi_eint_ctrl(ENUM_PIN_STATE state)
{
#if 0 /*def GPIO_WIFI_EINT_PIN*/
    switch(state)
    {
        case PIN_STA_INIT:
            mt_set_gpio_pull_enable(GPIO_WIFI_EINT_PIN, GPIO_PULL_DISABLE);
            mt_set_gpio_dir(GPIO_WIFI_EINT_PIN, GPIO_DIR_OUT);
            mt_set_gpio_mode(GPIO_WIFI_EINT_PIN, GPIO_MODE_GPIO);
            mt_set_gpio_out(GPIO_WIFI_EINT_PIN, GPIO_OUT_ONE);
            break;
        case PIN_STA_MUX:
            mt_set_gpio_mode(GPIO_WIFI_EINT_PIN, GPIO_WIFI_EINT_PIN_M_GPIO);
            mt_set_gpio_pull_enable(GPIO_WIFI_EINT_PIN, GPIO_PULL_ENABLE);
            mt_set_gpio_pull_select(GPIO_WIFI_EINT_PIN, GPIO_PULL_UP);
            mt_set_gpio_mode(GPIO_WIFI_EINT_PIN, GPIO_WIFI_EINT_PIN_M_EINT);

            break;
        case PIN_STA_EINT_EN:
            mt65xx_eint_unmask(CUST_EINT_WIFI_NUM);
            break;
        case PIN_STA_EINT_DIS:
            mt65xx_eint_mask(CUST_EINT_WIFI_NUM);
            break;
        case PIN_STA_IN_L:
        case PIN_STA_DEINIT:
            /*set to gpio input low, pull down enable*/
            mt_set_gpio_mode(GPIO_WIFI_EINT_PIN, GPIO_COMBO_BGF_EINT_PIN_M_GPIO);
            mt_set_gpio_dir(GPIO_WIFI_EINT_PIN, GPIO_DIR_IN);
            mt_set_gpio_pull_select(GPIO_WIFI_EINT_PIN, GPIO_PULL_DOWN);
            mt_set_gpio_pull_enable(GPIO_WIFI_EINT_PIN, GPIO_PULL_ENABLE);
            break;
        default:
            WMT_WARN_FUNC("WMT-PLAT:Warnning, invalid state(%d) on WIFI EINT\n", state);
            break;
    }
#else
    WMT_INFO_FUNC("WMT-PLAT:WIFI EINT is controlled by MSDC driver \n");
#endif
    return 0;
}
コード例 #18
0
ファイル: hall.c プロジェクト: georgewhite5/dhow
static void hall_eint_work_callback(struct work_struct *work)
{
	bool cover;
	u8 old_state = hall_cover_state;
	
	mt65xx_eint_mask(CUST_EINT_MHALL_NUM);
	DOCK_DEBUG("[hall] hall_cover_state = %d\n", hall_cover_state );
        hall_cover_state = !mt_get_gpio_in(GPIO_MHALL_EINT_PIN);
	if ( old_state ==  hall_cover_state )
	{
		DOCK_ERR("[hall] no hall state changed!!!\n");
		//mt65xx_eint_unmask(CUST_EINT_MHALL_NUM);
		//return;
	}
	switch_set_state((struct switch_dev *)&hall_data, hall_cover_state);

	//input_report_switch(kpd_input_dev, SW_LID, hall_cover_state);
	//input_sync(kpd_input_dev);
	mt65xx_eint_set_polarity(CUST_EINT_MHALL_NUM, !old_state);
	mt65xx_eint_unmask(CUST_EINT_MHALL_NUM);
}
コード例 #19
0
/* platform device functions */
void tpd_suspend(struct early_suspend *h)
{
	TPD_DEBUG("[mtk-tpd] Suspend++.\n");
	if(isUpgrade ==1)
	{
	    TPD_DEBUG("Magnum tp is Upgrading.....\r\n");
		return;
	}
	mt65xx_eint_mask(CUST_EINT_TOUCH_PANEL_NUM);
	if(tpd_down_state){
	    tpd_up(down_x,down_y,NULL);
	//Ivan        input_report_abs(tpd->dev, ABS_MT_TRACKING_ID, 0);
	    input_sync(tpd->dev);
	    msleep(200);
	}
	tpd_status = 0;
	tinno_tp_power_off();
	TPD_DEBUG("[mtk-tpd] Suspend--.tpd_down_state=%d\n",tpd_down_state);
	if (ft5316_i2c_client == NULL)
		return;
}
コード例 #20
0
/**
  * Specific cleanup, when driver module is removed.
  *
  * @return void
  */
void
open_nfc_custom_exit(void)
{
	struct open_nfc_custom_device *p_device;

	ENTER();
	
	p_device = open_nfc_p_device;
	if (p_device == NULL)
		return;

	/* Go back to PROBED state if needed */
	opennfc_struct_cleanup(p_device);

	/* Remove the IRQ handler */
//	free_irq(p_device->irqout, p_device);
    mt65xx_eint_mask(CUST_EINT_NFC_NUM);

	/* stop any pending work */
	cancel_work_sync(&p_device->irqout_event_work);

	i2c_del_driver(&open_nfc_i2c_driver);

	/* release the other GPIO */
  gpio_free(GPIO_NFC_VEN_PIN);
  gpio_free(GPIO_NFC_EINT_PIN);

	del_timer(&p_device->sResetTimer);
	del_timer(&p_device->rx_timer);
	mutex_destroy(&p_device->mutex);

	/* free the custom device context */
	kfree(p_device);

	open_nfc_p_device = NULL;

}
コード例 #21
0
/* Function to manage low power suspend */
void tpd_suspend(struct early_suspend *h)
{
	//if(tpd_debuglog==1) {
		//TPD_DMESG("[mtk-tpd] %s\n", __FUNCTION__); 
	//}
	 tpd_halt = 1;
   	 mt65xx_eint_mask(CUST_EINT_TOUCH_PANEL_NUM);
#if 0
	uint8_t bfffer[2] = {0x01,0x00};
	tpd_i2c_master_rs_send(i2c_client,bfffer,1<<8|1);
	bfffer[1] &= ~0x0E;
	tpd_i2c_master_send(i2c_client,bfffer,2);
	
#ifdef TPD_HAVE_POWER_ON_OFF
	/*mt_set_gpio_mode(GPIO_CTP_EN_PIN, GPIO_CTP_EN_PIN_M_GPIO);
	mt_set_gpio_dir(GPIO_CTP_EN_PIN, GPIO_DIR_OUT);
	mt_set_gpio_out(GPIO_CTP_EN_PIN, GPIO_OUT_ZERO);*/

#endif

#endif
    tpd_hw_disable();

}
コード例 #22
0
ファイル: board.c プロジェクト: nxglabs/mt6735-kernel-3.10.61
	static void combo_sdio_disable_eirq(void)
	{
	    mt65xx_eint_mask(combo_sdio_eint_num); /* CUST_EINT_WIFI_NUM */
	}
コード例 #23
0
ファイル: board.c プロジェクト: nxglabs/mt6735-kernel-3.10.61
void mt_combo_bgf_disable_irq(void)
{
    mt65xx_eint_mask(CUST_EINT_COMBO_BGF_NUM);
    return;
}
コード例 #24
0
ファイル: board.c プロジェクト: SiddheshK15/s9086b_wet_kk
static void mtk_wcn_cmb_sdio_disable_eirq(void)
{
    mt65xx_eint_mask(mtk_wcn_cmb_sdio_eint_num); /* CUST_EINT_WIFI_NUM */
}
コード例 #25
0
static int gt927_diffdata_read_proc(char *page, char **start, off_t off, int count, int *eof, void *data)
{
    int driving_num = 0;
    int sensing_num = 0;
    int i;
    char *ptr = page;
    u8 *buf;
    mt65xx_eint_mask(CUST_EINT_TOUCH_PANEL_NUM);
    driving_num += (config[27 + GTP_ADDR_LENGTH] & 0x1F);
    driving_num += (config[28 + GTP_ADDR_LENGTH] & 0x1F);
    sensing_num += (config[29 + GTP_ADDR_LENGTH] & 0x0F);
    sensing_num += (config[29 + GTP_ADDR_LENGTH] & 0xF0) >> 4;
    GTP_INFO("TPD driving_num %d", driving_num);
    GTP_INFO("TPD sensing_num %d", sensing_num);
    buf = (u8 *)kzalloc(driving_num * sensing_num, GFP_KERNEL);

    //0x8040 write 1 for rawdata/diff access
    buf[0] = 1;
    i2c_write_bytes(i2c_client_point, GTP_REG_SLEEP, buf, 1);

    // wait for normal INT finished
    while (tpd_flag == 1)
    {
        msleep(20);
    }

    msleep(100);

    //check for raw data ready
    i2c_read_bytes(i2c_client_point, GTP_READ_COOR_ADDR, buf, 1);

    while (buf[0] == 0)
    {
        //wait for data ready
        GTP_INFO("Wati for raw data");
        i2c_read_bytes(i2c_client_point, GTP_READ_COOR_ADDR, buf, 1);
        GTP_INFO("0x814E : %2X", buf[0]);
        buf[0] &=  0x80;
        msleep(5);
    }

    i2c_read_bytes(i2c_client_point, GTP_DIFFDATA_REG, buf, driving_num * sensing_num);

    for (i = 0 ; i < driving_num * sensing_num; i = i + 1)
    {
        ptr += sprintf(ptr, "%d\t", buf[i]);

        if ((i % (sensing_num)) == (sensing_num - 1))
            ptr += sprintf(ptr, "\n");
    }

    //clear data ready status
    buf[0] = 0;
    i2c_write_bytes(i2c_client_point, GTP_READ_COOR_ADDR, buf, 1);

    //0x8040 write 0 for leaving rawdata/diff access mode
    buf[0] = 0;
    i2c_write_bytes(i2c_client_point, GTP_REG_SLEEP, buf, 1);

    mt65xx_eint_unmask(CUST_EINT_TOUCH_PANEL_NUM);
    kfree(buf);
    *eof = 1;
    return (ptr - page);
}
コード例 #26
0
 static int __devinit tpd_probe(struct i2c_client *client, const struct i2c_device_id *id)
 {	 
	int retval = TPD_OK;
	int panel_version = 0;
	int panel_vendor = 0;
	int iRetry = 3;
	tinno_ts_data *ts;
	int ret = 0;
	
	if ( tpd_load_status ){
		printk("[ft5x06] %s:Already probed a TP, needn't to probe any more!",__func__);
		return -1;
	}

	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
		dev_err(&client->dev,"need I2C_FUNC_I2C");
		ret = -ENODEV;
		goto err_check_functionality_failed;
	}

	ts = kzalloc(sizeof(tinno_ts_data), GFP_KERNEL);
	if (ts == NULL) {
		ret = -ENOMEM;
		goto err_alloc_data_failed;
	}
	
	printk("[ft5x06] %s:TPD enter tpd_probe ts=0x%p, TPD_RES_X=%d, TPD_RES_Y=%d, addr=0x%x\n", __func__, ts, TPD_RES_X, TPD_RES_Y, client->addr);
	memset(ts, 0, sizeof(tinno_ts_data));
	g_pts = ts;

	client->timing = I2C_MASTER_CLOCK;
	ts->client = client;
	ts->start_reg = 0x00;
	atomic_set( &ts->ts_sleepState, 0 );
	mutex_init(&ts->mutex);

	i2c_set_clientdata(client, ts);

	fts_5x06_hw_init();
	msleep(120);
	
	fts_iic_init(ts);

	if ( fts_5x06_isp_init(ts) ){
		goto err_isp_register;
	}

	while (iRetry) {
		ret = ft5x06_get_vendor_version(ts, &panel_vendor, &panel_version);
		if ( panel_version < 0 || panel_vendor<0 || ret<0 ){
			printk("[ft5x06] %s: Product version is %d\n", __func__, panel_version);
			fts_5x06_hw_reset();
		}else{
            printk("[ft5x06] %s: panel_vendor =%x, panel_version=%x\n", __func__, panel_vendor, panel_version);
			break;
		}
		iRetry--;
		msleep(15);  
	} 
	if ( panel_version < 0 || panel_vendor<0 || ret<0 ){
		goto err_get_version;
	}
#ifdef TPD_HAVE_BUTTON 
	tinno_update_tp_button_dim(panel_vendor);
#endif
#ifdef CONFIG_TOUCHSCREEN_FT5X05_DISABLE_KEY_WHEN_SLIDE
	if ( fts_keys_init(ts) ){
		fts_keys_deinit();
		goto err_get_version;
	}
#endif
	
	mt_set_gpio_mode(GPIO_CTP_EINT_PIN, GPIO_CTP_EINT_PIN_M_EINT);
	mt_set_gpio_dir(GPIO_CTP_EINT_PIN, GPIO_DIR_IN);
	mt_set_gpio_pull_enable(GPIO_CTP_EINT_PIN, GPIO_PULL_ENABLE);
	mt_set_gpio_pull_select(GPIO_CTP_EINT_PIN, GPIO_PULL_UP);
 
 	mt65xx_eint_set_sens(CUST_EINT_TOUCH_PANEL_NUM, CUST_EINT_TOUCH_PANEL_SENSITIVE);
	mt65xx_eint_set_hw_debounce(CUST_EINT_TOUCH_PANEL_NUM, CUST_EINT_TOUCH_PANEL_DEBOUNCE_CN);
	mt65xx_eint_registration(CUST_EINT_TOUCH_PANEL_NUM, CUST_EINT_TOUCH_PANEL_DEBOUNCE_EN, CUST_EINT_TOUCH_PANEL_POLARITY, tpd_eint_interrupt_handler, 0); 
 
	ts->thread = kthread_run(touch_event_handler, ts, TPD_DEVICE);
	 if (IS_ERR(ts->thread)){ 
		  retval = PTR_ERR(ts->thread);
		  printk("[ft5x06] %s: failed to create kernel thread: %d\n", __func__, retval);
			goto err_start_touch_kthread;
	}

	tpd_load_status = 1;
	mt65xx_eint_unmask(CUST_EINT_TOUCH_PANEL_NUM); 
	
	printk("[ft5x06] %s:Touch Panel Device(%s) Probe PASS\n", __func__, fts_get_vendor_name(panel_vendor));
//#if defined (TINNO_ANDROID_S9091) || defined (TINNO_ANDROID_S8121) || defined(TINNO_ANDROID_S8111B)
#if 1
{
	extern char tpd_desc[50];
	extern int tpd_fw_version;
	sprintf(tpd_desc, "%s", fts_get_vendor_name(panel_vendor));
	tpd_fw_version = panel_version;
}
#endif

//LINE<JIRA_ID><DATE20130402><add for focaltech debug>zenghaihui
#ifdef FTS_CTL_IIC
        if (ft_rw_iic_drv_init(client) < 0)
            dev_err(&client->dev, "%s:[FTS] create fts control iic driver failed\n",
                    __func__);
#endif

    //LINE<JIRA_ID><DATE20130320><add charger flag>zenghaihui
    g_need_refresh_tp_flag = 1;
    
	return 0;
   
err_start_touch_kthread:
	mt65xx_eint_mask(CUST_EINT_TOUCH_PANEL_NUM); 
err_get_version:
err_isp_register:
  #ifdef CONFIG_TOUCHSCREEN_POWER_DOWN_WHEN_SLEEP
	hwPowerDown(MT65XX_POWER_LDO_VGP5, "touch"); 
  #endif	
	fts_5x06_isp_exit();
	mutex_destroy(&ts->mutex);
	g_pts = NULL;
	kfree(ts);
err_alloc_data_failed:
err_check_functionality_failed:
	printk("[ft5x06] %s:Touch Panel Device Probe FAIL\n", __func__);
	return -1;
 }
コード例 #27
0
static void tpd_suspend(struct early_suspend *h)
 {
	int ret = 0;
	int iRetry = 5;
	const char data = 0x3;
 
	if ( g_pts ){
		 CTP_DBG("TPD enter sleep\n");
		if (atomic_read(&g_pts->isp_opened)){
			CTP_DBG("isp is already opened.");
			return;
		}

		 mt65xx_eint_mask(CUST_EINT_TOUCH_PANEL_NUM);
		mutex_lock(&g_pts->mutex);//Unlock on resume
		 
#ifdef CONFIG_TOUCHSCREEN_FT5X05_DISABLE_KEY_WHEN_SLIDE
		fts_5x06_key_cancel();
#endif

#ifdef CONFIG_TOUCHSCREEN_POWER_DOWN_WHEN_SLEEP
	mt_set_gpio_mode(GPIO_CTP_RST_PIN, GPIO_CTP_RST_PIN_M_GPIO);
	mt_set_gpio_dir(GPIO_CTP_RST_PIN, GPIO_DIR_OUT);
	mt_set_gpio_out(GPIO_CTP_RST_PIN, GPIO_OUT_ZERO);
	msleep(2);
#if 1 // def MT6577
		hwPowerDown(MT65XX_POWER_LDO_VGP5, "touch"); 
#else
		mt_set_gpio_mode(GPIO_CTP_EN_PIN, GPIO_CTP_EN_PIN_M_GPIO);
		mt_set_gpio_dir(GPIO_CTP_EN_PIN, GPIO_DIR_OUT);
		mt_set_gpio_out(GPIO_CTP_EN_PIN, GPIO_OUT_ZERO);
#endif	
#else //!CONFIG_TOUCHSCREEN_POWER_DOWN_WHEN_SLEEP
		//make sure the WakeUp is high before it enter sleep mode, 
		//otherwise the touch can't be resumed.
		//mt_set_gpio_mode(GPIO_CTP_EN_PIN, GPIO_CTP_EN_PIN_M_GPIO);
		//mt_set_gpio_dir(GPIO_CTP_EN_PIN, GPIO_DIR_OUT);
		//mt_set_gpio_out(GPIO_CTP_EN_PIN, GPIO_OUT_ONE);
		//msleep(1);  

		while (iRetry) {
			ret = i2c_smbus_write_i2c_block_data(g_pts->client, 0xA5, 1, &data);  //TP enter sleep mode
			if ( ret < 0 ){
				TPD_DMESG("Enter sleep mode is %d\n", ret);
#if 1 // def MT6577
				hwPowerDown(MT65XX_POWER_LDO_VGP5, "touch"); 
#else
				mt_set_gpio_mode(GPIO_CTP_EN_PIN, GPIO_CTP_EN_PIN_M_GPIO);
				mt_set_gpio_dir(GPIO_CTP_EN_PIN, GPIO_DIR_OUT);
				mt_set_gpio_out(GPIO_CTP_EN_PIN, GPIO_OUT_ZERO);
#endif	
				msleep(2);  
				fts_5x06_hw_init();
			}else{
				break;
			}
			iRetry--;
			msleep(100);  
		} 
#endif//CONFIG_TOUCHSCREEN_POWER_DOWN_WHEN_SLEEP

		atomic_set( &g_pts->ts_sleepState, 1 );
	}
 } 
コード例 #28
0
void cm_disable_ext_md_wakeup_irq(void)
{
	mt65xx_eint_mask(CUST_EINT_DT_EXT_MD_WK_UP_NUM);
}
コード例 #29
0
void cm_disable_ext_md_wdt_irq(void)
{
	mt65xx_eint_mask(CUST_EINT_DT_EXT_MD_WDT_NUM);
}
コード例 #30
0
INT32
wmt_plat_eirq_ctrl (
    ENUM_PIN_ID id,
    ENUM_PIN_STATE state
    )
{
    INT32 iret;

    // TODO: [ChangeFeature][GeorgeKuo]: use another function to handle this, as done in gpio_ctrls

    if ( (PIN_STA_INIT != state )
        && (PIN_STA_DEINIT != state )
        && (PIN_STA_EINT_EN != state )
        && (PIN_STA_EINT_DIS != state ) ) {
        WMT_WARN_FUNC("WMT-PLAT:invalid PIN_STATE(%d) in eirq_ctrl for PIN(%d)\n", state, id);
        return -1;
    }

    iret = -2;
    switch (id) {
    case PIN_BGF_EINT:
#ifdef GPIO_COMBO_BGF_EINT_PIN
        if (PIN_STA_INIT == state) {
            mt65xx_eint_set_sens(CUST_EINT_COMBO_BGF_NUM, CUST_EINT_COMBO_BGF_SENSITIVE);
            mt65xx_eint_set_hw_debounce(CUST_EINT_COMBO_BGF_NUM, CUST_EINT_COMBO_BGF_DEBOUNCE_CN);
            mt65xx_eint_registration(CUST_EINT_COMBO_BGF_NUM,
                CUST_EINT_COMBO_BGF_DEBOUNCE_EN,
                CUST_EINT_COMBO_BGF_POLARITY,
                wmt_plat_bgf_eirq_cb,
                0);
            mt65xx_eint_mask(CUST_EINT_COMBO_BGF_NUM); /*2*/
        }
        else if (PIN_STA_EINT_EN == state) {
             mt65xx_eint_unmask(CUST_EINT_COMBO_BGF_NUM);
             WMT_DBG_FUNC("WMT-PLAT:BGFInt (en) \n");
        }
        else if (PIN_STA_EINT_DIS == state) {
            mt65xx_eint_mask(CUST_EINT_COMBO_BGF_NUM);
            WMT_DBG_FUNC("WMT-PLAT:BGFInt (dis) \n");
        }
        else {
            mt65xx_eint_mask(CUST_EINT_COMBO_BGF_NUM);
            /* de-init: nothing to do in ALPS, such as un-registration... */
        }
#else
        WMT_INFO_FUNC("WMT-PLAT:BGF EINT not defined\n", state);
#endif
        iret = 0;
        break;

    case PIN_ALL_EINT:
#ifdef GPIO_COMBO_ALL_EINT_PIN
        if (PIN_STA_INIT == state) {
            #if 0
            mt65xx_eint_set_sens(CUST_EINT_COMBO_ALL_NUM, CUST_EINT_COMBO_ALL_SENSITIVE);
            mt65xx_eint_set_hw_debounce(CUST_EINT_COMBO_ALL_NUM, CUST_EINT_COMBO_ALL_DEBOUNCE_CN);
            mt65xx_eint_registration(CUST_EINT_COMBO_ALL_NUM,
                CUST_EINT_COMBO_ALL_DEBOUNCE_EN,
                CUST_EINT_COMBO_ALL_POLARITY,
                combo_bgf_eirq_handler,
                0);
            #endif
            mt65xx_eint_mask(CUST_EINT_COMBO_ALL_NUM); /*2*/
            WMT_DBG_FUNC("WMT-PLAT:ALLInt (INIT but not used yet) \n");
        }
        else if (PIN_STA_EINT_EN == state) {
             /*mt65xx_eint_unmask(CUST_EINT_COMBO_ALL_NUM);*/
             WMT_DBG_FUNC("WMT-PLAT:ALLInt (EN but not used yet) \n");
        }
        else if (PIN_STA_EINT_DIS == state) {
            mt65xx_eint_mask(CUST_EINT_COMBO_ALL_NUM);
            WMT_DBG_FUNC("WMT-PLAT:ALLInt (DIS but not used yet) \n");
        }
        else {
            mt65xx_eint_mask(CUST_EINT_COMBO_ALL_NUM);
            WMT_DBG_FUNC("WMT-PLAT:ALLInt (DEINIT but not used yet) \n");
            /* de-init: nothing to do in ALPS, such as un-registration... */
        }
#else
        WMT_INFO_FUNC("WMT-PLAT:ALL EINT not defined\n", state);
#endif
        iret = 0;
        break;

    default:
        WMT_WARN_FUNC("WMT-PLAT:unsupported EIRQ(PIN_ID:%d) in eirq_ctrl\n", id);
        iret = -1;
        break;
    }

    return iret;
}