Skip to content

Instantly share code, notes, and snippets.

@itszero
Created January 20, 2010 04:45
Show Gist options
  • Save itszero/281613 to your computer and use it in GitHub Desktop.
Save itszero/281613 to your computer and use it in GitHub Desktop.
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index 0fda6e1..8a0f8d3 100644
@@ -545,11 +563,12 @@ static struct platform_device leds_gpio = {
static struct gpio_keys_button gpio_buttons[] = {
{
- .code = BTN_EXTRA,
- .gpio = 7,
+ .code = 158,
+ .gpio = 26,
.desc = "user",
.wakeup = 1,
- },
+ .active_low = 1
+ }
};
static struct gpio_keys_platform_data gpio_key_info = {
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index 2ae5ab8..59e1671 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -173,6 +173,16 @@ struct ads7846 {
#define READ_X(vref) (READ_12BIT_DFR(x, 1, vref))
#define PWRDOWN (READ_12BIT_DFR(y, 0, 0)) /* LAST */
+/* Zero.20100119: Add ads7846.flip=1 param to allow flipping the coordinate.
+ LCD panel on DevKit8k have the coordinate left-right, top-bottom flipped for unknwon reason,
+ this is intented to workaround this problem. */
+
+static int flipcord = 0;
+static int flip_xmin = 0, flip_xmax = 0, flip_ymin = 0, flip_ymax = 0;
+module_param(flipcord, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
+MODULE_PARM_DESC(flipcord, "flip coordinate to workaround devkit8k-android issue");
+#define FLIP_POINT(curr, min, max) (max - (curr - min))
+
/* single-ended samples need to first power up reference voltage;
* we leave both ADC and VREF powered
*/
@@ -200,6 +210,7 @@ struct ser_req {
struct spi_transfer xfer[6];
};
+
static void ads7846_enable(struct ads7846 *ts);
static void ads7846_disable(struct ads7846 *ts);
@@ -593,6 +604,13 @@ static void ads7846_rx(void *ads)
dev_dbg(&ts->spi->dev, "DOWN\n");
#endif
}
+ if (flipcord)
+ {
+ dev_dbg(&ts->spi->dev, "original input: %4d/%4d/%4d\n", x, y, Rt);
+ x = FLIP_POINT(x, flip_xmin, flip_xmax);
+ y = FLIP_POINT(y, flip_ymin, flip_ymax);
+ dev_dbg(&ts->spi->dev, "flipped input: %4d/%4d/%4d\n", x, y, Rt);
+ }
input_report_abs(input, ABS_X, x);
input_report_abs(input, ABS_Y, y);
input_report_abs(input, ABS_PRESSURE, Rt);
@@ -975,6 +993,11 @@ static int __devinit ads7846_probe(struct spi_device *spi)
input_set_abs_params(input_dev, ABS_PRESSURE,
pdata->pressure_min, pdata->pressure_max, 0, 0);
+ /* Zero.20100119 : flipcord need min, max to perform correctly */
+ flip_xmin = pdata->x_min ? : 0; flip_xmax = pdata->x_max ? : MAX_12BIT;
+ flip_ymin = pdata->y_min ? : 0; flip_ymax = pdata->y_max ? : MAX_12BIT;
+ dev_dbg(&spi->dev, "flipcord: baseinfo = x(%d, %d), y(%d, %d)\n", flip_xmin, flip_xmax, flip_ymin, flip_ymax);
+
vref = pdata->keep_vref_on;
/* set up the transfers to read touchscreen state; this assumes we
@@ -1228,6 +1251,8 @@ static struct spi_driver ads7846_driver = {
static int __init ads7846_init(void)
{
+ if (flipcord == 1)
+ printk(KERN_INFO "ads7846: coordinate flipping enabled\n");
return spi_register_driver(&ads7846_driver);
}
module_init(ads7846_init);
diff --git a/drivers/video/omap/lcd_omap3devkit8000.c b/drivers/video/omap/lcd_omap3devkit8000.c
index f72432f..ddea149 100644
--- a/drivers/video/omap/lcd_omap3devkit8000.c
+++ b/drivers/video/omap/lcd_omap3devkit8000.c
@@ -32,8 +32,8 @@
#include <asm/mach-types.h>
-#define DVI
-//#undef DVI
+//#define DVI
+#undef DVI
#define LCD_PANEL_ENABLE_GPIO 170
/*
diff --git a/drivers/video/omap/omapfb_main.c b/drivers/video/omap/omapfb_main.c
index 59d1215..6be8c5c 100644
--- a/drivers/video/omap/omapfb_main.c
+++ b/drivers/video/omap/omapfb_main.c
@@ -357,7 +357,7 @@ static int ctrl_init(struct omapfb_device *fbdev)
/* 12 bpp is packed in 16 bits */
if (bpp == 12)
bpp = 16;
- def_size = def_vxres * def_vyres * bpp / 8;
+ def_size = def_vxres * def_vyres * 2 * bpp / 8;
fbdev->mem_desc.region_cnt = 1;
fbdev->mem_desc.region[0].size = PAGE_ALIGN(def_size);
}
@@ -1684,7 +1684,7 @@ static int fbinfo_init(struct omapfb_device *fbdev, struct fb_info *info)
var->xres = def_vxres;
var->yres = def_vyres;
var->xres_virtual = def_vxres;
- var->yres_virtual = def_vyres;
+ var->yres_virtual = def_vyres * 2;
var->rotate = def_rotate;
var->bits_per_pixel = fbdev->panel->bpp;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment