staging: rtl8188eu: rename HalSetBrateCfg() - style
[linux/fpc-iii.git] / drivers / sbus / char / bbc_i2c.h
blobc2d066d3fa41d76b8f4e4fe9e3f67beac4e3c23c
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _BBC_I2C_H
3 #define _BBC_I2C_H
5 #include <linux/of.h>
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;
12 int bus;
13 int address;
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;
23 int index;
25 /* Current readings, and history. */
26 s8 curr_cpu_temp;
27 s8 curr_amb_temp;
28 s8 prev_cpu_temp;
29 s8 prev_amb_temp;
30 s8 avg_cpu_temp;
31 s8 avg_amb_temp;
33 int sample_tick;
35 enum fan_action fan_todo[2];
36 #define FAN_AMBIENT 0
37 #define FAN_CPU 1
40 struct bbc_fan_control {
41 struct list_head bp_list;
42 struct list_head glob_list;
44 struct bbc_i2c_client *client;
45 int index;
47 int psupply_fan_on;
48 int cpu_fan_speed;
49 int system_fan_speed;
52 #define NUM_CHILDREN 8
54 struct bbc_i2c_bus {
55 struct bbc_i2c_bus *next;
56 int index;
57 spinlock_t lock;
58 void __iomem *i2c_bussel_reg;
59 void __iomem *i2c_control_regs;
60 unsigned char own, clock;
62 wait_queue_head_t wq;
63 volatile int waiting;
65 struct list_head temps;
66 struct list_head fans;
68 struct platform_device *op;
69 struct {
70 struct platform_device *device;
71 int client_claimed;
72 } devs[NUM_CHILDREN];
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 */