Exemplo n.º 1
0
void rtw_register_early_suspend(struct pwrctrl_priv *pwrpriv)
{
	DBG_871X("%s\n", __FUNCTION__);

	//jeff: set the early suspend level before blank screen, so we wll do late resume after scree is lit
	pwrpriv->early_suspend.level = ANDROID_EARLY_SUSPEND_LEVEL_BLANK_SCREEN - 20;
	pwrpriv->early_suspend.suspend = rtw_early_suspend;
	pwrpriv->early_suspend.resume = rtw_late_resume;
	android_register_early_suspend(&pwrpriv->early_suspend);	
}
Exemplo n.º 2
0
static int  ft5406_probe(struct i2c_client *client ,const struct i2c_device_id *id)
{
	struct ft5x0x_ts_data *ft5x0x_ts;
	struct input_dev *input_dev;
	struct ft5406_platform_data *pdata = pdata = client->dev.platform_data;

	int err = 0;
	int ret = 0;
	u8 buf_w[1];
	u8 buf_r[1];

	printk("==ft5x0x_ts_probe=\n");
	
	if (!pdata) {
		dev_err(&client->dev, "platform data is required!\n");
		return -EINVAL;
	}	

	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C))
		return -EIO;
	
	
	ft5x0x_ts = kzalloc(sizeof(*ft5x0x_ts), GFP_KERNEL);
	if (!ft5x0x_ts)	{
		err = -ENOMEM;
		goto exit_alloc_data_failed;
	}
/*
	ft5x0x_client.adapter = bus;
	ft5x0x_client.addr= address;
	ft5x0x_client.mode = NORMALMODE; //NORMALNOSTOPMODE;// DIRECTMODE;
	ft5x0x_client.Channel = I2C_CH0;
	ft5x0x_client.speed = 300;
	ft5x0x_client.addressBit=I2C_7BIT_ADDRESS_8BIT_REG;
	ft5x0x_ts->client=&ft5x0x_client; 

	i2c_set_clientdata(&ft5x0x_client, ft5x0x_ts);

	err = i2c_attach_client(&ft5x0x_client);
	if (err < 0)
	{
		printk("ft5x0x attach client failed!!!!\n");
		goto exit_alloc_data_failed;
	}

	INIT_WORK(&ft5x0x_ts->pen_event_work, ft5x0x_ts_pen_irq_work);
	ft5x0x_ts->ts_workqueue = create_singlethread_workqueue("ft5x0x_ts");
	if (!ft5x0x_ts->ts_workqueue) {
		err = -ESRCH;
		goto exit_create_singlethread;
	}

	rockchip_mux_api_set(TOUCH_INT_IOMUX_PINNAME,TOUCH_INT_IOMUX_PINDIR);
	GPIOSetPinDirection(TOUCH_INT_IOPIN, GPIO_IN);
	GPIOPullUpDown(TOUCH_INT_IOPIN, GPIOPullUp);
	err = request_gpio_irq(TOUCH_INT_IOPIN, ft5x0x_ts_interrupt, GPIOEdgelFalling, ft5x0x_ts);
	if(err < 0)
	{
		printk("ft5x0x_probe: request irq failed\n");
		goto exit_irq_request_failed;
	}
*/
	input_dev = input_allocate_device();
	if (!input_dev) {
		err = -ENOMEM;
		printk("failed to allocate input device\n");
		goto exit_input_dev_alloc_failed;
	}

	ft5x0x_ts->client = client;
	ft5x0x_ts->irq = client->irq;
	ft5x0x_ts->input_dev = input_dev;

#ifdef CONFIG_FT5X0X_MULTITOUCH
	set_bit(ABS_MT_TOUCH_MAJOR, input_dev->absbit);
	set_bit(ABS_MT_POSITION_X, input_dev->absbit);
	set_bit(ABS_MT_POSITION_Y, input_dev->absbit);
	set_bit(ABS_MT_WIDTH_MAJOR, input_dev->absbit);
	
	//input_dev->evbit[0] = BIT_MASK(EV_ABS)|BIT_MASK(EV_KEY)|BIT_MASK(EV_SYN);                  //harry 03.21
	      //  set_bit(KEY_HOME, input_dev->keybit);

	input_set_abs_params(input_dev,
			     ABS_MT_POSITION_X, 0, SCREEN_MAX_X, 0, 0);
	input_set_abs_params(input_dev,
			     ABS_MT_POSITION_Y, 0, SCREEN_MAX_Y, 0, 0);
	input_set_abs_params(input_dev,
			     ABS_MT_TOUCH_MAJOR, 0, PRESS_MAX, 0, 0);
	input_set_abs_params(input_dev,
			     ABS_MT_WIDTH_MAJOR, 0, 200, 0, 0);
	input_set_abs_params(input_dev, ABS_MT_TRACKING_ID, 0, 10, 0, 0);
