blob: 5a315257ce5940114a4d9af73afdf36c8d245c13 [file] [log] [blame]
Duy Truong790f06d2013-02-13 16:38:12 -08001/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12
13#include <linux/types.h>
14#include <linux/skbuff.h>
15
16#ifndef _BAM_DMUX_H
17#define _BAM_DMUX_H
18
Jeff Hugo7960abd2011-08-02 15:39:38 -060019#define BAM_DMUX_CH_NAME_MAX_LEN 20
20
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070021enum {
22 BAM_DMUX_DATA_RMNET_0,
23 BAM_DMUX_DATA_RMNET_1,
24 BAM_DMUX_DATA_RMNET_2,
25 BAM_DMUX_DATA_RMNET_3,
26 BAM_DMUX_DATA_RMNET_4,
27 BAM_DMUX_DATA_RMNET_5,
28 BAM_DMUX_DATA_RMNET_6,
29 BAM_DMUX_DATA_RMNET_7,
30 BAM_DMUX_USB_RMNET_0,
Arun Kumar Neelakantam088d7a32012-10-31 11:18:20 +053031 BAM_DMUX_RESERVED_0, /* 9..11 are reserved*/
32 BAM_DMUX_RESERVED_1,
33 BAM_DMUX_RESERVED_2,
34 BAM_DMUX_DATA_REV_RMNET_0,
35 BAM_DMUX_DATA_REV_RMNET_1,
36 BAM_DMUX_DATA_REV_RMNET_2,
37 BAM_DMUX_DATA_REV_RMNET_3,
38 BAM_DMUX_DATA_REV_RMNET_4,
39 BAM_DMUX_DATA_REV_RMNET_5,
40 BAM_DMUX_DATA_REV_RMNET_6,
41 BAM_DMUX_DATA_REV_RMNET_7,
42 BAM_DMUX_DATA_REV_RMNET_8,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070043 BAM_DMUX_NUM_CHANNELS
44};
45
Manu Gautam7f808962011-08-29 16:38:07 +053046/* event type enum */
47enum {
48 BAM_DMUX_RECEIVE, /* data is struct sk_buff */
49 BAM_DMUX_WRITE_DONE, /* data is struct sk_buff */
Jeff Hugod98b1082011-10-24 10:30:23 -060050 BAM_DMUX_UL_CONNECTED, /* data is null */
51 BAM_DMUX_UL_DISCONNECTED, /*data is null */
Manu Gautam7f808962011-08-29 16:38:07 +053052};
53
54/*
55 * Open a bam_dmux logical channel
56 * id - the logical channel to open
57 * priv - private data pointer to be passed to the notify callback
58 * notify - event callback function
59 * priv - private data pointer passed to msm_bam_dmux_open()
60 * event_type - type of event
61 * data - data relevant to event. May not be valid. See event_type
62 * enum for valid cases.
63 */
64#ifdef CONFIG_MSM_BAM_DMUX
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070065int msm_bam_dmux_open(uint32_t id, void *priv,
Jeff Hugo1c4531c2011-08-02 14:55:37 -060066 void (*notify)(void *priv, int event_type,
67 unsigned long data));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070068
69int msm_bam_dmux_close(uint32_t id);
70
71int msm_bam_dmux_write(uint32_t id, struct sk_buff *skb);
Jeff Hugod98b1082011-10-24 10:30:23 -060072
Eric Holmbergbc9f21c2012-01-18 11:33:33 -070073int msm_bam_dmux_kickoff_ul_wakeup(void);
74
75int msm_bam_dmux_ul_power_vote(void);
76
77int msm_bam_dmux_ul_power_unvote(void);
Karthikeyan Ramasubramanian7bf5ca82011-11-21 13:33:19 -070078
79int msm_bam_dmux_is_ch_full(uint32_t id);
80
81int msm_bam_dmux_is_ch_low(uint32_t id);
Jeff Hugocb798022012-04-09 14:55:40 -060082
83int msm_bam_dmux_reg_notify(void *priv,
84 void (*notify)(void *priv, int event_type,
85 unsigned long data));
Manu Gautam7f808962011-08-29 16:38:07 +053086#else
Eric Holmberg89c734b2012-01-30 12:45:54 -070087static inline int msm_bam_dmux_open(uint32_t id, void *priv,
Jeff Hugo1c4531c2011-08-02 14:55:37 -060088 void (*notify)(void *priv, int event_type,
89 unsigned long data))
Manu Gautam7f808962011-08-29 16:38:07 +053090{
91 return -ENODEV;
92}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070093
Eric Holmberg89c734b2012-01-30 12:45:54 -070094static inline int msm_bam_dmux_close(uint32_t id)
Manu Gautam7f808962011-08-29 16:38:07 +053095{
96 return -ENODEV;
97}
98
Eric Holmberg89c734b2012-01-30 12:45:54 -070099static inline int msm_bam_dmux_write(uint32_t id, struct sk_buff *skb)
Manu Gautam7f808962011-08-29 16:38:07 +0530100{
101 return -ENODEV;
102}
Jeff Hugod98b1082011-10-24 10:30:23 -0600103
Eric Holmbergbc9f21c2012-01-18 11:33:33 -0700104static inline int msm_bam_dmux_kickoff_ul_wakeup(void)
Jeff Hugod98b1082011-10-24 10:30:23 -0600105{
Eric Holmbergbc9f21c2012-01-18 11:33:33 -0700106 return -ENODEV;
107}
108
109static inline int msm_bam_dmux_ul_power_vote(void)
110{
111 return -ENODEV;
112}
113
114static inline int msm_bam_dmux_ul_power_unvote(void)
115{
116 return -ENODEV;
Jeff Hugod98b1082011-10-24 10:30:23 -0600117}
Karthikeyan Ramasubramanian7bf5ca82011-11-21 13:33:19 -0700118
Eric Holmberg89c734b2012-01-30 12:45:54 -0700119static inline int msm_bam_dmux_is_ch_full(uint32_t id)
Karthikeyan Ramasubramanian7bf5ca82011-11-21 13:33:19 -0700120{
121 return -ENODEV;
122}
123
Eric Holmberg89c734b2012-01-30 12:45:54 -0700124static inline int msm_bam_dmux_is_ch_low(uint32_t id)
Karthikeyan Ramasubramanian7bf5ca82011-11-21 13:33:19 -0700125{
126 return -ENODEV;
127}
Jeff Hugocb798022012-04-09 14:55:40 -0600128
129static inline int msm_bam_dmux_reg_notify(void *priv,
130 void (*notify)(void *priv, int event_type,
131 unsigned long data))
132{
133 return -ENODEV;
134}
Manu Gautam7f808962011-08-29 16:38:07 +0530135#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700136#endif /* _BAM_DMUX_H */