2 * Copyright (C) 2008, Creative Technology Ltd. All Rights Reserved.
4 * This source file is released under GPL v2 license (no other versions).
5 * See the COPYING file included in the main directory of this source
6 * distribution for the license terms and conditions.
11 * This file contains the definition of Digital Audio Input Output
12 * resource management object.
22 #include "ctresource.h"
24 #include <linux/spinlock.h>
25 #include <linux/list.h>
27 /* Define the descriptor of a daio resource */
33 SPDIFOO
, /* S/PDIF Out (Flexijack/Optical) */
35 SPDIFIO
, /* S/PDIF In (Flexijack/Optical) on the card */
36 SPDIFI1
, /* S/PDIF In on internal Drive Bay */
45 struct rsc rscl
; /* Basic resource info for left TX/RX */
46 struct rsc rscr
; /* Basic resource info for right TX/RX */
52 struct dao_rsc_ops
*ops
; /* DAO specific operations */
53 struct imapper
**imappers
;
61 struct dai_rsc_ops
*ops
; /* DAI specific operations */
68 unsigned int passthru
:1;
72 int (*set_spos
)(struct dao
*dao
, unsigned int spos
);
73 int (*commit_write
)(struct dao
*dao
);
74 int (*get_spos
)(struct dao
*dao
, unsigned int *spos
);
75 int (*reinit
)(struct dao
*dao
, const struct dao_desc
*desc
);
76 int (*set_left_input
)(struct dao
*dao
, struct rsc
*input
);
77 int (*set_right_input
)(struct dao
*dao
, struct rsc
*input
);
78 int (*clear_left_input
)(struct dao
*dao
);
79 int (*clear_right_input
)(struct dao
*dao
);
83 int (*set_srt_srcl
)(struct dai
*dai
, struct rsc
*src
);
84 int (*set_srt_srcr
)(struct dai
*dai
, struct rsc
*src
);
85 int (*set_srt_msr
)(struct dai
*dai
, unsigned int msr
);
86 int (*set_enb_src
)(struct dai
*dai
, unsigned int enb
);
87 int (*set_enb_srt
)(struct dai
*dai
, unsigned int enb
);
88 int (*commit_write
)(struct dai
*dai
);
91 /* Define daio resource request description info */
95 unsigned int passthru
:1;
99 struct rsc_mgr mgr
; /* Basic resource manager info */
101 spinlock_t imap_lock
;
102 struct list_head imappers
;
103 struct imapper
*init_imap
;
104 unsigned int init_imap_added
;
106 /* request one daio resource */
107 int (*get_daio
)(struct daio_mgr
*mgr
,
108 const struct daio_desc
*desc
, struct daio
**rdaio
);
109 /* return one daio resource */
110 int (*put_daio
)(struct daio_mgr
*mgr
, struct daio
*daio
);
111 int (*daio_enable
)(struct daio_mgr
*mgr
, struct daio
*daio
);
112 int (*daio_disable
)(struct daio_mgr
*mgr
, struct daio
*daio
);
113 int (*imap_add
)(struct daio_mgr
*mgr
, struct imapper
*entry
);
114 int (*imap_delete
)(struct daio_mgr
*mgr
, struct imapper
*entry
);
115 int (*commit_write
)(struct daio_mgr
*mgr
);
118 /* Constructor and destructor of daio resource manager */
119 int daio_mgr_create(void *hw
, struct daio_mgr
**rdaio_mgr
);
120 int daio_mgr_destroy(struct daio_mgr
*daio_mgr
);
122 #endif /* CTDAIO_H */