From: "Ville Syrjälä" <syrjala@sci.fi>
To: Alan Cox <alan@linux.intel.com>
Cc: linux-input@vger.kernel.org, dmitry.torokhov@gmail.com
Subject: Re: cy8ctmg110: capacitive touchscreen support
Date: Thu, 8 Jul 2010 20:44:01 +0300 [thread overview]
Message-ID: <20100708174401.GJ10135@sci.fi> (raw)
In-Reply-To: <20100708161040.23957.36738.stgit@localhost.localdomain>
On Thu, Jul 08, 2010 at 04:11:38PM -0000, Alan Cox wrote:
> From: Samuli Konttila <samuli.konttila@aavamobile.com>
>
> Add support for the cy8ctmg110 capacitive touchscreen used on some embedded
> devices.
>
> (Some clean up by Alan Cox)
>
> Signed-off-by: Alan Cox <alan@linux.intel.com>
>
> ---
> drivers/input/touchscreen/Kconfig | 14 +
> drivers/input/touchscreen/Makefile | 1
> drivers/input/touchscreen/cy8ctmg110_ts.c | 470 +++++++++++++++++++++++++++++
> 3 files changed, 485 insertions(+), 0 deletions(-)
> create mode 100644 drivers/input/touchscreen/cy8ctmg110_ts.c
>
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-input" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
<snip>
> diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
> +/*
> + * cy8ctmg110_write_req write regs to the i2c devices
> + */
> +static int cy8ctmg110_write_req(struct cy8ctmg110 *tsc, unsigned char reg,
^
s/req/reg
> + unsigned char len, unsigned char *value)
> +{
> + struct i2c_client *client = tsc->client;
> + unsigned int ret;
> + unsigned char i2c_data[6];
> +
> + BUG_ON(len > 5);
> +
> + i2c_data[0] = reg;
> + memcpy(i2c_data + 1, value, len);
> +
> + ret = i2c_master_send(client, i2c_data, len + 1);
> + if (ret != 1) {
> + dev_err(&client->dev,
> + "cy8ctmg110 touch : i2c write data cmd failed\n");
> + return ret;
> + }
> + return 0;
> +}
> +
> +/*
> + * cy8ctmg110_read_req read regs from i2c devise
> + */
> +
> +static int cy8ctmg110_read_req(struct cy8ctmg110 *tsc,
ditto
> + unsigned char *i2c_data, unsigned char len, unsigned char cmd)
> +{
> + struct i2c_client *client = tsc->client;
> + unsigned int ret;
> +
> + /* first write slave position to i2c devices */
> + ret = i2c_master_send(client, &cmd, 1);
> + if (ret != 1)
> + return ret;
> +
> + /* Second read data from position */
> + ret = i2c_master_recv(client, i2c_data, 1);
> + if (ret != 1)
> + return ret;
> + return 0;
> +}
> +
<snip>
> +/*
> + * cy8ctmg110_irq_handler irq handling function
> + */
> +
> +static irqreturn_t cy8ctmg110_irq_handler(int irq, void *dev_id)
> +{
> + struct cy8ctmg110 *tsc = (struct cy8ctmg110 *) dev_id;
> + cy8ctmg110_touch_pos(tsc);
i2c from an interrupt handler? Is there some problem with using a
threaded irq handler?
I see this stuff ends up in i2c_transfer() which will fail with
-EAGAIN if it can't get the bus lock while irqs are disabled. But
-EAGAIN apparently isn't handled by the driver. So what happens
in that case? The event is lost?
> + return IRQ_HANDLED;
> +}
> +
--
Ville Syrjälä
syrjala@sci.fi
http://www.sci.fi/~syrjala/
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2010-07-08 17:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-08 16:11 [PATCH] cy8ctmg110: capacitive touchscreen support Alan Cox
2010-07-08 17:26 ` Dmitry Torokhov
2010-07-09 14:13 ` Alan Cox
2010-07-08 17:44 ` Ville Syrjälä [this message]
2010-07-09 13:51 ` Alan Cox
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=20100708174401.GJ10135@sci.fi \
--to=syrjala@sci.fi \
--cc=alan@linux.intel.com \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.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).