linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Fritz <chf.fritz@googlemail.com>
To: Kevin McNeely <kev@cypress.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	David Brown <davidb@codeaurora.org>,
	Trilok Soni <tsoni@codeaurora.org>,
	Fred <fwk@ubuntu.linuxcertified.com>,
	Samuel Ortiz <sameo@linux.intel.com>,
	Eric Miao <eric.y.miao@gmail.com>,
	Mark Brown <broonie@opensource.wolfsonmicro.com>,
	Simtec Linux Team <linux@simtec.co.uk>,
	Arnaud Patard <arnaud.patard@rtp-net.org>,
	Antonio Ospite <ospite@studenti.unina.it>,
	Henrik Rydberg <rydberg@euromail.se>,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	chf.fritz@googlemail.com
Subject: Re: [PATCH] i2c: cyttsp i2c touchscreen driver init submit
Date: Tue, 13 Jul 2010 04:34:24 +0200	[thread overview]
Message-ID: <1278988464.4037.9.camel@lovely.krouter> (raw)
In-Reply-To: <1278968210-6827-1-git-send-email-kev@cypress.com>

On Mon, 2010-07-12 at 13:56 -0700, Kevin McNeely wrote:
> From: Fred <fwk@ubuntu.linuxcertified.com>
> 
> This is a new touchscreen driver for the Cypress Semiconductor
> cyttsp family of devices.  This driver is for the i2c version
> of cyttsp parts.
> 
> Signed-off-by: Kevin McNeely <kev@cypress.com>
> ---
>  drivers/input/touchscreen/Kconfig      |   13 +
>  drivers/input/touchscreen/Makefile     |    1 +
>  drivers/input/touchscreen/cyttsp-i2c.c | 2016 ++++++++++++++++++++++++++++++++
>  include/linux/cyttsp.h                 |  649 ++++++++++
>  4 files changed, 2679 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/input/touchscreen/cyttsp-i2c.c
>  create mode 100644 include/linux/cyttsp.h
> 
> diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
> index 3b9d5e2..a7a69a0 100644
> --- a/drivers/input/touchscreen/Kconfig
> +++ b/drivers/input/touchscreen/Kconfig
> @@ -603,4 +603,17 @@ config TOUCHSCREEN_TPS6507X
>  	  To compile this driver as a module, choose M here: the
>  	  module will be called tps6507x_ts.
>  
> +config TOUCHSCREEN_CYTTSP_I2C
> +	default n
> +	tristate "Cypress TTSP i2c touchscreen"
> +	depends on I2C
> +	help
> +	  Say Y here if you have a Cypress TTSP touchscreen
> +	  connected to your system's i2c bus.
> +
> +	  If unsure, say N.
> +
> +	  To compile this driver as a module, choose M here: the
> +	  module will be called cyttsp_i2c.

below it's named cyttsp-i2c

