aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-04-09 11:45:40 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-04-09 11:45:40 -0400
commit39de65aa2c3eee901db020a4f1396998e09602a3 (patch)
tree0582450ec0b5b6b9778275b431207145d5fedfc8 /include
parent97e18dc007546fce8e99098480b921a02ebb3037 (diff)
parent1fbeab0b8fd5e655ffef8a793b869eb7dffe0337 (diff)
Merge branch 'i2c/for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux
Pull i2c updates from Wolfram Sang: "Here is the pull request from the i2c subsystem. It got a little delayed because I needed to wait for a dependency to be included (commit b424080a9e08: "reset: Add optional resets and stubs"). Plus, I had some email problems. All done now, the highlights are: - drivers can now deprecate their use of i2c classes. That shouldn't be used on embedded platforms anyhow and was often blindly copy&pasted. This mechanism gives users time to switch away and ultimately boot faster once the use of classes for those drivers is gone for good. - new drivers for QUP, Cadence, efm32 - tracepoint support for I2C and SMBus - bigger cleanups for the mv64xxx, nomadik, and designware drivers And the usual bugfixes, cleanups, feature additions. Most stuff has been in linux-next for a while. Just some hot fixes and new drivers were added a bit more recently." * 'i2c/for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (63 commits) i2c: cadence: fix Kconfig dependency i2c: Add driver for Cadence I2C controller i2c: cadence: Document device tree bindings Documentation: i2c: improve section about flags mangling the protocol i2c: qup: use proper type fro clk_freq i2c: qup: off by ones in qup_i2c_probe() i2c: efm32: fix binding doc MAINTAINERS: update I2C web resources i2c: qup: New bus driver for the Qualcomm QUP I2C controller i2c: qup: Add device tree bindings information i2c: i2c-xiic: deprecate class based instantiation i2c: i2c-sirf: deprecate class based instantiation i2c: i2c-mv64xxx: deprecate class based instantiation i2c: i2c-designware-platdrv: deprecate class based instantiation i2c: i2c-davinci: deprecate class based instantiation i2c: i2c-bcm2835: deprecate class based instantiation i2c: mv64xxx: Fix reset controller handling i2c: omap: fix usage of IS_ERR_VALUE with pm_runtime_get_sync i2c: efm32: new bus driver i2c: exynos5: remove unnecessary cast of void pointer ...
Diffstat (limited to 'include')
-rw-r--r--include/linux/i2c.h1
-rw-r--r--include/linux/i2c/bfin_twi.h145
-rw-r--r--include/linux/platform_data/i2c-s3c2410.h9
-rw-r--r--include/trace/events/i2c.h372
4 files changed, 522 insertions, 5 deletions
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index deddeb8c337c..b556e0ab946f 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -487,6 +487,7 @@ void i2c_unlock_adapter(struct i2c_adapter *);
487#define I2C_CLASS_HWMON (1<<0) /* lm_sensors, ... */ 487#define I2C_CLASS_HWMON (1<<0) /* lm_sensors, ... */
488#define I2C_CLASS_DDC (1<<3) /* DDC bus on graphics adapters */ 488#define I2C_CLASS_DDC (1<<3) /* DDC bus on graphics adapters */
489#define I2C_CLASS_SPD (1<<7) /* Memory modules */ 489#define I2C_CLASS_SPD (1<<7) /* Memory modules */
490#define I2C_CLASS_DEPRECATED (1<<8) /* Warn users that adapter will stop using classes */
490 491
491/* Internal numbers to terminate lists */ 492/* Internal numbers to terminate lists */
492#define I2C_CLIENT_END 0xfffeU 493#define I2C_CLIENT_END 0xfffeU
diff --git a/include/linux/i2c/bfin_twi.h b/include/linux/i2c/bfin_twi.h
new file mode 100644
index 000000000000..135a4e0876ae
--- /dev/null
+++ b/include/linux/i2c/bfin_twi.h
@@ -0,0 +1,145 @@
1/*
2 * i2c-bfin-twi.h - interface to ADI TWI controller
3 *
4 * Copyright 2005-2014 Analog Devices Inc.
5 *
6 * Licensed under the GPL-2 or later.
7 */
8
9#ifndef __I2C_BFIN_TWI_H__
10#define __I2C_BFIN_TWI_H__
11
12#include <linux/types.h>
13#include <linux/i2c.h>
14
15/*
16 * ADI twi registers layout
17 */
18struct bfin_twi_regs {
19 u16 clkdiv;
20 u16 dummy1;
21 u16 control;
22 u16 dummy2;
23 u16 slave_ctl;
24 u16 dummy3;
25 u16 slave_stat;
26 u16 dummy4;
27 u16 slave_addr;
28 u16 dummy5;
29 u16 master_ctl;
30 u16 dummy6;
31 u16 master_stat;
32 u16 dummy7;
33 u16 master_addr;
34 u16 dummy8;
35 u16 int_stat;
36 u16 dummy9;
37 u16 int_mask;
38 u16 dummy10;
39 u16 fifo_ctl;
40 u16 dummy11;
41 u16 fifo_stat;
42 u16 dummy12;
43 u32 __pad[20];
44 u16 xmt_data8;
45 u16 dummy13;
46 u16 xmt_data16;
47 u16 dummy14;
48 u16 rcv_data8;
49 u16 dummy15;
50 u16 rcv_data16;
51 u16 dummy16;
52};
53
54struct bfin_twi_iface {
55 int irq;
56 spinlock_t lock;
57 char read_write;
58 u8 command;
59 u8 *transPtr;
60 int readNum;
61 int writeNum;
62 int cur_mode;
63 int manual_stop;
64 int result;
65 struct i2c_adapter adap;
66 struct completion complete;
67 struct i2c_msg *pmsg;
68 int msg_num;
69 int cur_msg;
70 u16 saved_clkdiv;
71 u16 saved_control;
72 struct bfin_twi_regs __iomem *regs_base;
73};
74
75/* ******************** TWO-WIRE INTERFACE (TWI) MASKS ********************/
76/* TWI_CLKDIV Macros (Use: *pTWI_CLKDIV = CLKLOW(x)|CLKHI(y); ) */
77#define CLKLOW(x) ((x) & 0xFF) /* Periods Clock Is Held Low */
78#define CLKHI(y) (((y)&0xFF)<<0x8) /* Periods Before New Clock Low */
79
80/* TWI_PRESCALE Masks */
81#define PRESCALE 0x007F /* SCLKs Per Internal Time Reference (10MHz) */
82#define TWI_ENA 0x0080 /* TWI Enable */
83#define SCCB 0x0200 /* SCCB Compatibility Enable */
84
85/* TWI_SLAVE_CTL Masks */
86#define SEN 0x0001 /* Slave Enable */
87#define SADD_LEN 0x0002 /* Slave Address Length */
88#define STDVAL 0x0004 /* Slave Transmit Data Valid */
89#define NAK 0x0008 /* NAK Generated At Conclusion Of Transfer */
90#define GEN 0x0010 /* General Call Address Matching Enabled */
91
92/* TWI_SLAVE_STAT Masks */
93#define SDIR 0x0001 /* Slave Transfer Direction (RX/TX*) */
94#define GCALL 0x0002 /* General Call Indicator */
95
96/* TWI_MASTER_CTL Masks */
97#define MEN 0x0001 /* Master Mode Enable */
98#define MADD_LEN 0x0002 /* Master Address Length */
99#define MDIR 0x0004 /* Master Transmit Direction (RX/TX*) */
100#define FAST 0x0008 /* Use Fast Mode Timing Specs */
101#define STOP 0x0010 /* Issue Stop Condition */
102#define RSTART 0x0020 /* Repeat Start or Stop* At End Of Transfer */
103#define DCNT 0x3FC0 /* Data Bytes To Transfer */
104#define SDAOVR 0x4000 /* Serial Data Override */
105#define SCLOVR 0x8000 /* Serial Clock Override */
106
107/* TWI_MASTER_STAT Masks */
108#define MPROG 0x0001 /* Master Transfer In Progress */
109#define LOSTARB 0x0002 /* Lost Arbitration Indicator (Xfer Aborted) */
110#define ANAK 0x0004 /* Address Not Acknowledged */
111#define DNAK 0x0008 /* Data Not Acknowledged */
112#define BUFRDERR 0x0010 /* Buffer Read Error */
113#define BUFWRERR 0x0020 /* Buffer Write Error */
114#define SDASEN 0x0040 /* Serial Data Sense */
115#define SCLSEN 0x0080 /* Serial Clock Sense */
116#define BUSBUSY 0x0100 /* Bus Busy Indicator */
117
118/* TWI_INT_SRC and TWI_INT_ENABLE Masks */
119#define SINIT 0x0001 /* Slave Transfer Initiated */
120#define SCOMP 0x0002 /* Slave Transfer Complete */
121#define SERR 0x0004 /* Slave Transfer Error */
122#define SOVF 0x0008 /* Slave Overflow */
123#define MCOMP 0x0010 /* Master Transfer Complete */
124#define MERR 0x0020 /* Master Transfer Error */
125#define XMTSERV 0x0040 /* Transmit FIFO Service */
126#define RCVSERV 0x0080 /* Receive FIFO Service */
127
128/* TWI_FIFO_CTRL Masks */
129#define XMTFLUSH 0x0001 /* Transmit Buffer Flush */
130#define RCVFLUSH 0x0002 /* Receive Buffer Flush */
131#define XMTINTLEN 0x0004 /* Transmit Buffer Interrupt Length */
132#define RCVINTLEN 0x0008 /* Receive Buffer Interrupt Length */
133
134/* TWI_FIFO_STAT Masks */
135#define XMTSTAT 0x0003 /* Transmit FIFO Status */
136#define XMT_EMPTY 0x0000 /* Transmit FIFO Empty */
137#define XMT_HALF 0x0001 /* Transmit FIFO Has 1 Byte To Write */
138#define XMT_FULL 0x0003 /* Transmit FIFO Full (2 Bytes To Write) */
139
140#define RCVSTAT 0x000C /* Receive FIFO Status */
141#define RCV_EMPTY 0x0000 /* Receive FIFO Empty */
142#define RCV_HALF 0x0004 /* Receive FIFO Has 1 Byte To Read */
143#define RCV_FULL 0x000C /* Receive FIFO Full (2 Bytes To Read) */
144
145#endif
diff --git a/include/linux/platform_data/i2c-s3c2410.h b/include/linux/platform_data/i2c-s3c2410.h
index 2a50048c1c44..05af66b840b9 100644
--- a/include/linux/platform_data/i2c-s3c2410.h
+++ b/include/linux/platform_data/i2c-s3c2410.h
@@ -1,5 +1,4 @@
1/* arch/arm/plat-s3c/include/plat/iic.h 1/*
2 *
3 * Copyright 2004-2009 Simtec Electronics 2 * Copyright 2004-2009 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk> 3 * Ben Dooks <ben@simtec.co.uk>
5 * 4 *
@@ -10,8 +9,8 @@
10 * published by the Free Software Foundation. 9 * published by the Free Software Foundation.
11*/ 10*/
12 11
13#ifndef __ASM_ARCH_IIC_H 12#ifndef __I2C_S3C2410_H
14#define __ASM_ARCH_IIC_H __FILE__ 13#define __I2C_S3C2410_H __FILE__
15 14
16#define S3C_IICFLG_FILTER (1<<0) /* enable s3c2440 filter */ 15#define S3C_IICFLG_FILTER (1<<0) /* enable s3c2440 filter */
17 16
@@ -76,4 +75,4 @@ extern void s3c_i2c7_cfg_gpio(struct platform_device *dev);
76 75
77extern struct s3c2410_platform_i2c default_i2c_data; 76extern struct s3c2410_platform_i2c default_i2c_data;
78 77
79#endif /* __ASM_ARCH_IIC_H */ 78#endif /* __I2C_S3C2410_H */
diff --git a/include/trace/events/i2c.h b/include/trace/events/i2c.h
new file mode 100644
index 000000000000..fe17187df65d
--- /dev/null
+++ b/include/trace/events/i2c.h
@@ -0,0 +1,372 @@
1/* I2C and 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 i2c
13
14#if !defined(_TRACE_I2C_H) || defined(TRACE_HEADER_MULTI_READ)
15#define _TRACE_I2C_H
16
17#include <linux/i2c.h>
18#include <linux/tracepoint.h>
19
20/*
21 * drivers/i2c/i2c-core.c
22 */
23extern void i2c_transfer_trace_reg(void);
24extern void i2c_transfer_trace_unreg(void);
25
26/*
27 * __i2c_transfer() write request
28 */
29TRACE_EVENT_FN(i2c_write,
30 TP_PROTO(const struct i2c_adapter *adap, const struct i2c_msg *msg,
31 int num),
32 TP_ARGS(adap, msg, num),
33 TP_STRUCT__entry(
34 __field(int, adapter_nr )
35 __field(__u16, msg_nr )
36 __field(__u16, addr )
37 __field(__u16, flags )
38 __field(__u16, len )
39 __dynamic_array(__u8, buf, msg->len) ),
40 TP_fast_assign(
41 __entry->adapter_nr = adap->nr;
42 __entry->msg_nr = num;
43 __entry->addr = msg->addr;
44 __entry->flags = msg->flags;
45 __entry->len = msg->len;
46 memcpy(__get_dynamic_array(buf), msg->buf, msg->len);
47 ),
48 TP_printk("i2c-%d #%u a=%03x f=%04x l=%u [%*phD]",
49 __entry->adapter_nr,
50 __entry->msg_nr,
51 __entry->addr,
52 __entry->flags,
53 __entry->len,
54 __entry->len, __get_dynamic_array(buf)
55 ),
56 i2c_transfer_trace_reg,
57 i2c_transfer_trace_unreg);
58
59/*
60 * __i2c_transfer() read request
61 */
62TRACE_EVENT_FN(i2c_read,
63 TP_PROTO(const struct i2c_adapter *adap, const struct i2c_msg *msg,
64 int num),
65 TP_ARGS(adap, msg, num),
66 TP_STRUCT__entry(
67 __field(int, adapter_nr )
68 __field(__u16, msg_nr )
69 __field(__u16, addr )
70 __field(__u16, flags )
71 __field(__u16, len )
72 ),
73 TP_fast_assign(
74 __entry->adapter_nr = adap->nr;
75 __entry->msg_nr = num;
76 __entry->addr = msg->addr;
77 __entry->flags = msg->flags;
78 __entry->len = msg->len;
79 ),
80 TP_printk("i2c-%d #%u a=%03x f=%04x l=%u",
81 __entry->adapter_nr,
82 __entry->msg_nr,
83 __entry->addr,
84 __entry->flags,
85 __entry->len
86 ),
87 i2c_transfer_trace_reg,
88 i2c_transfer_trace_unreg);
89
90/*
91 * __i2c_transfer() read reply
92 */
93TRACE_EVENT_FN(i2c_reply,
94 TP_PROTO(const struct i2c_adapter *adap, const struct i2c_msg *msg,
95 int num),
96 TP_ARGS(adap, msg, num),
97 TP_STRUCT__entry(
98 __field(int, adapter_nr )
99 __field(__u16, msg_nr )
100 __field(__u16, addr )
101 __field(__u16, flags )
102 __field(__u16, len )
103 __dynamic_array(__u8, buf, msg->len) ),
104 TP_fast_assign(
105 __entry->adapter_nr = adap->nr;
106 __entry->msg_nr = num;
107 __entry->addr = msg->addr;
108 __entry->flags = msg->flags;
109 __entry->len = msg->len;
110 memcpy(__get_dynamic_array(buf), msg->buf, msg->len);
111 ),
112 TP_printk("i2c-%d #%u a=%03x f=%04x l=%u [%*phD]",
113 __entry->adapter_nr,
114 __entry->msg_nr,
115 __entry->addr,
116 __entry->flags,
117 __entry->len,
118 __entry->len, __get_dynamic_array(buf)
119 ),
120 i2c_transfer_trace_reg,
121 i2c_transfer_trace_unreg);
122
123/*
124 * __i2c_transfer() result
125 */
126TRACE_EVENT_FN(i2c_result,
127 TP_PROTO(const struct i2c_adapter *adap, int num, int ret),
128 TP_ARGS(adap, num, ret),
129 TP_STRUCT__entry(
130 __field(int, adapter_nr )
131 __field(__u16, nr_msgs )
132 __field(__s16, ret )
133 ),
134 TP_fast_assign(
135 __entry->adapter_nr = adap->nr;
136 __entry->nr_msgs = num;
137 __entry->ret = ret;
138 ),
139 TP_printk("i2c-%d n=%u ret=%d",
140 __entry->adapter_nr,
141 __entry->nr_msgs,
142 __entry->ret
143 ),
144 i2c_transfer_trace_reg,
145 i2c_transfer_trace_unreg);
146
147/*
148 * i2c_smbus_xfer() write data or procedure call request
149 */
150TRACE_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 */
218TRACE_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 */
260TRACE_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 */
326TRACE_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 */
370
371/* This part must be outside protection */
372#include <trace/define_trace.h>