[PATCH v8 0/3] Input: Cypress TTSP device driver

January 04th, 2012 - 07:20 pm ET by Javier Martinez Canillas | Report spam
Cypress TrueTouch(tm) Standard Product controllers are found in a wide range of
embedded devices. This patch-set adds support for a variety of TTSP controllers.

The original author of the driver is Kevin McNeely <kev@cypress.com>

Since the hardware is capable of tracking identifiable contacts and the original
driver used multi-touch protocol type A (stateless), Multi-touch protocol type B
(stateful) support was added and lots of cleanups were made for upstream submission.

The driver is composed of a core driver that process the data sent by the
contacts (fingers) and two bus specific interface modules (I2C and SPI).

This is a version 8 of the driver that fixes issues called out by
Dmitry Torokhov, Henrik Rydberg, Mohan Pallaka and Shubhrajyoti Datta.

The patchset is composed of the following patches:

[PATCH v8 1/3] Input: cyttsp - Cypress TTSP capacitive multi-touch screen support
[PATCH v8 2/3] Input: cyttsp - add support for Cypress TTSP touchscreen I2C bus interface
[PATCH v8 3/3] Input: cyttsp - add support for Cypress TTSP touchscreen SPI bus interface

Best regards,
Javier
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
email Follow the discussionReplies 4 repliesReplies Make a reply

Similar topics

Replies

#1 Javier Martinez Canillas
January 04th, 2012 - 07:20 pm ET | Report spam
The driver is composed of a core driver that process the data sent by
the contacts and a set of bus specific interface modules.

This patch add supports for the Cypress TTSP I2C bus interface.

Signed-off-by: Javier Martinez Canillas


Changes for v8:
Javier Martinez Canillas (5):
- Check i2c_master_recv() didn't return and error before checking length
- Check i2c read completed sucessful
- Define module exit macro in i2c driver
- Fix return values for I2C transport
- Add error msg when capability is not supported

drivers/input/touchscreen/cyttsp_i2c.c | 137 ++++++++++++++++++++++++++++++++
1 files changed, 137 insertions(+), 0 deletions(-)
create mode 100644 drivers/input/touchscreen/cyttsp_i2c.c

diff --git a/drivers/input/touchscreen/cyttsp_i2c.c b/drivers/input/touchscreen/cyttsp_i2c.c
new file mode 100644
index 0000000..cdbf61d
/dev/null
+++ b/drivers/input/touchscreen/cyttsp_i2c.c
@@ -0,0 +1,137 @@
+/*
+ * Source for:
+ * Cypress TrueTouch(TM) Standard Product (TTSP) I2C touchscreen driver.
+ * For use with Cypress Txx3xx parts.
+ * Supported parts include:
+ * CY8CTST341
+ * CY8CTMA340
+ *
+ * Copyright (C) 2009, 2010, 2011 Cypress Semiconductor, Inc.
+ * Copyright (C) 2012 Javier Martinez Canillas
+ *
+ * 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.
+ *
+ * Contact Cypress Semiconductor at www.cypress.com
+ *
+ */
+
+#include "cyttsp_core.h"
+
+#include <linux/i2c.h>
+#include <linux/input.h>
+
+#define CY_I2C_DATA_SIZE 128
+
+static int cyttsp_i2c_read_block_data(struct device *dev,
+ u8 addr, u8 length, void *values)
+{
+ struct i2c_client *client = to_i2c_client(dev);
+ int retval;
+
+ retval = i2c_master_send(client, &addr, 1);
+ if (retval < 0)
+ return retval;
+
+ retval = i2c_master_recv(client, values, length);
+
+ if (retval < 0)
+ return retval;
+
+ return (retval != length) ? -EIO : 0;
+}
+
+static int cyttsp_i2c_write_block_data(struct device *dev,
+ u8 addr, u8 length, const void *values)
+{
+ struct i2c_client *client = to_i2c_client(dev);
+ struct cyttsp *ts = i2c_get_clientdata(client);
+ int retval;
+
+ ts->xfer_buf[0] = addr;
+ memcpy(&ts->xfer_buf[1], values, length);
+ retval = i2c_master_send(client, ts->xfer_buf, length + 1);
+
+ return (retval < 0) ? retval : 0;
+}
+
+static const struct cyttsp_bus_ops cyttsp_i2c_bus_ops = {
+ .bustype = BUS_I2C,
+ .write = cyttsp_i2c_write_block_data,
+ .read = cyttsp_i2c_read_block_data,
+};
+
+static int __devinit cyttsp_i2c_probe(struct i2c_client *client,
+ const struct i2c_device_id *id)
+{
+ struct cyttsp *ts;
+
+ if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
+ dev_err(&client->dev, "I2C functionality not Supported");
+ return -EIO;
+ }
+
+ ts = cyttsp_probe(&cyttsp_i2c_bus_ops, &client->dev, client->irq,
+ CY_I2C_DATA_SIZE);
+
+ if (IS_ERR(ts))
+ return PTR_ERR(ts);
+
+ i2c_set_clientdata(client, ts);
+
+ return 0;
+}
+
+static int __devexit cyttsp_i2c_remove(struct i2c_client *client)
+{
+ struct cyttsp *ts = i2c_get_clientdata(client);
+
+ cyttsp_remove(ts);
+
+ return 0;
+}
+
+static const struct i2c_device_id cyttsp_i2c_id[] = {
+ { CY_I2C_NAME, 0 },
+ { }
+};
+MODULE_DEVICE_TABLE(i2c, cyttsp_i2c_id);
+
+static struct i2c_driver cyttsp_i2c_driver = {
+ .driver = {
+ .name = CY_I2C_NAME,
+ .owner = THIS_MODULE,
+ .pm = &cyttsp_pm_ops,
+ },
+ .probe = cyttsp_i2c_probe,
+ .remove = __devexit_p(cyttsp_i2c_remove),
+ .id_table = cyttsp_i2c_id,
+};
+
+static int __init cyttsp_i2c_init(void)
+{
+ return i2c_add_driver(&cyttsp_i2c_driver);
+}
+module_init(cyttsp_i2c_init);
+
+static void __exit cyttsp_i2c_exit(void)
+{
+ return i2c_del_driver(&cyttsp_i2c_driver);
+}
+module_exit(cyttsp_i2c_exit);
+
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("Cypress TrueTouch(R) Standard Product (TTSP) I2C driver");
+MODULE_AUTHOR("Cypress");
+MODULE_ALIAS("i2c:cyttsp");
1.7.4.1

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Replies Reply to this message
#2 Javier Martinez Canillas
January 04th, 2012 - 07:20 pm ET | Report spam
The driver is composed of a core driver that process the data sent by
the contacts and a set of bus specific interface modules.

This patch add supports for the Cypress TTSP SPI bus interface.

Signed-off-by: Javier Martinez Canillas


Changes for v8:
Javier Martinez Canillas (2):
- struct cyttsp is inside struct device not struct spi_device
- Add error msg when capability is not supported

Kevin McNeely (1):
- SPI xfer function cleanups

drivers/input/touchscreen/cyttsp_spi.c | 245 ++++++++++++++++++++++++++++++++
1 files changed, 245 insertions(+), 0 deletions(-)
create mode 100644 drivers/input/touchscreen/cyttsp_spi.c

diff --git a/drivers/input/touchscreen/cyttsp_spi.c b/drivers/input/touchscreen/cyttsp_spi.c
new file mode 100644
index 0000000..3238c7d
/dev/null
+++ b/drivers/input/touchscreen/cyttsp_spi.c
@@ -0,0 +1,245 @@
+/*
+ * Source for:
+ * Cypress TrueTouch(TM) Standard Product (TTSP) SPI touchscreen driver.
+ * For use with Cypress Txx3xx parts.
+ * Supported parts include:
+ * CY8CTST341
+ * CY8CTMA340
+ *
+ * Copyright (C) 2009, 2010, 2011 Cypress Semiconductor, Inc.
+ * Copyright (C) 2012 Javier Martinez Canillas
+ *
+ * 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.
+ *
+ * Contact Cypress Semiconductor at www.cypress.com
+ *
+ */
+
+#include "cyttsp_core.h"
+
+#include <linux/delay.h>
+#include <linux/input.h>
+#include <linux/spi/spi.h>
+
+#define CY_SPI_WR_OP 0x00 /* r/~w */
+#define CY_SPI_RD_OP 0x01
+#define CY_SPI_CMD_BYTES 4
+#define CY_SPI_SYNC_BYTE 2
+#define CY_SPI_SYNC_ACK1 0x62 /* from protocol v.2 */
+#define CY_SPI_SYNC_ACK2 0x9D /* from protocol v.2 */
+#define CY_SPI_DATA_SIZE 128
+#define CY_SPI_DATA_BUF_SIZE (CY_SPI_CMD_BYTES + CY_SPI_DATA_SIZE)
+#define CY_SPI_BITS_PER_WORD 8
+
+static int cyttsp_spi_xfer(u8 op, struct spi_device *spi,
+ u8 reg, u8 *buf, int length)
+{
+ struct cyttsp *ts = spi_get_drvdata(spi);
+ struct spi_message msg;
+ struct spi_transfer xfer[2];
+ u8 *wr_buf = &ts->xfer_buf[0];
+ u8 *rd_buf = &ts->xfer_buf[CY_SPI_DATA_BUF_SIZE];
+ int retval;
+
+ if (length > CY_SPI_DATA_SIZE) {
+ dev_dbg(&spi->dev, "%s: length %d is too big.",
+ __func__, length);
+ return -EINVAL;
+ }
+
+ memset(wr_buf, 0, CY_SPI_DATA_BUF_SIZE);
+ memset(rd_buf, 0, CY_SPI_DATA_BUF_SIZE);
+
+ wr_buf[0] = 0x00; /* header byte 0 */
+ wr_buf[1] = 0xFF; /* header byte 1 */
+ wr_buf[2] = reg; /* reg index */
+ wr_buf[3] = op; /* r/~w */
+ if (op == CY_SPI_WR_OP)
+ memcpy(wr_buf + CY_SPI_CMD_BYTES, buf, length);
+
+ memset(xfer, 0, sizeof(xfer));
+ spi_message_init(&msg);
+
+ /*
+ We set both TX and RX buffers because Cypress TTSP
+ requires full duplex operation.
+ */
+ xfer[0].tx_buf = wr_buf;
+ xfer[0].rx_buf = rd_buf;
+ switch (op) {
+ case CY_SPI_WR_OP:
+ xfer[0].len = length + CY_SPI_CMD_BYTES;
+ spi_message_add_tail(&xfer[0], &msg);
+ break;
+
+ case CY_SPI_RD_OP:
+ xfer[0].len = CY_SPI_CMD_BYTES;
+ spi_message_add_tail(&xfer[0], &msg);
+
+ xfer[1].rx_buf = buf;
+ xfer[1].len = length;
+ spi_message_add_tail(&xfer[1], &msg);
+ break;
+
+ default:
+ dev_dbg(&spi->dev,
+ "%s: bad operation code=%d", __func__, op);
+ return -EINVAL;
+ }
+
+ retval = spi_sync(spi, &msg);
+ if (retval < 0) {
+ dev_dbg(&spi->dev,
+ "%s: spi_sync() error %d, len=%d, op=%d",
+ __func__, retval, xfer[1].len, op);
+
+ /*
+ * do not return here since was a bad ACK sequence
+ * let the following ACK check handle any errors and
+ * allow silent retries
+ */
+ }
+
+ if (rd_buf[CY_SPI_SYNC_BYTE] != CY_SPI_SYNC_ACK1 ||
+ rd_buf[CY_SPI_SYNC_BYTE + 1] != CY_SPI_SYNC_ACK2) {
+ int i;
+ for (i = 0; i < CY_SPI_CMD_BYTES; i++)
+ dev_dbg(&spi->dev,
+ "%s: test rd_buf[%d]:0x%02x",
+ __func__, i, rd_buf[i]);
+ for (i = 0; i < length; i++)
+ dev_dbg(&spi->dev,
+ "%s: test buf[%d]:0x%02x",
+ __func__, i, buf[i]);
+
+ /* signal ACK error so silent retry */
+ return 1;
+ }
+
+ return 0;
+}
+
+static int cyttsp_spi_read_block_data(struct device *dev,
+ u8 addr, u8 length, void *data)
+{
+ struct spi_device *spi = to_spi_device(dev);
+ int retval;
+
+ retval = cyttsp_spi_xfer(CY_SPI_RD_OP, spi, addr, data, length);
+ if (retval < 0)
+ dev_err(dev, "cyttsp_spi_read_block_data failed, err: %d",
+ retval);
+
+ /*
+ * Do not print the above error if the data sync bytes were not found.
+ * This is a normal condition for the bootloader loader startup and need
+ * to retry until data sync bytes are found.
+ */
+ if (retval > 0)
+ retval = -EIO; /* now signal fail; so retry can be done */
+
+ return retval;
+}
+
+static int cyttsp_spi_write_block_data(struct device *dev,
+ u8 addr, u8 length, const void *data)
+{
+ struct spi_device *spi = to_spi_device(dev);
+ int retval;
+
+ retval = cyttsp_spi_xfer(CY_SPI_WR_OP, spi, addr, (void *)data, length);
+ if (retval < 0)
+ dev_err(dev, "cyttsp_spi_write_block_data failed, err: %d",
+ retval);
+
+ /*
+ * Do not print the above error if the data sync bytes were not found.
+ * This is a normal condition for the bootloader loader startup and need
+ * to retry until data sync bytes are found.
+ */
+ if (retval > 0)
+ retval = -EIO; /* now signal fail; so retry can be done */
+
+ return retval;
+}
+
+static const struct cyttsp_bus_ops cyttsp_spi_bus_ops = {
+ .bustype = BUS_SPI,
+ .write = cyttsp_spi_write_block_data,
+ .read = cyttsp_spi_read_block_data,
+};
+
+static int __devinit cyttsp_spi_probe(struct spi_device *spi)
+{
+ struct cyttsp *ts;
+ int error;
+
+ /* Set up SPI*/
+ spi->bits_per_word = CY_SPI_BITS_PER_WORD;
+ spi->mode = SPI_MODE_0;
+ error = spi_setup(spi);
+ if (error < 0) {
+ dev_err(&spi->dev, "%s: SPI setup error %d",
+ __func__, error);
+ return error;
+ }
+
+ ts = cyttsp_probe(&cyttsp_spi_bus_ops, &spi->dev, spi->irq,
+ CY_SPI_DATA_BUF_SIZE * 2);
+ if (IS_ERR(ts))
+ return PTR_ERR(ts);
+
+ spi_set_drvdata(spi, ts);
+
+ return 0;
+}
+
+static int __devexit cyttsp_spi_remove(struct spi_device *spi)
+{
+ struct cyttsp *ts = dev_get_drvdata(&spi->dev);
+
+ cyttsp_remove(ts);
+
+ return 0;
+}
+
+static struct spi_driver cyttsp_spi_driver = {
+ .driver = {
+ .name = CY_SPI_NAME,
+ .owner = THIS_MODULE,
+ .pm = &cyttsp_pm_ops,
+ },
+ .probe = cyttsp_spi_probe,
+ .remove = __devexit_p(cyttsp_spi_remove),
+};
+
+static int __init cyttsp_spi_init(void)
+{
+ return spi_register_driver(&cyttsp_spi_driver);
+}
+module_init(cyttsp_spi_init);
+
+static void __exit cyttsp_spi_exit(void)
+{
+ spi_unregister_driver(&cyttsp_spi_driver);
+}
+module_exit(cyttsp_spi_exit);
+
+MODULE_ALIAS("spi:cyttsp");
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("Cypress TrueTouch(R) Standard Product (TTSP) SPI driver");
+MODULE_AUTHOR("Cypress");
+MODULE_ALIAS("spi:cyttsp");
+
1.7.4.1

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Replies Reply to this message
#3 Henrik Rydberg
January 09th, 2012 - 12:40 pm ET | Report spam
Hi Javier,

