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

Commit 360b9ab2 authored by Hans de Goede's avatar Hans de Goede Committed by Greg Kroah-Hartman
Browse files

abituguru: Add suspend/resume support



This patch contains rudimentary suspend / resume support for the uguru,
this protects the uguru and the driver against suspend / resume cycles,
so there is no reason to unload the driver in your suspend / resume
scripts.

Only include suspend / resume functions when CONFIG_PM is set.

Signed-off-by: default avatarHans de Goede <j.w.r.degoede@hhs.nl>
Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent b17ebc94
Loading
Loading
Loading
Loading
+28 −2
Original line number Original line Diff line number Diff line
@@ -1354,6 +1354,30 @@ static struct abituguru_data *abituguru_update_device(struct device *dev)
		return NULL;
		return NULL;
}
}


#ifdef CONFIG_PM
static int abituguru_suspend(struct platform_device *pdev, pm_message_t state)
{
	struct abituguru_data *data = platform_get_drvdata(pdev);
	/* make sure all communications with the uguru are done and no new
	   ones are started */
	mutex_lock(&data->update_lock);
	return 0;
}

static int abituguru_resume(struct platform_device *pdev)
{
	struct abituguru_data *data = platform_get_drvdata(pdev);
	/* See if the uGuru is still ready */
	if (inb_p(data->addr + ABIT_UGURU_DATA) != ABIT_UGURU_STATUS_INPUT)
		data->uguru_ready = 0;
	mutex_unlock(&data->update_lock);
	return 0;
}
#else
#define abituguru_suspend	NULL
#define abituguru_resume	NULL
#endif /* CONFIG_PM */

static struct platform_driver abituguru_driver = {
static struct platform_driver abituguru_driver = {
	.driver = {
	.driver = {
		.owner	= THIS_MODULE,
		.owner	= THIS_MODULE,
@@ -1361,6 +1385,8 @@ static struct platform_driver abituguru_driver = {
	},
	},
	.probe		= abituguru_probe,
	.probe		= abituguru_probe,
	.remove		= __devexit_p(abituguru_remove),
	.remove		= __devexit_p(abituguru_remove),
	.suspend	= abituguru_suspend,
	.resume		= abituguru_resume,
};
};


static int __init abituguru_detect(void)
static int __init abituguru_detect(void)