diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-07-12 13:04:56 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-07-12 13:04:56 -0400 |
| commit | 235b84fc862ae2637dc0dabada18d97f1bfc18e1 (patch) | |
| tree | c89a1a8ffa7765fc7fa7cfe1ba4c033eb886a87d /include/trace | |
| parent | fb4e3beeffa47619985f190663c6ef424f063a22 (diff) | |
| parent | 8f1a357d41a22009150cf404b5aa5876efdb59b1 (diff) | |
Merge branch 'i2c/for-4.13' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux
Pull i2c updates from Wolfram Sang:
"This pull request contains:
- i2c core reorganization. One source file became too monolithic. It
is now split up, yet we still have the same named object as the
final output. This should ease maintenance.
- new drivers: ZTE ZX2967 family, ASPEED 24XX/25XX
- designware driver gained slave mode support
- xgene-slimpro driver gained ACPI support
- bigger overhaul for pca-platform driver
- the algo-bit module now supports messages with enforced STOP
- slightly bigger than usual set of driver updates and improvements
and with much appreciated quality assurance from Andy Shevchenko"
* 'i2c/for-4.13' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (51 commits)
i2c: Provide a stub for i2c_detect_slave_mode()
i2c: designware: Let slave adapter support be optional
i2c: designware: Make HW init functions static
i2c: designware: fix spelling mistakes
i2c: pca-platform: propagate error from i2c_pca_add_numbered_bus
i2c: pca-platform: correctly set algo_data.reset_chip
i2c: acpi: Do not create i2c-clients for LNXVIDEO ACPI devices
i2c: designware: enable SLAVE in platform module
i2c: designware: add SLAVE mode functions
i2c: zx2967: drop COMPILE_TEST dependency
i2c: zx2967: always use the same device when printing errors
i2c: pca-platform: use dev_warn/dev_info instead of printk
i2c: pca-platform: use device managed allocations
i2c: pca-platform: add devicetree awareness
i2c: pca-platform: switch to struct gpio_desc
dt-bindings: add bindings for i2c-pca-platform
i2c: cadance: fix ctrl/addr reg write order
i2c: zx2967: add i2c controller driver for ZTE's zx2967 family
dt: bindings: add documentation for zx2967 family i2c controller
i2c: algo-bit: add support for I2C_M_STOP
...
Diffstat (limited to 'include/trace')
| -rw-r--r-- | include/trace/events/i2c.h | 226 | ||||
| -rw-r--r-- | include/trace/events/smbus.h | 249 |
2 files changed, 251 insertions, 224 deletions
diff --git a/include/trace/events/i2c.h b/include/trace/events/i2c.h index 4abb8eab34d3..86a401190df9 100644 --- a/include/trace/events/i2c.h +++ b/include/trace/events/i2c.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* I2C and SMBUS message transfer tracepoints | 1 | /* I2C message transfer tracepoints |
| 2 | * | 2 | * |
| 3 | * Copyright (C) 2013 Red Hat, Inc. All Rights Reserved. | 3 | * Copyright (C) 2013 Red Hat, Inc. All Rights Reserved. |
| 4 | * Written by David Howells (dhowells@redhat.com) | 4 | * Written by David Howells (dhowells@redhat.com) |
| @@ -18,7 +18,7 @@ | |||
| 18 | #include <linux/tracepoint.h> | 18 | #include <linux/tracepoint.h> |
| 19 | 19 | ||
| 20 | /* | 20 | /* |
| 21 | * drivers/i2c/i2c-core.c | 21 | * drivers/i2c/i2c-core-base.c |
| 22 | */ | 22 | */ |
| 23 | extern int i2c_transfer_trace_reg(void); | 23 | extern int i2c_transfer_trace_reg(void); |
| 24 | extern void i2c_transfer_trace_unreg(void); | 24 | extern void i2c_transfer_trace_unreg(void); |
| @@ -144,228 +144,6 @@ TRACE_EVENT_FN(i2c_result, | |||
| 144 | i2c_transfer_trace_reg, | 144 | i2c_transfer_trace_reg, |
| 145 | i2c_transfer_trace_unreg); | 145 | i2c_transfer_trace_unreg); |
| 146 | 146 | ||
| 147 | /* | ||
| 148 | * i2c_smbus_xfer() write data or procedure call request | ||
| 149 | */ | ||
| 150 | TRACE_EVENT_CONDITION(smbus_write, | ||
| 151 | TP_PROTO(const struct i2c_adapter *adap, | ||
| 152 | u16 addr, unsigned short flags, | ||
| 153 | char read_write, u8 command, int protocol, | ||
| 154 | const union i2c_smbus_data *data), | ||
| 155 | TP_ARGS(adap, addr, flags, read_write, command, protocol, data), | ||
| 156 | TP_CONDITION(read_write == I2C_SMBUS_WRITE || | ||
| 157 | protocol == I2C_SMBUS_PROC_CALL || | ||
| 158 | protocol == I2C_SMBUS_BLOCK_PROC_CALL), | ||
| 159 | TP_STRUCT__entry( | ||
| 160 | __field(int, adapter_nr ) | ||
| 161 | __field(__u16, addr ) | ||
| 162 | __field(__u16, flags ) | ||
| 163 | __field(__u8, command ) | ||
| 164 | __field(__u8, len ) | ||
| 165 | __field(__u32, protocol ) | ||
| 166 | __array(__u8, buf, I2C_SMBUS_BLOCK_MAX + 2) ), | ||
| 167 | TP_fast_assign( | ||
| 168 | __entry->adapter_nr = adap->nr; | ||
| 169 | __entry->addr = addr; | ||
| 170 | __entry->flags = flags; | ||
| 171 | __entry->command = command; | ||
| 172 | __entry->protocol = protocol; | ||
| 173 | |||
| 174 | switch (protocol) { | ||
| 175 | case I2C_SMBUS_BYTE_DATA: | ||
| 176 | __entry->len = 1; | ||
| 177 | goto copy; | ||
| 178 | case I2C_SMBUS_WORD_DATA: | ||
| 179 | case I2C_SMBUS_PROC_CALL: | ||
| 180 | __entry->len = 2; | ||
| 181 | goto copy; | ||
| 182 | case I2C_SMBUS_BLOCK_DATA: | ||
| 183 | case I2C_SMBUS_BLOCK_PROC_CALL: | ||
| 184 | case I2C_SMBUS_I2C_BLOCK_DATA: | ||
| 185 | __entry->len = data->block[0] + 1; | ||
| 186 | copy: | ||
| 187 | memcpy(__entry->buf, data->block, __entry->len); | ||
| 188 | break; | ||
| 189 | case I2C_SMBUS_QUICK: | ||
| 190 | case I2C_SMBUS_BYTE: | ||
| 191 | case I2C_SMBUS_I2C_BLOCK_BROKEN: | ||
| 192 | default: | ||
| 193 | __entry->len = 0; | ||
| 194 | } | ||
| 195 | ), | ||
| 196 | TP_printk("i2c-%d a=%03x f=%04x c=%x %s l=%u [%*phD]", | ||
| 197 | __entry->adapter_nr, | ||
| 198 | __entry->addr, | ||
| 199 | __entry->flags, | ||
| 200 | __entry->command, | ||
| 201 | __print_symbolic(__entry->protocol, | ||
| 202 | { I2C_SMBUS_QUICK, "QUICK" }, | ||
| 203 | { I2C_SMBUS_BYTE, "BYTE" }, | ||
| 204 | { I2C_SMBUS_BYTE_DATA, "BYTE_DATA" }, | ||
| 205 | { I2C_SMBUS_WORD_DATA, "WORD_DATA" }, | ||
| 206 | { I2C_SMBUS_PROC_CALL, "PROC_CALL" }, | ||
| 207 | { I2C_SMBUS_BLOCK_DATA, "BLOCK_DATA" }, | ||
| 208 | { I2C_SMBUS_I2C_BLOCK_BROKEN, "I2C_BLOCK_BROKEN" }, | ||
| 209 | { I2C_SMBUS_BLOCK_PROC_CALL, "BLOCK_PROC_CALL" }, | ||
| 210 | { I2C_SMBUS_I2C_BLOCK_DATA, "I2C_BLOCK_DATA" }), | ||
| 211 | __entry->len, | ||
| 212 | __entry->len, __entry->buf | ||
| 213 | )); | ||
| 214 | |||
| 215 | /* | ||
| 216 | * i2c_smbus_xfer() read data request | ||
| 217 | */ | ||
| 218 | TRACE_EVENT_CONDITION(smbus_read, | ||
| 219 | TP_PROTO(const struct i2c_adapter *adap, | ||
| 220 | u16 addr, unsigned short flags, | ||
| 221 | char read_write, u8 command, int protocol), | ||
| 222 | TP_ARGS(adap, addr, flags, read_write, command, protocol), | ||
| 223 | TP_CONDITION(!(read_write == I2C_SMBUS_WRITE || | ||
| 224 | protocol == I2C_SMBUS_PROC_CALL || | ||
| 225 | protocol == I2C_SMBUS_BLOCK_PROC_CALL)), | ||
| 226 | TP_STRUCT__entry( | ||
| 227 | __field(int, adapter_nr ) | ||
| 228 | __field(__u16, flags ) | ||
| 229 | __field(__u16, addr ) | ||
| 230 | __field(__u8, command ) | ||
| 231 | __field(__u32, protocol ) | ||
| 232 | __array(__u8, buf, I2C_SMBUS_BLOCK_MAX + 2) ), | ||
| 233 | TP_fast_assign( | ||
| 234 | __entry->adapter_nr = adap->nr; | ||
| 235 | __entry->addr = addr; | ||
| 236 | __entry->flags = flags; | ||
| 237 | __entry->command = command; | ||
| 238 | __entry->protocol = protocol; | ||
| 239 | ), | ||
| 240 | TP_printk("i2c-%d a=%03x f=%04x c=%x %s", | ||
| 241 | __entry->adapter_nr, | ||
| 242 | __entry->addr, | ||
| 243 | __entry->flags, | ||
| 244 | __entry->command, | ||
| 245 | __print_symbolic(__entry->protocol, | ||
| 246 | { I2C_SMBUS_QUICK, "QUICK" }, | ||
| 247 | { I2C_SMBUS_BYTE, "BYTE" }, | ||
| 248 | { I2C_SMBUS_BYTE_DATA, "BYTE_DATA" }, | ||
| 249 | { I2C_SMBUS_WORD_DATA, "WORD_DATA" }, | ||
| 250 | { I2C_SMBUS_PROC_CALL, "PROC_CALL" }, | ||
| 251 | { I2C_SMBUS_BLOCK_DATA, "BLOCK_DATA" }, | ||
| 252 | { I2C_SMBUS_I2C_BLOCK_BROKEN, "I2C_BLOCK_BROKEN" }, | ||
| 253 | { I2C_SMBUS_BLOCK_PROC_CALL, "BLOCK_PROC_CALL" }, | ||
| 254 | { I2C_SMBUS_I2C_BLOCK_DATA, "I2C_BLOCK_DATA" }) | ||
| 255 | )); | ||
| 256 | |||
| 257 | /* | ||
| 258 | * i2c_smbus_xfer() read data or procedure call reply | ||
| 259 | */ | ||
| 260 | TRACE_EVENT_CONDITION(smbus_reply, | ||
| 261 | TP_PROTO(const struct i2c_adapter *adap, | ||
| 262 | u16 addr, unsigned short flags, | ||
| 263 | char read_write, u8 command, int protocol, | ||
| 264 | const union i2c_smbus_data *data), | ||
| 265 | TP_ARGS(adap, addr, flags, read_write, command, protocol, data), | ||
| 266 | TP_CONDITION(read_write == I2C_SMBUS_READ), | ||
| 267 | TP_STRUCT__entry( | ||
| 268 | __field(int, adapter_nr ) | ||
| 269 | __field(__u16, addr ) | ||
| 270 | __field(__u16, flags ) | ||
| 271 | __field(__u8, command ) | ||
| 272 | __field(__u8, len ) | ||
| 273 | __field(__u32, protocol ) | ||
| 274 | __array(__u8, buf, I2C_SMBUS_BLOCK_MAX + 2) ), | ||
| 275 | TP_fast_assign( | ||
| 276 | __entry->adapter_nr = adap->nr; | ||
| 277 | __entry->addr = addr; | ||
| 278 | __entry->flags = flags; | ||
| 279 | __entry->command = command; | ||
| 280 | __entry->protocol = protocol; | ||
| 281 | |||
| 282 | switch (protocol) { | ||
| 283 | case I2C_SMBUS_BYTE: | ||
| 284 | case I2C_SMBUS_BYTE_DATA: | ||
| 285 | __entry->len = 1; | ||
| 286 | goto copy; | ||
| 287 | case I2C_SMBUS_WORD_DATA: | ||
| 288 | case I2C_SMBUS_PROC_CALL: | ||
| 289 | __entry->len = 2; | ||
| 290 | goto copy; | ||
| 291 | case I2C_SMBUS_BLOCK_DATA: | ||
| 292 | case I2C_SMBUS_BLOCK_PROC_CALL: | ||
| 293 | case I2C_SMBUS_I2C_BLOCK_DATA: | ||
| 294 | __entry->len = data->block[0] + 1; | ||
| 295 | copy: | ||
| 296 | memcpy(__entry->buf, data->block, __entry->len); | ||
| 297 | break; | ||
| 298 | case I2C_SMBUS_QUICK: | ||
| 299 | case I2C_SMBUS_I2C_BLOCK_BROKEN: | ||
| 300 | default: | ||
| 301 | __entry->len = 0; | ||
| 302 | } | ||
| 303 | ), | ||
| 304 | TP_printk("i2c-%d a=%03x f=%04x c=%x %s l=%u [%*phD]", | ||
| 305 | __entry->adapter_nr, | ||
| 306 | __entry->addr, | ||
| 307 | __entry->flags, | ||
| 308 | __entry->command, | ||
| 309 | __print_symbolic(__entry->protocol, | ||
| 310 | { I2C_SMBUS_QUICK, "QUICK" }, | ||
| 311 | { I2C_SMBUS_BYTE, "BYTE" }, | ||
| 312 | { I2C_SMBUS_BYTE_DATA, "BYTE_DATA" }, | ||
| 313 | { I2C_SMBUS_WORD_DATA, "WORD_DATA" }, | ||
| 314 | { I2C_SMBUS_PROC_CALL, "PROC_CALL" }, | ||
| 315 | { I2C_SMBUS_BLOCK_DATA, "BLOCK_DATA" }, | ||
| 316 | { I2C_SMBUS_I2C_BLOCK_BROKEN, "I2C_BLOCK_BROKEN" }, | ||
| 317 | { I2C_SMBUS_BLOCK_PROC_CALL, "BLOCK_PROC_CALL" }, | ||
| 318 | { I2C_SMBUS_I2C_BLOCK_DATA, "I2C_BLOCK_DATA" }), | ||
| 319 | __entry->len, | ||
| 320 | __entry->len, __entry->buf | ||
| 321 | )); | ||
| 322 | |||
| 323 | /* | ||
| 324 | * i2c_smbus_xfer() result | ||
| 325 | */ | ||
| 326 | TRACE_EVENT(smbus_result, | ||
| 327 | TP_PROTO(const struct i2c_adapter *adap, | ||
| 328 | u16 addr, unsigned short flags, | ||
| 329 | char read_write, u8 command, int protocol, | ||
| 330 | int res), | ||
| 331 | TP_ARGS(adap, addr, flags, read_write, command, protocol, res), | ||
| 332 | TP_STRUCT__entry( | ||
| 333 | __field(int, adapter_nr ) | ||
| 334 | __field(__u16, addr ) | ||
| 335 | __field(__u16, flags ) | ||
| 336 | __field(__u8, read_write ) | ||
| 337 | __field(__u8, command ) | ||
| 338 | __field(__s16, res ) | ||
| 339 | __field(__u32, protocol ) | ||
| 340 | ), | ||
| 341 | TP_fast_assign( | ||
| 342 | __entry->adapter_nr = adap->nr; | ||
| 343 | __entry->addr = addr; | ||
| 344 | __entry->flags = flags; | ||
| 345 | __entry->read_write = read_write; | ||
| 346 | __entry->command = command; | ||
| 347 | __entry->protocol = protocol; | ||
| 348 | __entry->res = res; | ||
| 349 | ), | ||
| 350 | TP_printk("i2c-%d a=%03x f=%04x c=%x %s %s res=%d", | ||
| 351 | __entry->adapter_nr, | ||
| 352 | __entry->addr, | ||
| 353 | __entry->flags, | ||
| 354 | __entry->command, | ||
| 355 | __print_symbolic(__entry->protocol, | ||
| 356 | { I2C_SMBUS_QUICK, "QUICK" }, | ||
| 357 | { I2C_SMBUS_BYTE, "BYTE" }, | ||
| 358 | { I2C_SMBUS_BYTE_DATA, "BYTE_DATA" }, | ||
| 359 | { I2C_SMBUS_WORD_DATA, "WORD_DATA" }, | ||
| 360 | { I2C_SMBUS_PROC_CALL, "PROC_CALL" }, | ||
| 361 | { I2C_SMBUS_BLOCK_DATA, "BLOCK_DATA" }, | ||
| 362 | { I2C_SMBUS_I2C_BLOCK_BROKEN, "I2C_BLOCK_BROKEN" }, | ||
| 363 | { I2C_SMBUS_BLOCK_PROC_CALL, "BLOCK_PROC_CALL" }, | ||
| 364 | { I2C_SMBUS_I2C_BLOCK_DATA, "I2C_BLOCK_DATA" }), | ||
| 365 | __entry->read_write == I2C_SMBUS_WRITE ? "wr" : "rd", | ||
| 366 | __entry->res | ||
| 367 | )); | ||
| 368 | |||
| 369 | #endif /* _TRACE_I2C_H */ | 147 | #endif /* _TRACE_I2C_H */ |
| 370 | 148 | ||
| 371 | /* This part must be outside protection */ | 149 | /* This part must be outside protection */ |
diff --git a/include/trace/events/smbus.h b/include/trace/events/smbus.h new file mode 100644 index 000000000000..d2fb6e1d3e10 --- /dev/null +++ b/include/trace/events/smbus.h | |||
| @@ -0,0 +1,249 @@ | |||
| 1 | /* SMBUS message transfer tracepoints | ||
| 2 | * | ||
| 3 | * Copyright (C) 2013 Red Hat, Inc. All Rights Reserved. | ||
| 4 | * Written by David Howells (dhowells@redhat.com) | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or | ||
| 7 | * modify it under the terms of the GNU General Public Licence | ||
| 8 | * as published by the Free Software Foundation; either version | ||
| 9 | * 2 of the Licence, or (at your option) any later version. | ||
| 10 | */ | ||
| 11 | #undef TRACE_SYSTEM | ||
| 12 | #define TRACE_SYSTEM smbus | ||
| 13 | |||
| 14 | #if !defined(_TRACE_SMBUS_H) || defined(TRACE_HEADER_MULTI_READ) | ||
| 15 | #define _TRACE_SMBUS_H | ||
| 16 | |||
| 17 | #include <linux/i2c.h> | ||
| 18 | #include <linux/tracepoint.h> | ||
| 19 | |||
| 20 | /* | ||
| 21 | * drivers/i2c/i2c-core-smbus.c | ||
| 22 | */ | ||
| 23 | |||
| 24 | /* | ||
| 25 | * i2c_smbus_xfer() write data or procedure call request | ||
| 26 | */ | ||
| 27 | TRACE_EVENT_CONDITION(smbus_write, | ||
| 28 | TP_PROTO(const struct i2c_adapter *adap, | ||
| 29 | u16 addr, unsigned short flags, | ||
| 30 | char read_write, u8 command, int protocol, | ||
| 31 | const union i2c_smbus_data *data), | ||
| 32 | TP_ARGS(adap, addr, flags, read_write, command, protocol, data), | ||
| 33 | TP_CONDITION(read_write == I2C_SMBUS_WRITE || | ||
| 34 | protocol == I2C_SMBUS_PROC_CALL || | ||
| 35 | protocol == I2C_SMBUS_BLOCK_PROC_CALL), | ||
| 36 | TP_STRUCT__entry( | ||
| 37 | __field(int, adapter_nr ) | ||
| 38 | __field(__u16, addr ) | ||
| 39 | __field(__u16, flags ) | ||
| 40 | __field(__u8, command ) | ||
| 41 | __field(__u8, len ) | ||
| 42 | __field(__u32, protocol ) | ||
| 43 | __array(__u8, buf, I2C_SMBUS_BLOCK_MAX + 2) ), | ||
| 44 | TP_fast_assign( | ||
| 45 | __entry->adapter_nr = adap->nr; | ||
| 46 | __entry->addr = addr; | ||
| 47 | __entry->flags = flags; | ||
| 48 | __entry->command = command; | ||
| 49 | __entry->protocol = protocol; | ||
| 50 | |||
| 51 | switch (protocol) { | ||
| 52 | case I2C_SMBUS_BYTE_DATA: | ||
| 53 | __entry->len = 1; | ||
| 54 | goto copy; | ||
| 55 | case I2C_SMBUS_WORD_DATA: | ||
| 56 | case I2C_SMBUS_PROC_CALL: | ||
| 57 | __entry->len = 2; | ||
| 58 | goto copy; | ||
| 59 | case I2C_SMBUS_BLOCK_DATA: | ||
| 60 | case I2C_SMBUS_BLOCK_PROC_CALL: | ||
| 61 | case I2C_SMBUS_I2C_BLOCK_DATA: | ||
| 62 | __entry->len = data->block[0] + 1; | ||
| 63 | copy: | ||
| 64 | memcpy(__entry->buf, data->block, __entry->len); | ||
| 65 | break; | ||
| 66 | case I2C_SMBUS_QUICK: | ||
| 67 | case I2C_SMBUS_BYTE: | ||
| 68 | case I2C_SMBUS_I2C_BLOCK_BROKEN: | ||
| 69 | default: | ||
| 70 | __entry->len = 0; | ||
| 71 | } | ||
| 72 | ), | ||
| 73 | TP_printk("i2c-%d a=%03x f=%04x c=%x %s l=%u [%*phD]", | ||
| 74 | __entry->adapter_nr, | ||
| 75 | __entry->addr, | ||
| 76 | __entry->flags, | ||
| 77 | __entry->command, | ||
| 78 | __print_symbolic(__entry->protocol, | ||
| 79 | { I2C_SMBUS_QUICK, "QUICK" }, | ||
| 80 | { I2C_SMBUS_BYTE, "BYTE" }, | ||
| 81 | { I2C_SMBUS_BYTE_DATA, "BYTE_DATA" }, | ||
| 82 | { I2C_SMBUS_WORD_DATA, "WORD_DATA" }, | ||
| 83 | { I2C_SMBUS_PROC_CALL, "PROC_CALL" }, | ||
| 84 | { I2C_SMBUS_BLOCK_DATA, "BLOCK_DATA" }, | ||
| 85 | { I2C_SMBUS_I2C_BLOCK_BROKEN, "I2C_BLOCK_BROKEN" }, | ||
| 86 | { I2C_SMBUS_BLOCK_PROC_CALL, "BLOCK_PROC_CALL" }, | ||
| 87 | { I2C_SMBUS_I2C_BLOCK_DATA, "I2C_BLOCK_DATA" }), | ||
| 88 | __entry->len, | ||
| 89 | __entry->len, __entry->buf | ||
| 90 | )); | ||
| 91 | |||
| 92 | /* | ||
| 93 | * i2c_smbus_xfer() read data request | ||
| 94 | */ | ||
| 95 | TRACE_EVENT_CONDITION(smbus_read, | ||
| 96 | TP_PROTO(const struct i2c_adapter *adap, | ||
| 97 | u16 addr, unsigned short flags, | ||
| 98 | char read_write, u8 command, int protocol), | ||
| 99 | TP_ARGS(adap, addr, flags, read_write, command, protocol), | ||
| 100 | TP_CONDITION(!(read_write == I2C_SMBUS_WRITE || | ||
| 101 | protocol == I2C_SMBUS_PROC_CALL || | ||
| 102 | protocol == I2C_SMBUS_BLOCK_PROC_CALL)), | ||
| 103 | TP_STRUCT__entry( | ||
| 104 | __field(int, adapter_nr ) | ||
| 105 | __field(__u16, flags ) | ||
| 106 | __field(__u16, addr ) | ||
| 107 | __field(__u8, command ) | ||
| 108 | __field(__u32, protocol ) | ||
| 109 | __array(__u8, buf, I2C_SMBUS_BLOCK_MAX + 2) ), | ||
| 110 | TP_fast_assign( | ||
| 111 | __entry->adapter_nr = adap->nr; | ||
| 112 | __entry->addr = addr; | ||
| 113 | __entry->flags = flags; | ||
| 114 | __entry->command = command; | ||
| 115 | __entry->protocol = protocol; | ||
| 116 | ), | ||
| 117 | TP_printk("i2c-%d a=%03x f=%04x c=%x %s", | ||
| 118 | __entry->adapter_nr, | ||
| 119 | __entry->addr, | ||
| 120 | __entry->flags, | ||
| 121 | __entry->command, | ||
| 122 | __print_symbolic(__entry->protocol, | ||
| 123 | { I2C_SMBUS_QUICK, "QUICK" }, | ||
| 124 | { I2C_SMBUS_BYTE, "BYTE" }, | ||
| 125 | { I2C_SMBUS_BYTE_DATA, "BYTE_DATA" }, | ||
| 126 | { I2C_SMBUS_WORD_DATA, "WORD_DATA" }, | ||
| 127 | { I2C_SMBUS_PROC_CALL, "PROC_CALL" }, | ||
| 128 | { I2C_SMBUS_BLOCK_DATA, "BLOCK_DATA" }, | ||
| 129 | { I2C_SMBUS_I2C_BLOCK_BROKEN, "I2C_BLOCK_BROKEN" }, | ||
| 130 | { I2C_SMBUS_BLOCK_PROC_CALL, "BLOCK_PROC_CALL" }, | ||
| 131 | { I2C_SMBUS_I2C_BLOCK_DATA, "I2C_BLOCK_DATA" }) | ||
| 132 | )); | ||
| 133 | |||
| 134 | /* | ||
| 135 | * i2c_smbus_xfer() read data or procedure call reply | ||
| 136 | */ | ||
| 137 | TRACE_EVENT_CONDITION(smbus_reply, | ||
| 138 | TP_PROTO(const struct i2c_adapter *adap, | ||
| 139 | u16 addr, unsigned short flags, | ||
| 140 | char read_write, u8 command, int protocol, | ||
| 141 | const union i2c_smbus_data *data), | ||
| 142 | TP_ARGS(adap, addr, flags, read_write, command, protocol, data), | ||
| 143 | TP_CONDITION(read_write == I2C_SMBUS_READ), | ||
| 144 | TP_STRUCT__entry( | ||
| 145 | __field(int, adapter_nr ) | ||
| 146 | __field(__u16, addr ) | ||
| 147 | __field(__u16, flags ) | ||
| 148 | __field(__u8, command ) | ||
| 149 | __field(__u8, len ) | ||
| 150 | __field(__u32, protocol ) | ||
| 151 | __array(__u8, buf, I2C_SMBUS_BLOCK_MAX + 2) ), | ||
| 152 | TP_fast_assign( | ||
| 153 | __entry->adapter_nr = adap->nr; | ||
| 154 | __entry->addr = addr; | ||
| 155 | __entry->flags = flags; | ||
| 156 | __entry->command = command; | ||
| 157 | __entry->protocol = protocol; | ||
| 158 | |||
| 159 | switch (protocol) { | ||
| 160 | case I2C_SMBUS_BYTE: | ||
| 161 | case I2C_SMBUS_BYTE_DATA: | ||
| 162 | __entry->len = 1; | ||
| 163 | goto copy; | ||
| 164 | case I2C_SMBUS_WORD_DATA: | ||
| 165 | case I2C_SMBUS_PROC_CALL: | ||
| 166 | __entry->len = 2; | ||
| 167 | goto copy; | ||
| 168 | case I2C_SMBUS_BLOCK_DATA: | ||
| 169 | case I2C_SMBUS_BLOCK_PROC_CALL: | ||
| 170 | case I2C_SMBUS_I2C_BLOCK_DATA: | ||
| 171 | __entry->len = data->block[0] + 1; | ||
| 172 | copy: | ||
| 173 | memcpy(__entry->buf, data->block, __entry->len); | ||
| 174 | break; | ||
| 175 | case I2C_SMBUS_QUICK: | ||
| 176 | case I2C_SMBUS_I2C_BLOCK_BROKEN: | ||
| 177 | default: | ||
| 178 | __entry->len = 0; | ||
| 179 | } | ||
| 180 | ), | ||
| 181 | TP_printk("i2c-%d a=%03x f=%04x c=%x %s l=%u [%*phD]", | ||
| 182 | __entry->adapter_nr, | ||
| 183 | __entry->addr, | ||
| 184 | __entry->flags, | ||
| 185 | __entry->command, | ||
| 186 | __print_symbolic(__entry->protocol, | ||
| 187 | { I2C_SMBUS_QUICK, "QUICK" }, | ||
| 188 | { I2C_SMBUS_BYTE, "BYTE" }, | ||
| 189 | { I2C_SMBUS_BYTE_DATA, "BYTE_DATA" }, | ||
| 190 | { I2C_SMBUS_WORD_DATA, "WORD_DATA" }, | ||
| 191 | { I2C_SMBUS_PROC_CALL, "PROC_CALL" }, | ||
| 192 | { I2C_SMBUS_BLOCK_DATA, "BLOCK_DATA" }, | ||
| 193 | { I2C_SMBUS_I2C_BLOCK_BROKEN, "I2C_BLOCK_BROKEN" }, | ||
| 194 | { I2C_SMBUS_BLOCK_PROC_CALL, "BLOCK_PROC_CALL" }, | ||
| 195 | { I2C_SMBUS_I2C_BLOCK_DATA, "I2C_BLOCK_DATA" }), | ||
| 196 | __entry->len, | ||
| 197 | __entry->len, __entry->buf | ||
| 198 | )); | ||
| 199 | |||
| 200 | /* | ||
| 201 | * i2c_smbus_xfer() result | ||
| 202 | */ | ||
| 203 | TRACE_EVENT(smbus_result, | ||
| 204 | TP_PROTO(const struct i2c_adapter *adap, | ||
| 205 | u16 addr, unsigned short flags, | ||
| 206 | char read_write, u8 command, int protocol, | ||
| 207 | int res), | ||
| 208 | TP_ARGS(adap, addr, flags, read_write, command, protocol, res), | ||
| 209 | TP_STRUCT__entry( | ||
| 210 | __field(int, adapter_nr ) | ||
| 211 | __field(__u16, addr ) | ||
| 212 | __field(__u16, flags ) | ||
| 213 | __field(__u8, read_write ) | ||
| 214 | __field(__u8, command ) | ||
| 215 | __field(__s16, res ) | ||
| 216 | __field(__u32, protocol ) | ||
| 217 | ), | ||
| 218 | TP_fast_assign( | ||
| 219 | __entry->adapter_nr = adap->nr; | ||
| 220 | __entry->addr = addr; | ||
| 221 | __entry->flags = flags; | ||
| 222 | __entry->read_write = read_write; | ||
| 223 | __entry->command = command; | ||
| 224 | __entry->protocol = protocol; | ||
| 225 | __entry->res = res; | ||
| 226 | ), | ||
| 227 | TP_printk("i2c-%d a=%03x f=%04x c=%x %s %s res=%d", | ||
| 228 | __entry->adapter_nr, | ||
| 229 | __entry->addr, | ||
| 230 | __entry->flags, | ||
| 231 | __entry->command, | ||
| 232 | __print_symbolic(__entry->protocol, | ||
| 233 | { I2C_SMBUS_QUICK, "QUICK" }, | ||
| 234 | { I2C_SMBUS_BYTE, "BYTE" }, | ||
| 235 | { I2C_SMBUS_BYTE_DATA, "BYTE_DATA" }, | ||
| 236 | { I2C_SMBUS_WORD_DATA, "WORD_DATA" }, | ||
| 237 | { I2C_SMBUS_PROC_CALL, "PROC_CALL" }, | ||
| 238 | { I2C_SMBUS_BLOCK_DATA, "BLOCK_DATA" }, | ||
| 239 | { I2C_SMBUS_I2C_BLOCK_BROKEN, "I2C_BLOCK_BROKEN" }, | ||
| 240 | { I2C_SMBUS_BLOCK_PROC_CALL, "BLOCK_PROC_CALL" }, | ||
| 241 | { I2C_SMBUS_I2C_BLOCK_DATA, "I2C_BLOCK_DATA" }), | ||
| 242 | __entry->read_write == I2C_SMBUS_WRITE ? "wr" : "rd", | ||
| 243 | __entry->res | ||
| 244 | )); | ||
| 245 | |||
| 246 | #endif /* _TRACE_SMBUS_H */ | ||
| 247 | |||
| 248 | /* This part must be outside protection */ | ||
| 249 | #include <trace/define_trace.h> | ||
