1
2
3
4
5
6
7
8
9
10#ifndef _LINUX_I2C_H
11#define _LINUX_I2C_H
12
13#include <linux/acpi.h>
14#include <linux/mod_devicetable.h>
15#include <linux/device.h>
16#include <linux/sched.h>
17#include <linux/mutex.h>
18#include <linux/rtmutex.h>
19#include <linux/irqdomain.h>
20#include <linux/of.h>
21#include <linux/swab.h>
22#include <uapi/linux/i2c.h>
23
24extern struct bus_type i2c_bus_type;
25extern struct device_type i2c_adapter_type;
26extern struct device_type i2c_client_type;
27
28
29
30struct i2c_msg;
31struct i2c_algorithm;
32struct i2c_adapter;
33struct i2c_client;
34struct i2c_driver;
35struct i2c_device_identity;
36union i2c_smbus_data;
37struct i2c_board_info;
38enum i2c_slave_event;
39typedef int (*i2c_slave_cb_t)(struct i2c_client *client,
40 enum i2c_slave_event event, u8 *val);
41
42
43#define I2C_MAX_STANDARD_MODE_FREQ 100000
44#define I2C_MAX_FAST_MODE_FREQ 400000
45#define I2C_MAX_FAST_MODE_PLUS_FREQ 1000000
46#define I2C_MAX_TURBO_MODE_FREQ 1400000
47#define I2C_MAX_HIGH_SPEED_MODE_FREQ 3400000
48#define I2C_MAX_ULTRA_FAST_MODE_FREQ 5000000
49
50struct module;
51struct property_entry;
52
53#if IS_ENABLED(CONFIG_I2C)
54
55
56
57
58
59
60
61int i2c_transfer_buffer_flags(const struct i2c_client *client,
62 char *buf, int count, u16 flags);
63
64
65
66
67
68
69
70
71
72static inline int i2c_master_recv(const struct i2c_client *client,
73 char *buf, int count)
74{
75 return i2c_transfer_buffer_flags(client, buf, count, I2C_M_RD);
76};
77
78
79
80
81
82
83
84
85
86
87static inline int i2c_master_recv_dmasafe(const struct i2c_client *client,
88 char *buf, int count)
89{
90 return i2c_transfer_buffer_flags(client, buf, count,
91 I2C_M_RD | I2C_M_DMA_SAFE);
92};
93
94
95
96
97
98
99
100
101
102static inline int i2c_master_send(const struct i2c_client *client,
103 const char *buf, int count)
104{
105 return i2c_transfer_buffer_flags(client, (char *)buf, count, 0);
106};
107
108
109
110
111
112
113
114
115
116
117static inline int i2c_master_send_dmasafe(const struct i2c_client *client,
118 const char *buf, int count)
119{
120 return i2c_transfer_buffer_flags(client, (char *)buf, count,
121 I2C_M_DMA_SAFE);
122};
123
124
125
126int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num);
127
128int __i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num);
129
130
131
132
133
134
135s32 i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr,
136 unsigned short flags, char read_write, u8 command,
137 int protocol, union i2c_smbus_data *data);
138
139
140s32 __i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr,
141 unsigned short flags, char read_write, u8 command,
142 int protocol, union i2c_smbus_data *data);
143
144
145
146
147s32 i2c_smbus_read_byte(const struct i2c_client *client);
148s32 i2c_smbus_write_byte(const struct i2c_client *client, u8 value);
149s32 i2c_smbus_read_byte_data(const struct i2c_client *client, u8 command);
150s32 i2c_smbus_write_byte_data(const struct i2c_client *client,
151 u8 command, u8 value);
152s32 i2c_smbus_read_word_data(const struct i2c_client *client, u8 command);
153s32 i2c_smbus_write_word_data(const struct i2c_client *client,
154 u8 command, u16 value);
155
156static inline s32
157i2c_smbus_read_word_swapped(const struct i2c_client *client, u8 command)
158{
159 s32 value = i2c_smbus_read_word_data(client, command);
160
161 return (value < 0) ? value : swab16(value);
162}
163
164static inline s32
165i2c_smbus_write_word_swapped(const struct i2c_client *client,
166 u8 command, u16 value)
167{
168 return i2c_smbus_write_word_data(client, command, swab16(value));
169}
170
171
172s32 i2c_smbus_read_block_data(const struct i2c_client *client,
173 u8 command, u8 *values);
174s32 i2c_smbus_write_block_data(const struct i2c_client *client,
175 u8 command, u8 length, const u8 *values);
176
177s32 i2c_smbus_read_i2c_block_data(const struct i2c_client *client,
178 u8 command, u8 length, u8 *values);
179s32 i2c_smbus_write_i2c_block_data(const struct i2c_client *client,
180 u8 command, u8 length, const u8 *values);
181s32 i2c_smbus_read_i2c_block_data_or_emulated(const struct i2c_client *client,
182 u8 command, u8 length,
183 u8 *values);
184int i2c_get_device_id(const struct i2c_client *client,
185 struct i2c_device_identity *id);
186#endif
187
188
189
190
191
192
193
194struct i2c_device_identity {
195 u16 manufacturer_id;
196#define I2C_DEVICE_ID_NXP_SEMICONDUCTORS 0
197#define I2C_DEVICE_ID_NXP_SEMICONDUCTORS_1 1
198#define I2C_DEVICE_ID_NXP_SEMICONDUCTORS_2 2
199#define I2C_DEVICE_ID_NXP_SEMICONDUCTORS_3 3
200#define I2C_DEVICE_ID_RAMTRON_INTERNATIONAL 4
201#define I2C_DEVICE_ID_ANALOG_DEVICES 5
202#define I2C_DEVICE_ID_STMICROELECTRONICS 6
203#define I2C_DEVICE_ID_ON_SEMICONDUCTOR 7
204#define I2C_DEVICE_ID_SPRINTEK_CORPORATION 8
205#define I2C_DEVICE_ID_ESPROS_PHOTONICS_AG 9
206#define I2C_DEVICE_ID_FUJITSU_SEMICONDUCTOR 10
207#define I2C_DEVICE_ID_FLIR 11
208#define I2C_DEVICE_ID_O2MICRO 12
209#define I2C_DEVICE_ID_ATMEL 13
210#define I2C_DEVICE_ID_NONE 0xffff
211 u16 part_id;
212 u8 die_revision;
213};
214
215enum i2c_alert_protocol {
216 I2C_PROTOCOL_SMBUS_ALERT,
217 I2C_PROTOCOL_SMBUS_HOST_NOTIFY,
218};
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255struct i2c_driver {
256 unsigned int class;
257
258
259 int (*probe)(struct i2c_client *client, const struct i2c_device_id *id);
260 int (*remove)(struct i2c_client *client);
261
262
263
264
265 int (*probe_new)(struct i2c_client *client);
266
267
268 void (*shutdown)(struct i2c_client *client);
269
270
271
272
273
274
275
276
277 void (*alert)(struct i2c_client *client, enum i2c_alert_protocol protocol,
278 unsigned int data);
279
280
281
282
283 int (*command)(struct i2c_client *client, unsigned int cmd, void *arg);
284
285 struct device_driver driver;
286 const struct i2c_device_id *id_table;
287
288
289 int (*detect)(struct i2c_client *client, struct i2c_board_info *info);
290 const unsigned short *address_list;
291 struct list_head clients;
292};
293#define to_i2c_driver(d) container_of(d, struct i2c_driver, driver)
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314struct i2c_client {
315 unsigned short flags;
316#define I2C_CLIENT_PEC 0x04
317#define I2C_CLIENT_TEN 0x10
318
319#define I2C_CLIENT_SLAVE 0x20
320#define I2C_CLIENT_HOST_NOTIFY 0x40
321#define I2C_CLIENT_WAKE 0x80
322#define I2C_CLIENT_SCCB 0x9000
323
324
325 unsigned short addr;
326
327
328 char name[I2C_NAME_SIZE];
329 struct i2c_adapter *adapter;
330 struct device dev;
331 int init_irq;
332 int irq;
333 struct list_head detected;
334#if IS_ENABLED(CONFIG_I2C_SLAVE)
335 i2c_slave_cb_t slave_cb;
336#endif
337};
338#define to_i2c_client(d) container_of(d, struct i2c_client, dev)
339
340struct i2c_client *i2c_verify_client(struct device *dev);
341struct i2c_adapter *i2c_verify_adapter(struct device *dev);
342const struct i2c_device_id *i2c_match_id(const struct i2c_device_id *id,
343 const struct i2c_client *client);
344
345static inline struct i2c_client *kobj_to_i2c_client(struct kobject *kobj)
346{
347 struct device * const dev = kobj_to_dev(kobj);
348 return to_i2c_client(dev);
349}
350
351static inline void *i2c_get_clientdata(const struct i2c_client *client)
352{
353 return dev_get_drvdata(&client->dev);
354}
355
356static inline void i2c_set_clientdata(struct i2c_client *client, void *data)
357{
358 dev_set_drvdata(&client->dev, data);
359}
360
361
362
363#if IS_ENABLED(CONFIG_I2C_SLAVE)
364enum i2c_slave_event {
365 I2C_SLAVE_READ_REQUESTED,
366 I2C_SLAVE_WRITE_REQUESTED,
367 I2C_SLAVE_READ_PROCESSED,
368 I2C_SLAVE_WRITE_RECEIVED,
369 I2C_SLAVE_STOP,
370};
371
372int i2c_slave_register(struct i2c_client *client, i2c_slave_cb_t slave_cb);
373int i2c_slave_unregister(struct i2c_client *client);
374bool i2c_detect_slave_mode(struct device *dev);
375
376static inline int i2c_slave_event(struct i2c_client *client,
377 enum i2c_slave_event event, u8 *val)
378{
379 return client->slave_cb(client, event, val);
380}
381#else
382static inline bool i2c_detect_slave_mode(struct device *dev) { return false; }
383#endif
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410struct i2c_board_info {
411 char type[I2C_NAME_SIZE];
412 unsigned short flags;
413 unsigned short addr;
414 const char *dev_name;
415 void *platform_data;
416 struct device_node *of_node;
417 struct fwnode_handle *fwnode;
418 const struct property_entry *properties;
419 const struct resource *resources;
420 unsigned int num_resources;
421 int irq;
422};
423
424
425
426
427
428
429
430
431
432
433
434#define I2C_BOARD_INFO(dev_type, dev_addr) \
435 .type = dev_type, .addr = (dev_addr)
436
437
438#if IS_ENABLED(CONFIG_I2C)
439
440
441
442
443
444struct i2c_client *
445i2c_new_client_device(struct i2c_adapter *adap, struct i2c_board_info const *info);
446
447
448
449
450
451
452
453struct i2c_client *
454i2c_new_scanned_device(struct i2c_adapter *adap,
455 struct i2c_board_info *info,
456 unsigned short const *addr_list,
457 int (*probe)(struct i2c_adapter *adap, unsigned short addr));
458
459
460int i2c_probe_func_quick_read(struct i2c_adapter *adap, unsigned short addr);
461
462struct i2c_client *
463i2c_new_dummy_device(struct i2c_adapter *adapter, u16 address);
464
465struct i2c_client *
466devm_i2c_new_dummy_device(struct device *dev, struct i2c_adapter *adap, u16 address);
467
468struct i2c_client *
469i2c_new_ancillary_device(struct i2c_client *client,
470 const char *name,
471 u16 default_addr);
472
473void i2c_unregister_device(struct i2c_client *client);
474#endif
475
476
477
478
479
480#ifdef CONFIG_I2C_BOARDINFO
481int
482i2c_register_board_info(int busnum, struct i2c_board_info const *info,
483 unsigned n);
484#else
485static inline int
486i2c_register_board_info(int busnum, struct i2c_board_info const *info,
487 unsigned n)
488{
489 return 0;
490}
491#endif
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519struct i2c_algorithm {
520
521
522
523
524
525
526
527
528
529 int (*master_xfer)(struct i2c_adapter *adap, struct i2c_msg *msgs,
530 int num);
531 int (*master_xfer_atomic)(struct i2c_adapter *adap,
532 struct i2c_msg *msgs, int num);
533 int (*smbus_xfer)(struct i2c_adapter *adap, u16 addr,
534 unsigned short flags, char read_write,
535 u8 command, int size, union i2c_smbus_data *data);
536 int (*smbus_xfer_atomic)(struct i2c_adapter *adap, u16 addr,
537 unsigned short flags, char read_write,
538 u8 command, int size, union i2c_smbus_data *data);
539
540
541 u32 (*functionality)(struct i2c_adapter *adap);
542
543#if IS_ENABLED(CONFIG_I2C_SLAVE)
544 int (*reg_slave)(struct i2c_client *client);
545 int (*unreg_slave)(struct i2c_client *client);
546#endif
547};
548
549
550
551
552
553
554
555
556
557struct i2c_lock_operations {
558 void (*lock_bus)(struct i2c_adapter *adapter, unsigned int flags);
559 int (*trylock_bus)(struct i2c_adapter *adapter, unsigned int flags);
560 void (*unlock_bus)(struct i2c_adapter *adapter, unsigned int flags);
561};
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576struct i2c_timings {
577 u32 bus_freq_hz;
578 u32 scl_rise_ns;
579 u32 scl_fall_ns;
580 u32 scl_int_delay_ns;
581 u32 sda_fall_ns;
582 u32 sda_hold_ns;
583 u32 digital_filter_width_ns;
584 u32 analog_filter_cutoff_freq_hz;
585};
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618struct i2c_bus_recovery_info {
619 int (*recover_bus)(struct i2c_adapter *adap);
620
621 int (*get_scl)(struct i2c_adapter *adap);
622 void (*set_scl)(struct i2c_adapter *adap, int val);
623 int (*get_sda)(struct i2c_adapter *adap);
624 void (*set_sda)(struct i2c_adapter *adap, int val);
625 int (*get_bus_free)(struct i2c_adapter *adap);
626
627 void (*prepare_recovery)(struct i2c_adapter *adap);
628 void (*unprepare_recovery)(struct i2c_adapter *adap);
629
630
631 struct gpio_desc *scl_gpiod;
632 struct gpio_desc *sda_gpiod;
633 struct pinctrl *pinctrl;
634 struct pinctrl_state *pins_default;
635 struct pinctrl_state *pins_gpio;
636};
637
638int i2c_recover_bus(struct i2c_adapter *adap);
639
640
641int i2c_generic_scl_recovery(struct i2c_adapter *adap);
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664struct i2c_adapter_quirks {
665 u64 flags;
666 int max_num_msgs;
667 u16 max_write_len;
668 u16 max_read_len;
669 u16 max_comb_1st_msg_len;
670 u16 max_comb_2nd_msg_len;
671};
672
673
674#define I2C_AQ_COMB BIT(0)
675
676#define I2C_AQ_COMB_WRITE_FIRST BIT(1)
677
678#define I2C_AQ_COMB_READ_SECOND BIT(2)
679
680#define I2C_AQ_COMB_SAME_ADDR BIT(3)
681
682#define I2C_AQ_COMB_WRITE_THEN_READ (I2C_AQ_COMB | I2C_AQ_COMB_WRITE_FIRST | \
683 I2C_AQ_COMB_READ_SECOND | I2C_AQ_COMB_SAME_ADDR)
684
685#define I2C_AQ_NO_CLK_STRETCH BIT(4)
686
687#define I2C_AQ_NO_ZERO_LEN_READ BIT(5)
688#define I2C_AQ_NO_ZERO_LEN_WRITE BIT(6)
689#define I2C_AQ_NO_ZERO_LEN (I2C_AQ_NO_ZERO_LEN_READ | I2C_AQ_NO_ZERO_LEN_WRITE)
690
691
692
693
694
695struct i2c_adapter {
696 struct module *owner;
697 unsigned int class;
698 const struct i2c_algorithm *algo;
699 void *algo_data;
700
701
702 const struct i2c_lock_operations *lock_ops;
703 struct rt_mutex bus_lock;
704 struct rt_mutex mux_lock;
705
706 int timeout;
707 int retries;
708 struct device dev;
709 unsigned long locked_flags;
710#define I2C_ALF_IS_SUSPENDED 0
711#define I2C_ALF_SUSPEND_REPORTED 1
712
713 int nr;
714 char name[48];
715 struct completion dev_released;
716
717 struct mutex userspace_clients_lock;
718 struct list_head userspace_clients;
719
720 struct i2c_bus_recovery_info *bus_recovery_info;
721 const struct i2c_adapter_quirks *quirks;
722
723 struct irq_domain *host_notify_domain;
724};
725#define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev)
726
727static inline void *i2c_get_adapdata(const struct i2c_adapter *adap)
728{
729 return dev_get_drvdata(&adap->dev);
730}
731
732static inline void i2c_set_adapdata(struct i2c_adapter *adap, void *data)
733{
734 dev_set_drvdata(&adap->dev, data);
735}
736
737static inline struct i2c_adapter *
738i2c_parent_is_i2c_adapter(const struct i2c_adapter *adapter)
739{
740#if IS_ENABLED(CONFIG_I2C_MUX)
741 struct device *parent = adapter->dev.parent;
742
743 if (parent != NULL && parent->type == &i2c_adapter_type)
744 return to_i2c_adapter(parent);
745 else
746#endif
747 return NULL;
748}
749
750int i2c_for_each_dev(void *data, int (*fn)(struct device *dev, void *data));
751
752
753#define I2C_LOCK_ROOT_ADAPTER BIT(0)
754#define I2C_LOCK_SEGMENT BIT(1)
755
756
757
758
759
760
761
762static inline void
763i2c_lock_bus(struct i2c_adapter *adapter, unsigned int flags)
764{
765 adapter->lock_ops->lock_bus(adapter, flags);
766}
767
768
769
770
771
772
773
774
775
776static inline int
777i2c_trylock_bus(struct i2c_adapter *adapter, unsigned int flags)
778{
779 return adapter->lock_ops->trylock_bus(adapter, flags);
780}
781
782
783
784
785
786
787
788static inline void
789i2c_unlock_bus(struct i2c_adapter *adapter, unsigned int flags)
790{
791 adapter->lock_ops->unlock_bus(adapter, flags);
792}
793
794
795
796
797
798
799
800
801
802
803
804static inline void i2c_mark_adapter_suspended(struct i2c_adapter *adap)
805{
806 i2c_lock_bus(adap, I2C_LOCK_ROOT_ADAPTER);
807 set_bit(I2C_ALF_IS_SUSPENDED, &adap->locked_flags);
808 i2c_unlock_bus(adap, I2C_LOCK_ROOT_ADAPTER);
809}
810
811
812
813
814
815
816
817
818
819static inline void i2c_mark_adapter_resumed(struct i2c_adapter *adap)
820{
821 i2c_lock_bus(adap, I2C_LOCK_ROOT_ADAPTER);
822 clear_bit(I2C_ALF_IS_SUSPENDED, &adap->locked_flags);
823 i2c_unlock_bus(adap, I2C_LOCK_ROOT_ADAPTER);
824}
825
826
827#define I2C_CLASS_HWMON (1<<0)
828#define I2C_CLASS_DDC (1<<3)
829#define I2C_CLASS_SPD (1<<7)
830
831#define I2C_CLASS_DEPRECATED (1<<8)
832
833
834#define I2C_CLIENT_END 0xfffeU
835
836
837#define I2C_ADDRS(addr, addrs...) \
838 ((const unsigned short []){ addr, ## addrs, I2C_CLIENT_END })
839
840
841
842
843
844
845#if IS_ENABLED(CONFIG_I2C)
846int i2c_add_adapter(struct i2c_adapter *adap);
847void i2c_del_adapter(struct i2c_adapter *adap);
848int i2c_add_numbered_adapter(struct i2c_adapter *adap);
849
850int i2c_register_driver(struct module *owner, struct i2c_driver *driver);
851void i2c_del_driver(struct i2c_driver *driver);
852
853
854#define i2c_add_driver(driver) \
855 i2c_register_driver(THIS_MODULE, driver)
856
857static inline bool i2c_client_has_driver(struct i2c_client *client)
858{
859 return !IS_ERR_OR_NULL(client) && client->dev.driver;
860}
861
862
863
864void i2c_clients_command(struct i2c_adapter *adap,
865 unsigned int cmd, void *arg);
866
867struct i2c_adapter *i2c_get_adapter(int nr);
868void i2c_put_adapter(struct i2c_adapter *adap);
869unsigned int i2c_adapter_depth(struct i2c_adapter *adapter);
870
871void i2c_parse_fw_timings(struct device *dev, struct i2c_timings *t, bool use_defaults);
872
873
874static inline u32 i2c_get_functionality(struct i2c_adapter *adap)
875{
876 return adap->algo->functionality(adap);
877}
878
879
880static inline int i2c_check_functionality(struct i2c_adapter *adap, u32 func)
881{
882 return (func & i2c_get_functionality(adap)) == func;
883}
884
885
886
887
888
889
890
891
892static inline bool i2c_check_quirks(struct i2c_adapter *adap, u64 quirks)
893{
894 if (!adap->quirks)
895 return false;
896 return (adap->quirks->flags & quirks) == quirks;
897}
898
899
900static inline int i2c_adapter_id(struct i2c_adapter *adap)
901{
902 return adap->nr;
903}
904
905static inline u8 i2c_8bit_addr_from_msg(const struct i2c_msg *msg)
906{
907 return (msg->addr << 1) | (msg->flags & I2C_M_RD ? 1 : 0);
908}
909
910u8 *i2c_get_dma_safe_msg_buf(struct i2c_msg *msg, unsigned int threshold);
911void i2c_put_dma_safe_msg_buf(u8 *buf, struct i2c_msg *msg, bool xferred);
912
913int i2c_handle_smbus_host_notify(struct i2c_adapter *adap, unsigned short addr);
914
915
916
917
918
919
920
921
922#define module_i2c_driver(__i2c_driver) \
923 module_driver(__i2c_driver, i2c_add_driver, \
924 i2c_del_driver)
925
926
927
928
929
930
931
932
933
934#define builtin_i2c_driver(__i2c_driver) \
935 builtin_driver(__i2c_driver, i2c_add_driver)
936
937#endif
938
939#if IS_ENABLED(CONFIG_OF)
940
941struct i2c_client *of_find_i2c_device_by_node(struct device_node *node);
942
943
944struct i2c_adapter *of_find_i2c_adapter_by_node(struct device_node *node);
945
946
947struct i2c_adapter *of_get_i2c_adapter_by_node(struct device_node *node);
948
949const struct of_device_id
950*i2c_of_match_device(const struct of_device_id *matches,
951 struct i2c_client *client);
952
953int of_i2c_get_board_info(struct device *dev, struct device_node *node,
954 struct i2c_board_info *info);
955
956#else
957
958static inline struct i2c_client *of_find_i2c_device_by_node(struct device_node *node)
959{
960 return NULL;
961}
962
963static inline struct i2c_adapter *of_find_i2c_adapter_by_node(struct device_node *node)
964{
965 return NULL;
966}
967
968static inline struct i2c_adapter *of_get_i2c_adapter_by_node(struct device_node *node)
969{
970 return NULL;
971}
972
973static inline const struct of_device_id
974*i2c_of_match_device(const struct of_device_id *matches,
975 struct i2c_client *client)
976{
977 return NULL;
978}
979
980static inline int of_i2c_get_board_info(struct device *dev,
981 struct device_node *node,
982 struct i2c_board_info *info)
983{
984 return -ENOTSUPP;
985}
986
987#endif
988
989struct acpi_resource;
990struct acpi_resource_i2c_serialbus;
991
992#if IS_ENABLED(CONFIG_ACPI)
993bool i2c_acpi_get_i2c_resource(struct acpi_resource *ares,
994 struct acpi_resource_i2c_serialbus **i2c);
995u32 i2c_acpi_find_bus_speed(struct device *dev);
996struct i2c_client *i2c_acpi_new_device(struct device *dev, int index,
997 struct i2c_board_info *info);
998struct i2c_adapter *i2c_acpi_find_adapter_by_handle(acpi_handle handle);
999#else
1000static inline bool i2c_acpi_get_i2c_resource(struct acpi_resource *ares,
1001 struct acpi_resource_i2c_serialbus **i2c)
1002{
1003 return false;
1004}
1005static inline u32 i2c_acpi_find_bus_speed(struct device *dev)
1006{
1007 return 0;
1008}
1009static inline struct i2c_client *i2c_acpi_new_device(struct device *dev,
1010 int index, struct i2c_board_info *info)
1011{
1012 return ERR_PTR(-ENODEV);
1013}
1014static inline struct i2c_adapter *i2c_acpi_find_adapter_by_handle(acpi_handle handle)
1015{
1016 return NULL;
1017}
1018#endif
1019
1020#endif
1021