1 /* SPDX-License-Identifier: GPL-2.0 */ << 2 #undef TRACE_SYSTEM 1 #undef TRACE_SYSTEM 3 #define TRACE_SYSTEM spi 2 #define TRACE_SYSTEM spi 4 3 5 #if !defined(_TRACE_SPI_H) || defined(TRACE_HE 4 #if !defined(_TRACE_SPI_H) || defined(TRACE_HEADER_MULTI_READ) 6 #define _TRACE_SPI_H 5 #define _TRACE_SPI_H 7 6 8 #include <linux/ktime.h> 7 #include <linux/ktime.h> 9 #include <linux/tracepoint.h> 8 #include <linux/tracepoint.h> 10 9 11 DECLARE_EVENT_CLASS(spi_controller, !! 10 DECLARE_EVENT_CLASS(spi_master, 12 11 13 TP_PROTO(struct spi_controller *contro !! 12 TP_PROTO(struct spi_master *master), 14 13 15 TP_ARGS(controller), !! 14 TP_ARGS(master), 16 15 17 TP_STRUCT__entry( 16 TP_STRUCT__entry( 18 __field( int, 17 __field( int, bus_num ) 19 ), 18 ), 20 19 21 TP_fast_assign( 20 TP_fast_assign( 22 __entry->bus_num = controller- !! 21 __entry->bus_num = master->bus_num; 23 ), 22 ), 24 23 25 TP_printk("spi%d", (int)__entry->bus_n 24 TP_printk("spi%d", (int)__entry->bus_num) 26 25 27 ); 26 ); 28 27 29 DEFINE_EVENT(spi_controller, spi_controller_id !! 28 DEFINE_EVENT(spi_master, spi_master_idle, 30 29 31 TP_PROTO(struct spi_controller *contro !! 30 TP_PROTO(struct spi_master *master), 32 31 33 TP_ARGS(controller) !! 32 TP_ARGS(master) 34 33 35 ); 34 ); 36 35 37 DEFINE_EVENT(spi_controller, spi_controller_bu !! 36 DEFINE_EVENT(spi_master, spi_master_busy, 38 37 39 TP_PROTO(struct spi_controller *contro !! 38 TP_PROTO(struct spi_master *master), 40 39 41 TP_ARGS(controller) !! 40 TP_ARGS(master) 42 41 43 ); 42 ); 44 43 45 TRACE_EVENT(spi_setup, << 46 TP_PROTO(struct spi_device *spi, int s << 47 TP_ARGS(spi, status), << 48 << 49 TP_STRUCT__entry( << 50 __field(int, bus_num) << 51 __field(int, chip_select) << 52 __field(unsigned long, mode) << 53 __field(unsigned int, bits_per << 54 __field(unsigned int, max_spee << 55 __field(int, status) << 56 ), << 57 << 58 TP_fast_assign( << 59 __entry->bus_num = spi->contro << 60 __entry->chip_select = spi_ge << 61 __entry->mode = spi->mode; << 62 __entry->bits_per_word = spi-> << 63 __entry->max_speed_hz = spi->m << 64 __entry->status = status; << 65 ), << 66 << 67 TP_printk("spi%d.%d setup mode %lu, %s << 68 __entry->bus_num, __entry->c << 69 (__entry->mode & SPI_MODE_X_ << 70 (__entry->mode & SPI_CS_HIGH << 71 (__entry->mode & SPI_LSB_FIR << 72 (__entry->mode & SPI_3WIRE) << 73 (__entry->mode & SPI_LOOP) ? << 74 __entry->bits_per_word, __en << 75 __entry->status) << 76 ); << 77 << 78 TRACE_EVENT(spi_set_cs, << 79 TP_PROTO(struct spi_device *spi, bool << 80 TP_ARGS(spi, enable), << 81 << 82 TP_STRUCT__entry( << 83 __field(int, bus_num) << 84 __field(int, chip_select) << 85 __field(unsigned long, mode) << 86 __field(bool, enable) << 87 ), << 88 << 89 TP_fast_assign( << 90 __entry->bus_num = spi->contro << 91 __entry->chip_select = spi_get << 92 __entry->mode = spi->mode; << 93 __entry->enable = enable; << 94 ), << 95 << 96 TP_printk("spi%d.%d %s%s", << 97 __entry->bus_num, __entry->c << 98 __entry->enable ? "activate" << 99 (__entry->mode & SPI_CS_HIGH << 100 ); << 101 << 102 DECLARE_EVENT_CLASS(spi_message, 44 DECLARE_EVENT_CLASS(spi_message, 103 45 104 TP_PROTO(struct spi_message *msg), 46 TP_PROTO(struct spi_message *msg), 105 47 106 TP_ARGS(msg), 48 TP_ARGS(msg), 107 49 108 TP_STRUCT__entry( 50 TP_STRUCT__entry( 109 __field( int, 51 __field( int, bus_num ) 110 __field( int, 52 __field( int, chip_select ) 111 __field( struct spi_mes 53 __field( struct spi_message *, msg ) 112 ), 54 ), 113 55 114 TP_fast_assign( 56 TP_fast_assign( 115 __entry->bus_num = msg->spi->c !! 57 __entry->bus_num = msg->spi->master->bus_num; 116 __entry->chip_select = spi_get !! 58 __entry->chip_select = msg->spi->chip_select; 117 __entry->msg = msg; 59 __entry->msg = msg; 118 ), 60 ), 119 61 120 TP_printk("spi%d.%d %p", (int)__entry- 62 TP_printk("spi%d.%d %p", (int)__entry->bus_num, 121 (int)__entry->chip_select, 63 (int)__entry->chip_select, 122 (struct spi_message *)__entr 64 (struct spi_message *)__entry->msg) 123 ); 65 ); 124 66 125 DEFINE_EVENT(spi_message, spi_message_submit, 67 DEFINE_EVENT(spi_message, spi_message_submit, 126 68 127 TP_PROTO(struct spi_message *msg), 69 TP_PROTO(struct spi_message *msg), 128 70 129 TP_ARGS(msg) 71 TP_ARGS(msg) 130 72 131 ); 73 ); 132 74 133 DEFINE_EVENT(spi_message, spi_message_start, 75 DEFINE_EVENT(spi_message, spi_message_start, 134 76 135 TP_PROTO(struct spi_message *msg), 77 TP_PROTO(struct spi_message *msg), 136 78 137 TP_ARGS(msg) 79 TP_ARGS(msg) 138 80 139 ); 81 ); 140 82 141 TRACE_EVENT(spi_message_done, 83 TRACE_EVENT(spi_message_done, 142 84 143 TP_PROTO(struct spi_message *msg), 85 TP_PROTO(struct spi_message *msg), 144 86 145 TP_ARGS(msg), 87 TP_ARGS(msg), 146 88 147 TP_STRUCT__entry( 89 TP_STRUCT__entry( 148 __field( int, 90 __field( int, bus_num ) 149 __field( int, 91 __field( int, chip_select ) 150 __field( struct spi_mes 92 __field( struct spi_message *, msg ) 151 __field( unsigned, 93 __field( unsigned, frame ) 152 __field( unsigned, 94 __field( unsigned, actual ) 153 ), 95 ), 154 96 155 TP_fast_assign( 97 TP_fast_assign( 156 __entry->bus_num = msg->spi->c !! 98 __entry->bus_num = msg->spi->master->bus_num; 157 __entry->chip_select = spi_get !! 99 __entry->chip_select = msg->spi->chip_select; 158 __entry->msg = msg; 100 __entry->msg = msg; 159 __entry->frame = msg->frame_le 101 __entry->frame = msg->frame_length; 160 __entry->actual = msg->actual_ 102 __entry->actual = msg->actual_length; 161 ), 103 ), 162 104 163 TP_printk("spi%d.%d %p len=%u/%u", (in 105 TP_printk("spi%d.%d %p len=%u/%u", (int)__entry->bus_num, 164 (int)__entry->chip_select, 106 (int)__entry->chip_select, 165 (struct spi_message *)__entr 107 (struct spi_message *)__entry->msg, 166 (unsigned)__entry->actual, ( 108 (unsigned)__entry->actual, (unsigned)__entry->frame) 167 ); 109 ); 168 110 169 /* << 170 * Consider a buffer valid if non-NULL and if << 171 * that only exist to work with controllers th << 172 * SPI_CONTROLLER_MUST_RX. << 173 */ << 174 #define spi_valid_txbuf(msg, xfer) \ << 175 (xfer->tx_buf && xfer->tx_buf != msg-> << 176 #define spi_valid_rxbuf(msg, xfer) \ << 177 (xfer->rx_buf && xfer->rx_buf != msg-> << 178 << 179 DECLARE_EVENT_CLASS(spi_transfer, 111 DECLARE_EVENT_CLASS(spi_transfer, 180 112 181 TP_PROTO(struct spi_message *msg, stru 113 TP_PROTO(struct spi_message *msg, struct spi_transfer *xfer), 182 114 183 TP_ARGS(msg, xfer), 115 TP_ARGS(msg, xfer), 184 116 185 TP_STRUCT__entry( 117 TP_STRUCT__entry( 186 __field( int, 118 __field( int, bus_num ) 187 __field( int, 119 __field( int, chip_select ) 188 __field( struct spi_tra 120 __field( struct spi_transfer *, xfer ) 189 __field( int, 121 __field( int, len ) 190 __dynamic_array(u8, rx_buf, << 191 spi_valid_rxbu << 192 (xfer- << 193 __dynamic_array(u8, tx_buf, << 194 spi_valid_txbu << 195 (xfer- << 196 ), 122 ), 197 123 198 TP_fast_assign( 124 TP_fast_assign( 199 __entry->bus_num = msg->spi->c !! 125 __entry->bus_num = msg->spi->master->bus_num; 200 __entry->chip_select = spi_get !! 126 __entry->chip_select = msg->spi->chip_select; 201 __entry->xfer = xfer; 127 __entry->xfer = xfer; 202 __entry->len = xfer->len; 128 __entry->len = xfer->len; 203 << 204 if (spi_valid_txbuf(msg, xfer) << 205 memcpy(__get_dynamic_a << 206 xfer->tx_buf, _ << 207 << 208 if (spi_valid_rxbuf(msg, xfer) << 209 memcpy(__get_dynamic_a << 210 xfer->rx_buf, _ << 211 ), 129 ), 212 130 213 TP_printk("spi%d.%d %p len=%d tx=[%*ph !! 131 TP_printk("spi%d.%d %p len=%d", (int)__entry->bus_num, 214 __entry->bus_num, __entry->c !! 132 (int)__entry->chip_select, 215 __entry->xfer, __entry->len, !! 133 (struct spi_message *)__entry->xfer, 216 __get_dynamic_array_len(tx_b !! 134 (int)__entry->len) 217 __get_dynamic_array_len(rx_b << 218 ); 135 ); 219 136 220 DEFINE_EVENT(spi_transfer, spi_transfer_start, 137 DEFINE_EVENT(spi_transfer, spi_transfer_start, 221 138 222 TP_PROTO(struct spi_message *msg, stru 139 TP_PROTO(struct spi_message *msg, struct spi_transfer *xfer), 223 140 224 TP_ARGS(msg, xfer) 141 TP_ARGS(msg, xfer) 225 142 226 ); 143 ); 227 144 228 DEFINE_EVENT(spi_transfer, spi_transfer_stop, 145 DEFINE_EVENT(spi_transfer, spi_transfer_stop, 229 146 230 TP_PROTO(struct spi_message *msg, stru 147 TP_PROTO(struct spi_message *msg, struct spi_transfer *xfer), 231 148 232 TP_ARGS(msg, xfer) 149 TP_ARGS(msg, xfer) 233 150 234 ); 151 ); 235 152 236 #endif /* _TRACE_POWER_H */ 153 #endif /* _TRACE_POWER_H */ 237 154 238 /* This part must be outside protection */ 155 /* This part must be outside protection */ 239 #include <trace/define_trace.h> 156 #include <trace/define_trace.h> 240 157
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.