misc: mic: Enable OSPM suspend and resume support.
authorDasaratharaman Chandramouli <dasaratharaman.chandramouli@intel.com>
Fri, 4 Oct 2013 01:06:23 +0000 (18:06 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 6 Oct 2013 01:01:42 +0000 (18:01 -0700)
commitaf190494f9b2e1fb6e1c039e9626c3c334717da1
tree3c6b5168cd9e3bd9455380ca5360a4a250820ab0
parent12b3af3096cdfb0613da374021167868c6abc9ce
misc: mic: Enable OSPM suspend and resume support.

This patch enables support for OSPM suspend and resume in the MIC
driver. During a host suspend event, the driver performs an
orderly shutdown of the cards if they are online. Upon resume, any
cards that were previously online before suspend are rebooted.
The driver performs an orderly shutdown of the card primarily to
ensure that applications in the card are terminated and mounted
devices are safely un-mounted before the card is powered down in
the event of an OSPM suspend.

The driver makes use of the MIC daemon to accomplish OSPM suspend
and resume. The driver registers a PM notifier per MIC device.
The devices get notified synchronously during PM_SUSPEND_PREPARE and
PM_POST_SUSPEND phases.

During the PM_SUSPEND_PREPARE phase, the driver performs one of the
following three tasks.
1) If the card is 'offline', the driver sets the card to a
   'suspended' state and returns.
2) If the card is 'online', the driver initiates card shutdown by
   setting the card state to suspending. This notifies the MIC
   daemon which invokes shutdown and sets card state to 'suspended'.
   The driver returns after the shutdown is complete.
3) If the card is already being shutdown, possibly by a host user
   space application, the driver sets the card state to 'suspended'
   and returns after the shutdown is complete.

During the PM_POST_SUSPEND phase, the driver simply notifies the
daemon and returns. The daemon boots those cards that were previously
online during the suspend phase.

Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
Signed-off-by: Harshavardhan R Kharche <harshavardhan.r.kharche@intel.com>
Signed-off-by: Sudeep Dutt <sudeep.dutt@intel.com>
Signed-off-by: Dasaratharaman Chandramouli <dasaratharaman.chandramouli@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Documentation/ABI/testing/sysfs-class-mic.txt
Documentation/mic/mic_overview.txt
Documentation/mic/mpssd/mpssd.c
Documentation/mic/mpssd/mpssd.h
drivers/misc/mic/host/mic_boot.c
drivers/misc/mic/host/mic_device.h
drivers/misc/mic/host/mic_main.c
drivers/misc/mic/host/mic_sysfs.c
include/uapi/linux/mic_common.h