Changes for v8:
Dmitry Torokhov (9):
- Fix use-after-free in cyttsp_release
- Remove ext() method from bus ops
- Move up into main touchscreen directory
- Rework Kconfig entries
- Guard PM methods with CONFIG_PM_SLEEP
- Device does not belong in bus structure
- Set up bus type in input device
- Use unified structure for ts object
- Consolidate PM methods

Javier Martinez Canillas (5):
- Add <linux/device.h> macro to cyttsp_core.h
- Soft reset returns negative on error, not 0
- Use CY_NUM_RETRY instead of CY_DELAY_MAX for retries
- Add suspended an on boolean to cyttsp core
- Rework PM functions



Looking a lot better now, thank you. Some tiny comments below.

+static int ttsp_read_block_data(struct cyttsp *ts, u8 command,
+ u8 length, void *buf)
+{
+ int retval = -1;
+ int tries;
+
+ if (!buf || !length)
+ return -EINVAL;
+
+ for (tries = 0; tries < CY_NUM_RETRY && (retval < 0); tries++) {
+ retval = ts->bus_ops->read(ts->dev, command, length, buf);
+ if (retval)
+ msleep(CY_DELAY_DFLT);
+ }
+
+ return retval;
+}



Still wondering why (retval > 0) is handled the same way as (retval < 0).

