Skip to content

Commit

Permalink
Input: atmel_mxt_ts - report failures in suspend/resume
Browse files Browse the repository at this point in the history
  • Loading branch information
ndyer committed Apr 26, 2016
1 parent 14052b6 commit 93a5757
Showing 1 changed file with 39 additions and 12 deletions.
51 changes: 39 additions & 12 deletions drivers/input/touchscreen/atmel_mxt_ts.c
Original file line number Diff line number Diff line change
Expand Up @@ -2899,10 +2899,12 @@ static void mxt_reset_slots(struct mxt_data *data)
mxt_input_sync(data);
}

static void mxt_start(struct mxt_data *data)
static int mxt_start(struct mxt_data *data)
{
int ret;

if (!data->suspended || data->in_bootloader)
return;
return 0;

switch (data->pdata->suspend_mode) {
case MXT_SUSPEND_T9_CTRL:
Expand All @@ -2927,28 +2929,42 @@ static void mxt_start(struct mxt_data *data)
*/
mxt_process_messages_until_invalid(data);

mxt_set_t7_power_cfg(data, MXT_POWER_CFG_RUN);
ret = mxt_set_t7_power_cfg(data, MXT_POWER_CFG_RUN);
if (ret)
return ret;

/* Recalibrate since chip has been in deep sleep */
mxt_t6_command(data, MXT_COMMAND_CALIBRATE, 1, false);
ret = mxt_t6_command(data, MXT_COMMAND_CALIBRATE, 1, false);
if (ret)
return ret;

ret = mxt_acquire_irq(data);
if (ret)
return ret;

mxt_acquire_irq(data);
break;
}

data->suspended = false;

return 0;
}

static void mxt_stop(struct mxt_data *data)
static int mxt_stop(struct mxt_data *data)
{
int ret;

if (data->suspended || data->in_bootloader)
return;
return 0;

switch (data->pdata->suspend_mode) {
case MXT_SUSPEND_T9_CTRL:
/* Touch disable */
mxt_write_object(data,
ret = mxt_write_object(data,
MXT_TOUCH_MULTI_T9, MXT_T9_CTRL, 0);
if (ret)
return ret;

break;

case MXT_SUSPEND_REGULATOR:
Expand All @@ -2961,29 +2977,40 @@ static void mxt_stop(struct mxt_data *data)
default:
disable_irq(data->irq);

mxt_set_t7_power_cfg(data, MXT_POWER_CFG_DEEPSLEEP);
ret = mxt_set_t7_power_cfg(data, MXT_POWER_CFG_DEEPSLEEP);
if (ret)
return ret;

mxt_reset_slots(data);
break;
}

data->suspended = true;
return 0;
}

static int mxt_input_open(struct input_dev *dev)
{
struct mxt_data *data = input_get_drvdata(dev);
int ret;

mxt_start(data);
ret = mxt_start(data);

return 0;
if (ret)
dev_err(&data->client->dev, "%s failed rc=%d\n", __func__, ret);

return ret;
}

static void mxt_input_close(struct input_dev *dev)
{
struct mxt_data *data = input_get_drvdata(dev);
int ret;

mxt_stop(data);
ret = mxt_stop(data);

if (ret)
dev_err(&data->client->dev, "%s failed rc=%d\n", __func__, ret);
}

#ifdef CONFIG_OF
Expand Down

0 comments on commit 93a5757

Please sign in to comment.