Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ba7e72e5 authored by Shantanu Jain's avatar Shantanu Jain Committed by Gerrit - the friendly Code Review server
Browse files

input: keyboard: correct suspend/resume for gpio_keys



Execute pinctrl operations at correct place in
suspend/resume procedure of gpio_keys driver.

Change-Id: Ic393778e35f52859512bd32ccbf6c4d1079a7e37
Signed-off-by: default avatarShantanu Jain <shjain@codeaurora.org>
parent 32829884
Loading
Loading
Loading
Loading
+16 −17
Original line number Diff line number Diff line
@@ -852,6 +852,14 @@ static int gpio_keys_suspend(struct device *dev)
	struct input_dev *input = ddata->input;
	int i, ret;

	if (ddata->key_pinctrl) {
		ret = gpio_keys_pinctrl_configure(ddata, false);
		if (ret) {
			dev_err(dev, "failed to put the pin in suspend state\n");
			return ret;
		}
	}

	if (device_may_wakeup(dev)) {
		for (i = 0; i < ddata->pdata->nbuttons; i++) {
			struct gpio_button_data *bdata = &ddata->data[i];
@@ -865,14 +873,6 @@ static int gpio_keys_suspend(struct device *dev)
		mutex_unlock(&input->mutex);
	}

	if (ddata->key_pinctrl) {
		ret = gpio_keys_pinctrl_configure(ddata, false);
		if (ret) {
			dev_err(dev, "failed to put the pin in suspend state\n");
			return ret;
		}
	}

	return 0;
}

@@ -883,6 +883,14 @@ static int gpio_keys_resume(struct device *dev)
	int error = 0;
	int i;

	if (ddata->key_pinctrl) {
		error = gpio_keys_pinctrl_configure(ddata, true);
		if (error) {
			dev_err(dev, "failed to put the pin in resume state\n");
			return error;
		}
	}

	if (device_may_wakeup(dev)) {
		for (i = 0; i < ddata->pdata->nbuttons; i++) {
			struct gpio_button_data *bdata = &ddata->data[i];
@@ -899,15 +907,6 @@ static int gpio_keys_resume(struct device *dev)
	if (error)
		return error;

	if (ddata->key_pinctrl) {
		error = gpio_keys_pinctrl_configure(ddata, true);
		if (error) {
			dev_err(dev, "failed to put the pin in resume state\n");
			return error;
		}
	}


	gpio_keys_report_state(ddata);
	return 0;
}