#else
	set_bit(ABS_X, input_dev->absbit);
	set_bit(ABS_Y, input_dev->absbit);
	set_bit(ABS_PRESSURE, input_dev->absbit);
	set_bit(BTN_TOUCH, input_dev->keybit);

	input_set_abs_params(input_dev, ABS_X, 0, SCREEN_MAX_X, 0, 0);
	input_set_abs_params(input_dev, ABS_Y, 0, SCREEN_MAX_Y, 0, 0);
	input_set_abs_params(input_dev,
			     ABS_PRESSURE, 0, PRESS_MAX, 0 , 0);
#endif


	set_bit(EV_ABS, input_dev->evbit);
	set_bit(EV_KEY, input_dev->evbit);

	//set_bit(EV_SYN, input_dev->evbit);              //harry 03.21

	input_dev->name		= FT5X0X_NAME;		//dev_name(&client->dev)
	err = input_register_device(input_dev);
	if (err) {
		printk("ft5x0x_ts_probe: failed to register input device: \n");
		goto exit_input_register_device_failed;
	}

#if 0//def CONFIG_HAS_EARLYSUSPEND
	ts_early_suspend.suspend = ft5x0x_ts_suspend;
	ts_early_suspend.resume	= ft5x0x_ts_resume;
    android_register_early_suspend(&ts_early_suspend);
#endif
	printk("==probe over =\n");
	if (pdata->init_platform_hw)                              
		pdata->init_platform_hw();

	if (!ft5x0x_ts->irq) {
		dev_dbg(&ft5x0x_ts->client->dev, "no IRQ?\n");
		return -ENODEV;
	}else{
		ft5x0x_ts->irq = gpio_to_irq(ft5x0x_ts->irq);
	}

	INIT_WORK(&ft5x0x_ts->pen_event_work, ft5x0x_ts_pen_irq_work);
	ft5x0x_ts->ts_workqueue = create_singlethread_workqueue("ft5x0x_ts");
	if (!ft5x0x_ts->ts_workqueue) {
		err = -ESRCH;
		goto exit_create_singlethread;
	}



	printk("client->dev.driver->name %s  ,%d \n",client->dev.driver->name,ft5x0x_ts->irq);


	ret = request_irq(ft5x0x_ts->irq, ft5x0x_ts_interrupt, IRQF_TRIGGER_LOW,
			client->dev.driver->name, ft5x0x_ts);
	
	if (ret < 0) {
		dev_err(&client->dev, "irq %d busy?\n", ft5x0x_ts->irq);
		goto fail3;
	}
	
	ret = input_register_device(input_dev);	
	if(ret<0)
	{
		printk("ft5406 register input device failed!!!!\n");
		goto exit_irq_request_failed;
	}
	

	buf_w[0] = 6;
	err = ft5406_set_regs(client,0x88,buf_w,1);
		//ft5x0x_i2c_txdata(0x88, buf_w, 1);    /* adjust frequency 60Hz */

	buf_r[0] = 0;
	err = ft5406_read_regs(client,0x88,buf_r,1);
		//ft5x0x_i2c_rxdata(0x88, buf_r, 1);
	printk("read buf[0x88] = %d\n", buf_r[0]);

    return 0;
fail3:
	free_irq(ft5x0x_ts->irq,ft5x0x_ts);
exit_input_register_device_failed:
	input_free_device(input_dev);
exit_input_dev_alloc_failed:
	free_irq(7, ft5x0x_ts);
exit_irq_request_failed:
exit_platform_data_null:
	cancel_work_sync(&ft5x0x_ts->pen_event_work);
	destroy_workqueue(ft5x0x_ts->ts_workqueue);
exit_create_singlethread:
	printk("==singlethread error =\n");
	kfree(ft5x0x_ts);
