lkml.org 
[lkml]   [2013]   [Feb]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 28/40] Input: atmel_mxt_ts - Add CHG line handling in bootloader code
From
On Fri, Feb 22, 2013 at 9:58 AM, Nick Dyer <nick.dyer@itdev.co.uk> wrote:
> The bootloader state machine toggles the CHG/Interrupt line to indicate when
> it has transitioned between states. Waiting for this event improves bootloader
> reliability.
>
> Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
> ---
> drivers/input/touchscreen/atmel_mxt_ts.c | 29 +++++++++++++++++++++++++++--
> 1 file changed, 27 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
> index a1f196b..f182228 100644
> --- a/drivers/input/touchscreen/atmel_mxt_ts.c
> +++ b/drivers/input/touchscreen/atmel_mxt_ts.c
> @@ -430,6 +430,27 @@ static int mxt_probe_bootloader(struct mxt_data *data)
> return 0;
> }
>
> +static int mxt_wait_for_chg(struct mxt_data *data)
> +{
> + int timeout_counter = 0;
> + int count = 1E6;
> +
> + if (data->pdata->read_chg == NULL) {

This also assumes the existence of data->pdata. If data->pdata ==
NULL, you're going to have a bad time.

> + msleep(20);
> + return 0;
> + }
> +
> + while ((timeout_counter++ <= count) && data->pdata->read_chg())
> + udelay(20);
> +
> + if (timeout_counter > count) {
> + dev_err(&data->client->dev, "mxt_wait_for_chg() timeout!\n");
> + return -EIO;
> + }
> +
> + return 0;
> +}
> +

> --
> 1.7.10.4
>



--
Benson Leung
Software Engineer, Chrom* OS
bleung@chromium.org


\
 
 \ /
  Last update: 2013-02-23 03:01    [W:0.300 / U:0.752 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site