I purchased the 7 inch LCD w/ Touchscreen from e-bay to use with my BB. xM Rev. B.
In WinCE everything works ok, but in Linux the Touchscreen refuses to work.
I have already tried recompiling Kernel, rootfs, u-boot, pretty much everything.
I even used the validation u-boot and kernel from http://gitorious.org/beagleboard-validation, changing the panel and adding the touchscreen driver in board-omap3beagle.c but it didn't work.
After some further tests I found that, in the file
./drivers/input/touchscreen/ads7846.c,
the following function
Code: Select all
static int ads7846_read12_ser(struct device *dev, unsigned command)
{
struct spi_device *spi = to_spi_device(dev);
struct ads7846 *ts = dev_get_drvdata(dev);
struct ser_req *req = kzalloc(sizeof *req, GFP_KERNEL);
int status;
int use_internal;
if (!req)
return -ENOMEM;
spi_message_init(&req->msg);
/* FIXME boards with ads7846 might use external vref instead ... */
use_internal = (ts->model == 7846);
printk("ads7846: ts->model - %d\n", ts->model);
printk("ads7846: use_internal - %s\n", (use_internal?"true":"false"));
/* maybe turn on internal vREF, and let it settle */
if (use_internal) {
printk("ads7846: entered use_internal method\n");
req->ref_on = REF_ON;
req->xfer[0].tx_buf = &req->ref_on;
req->xfer[0].len = 1;
spi_message_add_tail(&req->xfer[0], &req->msg);
req->xfer[1].rx_buf = &req->scratch;
req->xfer[1].len = 2;
/* for 1uF, settle for 800 usec; no cap, 100 usec. */
req->xfer[1].delay_usecs = ts->vref_delay_usecs;
spi_message_add_tail(&req->xfer[1], &req->msg);
}
/* take sample */
req->command = (u8) command;
req->xfer[2].tx_buf = &req->command;
req->xfer[2].len = 1;
spi_message_add_tail(&req->xfer[2], &req->msg);
req->xfer[3].rx_buf = &req->sample;
req->xfer[3].len = 2;
spi_message_add_tail(&req->xfer[3], &req->msg);
/* REVISIT: take a few more samples, and compare ... */
/* converter in low power mode & enable PENIRQ */
req->ref_off = PWRDOWN;
req->xfer[4].tx_buf = &req->ref_off;
req->xfer[4].len = 1;
spi_message_add_tail(&req->xfer[4], &req->msg);
req->xfer[5].rx_buf = &req->scratch;
req->xfer[5].len = 2;
CS_CHANGE(req->xfer[5]);
spi_message_add_tail(&req->xfer[5], &req->msg);
ts->irq_disabled = 1;
disable_irq(spi->irq);
status = spi_sync(spi, &req->msg);
printk("ads7846: status = %d\n", status);
ts->irq_disabled = 0;
enable_irq(spi->irq);
if (status == 0) {
/* on-wire is a must-ignore bit, a BE12 value, then padding */
status = be16_to_cpu(req->sample);
status = status >> 3;
status &= 0x0fff;
}
kfree(req);
return status;
}
Code: Select all
status = spi_sync(spi, &req->msg);
Thus, in the function
static int __devinit ads7846_probe(struct spi_device *spi)
the following code
Code: Select all
err = ads7846_read12_ser(&spi->dev,
READ_12BIT_SER(vaux) | ADS_PD10_ALL_ON);
/* if sample is all 0's or all 1's then there is no device on spi */
if ( (err == 0x000) || (err == 0xfff)) {
dev_info(&spi->dev, "no device detected, test read result was 0x%08X\n", err);
err = -ENODEV;
goto err_free_irq;
}
The touchscreen driver implementation I adopted is equal to the one on board-omap3evm.c, or the one from the android sources that came in the data partition of the sd card.
Has anyone experienced this situation or know how to solve it?
I would appreciate any help you could give me.
Thank you
Oh, and forgot to mention my final tests were performed with Angstrom, and the command
Code: Select all
dmesg | grep ads7846
Code: Select all
ads7846 spi3.0: setup mode 0, 8 bits/w, 1500000 Hz max --> 0
ads7846 spi3.0: touchscreen, irq 293
ads7846 spi3.0: no device detected, test read result was 0x00000000