return;
}
-
+ int t ,m;
+ if(ct36x_dbg_level==2)
+ for(t=0;t< ts->point_num;t++){
+ ct36x_dbg(ts, "CT363buf[%d]: ", t);
+ for(m=0;m<6;m++){
+ ct36x_dbg(ts, " 0x%x %x %x %x %x %x %x %x ",ct363->pts[t].xhi,
+ ct363->pts[t].yhi,
+ ct363->pts[t].ylo,
+ ct363->pts[t].xlo,
+ ct363->pts[t].status,
+ ct363->pts[t].id,
+ ct363->pts[t].area,
+ ct363->pts[t].pressure);
+ }
+ ct36x_dbg(ts, " \n ");
+ }
+
ct363->press = 0;
for(i = 0; i < ts->point_num; i++){
if((ct363->pts[i].xhi != 0xFF && ct363->pts[i].yhi != 0xFF) &&
(ct363->pts[i].status == 1 || ct363->pts[i].status == 2)){
x = (ct363->pts[i].xhi<<4)|(ct363->pts[i].xlo&0xF);
y = (ct363->pts[i].yhi<<4)|(ct363->pts[i].ylo&0xF);
+
ct363->x = ts->orientation[0] * x + ts->orientation[1] * y;
ct363->y = ts->orientation[2] * x + ts->orientation[3] * y;
- if(ct363->x < 0)
- ct363->x = ts->x_max - ct363->x;
- if(ct363->y < 0)
- ct363->y = ts->y_max - ct363->y;
+ if( (ct363->x > ts->x_max) || (ct363->y > ts->y_max) || (ct363->x < 0) || (ct363->y < 0) ){
+ continue ;
+ }
+
input_mt_slot(ts->input, ct363->pts[i].id - 1);
input_mt_report_slot_state(ts->input, MT_TOOL_FINGER, true);
input_report_abs(ts->input, ABS_MT_TOUCH_MAJOR, 1);
- input_report_abs(ts->input, ABS_MT_POSITION_X, x);
- input_report_abs(ts->input, ABS_MT_POSITION_Y, y);
+ input_report_abs(ts->input, ABS_MT_POSITION_X, ct363->x);
+ input_report_abs(ts->input, ABS_MT_POSITION_Y, ct363->y);
input_report_abs(ts->input, ABS_MT_PRESSURE, ct363->pts[i].pressure);
- ct36x_dbg(ts, "CT363 report value: x: %d, y:%d\n", ct363->x, ct363->y);
+ ct36x_dbg(ts, "CT363 report value: id: %d, x: %d, y:%d\n",ct363->pts[i].id - 1, ct363->x, ct363->y);
sync = 1;
ct363->press |= 0x01 << (ct363->pts[i].id - 1);
#include <mach/board.h>
#include <mach/gpio.h>
-#if 0
+//#if 1
+//#define ct36x_dbg(ts, format, arg...) \
+// dev_printk(KERN_INFO , ts->dev , format , ## arg)
+//#else
+//#define ct36x_dbg(ts, format, arg...)
+//#endif
+int ct36x_dbg_level = 0;
+module_param_named(dbg_level, ct36x_dbg_level, int, 0644);
+#if 1
#define ct36x_dbg(ts, format, arg...) \
- dev_printk(KERN_INFO , ts->dev , format , ## arg)
-#else
-#define ct36x_dbg(ts, format, arg...)
+ do { \
+ if (ct36x_dbg_level) { \
+ dev_printk(KERN_INFO , ts->dev , format , ## arg) ;\
+ } \
+ } while (0)
+#else
+#define DBG(x...)
#endif
+
+
+
#define CT36X_I2C_RATE (200 * 1000)
struct ct36x_data;
static irqreturn_t ct36x_irq_handler(int irq, void *data)
{
struct ct36x_data *ts = data;
-
+ ct36x_dbg(ts, "----------- ct36x_irq_handler -----------\n");
//disable_irq(ts->irq);
if(ts->ops->report)
ts->ops->report(ts);
register_early_suspend(&ts->early_suspend);
#endif
ts->irq = gpio_to_irq(ts->irq_io.gpio);
- ret = request_threaded_irq(ts->irq, NULL, ct36x_irq_handler, IRQF_ONESHOT, CT36X_NAME, ts);
+ ret = request_threaded_irq(ts->irq, NULL, ct36x_irq_handler, IRQF_TRIGGER_FALLING|IRQF_ONESHOT, CT36X_NAME, ts);
if(ret < 0){
dev_err(ts->dev, "Failed to request threaded irq\n");
goto err_request_threaded_irq;