Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ericvh...
[pandora-kernel.git] / drivers / staging / crystalhd / crystalhd_cmds.h
1 /***************************************************************************
2  * Copyright (c) 2005-2009, Broadcom Corporation.
3  *
4  *  Name: crystalhd_cmds . h
5  *
6  *  Description:
7  *              BCM70010 Linux driver user command interfaces.
8  *
9  *  HISTORY:
10  *
11  **********************************************************************
12  * This file is part of the crystalhd device driver.
13  *
14  * This driver is free software; you can redistribute it and/or modify
15  * it under the terms of the GNU General Public License as published by
16  * the Free Software Foundation, version 2 of the License.
17  *
18  * This driver is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this driver.  If not, see <http://www.gnu.org/licenses/>.
25  **********************************************************************/
26
27 #ifndef _CRYSTALHD_CMDS_H_
28 #define _CRYSTALHD_CMDS_H_
29
30 /*
31  * NOTE:: This is the main interface file between the Linux layer
32  *        and the harware layer. This file will use the definitions
33  *        from _dts_glob and dts_defs etc.. which are defined for
34  *        windows.
35  */
36 #include "crystalhd_misc.h"
37 #include "crystalhd_hw.h"
38
39 enum 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
49 struct crystalhd_user {
50         uint32_t        uid;
51         uint32_t        in_use;
52         uint32_t        mode;
53 };
54
55 #define DTS_MODE_INV    (-1)
56
57 struct 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
69 typedef enum BC_STATUS(*crystalhd_cmd_proc)(struct crystalhd_cmd *, struct crystalhd_ioctl_data *);
70
71 struct crystalhd_cmd_tbl {
72         uint32_t                cmd_id;
73         const crystalhd_cmd_proc        cmd_proc;
74         uint32_t                block_mon;
75 };
76
77 enum BC_STATUS crystalhd_suspend(struct crystalhd_cmd *ctx, struct crystalhd_ioctl_data *idata);
78 enum BC_STATUS crystalhd_resume(struct crystalhd_cmd *ctx);
79 crystalhd_cmd_proc crystalhd_get_cmd_proc(struct crystalhd_cmd *ctx, uint32_t cmd,
80                                       struct crystalhd_user *uc);
81 enum BC_STATUS crystalhd_user_open(struct crystalhd_cmd *ctx, struct crystalhd_user **user_ctx);
82 enum BC_STATUS crystalhd_user_close(struct crystalhd_cmd *ctx, struct crystalhd_user *uc);
83 enum BC_STATUS crystalhd_setup_cmd_context(struct crystalhd_cmd *ctx, struct crystalhd_adp *adp);
84 enum BC_STATUS crystalhd_delete_cmd_context(struct crystalhd_cmd *ctx);
85 bool crystalhd_cmd_interrupt(struct crystalhd_cmd *ctx);
86
87 #endif