static int tavorevb_vbus_detect(void *func, int enable) { if (enable) { pmic_callback_register(PMIC_EVENT_USB, func); pxa3xx_pmic_set_pump(1); } else { pxa3xx_pmic_set_pump(0); pmic_callback_unregister(PMIC_EVENT_USB, func); } return 0; }
static int lt_ts_probe(struct platform_device *pdev) { int ret; struct lt_touch_data *p_lt_touch; struct input_dev *littleton_ts_input_dev; /* register input device */ littleton_ts_input_dev = input_allocate_device(); littleton_ts_input_dev->name = "Littleton touchscreen"; littleton_ts_input_dev->open = littleton_ts_input_open; littleton_ts_input_dev->close = littleton_ts_input_close; __set_bit(EV_ABS, littleton_ts_input_dev->evbit); __set_bit(ABS_X, littleton_ts_input_dev->absbit); __set_bit(ABS_Y, littleton_ts_input_dev->absbit); __set_bit(ABS_PRESSURE, littleton_ts_input_dev->absbit); #ifdef CONFIG_INPUT_ANDROID set_bit(EV_KEY, littleton_ts_input_dev->evbit); set_bit(BTN_TOUCH, littleton_ts_input_dev->keybit); #endif /* Malloc lt_touch context */ p_lt_touch = kzalloc(sizeof(struct lt_touch_data), GFP_KERNEL); if (!p_lt_touch) { ret = -ENOMEM; goto lt_touch_out; } lt_touch = p_lt_touch; p_lt_touch->littleton_ts_input_dev = littleton_ts_input_dev; platform_set_drvdata(pdev, p_lt_touch); input_set_drvdata(littleton_ts_input_dev, p_lt_touch); input_calibrate_enable(littleton_ts_input_dev); ret = input_register_device(littleton_ts_input_dev); ret = pmic_callback_register(PMIC_EVENT_TOUCH, lt_touch_interrupt); if (ret < 0) goto pmic_cb_out; spin_lock_init(&p_lt_touch->ts_lock); p_lt_touch->pen_state = TSI_PEN_UP; p_lt_touch->suspended = 0; p_lt_touch->use_count = 0; p_lt_touch->poll_jiffies = LT_TOUCH_POLL_JIFFIES; p_lt_touch->intervalUs_sample = LT_TOUCH_SAMPLE_INTERVAL_US; #ifdef LT_TOUCH_TIMER_POLL init_timer(&p_lt_touch->lt_touch_timer); p_lt_touch->lt_touch_timer.data = (unsigned long)p_lt_touch; p_lt_touch->lt_touch_timer.function = lt_touch_timer_handler; #else init_waitqueue_head(&p_lt_touch->ts_wait_queue); #endif #ifdef LT_TOUCH_ENABLE_FILTER p_lt_touch->sample_offset = LT_TOUCH_SAMPLE_OFFSET; p_lt_touch->max_step = LT_TOUCH_MAX_STEP; #endif ret = sysfs_create_group(&pdev->dev.kobj,<_touch_attr_group); micco_tsi_poweron(); lt_touch_enable_stage(TSI_STAGE_DETECT); #ifdef CONFIG_YUHUA_MISC_DEV set_touch_detect(1); #endif printk("Android micco touchscreen driver register succ\n"); return 0; pmic_cb_out: kfree(p_lt_touch); lt_touch_out: input_unregister_device(littleton_ts_input_dev); return ret; }
static int sanremo_ts_probe(struct platform_device *pdev) { int ret; u8 tmp; if(sanremo_read(SANREMO_ID, &tmp) < 0) return -ENODEV; sanremo_td = kzalloc(sizeof(struct sanremo_ts_data), GFP_KERNEL); if (!sanremo_td) { ret = -ENOMEM; goto sanremo_ts_out; } sanremo_td->use_count = 0; sanremo_td->ts_timer = (struct timer_list *)kmalloc(sizeof(struct timer_list), GFP_KERNEL); init_timer(sanremo_td->ts_timer); sanremo_td->ts_timer->function = sanremo_ts_timer_handler; // sanremo_td->ts_timer->data = sanremo_td; /* register input device */ sanremo_ts_input_dev = input_allocate_device(); if (sanremo_ts_input_dev == NULL) { printk(KERN_ERR "%s: failed to allocate input dev\n", __FUNCTION__); return -ENOMEM; } sanremo_ts_input_dev->name = "sanremo-ts"; sanremo_ts_input_dev->phys = "sanremo-ts/input0"; sanremo_ts_input_dev->dev.parent = &pdev->dev; sanremo_ts_input_dev->open = sanremo_ts_open; sanremo_ts_input_dev->close = sanremo_ts_close; __set_bit(EV_ABS, sanremo_ts_input_dev->evbit); __set_bit(ABS_X, sanremo_ts_input_dev->absbit); __set_bit(ABS_Y, sanremo_ts_input_dev->absbit); __set_bit(ABS_PRESSURE, sanremo_ts_input_dev->absbit); __set_bit(EV_SYN, sanremo_ts_input_dev->evbit); __set_bit(EV_KEY, sanremo_ts_input_dev->evbit); __set_bit(BTN_TOUCH, sanremo_ts_input_dev->keybit); input_set_abs_params(sanremo_ts_input_dev, ABS_X, 0, 3600, 0, 0); input_set_abs_params(sanremo_ts_input_dev, ABS_Y, 0, 3800, 0, 0); input_set_abs_params(sanremo_ts_input_dev, ABS_PRESSURE, 0, 255, 0, 0); input_set_abs_params(sanremo_ts_input_dev, ABS_TOOL_WIDTH, 0, 15, 0, 0); ret = input_register_device(sanremo_ts_input_dev); if (ret) { printk(KERN_ERR "%s: unabled to register input device, ret = %d\n", __FUNCTION__, ret); return ret; } /* The Littleton IRQ come from Sanremo. So we just implemate * a callback IRQ function for Sanremo. */ ret = pmic_callback_register(PMIC_EVENT_TOUCH, sanremo_ts_interrupt); if (ret < 0) goto pmic_cb_out; return 0; pmic_cb_out: input_unregister_device(sanremo_ts_input_dev); sanremo_ts_out: kfree(sanremo_td); return ret; }