Merge tag 'pwm/for-4.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/thierry...
[deliverable/linux.git] / sound / pci / ctxfi / ctdaio.h
CommitLineData
8cc72361
WYC
1/**
2 * Copyright (C) 2008, Creative Technology Ltd. All Rights Reserved.
3 *
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.
7 *
8 * @File ctdaio.h
9 *
10 * @Brief
11 * This file contains the definition of Digital Audio Input Output
12 * resource management object.
13 *
14 * @Author Liu Chun
15 * @Date May 23 2008
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>
3d0fdc86 26#include <sound/core.h>
8cc72361
WYC
27
28/* Define the descriptor of a daio resource */
29enum DAIOTYP {
30 LINEO1,
31 LINEO2,
32 LINEO3,
33 LINEO4,
34 SPDIFOO, /* S/PDIF Out (Flexijack/Optical) */
35 LINEIM,
36 SPDIFIO, /* S/PDIF In (Flexijack/Optical) on the card */
55309216 37 MIC, /* Dedicated mic on Titanium HD */
8cc72361
WYC
38 SPDIFI1, /* S/PDIF In on internal Drive Bay */
39 NUM_DAIOTYP
40};
41
42struct dao_rsc_ops;
43struct dai_rsc_ops;
44struct daio_mgr;
45
46struct daio {
47 struct rsc rscl; /* Basic resource info for left TX/RX */
48 struct rsc rscr; /* Basic resource info for right TX/RX */
49 enum DAIOTYP type;
50};
51
52struct dao {
53 struct daio daio;
43f2cdeb 54 const struct dao_rsc_ops *ops; /* DAO specific operations */
8cc72361
WYC
55 struct imapper **imappers;
56 struct daio_mgr *mgr;
66640898 57 struct hw *hw;
8cc72361
WYC
58 void *ctrl_blk;
59};
60
61struct dai {
62 struct daio daio;
43f2cdeb 63 const struct dai_rsc_ops *ops; /* DAI specific operations */
66640898 64 struct hw *hw;
8cc72361
WYC
65 void *ctrl_blk;
66};
67
68struct dao_desc {
69 unsigned int msr:4;
70 unsigned int passthru:1;
71};
72
73struct dao_rsc_ops {
74 int (*set_spos)(struct dao *dao, unsigned int spos);
75 int (*commit_write)(struct dao *dao);
76 int (*get_spos)(struct dao *dao, unsigned int *spos);
77 int (*reinit)(struct dao *dao, const struct dao_desc *desc);
78 int (*set_left_input)(struct dao *dao, struct rsc *input);
79 int (*set_right_input)(struct dao *dao, struct rsc *input);
80 int (*clear_left_input)(struct dao *dao);
81 int (*clear_right_input)(struct dao *dao);
82};
83
84struct dai_rsc_ops {
85 int (*set_srt_srcl)(struct dai *dai, struct rsc *src);
86 int (*set_srt_srcr)(struct dai *dai, struct rsc *src);
87 int (*set_srt_msr)(struct dai *dai, unsigned int msr);
88 int (*set_enb_src)(struct dai *dai, unsigned int enb);
89 int (*set_enb_srt)(struct dai *dai, unsigned int enb);
90 int (*commit_write)(struct dai *dai);
91};
92
93/* Define daio resource request description info */
94struct daio_desc {
95 unsigned int type:4;
96 unsigned int msr:4;
97 unsigned int passthru:1;
98};
99
100struct daio_mgr {
101 struct rsc_mgr mgr; /* Basic resource manager info */
3d0fdc86 102 struct snd_card *card; /* pointer to this card */
8cc72361
WYC
103 spinlock_t mgr_lock;
104 spinlock_t imap_lock;
105 struct list_head imappers;
106 struct imapper *init_imap;
107 unsigned int init_imap_added;
108
109 /* request one daio resource */
110 int (*get_daio)(struct daio_mgr *mgr,
111 const struct daio_desc *desc, struct daio **rdaio);
112 /* return one daio resource */
113 int (*put_daio)(struct daio_mgr *mgr, struct daio *daio);
114 int (*daio_enable)(struct daio_mgr *mgr, struct daio *daio);
115 int (*daio_disable)(struct daio_mgr *mgr, struct daio *daio);
116 int (*imap_add)(struct daio_mgr *mgr, struct imapper *entry);
117 int (*imap_delete)(struct daio_mgr *mgr, struct imapper *entry);
118 int (*commit_write)(struct daio_mgr *mgr);
119};
120
121/* Constructor and destructor of daio resource manager */
66640898 122int daio_mgr_create(struct hw *hw, struct daio_mgr **rdaio_mgr);
8cc72361
WYC
123int daio_mgr_destroy(struct daio_mgr *daio_mgr);
124
125#endif /* CTDAIO_H */
This page took 0.394826 seconds and 5 git commands to generate.