Merge branch 'linux-linaro-lsk-v4.4-android' of git://git.linaro.org/kernel/linux...
[firefly-linux-kernel-4.4.55.git] / sound / soc / codecs / aic3xxx_cfw_ops.h
1 #ifndef AIC3XXX_CFW_OPS_H_
2 #define AIC3XXX_CFW_OPS_H_
3
4 #ifdef AIC3XXX_CFW_HOST_BLD
5 void *aic3xxx_cfw_init(void *pcfw, int n);
6 void *aic3xxx_cfw_getpjt(void *ps);
7 cfw_project *aic3xxx_cfw_unpickle(void *,int);
8 unsigned int crc32(unsigned int *pdata, int n);
9 #endif
10
11 int aic3xxx_cfw_reload(void *pv, void *pcfw, int n);
12 int aic3xxx_cfw_setmode(void *pv, int mode);
13 int aic3xxx_cfw_setmode_cfg(void *pv, int mode, int cfg);
14 int aic3xxx_cfw_setcfg(void *pv, int cfg);
15 int aic3xxx_cfw_transition(void *pv, char *ttype);
16 int aic3xxx_cfw_set_pll(void *pv, int asi);
17
18
19 #define AIC3XX_COPS_MDSP_D  (0x00000003u)
20 #define AIC3XX_COPS_MDSP_A  (0x00000030u)
21 #define AIC3XX_COPS_MDSP_ALL (AIC3XX_COPS_MDSP_D|AIC3XX_COPS_MDSP_A)
22
23 #define AIC3XX_ABUF_MDSP_D1 (0x00000001u)
24 #define AIC3XX_ABUF_MDSP_D2 (0x00000002u)
25 #define AIC3XX_ABUF_MDSP_A  (0x00000010u)
26 #define AIC3XX_ABUF_MDSP_ALL \
27     (AIC3XX_ABUF_MDSP_D1| AIC3XX_ABUF_MDSP_D2| AIC3XX_ABUF_MDSP_A)
28
29 typedef struct aic3xxx_codec_ops {
30     int (*reg_read)(void *p, unsigned int reg);
31     int (*reg_write)(void *p, unsigned int reg,
32             unsigned char val);
33     int (*set_bits)(void *p, unsigned int reg, 
34             unsigned char mask, unsigned char val);
35     int (*bulk_read)(void *p, unsigned int reg, 
36             int count, u8 *buf);
37     int (*bulk_write)(void *p, unsigned int reg, 
38             int count, const u8 *buf);
39
40     int (*lock)(void *p);
41     int (*unlock)(void *p);
42     int (*stop)(void *p, int mask);
43     int (*restore)(void *p, int runstate);
44     int (*bswap)(void *p,int mask);
45 } aic3xxx_codec_ops;
46
47 typedef struct cfw_state {
48     cfw_project *pjt;
49     const aic3xxx_codec_ops *ops;
50     void *ops_obj;
51     int cur_mode;
52     int cur_pfw;
53     int cur_ovly;
54     int cur_cfg;
55 } cfw_state;
56
57 #ifndef AIC3XXX_CFW_HOST_BLD
58 #ifdef DEBUG
59
60 #   define DBG(fmt,...) printk("CFW[%s:%d]: " fmt "\n",      \
61                         __FILE__, __LINE__, ##__VA_ARGS__)
62 #else
63
64 #   define DBG(fmt,...) 
65
66 #endif
67
68 #endif
69 #endif