Input: ads7846 - introduce platform specific way to synchronize sampling
Noises can be introduced when LCD signals are being driven, some platforms provide a signal to assist the synchronization of this sampling procedure. Signed-off-by: Eric Miao <eric.miao@marvell.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
This commit is contained in:
committed by
Dmitry Torokhov
parent
b79e83bdd9
commit
fd746d540a
@@ -127,6 +127,8 @@ struct ads7846 {
|
|||||||
void (*filter_cleanup)(void *data);
|
void (*filter_cleanup)(void *data);
|
||||||
int (*get_pendown_state)(void);
|
int (*get_pendown_state)(void);
|
||||||
int gpio_pendown;
|
int gpio_pendown;
|
||||||
|
|
||||||
|
void (*wait_for_sync)(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
/* leave chip selected when we're done, for quicker re-select? */
|
/* leave chip selected when we're done, for quicker re-select? */
|
||||||
@@ -511,6 +513,10 @@ static int get_pendown_state(struct ads7846 *ts)
|
|||||||
return !gpio_get_value(ts->gpio_pendown);
|
return !gpio_get_value(ts->gpio_pendown);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void null_wait_for_sync(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* PENIRQ only kicks the timer. The timer only reissues the SPI transfer,
|
* PENIRQ only kicks the timer. The timer only reissues the SPI transfer,
|
||||||
* to retrieve touchscreen status.
|
* to retrieve touchscreen status.
|
||||||
@@ -686,6 +692,7 @@ static void ads7846_rx_val(void *ads)
|
|||||||
default:
|
default:
|
||||||
BUG();
|
BUG();
|
||||||
}
|
}
|
||||||
|
ts->wait_for_sync();
|
||||||
status = spi_async(ts->spi, m);
|
status = spi_async(ts->spi, m);
|
||||||
if (status)
|
if (status)
|
||||||
dev_err(&ts->spi->dev, "spi_async --> %d\n",
|
dev_err(&ts->spi->dev, "spi_async --> %d\n",
|
||||||
@@ -723,6 +730,7 @@ static enum hrtimer_restart ads7846_timer(struct hrtimer *handle)
|
|||||||
} else {
|
} else {
|
||||||
/* pen is still down, continue with the measurement */
|
/* pen is still down, continue with the measurement */
|
||||||
ts->msg_idx = 0;
|
ts->msg_idx = 0;
|
||||||
|
ts->wait_for_sync();
|
||||||
status = spi_async(ts->spi, &ts->msg[0]);
|
status = spi_async(ts->spi, &ts->msg[0]);
|
||||||
if (status)
|
if (status)
|
||||||
dev_err(&ts->spi->dev, "spi_async --> %d\n", status);
|
dev_err(&ts->spi->dev, "spi_async --> %d\n", status);
|
||||||
@@ -947,6 +955,8 @@ static int __devinit ads7846_probe(struct spi_device *spi)
|
|||||||
ts->penirq_recheck_delay_usecs =
|
ts->penirq_recheck_delay_usecs =
|
||||||
pdata->penirq_recheck_delay_usecs;
|
pdata->penirq_recheck_delay_usecs;
|
||||||
|
|
||||||
|
ts->wait_for_sync = pdata->wait_for_sync ? : null_wait_for_sync;
|
||||||
|
|
||||||
snprintf(ts->phys, sizeof(ts->phys), "%s/input0", dev_name(&spi->dev));
|
snprintf(ts->phys, sizeof(ts->phys), "%s/input0", dev_name(&spi->dev));
|
||||||
|
|
||||||
input_dev->name = "ADS784x Touchscreen";
|
input_dev->name = "ADS784x Touchscreen";
|
||||||
|
@@ -51,5 +51,6 @@ struct ads7846_platform_data {
|
|||||||
void **filter_data);
|
void **filter_data);
|
||||||
int (*filter) (void *filter_data, int data_idx, int *val);
|
int (*filter) (void *filter_data, int data_idx, int *val);
|
||||||
void (*filter_cleanup)(void *filter_data);
|
void (*filter_cleanup)(void *filter_data);
|
||||||
|
void (*wait_for_sync)(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user