diff options
author | Michael Hsu <mhsu@nvidia.com> | 2010-06-19 12:27:07 -0700 |
---|---|---|
committer | Gary King <gking@nvidia.com> | 2010-06-21 09:13:21 -0700 |
commit | 60d59836a1305e8936f6ca8eb52910c65c7fa336 (patch) | |
tree | 9c0f5b1f3087bc43d9d47689bde8ba26a2aa1925 | |
parent | cf1a07ab69848ce803a8c6ccb0374751e065de14 (diff) |
[ARM/tegra] Touch driver event size for finger vs cheek events.
Touch screen drivers must report size value for presses. If
size < 0.6, then it is considered finger press. If size > 0.6,
then event is considered to be cheek press.
The distinction is important in phone mode, because cheek presses
are ignored in that mode (the user has the device next to his face
in phone mode, and will likely press cheek accidentally against
touch screen).
Bug 700050
Change-Id: I6792a888f4761672230140e011e9fdc5d60696d3
Reviewed-on: http://git-master/r/2903
Reviewed-by: Michael Hsu <mhsu@nvidia.com>
Tested-by: Michael Hsu <mhsu@nvidia.com>
Reviewed-by: Gary King <gking@nvidia.com>
-rw-r--r-- | drivers/input/touchscreen/tegra_odm.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/drivers/input/touchscreen/tegra_odm.c b/drivers/input/touchscreen/tegra_odm.c index 3399d9918e76..b8b1852df14c 100644 --- a/drivers/input/touchscreen/tegra_odm.c +++ b/drivers/input/touchscreen/tegra_odm.c @@ -35,7 +35,19 @@ #include <nvodm_touch.h> #define TOOL_PRESSURE 100 -#define TOOL_WIDTH 8 + +#define TOOL_WIDTH_MAX 8 + +/* Ratio TOOL_WIDTH_FINGER / TOOL_WIDTH_MAX must be < 0.6f to be considered + * "finger" press. + */ +#define TOOL_WIDTH_FINGER 1 + +/* Ratio TOOL_WIDTH_CHEEK / TOOL_WIDTH_MAX must be > 0.6f to be considered + * "cheek" press. (Cheek presses are ignored in phone mode, under assumption + * that user accidentally pressed cheek against touch screen.) + */ + /* the kernel supports 5 fingers only as of now */ #define MAX_FINGERS 5 @@ -119,7 +131,7 @@ static int tegra_touch_thread(void *pdata) NvOdmTouchCoordinateInfo c = {0}; NvU32 x[MAX_FINGERS] = {0}, y[MAX_FINGERS] = {0}, i = 0; NvU32 Pressure[MAX_FINGERS] = {TOOL_PRESSURE}; - NvU32 Width[MAX_FINGERS] = {TOOL_WIDTH}; + NvU32 Width[MAX_FINGERS] = {TOOL_WIDTH_FINGER}; static NvU32 prev_x0 = 0, prev_y0 = 0; NvBool bKeepReadingSamples = NV_FALSE; NvU32 fingers = 0, index, offset; @@ -160,7 +172,7 @@ static int tegra_touch_thread(void *pdata) if (caps->IsWidthSupported) Width[0] = c.additionalInfo.width[0]; else - Width[0] = TOOL_WIDTH; + Width[0] = TOOL_WIDTH_FINGER; } else if ((fingers >= 2) && (fingers <= MAX_FINGERS)) { for (i = 0; i < fingers; i++) { @@ -173,7 +185,7 @@ static int tegra_touch_thread(void *pdata) if (caps->IsWidthSupported) Width[i] = c.additionalInfo.width[i]; else - Width[i] = TOOL_WIDTH; + Width[i] = TOOL_WIDTH_FINGER; } } else { @@ -376,9 +388,9 @@ static int __init tegra_touch_probe(struct platform_device *pdev) } else { input_set_abs_params(touch->input_dev, ABS_TOOL_WIDTH, 0, - TOOL_WIDTH, 0, 0); + TOOL_WIDTH_MAX, 0, 0); input_set_abs_params(touch->input_dev, ABS_MT_WIDTH_MAJOR, 0, - TOOL_WIDTH, 0, 0); + TOOL_WIDTH_MAX, 0, 0); } platform_set_drvdata(pdev, touch); |