X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=drivers%2Fhid%2Fintel-ish-hid%2Fipc%2Fpci-ish.c;h=8df81dc845295962a2e3b04b16e65ff990162176;hb=53f724b2432a9f97a941251772f2b0d195e2d282;hp=20d647d2dd2cbfa5fb57fbc85de236147cf448ab;hpb=fe6cc17f89b2bf044f61d7cc6a45b51ccf86d853;p=platform%2Fkernel%2Flinux-exynos.git diff --git a/drivers/hid/intel-ish-hid/ipc/pci-ish.c b/drivers/hid/intel-ish-hid/ipc/pci-ish.c index 20d647d..8df81dc 100644 --- a/drivers/hid/intel-ish-hid/ipc/pci-ish.c +++ b/drivers/hid/intel-ish-hid/ipc/pci-ish.c @@ -24,7 +24,6 @@ #include #include #include -#include #define CREATE_TRACE_POINTS #include #include "ishtp-dev.h" @@ -47,7 +46,8 @@ MODULE_DEVICE_TABLE(pci, ish_pci_tbl); * * Callback to direct log messages to Linux trace buffers */ -static void ish_event_tracer(struct ishtp_device *dev, char *format, ...) +static __printf(2, 3) +void ish_event_tracer(struct ishtp_device *dev, const char *format, ...) { if (trace_ishtp_dump_enabled()) { va_list args; @@ -205,12 +205,15 @@ static void ish_remove(struct pci_dev *pdev) #ifdef CONFIG_PM static struct device *ish_resume_device; +/* 50ms to get resume response */ +#define WAIT_FOR_RESUME_ACK_MS 50 + /** * ish_resume_handler() - Work function to complete resume * @work: work struct * * The resume work function to complete resume function asynchronously. - * There are two types of platforms, one where ISH is not powered off, + * There are two resume paths, one where ISH is not powered off, * in that case a simple resume message is enough, others we need * a reset sequence. */ @@ -218,20 +221,31 @@ static void ish_resume_handler(struct work_struct *work) { struct pci_dev *pdev = to_pci_dev(ish_resume_device); struct ishtp_device *dev = pci_get_drvdata(pdev); + uint32_t fwsts; int ret; - ishtp_send_resume(dev); + /* Get ISH FW status */ + fwsts = IPC_GET_ISH_FWSTS(dev->ops->get_fw_status(dev)); - /* 50 ms to get resume response */ - if (dev->resume_flag) - ret = wait_event_interruptible_timeout(dev->resume_wait, - !dev->resume_flag, - msecs_to_jiffies(50)); + /* + * If currently, in ISH FW, sensor app is loaded or beyond that, + * it means ISH isn't powered off, in this case, send a resume message. + */ + if (fwsts >= FWSTS_SENSOR_APP_LOADED) { + ishtp_send_resume(dev); + + /* Waiting to get resume response */ + if (dev->resume_flag) + ret = wait_event_interruptible_timeout(dev->resume_wait, + !dev->resume_flag, + msecs_to_jiffies(WAIT_FOR_RESUME_ACK_MS)); + } /* - * If no resume response. This platform is not S0ix compatible - * So on resume full reboot of ISH processor will happen, so - * need to go through init sequence again + * If in ISH FW, sensor app isn't loaded yet, or no resume response. + * That means this platform is not S0ix compatible, or something is + * wrong with ISH FW. So on resume, full reboot of ISH processor will + * happen, so need to go through init sequence again. */ if (dev->resume_flag) ish_init(dev);