exit_alloc_data_failed:
	return err;
}
Exemplo n.º 3
0
static int rk28_jogball_probe(struct platform_device *pdev)
{

      int    error, i;
	struct rk28_jogball *jogball = NULL;
	struct input_dev *input_dev = NULL;
	struct rk2818_jogball_paltform_data *pdata = pdev->dev.platform_data;
	if(!(pdata->jogball_key))
		return -1;
	
	jogball = kzalloc(sizeof(struct rk28_jogball), GFP_KERNEL);
	if (jogball == NULL)
	{
	    printk("Alloc memory for rk28_jogball failed.\n");
	    return -ENOMEM;
	}
	
	/* Create and register the input driver. */
	input_dev = input_allocate_device();
	if (!input_dev || !jogball) 
	{
		printk("failed to allocate input device.\n");
		error = -ENOMEM;
		goto failed1;
	}
	
	memcpy(jogball->keycodes, initkey_code, sizeof(jogball->keycodes));
	input_dev->name = "jogball";
	input_dev->dev.parent = &pdev->dev;
	input_dev->phys = JOGBALL_PHYS_NAME;
	input_dev->keycode = jogball->keycodes;
	input_dev->keycodesize = sizeof(unsigned char);
	input_dev->keycodemax = ARRAY_SIZE(initkey_code);
	for (i = 0; i < ARRAY_SIZE(initkey_code); i++)
		set_bit(initkey_code[i], input_dev->keybit);
	clear_bit(0, input_dev->keybit);
  	input_dev->evbit[0] = BIT_MASK(EV_KEY);
    	jogball->pdata = pdata;
	jogball->input_dev = input_dev;
	input_set_drvdata(input_dev, jogball);

	platform_set_drvdata(pdev, jogball);

	prockjogball = jogball;

	/* Register the input device */
	error = input_register_device(input_dev);
	if (error) 
	{
		printk("failed to register input device.\n");
		goto failed2;
	}
	printk(" irq register for input device.\n");
	#if 1	//ÉêÇëEXTERN GPIO INTERRUPT
	//JOG_UP_PORT
	

	error = gpio_request(pdata->jogball_key->pin_up,"Jog up");
	if(error)
	{
		printk("unable to request JOG_UP_PORT IRQ err=%d\n", error);
		goto failed3;
	}
	gpio_direction_input(pdata->jogball_key->pin_up);	
	error = request_irq(gpio_to_irq(pdata->jogball_key->pin_up),rk28_jogball_up_ISR,IRQ_TYPE_EDGE_RISING,NULL,jogball);
	if(error)
	{
		printk("unable to request JOG_UP_PORT irq\n");
		goto failed4;
	}	
	//JOG_DOWN_PORT
	error = gpio_request(pdata->jogball_key->pin_down,"jog down");
	if(error)
	{
		printk("unable to request JOG_DOWN_PORT IRQ err=%d\n", error);
		goto failed5;
	}
	gpio_direction_input(pdata->jogball_key->pin_down);
	//gpio_pull_updown(JOG_DOWN_PORT,GPIOPullUp);
	error = request_irq(gpio_to_irq(pdata->jogball_key->pin_down),rk28_jogball_down_ISR,IRQ_TYPE_EDGE_RISING,NULL,jogball);
	if(error)
	{
		printk("unable to request JOG_DOWN_PORT irq\n");
		goto failed6;
	}	
	//JOG_LEFT_PORT
	error = gpio_request(pdata->jogball_key->pin_left,"jog left");
	if(error)
	{
		printk("unable to request JOG_LEFT_PORT IRQ err=%d\n", error);
		goto failed7;
	}
	gpio_direction_input(pdata->jogball_key->pin_left);
	//gpio_pull_updown(JOG_LEFT_PORT,GPIOPullUp);
	error = request_irq(gpio_to_irq(pdata->jogball_key->pin_left),rk28_jogball_left_ISR,IRQ_TYPE_EDGE_RISING,NULL,jogball);
	if(error)
	{
		printk("unable to request JOG_LEFT_PORT irq\n");
		goto failed8;
	}	
	//JOG_RIGHT_PORT
	error = gpio_request(pdata->jogball_key->pin_right,NULL);
	if(error)
	{
		printk("unable to request JOG_RIGHT_PORT IRQ err=%d\n", error);
		goto failed9;
	}
	gpio_direction_input(pdata->jogball_key->pin_right);
	//gpio_pull_updown(JOG_RIGHT_PORT,GPIOPullUp);
	error = request_irq(gpio_to_irq(pdata->jogball_key->pin_right),rk28_jogball_right_ISR,IRQ_TYPE_EDGE_RISING,NULL,jogball);
	if(error)
	{
		printk("unable to request JOG_RIGHT_PORT irq\n");
		goto failed10;
	}			
#endif

#ifdef CONFIG_ANDROID_POWER
    jogball_early_suspend.suspend = rk28_jogball_early_suspend;
    jogball_early_suspend.resume = rk28_jogball_early_resume;
    jogball_early_suspend.level = 0x2;
    android_register_early_suspend(&jogball_early_suspend);
#endif

	printk("JOGBALL:rk28_jogball_probe sucess\n");
	return 0;
#if 1
failed10:
	free_irq(gpio_to_irq(pdata->jogball_key->pin_down),NULL);
failed9:
	gpio_free(pdata->jogball_key->pin_down);
failed8:
	free_irq(gpio_to_irq(pdata->jogball_key->pin_left),NULL);
failed7:
	gpio_free(pdata->jogball_key->pin_left);
failed6:		
	free_irq(gpio_to_irq(pdata->jogball_key->pin_down),NULL);
failed5:
	gpio_free(pdata->jogball_key->pin_down);
failed4:
	free_irq(gpio_to_irq(pdata->jogball_key->pin_up),NULL);
failed3:
	gpio_free(pdata->jogball_key->pin_up);
	
	input_unregister_device(jogball->input_dev);

failed2:
    platform_set_drvdata(pdev, NULL);
    input_free_device(input_dev);

failed1:
	kfree(jogball);
	
	return error;
#endif
}
Exemplo n.º 4
0
static int  mma7660_probe(struct i2c_client *client, const struct i2c_device_id *id)
{
	struct mma7660_data *mma7660;
	int err;
	
	dprint("l=%d,%s:\n",__LINE__, __func__);
	Xaverage = Yaverage = Zaverage = RawDataNum = 0;

	mma7660 = kzalloc(sizeof(struct mma7660_data), GFP_KERNEL);
	if (!mma7660) {
		rk28printk("[mma7660]:alloc data failed.\n");
		err = -ENOMEM;
		goto exit_alloc_data_failed;
	}
    
	INIT_WORK(&mma7660->work, mma7660_work_func);
	INIT_DELAYED_WORK(&mma7660->delaywork, mma7660_delaywork_func);

	mma7660->client = client;
	//mma7660->swap_xy = 
	i2c_set_clientdata(client, mma7660);

	this_client = client;

	err = mma7660_init_client(client);
	if (err < 0) {
		rk28printk(KERN_ERR
		       "mma7660_probe: mma7660_init_client failed\n");
		goto exit_request_gpio_irq_failed;
	}
		
	mma7660->input_dev = input_allocate_device();
	if (!mma7660->input_dev) {
		err = -ENOMEM;
		rk28printk(KERN_ERR
		       "mma7660_probe: Failed to allocate input device\n");
		goto exit_input_allocate_device_failed;
	}

	set_bit(EV_ABS, mma7660->input_dev->evbit);

	/* x-axis acceleration */
	input_set_abs_params(mma7660->input_dev, ABS_X, -1500, 1500, 0, 0);
	/* y-axis acceleration */
	input_set_abs_params(mma7660->input_dev, ABS_Y, -1500, 1500, 0, 0);
	/* z-axis acceleration */
	input_set_abs_params(mma7660->input_dev, ABS_Z, -1500, 1500, 0, 0);

	mma7660->input_dev->name = "gsensor";
	mma7660->input_dev->dev.parent = &client->dev;

	err = input_register_device(mma7660->input_dev);
	if (err < 0) {
		rk28printk(KERN_ERR
		       "mma7660_probe: Unable to register input device: %s\n",
		       mma7660->input_dev->name);
		goto exit_input_register_device_failed;
	}

    mma7660_device.parent = &client->dev;
	err = misc_register(&mma7660_device);
	if (err < 0) {
		rk28printk(KERN_ERR
		       "mma7660_probe: mmad_device register failed\n");
		goto exit_misc_device_register_mma7660_device_failed;
	}

	err = gsensor_sysfs_init();
	if (err < 0) {
		rk28printk(KERN_ERR
            "mma7660_probe: gsensor sysfs init failed\n");
		goto exit_gsensor_sysfs_init_failed;
	}
	
#ifdef CONFIG_ANDROID_POWER
    mma7660_early_suspend.suspend = mma7660_suspend;
    mma7660_early_suspend.resume = mma7660_resume;
    mma7660_early_suspend.level = 0x2;
    android_register_early_suspend(&mma7660_early_suspend);
#endif
	rk28printk(KERN_INFO "mma7660 probe ok\n");
	mma7660->status = -1;
#if 0	
	mma7660_start(client, MMA7660_RATE_32);
#endif
	dprint("l=%d,%s:loaded successfully.\n",__LINE__, __func__);
	return 0;

exit_gsensor_sysfs_init_failed:
    misc_deregister(&mma7660_device);
exit_misc_device_register_mma7660_device_failed:
    input_unregister_device(mma7660->input_dev);
exit_input_register_device_failed:
	input_free_device(mma7660->input_dev);
exit_input_allocate_device_failed:
    free_irq(client->irq, mma7660);
exit_request_gpio_irq_failed:
	kfree(mma7660);	
exit_alloc_data_failed:
    ;
	return err;
}
Exemplo n.º 5
0
static int	__devinit xpt2046_ts_proble(struct spi_device *spi)
{

    struct XPT2046_TS_EVENT  *ts_dev;
    struct input_dev *xpt2046_ts_dev;
    unsigned int err = 0;

    rk28printk("************>%s.....%s.....%d\n",__FILE__,__FUNCTION__,__LINE__);


    ts_dev=kzalloc(sizeof(struct XPT2046_TS_EVENT), GFP_KERNEL);
    if(!ts_dev)
    {
        printk("failed to allocate memory!!\n");
        goto nomem;
    }

    ts_dev->spi = spi;	/*ts_dev to spi reference*/
    printk("touch device spi speed = %d\n",spi->max_speed_hz);

    xpt2046_ts_dev = input_allocate_device();
    if(!xpt2046_ts_dev)
    {
        printk("rk28 xpt2046_ts allocate input device failed!!!\n");
        goto fail1;
    }
    ts_dev->input = xpt2046_ts_dev;
    /*init	timer to dispose workqueue */
    hrtimer_init(&ts_dev->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
    ts_dev->timer.function = xpt2046_dostimer;

    ts_dev->x = 0;
    ts_dev->y = 0;
    ts_dev->z1 = 0;
    ts_dev->z2 = 0;
    ts_dev->touch_x = 0;
    ts_dev->touch_y = 0;
    ts_dev->status = 0;
    ts_dev->pendown = 0;
    ts_dev->irq =XPT2046_IRQ;
    snprintf(ts_dev->phys,sizeof(ts_dev->phys),"%s/input0",spi->dev.bus_id);

    xpt2046_ts_dev->evbit[0] = BIT_MASK(EV_ABS)|BIT_MASK(EV_KEY);
    xpt2046_ts_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
    //input_set_abs_params(xpt2046_ts_dev,ABS_X,400,3680,0,0);
    //input_set_abs_params(xpt2046_ts_dev,ABS_Y,550,3350,0,0);

    input_set_abs_params(xpt2046_ts_dev,ABS_X,0,LCD_MAX_LENGTH,0,0);
    input_set_abs_params(xpt2046_ts_dev,ABS_Y,0,LCD_MAX_WIDTH,0,0);
    //input_set_abs_params(xpt2046_ts_dev, ABS_PRESSURE,0,4096, 0, 0);
    xpt2046_ts_dev->name = XPT2046_NAME;

#ifdef CONFIG_ANDROID_POWER

    ts_early_suspend.suspend = rk28_ts_suspend;

    ts_early_suspend.resume = rk28_ts_resume;

    android_register_early_suspend(&ts_early_suspend);

#endif
    xpt2046_ts_dev->phys = ts_dev->phys;


    dev_set_drvdata(&spi->dev, ts_dev);
    xpt2046_ts_dev->dev.parent = &spi->dev;

    //xpt2046_read_values(ts_dev,MAX_SAMPLE_TIMES);
    xpt2046_read_values(ts_dev);
    rk28printk("************>%s....x=%d...y=%d...z1=%d...z2=%d\n",__FUNCTION__,ts_dev->x,ts_dev->y,ts_dev->z1,ts_dev->z2);

    ///__raw_writel(__raw_readl(GPIO1_BASE_ADDR_VA + 0x30)|0x80,(GPIO1_BASE_ADDR_VA + 0x30));
    //err = request_irq(ts_dev->irq,xpt2046_ts_interrupt,IRQF_TRIGGER_FALLING,spi->dev.driver->name,ts_dev);
    GPIOPullUpDown(PT2046_PENIRQ,GPIOPullUp);
    err = request_gpio_irq(PT2046_PENIRQ,xpt2046_ts_interrupt,GPIOEdgelFalling,ts_dev);
    if(err<0)
    {
        printk("xpt2046 request irq failed !!\n");
        err = -EBUSY;
        goto fail1;
    }
    err = input_register_device(xpt2046_ts_dev);
    if(err)
        goto fail2;
    return err;

fail2:
    free_irq(XPT2046_IRQ,NULL);

fail1:
    input_free_device(xpt2046_ts_dev);
    hrtimer_cancel(&ts_dev->timer);
nomem:
    kfree(ts_dev);

    return err;
}
Exemplo n.º 6
0
static int __init rk28_ts_ak4183_init(void)
{
	int ret;
	struct AK4183_TS_EVENT *ts_dev = NULL;

	GPIOSetPinDirection(GPIOPortE_Pin3,GPIO_IN);
	GPIOSetPinLevel(GPIOPortE_Pin3,GPIO_HIGH);

	ts_dev = kzalloc(sizeof(struct AK4183_TS_EVENT), GFP_KERNEL);
	if(ts_dev == NULL)
	{
		E("ts_dev kzalloc failed!\n");
		ret = -ENOMEM;
		goto err1;
	}

	ts_dev->input = input_allocate_device();
	if(ts_dev->input == NULL)
	{
		E("input_allocate_device err!\n"); 
		ret = -ENOMEM;

		goto err2;
	}	

	ts_dev->irq = 7;
	
	ts_dev->input->name = "ak4183";	
	ts_dev->input->phys = "ak4183_TS/input0";
	ts_dev->input->evbit[0] = BIT_MASK(EV_ABS)|BIT_MASK(EV_KEY);
	ts_dev->input->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
	input_set_abs_params(ts_dev->input, ABS_X, 0, LCD_MAX_LENGTH - 1, 0, 0);
	input_set_abs_params(ts_dev->input, ABS_Y, 0, LCD_MAX_WIDTH - 1, 0, 0);
	
	ret = input_register_device(ts_dev->input);
	if(ret < 0){
		goto err3;

	}
#ifdef CONFIG_ANDROID_POWER
	ts_early_suspend.suspend = ak4183_suspend;
    ts_early_suspend.resume = ak4183_resume;
    android_register_early_suspend(&ts_early_suspend);
#endif

    rockchip_mux_api_set(GPIOB_SPI0_MMC0_NAME, 0);
	rockchip_mux_api_set(GPIOB4_SPI0CS0_MMC0D4_NAME, IOMUXA_GPIO0_B4);
	GPIOSetPinDirection(GPIOPortB_Pin4,GPIO_IN);
	GPIOSetPinLevel(GPIOPortB_Pin4,GPIO_HIGH);
	GPIOSetPinDirection(GPIOPortB_Pin5,GPIO_IN);
	GPIOSetPinLevel(GPIOPortB_Pin5,GPIO_HIGH);
	GPIOSetPinDirection(GPIOPortB_Pin6,GPIO_IN);
	GPIOSetPinLevel(GPIOPortB_Pin6,GPIO_HIGH);
	GPIOSetPinDirection(GPIOPortB_Pin7,GPIO_IN);
	GPIOSetPinLevel(GPIOPortB_Pin7,GPIO_HIGH);

	INIT_DELAYED_WORK(&ts_dev->work, ak4183_delay_work);

	ret = request_gpio_irq(GPIOPortE_Pin3, (void *)ak4183_isr, GPIOEdgelFalling, ts_dev);
	if(ret < 0){
		E("ak4183 request irq err, ret = %d\n", ret);
		goto err4;
	}	

	ret =  i2c_add_driver(&ak4183_i2c_driver);
	if(ret < 0){
		E("i2c_add_driver err, ret = %d\n", ret);
		goto err5;
	}
	
	g_ts_dev = ts_dev;
	
	ret = driver_create_file(&ak4183_i2c_driver.driver, &driver_attr_touchcheck);
	ret += driver_create_file(&ak4183_i2c_driver.driver, &driver_attr_touchadc);
	ret += driver_create_file(&ak4183_i2c_driver.driver, &driver_attr_calistatus);
	ret += driver_create_file(&ak4183_i2c_driver.driver, &driver_attr_debug_ak4183);

	I("ak4183 init success!\n");

	return 0;

err5:
	free_irq(7, NULL);
err4:
	input_unregister_device(ts_dev->input);
err3:
	input_free_device(ts_dev->input);
err2:
	kfree(ts_dev);
err1:
	return ret;