mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 20:07:46 +09:00
fix touch ct363
This commit is contained in:
@@ -118,7 +118,7 @@ static struct ct36x_platform_data ct36x_info = {
|
||||
.gpio = TOUCH_INT_PIN,
|
||||
.active_low = 1,
|
||||
},
|
||||
.orientation = {1, 0, 1, 0},
|
||||
.orientation = {1, 0, 0, 1},
|
||||
};
|
||||
#endif
|
||||
static struct spi_board_info board_spi_devices[] = {
|
||||
|
||||
@@ -174,27 +174,44 @@ static void ct363_report(struct ct36x_data *ts)
|
||||
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);
|
||||
|
||||
@@ -22,13 +22,28 @@
|
||||
|
||||
#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;
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ static int ct36x_add_client(void)
|
||||
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);
|
||||
@@ -216,7 +216,7 @@ static int ct36x_ts_probe(struct i2c_client *client, const struct i2c_device_id
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user