greybus: firmware: Add runtime PM support
authorViresh Kumar <viresh.kumar@linaro.org>
Tue, 26 Jul 2016 20:41:02 +0000 (13:41 -0700)
committerGreg Kroah-Hartman <gregkh@google.com>
Tue, 26 Jul 2016 22:29:00 +0000 (15:29 -0700)
commitc57fbb404af28eda44d0590ede8812b889a89b8c
tree42529b635777ed0e26f7b995a32930b77b28cb5f
parent2321f049a93368fffc3375cfbf2f9f9561ef1e69
greybus: firmware: Add runtime PM support

This patch implements runtime PM support for firmware management bundle.
This guarantees that the bundle will be active, while the AP or the
Module is trying to exchange any operations over any of the CPorts.

- Firmware Management CPort:

  Runtime PM get/put calls are placed around the ioctl calls, which are
  all implemented as blocking ioctls.

- Component Authentication CPort:

  Runtime PM get/put calls are placed around the ioctl calls, which are
  all implemented as blocking ioctls.

- SPI:

  Uses the interface provided by spilib.c and runtime PM get/put are
  called around connection usage.

- firmware-download:

  This is the most tricky one. All operations on this CPort are
  initiated from the Module and not from the AP. And the AP needs to do
  runtime_pm_get() before any request is received over this CPort.

  The module doesn't send any request over this connection, unless the
  AP has requested the module over firmware management CPort to download
  a firmware package over firmware download CPort.

  And so the runtime PM get/put calls around the ioctls in
  fw-management.c are sufficient to handle the firmware management CPort
  as well.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/authentication.c
drivers/staging/greybus/fw-core.c
drivers/staging/greybus/fw-management.c