mirror of
https://github.com/torvalds/linux.git
synced 2026-06-10 15:42:19 +02:00
cpcap: suspend/resume
Disable cpcap interrupts at suspend and re-enable at resume, to avoid processing interrupts while the SPI controller is suspended. Change-Id: I26676b8ce8983bf5477f169a15d811c474c6f5a4 Signed-off-by: Todd Poynor <toddpoynor@google.com>
This commit is contained in:
parent
1fa241ab56
commit
a7ac4fced2
|
|
@ -27,6 +27,7 @@
|
|||
#include <linux/reboot.h>
|
||||
#include <linux/notifier.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/pm.h>
|
||||
|
||||
struct cpcap_driver_info {
|
||||
struct list_head list;
|
||||
|
|
@ -38,6 +39,11 @@ static int ioctl(struct inode *inode,
|
|||
static int __devinit cpcap_probe(struct spi_device *spi);
|
||||
static int __devexit cpcap_remove(struct spi_device *spi);
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
static int cpcap_suspend(struct spi_device *spi, pm_message_t mesg);
|
||||
static int cpcap_resume(struct spi_device *spi);
|
||||
#endif
|
||||
|
||||
const static struct file_operations cpcap_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.ioctl = ioctl,
|
||||
|
|
@ -57,6 +63,10 @@ static struct spi_driver cpcap_driver = {
|
|||
},
|
||||
.probe = cpcap_probe,
|
||||
.remove = __devexit_p(cpcap_remove),
|
||||
#ifdef CONFIG_PM
|
||||
.suspend = cpcap_suspend,
|
||||
.resume = cpcap_resume,
|
||||
#endif
|
||||
};
|
||||
|
||||
static struct platform_device cpcap_adc_device = {
|
||||
|
|
@ -455,6 +465,23 @@ static void cpcap_shutdown(void)
|
|||
spi_unregister_driver(&cpcap_driver);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
static int cpcap_suspend(struct spi_device *spi, pm_message_t mesg)
|
||||
{
|
||||
|
||||
struct cpcap_device *cpcap = spi_get_drvdata(spi);
|
||||
|
||||
return cpcap_irq_suspend(cpcap);
|
||||
}
|
||||
|
||||
static int cpcap_resume(struct spi_device *spi)
|
||||
{
|
||||
struct cpcap_device *cpcap = spi_get_drvdata(spi);
|
||||
|
||||
return cpcap_irq_resume(cpcap);
|
||||
}
|
||||
#endif
|
||||
|
||||
subsys_initcall(cpcap_init);
|
||||
module_exit(cpcap_shutdown);
|
||||
|
||||
|
|
|
|||
|
|
@ -630,3 +630,21 @@ int cpcap_irq_sense(struct cpcap_device *cpcap,
|
|||
return ((val & EVENT_MASK(irq)) != 0) ? 1 : 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cpcap_irq_sense);
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
int cpcap_irq_suspend(struct cpcap_device *cpcap)
|
||||
{
|
||||
struct spi_device *spi = cpcap->spi;
|
||||
|
||||
disable_irq(spi->irq);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int cpcap_irq_resume(struct cpcap_device *cpcap)
|
||||
{
|
||||
struct spi_device *spi = cpcap->spi;
|
||||
|
||||
enable_irq(spi->irq);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -717,6 +717,12 @@ int cpcap_irq_mask_get(struct cpcap_device *cpcap, enum cpcap_irqs int_event);
|
|||
int cpcap_irq_sense(struct cpcap_device *cpcap, enum cpcap_irqs int_event,
|
||||
unsigned char clear);
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
int cpcap_irq_suspend(struct cpcap_device *cpcap);
|
||||
|
||||
int cpcap_irq_resume(struct cpcap_device *cpcap);
|
||||
#endif
|
||||
|
||||
int cpcap_adc_sync_read(struct cpcap_device *cpcap,
|
||||
struct cpcap_adc_request *request);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user