aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spmi
diff options
context:
space:
mode:
authorAnkit Gupta <ankgupta@codeaurora.org>2015-06-22 18:38:46 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-08-05 15:27:09 -0400
commita9fce374815d8ab94a3e6259802a944e2cc21408 (patch)
tree28f6edf1e905b15f40ac24e17018b54671baa331 /drivers/spmi
parent6497a8757361a88b73fc3814d2ee9b9fc105fa42 (diff)
spmi: add command tracepoints for SPMI
Add tracepoints to retrieve information about read, write and non-data commands. For performance measurement support tracepoints are added at the beginning and at the end of transfers. Following is a list showing the new tracepoint events. The "cmd" parameter here represents the opcode, SID, and full 16-bit address. spmi_write_begin: cmd and data buffer. spmi_write_end : cmd and return value. spmi_read_begin : cmd. spmi_read_end : cmd, return value and data buffer. spmi_cmd : cmd. The reason that cmd appears at both the beginning and at the end event is that SPMI drivers can request commands concurrently. cmd helps in matching the corresponding events. SPMI tracepoints can be enabled like: echo 1 >/sys/kernel/debug/tracing/events/spmi/enable and will dump messages that can be viewed in /sys/kernel/debug/tracing/trace that look like: ... spmi_read_begin: opc=56 sid=00 addr=0x0000 ... spmi_read_end: opc=56 sid=00 addr=0x0000 ret=0 len=02 buf=0x[01-40] ... spmi_write_begin: opc=48 sid=00 addr=0x0000 len=3 buf=0x[ff-ff-ff] Suggested-by: Sagar Dharia <sdharia@codeaurora.org> Acked-by: Steven Rostedt <rostedt@goodmis.org> Reviewed-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: Gilad Avidov <gavidov@codeaurora.org> Signed-off-by: Ankit Gupta <ankgupta@codeaurora.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/spmi')
-rw-r--r--drivers/spmi/spmi.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/drivers/spmi/spmi.c b/drivers/spmi/spmi.c
index 94938436aef9..11467e17bdd8 100644
--- a/drivers/spmi/spmi.c
+++ b/drivers/spmi/spmi.c
@@ -22,6 +22,8 @@
22#include <linux/pm_runtime.h> 22#include <linux/pm_runtime.h>
23 23
24#include <dt-bindings/spmi/spmi.h> 24#include <dt-bindings/spmi/spmi.h>
25#define CREATE_TRACE_POINTS
26#include <trace/events/spmi.h>
25 27
26static DEFINE_IDA(ctrl_ida); 28static DEFINE_IDA(ctrl_ida);
27 29
@@ -96,28 +98,42 @@ EXPORT_SYMBOL_GPL(spmi_device_remove);
96static inline int 98static inline int
97spmi_cmd(struct spmi_controller *ctrl, u8 opcode, u8 sid) 99spmi_cmd(struct spmi_controller *ctrl, u8 opcode, u8 sid)
98{ 100{
101 int ret;
102
99 if (!ctrl || !ctrl->cmd || ctrl->dev.type != &spmi_ctrl_type) 103 if (!ctrl || !ctrl->cmd || ctrl->dev.type != &spmi_ctrl_type)
100 return -EINVAL; 104 return -EINVAL;
101 105
102 return ctrl->cmd(ctrl, opcode, sid); 106 ret = ctrl->cmd(ctrl, opcode, sid);
107 trace_spmi_cmd(opcode, sid, ret);
108 return ret;
103} 109}
104 110
105static inline int spmi_read_cmd(struct spmi_controller *ctrl, u8 opcode, 111static inline int spmi_read_cmd(struct spmi_controller *ctrl, u8 opcode,
106 u8 sid, u16 addr, u8 *buf, size_t len) 112 u8 sid, u16 addr, u8 *buf, size_t len)
107{ 113{
114 int ret;
115
108 if (!ctrl || !ctrl->read_cmd || ctrl->dev.type != &spmi_ctrl_type) 116 if (!ctrl || !ctrl->read_cmd || ctrl->dev.type != &spmi_ctrl_type)
109 return -EINVAL; 117 return -EINVAL;
110 118
111 return ctrl->read_cmd(ctrl, opcode, sid, addr, buf, len); 119 trace_spmi_read_begin(opcode, sid, addr);
120 ret = ctrl->read_cmd(ctrl, opcode, sid, addr, buf, len);
121 trace_spmi_read_end(opcode, sid, addr, ret, len, buf);
122 return ret;
112} 123}
113 124
114static inline int spmi_write_cmd(struct spmi_controller *ctrl, u8 opcode, 125static inline int spmi_write_cmd(struct spmi_controller *ctrl, u8 opcode,
115 u8 sid, u16 addr, const u8 *buf, size_t len) 126 u8 sid, u16 addr, const u8 *buf, size_t len)
116{ 127{
128 int ret;
129
117 if (!ctrl || !ctrl->write_cmd || ctrl->dev.type != &spmi_ctrl_type) 130 if (!ctrl || !ctrl->write_cmd || ctrl->dev.type != &spmi_ctrl_type)
118 return -EINVAL; 131 return -EINVAL;
119 132
120 return ctrl->write_cmd(ctrl, opcode, sid, addr, buf, len); 133 trace_spmi_write_begin(opcode, sid, addr, len, buf);
134 ret = ctrl->write_cmd(ctrl, opcode, sid, addr, buf, len);
135 trace_spmi_write_end(opcode, sid, addr, ret);
136 return ret;
121} 137}
122 138
123/** 139/**