1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27#ifndef _CRYSTALHD_CMDS_H_
28#define _CRYSTALHD_CMDS_H_
29
30
31
32
33
34
35
36
37#include "crystalhd.h"
38
39enum crystalhd_state {
40 BC_LINK_INVALID = 0x00,
41 BC_LINK_INIT = 0x01,
42 BC_LINK_CAP_EN = 0x02,
43 BC_LINK_FMT_CHG = 0x04,
44 BC_LINK_SUSPEND = 0x10,
45 BC_LINK_PAUSED = 0x20,
46 BC_LINK_READY = (BC_LINK_INIT | BC_LINK_CAP_EN | BC_LINK_FMT_CHG),
47};
48
49struct crystalhd_user {
50 uint32_t uid;
51 uint32_t in_use;
52 uint32_t mode;
53};
54
55#define DTS_MODE_INV (-1)
56
57struct crystalhd_cmd {
58 uint32_t state;
59 struct crystalhd_adp *adp;
60 struct crystalhd_user user[BC_LINK_MAX_OPENS];
61
62 spinlock_t ctx_lock;
63 uint32_t tx_list_id;
64 uint32_t cin_wait_exit;
65 uint32_t pwr_state_change;
66 struct crystalhd_hw hw_ctx;
67};
68
69typedef enum BC_STATUS(*crystalhd_cmd_proc)(struct crystalhd_cmd *,
70 struct crystalhd_ioctl_data *);
71
72struct crystalhd_cmd_tbl {
73 uint32_t cmd_id;
74 const crystalhd_cmd_proc cmd_proc;
75 uint32_t block_mon;
76};
77
78enum BC_STATUS crystalhd_suspend(struct crystalhd_cmd *ctx,
79 struct crystalhd_ioctl_data *idata);
80enum BC_STATUS crystalhd_resume(struct crystalhd_cmd *ctx);
81crystalhd_cmd_proc crystalhd_get_cmd_proc(struct crystalhd_cmd *ctx,
82 uint32_t cmd, struct crystalhd_user *uc);
83enum BC_STATUS crystalhd_user_open(struct crystalhd_cmd *ctx,
84 struct crystalhd_user **user_ctx);
85enum BC_STATUS crystalhd_user_close(struct crystalhd_cmd *ctx,
86 struct crystalhd_user *uc);
87enum BC_STATUS crystalhd_setup_cmd_context(struct crystalhd_cmd *ctx,
88 struct crystalhd_adp *adp);
89enum BC_STATUS crystalhd_delete_cmd_context(struct crystalhd_cmd *ctx);
90bool crystalhd_cmd_interrupt(struct crystalhd_cmd *ctx);
91
92#endif
93