Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
bbc_i2c.h
Go to the documentation of this file.
1 #ifndef _BBC_I2C_H
2 #define _BBC_I2C_H
3 
4 #include <linux/of.h>
5 #include <linux/of_device.h>
6 #include <linux/list.h>
7 
8 struct bbc_i2c_client {
9  struct bbc_i2c_bus *bp;
11  int bus;
12  int address;
13 };
14 
16 
20 
22  int index;
23 
24  /* Current readings, and history. */
31 
33 
35 #define FAN_AMBIENT 0
36 #define FAN_CPU 1
37 };
38 
42 
44  int index;
45 
49 };
50 
51 #define NUM_CHILDREN 8
52 
53 struct bbc_i2c_bus {
54  struct bbc_i2c_bus *next;
55  int index;
59  unsigned char own, clock;
60 
62  volatile int waiting;
63 
64  struct list_head temps;
65  struct list_head fans;
66 
68  struct {
71  } devs[NUM_CHILDREN];
72 };
73 
74 /* Probing and attachment. */
75 extern struct platform_device *bbc_i2c_getdev(struct bbc_i2c_bus *, int);
76 extern struct bbc_i2c_client *bbc_i2c_attach(struct bbc_i2c_bus *bp, struct platform_device *);
77 extern void bbc_i2c_detach(struct bbc_i2c_client *);
78 
79 /* Register read/write. NOTE: Blocking! */
80 extern int bbc_i2c_writeb(struct bbc_i2c_client *, unsigned char val, int off);
81 extern int bbc_i2c_readb(struct bbc_i2c_client *, unsigned char *byte, int off);
82 extern int bbc_i2c_write_buf(struct bbc_i2c_client *, char *buf, int len, int off);
83 extern int bbc_i2c_read_buf(struct bbc_i2c_client *, char *buf, int len, int off);
84 
85 #endif /* _BBC_I2C_H */