Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
[cris-mirror.git] / drivers / i2c / i2c-core-smbus.c
blob59d5cf376f6af4cdb0b0e8f0e66233b85d4d2d75
1 /*
2 * Linux I2C core SMBus and SMBus emulation code
4 * This file contains the SMBus functions which are always included in the I2C
5 * core because they can be emulated via I2C. SMBus specific extensions
6 * (e.g. smbalert) are handled in a seperate i2c-smbus module.
8 * All SMBus-related things are written by Frodo Looijaard <frodol@dds.nl>
9 * SMBus 2.0 support by Mark Studebaker <mdsxyz123@yahoo.com> and
10 * Jean Delvare <jdelvare@suse.de>
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the Free
14 * Software Foundation; either version 2 of the License, or (at your option)
15 * any later version.
17 #include <linux/device.h>
18 #include <linux/err.h>
19 #include <linux/i2c.h>
20 #include <linux/i2c-smbus.h>
21 #include <linux/slab.h>
23 #define CREATE_TRACE_POINTS
24 #include <trace/events/smbus.h>
27 /* The SMBus parts */
29 #define POLY (0x1070U << 3)
30 static u8 crc8(u16 data)
32 int i;
34 for (i = 0; i < 8; i++) {
35 if (data & 0x8000)
36 data = data ^ POLY;
37 data = data << 1;
39 return (u8)(data >> 8);
42 /* Incremental CRC8 over count bytes in the array pointed to by p */
43 static u8 i2c_smbus_pec(u8 crc, u8 *p, size_t count)
45 int i;
47 for (i = 0; i < count; i++)
48 crc = crc8((crc ^ p[i]) << 8);
49 return crc;
52 /* Assume a 7-bit address, which is reasonable for SMBus */
53 static u8 i2c_smbus_msg_pec(u8 pec, struct i2c_msg *msg)
55 /* The address will be sent first */
56 u8 addr = i2c_8bit_addr_from_msg(msg);
57 pec = i2c_smbus_pec(pec, &addr, 1);
59 /* The data buffer follows */
60 return i2c_smbus_pec(pec, msg->buf, msg->len);
63 /* Used for write only transactions */
64 static inline void i2c_smbus_add_pec(struct i2c_msg *msg)
66 msg->buf[msg->len] = i2c_smbus_msg_pec(0, msg);
67 msg->len++;
70 /* Return <0 on CRC error
71 If there was a write before this read (most cases) we need to take the
72 partial CRC from the write part into account.
73 Note that this function does modify the message (we need to decrease the
74 message length to hide the CRC byte from the caller). */
75 static int i2c_smbus_check_pec(u8 cpec, struct i2c_msg *msg)
77 u8 rpec = msg->buf[--msg->len];
78 cpec = i2c_smbus_msg_pec(cpec, msg);
80 if (rpec != cpec) {
81 pr_debug("Bad PEC 0x%02x vs. 0x%02x\n",
82 rpec, cpec);
83 return -EBADMSG;
85 return 0;
88 /**
89 * i2c_smbus_read_byte - SMBus "receive byte" protocol
90 * @client: Handle to slave device
92 * This executes the SMBus "receive byte" protocol, returning negative errno
93 * else the byte received from the device.
95 s32 i2c_smbus_read_byte(const struct i2c_client *client)
97 union i2c_smbus_data data;
98 int status;
100 status = i2c_smbus_xfer(client->adapter, client->addr, client->flags,
101 I2C_SMBUS_READ, 0,
102 I2C_SMBUS_BYTE, &data);
103 return (status < 0) ? status : data.byte;
105 EXPORT_SYMBOL(i2c_smbus_read_byte);
108 * i2c_smbus_write_byte - SMBus "send byte" protocol
109 * @client: Handle to slave device
110 * @value: Byte to be sent
112 * This executes the SMBus "send byte" protocol, returning negative errno
113 * else zero on success.
115 s32 i2c_smbus_write_byte(const struct i2c_client *client, u8 value)
117 return i2c_smbus_xfer(client->adapter, client->addr, client->flags,
118 I2C_SMBUS_WRITE, value, I2C_SMBUS_BYTE, NULL);
120 EXPORT_SYMBOL(i2c_smbus_write_byte);
123 * i2c_smbus_read_byte_data - SMBus "read byte" protocol
124 * @client: Handle to slave device
125 * @command: Byte interpreted by slave
127 * This executes the SMBus "read byte" protocol, returning negative errno
128 * else a data byte received from the device.
130 s32 i2c_smbus_read_byte_data(const struct i2c_client *client, u8 command)
132 union i2c_smbus_data data;
133 int status;
135 status = i2c_smbus_xfer(client->adapter, client->addr, client->flags,
136 I2C_SMBUS_READ, command,
137 I2C_SMBUS_BYTE_DATA, &data);
138 return (status < 0) ? status : data.byte;
140 EXPORT_SYMBOL(i2c_smbus_read_byte_data);
143 * i2c_smbus_write_byte_data - SMBus "write byte" protocol
144 * @client: Handle to slave device
145 * @command: Byte interpreted by slave
146 * @value: Byte being written
148 * This executes the SMBus "write byte" protocol, returning negative errno
149 * else zero on success.
151 s32 i2c_smbus_write_byte_data(const struct i2c_client *client, u8 command,
152 u8 value)
154 union i2c_smbus_data data;
155 data.byte = value;
156 return i2c_smbus_xfer(client->adapter, client->addr, client->flags,
157 I2C_SMBUS_WRITE, command,
158 I2C_SMBUS_BYTE_DATA, &data);
160 EXPORT_SYMBOL(i2c_smbus_write_byte_data);
163 * i2c_smbus_read_word_data - SMBus "read word" protocol
164 * @client: Handle to slave device
165 * @command: Byte interpreted by slave
167 * This executes the SMBus "read word" protocol, returning negative errno
168 * else a 16-bit unsigned "word" received from the device.
170 s32 i2c_smbus_read_word_data(const struct i2c_client *client, u8 command)
172 union i2c_smbus_data data;
173 int status;
175 status = i2c_smbus_xfer(client->adapter, client->addr, client->flags,
176 I2C_SMBUS_READ, command,
177 I2C_SMBUS_WORD_DATA, &data);
178 return (status < 0) ? status : data.word;
180 EXPORT_SYMBOL(i2c_smbus_read_word_data);
183 * i2c_smbus_write_word_data - SMBus "write word" protocol
184 * @client: Handle to slave device
185 * @command: Byte interpreted by slave
186 * @value: 16-bit "word" being written
188 * This executes the SMBus "write word" protocol, returning negative errno
189 * else zero on success.
191 s32 i2c_smbus_write_word_data(const struct i2c_client *client, u8 command,
192 u16 value)
194 union i2c_smbus_data data;
195 data.word = value;
196 return i2c_smbus_xfer(client->adapter, client->addr, client->flags,
197 I2C_SMBUS_WRITE, command,
198 I2C_SMBUS_WORD_DATA, &data);
200 EXPORT_SYMBOL(i2c_smbus_write_word_data);
203 * i2c_smbus_read_block_data - SMBus "block read" protocol
204 * @client: Handle to slave device
205 * @command: Byte interpreted by slave
206 * @values: Byte array into which data will be read; big enough to hold
207 * the data returned by the slave. SMBus allows at most 32 bytes.
209 * This executes the SMBus "block read" protocol, returning negative errno
210 * else the number of data bytes in the slave's response.
212 * Note that using this function requires that the client's adapter support
213 * the I2C_FUNC_SMBUS_READ_BLOCK_DATA functionality. Not all adapter drivers
214 * support this; its emulation through I2C messaging relies on a specific
215 * mechanism (I2C_M_RECV_LEN) which may not be implemented.
217 s32 i2c_smbus_read_block_data(const struct i2c_client *client, u8 command,
218 u8 *values)
220 union i2c_smbus_data data;
221 int status;
223 status = i2c_smbus_xfer(client->adapter, client->addr, client->flags,
224 I2C_SMBUS_READ, command,
225 I2C_SMBUS_BLOCK_DATA, &data);
226 if (status)
227 return status;
229 memcpy(values, &data.block[1], data.block[0]);
230 return data.block[0];
232 EXPORT_SYMBOL(i2c_smbus_read_block_data);
235 * i2c_smbus_write_block_data - SMBus "block write" protocol
236 * @client: Handle to slave device
237 * @command: Byte interpreted by slave
238 * @length: Size of data block; SMBus allows at most 32 bytes
239 * @values: Byte array which will be written.
241 * This executes the SMBus "block write" protocol, returning negative errno
242 * else zero on success.
244 s32 i2c_smbus_write_block_data(const struct i2c_client *client, u8 command,
245 u8 length, const u8 *values)
247 union i2c_smbus_data data;
249 if (length > I2C_SMBUS_BLOCK_MAX)
250 length = I2C_SMBUS_BLOCK_MAX;
251 data.block[0] = length;
252 memcpy(&data.block[1], values, length);
253 return i2c_smbus_xfer(client->adapter, client->addr, client->flags,
254 I2C_SMBUS_WRITE, command,
255 I2C_SMBUS_BLOCK_DATA, &data);
257 EXPORT_SYMBOL(i2c_smbus_write_block_data);
259 /* Returns the number of read bytes */
260 s32 i2c_smbus_read_i2c_block_data(const struct i2c_client *client, u8 command,
261 u8 length, u8 *values)
263 union i2c_smbus_data data;
264 int status;
266 if (length > I2C_SMBUS_BLOCK_MAX)
267 length = I2C_SMBUS_BLOCK_MAX;
268 data.block[0] = length;
269 status = i2c_smbus_xfer(client->adapter, client->addr, client->flags,
270 I2C_SMBUS_READ, command,
271 I2C_SMBUS_I2C_BLOCK_DATA, &data);
272 if (status < 0)
273 return status;
275 memcpy(values, &data.block[1], data.block[0]);
276 return data.block[0];
278 EXPORT_SYMBOL(i2c_smbus_read_i2c_block_data);
280 s32 i2c_smbus_write_i2c_block_data(const struct i2c_client *client, u8 command,
281 u8 length, const u8 *values)
283 union i2c_smbus_data data;
285 if (length > I2C_SMBUS_BLOCK_MAX)
286 length = I2C_SMBUS_BLOCK_MAX;
287 data.block[0] = length;
288 memcpy(data.block + 1, values, length);
289 return i2c_smbus_xfer(client->adapter, client->addr, client->flags,
290 I2C_SMBUS_WRITE, command,
291 I2C_SMBUS_I2C_BLOCK_DATA, &data);
293 EXPORT_SYMBOL(i2c_smbus_write_i2c_block_data);
295 static void i2c_smbus_try_get_dmabuf(struct i2c_msg *msg, u8 init_val)
297 bool is_read = msg->flags & I2C_M_RD;
298 unsigned char *dma_buf;
300 dma_buf = kzalloc(I2C_SMBUS_BLOCK_MAX + (is_read ? 2 : 3), GFP_KERNEL);
301 if (!dma_buf)
302 return;
304 msg->buf = dma_buf;
305 msg->flags |= I2C_M_DMA_SAFE;
307 if (init_val)
308 msg->buf[0] = init_val;
311 /* Simulate a SMBus command using the i2c protocol
312 No checking of parameters is done! */
313 static s32 i2c_smbus_xfer_emulated(struct i2c_adapter *adapter, u16 addr,
314 unsigned short flags,
315 char read_write, u8 command, int size,
316 union i2c_smbus_data *data)
318 /* So we need to generate a series of msgs. In the case of writing, we
319 need to use only one message; when reading, we need two. We initialize
320 most things with sane defaults, to keep the code below somewhat
321 simpler. */
322 unsigned char msgbuf0[I2C_SMBUS_BLOCK_MAX+3];
323 unsigned char msgbuf1[I2C_SMBUS_BLOCK_MAX+2];
324 int num = read_write == I2C_SMBUS_READ ? 2 : 1;
325 int i;
326 u8 partial_pec = 0;
327 int status;
328 struct i2c_msg msg[2] = {
330 .addr = addr,
331 .flags = flags,
332 .len = 1,
333 .buf = msgbuf0,
334 }, {
335 .addr = addr,
336 .flags = flags | I2C_M_RD,
337 .len = 0,
338 .buf = msgbuf1,
342 msgbuf0[0] = command;
343 switch (size) {
344 case I2C_SMBUS_QUICK:
345 msg[0].len = 0;
346 /* Special case: The read/write field is used as data */
347 msg[0].flags = flags | (read_write == I2C_SMBUS_READ ?
348 I2C_M_RD : 0);
349 num = 1;
350 break;
351 case I2C_SMBUS_BYTE:
352 if (read_write == I2C_SMBUS_READ) {
353 /* Special case: only a read! */
354 msg[0].flags = I2C_M_RD | flags;
355 num = 1;
357 break;
358 case I2C_SMBUS_BYTE_DATA:
359 if (read_write == I2C_SMBUS_READ)
360 msg[1].len = 1;
361 else {
362 msg[0].len = 2;
363 msgbuf0[1] = data->byte;
365 break;
366 case I2C_SMBUS_WORD_DATA:
367 if (read_write == I2C_SMBUS_READ)
368 msg[1].len = 2;
369 else {
370 msg[0].len = 3;
371 msgbuf0[1] = data->word & 0xff;
372 msgbuf0[2] = data->word >> 8;
374 break;
375 case I2C_SMBUS_PROC_CALL:
376 num = 2; /* Special case */
377 read_write = I2C_SMBUS_READ;
378 msg[0].len = 3;
379 msg[1].len = 2;
380 msgbuf0[1] = data->word & 0xff;
381 msgbuf0[2] = data->word >> 8;
382 break;
383 case I2C_SMBUS_BLOCK_DATA:
384 if (read_write == I2C_SMBUS_READ) {
385 msg[1].flags |= I2C_M_RECV_LEN;
386 msg[1].len = 1; /* block length will be added by
387 the underlying bus driver */
388 i2c_smbus_try_get_dmabuf(&msg[1], 0);
389 } else {
390 msg[0].len = data->block[0] + 2;
391 if (msg[0].len > I2C_SMBUS_BLOCK_MAX + 2) {
392 dev_err(&adapter->dev,
393 "Invalid block write size %d\n",
394 data->block[0]);
395 return -EINVAL;
398 i2c_smbus_try_get_dmabuf(&msg[0], command);
399 for (i = 1; i < msg[0].len; i++)
400 msg[0].buf[i] = data->block[i - 1];
402 break;
403 case I2C_SMBUS_BLOCK_PROC_CALL:
404 num = 2; /* Another special case */
405 read_write = I2C_SMBUS_READ;
406 if (data->block[0] > I2C_SMBUS_BLOCK_MAX) {
407 dev_err(&adapter->dev,
408 "Invalid block write size %d\n",
409 data->block[0]);
410 return -EINVAL;
413 msg[0].len = data->block[0] + 2;
414 i2c_smbus_try_get_dmabuf(&msg[0], command);
415 for (i = 1; i < msg[0].len; i++)
416 msg[0].buf[i] = data->block[i - 1];
418 msg[1].flags |= I2C_M_RECV_LEN;
419 msg[1].len = 1; /* block length will be added by
420 the underlying bus driver */
421 i2c_smbus_try_get_dmabuf(&msg[1], 0);
422 break;
423 case I2C_SMBUS_I2C_BLOCK_DATA:
424 if (data->block[0] > I2C_SMBUS_BLOCK_MAX) {
425 dev_err(&adapter->dev, "Invalid block %s size %d\n",
426 read_write == I2C_SMBUS_READ ? "read" : "write",
427 data->block[0]);
428 return -EINVAL;
431 if (read_write == I2C_SMBUS_READ) {
432 msg[1].len = data->block[0];
433 i2c_smbus_try_get_dmabuf(&msg[1], 0);
434 } else {
435 msg[0].len = data->block[0] + 1;
437 i2c_smbus_try_get_dmabuf(&msg[0], command);
438 for (i = 1; i <= data->block[0]; i++)
439 msg[0].buf[i] = data->block[i];
441 break;
442 default:
443 dev_err(&adapter->dev, "Unsupported transaction %d\n", size);
444 return -EOPNOTSUPP;
447 i = ((flags & I2C_CLIENT_PEC) && size != I2C_SMBUS_QUICK
448 && size != I2C_SMBUS_I2C_BLOCK_DATA);
449 if (i) {
450 /* Compute PEC if first message is a write */
451 if (!(msg[0].flags & I2C_M_RD)) {
452 if (num == 1) /* Write only */
453 i2c_smbus_add_pec(&msg[0]);
454 else /* Write followed by read */
455 partial_pec = i2c_smbus_msg_pec(0, &msg[0]);
457 /* Ask for PEC if last message is a read */
458 if (msg[num-1].flags & I2C_M_RD)
459 msg[num-1].len++;
462 status = i2c_transfer(adapter, msg, num);
463 if (status < 0)
464 return status;
466 /* Check PEC if last message is a read */
467 if (i && (msg[num-1].flags & I2C_M_RD)) {
468 status = i2c_smbus_check_pec(partial_pec, &msg[num-1]);
469 if (status < 0)
470 return status;
473 if (read_write == I2C_SMBUS_READ)
474 switch (size) {
475 case I2C_SMBUS_BYTE:
476 data->byte = msgbuf0[0];
477 break;
478 case I2C_SMBUS_BYTE_DATA:
479 data->byte = msgbuf1[0];
480 break;
481 case I2C_SMBUS_WORD_DATA:
482 case I2C_SMBUS_PROC_CALL:
483 data->word = msgbuf1[0] | (msgbuf1[1] << 8);
484 break;
485 case I2C_SMBUS_I2C_BLOCK_DATA:
486 for (i = 0; i < data->block[0]; i++)
487 data->block[i + 1] = msg[1].buf[i];
488 break;
489 case I2C_SMBUS_BLOCK_DATA:
490 case I2C_SMBUS_BLOCK_PROC_CALL:
491 for (i = 0; i < msg[1].buf[0] + 1; i++)
492 data->block[i] = msg[1].buf[i];
493 break;
496 if (msg[0].flags & I2C_M_DMA_SAFE)
497 kfree(msg[0].buf);
498 if (msg[1].flags & I2C_M_DMA_SAFE)
499 kfree(msg[1].buf);
501 return 0;
505 * i2c_smbus_xfer - execute SMBus protocol operations
506 * @adapter: Handle to I2C bus
507 * @addr: Address of SMBus slave on that bus
508 * @flags: I2C_CLIENT_* flags (usually zero or I2C_CLIENT_PEC)
509 * @read_write: I2C_SMBUS_READ or I2C_SMBUS_WRITE
510 * @command: Byte interpreted by slave, for protocols which use such bytes
511 * @protocol: SMBus protocol operation to execute, such as I2C_SMBUS_PROC_CALL
512 * @data: Data to be read or written
514 * This executes an SMBus protocol operation, and returns a negative
515 * errno code else zero on success.
517 s32 i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr, unsigned short flags,
518 char read_write, u8 command, int protocol,
519 union i2c_smbus_data *data)
521 unsigned long orig_jiffies;
522 int try;
523 s32 res;
525 /* If enabled, the following two tracepoints are conditional on
526 * read_write and protocol.
528 trace_smbus_write(adapter, addr, flags, read_write,
529 command, protocol, data);
530 trace_smbus_read(adapter, addr, flags, read_write,
531 command, protocol);
533 flags &= I2C_M_TEN | I2C_CLIENT_PEC | I2C_CLIENT_SCCB;
535 if (adapter->algo->smbus_xfer) {
536 i2c_lock_bus(adapter, I2C_LOCK_SEGMENT);
538 /* Retry automatically on arbitration loss */
539 orig_jiffies = jiffies;
540 for (res = 0, try = 0; try <= adapter->retries; try++) {
541 res = adapter->algo->smbus_xfer(adapter, addr, flags,
542 read_write, command,
543 protocol, data);
544 if (res != -EAGAIN)
545 break;
546 if (time_after(jiffies,
547 orig_jiffies + adapter->timeout))
548 break;
550 i2c_unlock_bus(adapter, I2C_LOCK_SEGMENT);
552 if (res != -EOPNOTSUPP || !adapter->algo->master_xfer)
553 goto trace;
555 * Fall back to i2c_smbus_xfer_emulated if the adapter doesn't
556 * implement native support for the SMBus operation.
560 res = i2c_smbus_xfer_emulated(adapter, addr, flags, read_write,
561 command, protocol, data);
563 trace:
564 /* If enabled, the reply tracepoint is conditional on read_write. */
565 trace_smbus_reply(adapter, addr, flags, read_write,
566 command, protocol, data);
567 trace_smbus_result(adapter, addr, flags, read_write,
568 command, protocol, res);
570 return res;
572 EXPORT_SYMBOL(i2c_smbus_xfer);
575 * i2c_smbus_read_i2c_block_data_or_emulated - read block or emulate
576 * @client: Handle to slave device
577 * @command: Byte interpreted by slave
578 * @length: Size of data block; SMBus allows at most I2C_SMBUS_BLOCK_MAX bytes
579 * @values: Byte array into which data will be read; big enough to hold
580 * the data returned by the slave. SMBus allows at most
581 * I2C_SMBUS_BLOCK_MAX bytes.
583 * This executes the SMBus "block read" protocol if supported by the adapter.
584 * If block read is not supported, it emulates it using either word or byte
585 * read protocols depending on availability.
587 * The addresses of the I2C slave device that are accessed with this function
588 * must be mapped to a linear region, so that a block read will have the same
589 * effect as a byte read. Before using this function you must double-check
590 * if the I2C slave does support exchanging a block transfer with a byte
591 * transfer.
593 s32 i2c_smbus_read_i2c_block_data_or_emulated(const struct i2c_client *client,
594 u8 command, u8 length, u8 *values)
596 u8 i = 0;
597 int status;
599 if (length > I2C_SMBUS_BLOCK_MAX)
600 length = I2C_SMBUS_BLOCK_MAX;
602 if (i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_READ_I2C_BLOCK))
603 return i2c_smbus_read_i2c_block_data(client, command, length, values);
605 if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_READ_BYTE_DATA))
606 return -EOPNOTSUPP;
608 if (i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_READ_WORD_DATA)) {
609 while ((i + 2) <= length) {
610 status = i2c_smbus_read_word_data(client, command + i);
611 if (status < 0)
612 return status;
613 values[i] = status & 0xff;
614 values[i + 1] = status >> 8;
615 i += 2;
619 while (i < length) {
620 status = i2c_smbus_read_byte_data(client, command + i);
621 if (status < 0)
622 return status;
623 values[i] = status;
624 i++;
627 return i;
629 EXPORT_SYMBOL(i2c_smbus_read_i2c_block_data_or_emulated);
632 * i2c_setup_smbus_alert - Setup SMBus alert support
633 * @adapter: the target adapter
634 * @setup: setup data for the SMBus alert handler
635 * Context: can sleep
637 * Setup handling of the SMBus alert protocol on a given I2C bus segment.
639 * Handling can be done either through our IRQ handler, or by the
640 * adapter (from its handler, periodic polling, or whatever).
642 * NOTE that if we manage the IRQ, we *MUST* know if it's level or
643 * edge triggered in order to hand it to the workqueue correctly.
644 * If triggering the alert seems to wedge the system, you probably
645 * should have said it's level triggered.
647 * This returns the ara client, which should be saved for later use with
648 * i2c_handle_smbus_alert() and ultimately i2c_unregister_device(); or NULL
649 * to indicate an error.
651 struct i2c_client *i2c_setup_smbus_alert(struct i2c_adapter *adapter,
652 struct i2c_smbus_alert_setup *setup)
654 struct i2c_board_info ara_board_info = {
655 I2C_BOARD_INFO("smbus_alert", 0x0c),
656 .platform_data = setup,
659 return i2c_new_device(adapter, &ara_board_info);
661 EXPORT_SYMBOL_GPL(i2c_setup_smbus_alert);
663 #if IS_ENABLED(CONFIG_I2C_SMBUS) && IS_ENABLED(CONFIG_OF)
664 int of_i2c_setup_smbus_alert(struct i2c_adapter *adapter)
666 struct i2c_client *client;
667 int irq;
669 irq = of_property_match_string(adapter->dev.of_node, "interrupt-names",
670 "smbus_alert");
671 if (irq == -EINVAL || irq == -ENODATA)
672 return 0;
673 else if (irq < 0)
674 return irq;
676 client = i2c_setup_smbus_alert(adapter, NULL);
677 if (!client)
678 return -ENODEV;
680 return 0;
682 EXPORT_SYMBOL_GPL(of_i2c_setup_smbus_alert);
683 #endif