> +
>  endif
> diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile
> index 497964a..2026cb8 100644
> --- a/drivers/input/touchscreen/Makefile
> +++ b/drivers/input/touchscreen/Makefile
> @@ -47,3 +47,4 @@ obj-$(CONFIG_TOUCHSCREEN_WM97XX_MAINSTONE)	+= mainstone-wm97xx.o
>  obj-$(CONFIG_TOUCHSCREEN_WM97XX_ZYLONITE)	+= zylonite-wm97xx.o
>  obj-$(CONFIG_TOUCHSCREEN_W90X900)	+= w90p910_ts.o
>  obj-$(CONFIG_TOUCHSCREEN_TPS6507X)	+= tps6507x-ts.o
> +obj-$(CONFIG_TOUCHSCREEN_CYTTSP_I2C)	+= cyttsp-i2c.o
> diff --git a/drivers/input/touchscreen/cyttsp-i2c.c b/drivers/input/touchscreen/cyttsp-i2c.c
> new file mode 100644
> index 0000000..8397aa1
> --- /dev/null
> +++ b/drivers/input/touchscreen/cyttsp-i2c.c
> @@ -0,0 +1,2016 @@
> +/* Source for:
> + * Cypress TrueTouch(TM) Standard Product I2C touchscreen driver.
> + * drivers/input/touchscreen/cyttsp-i2c.c

To quote Dmitry Torokhov:
"No file names  (and especially paths) in comment blocks please - makes
harder to move stuff around."

> + *
> + * Copyright (C) 2009, 2010 Cypress Semiconductor, Inc.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * version 2, and only version 2, as published by the
> + * Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License along
> + * with this program; if not, write to the Free Software Foundation, Inc.,
> + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
> + *
> + * Cypress reserves the right to make changes without further notice
> + * to the materials described herein. Cypress does not assume any
> + * liability arising out of the application described herein.

Sure, Cypress can engineer what they want. The warranty is already
covered by GPL.

> + *
> + * Contact Cypress Semiconductor at www.cypress.com

Maintainer or at least a email ad would be nice I think.

> + *
> + */
> +
> +#include <linux/delay.h>
> +#include <linux/init.h>
> +#include <linux/module.h>
> +#include <linux/i2c.h>
> +#include <linux/input.h>
> +#include <linux/slab.h>
> +#include <linux/gpio.h>
> +#include <linux/irq.h>
> +#include <linux/interrupt.h>
> +#include <linux/timer.h>
> +#include <linux/workqueue.h>
> +#include <linux/byteorder/generic.h>
> +#include <linux/bitops.h>
> +#ifdef CONFIG_HAS_EARLYSUSPEND
> +#include <linux/earlysuspend.h>
> +#endif /* CONFIG_HAS_EARLYSUSPEND */
> +
> +#define CY_DECLARE_GLOBALS
> +
> +#include <linux/cyttsp.h>

Would it be possible to move cyttsp.h to the local folder?

> +
> +uint32_t cyttsp_tsdebug1 = 0xff;

why can't this be static?
why is it in the header too?

> +module_param_named(tsdebug1, cyttsp_tsdebug1, uint, 0664);
> +
> +/* CY TTSP I2C Driver private data */
> +struct cyttsp {
> +	struct i2c_client *client;
> +	struct input_dev *input;
> +	struct work_struct work;
> +	struct timer_list timer;
> +	struct mutex mutex;
> +	char phys[32];
> +	struct cyttsp_platform_data *platform_data;
> +	u8 num_prv_st_tch;
> +	u16 act_trk[CY_NUM_TRK_ID];
> +	u16 prv_st_tch[CY_NUM_ST_TCH_ID];
> +	u16 prv_mt_tch[CY_NUM_MT_TCH_ID];
> +	u16 prv_mt_pos[CY_NUM_TRK_ID][2];
> +	atomic_t irq_enabled;
> +#ifdef CONFIG_HAS_EARLYSUSPEND
> +	struct early_suspend early_suspend;
> +#endif /* CONFIG_HAS_EARLYSUSPEND */
> +};
> +static u8 irq_cnt;		/* comparison counter with register valuw */
> +static u32 irq_cnt_total;	/* total interrupts */
> +static u32 irq_err_cnt;		/* count number of touch interrupts with err */
> +#define CY_IRQ_CNT_MASK	0x000000FF	/* mapped for sizeof count in reg */
> +#define CY_IRQ_CNT_REG	0x00		/* tt_undef[0]=reg 0x1B - Gen3 only */
> +
> +#ifdef CONFIG_HAS_EARLYSUSPEND
> +static void cyttsp_early_suspend(struct early_suspend *handler);
> +static void cyttsp_late_resume(struct early_suspend *handler);
> +#endif /* CONFIG_HAS_EARLYSUSPEND */
> +
> +static struct workqueue_struct *cyttsp_ts_wq;
> +
> +
> +/* ****************************************************************************
> + * Prototypes for static functions
> + * ************************************************************************** */

star gap, and more than 80 chars

