Re: [PATCH] Add support for HTC Shift Touchscreen

From: Pekka Enberg
Date: Mon May 19 2008 - 01:22:28 EST


On Mon, May 19, 2008 at 6:16 AM, Pau Oliva Fora <pau@xxxxxxxxxx> wrote:
> The patch below adds support for HTC Shift UMPC touchscreen.
>
> Signed-off-by: Pau Oliva Fora <pau@xxxxxxxxxx>
>
> ---
>
> Patch against linux-2.6.25.4, should apply clean on other versions too.
> Includes all the suggestions by Sam Ravnborg, Pekka Enberg and Marcin
> Slusarz.
>
>
> diff -uprN linux-2.6.25.4/drivers/input/touchscreen/htcpen.c
> linux/drivers/input/touchscreen/htcpen.c
> --- linux-2.6.25.4/drivers/input/touchscreen/htcpen.c 1970-01-01
> 01:00:00.000000000 +0100
> +++ linux/drivers/input/touchscreen/htcpen.c 2008-05-19
> 04:44:16.000000000 +0200
> @@ -0,0 +1,199 @@
> +/*
> + * HTC Shift touchscreen driver
> + *
> + * Copyright (C) 2008 Pau Oliva Fora <pof@xxxxxxxxxx>
> + *
> + * Thanks to:
> + * Heikki Linnakangas - Penmount LPC touchscreen driver
> + * Wacom / Ping Cheng - Help on linuxwacom-devel
> + * Esteve Espuna - Ideas, tips, moral support :)
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License version 2 as published
> + * by the Free Software Foundation.
> + */
> +
> +#include <linux/errno.h>
> +#include <linux/kernel.h>
> +#include <linux/module.h>
> +#include <linux/input.h>
> +#include <linux/interrupt.h>
> +#include <linux/io.h>
> +#include <linux/init.h>
> +#include <linux/irq.h>
> +#include <linux/isa.h>
> +
> +#define DRIVER_VERSION "0.7"
> +#define DRIVER_DESC "HTC Shift touchscreen driver v" DRIVER_VERSION
> +
> +MODULE_AUTHOR("Pau Oliva Fora <pau@xxxxxxxxxx>");
> +MODULE_DESCRIPTION(DRIVER_DESC);
> +MODULE_VERSION(DRIVER_VERSION);
> +MODULE_LICENSE("GPL");
> +
> +#define HTCPEN_PORT_IRQ_CLEAR 0x068
> +#define HTCPEN_PORT_INIT 0x06c
> +#define HTCPEN_PORT_INDEX 0x0250
> +#define HTCPEN_PORT_DATA 0x0251
> +#define HTCPEN_IRQ 3
> +
> +#define X_INDEX 3
> +#define Y_INDEX 5
> +#define LSB_XY_INDEX 0xc
> +#define X_AXIS_MAX 2040
> +#define Y_AXIS_MAX 2040
> +#define DEVICE_ENABLE 0xa2
> +
> +static int inverse_x;
> +module_param(inverse_x, bool, 0644);
> +MODULE_PARM_DESC(inverse_x, "If set X axis is inversed");
> +static int inverse_y;
> +module_param(inverse_y, bool, 0644);
> +MODULE_PARM_DESC(inverse_y, "If set Y axis is inversed");
> +
> +struct input_dev *htcpen_dev;

The point of converting to isa_register_driver() is to use
dev_set_drvdata()/dev_get_drvdata() instead of having a global
variable like this.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/