1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (C) 2008, Creative Technology Ltd. All Rights Reserved.
8 * This file contains the definition of Digital Audio Input Output
9 * resource management object.
18 #include "ctresource.h"
20 #include <linux/spinlock.h>
21 #include <linux/list.h>
22 #include <sound/core.h>
24 /* Define the descriptor of a daio resource */
30 SPDIFOO
, /* S/PDIF Out (Flexijack/Optical) */
32 SPDIFIO
, /* S/PDIF In (Flexijack/Optical) on the card */
33 MIC
, /* Dedicated mic on Titanium HD */
34 SPDIFI1
, /* S/PDIF In on internal Drive Bay */
43 struct rsc rscl
; /* Basic resource info for left TX/RX */
44 struct rsc rscr
; /* Basic resource info for right TX/RX */
50 const struct dao_rsc_ops
*ops
; /* DAO specific operations */
51 struct imapper
**imappers
;
59 const struct dai_rsc_ops
*ops
; /* DAI specific operations */
66 unsigned int passthru
:1;
70 int (*set_spos
)(struct dao
*dao
, unsigned int spos
);
71 int (*commit_write
)(struct dao
*dao
);
72 int (*get_spos
)(struct dao
*dao
, unsigned int *spos
);
73 int (*reinit
)(struct dao
*dao
, const struct dao_desc
*desc
);
74 int (*set_left_input
)(struct dao
*dao
, struct rsc
*input
);
75 int (*set_right_input
)(struct dao
*dao
, struct rsc
*input
);
76 int (*clear_left_input
)(struct dao
*dao
);
77 int (*clear_right_input
)(struct dao
*dao
);
81 int (*set_srt_srcl
)(struct dai
*dai
, struct rsc
*src
);
82 int (*set_srt_srcr
)(struct dai
*dai
, struct rsc
*src
);
83 int (*set_srt_msr
)(struct dai
*dai
, unsigned int msr
);
84 int (*set_enb_src
)(struct dai
*dai
, unsigned int enb
);
85 int (*set_enb_srt
)(struct dai
*dai
, unsigned int enb
);
86 int (*commit_write
)(struct dai
*dai
);
89 /* Define daio resource request description info */
93 unsigned int passthru
:1;
97 struct rsc_mgr mgr
; /* Basic resource manager info */
98 struct snd_card
*card
; /* pointer to this card */
100 spinlock_t imap_lock
;
101 struct list_head imappers
;
102 struct imapper
*init_imap
;
103 unsigned int init_imap_added
;
105 /* request one daio resource */
106 int (*get_daio
)(struct daio_mgr
*mgr
,
107 const struct daio_desc
*desc
, struct daio
**rdaio
);
108 /* return one daio resource */
109 int (*put_daio
)(struct daio_mgr
*mgr
, struct daio
*daio
);
110 int (*daio_enable
)(struct daio_mgr
*mgr
, struct daio
*daio
);
111 int (*daio_disable
)(struct daio_mgr
*mgr
, struct daio
*daio
);
112 int (*imap_add
)(struct daio_mgr
*mgr
, struct imapper
*entry
);
113 int (*imap_delete
)(struct daio_mgr
*mgr
, struct imapper
*entry
);
114 int (*commit_write
)(struct daio_mgr
*mgr
);
117 /* Constructor and destructor of daio resource manager */
118 int daio_mgr_create(struct hw
*hw
, struct daio_mgr
**rdaio_mgr
);
119 int daio_mgr_destroy(struct daio_mgr
*daio_mgr
);
121 #endif /* CTDAIO_H */