Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
torvalds
GitHub Repository: torvalds/linux
Path: blob/master/sound/pci/ctxfi/ctdaio.h
52844 views
1
/* SPDX-License-Identifier: GPL-2.0-only */
2
/*
3
* Copyright (C) 2008, Creative Technology Ltd. All Rights Reserved.
4
*
5
* @File ctdaio.h
6
*
7
* @Brief
8
* This file contains the definition of Digital Audio Input Output
9
* resource management object.
10
*
11
* @Author Liu Chun
12
* @Date May 23 2008
13
*/
14
15
#ifndef CTDAIO_H
16
#define CTDAIO_H
17
18
#include "ctresource.h"
19
#include "ctimap.h"
20
#include <linux/spinlock.h>
21
#include <linux/list.h>
22
#include <sound/core.h>
23
24
/* Define the descriptor of a daio resource */
25
enum DAIOTYP {
26
LINEO1,
27
LINEO2,
28
LINEO3,
29
LINEO4,
30
SPDIFOO, /* S/PDIF Out (Flexijack/Optical) */
31
LINEIM,
32
SPDIFIO, /* S/PDIF In (Flexijack/Optical) on the card */
33
MIC, /* Dedicated mic on Titanium HD */
34
RCA, /* Dedicated RCA on SE-300PCIE */
35
SPDIFI1, /* S/PDIF In on internal Drive Bay */
36
NUM_DAIOTYP
37
};
38
39
struct dao_rsc_ops;
40
struct dai_rsc_ops;
41
struct daio_mgr;
42
43
struct daio {
44
struct rsc rscl; /* Basic resource info for left TX/RX */
45
struct rsc rscr; /* Basic resource info for right TX/RX */
46
enum DAIOTYP type;
47
unsigned char output;
48
};
49
50
struct dao {
51
struct daio daio;
52
const struct dao_rsc_ops *ops; /* DAO specific operations */
53
struct imapper **imappers;
54
struct daio_mgr *mgr;
55
struct hw *hw;
56
void *ctrl_blk;
57
};
58
59
struct dai {
60
struct daio daio;
61
const struct dai_rsc_ops *ops; /* DAI specific operations */
62
struct hw *hw;
63
void *ctrl_blk;
64
};
65
66
struct dao_desc {
67
unsigned int msr:4;
68
unsigned int passthru:1;
69
};
70
71
struct dao_rsc_ops {
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);
80
};
81
82
struct dai_rsc_ops {
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);
89
};
90
91
/* Define daio resource request description info */
92
struct daio_desc {
93
unsigned int type:4;
94
unsigned int msr:4;
95
unsigned int passthru:1;
96
unsigned int output:1;
97
};
98
99
struct daio_mgr {
100
struct rsc_mgr mgr; /* Basic resource manager info */
101
struct snd_card *card; /* pointer to this card */
102
spinlock_t mgr_lock;
103
spinlock_t imap_lock;
104
struct list_head imappers;
105
struct imapper *init_imap;
106
unsigned int init_imap_added;
107
108
/* request one daio resource */
109
int (*get_daio)(struct daio_mgr *mgr,
110
const struct daio_desc *desc, struct daio **rdaio);
111
/* return one daio resource */
112
int (*put_daio)(struct daio_mgr *mgr, struct daio *daio);
113
int (*daio_enable)(struct daio_mgr *mgr, struct daio *daio);
114
int (*daio_disable)(struct daio_mgr *mgr, struct daio *daio);
115
int (*imap_add)(struct daio_mgr *mgr, struct imapper *entry);
116
int (*imap_delete)(struct daio_mgr *mgr, struct imapper *entry);
117
int (*commit_write)(struct daio_mgr *mgr);
118
};
119
120
/* Constructor and destructor of daio resource manager */
121
int daio_mgr_create(struct hw *hw, void **ptr);
122
int daio_mgr_destroy(void *ptr);
123
124
#endif /* CTDAIO_H */
125
126