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

Commit e2bacacc authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "input: synaptics: defer touch resume to workqueue for v2.6 driver"

parents b1aee83b 9832a751
Loading
Loading
Loading
Loading
+41 −10
Original line number Diff line number Diff line
@@ -122,6 +122,7 @@ static int synaptics_rmi4_reset_device(struct synaptics_rmi4_data *rmi4_data,
		bool rebuild);

#ifdef CONFIG_FB
static void synaptics_rmi4_fb_notify_resume_work(struct work_struct *work);
static int synaptics_rmi4_fb_notifier_cb(struct notifier_block *self,
		unsigned long event, void *data);
#endif
@@ -4012,6 +4013,8 @@ static int synaptics_rmi4_probe(struct platform_device *pdev)
	}

#ifdef CONFIG_FB
	INIT_WORK(&rmi4_data->fb_notify_work,
		  synaptics_rmi4_fb_notify_resume_work);
	rmi4_data->fb_notifier.notifier_call = synaptics_rmi4_fb_notifier_cb;
	retval = fb_register_client(&rmi4_data->fb_notifier);
	if (retval < 0) {
@@ -4328,6 +4331,14 @@ static void synaptics_rmi4_wakeup_gesture(struct synaptics_rmi4_data *rmi4_data,
}

#ifdef CONFIG_FB
static void synaptics_rmi4_fb_notify_resume_work(struct work_struct *work)
{
	struct synaptics_rmi4_data *rmi4_data =
		container_of(work, struct synaptics_rmi4_data, fb_notify_work);
	synaptics_rmi4_resume(&(rmi4_data->input_dev->dev));
	rmi4_data->fb_ready = true;
}

static int synaptics_rmi4_fb_notifier_cb(struct notifier_block *self,
		unsigned long event, void *data)
{
@@ -4338,19 +4349,39 @@ static int synaptics_rmi4_fb_notifier_cb(struct notifier_block *self,
			fb_notifier);

	if (evdata && evdata->data && rmi4_data) {
		if (rmi4_data->hw_if->board_data->resume_in_workqueue) {
			if (event == FB_EARLY_EVENT_BLANK) {
				synaptics_secure_touch_stop(rmi4_data, false);
			} else if (event == FB_EVENT_BLANK) {
				transition = evdata->data;
				if (*transition == FB_BLANK_POWERDOWN) {
					flush_work(
						&(rmi4_data->fb_notify_work));
					synaptics_rmi4_suspend(
						&rmi4_data->pdev->dev);
					rmi4_data->fb_ready = false;
				} else if (*transition == FB_BLANK_UNBLANK) {
					schedule_work(
						&(rmi4_data->fb_notify_work));
				}
			}
		} else {
			if (event == FB_EARLY_EVENT_BLANK) {
				synaptics_secure_touch_stop(rmi4_data, false);
			} else if (event == FB_EVENT_BLANK) {
				transition = evdata->data;
				if (*transition == FB_BLANK_POWERDOWN) {
				synaptics_rmi4_suspend(&rmi4_data->pdev->dev);
					synaptics_rmi4_suspend(
						&rmi4_data->pdev->dev);
					rmi4_data->fb_ready = false;
				} else if (*transition == FB_BLANK_UNBLANK) {
				synaptics_rmi4_resume(&rmi4_data->pdev->dev);
					synaptics_rmi4_resume(
						&rmi4_data->pdev->dev);
					rmi4_data->fb_ready = true;
				}
			}
		}
	}

	return 0;
}
+2 −1
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@
 *
 * Copyright (C) 2012 Alexandra Chin <alexandra.chin@tw.synaptics.com>
 * Copyright (C) 2012 Scott Lin <scott.lin@tw.synaptics.com>
 *
 * Copyright (C) 2016 The Linux Foundation. All rights reserved.
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
@@ -331,6 +331,7 @@ struct synaptics_rmi4_data {
	struct delayed_work rb_work;
	struct workqueue_struct *rb_workqueue;
#ifdef CONFIG_FB
	struct work_struct fb_notify_work;
	struct notifier_block fb_notifier;
	struct work_struct reset_work;
	struct workqueue_struct *reset_workqueue;
+4 −1
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@
 *
 * Copyright (C) 2012 Alexandra Chin <alexandra.chin@tw.synaptics.com>
 * Copyright (C) 2012 Scott Lin <scott.lin@tw.synaptics.com>
 *
 * Copyright (C) 2016, The Linux Foundation.  All rights reserved.
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
@@ -78,6 +78,9 @@ static int parse_dt(struct device *dev, struct synaptics_dsx_board_data *bdata)
	else
		bdata->irq_on_state = value;

	bdata->resume_in_workqueue = of_property_read_bool(np,
			"synaptics,resume-in-workqueue");

	retval = of_property_read_string(np, "synaptics,pwr-reg-name", &name);
	if (retval < 0)
		bdata->pwr_reg_name = NULL;
+4 −0
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@
 *
 * Copyright (C) 2012 Alexandra Chin <alexandra.chin@tw.synaptics.com>
 * Copyright (C) 2012 Scott Lin <scott.lin@tw.synaptics.com>
 * Copyright (C) 2016, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
@@ -57,6 +58,7 @@ struct synaptics_dsx_button_map {
 * @x_flip: x flip flag
 * @y_flip: y flip flag
 * @swap_axes: swap axes flag
 * @resume_in_workqueue: defer resume function to workqueue
 * @irq_gpio: attention interrupt GPIO
 * @irq_on_state: attention interrupt active state
 * @power_gpio: power switch GPIO
@@ -79,11 +81,13 @@ struct synaptics_dsx_button_map {
 * @bus_reg_name: pointer to name of regulator for bus pullup control
 * @cap_button_map: pointer to 0D button map
 * @vir_button_map: pointer to virtual button map
 * @resume_in_workqueue: defer resume function to workqueue
 */
struct synaptics_dsx_board_data {
	bool x_flip;
	bool y_flip;
	bool swap_axes;
	bool resume_in_workqueue;
	int irq_gpio;
	int irq_on_state;
	int power_gpio;