+static int cyttsp_bl_app_valid(struct cyttsp *ts)
+{
+ int retval;
+
+ retval = cyttsp_load_bl_regs(ts);
+
+ if (retval < 0) {
+ retval = -ENODEV;
+ goto done;
+ }
+
+ if (GET_BOOTLOADERMODE(ts->bl_data.bl_status)) {
+ if (IS_VALID_APP(ts->bl_data.bl_status))
+ return 0;
+ else
+ return -ENODEV;
+ }
+
+ if (GET_HSTMODE(ts->bl_data.bl_file) == CY_OPERATE_MODE) {
+ if (!(IS_OPERATIONAL_ERR(ts->bl_data.bl_status)))
+ return 1;
+ else
+ return -ENODEV;
+ }
+
+ retval = -ENODEV;
+done:
+ return retval;



The function seems to always return ENODEV, something to simplify?

+static int cyttsp_set_sysinfo_mode(struct cyttsp *ts)
+{
+ int retval;
+ int tries;
+ u8 cmd = CY_SYSINFO_MODE;
+
+ memset(&(ts->sysinfo_data), 0, sizeof(struct cyttsp_sysinfo_data));
+
+ /* switch to sysinfo mode */
+ retval = ttsp_write_block_data(ts, CY_REG_BASE, sizeof(cmd), &cmd);
+ if (retval < 0)
+ return retval;
+
+ /* read sysinfo registers */
+ tries = 0;
+ do {
+ msleep(CY_DELAY_DFLT);
+ retval = ttsp_read_block_data(ts, CY_REG_BASE,
+ sizeof(ts->sysinfo_data), &ts->sysinfo_data);
+ } while ((retval || (!ts->sysinfo_data.tts_verh &&
+ !ts->sysinfo_data.tts_verl)) &&
+ (tries++ < CY_NUM_RETRY));
+
+ if (tries >= CY_NUM_RETRY)
+ return -EAGAIN;



The loop above seems to appear many times in the code. Something to
simplify?

Thanks,
Henrik
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Replies Reply to this message
#4 Javier Martinez Canillas
January 09th, 2012 - 03:50 pm ET | Report spam
On Mon, Jan 9, 2012 at 6:35 PM, Henrik Rydberg wrote:

Hi Javier,

> Changes for v8:
>     Dmitry Torokhov (9):
>     - Fix use-after-free in cyttsp_release
>     - Remove ext() method from bus ops
>     - Move up into main touchscreen directory
>     - Rework Kconfig entries
>     - Guard PM methods with CONFIG_PM_SLEEP
>     - Device does not belong in bus structure
>     - Set up bus type in input device
>     - Use unified structure for ts object
>     - Consolidate PM methods
>
>     Javier Martinez Canillas (5):
>     - Add <linux/device.h> macro to cyttsp_core.h
>     - Soft reset returns negative on error, not 0
>     - Use CY_NUM_RETRY instead of CY_DELAY_MAX for retries
>     - Add suspended an on boolean to cyttsp core
>     - Rework PM functions

Looking a lot better now, thank you. Some tiny comments below.




Hi Henrik,

Your welcome. Thank you for the review and your patience.

> +static int ttsp_read_block_data(struct cyttsp *ts, u8 command,
> +     u8 length, void *buf)
> +{
> +     int retval = -1;
> +     int tries;
> +
> +     if (!buf || !length)
> +             return -EINVAL;
> +
> +     for (tries = 0; tries < CY_NUM_RETRY && (retval < 0); tries++) {
> +             retval = ts->bus_ops->read(ts->dev, command, length, buf);
> +             if (retval)
> +                     msleep(CY_DELAY_DFLT);
> +     }
> +
> +     return retval;
> +}

Still wondering why (retval > 0) is handled the same way as (retval < 0).




Well, that is a convention followed in the driver. All the bus
specific read/write operations (I2C, SPI, etc) never return positive
numbers. They return 0 on success or the error value (retval < 0).

Changing that semantic could be a bit of a hassle since all the driver
assumes that behavior. But to be consistent with the rest of the
kernel and if that could be a reason to not merge the driver I can
rework that.

> +static int cyttsp_bl_app_valid(struct cyttsp *ts)
> +{
> +     int retval;
> +
> +     retval = cyttsp_load_bl_regs(ts);
> +
> +     if (retval < 0) {
> +             retval = -ENODEV;
> +             goto done;
> +     }
> +
> +     if (GET_BOOTLOADERMODE(ts->bl_data.bl_status)) {
> +             if (IS_VALID_APP(ts->bl_data.bl_status))
> +                     return 0;
> +             else
> +                     return -ENODEV;
> +     }
> +
> +     if (GET_HSTMODE(ts->bl_data.bl_file) == CY_OPERATE_MODE) {
> +             if (!(IS_OPERATIONAL_ERR(ts->bl_data.bl_status)))
> +                     return 1;
> +             else
> +                     return -ENODEV;
> +     }
> +
> +     retval = -ENODEV;
> +done:
> +     return retval;

The function seems to always return ENODEV, something to simplify?




Actually, it returns 1 if the device is not in bootloader mode an
operational or 0 otherwise. But you are right, the function is kind of
a mess. I'll simplify this.

> +static int cyttsp_set_sysinfo_mode(struct cyttsp *ts)
> +{
> +     int retval;
> +     int tries;
> +     u8 cmd = CY_SYSINFO_MODE;
> +
> +     memset(&(ts->sysinfo_data), 0, sizeof(struct cyttsp_sysinfo_data));
> +
> +     /* switch to sysinfo mode */
> +     retval = ttsp_write_block_data(ts, CY_REG_BASE, sizeof(cmd), &cmd);
> +     if (retval < 0)
> +             return retval;
> +
> +     /* read sysinfo registers */
> +     tries = 0;
> +     do {
> +             msleep(CY_DELAY_DFLT);
> +             retval = ttsp_read_block_data(ts, CY_REG_BASE,
> +                     sizeof(ts->sysinfo_data), &ts->sysinfo_data);
> +     } while ((retval || (!ts->sysinfo_data.tts_verh &&
> +                          !ts->sysinfo_data.tts_verl)) &&
> +              (tries++ < CY_NUM_RETRY));
> +
> +     if (tries >= CY_NUM_RETRY)
> +             return -EAGAIN;

The loop above seems to appear many times in the code. Something to
simplify?




Ok, will simplify this also.

Thanks,
Henrik



Thanks a lot and best regards,
Javier
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
email Follow the discussion Replies Reply to this message
Help Create a new topicReplies Make a reply
Search Make your own search