slim:msm: Add runtime PM to MSM slimbus controller
Runtime PM is used to turn clocks on and off when the controller is
not in use. There are 2 use-cases for the controller:
When the controller is used for messaging, pm_runtime_get is called
before sending the message. pm_runtime_put is called when message is
sent and/or response is received.
When the controller is used for data channels, pm_runtime_get is
called when data channel slot usage goes from 0 to non-zero.
pm_runtime_put can't be just called when data channel is scheduled
since data channel activity is going on until the data channel is
explicitly taken down. In that case, pm_runtime_put is called when
data channels are no longer using any slots on the bus.
pm_runtime_autosuspend is used to ensure that runtime_suspend doesn't
happen right after runtime enters idle state. This serves 2 purposes:
1. Resources aren't turned on/off too frequently.
2. There is a use case from audio where it does read/write to some
registers and the following data-channel setup happens from the LPASS
(satellite side). The timer ensures that there is no runtime_suspend
between these 2 activities.
Change-Id: I282e779380ae76058198e63c088aabfa3f1686fd
CRs-Fixed: 318901
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
diff --git a/include/linux/slimbus/slimbus.h b/include/linux/slimbus/slimbus.h
index 26ca79a..2b5adb3 100644
--- a/include/linux/slimbus/slimbus.h
+++ b/include/linux/slimbus/slimbus.h
@@ -83,6 +83,12 @@
#define SLIM_MSG_MC_NEXT_REMOVE_CHANNEL 0x58
#define SLIM_MSG_MC_RECONFIGURE_NOW 0x5F
+/*
+ * Clock pause flag to indicate that the reconfig message
+ * corresponds to clock pause sequence
+ */
+#define SLIM_MSG_CLK_PAUSE_SEQ_FLG (1U << 8)
+
/* Value management messages */
#define SLIM_MSG_MC_REQUEST_VALUE 0x60
#define SLIM_MSG_MC_REQUEST_CHANGE_VALUE 0x61
@@ -150,7 +156,9 @@
* For the header information, refer to Table 34-36.
* @rl: Header field. remaining length.
* @mt: Header field. Message type.
- * @mc: Header field. Message code for type mt.
+ * @mc: Header field. LSB is message code for type mt. Framework will set MSB to
+ * SLIM_MSG_CLK_PAUSE_SEQ_FLG in case "mc" in the reconfiguration sequence
+ * is for pausing the clock.
* @dt: Header field. Destination type.
* @ec: Element size. Used for elemental access APIs.
* @len: Length of payload. (excludes ec)
@@ -166,7 +174,7 @@
struct slim_msg_txn {
u8 rl;
u8 mt;
- u8 mc;
+ u16 mc;
u8 dt;
u16 ec;
u8 len;
@@ -670,7 +678,7 @@
*/
extern int slim_xfer_msg(struct slim_controller *ctrl,
struct slim_device *sbdev, struct slim_ele_access *msg,
- u8 mc, u8 *rbuf, const u8 *wbuf, u8 len);
+ u16 mc, u8 *rbuf, const u8 *wbuf, u8 len);
/* end of message apis */
/* Port management for manager device APIs */