Re: cy8ctmg110: capacitive touchscreen support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jul 08, 2010 at 04:11:38PM -0000, Alan Cox wrote:
> From: Samuli Konttila <samuli.konttila@xxxxxxxxxxxxxx>
> 
> Add support for the cy8ctmg110 capacitive touchscreen used on some embedded
> devices.
> 
> (Some clean up by Alan Cox)
> 
> Signed-off-by: Alan Cox <alan@xxxxxxxxxxxxxxx>
> 
> ---
> 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@xxxxxxxxxxxxxxx
> 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@xxxxxx
http://www.sci.fi/~syrjala/
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux