Hi added the printk. this is my code
static void ads7846_report_state(struct ads7846 *ts) { struct ads7846_packet *packet = ts->packet; unsigned int Rt; u16 x, y, z1, z2;
/* added for debug */ printk(KERN_INFO "ads7846_report_state\n");
/* * ads7846_get_value() does in-place conversion (including byte swap) * from on-the-wire format as part of debouncing to get stable * readings. */ if (ts->model == 7845) { x = *(u16 *)packet->tc.x_buf; y = *(u16 *)packet->tc.y_buf; z1 = 0; z2 = 0; } else { x = packet->tc.x; y = packet->tc.y; z1 = packet->tc.z1; z2 = packet->tc.z2; }
/* range filtering */ if (x == MAX_12BIT) x = 0;
if (ts->model == 7843) { Rt = ts->pressure_max / 2; } else if (ts->model == 7845) { if (get_pendown_state(ts)) { Rt = ts->pressure_max / 2; } else { /* added for debug */ printk(KERN_INFO "cannot get pendown state \n"); Rt = 0; } dev_vdbg(&ts->spi->dev, "x/y: %d/%d, PD %d\n", x, y, Rt); } else if (likely(x && z1)) { /* compute touch pressure resistance using equation #2 */ /* added for debug */ printk(KERN_INFO "compute touch pressure resistance using equation #2 \n"); Rt = z2; Rt -= z1; Rt *= x; Rt *= ts->x_plate_ohms; Rt /= z1; Rt = (Rt + 2047) >> 12; } else { /* added for debug */ printk(KERN_INFO "ts model ? %d \n", ts->model); Rt = 0; } /* added for debug */ printk(KERN_INFO "Rt %d \n", Rt);
/* * Sample found inconsistent by debouncing or pressure is beyond * the maximum. Don't report it to user space, repeat at least * once more the measurement */ if (packet->tc.ignore || Rt > ts->pressure_max) { /* added for debug */ printk(KERN_INFO "Ignored %d pressure %d \n", packet->tc.ignore, Rt);
dev_vdbg(&ts->spi->dev, "ignored %d pressure %d \n", packet->tc.ignore, Rt); return; }
/* * Maybe check the pendown state before reporting. This discards * false readings when the pen is lifted. */ if (ts->penirq_recheck_delay_usecs) { udelay(ts->penirq_recheck_delay_usecs); if (!get_pendown_state(ts)) { /* added for debug */ printk(KERN_INFO "cannot get pendown state \n"); Rt = 0; } }
/* * NOTE: We can't rely on the pressure to determine the pen down * state, even this controller has a pressure sensor. The pressure * value can fluctuate for quite a while after lifting the pen and * in some cases may not even settle at the expected value. * * The only safe way to check for the pen up condition is in the * timer by reading the pen signal state (it's a GPIO _and_ IRQ). */ if (Rt) { struct input_dev *input = ts->input;
if (ts->swap_xy) swap(x, y);
if (!ts->pendown) { input_report_key(input, BTN_TOUCH, 1); ts->pendown = true; dev_vdbg(&ts->spi->dev, "DOWN\n"); }
/* added for debug */ printk(KERN_INFO "input_report_abs x: %d, y: %d \n", x, y);
input_report_abs(input, ABS_X, x); input_report_abs(input, ABS_Y, y); input_report_abs(input, ABS_PRESSURE, ts->pressure_max - Rt);
input_sync(input); dev_vdbg(&ts->spi->dev, "%4d/%4d/%4d\n", x, y, Rt); } else { /* added for debug */ printk(KERN_INFO "not reporting. Rt=%d \n", Rt); } }
and the output after touching the screen
<6>[ 59.531036] ads7846_report_state <6>[ 59.534423] compute touch pressure resistance using equation #2 <6>[ 59.540771] Rt 0 <6>[ 59.542785] not reporting. Rt=0 <6>[ 59.553497] ads7846_report_state <6>[ 59.556884] compute touch pressure resistance using equation #2 <6>[ 59.563201] Rt 0 <6>[ 59.565216] not reporting. Rt=0 <6>[ 59.577087] ads7846_report_state <6>[ 59.580474] compute touch pressure resistance using equation #2 <6>[ 59.586791] Rt 0 <6>[ 59.588836] not reporting. Rt=0 <6>[ 59.850494] ads7846_report_state <6>[ 59.853881] compute touch pressure resistance using equation #2 <6>[ 59.860198] Rt 0 <6>[ 59.862213] not reporting. Rt=0
Thanks Francesco
2012/2/15 Francesco Sarasini sarasini@gmail.com
I have added another printk
printk(KERN_INFO "compute touch pressure resistance using equation #2 \n"); printk(KERN_INFO "z1=%d, z2=%d, x=%d, y=%d, x_plate_ohms=%d \n", z1, z2, x, y, ts->x_plate_ohms); Rt = z2; Rt -= z1; Rt *= x; Rt *= ts->x_plate_ohms; Rt /= z1; Rt = (Rt + 2047) >> 12;
the output:
<6>[ 49.927917] ads7846_report_state <6>[ 49.931304] compute touch pressure resistance using equation #2 <6>[ 49.937652] z1=8191, z2=8191, x=8191, y=8191, x_plate_ohms=180 <6>[ 49.943908] Rt 0 <6>[ 49.945922] not reporting. Rt=0 <6>[ 49.959045] ads7846_report_state <6>[ 49.962432] compute touch pressure resistance using equation #2 <6>[ 49.968749] z1=8191, z2=8191, x=8191, y=8191, x_plate_ohms=180 <6>[ 49.975006] Rt 0
Thanks Francesco
2012/2/15 Francesco Sarasini sarasini@gmail.com
Hi Francesco,
I think, it may be an issue in hardware. Currently, I am also trying solve similar issue. Let me update you, once I get the clue.
Bye :)
My hardware has no problems, it works with other os.
Thanks Francescp
2012/2/16 Bharathi Subramanian bharathi.list@gmail.com
Hi Sarasini,
Then, why all x,y,z1 &z2 showing the same value? Are you using the touchscreen specific settings like debouncing, x-plate resistance value etc from the other OS driver. Next I feel, the driver might be reading the values before the settling time or other issues some thing similar to this.
Bye :)
linaro-android@lists.linaro.org