> +static void cyttsp_xy_worker(struct work_struct *work);
> +static irqreturn_t cyttsp_irq(int irq, void *handle);
> +static int cyttsp_inlist(u16 prev_track[],
> +			u8 cur_trk_id, u8 *prev_loc, u8 num_touches);
> +static int cyttsp_next_avail_inlist(u16 cur_trk[],
> +			u8 *new_loc, u8 num_touches);
> +static int cyttsp_putbl(struct cyttsp *ts, int show,
> +			int show_status, int show_version, int show_cid);
> +static int __devinit cyttsp_probe(struct i2c_client *client,
> +			const struct i2c_device_id *id);
> +static int __devexit cyttsp_remove(struct i2c_client *client);
> +static int cyttsp_resume(struct i2c_client *client);
> +static int cyttsp_suspend(struct i2c_client *client, pm_message_t message);

could these prototypes be avoided?

> +
> +/* Static variables */
> +static struct cyttsp_gen3_xydata_t g_xy_data;
> +static struct cyttsp_bootloader_data_t g_bl_data;
> +static struct cyttsp_sysinfo_data_t g_sysinfo_data;
> +static const struct i2c_device_id cyttsp_id[] = {
> +	{ CY_I2C_NAME, 0 },  { }
> +};
> +static u8 bl_cmd[] = {
> +	CY_BL_FILE0, CY_BL_CMD, CY_BL_EXIT,
> +	CY_BL_KEY0, CY_BL_KEY1, CY_BL_KEY2,
> +	CY_BL_KEY3, CY_BL_KEY4, CY_BL_KEY5,
> +	CY_BL_KEY6, CY_BL_KEY7};
> +
> +MODULE_DEVICE_TABLE(i2c, cyttsp_id);
> +
> +static struct i2c_driver cyttsp_driver = {
> +	.driver = {
> +		.name = CY_I2C_NAME,
> +		.owner = THIS_MODULE,
> +	},
> +	.probe = cyttsp_probe,
> +	.remove = __devexit_p(cyttsp_remove),
> +	.suspend = cyttsp_suspend,
> +	.resume = cyttsp_resume,
> +	.id_table = cyttsp_id,
> +};
> +
> +MODULE_LICENSE("GPL");
> +MODULE_DESCRIPTION("Cypress TrueTouch(R) Standard touchscreen driver");
> +MODULE_AUTHOR("Cypress");

Why not re-factoring the whole driver to keep consistency with other
touchpad drivers?
A maintainer to contact or at least a email-ad would be nice I think.
You could use scripts/checkpatch.pl to find some warnings.

