0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifndef CTDAIO_H
0016 #define CTDAIO_H
0017
0018 #include "ctresource.h"
0019 #include "ctimap.h"
0020 #include <linux/spinlock.h>
0021 #include <linux/list.h>
0022 #include <sound/core.h>
0023
0024
0025 enum DAIOTYP {
0026 LINEO1,
0027 LINEO2,
0028 LINEO3,
0029 LINEO4,
0030 SPDIFOO,
0031 LINEIM,
0032 SPDIFIO,
0033 MIC,
0034 SPDIFI1,
0035 NUM_DAIOTYP
0036 };
0037
0038 struct dao_rsc_ops;
0039 struct dai_rsc_ops;
0040 struct daio_mgr;
0041
0042 struct daio {
0043 struct rsc rscl;
0044 struct rsc rscr;
0045 enum DAIOTYP type;
0046 };
0047
0048 struct dao {
0049 struct daio daio;
0050 const struct dao_rsc_ops *ops;
0051 struct imapper **imappers;
0052 struct daio_mgr *mgr;
0053 struct hw *hw;
0054 void *ctrl_blk;
0055 };
0056
0057 struct dai {
0058 struct daio daio;
0059 const struct dai_rsc_ops *ops;
0060 struct hw *hw;
0061 void *ctrl_blk;
0062 };
0063
0064 struct dao_desc {
0065 unsigned int msr:4;
0066 unsigned int passthru:1;
0067 };
0068
0069 struct dao_rsc_ops {
0070 int (*set_spos)(struct dao *dao, unsigned int spos);
0071 int (*commit_write)(struct dao *dao);
0072 int (*get_spos)(struct dao *dao, unsigned int *spos);
0073 int (*reinit)(struct dao *dao, const struct dao_desc *desc);
0074 int (*set_left_input)(struct dao *dao, struct rsc *input);
0075 int (*set_right_input)(struct dao *dao, struct rsc *input);
0076 int (*clear_left_input)(struct dao *dao);
0077 int (*clear_right_input)(struct dao *dao);
0078 };
0079
0080 struct dai_rsc_ops {
0081 int (*set_srt_srcl)(struct dai *dai, struct rsc *src);
0082 int (*set_srt_srcr)(struct dai *dai, struct rsc *src);
0083 int (*set_srt_msr)(struct dai *dai, unsigned int msr);
0084 int (*set_enb_src)(struct dai *dai, unsigned int enb);
0085 int (*set_enb_srt)(struct dai *dai, unsigned int enb);
0086 int (*commit_write)(struct dai *dai);
0087 };
0088
0089
0090 struct daio_desc {
0091 unsigned int type:4;
0092 unsigned int msr:4;
0093 unsigned int passthru:1;
0094 };
0095
0096 struct daio_mgr {
0097 struct rsc_mgr mgr;
0098 struct snd_card *card;
0099 spinlock_t mgr_lock;
0100 spinlock_t imap_lock;
0101 struct list_head imappers;
0102 struct imapper *init_imap;
0103 unsigned int init_imap_added;
0104
0105
0106 int (*get_daio)(struct daio_mgr *mgr,
0107 const struct daio_desc *desc, struct daio **rdaio);
0108
0109 int (*put_daio)(struct daio_mgr *mgr, struct daio *daio);
0110 int (*daio_enable)(struct daio_mgr *mgr, struct daio *daio);
0111 int (*daio_disable)(struct daio_mgr *mgr, struct daio *daio);
0112 int (*imap_add)(struct daio_mgr *mgr, struct imapper *entry);
0113 int (*imap_delete)(struct daio_mgr *mgr, struct imapper *entry);
0114 int (*commit_write)(struct daio_mgr *mgr);
0115 };
0116
0117
0118 int daio_mgr_create(struct hw *hw, struct daio_mgr **rdaio_mgr);
0119 int daio_mgr_destroy(struct daio_mgr *daio_mgr);
0120
0121 #endif