mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-22 14:41:27 +00:00
Input: ads7846 - support swapping x and y axes
Signed-off-by: Michael Roth <mroth@nessie.de> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
This commit is contained in:
parent
225c9886b9
commit
86579a4ccc
2 changed files with 8 additions and 0 deletions
|
@ -97,6 +97,8 @@ struct ads7846 {
|
||||||
u16 x_plate_ohms;
|
u16 x_plate_ohms;
|
||||||
u16 pressure_max;
|
u16 pressure_max;
|
||||||
|
|
||||||
|
bool swap_xy;
|
||||||
|
|
||||||
struct ads7846_packet *packet;
|
struct ads7846_packet *packet;
|
||||||
|
|
||||||
struct spi_transfer xfer[18];
|
struct spi_transfer xfer[18];
|
||||||
|
@ -599,6 +601,10 @@ static void ads7846_rx(void *ads)
|
||||||
dev_dbg(&ts->spi->dev, "DOWN\n");
|
dev_dbg(&ts->spi->dev, "DOWN\n");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ts->swap_xy)
|
||||||
|
swap(x, y);
|
||||||
|
|
||||||
input_report_abs(input, ABS_X, x);
|
input_report_abs(input, ABS_X, x);
|
||||||
input_report_abs(input, ABS_Y, y);
|
input_report_abs(input, ABS_Y, y);
|
||||||
input_report_abs(input, ABS_PRESSURE, Rt);
|
input_report_abs(input, ABS_PRESSURE, Rt);
|
||||||
|
@ -917,6 +923,7 @@ static int __devinit ads7846_probe(struct spi_device *spi)
|
||||||
ts->spi = spi;
|
ts->spi = spi;
|
||||||
ts->input = input_dev;
|
ts->input = input_dev;
|
||||||
ts->vref_mv = pdata->vref_mv;
|
ts->vref_mv = pdata->vref_mv;
|
||||||
|
ts->swap_xy = pdata->swap_xy;
|
||||||
|
|
||||||
hrtimer_init(&ts->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
|
hrtimer_init(&ts->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
|
||||||
ts->timer.function = ads7846_timer;
|
ts->timer.function = ads7846_timer;
|
||||||
|
|
|
@ -17,6 +17,7 @@ struct ads7846_platform_data {
|
||||||
u16 vref_mv; /* external vref value, milliVolts */
|
u16 vref_mv; /* external vref value, milliVolts */
|
||||||
bool keep_vref_on; /* set to keep vref on for differential
|
bool keep_vref_on; /* set to keep vref on for differential
|
||||||
* measurements as well */
|
* measurements as well */
|
||||||
|
bool swap_xy; /* swap x and y axes */
|
||||||
|
|
||||||
/* Settling time of the analog signals; a function of Vcc and the
|
/* Settling time of the analog signals; a function of Vcc and the
|
||||||
* capacitance on the X/Y drivers. If set to non-zero, two samples
|
* capacitance on the X/Y drivers. If set to non-zero, two samples
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue