1 /* SPDX-License-Identifier: GPL-2.0 */
6 #include <linux/of_device.h>
7 #include <linux/list.h>
9 struct bbc_i2c_client {
10 struct bbc_i2c_bus *bp;
11 struct platform_device *op;
16 enum fan_action { FAN_SLOWER, FAN_SAME, FAN_FASTER, FAN_FULLBLAST, FAN_STATE_MAX };
18 struct bbc_cpu_temperature {
19 struct list_head bp_list;
20 struct list_head glob_list;
22 struct bbc_i2c_client *client;
25 /* Current readings, and history. */
35 enum fan_action fan_todo[2];
40 struct bbc_fan_control {
41 struct list_head bp_list;
42 struct list_head glob_list;
44 struct bbc_i2c_client *client;
52 #define NUM_CHILDREN 8
55 struct bbc_i2c_bus *next;
58 void __iomem *i2c_bussel_reg;
59 void __iomem *i2c_control_regs;
60 unsigned char own, clock;
65 struct list_head temps;
66 struct list_head fans;
68 struct platform_device *op;
70 struct platform_device *device;
75 /* Probing and attachment. */
76 extern struct platform_device *bbc_i2c_getdev(struct bbc_i2c_bus *, int);
77 extern struct bbc_i2c_client *bbc_i2c_attach(struct bbc_i2c_bus *bp, struct platform_device *);
78 extern void bbc_i2c_detach(struct bbc_i2c_client *);
80 /* Register read/write. NOTE: Blocking! */
81 extern int bbc_i2c_writeb(struct bbc_i2c_client *, unsigned char val, int off);
82 extern int bbc_i2c_readb(struct bbc_i2c_client *, unsigned char *byte, int off);
83 extern int bbc_i2c_write_buf(struct bbc_i2c_client *, char *buf, int len, int off);
84 extern int bbc_i2c_read_buf(struct bbc_i2c_client *, char *buf, int len, int off);
86 #endif /* _BBC_I2C_H */