summaryrefslogtreecommitdiff
path: root/arch/arm/mach-wmt/include/mach/wmt-i2c-bus.h
blob: 9a67b22e1726f1761e50de48f62ecbd541dcc048 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <mach/hardware.h>
#include <linux/i2c.h>

struct i2c_slave_dev {
	unsigned short addr;
	char * dev_name;
	void (*callback)(void *data);
	struct i2c_msg *msg;
};

struct wmt_i2cbusfifo {
	struct i2c_msg *msg;
	int msg_num;
	struct list_head busfifohead;
	int non_block;/*1:non-block, 0: block*/
	int xfer_length;
	int xfer_msgnum;
	int restart;
	void (*callback)(void *data);
	void *data;
};


struct i2c_algo_wmt_data {
	int  (*write_msg)(unsigned int slave_addr, char *buf, unsigned int length , int restart, int last) ;
	int  (*read_msg)(unsigned int slave_addr, char *buf, unsigned int length , int restart, int last) ;
	int  (*send_request)(struct i2c_msg *msg, int msg_num, int non_block, void (*callbck)(void *data), void *data);
#ifdef CONFIG_SND_SOC_VT1603
	int (*vt1603_write_for_read)(unsigned int slave_addr, char *buf, unsigned int length , int restart, int last);
#endif
	int  (*wait_bus_not_busy) (void);
	void (*reset) (void);
	void (*set_mode)(enum i2c_mode_e) ;
	int  udelay;
	int  timeout;
};

extern int wmt_i2c_transfer(struct i2c_msg* msgs, int msg_num, int bus_id, void (*callback)(void *data), void *data);