[..]



  reply	other threads:[~2010-07-13  2:32 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <Kevin McNeely <kev@cypress.com>
2010-07-12 20:56 ` [PATCH] i2c: cyttsp i2c touchscreen driver init submit Kevin McNeely
2010-07-13  2:34   ` Christoph Fritz [this message]
2010-08-04 16:30     ` Kevin McNeely
2010-07-13  6:48   ` Henrik Rydberg
2010-08-04 16:38     ` Kevin McNeely
2010-07-13  7:31   ` Trilok Soni
2010-07-13  7:55     ` Dmitry Torokhov
2010-07-13  8:42       ` Trilok Soni
2010-07-22 10:33         ` Trilok Soni
2010-07-27 15:20           ` Kevin McNeely
2010-08-04 17:27       ` Kevin McNeely
2010-07-19  9:28     ` Jean Delvare
2010-08-04 17:22     ` Kevin McNeely
2010-08-05 18:12 ` [PATCH] i2c: cyttsp i2c and spi " Kevin McNeely
2010-08-05 20:45   ` Trilok Soni
2010-08-05 21:07     ` Dmitry Torokhov
2010-08-07  0:39       ` Kevin McNeely
2010-08-07  0:52     ` Kevin McNeely
2010-08-05 23:06   ` Henrik Rydberg
2010-08-07  0:32     ` Kevin McNeely
2010-08-07  0:49       ` Henrik Rydberg
2010-08-10  0:51         ` Kevin McNeely
2010-08-06  9:06   ` Trilok Soni
2010-08-10  0:49     ` Kevin McNeely
2010-11-09 18:25 ` [PATCH] touchscreen: Cypress TTSP G3 MTDEV Core Driver Kevin McNeely
2010-11-15 16:46   ` Henrik Rydberg
2010-11-19 17:39     ` Kevin McNeely
2010-12-01  7:22       ` Trilok Soni
2010-12-01 14:38         ` Henrik Rydberg
2010-12-01 23:59           ` Kevin McNeely
2010-12-02  0:01             ` Henrik Rydberg
2010-12-02  0:34   ` Dmitry Torokhov
2010-11-09 18:25 ` [PATCH] i2c: Cypress TTSP G3 MTDEV I2C Device Driver Kevin McNeely
2010-11-09 18:25 ` [PATCH] spi: Cypress TTSP G3 MTDEV SPI " Kevin McNeely
2010-12-04  2:06 ` [v2] touchscreen Cypress TTSP G3 MTDEV Core Driver Kevin McNeely
2010-12-05  9:11   ` Henrik Rydberg
2010-12-04  2:06 ` [v2] 2/3 i2c: Cypress TTSP G3 MTDEV I2C Device Driver Kevin McNeely
2010-12-04  2:06 ` [v2] 3/3 spi: Cypress TTSP G3 MTDEV SPI " Kevin McNeely
2010-12-29 19:17 ` [v3 1/3] 1/3 Touchscreen: Cypress TTSP G3 MTDEV Core Driver Kevin McNeely
2010-12-30  6:04   ` Shubhrajyoti Datta
2011-01-05  0:45     ` Kevin McNeely
2010-12-31 11:53   ` Henrik Rydberg
2010-12-31 12:55     ` Trilok Soni
2010-12-31 13:58       ` Henrik Rydberg
2011-01-03  9:44         ` Trilok Soni
2011-01-03 17:03     ` Kevin McNeely
2011-01-03 18:45       ` Henrik Rydberg
2011-01-03 20:50         ` Kevin McNeely
2011-01-04  1:50   ` Hong Liu
2011-01-05  0:38     ` Kevin McNeely
2010-12-29 19:17 ` [v3 2/3] 2/3 i2c: Cypress TTSP G3 MTDEV I2C Device Driver Kevin McNeely
2011-01-04  1:45   ` Hong Liu
2011-01-05  0:37     ` Kevin McNeely
2010-12-29 19:17 ` [v3 3/3] 3/3 spi: Cypress TTSP G3 MTDEV SPI " Kevin McNeely
2011-01-05  0:54 ` [v4 1/3] 1/3 Touchscreen: Cypress TTSP G3 Core Driver Kevin McNeely
2011-01-05  8:59   ` Henrik Rydberg
2011-01-05 17:07     ` Kevin McNeely
2011-01-05 17:34       ` Henrik Rydberg
2011-01-10 19:27         ` Kevin McNeely
2011-01-10 21:11           ` Dmitry Torokhov
2011-01-10 21:17             ` Kevin McNeely
2011-02-24 18:31         ` Kevin McNeely
2011-02-27 12:34           ` Henrik Rydberg
2011-01-05  0:54 ` [v4 2/3] 2/3 i2c: Cypress TTSP G3 I2C Device Driver Kevin McNeely
2011-01-05  0:54 ` [v4 3/3] 3/3 spi: Cypress TTSP G3 SPI " Kevin McNeely
2011-01-12 18:45   ` Dmitry Torokhov
2011-01-12 19:02     ` Kevin McNeely
2011-01-20 11:10       ` Trilok Soni
2011-01-21  9:27         ` Dmitry Torokhov
2011-01-21 22:14           ` Kevin McNeely

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1278988464.4037.9.camel@lovely.krouter \
    --to=chf.fritz@googlemail.com \
    --cc=arnaud.patard@rtp-net.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=davidb@codeaurora.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=eric.y.miao@gmail.com \
    --cc=fwk@ubuntu.linuxcertified.com \
    --cc=kev@cypress.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@simtec.co.uk \
    --cc=ospite@studenti.unina.it \
    --cc=rydberg@euromail.se \
    --cc=sameo@linux.intel.com \
    --cc=tsoni@codeaurora.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).