1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19#ifndef CTDAIO_H
20#define CTDAIO_H
21
22#include "ctresource.h"
23#include "ctimap.h"
24#include <linux/spinlock.h>
25#include <linux/list.h>
26
27
28enum DAIOTYP {
29 LINEO1,
30 LINEO2,
31 LINEO3,
32 LINEO4,
33 SPDIFOO,
34 LINEIM,
35 SPDIFIO,
36 MIC,
37 SPDIFI1,
38 NUM_DAIOTYP
39};
40
41struct dao_rsc_ops;
42struct dai_rsc_ops;
43struct daio_mgr;
44
45struct daio {
46 struct rsc rscl;
47 struct rsc rscr;
48 enum DAIOTYP type;
49};
50
51struct dao {
52 struct daio daio;
53 struct dao_rsc_ops *ops;
54 struct imapper **imappers;
55 struct daio_mgr *mgr;
56 void *hw;
57 void *ctrl_blk;
58};
59
60struct dai {
61 struct daio daio;
62 struct dai_rsc_ops *ops;
63 void *hw;
64 void *ctrl_blk;
65};
66
67struct dao_desc {
68 unsigned int msr:4;
69 unsigned int passthru:1;
70};
71
72struct dao_rsc_ops {
73 int (*set_spos)(struct dao *dao, unsigned int spos);
74 int (*commit_write)(struct dao *dao);
75 int (*get_spos)(struct dao *dao, unsigned int *spos);
76 int (*reinit)(struct dao *dao, const struct dao_desc *desc);
77 int (*set_left_input)(struct dao *dao, struct rsc *input);
78 int (*set_right_input)(struct dao *dao, struct rsc *input);
79 int (*clear_left_input)(struct dao *dao);
80 int (*clear_right_input)(struct dao *dao);
81};
82
83struct dai_rsc_ops {
84 int (*set_srt_srcl)(struct dai *dai, struct rsc *src);
85 int (*set_srt_srcr)(struct dai *dai, struct rsc *src);
86 int (*set_srt_msr)(struct dai *dai, unsigned int msr);
87 int (*set_enb_src)(struct dai *dai, unsigned int enb);
88 int (*set_enb_srt)(struct dai *dai, unsigned int enb);
89 int (*commit_write)(struct dai *dai);
90};
91
92
93struct daio_desc {
94 unsigned int type:4;
95 unsigned int msr:4;
96 unsigned int passthru:1;
97};
98
99struct daio_mgr {
100 struct rsc_mgr mgr;
101 spinlock_t mgr_lock;
102 spinlock_t imap_lock;
103 struct list_head imappers;
104 struct imapper *init_imap;
105 unsigned int init_imap_added;
106
107
108 int (*get_daio)(struct daio_mgr *mgr,
109 const struct daio_desc *desc, struct daio **rdaio);
110
111 int (*put_daio)(struct daio_mgr *mgr, struct daio *daio);
112 int (*daio_enable)(struct daio_mgr *mgr, struct daio *daio);
113 int (*daio_disable)(struct daio_mgr *mgr, struct daio *daio);
114 int (*imap_add)(struct daio_mgr *mgr, struct imapper *entry);
115 int (*imap_delete)(struct daio_mgr *mgr, struct imapper *entry);
116 int (*commit_write)(struct daio_mgr *mgr);
117};
118
119
120int daio_mgr_create(void *hw, struct daio_mgr **rdaio_mgr);
121int daio_mgr_destroy(struct daio_mgr *daio_mgr);
122
123#endif
124