summaryrefslogtreecommitdiff
path: root/sound/soc/codecs/aic3xxx_cfw_ops.h
blob: 81f6bda3581b98dc8218662ed421641762027dd6 (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#ifndef AIC3XXX_CFW_OPS_H_
#define AIC3XXX_CFW_OPS_H_
#define DEBUG
#ifdef AIC3XXX_CFW_HOST_BLD
struct mutex {
	int lock;
};
#endif

struct cfw_state {
	struct cfw_project *pjt;
	struct aic3xxx_codec_ops const *ops;
	void *ops_obj;
	struct mutex mutex;
	int cur_mode_id;
	int cur_mode;
	int cur_pfw;
	int cur_ovly;
	int cur_cfg;
};

#ifdef AIC3XXX_CFW_HOST_BLD
struct cfw_project *aic3xxx_cfw_unpickle(void *pcfw, int n);
unsigned int crc32(unsigned int *pdata, int n);
struct snd_soc_codec;
#else
#ifdef DEBUG
#define DBG(fmt, ...) printk(KERN_DEBUG "CFW[%s:%d]: " fmt "\n",	\
	__FILE__, __LINE__, ##__VA_ARGS__)
#else
	#define DBG(fmt, ...)
#endif
#endif
int aic3xxx_cfw_init(struct cfw_state *ps, struct aic3xxx_codec_ops const *ops,
		void *ops_obj);
int aic3xxx_cfw_lock(struct cfw_state *ps, int lock);
int aic3xxx_cfw_reload(struct cfw_state *ps, void *pcfw, int n);
int aic3xxx_cfw_setmode(struct cfw_state *ps, int mode);
int aic3xxx_cfw_setmode_cfg(struct cfw_state *ps, int mode, int cfg);
int aic3xxx_cfw_setcfg(struct cfw_state *ps, int cfg);
int aic3xxx_cfw_transition(struct cfw_state *ps, char *ttype);
int aic3xxx_cfw_set_pll(struct cfw_state *ps, int asi);
int aic3xxx_cfw_control(struct cfw_state *ps, char *cname, int param);
int aic3xxx_cfw_add_controls(struct snd_soc_codec *codec, struct cfw_state *ps);
int aic3xxx_cfw_add_modes(struct snd_soc_codec *codec, struct cfw_state *ps);


#define AIC3XX_COPS_MDSP_D  (0x00000003u)
#define AIC3XX_COPS_MDSP_A  (0x00000030u)
#define AIC3XX_COPS_MDSP_ALL (AIC3XX_COPS_MDSP_D|AIC3XX_COPS_MDSP_A)

#define AIC3XX_ABUF_MDSP_D1 (0x00000001u)
#define AIC3XX_ABUF_MDSP_D2 (0x00000002u)
#define AIC3XX_ABUF_MDSP_A  (0x00000010u)
#define AIC3XX_ABUF_MDSP_ALL \
	(AIC3XX_ABUF_MDSP_D1 | AIC3XX_ABUF_MDSP_D2 | AIC3XX_ABUF_MDSP_A)

struct aic3xxx_codec_ops {
	int (*reg_read)(void *p, unsigned int reg);
	int (*reg_write)(void *p, unsigned int reg,
			unsigned int val);
	int (*set_bits)(void *p, unsigned int reg,
			unsigned char mask, unsigned char val);
	int (*bulk_read)(void *p, unsigned int reg,
			int count, u8 *buf);
	int (*bulk_write)(void *p, unsigned int reg,
			int count, const u8 *buf);

	int (*lock) (void *p);
	int (*unlock) (void *p);
	int (*stop) (void *p, int mask);
	int (*restore) (void *p, int runstate);
	int (*bswap) (void *p, int mask);
};

#endif