blob: ede298d657cf3a885531f9a16142e3eff5556e8b [file] [log] [blame]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
2 *
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
14/*
15 * BAM DMUX module.
16 */
17
18#define DEBUG
19
20#include <linux/delay.h>
21#include <linux/module.h>
22#include <linux/netdevice.h>
23#include <linux/platform_device.h>
24#include <linux/sched.h>
25#include <linux/skbuff.h>
26#include <linux/debugfs.h>
Jeff Hugoaab7ebc2011-09-07 16:46:04 -060027#include <linux/clk.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070028
29#include <mach/sps.h>
30#include <mach/bam_dmux.h>
Jeff Hugoade1f842011-08-03 15:53:59 -060031#include <mach/msm_smsm.h>
Jeff Hugo6e7a92a2011-10-24 05:25:13 -060032#include <mach/subsystem_notif.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070033
34#define BAM_CH_LOCAL_OPEN 0x1
35#define BAM_CH_REMOTE_OPEN 0x2
Jeff Hugo6e7a92a2011-10-24 05:25:13 -060036#define BAM_CH_IN_RESET 0x4
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070037
38#define BAM_MUX_HDR_MAGIC_NO 0x33fc
39
40#define BAM_MUX_HDR_CMD_DATA 0
41#define BAM_MUX_HDR_CMD_OPEN 1
42#define BAM_MUX_HDR_CMD_CLOSE 2
43
Jeff Hugo949080a2011-08-30 11:58:56 -060044#define POLLING_MIN_SLEEP 950 /* 0.95 ms */
45#define POLLING_MAX_SLEEP 1050 /* 1.05 ms */
46#define POLLING_INACTIVITY 40 /* cycles before switch to intr mode */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070047
48
49static int msm_bam_dmux_debug_enable;
50module_param_named(debug_enable, msm_bam_dmux_debug_enable,
51 int, S_IRUGO | S_IWUSR | S_IWGRP);
52
53#if defined(DEBUG)
54static uint32_t bam_dmux_read_cnt;
55static uint32_t bam_dmux_write_cnt;
56static uint32_t bam_dmux_write_cpy_cnt;
57static uint32_t bam_dmux_write_cpy_bytes;
Eric Holmberg2fddbcd2011-11-28 18:25:57 -070058static uint32_t bam_dmux_tx_sps_failure_cnt;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070059
60#define DBG(x...) do { \
61 if (msm_bam_dmux_debug_enable) \
62 pr_debug(x); \
63 } while (0)
64
65#define DBG_INC_READ_CNT(x) do { \
66 bam_dmux_read_cnt += (x); \
67 if (msm_bam_dmux_debug_enable) \
68 pr_debug("%s: total read bytes %u\n", \
69 __func__, bam_dmux_read_cnt); \
70 } while (0)
71
72#define DBG_INC_WRITE_CNT(x) do { \
73 bam_dmux_write_cnt += (x); \
74 if (msm_bam_dmux_debug_enable) \
75 pr_debug("%s: total written bytes %u\n", \
76 __func__, bam_dmux_write_cnt); \
77 } while (0)
78
79#define DBG_INC_WRITE_CPY(x) do { \
80 bam_dmux_write_cpy_bytes += (x); \
81 bam_dmux_write_cpy_cnt++; \
82 if (msm_bam_dmux_debug_enable) \
83 pr_debug("%s: total write copy cnt %u, bytes %u\n", \
84 __func__, bam_dmux_write_cpy_cnt, \
85 bam_dmux_write_cpy_bytes); \
86 } while (0)
Eric Holmberg2fddbcd2011-11-28 18:25:57 -070087
88#define DBG_INC_TX_SPS_FAILURE_CNT() do { \
89 bam_dmux_tx_sps_failure_cnt++; \
90} while (0)
91
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070092#else
93#define DBG(x...) do { } while (0)
94#define DBG_INC_READ_CNT(x...) do { } while (0)
95#define DBG_INC_WRITE_CNT(x...) do { } while (0)
96#define DBG_INC_WRITE_CPY(x...) do { } while (0)
Eric Holmberg2fddbcd2011-11-28 18:25:57 -070097#define DBG_INC_TX_SPS_FAILURE_CNT() do { } while (0)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070098#endif
99
100struct bam_ch_info {
101 uint32_t status;
Jeff Hugo1c4531c2011-08-02 14:55:37 -0600102 void (*notify)(void *, int, unsigned long);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700103 void *priv;
104 spinlock_t lock;
Jeff Hugo7960abd2011-08-02 15:39:38 -0600105 struct platform_device *pdev;
106 char name[BAM_DMUX_CH_NAME_MAX_LEN];
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700107};
108
109struct tx_pkt_info {
110 struct sk_buff *skb;
111 dma_addr_t dma_address;
112 char is_cmd;
113 uint32_t len;
114 struct work_struct work;
Jeff Hugo6e7a92a2011-10-24 05:25:13 -0600115 struct list_head list_node;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700116};
117
118struct rx_pkt_info {
119 struct sk_buff *skb;
120 dma_addr_t dma_address;
121 struct work_struct work;
Jeff Hugo949080a2011-08-30 11:58:56 -0600122 struct list_head list_node;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700123};
124
125#define A2_NUM_PIPES 6
126#define A2_SUMMING_THRESHOLD 4096
127#define A2_DEFAULT_DESCRIPTORS 32
128#define A2_PHYS_BASE 0x124C2000
129#define A2_PHYS_SIZE 0x2000
130#define BUFFER_SIZE 2048
131#define NUM_BUFFERS 32
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700132static struct sps_bam_props a2_props;
Jeff Hugoaab7ebc2011-09-07 16:46:04 -0600133static u32 a2_device_handle;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700134static struct sps_pipe *bam_tx_pipe;
135static struct sps_pipe *bam_rx_pipe;
136static struct sps_connect tx_connection;
137static struct sps_connect rx_connection;
138static struct sps_mem_buffer tx_desc_mem_buf;
139static struct sps_mem_buffer rx_desc_mem_buf;
140static struct sps_register_event tx_register_event;
Jeff Hugo33dbc002011-08-25 15:52:53 -0600141static struct sps_register_event rx_register_event;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700142
143static struct bam_ch_info bam_ch[BAM_DMUX_NUM_CHANNELS];
144static int bam_mux_initialized;
145
Jeff Hugo949080a2011-08-30 11:58:56 -0600146static int polling_mode;
147
148static LIST_HEAD(bam_rx_pool);
Jeff Hugoc9749932011-11-02 17:50:40 -0600149static DEFINE_MUTEX(bam_rx_pool_mutexlock);
Jeff Hugo6e7a92a2011-10-24 05:25:13 -0600150static LIST_HEAD(bam_tx_pool);
Jeff Hugoc9749932011-11-02 17:50:40 -0600151static DEFINE_SPINLOCK(bam_tx_pool_spinlock);
Jeff Hugo949080a2011-08-30 11:58:56 -0600152
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700153struct bam_mux_hdr {
154 uint16_t magic_num;
155 uint8_t reserved;
156 uint8_t cmd;
157 uint8_t pad_len;
158 uint8_t ch_id;
159 uint16_t pkt_len;
160};
161
Jeff Hugod98b1082011-10-24 10:30:23 -0600162static void notify_all(int event, unsigned long data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700163static void bam_mux_write_done(struct work_struct *work);
164static void handle_bam_mux_cmd(struct work_struct *work);
Jeff Hugo949080a2011-08-30 11:58:56 -0600165static void rx_timer_work_func(struct work_struct *work);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700166
Jeff Hugo949080a2011-08-30 11:58:56 -0600167static DECLARE_WORK(rx_timer_work, rx_timer_work_func);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700168
169static struct workqueue_struct *bam_mux_rx_workqueue;
170static struct workqueue_struct *bam_mux_tx_workqueue;
171
Jeff Hugoaab7ebc2011-09-07 16:46:04 -0600172/* A2 power collaspe */
173#define UL_TIMEOUT_DELAY 1000 /* in ms */
174static void toggle_apps_ack(void);
175static void reconnect_to_bam(void);
176static void disconnect_to_bam(void);
177static void ul_wakeup(void);
178static void ul_timeout(struct work_struct *work);
179static void vote_dfab(void);
180static void unvote_dfab(void);
Jeff Hugod98b1082011-10-24 10:30:23 -0600181static void kickoff_ul_wakeup_func(struct work_struct *work);
Jeff Hugoaab7ebc2011-09-07 16:46:04 -0600182
183static int bam_is_connected;
184static DEFINE_MUTEX(wakeup_lock);
185static struct completion ul_wakeup_ack_completion;
186static struct completion bam_connection_completion;
187static struct delayed_work ul_timeout_work;
188static int ul_packet_written;
189static struct clk *dfab_clk;
190static DEFINE_RWLOCK(ul_wakeup_lock);
Jeff Hugod98b1082011-10-24 10:30:23 -0600191static DECLARE_WORK(kickoff_ul_wakeup, kickoff_ul_wakeup_func);
Jeff Hugo6e7a92a2011-10-24 05:25:13 -0600192static int bam_connection_is_active;
Jeff Hugoaab7ebc2011-09-07 16:46:04 -0600193/* End A2 power collaspe */
194
Jeff Hugo6e7a92a2011-10-24 05:25:13 -0600195/* subsystem restart */
196static int restart_notifier_cb(struct notifier_block *this,
197 unsigned long code,
198 void *data);
199
200static struct notifier_block restart_notifier = {
201 .notifier_call = restart_notifier_cb,
202};
203static int in_global_reset;
204/* end subsystem restart */
205
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700206#define bam_ch_is_open(x) \
207 (bam_ch[(x)].status == (BAM_CH_LOCAL_OPEN | BAM_CH_REMOTE_OPEN))
208
209#define bam_ch_is_local_open(x) \
210 (bam_ch[(x)].status & BAM_CH_LOCAL_OPEN)
211
212#define bam_ch_is_remote_open(x) \
213 (bam_ch[(x)].status & BAM_CH_REMOTE_OPEN)
214
Jeff Hugo6e7a92a2011-10-24 05:25:13 -0600215#define bam_ch_is_in_reset(x) \
216 (bam_ch[(x)].status & BAM_CH_IN_RESET)
217
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700218static void queue_rx(void)
219{
220 void *ptr;
221 struct rx_pkt_info *info;
222
Jeff Hugo6e7a92a2011-10-24 05:25:13 -0600223 if (in_global_reset)
224 return;
225
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700226 info = kmalloc(sizeof(struct rx_pkt_info), GFP_KERNEL);
227 if (!info)
228 return; /*need better way to handle this */
229
230 INIT_WORK(&info->work, handle_bam_mux_cmd);
231
232 info->skb = __dev_alloc_skb(BUFFER_SIZE, GFP_KERNEL);
233 ptr = skb_put(info->skb, BUFFER_SIZE);
Jeff Hugo949080a2011-08-30 11:58:56 -0600234
Jeff Hugoc9749932011-11-02 17:50:40 -0600235 mutex_lock(&bam_rx_pool_mutexlock);
Jeff Hugo949080a2011-08-30 11:58:56 -0600236 list_add_tail(&info->list_node, &bam_rx_pool);
Jeff Hugoc9749932011-11-02 17:50:40 -0600237 mutex_unlock(&bam_rx_pool_mutexlock);
Jeff Hugo949080a2011-08-30 11:58:56 -0600238
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700239 /* need a way to handle error case */
240 info->dma_address = dma_map_single(NULL, ptr, BUFFER_SIZE,
241 DMA_FROM_DEVICE);
242 sps_transfer_one(bam_rx_pipe, info->dma_address,
Jeff Hugo33dbc002011-08-25 15:52:53 -0600243 BUFFER_SIZE, info,
244 SPS_IOVEC_FLAG_INT | SPS_IOVEC_FLAG_EOT);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700245}
246
247static void bam_mux_process_data(struct sk_buff *rx_skb)
248{
249 unsigned long flags;
250 struct bam_mux_hdr *rx_hdr;
Jeff Hugo1c4531c2011-08-02 14:55:37 -0600251 unsigned long event_data;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700252
253 rx_hdr = (struct bam_mux_hdr *)rx_skb->data;
254
255 rx_skb->data = (unsigned char *)(rx_hdr + 1);
256 rx_skb->tail = rx_skb->data + rx_hdr->pkt_len;
257 rx_skb->len = rx_hdr->pkt_len;
Jeff Hugoee88f672011-10-04 17:14:52 -0600258 rx_skb->truesize = rx_hdr->pkt_len + sizeof(struct sk_buff);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700259
Jeff Hugo1c4531c2011-08-02 14:55:37 -0600260 event_data = (unsigned long)(rx_skb);
261
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700262 spin_lock_irqsave(&bam_ch[rx_hdr->ch_id].lock, flags);
Jeff Hugo1c4531c2011-08-02 14:55:37 -0600263 if (bam_ch[rx_hdr->ch_id].notify)
264 bam_ch[rx_hdr->ch_id].notify(
265 bam_ch[rx_hdr->ch_id].priv, BAM_DMUX_RECEIVE,
266 event_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700267 else
268 dev_kfree_skb_any(rx_skb);
269 spin_unlock_irqrestore(&bam_ch[rx_hdr->ch_id].lock, flags);
270
271 queue_rx();
272}
273
274static void handle_bam_mux_cmd(struct work_struct *work)
275{
276 unsigned long flags;
277 struct bam_mux_hdr *rx_hdr;
278 struct rx_pkt_info *info;
279 struct sk_buff *rx_skb;
Jeff Hugo7960abd2011-08-02 15:39:38 -0600280 int ret;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700281
282 info = container_of(work, struct rx_pkt_info, work);
283 rx_skb = info->skb;
Jeff Hugo949080a2011-08-30 11:58:56 -0600284 dma_unmap_single(NULL, info->dma_address, BUFFER_SIZE, DMA_FROM_DEVICE);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700285 kfree(info);
286
287 rx_hdr = (struct bam_mux_hdr *)rx_skb->data;
288
289 DBG_INC_READ_CNT(sizeof(struct bam_mux_hdr));
290 DBG("%s: magic %x reserved %d cmd %d pad %d ch %d len %d\n", __func__,
291 rx_hdr->magic_num, rx_hdr->reserved, rx_hdr->cmd,
292 rx_hdr->pad_len, rx_hdr->ch_id, rx_hdr->pkt_len);
293 if (rx_hdr->magic_num != BAM_MUX_HDR_MAGIC_NO) {
294 pr_err("%s: dropping invalid hdr. magic %x reserved %d cmd %d"
295 " pad %d ch %d len %d\n", __func__,
296 rx_hdr->magic_num, rx_hdr->reserved, rx_hdr->cmd,
297 rx_hdr->pad_len, rx_hdr->ch_id, rx_hdr->pkt_len);
298 dev_kfree_skb_any(rx_skb);
299 queue_rx();
300 return;
301 }
Eric Holmberg9ff40a52011-11-17 19:17:00 -0700302
303 if (rx_hdr->ch_id >= BAM_DMUX_NUM_CHANNELS) {
304 pr_err("%s: dropping invalid LCID %d reserved %d cmd %d"
305 " pad %d ch %d len %d\n", __func__,
306 rx_hdr->ch_id, rx_hdr->reserved, rx_hdr->cmd,
307 rx_hdr->pad_len, rx_hdr->ch_id, rx_hdr->pkt_len);
308 dev_kfree_skb_any(rx_skb);
309 queue_rx();
310 return;
311 }
312
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700313 switch (rx_hdr->cmd) {
314 case BAM_MUX_HDR_CMD_DATA:
315 DBG_INC_READ_CNT(rx_hdr->pkt_len);
316 bam_mux_process_data(rx_skb);
317 break;
318 case BAM_MUX_HDR_CMD_OPEN:
319 spin_lock_irqsave(&bam_ch[rx_hdr->ch_id].lock, flags);
320 bam_ch[rx_hdr->ch_id].status |= BAM_CH_REMOTE_OPEN;
321 spin_unlock_irqrestore(&bam_ch[rx_hdr->ch_id].lock, flags);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700322 queue_rx();
Jeff Hugo7960abd2011-08-02 15:39:38 -0600323 ret = platform_device_add(bam_ch[rx_hdr->ch_id].pdev);
324 if (ret)
325 pr_err("%s: platform_device_add() error: %d\n",
326 __func__, ret);
Eric Holmberge779dba2011-11-04 18:22:01 -0600327 dev_kfree_skb_any(rx_skb);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700328 break;
329 case BAM_MUX_HDR_CMD_CLOSE:
330 /* probably should drop pending write */
331 spin_lock_irqsave(&bam_ch[rx_hdr->ch_id].lock, flags);
332 bam_ch[rx_hdr->ch_id].status &= ~BAM_CH_REMOTE_OPEN;
333 spin_unlock_irqrestore(&bam_ch[rx_hdr->ch_id].lock, flags);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700334 queue_rx();
Jeff Hugo7960abd2011-08-02 15:39:38 -0600335 platform_device_unregister(bam_ch[rx_hdr->ch_id].pdev);
336 bam_ch[rx_hdr->ch_id].pdev =
337 platform_device_alloc(bam_ch[rx_hdr->ch_id].name, 2);
338 if (!bam_ch[rx_hdr->ch_id].pdev)
339 pr_err("%s: platform_device_alloc failed\n", __func__);
Eric Holmberge779dba2011-11-04 18:22:01 -0600340 dev_kfree_skb_any(rx_skb);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700341 break;
342 default:
343 pr_err("%s: dropping invalid hdr. magic %x reserved %d cmd %d"
344 " pad %d ch %d len %d\n", __func__,
345 rx_hdr->magic_num, rx_hdr->reserved, rx_hdr->cmd,
346 rx_hdr->pad_len, rx_hdr->ch_id, rx_hdr->pkt_len);
347 dev_kfree_skb_any(rx_skb);
348 queue_rx();
349 return;
350 }
351}
352
353static int bam_mux_write_cmd(void *data, uint32_t len)
354{
355 int rc;
356 struct tx_pkt_info *pkt;
357 dma_addr_t dma_address;
358
Eric Holmbergd83cd2b2011-11-04 15:54:17 -0600359 pkt = kmalloc(sizeof(struct tx_pkt_info), GFP_ATOMIC);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700360 if (pkt == NULL) {
361 pr_err("%s: mem alloc for tx_pkt_info failed\n", __func__);
362 rc = -ENOMEM;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700363 return rc;
364 }
365
366 dma_address = dma_map_single(NULL, data, len,
367 DMA_TO_DEVICE);
368 if (!dma_address) {
369 pr_err("%s: dma_map_single() failed\n", __func__);
370 rc = -ENOMEM;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700371 return rc;
372 }
373 pkt->skb = (struct sk_buff *)(data);
374 pkt->len = len;
375 pkt->dma_address = dma_address;
376 pkt->is_cmd = 1;
Jeff Hugo6e7a92a2011-10-24 05:25:13 -0600377 INIT_WORK(&pkt->work, bam_mux_write_done);
Jeff Hugoc9749932011-11-02 17:50:40 -0600378 spin_lock(&bam_tx_pool_spinlock);
Jeff Hugo6e7a92a2011-10-24 05:25:13 -0600379 list_add_tail(&pkt->list_node, &bam_tx_pool);
Jeff Hugoc9749932011-11-02 17:50:40 -0600380 spin_unlock(&bam_tx_pool_spinlock);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700381 rc = sps_transfer_one(bam_tx_pipe, dma_address, len,
382 pkt, SPS_IOVEC_FLAG_INT | SPS_IOVEC_FLAG_EOT);
Jeff Hugo7b80c802011-11-04 16:12:20 -0600383 if (rc) {
384 DBG("%s sps_transfer_one failed rc=%d\n", __func__, rc);
385 spin_lock(&bam_tx_pool_spinlock);
386 list_del(&pkt->list_node);
Eric Holmberg2fddbcd2011-11-28 18:25:57 -0700387 DBG_INC_TX_SPS_FAILURE_CNT();
Jeff Hugo7b80c802011-11-04 16:12:20 -0600388 spin_unlock(&bam_tx_pool_spinlock);
389 kfree(pkt);
390 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700391
Jeff Hugoaab7ebc2011-09-07 16:46:04 -0600392 ul_packet_written = 1;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700393 return rc;
394}
395
396static void bam_mux_write_done(struct work_struct *work)
397{
398 struct sk_buff *skb;
399 struct bam_mux_hdr *hdr;
400 struct tx_pkt_info *info;
Jeff Hugo1c4531c2011-08-02 14:55:37 -0600401 unsigned long event_data;
Jeff Hugo6e7a92a2011-10-24 05:25:13 -0600402 struct list_head *node;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700403
Jeff Hugo6e7a92a2011-10-24 05:25:13 -0600404 if (in_global_reset)
405 return;
Jeff Hugoc9749932011-11-02 17:50:40 -0600406 spin_lock(&bam_tx_pool_spinlock);
Jeff Hugo6e7a92a2011-10-24 05:25:13 -0600407 node = bam_tx_pool.next;
408 list_del(node);
Jeff Hugoc9749932011-11-02 17:50:40 -0600409 spin_unlock(&bam_tx_pool_spinlock);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700410 info = container_of(work, struct tx_pkt_info, work);
Jeff Hugo6e7a92a2011-10-24 05:25:13 -0600411 if (info->is_cmd) {
412 kfree(info->skb);
413 kfree(info);
414 return;
415 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700416 skb = info->skb;
417 kfree(info);
418 hdr = (struct bam_mux_hdr *)skb->data;
419 DBG_INC_WRITE_CNT(skb->data_len);
Jeff Hugo1c4531c2011-08-02 14:55:37 -0600420 event_data = (unsigned long)(skb);
421 if (bam_ch[hdr->ch_id].notify)
422 bam_ch[hdr->ch_id].notify(
423 bam_ch[hdr->ch_id].priv, BAM_DMUX_WRITE_DONE,
424 event_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700425 else
426 dev_kfree_skb_any(skb);
427}
428
429int msm_bam_dmux_write(uint32_t id, struct sk_buff *skb)
430{
431 int rc = 0;
432 struct bam_mux_hdr *hdr;
433 unsigned long flags;
434 struct sk_buff *new_skb = NULL;
435 dma_addr_t dma_address;
436 struct tx_pkt_info *pkt;
437
438 if (id >= BAM_DMUX_NUM_CHANNELS)
439 return -EINVAL;
440 if (!skb)
441 return -EINVAL;
442 if (!bam_mux_initialized)
443 return -ENODEV;
444
445 DBG("%s: writing to ch %d len %d\n", __func__, id, skb->len);
446 spin_lock_irqsave(&bam_ch[id].lock, flags);
447 if (!bam_ch_is_open(id)) {
448 spin_unlock_irqrestore(&bam_ch[id].lock, flags);
449 pr_err("%s: port not open: %d\n", __func__, bam_ch[id].status);
450 return -ENODEV;
451 }
452 spin_unlock_irqrestore(&bam_ch[id].lock, flags);
453
Jeff Hugoaab7ebc2011-09-07 16:46:04 -0600454 read_lock(&ul_wakeup_lock);
Jeff Hugo061ce672011-10-21 17:15:32 -0600455 if (!bam_is_connected) {
456 read_unlock(&ul_wakeup_lock);
Jeff Hugoaab7ebc2011-09-07 16:46:04 -0600457 ul_wakeup();
Jeff Hugo061ce672011-10-21 17:15:32 -0600458 read_lock(&ul_wakeup_lock);
Jeff Hugod98b1082011-10-24 10:30:23 -0600459 notify_all(BAM_DMUX_UL_CONNECTED, (unsigned long)(NULL));
Jeff Hugo061ce672011-10-21 17:15:32 -0600460 }
Jeff Hugoaab7ebc2011-09-07 16:46:04 -0600461
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700462 /* if skb do not have any tailroom for padding,
463 copy the skb into a new expanded skb */
464 if ((skb->len & 0x3) && (skb_tailroom(skb) < (4 - (skb->len & 0x3)))) {
465 /* revisit, probably dev_alloc_skb and memcpy is effecient */
466 new_skb = skb_copy_expand(skb, skb_headroom(skb),
467 4 - (skb->len & 0x3), GFP_ATOMIC);
468 if (new_skb == NULL) {
469 pr_err("%s: cannot allocate skb\n", __func__);
Jeff Hugoc6af54d2011-11-02 17:00:27 -0600470 goto write_fail;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700471 }
472 dev_kfree_skb_any(skb);
473 skb = new_skb;
474 DBG_INC_WRITE_CPY(skb->len);
475 }
476
477 hdr = (struct bam_mux_hdr *)skb_push(skb, sizeof(struct bam_mux_hdr));
478
479 /* caller should allocate for hdr and padding
480 hdr is fine, padding is tricky */
481 hdr->magic_num = BAM_MUX_HDR_MAGIC_NO;
482 hdr->cmd = BAM_MUX_HDR_CMD_DATA;
483 hdr->reserved = 0;
484 hdr->ch_id = id;
485 hdr->pkt_len = skb->len - sizeof(struct bam_mux_hdr);
486 if (skb->len & 0x3)
487 skb_put(skb, 4 - (skb->len & 0x3));
488
489 hdr->pad_len = skb->len - (sizeof(struct bam_mux_hdr) + hdr->pkt_len);
490
491 DBG("%s: data %p, tail %p skb len %d pkt len %d pad len %d\n",
492 __func__, skb->data, skb->tail, skb->len,
493 hdr->pkt_len, hdr->pad_len);
494
495 pkt = kmalloc(sizeof(struct tx_pkt_info), GFP_ATOMIC);
496 if (pkt == NULL) {
497 pr_err("%s: mem alloc for tx_pkt_info failed\n", __func__);
Jeff Hugoc6af54d2011-11-02 17:00:27 -0600498 goto write_fail2;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700499 }
500
501 dma_address = dma_map_single(NULL, skb->data, skb->len,
502 DMA_TO_DEVICE);
503 if (!dma_address) {
504 pr_err("%s: dma_map_single() failed\n", __func__);
Jeff Hugoc6af54d2011-11-02 17:00:27 -0600505 goto write_fail3;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700506 }
507 pkt->skb = skb;
508 pkt->dma_address = dma_address;
509 pkt->is_cmd = 0;
510 INIT_WORK(&pkt->work, bam_mux_write_done);
Jeff Hugoc9749932011-11-02 17:50:40 -0600511 spin_lock(&bam_tx_pool_spinlock);
Jeff Hugo6e7a92a2011-10-24 05:25:13 -0600512 list_add_tail(&pkt->list_node, &bam_tx_pool);
Jeff Hugoc9749932011-11-02 17:50:40 -0600513 spin_unlock(&bam_tx_pool_spinlock);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700514 rc = sps_transfer_one(bam_tx_pipe, dma_address, skb->len,
515 pkt, SPS_IOVEC_FLAG_INT | SPS_IOVEC_FLAG_EOT);
Jeff Hugo7b80c802011-11-04 16:12:20 -0600516 if (rc) {
517 DBG("%s sps_transfer_one failed rc=%d\n", __func__, rc);
518 spin_lock(&bam_tx_pool_spinlock);
519 list_del(&pkt->list_node);
Eric Holmberg2fddbcd2011-11-28 18:25:57 -0700520 DBG_INC_TX_SPS_FAILURE_CNT();
Jeff Hugo7b80c802011-11-04 16:12:20 -0600521 spin_unlock(&bam_tx_pool_spinlock);
522 kfree(pkt);
523 }
Jeff Hugoaab7ebc2011-09-07 16:46:04 -0600524 ul_packet_written = 1;
525 read_unlock(&ul_wakeup_lock);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700526 return rc;
Jeff Hugoc6af54d2011-11-02 17:00:27 -0600527
528write_fail3:
529 kfree(pkt);
530write_fail2:
531 if (new_skb)
532 dev_kfree_skb_any(new_skb);
533write_fail:
534 read_unlock(&ul_wakeup_lock);
535 return -ENOMEM;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700536}
537
538int msm_bam_dmux_open(uint32_t id, void *priv,
Jeff Hugo1c4531c2011-08-02 14:55:37 -0600539 void (*notify)(void *, int, unsigned long))
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700540{
541 struct bam_mux_hdr *hdr;
542 unsigned long flags;
543 int rc = 0;
544
545 DBG("%s: opening ch %d\n", __func__, id);
Eric Holmberg5d775432011-11-09 10:23:35 -0700546 if (!bam_mux_initialized) {
547 DBG("%s: not inititialized\n", __func__);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700548 return -ENODEV;
Eric Holmberg5d775432011-11-09 10:23:35 -0700549 }
550 if (id >= BAM_DMUX_NUM_CHANNELS) {
551 pr_err("%s: invalid channel id %d\n", __func__, id);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700552 return -EINVAL;
Eric Holmberg5d775432011-11-09 10:23:35 -0700553 }
554 if (notify == NULL) {
555 pr_err("%s: notify function is NULL\n", __func__);
Jeff Hugo1c4531c2011-08-02 14:55:37 -0600556 return -EINVAL;
Eric Holmberg5d775432011-11-09 10:23:35 -0700557 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700558
559 hdr = kmalloc(sizeof(struct bam_mux_hdr), GFP_KERNEL);
560 if (hdr == NULL) {
561 pr_err("%s: hdr kmalloc failed. ch: %d\n", __func__, id);
562 return -ENOMEM;
563 }
564 spin_lock_irqsave(&bam_ch[id].lock, flags);
565 if (bam_ch_is_open(id)) {
566 DBG("%s: Already opened %d\n", __func__, id);
567 spin_unlock_irqrestore(&bam_ch[id].lock, flags);
568 kfree(hdr);
569 goto open_done;
570 }
571 if (!bam_ch_is_remote_open(id)) {
572 DBG("%s: Remote not open; ch: %d\n", __func__, id);
573 spin_unlock_irqrestore(&bam_ch[id].lock, flags);
574 kfree(hdr);
Eric Holmberg5d775432011-11-09 10:23:35 -0700575 return -ENODEV;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700576 }
577
Jeff Hugo1c4531c2011-08-02 14:55:37 -0600578 bam_ch[id].notify = notify;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700579 bam_ch[id].priv = priv;
580 bam_ch[id].status |= BAM_CH_LOCAL_OPEN;
581 spin_unlock_irqrestore(&bam_ch[id].lock, flags);
582
Jeff Hugoaab7ebc2011-09-07 16:46:04 -0600583 read_lock(&ul_wakeup_lock);
Jeff Hugo061ce672011-10-21 17:15:32 -0600584 if (!bam_is_connected) {
585 read_unlock(&ul_wakeup_lock);
Jeff Hugoaab7ebc2011-09-07 16:46:04 -0600586 ul_wakeup();
Jeff Hugo061ce672011-10-21 17:15:32 -0600587 read_lock(&ul_wakeup_lock);
Jeff Hugod98b1082011-10-24 10:30:23 -0600588 notify_all(BAM_DMUX_UL_CONNECTED, (unsigned long)(NULL));
Jeff Hugo061ce672011-10-21 17:15:32 -0600589 }
Jeff Hugoaab7ebc2011-09-07 16:46:04 -0600590
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700591 hdr->magic_num = BAM_MUX_HDR_MAGIC_NO;
592 hdr->cmd = BAM_MUX_HDR_CMD_OPEN;
593 hdr->reserved = 0;
594 hdr->ch_id = id;
595 hdr->pkt_len = 0;
596 hdr->pad_len = 0;
597
598 rc = bam_mux_write_cmd((void *)hdr, sizeof(struct bam_mux_hdr));
Jeff Hugoaab7ebc2011-09-07 16:46:04 -0600599 read_unlock(&ul_wakeup_lock);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700600
601open_done:
602 DBG("%s: opened ch %d\n", __func__, id);
603 return rc;
604}
605
606int msm_bam_dmux_close(uint32_t id)
607{
608 struct bam_mux_hdr *hdr;
609 unsigned long flags;
610 int rc;
611
612 if (id >= BAM_DMUX_NUM_CHANNELS)
613 return -EINVAL;
614 DBG("%s: closing ch %d\n", __func__, id);
615 if (!bam_mux_initialized)
616 return -ENODEV;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700617
Jeff Hugoaab7ebc2011-09-07 16:46:04 -0600618 read_lock(&ul_wakeup_lock);
Jeff Hugo6e7a92a2011-10-24 05:25:13 -0600619 if (!bam_is_connected && !bam_ch_is_in_reset(id)) {
Jeff Hugo061ce672011-10-21 17:15:32 -0600620 read_unlock(&ul_wakeup_lock);
Jeff Hugoaab7ebc2011-09-07 16:46:04 -0600621 ul_wakeup();
Jeff Hugo061ce672011-10-21 17:15:32 -0600622 read_lock(&ul_wakeup_lock);
Jeff Hugod98b1082011-10-24 10:30:23 -0600623 notify_all(BAM_DMUX_UL_CONNECTED, (unsigned long)(NULL));
Jeff Hugo061ce672011-10-21 17:15:32 -0600624 }
Jeff Hugoaab7ebc2011-09-07 16:46:04 -0600625
Jeff Hugo061ce672011-10-21 17:15:32 -0600626 spin_lock_irqsave(&bam_ch[id].lock, flags);
Jeff Hugo1c4531c2011-08-02 14:55:37 -0600627 bam_ch[id].notify = NULL;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700628 bam_ch[id].priv = NULL;
629 bam_ch[id].status &= ~BAM_CH_LOCAL_OPEN;
630 spin_unlock_irqrestore(&bam_ch[id].lock, flags);
631
Jeff Hugo6e7a92a2011-10-24 05:25:13 -0600632 if (bam_ch_is_in_reset(id)) {
633 read_unlock(&ul_wakeup_lock);
634 bam_ch[id].status &= ~BAM_CH_IN_RESET;
635 return 0;
636 }
637
Jeff Hugobb5802f2011-11-02 17:10:29 -0600638 hdr = kmalloc(sizeof(struct bam_mux_hdr), GFP_ATOMIC);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700639 if (hdr == NULL) {
640 pr_err("%s: hdr kmalloc failed. ch: %d\n", __func__, id);
Jeff Hugoc6af54d2011-11-02 17:00:27 -0600641 read_unlock(&ul_wakeup_lock);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700642 return -ENOMEM;
643 }
644 hdr->magic_num = BAM_MUX_HDR_MAGIC_NO;
645 hdr->cmd = BAM_MUX_HDR_CMD_CLOSE;
646 hdr->reserved = 0;
647 hdr->ch_id = id;
648 hdr->pkt_len = 0;
649 hdr->pad_len = 0;
650
651 rc = bam_mux_write_cmd((void *)hdr, sizeof(struct bam_mux_hdr));
Jeff Hugoaab7ebc2011-09-07 16:46:04 -0600652 read_unlock(&ul_wakeup_lock);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700653
654 DBG("%s: closed ch %d\n", __func__, id);
655 return rc;
656}
657
Jeff Hugo949080a2011-08-30 11:58:56 -0600658static void rx_timer_work_func(struct work_struct *work)
659{
660 struct sps_iovec iov;
661 struct list_head *node;
662 struct rx_pkt_info *info;
663 int inactive_cycles = 0;
664 int ret;
665 struct sps_connect cur_rx_conn;
666
667 while (1) { /* timer loop */
668 ++inactive_cycles;
669 while (1) { /* deplete queue loop */
Jeff Hugo6e7a92a2011-10-24 05:25:13 -0600670 if (in_global_reset)
671 return;
Jeff Hugo949080a2011-08-30 11:58:56 -0600672 sps_get_iovec(bam_rx_pipe, &iov);
673 if (iov.addr == 0)
674 break;
675 inactive_cycles = 0;
Jeff Hugoc9749932011-11-02 17:50:40 -0600676 mutex_lock(&bam_rx_pool_mutexlock);
Jeff Hugo949080a2011-08-30 11:58:56 -0600677 node = bam_rx_pool.next;
678 list_del(node);
Jeff Hugoc9749932011-11-02 17:50:40 -0600679 mutex_unlock(&bam_rx_pool_mutexlock);
Jeff Hugo949080a2011-08-30 11:58:56 -0600680 info = container_of(node, struct rx_pkt_info,
681 list_node);
682 handle_bam_mux_cmd(&info->work);
683 }
684
685 if (inactive_cycles == POLLING_INACTIVITY) {
686 /*
687 * attempt to enable interrupts in this pipe
688 * if enabling interrupts fails, continue polling
689 */
690 ret = sps_get_config(bam_rx_pipe, &cur_rx_conn);
691 if (ret) {
692 pr_err("%s: sps_get_config() failed, interrupts"
693 " not enabled\n", __func__);
694 queue_work(bam_mux_rx_workqueue,
695 &rx_timer_work);
696 return;
697 } else {
698 rx_register_event.options = SPS_O_EOT;
699 /* should check return value */
700 sps_register_event(bam_rx_pipe,
701 &rx_register_event);
702 cur_rx_conn.options = SPS_O_AUTO_ENABLE |
703 SPS_O_EOT | SPS_O_ACK_TRANSFERS;
704 ret = sps_set_config(bam_rx_pipe, &cur_rx_conn);
705 if (ret) {
706 pr_err("%s: sps_set_config() failed, "
707 "interrupts not enabled\n",
708 __func__);
709 queue_work(bam_mux_rx_workqueue,
710 &rx_timer_work);
711 return;
712 }
713 polling_mode = 0;
714 }
Jeff Hugo6e7a92a2011-10-24 05:25:13 -0600715 if (in_global_reset)
716 return;
Jeff Hugo949080a2011-08-30 11:58:56 -0600717 /* handle race condition - missed packet? */
718 sps_get_iovec(bam_rx_pipe, &iov);
719 if (iov.addr == 0)
720 return;
721 inactive_cycles = 0;
Jeff Hugoc9749932011-11-02 17:50:40 -0600722 mutex_lock(&bam_rx_pool_mutexlock);
Jeff Hugo949080a2011-08-30 11:58:56 -0600723 node = bam_rx_pool.next;
724 list_del(node);
Jeff Hugoc9749932011-11-02 17:50:40 -0600725 mutex_unlock(&bam_rx_pool_mutexlock);
Jeff Hugo949080a2011-08-30 11:58:56 -0600726 info = container_of(node, struct rx_pkt_info,
727 list_node);
728 handle_bam_mux_cmd(&info->work);
729 return;
730 }
731
732 usleep_range(POLLING_MIN_SLEEP, POLLING_MAX_SLEEP);
733 }
734}
735
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700736static void bam_mux_tx_notify(struct sps_event_notify *notify)
737{
738 struct tx_pkt_info *pkt;
739
740 DBG("%s: event %d notified\n", __func__, notify->event_id);
741
Jeff Hugo6e7a92a2011-10-24 05:25:13 -0600742 if (in_global_reset)
743 return;
744
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700745 switch (notify->event_id) {
746 case SPS_EVENT_EOT:
747 pkt = notify->data.transfer.user;
Jeff Hugo6e7a92a2011-10-24 05:25:13 -0600748 if (!pkt->is_cmd)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700749 dma_unmap_single(NULL, pkt->dma_address,
750 pkt->skb->len,
751 DMA_TO_DEVICE);
Jeff Hugo6e7a92a2011-10-24 05:25:13 -0600752 else
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700753 dma_unmap_single(NULL, pkt->dma_address,
754 pkt->len,
755 DMA_TO_DEVICE);
Jeff Hugo6e7a92a2011-10-24 05:25:13 -0600756 queue_work(bam_mux_tx_workqueue, &pkt->work);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700757 break;
758 default:
759 pr_err("%s: recieved unexpected event id %d\n", __func__,
760 notify->event_id);
761 }
762}
763
Jeff Hugo33dbc002011-08-25 15:52:53 -0600764static void bam_mux_rx_notify(struct sps_event_notify *notify)
765{
Jeff Hugo949080a2011-08-30 11:58:56 -0600766 int ret;
767 struct sps_connect cur_rx_conn;
Jeff Hugo33dbc002011-08-25 15:52:53 -0600768
769 DBG("%s: event %d notified\n", __func__, notify->event_id);
770
Jeff Hugo6e7a92a2011-10-24 05:25:13 -0600771 if (in_global_reset)
772 return;
773
Jeff Hugo33dbc002011-08-25 15:52:53 -0600774 switch (notify->event_id) {
775 case SPS_EVENT_EOT:
Jeff Hugo949080a2011-08-30 11:58:56 -0600776 /* attempt to disable interrupts in this pipe */
777 if (!polling_mode) {
778 ret = sps_get_config(bam_rx_pipe, &cur_rx_conn);
779 if (ret) {
780 pr_err("%s: sps_get_config() failed, interrupts"
781 " not disabled\n", __func__);
782 break;
783 }
784 rx_register_event.options = 0;
785 ret = sps_register_event(bam_rx_pipe,
786 &rx_register_event);
787 if (ret) {
788 pr_err("%s: sps_register_event ret = %d\n",
789 __func__, ret);
790 break;
791 }
792 cur_rx_conn.options = SPS_O_AUTO_ENABLE | SPS_O_EOT |
793 SPS_O_ACK_TRANSFERS | SPS_O_POLL;
794 ret = sps_set_config(bam_rx_pipe, &cur_rx_conn);
795 if (ret) {
796 pr_err("%s: sps_set_config() failed, interrupts"
797 " not disabled\n", __func__);
798 break;
799 }
800 polling_mode = 1;
801 queue_work(bam_mux_rx_workqueue, &rx_timer_work);
802 }
Jeff Hugo33dbc002011-08-25 15:52:53 -0600803 break;
804 default:
805 pr_err("%s: recieved unexpected event id %d\n", __func__,
806 notify->event_id);
807 }
808}
809
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700810#ifdef CONFIG_DEBUG_FS
811
812static int debug_tbl(char *buf, int max)
813{
814 int i = 0;
815 int j;
816
817 for (j = 0; j < BAM_DMUX_NUM_CHANNELS; ++j) {
818 i += scnprintf(buf + i, max - i,
819 "ch%02d local open=%s remote open=%s\n",
820 j, bam_ch_is_local_open(j) ? "Y" : "N",
821 bam_ch_is_remote_open(j) ? "Y" : "N");
822 }
823
824 return i;
825}
826
Eric Holmberg2fddbcd2011-11-28 18:25:57 -0700827static int debug_ul_pkt_cnt(char *buf, int max)
828{
829 struct list_head *p;
830 unsigned long flags;
831 int n = 0;
832
833 spin_lock_irqsave(&bam_tx_pool_spinlock, flags);
834 __list_for_each(p, &bam_tx_pool) {
835 ++n;
836 }
837 spin_unlock_irqrestore(&bam_tx_pool_spinlock, flags);
838
839 return scnprintf(buf, max, "Number of UL packets in flight: %d\n", n);
840}
841
842static int debug_stats(char *buf, int max)
843{
844 int i = 0;
845
846 i += scnprintf(buf + i, max - i,
847 "skb copy cnt: %u\n"
848 "skb copy bytes: %u\n"
849 "sps tx failures: %u\n",
850 bam_dmux_write_cpy_cnt,
851 bam_dmux_write_cpy_bytes,
852 bam_dmux_tx_sps_failure_cnt
853 );
854
855 return i;
856}
857
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700858#define DEBUG_BUFMAX 4096
859static char debug_buffer[DEBUG_BUFMAX];
860
861static ssize_t debug_read(struct file *file, char __user *buf,
862 size_t count, loff_t *ppos)
863{
864 int (*fill)(char *buf, int max) = file->private_data;
865 int bsize = fill(debug_buffer, DEBUG_BUFMAX);
866 return simple_read_from_buffer(buf, count, ppos, debug_buffer, bsize);
867}
868
869static int debug_open(struct inode *inode, struct file *file)
870{
871 file->private_data = inode->i_private;
872 return 0;
873}
874
875
876static const struct file_operations debug_ops = {
877 .read = debug_read,
878 .open = debug_open,
879};
880
881static void debug_create(const char *name, mode_t mode,
882 struct dentry *dent,
883 int (*fill)(char *buf, int max))
884{
885 debugfs_create_file(name, mode, dent, fill, &debug_ops);
886}
887
888#endif
889
Jeff Hugod98b1082011-10-24 10:30:23 -0600890static void notify_all(int event, unsigned long data)
891{
892 int i;
893
894 for (i = 0; i < BAM_DMUX_NUM_CHANNELS; ++i) {
895 if (bam_ch_is_open(i))
896 bam_ch[i].notify(bam_ch[i].priv, event, data);
897 }
898}
899
900static void kickoff_ul_wakeup_func(struct work_struct *work)
901{
902 read_lock(&ul_wakeup_lock);
903 if (!bam_is_connected) {
904 read_unlock(&ul_wakeup_lock);
905 ul_wakeup();
906 read_lock(&ul_wakeup_lock);
907 ul_packet_written = 1;
908 notify_all(BAM_DMUX_UL_CONNECTED, (unsigned long)(NULL));
909 }
910 read_unlock(&ul_wakeup_lock);
911}
912
913void msm_bam_dmux_kickoff_ul_wakeup(void)
914{
915 queue_work(bam_mux_tx_workqueue, &kickoff_ul_wakeup);
916}
917
Jeff Hugoaab7ebc2011-09-07 16:46:04 -0600918static void ul_timeout(struct work_struct *work)
919{
Jeff Hugoc040a5b2011-11-15 14:26:01 -0700920 unsigned long flags;
921 int ret;
922
Jeff Hugo6e7a92a2011-10-24 05:25:13 -0600923 if (in_global_reset)
924 return;
Jeff Hugoc040a5b2011-11-15 14:26:01 -0700925 ret = write_trylock_irqsave(&ul_wakeup_lock, flags);
926 if (!ret) { /* failed to grab lock, reschedule and bail */
927 schedule_delayed_work(&ul_timeout_work,
928 msecs_to_jiffies(UL_TIMEOUT_DELAY));
929 return;
930 }
Jeff Hugoaab7ebc2011-09-07 16:46:04 -0600931 if (ul_packet_written) {
932 ul_packet_written = 0;
933 schedule_delayed_work(&ul_timeout_work,
934 msecs_to_jiffies(UL_TIMEOUT_DELAY));
935 } else {
936 smsm_change_state(SMSM_APPS_STATE, SMSM_A2_POWER_CONTROL, 0);
937 bam_is_connected = 0;
Jeff Hugod98b1082011-10-24 10:30:23 -0600938 notify_all(BAM_DMUX_UL_DISCONNECTED, (unsigned long)(NULL));
Jeff Hugoaab7ebc2011-09-07 16:46:04 -0600939 }
Jeff Hugoc040a5b2011-11-15 14:26:01 -0700940 write_unlock_irqrestore(&ul_wakeup_lock, flags);
Jeff Hugoaab7ebc2011-09-07 16:46:04 -0600941}
942static void ul_wakeup(void)
943{
944 mutex_lock(&wakeup_lock);
945 if (bam_is_connected) { /* bam got connected before lock grabbed */
946 mutex_unlock(&wakeup_lock);
947 return;
948 }
949 INIT_COMPLETION(ul_wakeup_ack_completion);
950 smsm_change_state(SMSM_APPS_STATE, 0, SMSM_A2_POWER_CONTROL);
951 wait_for_completion_interruptible_timeout(&ul_wakeup_ack_completion,
952 HZ);
953 wait_for_completion_interruptible_timeout(&bam_connection_completion,
954 HZ);
955
956 bam_is_connected = 1;
957 schedule_delayed_work(&ul_timeout_work,
958 msecs_to_jiffies(UL_TIMEOUT_DELAY));
959 mutex_unlock(&wakeup_lock);
960}
961
962static void reconnect_to_bam(void)
963{
964 int i;
965
Jeff Hugo6e7a92a2011-10-24 05:25:13 -0600966 in_global_reset = 0;
Jeff Hugoaab7ebc2011-09-07 16:46:04 -0600967 vote_dfab();
968 i = sps_device_reset(a2_device_handle);
969 if (i)
970 pr_err("%s: device reset failed rc = %d\n", __func__, i);
971 i = sps_connect(bam_tx_pipe, &tx_connection);
972 if (i)
973 pr_err("%s: tx connection failed rc = %d\n", __func__, i);
974 i = sps_connect(bam_rx_pipe, &rx_connection);
975 if (i)
976 pr_err("%s: rx connection failed rc = %d\n", __func__, i);
977 i = sps_register_event(bam_tx_pipe, &tx_register_event);
978 if (i)
979 pr_err("%s: tx event reg failed rc = %d\n", __func__, i);
980 i = sps_register_event(bam_rx_pipe, &rx_register_event);
981 if (i)
982 pr_err("%s: rx event reg failed rc = %d\n", __func__, i);
983 for (i = 0; i < NUM_BUFFERS; ++i)
984 queue_rx();
985 toggle_apps_ack();
Jeff Hugo6e7a92a2011-10-24 05:25:13 -0600986 bam_connection_is_active = 1;
Jeff Hugoaab7ebc2011-09-07 16:46:04 -0600987 complete_all(&bam_connection_completion);
988}
989
990static void disconnect_to_bam(void)
991{
992 struct list_head *node;
993 struct rx_pkt_info *info;
994
Jeff Hugo6e7a92a2011-10-24 05:25:13 -0600995 bam_connection_is_active = 0;
Jeff Hugoaab7ebc2011-09-07 16:46:04 -0600996 INIT_COMPLETION(bam_connection_completion);
997 sps_disconnect(bam_tx_pipe);
998 sps_disconnect(bam_rx_pipe);
999 unvote_dfab();
1000 __memzero(rx_desc_mem_buf.base, rx_desc_mem_buf.size);
1001 __memzero(tx_desc_mem_buf.base, tx_desc_mem_buf.size);
1002 while (!list_empty(&bam_rx_pool)) {
1003 node = bam_rx_pool.next;
1004 list_del(node);
1005 info = container_of(node, struct rx_pkt_info, list_node);
1006 dma_unmap_single(NULL, info->dma_address, BUFFER_SIZE,
1007 DMA_FROM_DEVICE);
1008 dev_kfree_skb_any(info->skb);
1009 kfree(info);
1010 }
1011}
1012
1013static void vote_dfab(void)
1014{
Jeff Hugoaab7ebc2011-09-07 16:46:04 -06001015}
1016
1017static void unvote_dfab(void)
1018{
Jeff Hugoaab7ebc2011-09-07 16:46:04 -06001019}
1020
Jeff Hugo6e7a92a2011-10-24 05:25:13 -06001021static int restart_notifier_cb(struct notifier_block *this,
1022 unsigned long code,
1023 void *data)
1024{
1025 int i;
1026 struct list_head *node;
1027 struct tx_pkt_info *info;
1028 int temp_remote_status;
1029
1030 if (code != SUBSYS_AFTER_SHUTDOWN)
1031 return NOTIFY_DONE;
1032
1033 in_global_reset = 1;
1034 for (i = 0; i < BAM_DMUX_NUM_CHANNELS; ++i) {
1035 temp_remote_status = bam_ch_is_remote_open(i);
1036 bam_ch[i].status &= ~BAM_CH_REMOTE_OPEN;
1037 if (bam_ch_is_local_open(i))
1038 bam_ch[i].status |= BAM_CH_IN_RESET;
1039 if (temp_remote_status) {
1040 platform_device_unregister(bam_ch[i].pdev);
1041 bam_ch[i].pdev = platform_device_alloc(
1042 bam_ch[i].name, 2);
1043 }
1044 }
1045 /*cleanup UL*/
Jeff Hugoc9749932011-11-02 17:50:40 -06001046 spin_lock(&bam_tx_pool_spinlock);
Jeff Hugo6e7a92a2011-10-24 05:25:13 -06001047 while (!list_empty(&bam_tx_pool)) {
1048 node = bam_tx_pool.next;
1049 list_del(node);
1050 info = container_of(node, struct tx_pkt_info,
1051 list_node);
1052 if (!info->is_cmd) {
1053 dma_unmap_single(NULL, info->dma_address,
1054 info->skb->len,
1055 DMA_TO_DEVICE);
1056 dev_kfree_skb_any(info->skb);
1057 } else {
1058 dma_unmap_single(NULL, info->dma_address,
1059 info->len,
1060 DMA_TO_DEVICE);
1061 kfree(info->skb);
1062 }
1063 kfree(info);
1064 }
Jeff Hugoc9749932011-11-02 17:50:40 -06001065 spin_unlock(&bam_tx_pool_spinlock);
Jeff Hugo6e7a92a2011-10-24 05:25:13 -06001066 smsm_change_state(SMSM_APPS_STATE, SMSM_A2_POWER_CONTROL, 0);
1067
1068 return NOTIFY_DONE;
1069}
1070
Jeff Hugoade1f842011-08-03 15:53:59 -06001071static void bam_init(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001072{
1073 u32 h;
1074 dma_addr_t dma_addr;
1075 int ret;
1076 void *a2_virt_addr;
1077 int i;
1078
Jeff Hugoaab7ebc2011-09-07 16:46:04 -06001079 vote_dfab();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001080 /* init BAM */
1081 a2_virt_addr = ioremap_nocache(A2_PHYS_BASE, A2_PHYS_SIZE);
1082 if (!a2_virt_addr) {
1083 pr_err("%s: ioremap failed\n", __func__);
1084 ret = -ENOMEM;
1085 goto register_bam_failed;
1086 }
1087 a2_props.phys_addr = A2_PHYS_BASE;
1088 a2_props.virt_addr = a2_virt_addr;
1089 a2_props.virt_size = A2_PHYS_SIZE;
1090 a2_props.irq = A2_BAM_IRQ;
Jeff Hugo927cba62011-11-11 11:49:52 -07001091 a2_props.options = SPS_BAM_OPT_IRQ_WAKEUP;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001092 a2_props.num_pipes = A2_NUM_PIPES;
1093 a2_props.summing_threshold = A2_SUMMING_THRESHOLD;
1094 /* need to free on tear down */
1095 ret = sps_register_bam_device(&a2_props, &h);
1096 if (ret < 0) {
1097 pr_err("%s: register bam error %d\n", __func__, ret);
1098 goto register_bam_failed;
1099 }
Jeff Hugoaab7ebc2011-09-07 16:46:04 -06001100 a2_device_handle = h;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001101
1102 bam_tx_pipe = sps_alloc_endpoint();
1103 if (bam_tx_pipe == NULL) {
1104 pr_err("%s: tx alloc endpoint failed\n", __func__);
1105 ret = -ENOMEM;
1106 goto register_bam_failed;
1107 }
1108 ret = sps_get_config(bam_tx_pipe, &tx_connection);
1109 if (ret) {
1110 pr_err("%s: tx get config failed %d\n", __func__, ret);
1111 goto tx_get_config_failed;
1112 }
1113
1114 tx_connection.source = SPS_DEV_HANDLE_MEM;
1115 tx_connection.src_pipe_index = 0;
1116 tx_connection.destination = h;
1117 tx_connection.dest_pipe_index = 4;
1118 tx_connection.mode = SPS_MODE_DEST;
1119 tx_connection.options = SPS_O_AUTO_ENABLE | SPS_O_EOT;
1120 tx_desc_mem_buf.size = 0x800; /* 2k */
1121 tx_desc_mem_buf.base = dma_alloc_coherent(NULL, tx_desc_mem_buf.size,
1122 &dma_addr, 0);
1123 if (tx_desc_mem_buf.base == NULL) {
1124 pr_err("%s: tx memory alloc failed\n", __func__);
1125 ret = -ENOMEM;
1126 goto tx_mem_failed;
1127 }
1128 tx_desc_mem_buf.phys_base = dma_addr;
1129 memset(tx_desc_mem_buf.base, 0x0, tx_desc_mem_buf.size);
1130 tx_connection.desc = tx_desc_mem_buf;
1131 tx_connection.event_thresh = 0x10;
1132
1133 ret = sps_connect(bam_tx_pipe, &tx_connection);
1134 if (ret < 0) {
1135 pr_err("%s: tx connect error %d\n", __func__, ret);
1136 goto tx_connect_failed;
1137 }
1138
1139 bam_rx_pipe = sps_alloc_endpoint();
1140 if (bam_rx_pipe == NULL) {
1141 pr_err("%s: rx alloc endpoint failed\n", __func__);
1142 ret = -ENOMEM;
1143 goto tx_connect_failed;
1144 }
1145 ret = sps_get_config(bam_rx_pipe, &rx_connection);
1146 if (ret) {
1147 pr_err("%s: rx get config failed %d\n", __func__, ret);
1148 goto rx_get_config_failed;
1149 }
1150
1151 rx_connection.source = h;
1152 rx_connection.src_pipe_index = 5;
1153 rx_connection.destination = SPS_DEV_HANDLE_MEM;
1154 rx_connection.dest_pipe_index = 1;
1155 rx_connection.mode = SPS_MODE_SRC;
Jeff Hugo949080a2011-08-30 11:58:56 -06001156 rx_connection.options = SPS_O_AUTO_ENABLE | SPS_O_EOT |
1157 SPS_O_ACK_TRANSFERS;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001158 rx_desc_mem_buf.size = 0x800; /* 2k */
1159 rx_desc_mem_buf.base = dma_alloc_coherent(NULL, rx_desc_mem_buf.size,
1160 &dma_addr, 0);
1161 if (rx_desc_mem_buf.base == NULL) {
1162 pr_err("%s: rx memory alloc failed\n", __func__);
1163 ret = -ENOMEM;
1164 goto rx_mem_failed;
1165 }
1166 rx_desc_mem_buf.phys_base = dma_addr;
1167 memset(rx_desc_mem_buf.base, 0x0, rx_desc_mem_buf.size);
1168 rx_connection.desc = rx_desc_mem_buf;
1169 rx_connection.event_thresh = 0x10;
1170
1171 ret = sps_connect(bam_rx_pipe, &rx_connection);
1172 if (ret < 0) {
1173 pr_err("%s: rx connect error %d\n", __func__, ret);
1174 goto rx_connect_failed;
1175 }
1176
1177 tx_register_event.options = SPS_O_EOT;
1178 tx_register_event.mode = SPS_TRIGGER_CALLBACK;
1179 tx_register_event.xfer_done = NULL;
1180 tx_register_event.callback = bam_mux_tx_notify;
1181 tx_register_event.user = NULL;
1182 ret = sps_register_event(bam_tx_pipe, &tx_register_event);
1183 if (ret < 0) {
1184 pr_err("%s: tx register event error %d\n", __func__, ret);
1185 goto rx_event_reg_failed;
1186 }
1187
Jeff Hugo33dbc002011-08-25 15:52:53 -06001188 rx_register_event.options = SPS_O_EOT;
1189 rx_register_event.mode = SPS_TRIGGER_CALLBACK;
1190 rx_register_event.xfer_done = NULL;
1191 rx_register_event.callback = bam_mux_rx_notify;
1192 rx_register_event.user = NULL;
1193 ret = sps_register_event(bam_rx_pipe, &rx_register_event);
1194 if (ret < 0) {
1195 pr_err("%s: tx register event error %d\n", __func__, ret);
1196 goto rx_event_reg_failed;
1197 }
1198
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001199 bam_mux_initialized = 1;
1200 for (i = 0; i < NUM_BUFFERS; ++i)
1201 queue_rx();
Jeff Hugoaab7ebc2011-09-07 16:46:04 -06001202 toggle_apps_ack();
Jeff Hugo6e7a92a2011-10-24 05:25:13 -06001203 bam_connection_is_active = 1;
Jeff Hugoaab7ebc2011-09-07 16:46:04 -06001204 complete_all(&bam_connection_completion);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001205 return;
1206
1207rx_event_reg_failed:
1208 sps_disconnect(bam_rx_pipe);
1209rx_connect_failed:
1210 dma_free_coherent(NULL, rx_desc_mem_buf.size, rx_desc_mem_buf.base,
1211 rx_desc_mem_buf.phys_base);
1212rx_mem_failed:
1213 sps_disconnect(bam_tx_pipe);
1214rx_get_config_failed:
1215 sps_free_endpoint(bam_rx_pipe);
1216tx_connect_failed:
1217 dma_free_coherent(NULL, tx_desc_mem_buf.size, tx_desc_mem_buf.base,
1218 tx_desc_mem_buf.phys_base);
1219tx_get_config_failed:
1220 sps_free_endpoint(bam_tx_pipe);
1221tx_mem_failed:
1222 sps_deregister_bam_device(h);
1223register_bam_failed:
1224 /*destroy_workqueue(bam_mux_workqueue);*/
1225 /*return ret;*/
1226 return;
1227}
Jeff Hugoade1f842011-08-03 15:53:59 -06001228
Jeff Hugoaab7ebc2011-09-07 16:46:04 -06001229static void toggle_apps_ack(void)
1230{
1231 static unsigned int clear_bit; /* 0 = set the bit, else clear bit */
1232 smsm_change_state(SMSM_APPS_STATE,
1233 clear_bit & SMSM_A2_POWER_CONTROL_ACK,
1234 ~clear_bit & SMSM_A2_POWER_CONTROL_ACK);
1235 clear_bit = ~clear_bit;
1236}
1237
Jeff Hugoade1f842011-08-03 15:53:59 -06001238static void bam_dmux_smsm_cb(void *priv, uint32_t old_state, uint32_t new_state)
1239{
1240 DBG("%s: smsm activity\n", __func__);
Jeff Hugoaab7ebc2011-09-07 16:46:04 -06001241 if (bam_mux_initialized && new_state & SMSM_A2_POWER_CONTROL)
1242 reconnect_to_bam();
1243 else if (bam_mux_initialized && !(new_state & SMSM_A2_POWER_CONTROL))
1244 disconnect_to_bam();
Jeff Hugoade1f842011-08-03 15:53:59 -06001245 else if (new_state & SMSM_A2_POWER_CONTROL)
1246 bam_init();
1247 else
1248 pr_err("%s: unsupported state change\n", __func__);
1249
1250}
1251
Jeff Hugoaab7ebc2011-09-07 16:46:04 -06001252static void bam_dmux_smsm_ack_cb(void *priv, uint32_t old_state,
1253 uint32_t new_state)
1254{
1255 complete_all(&ul_wakeup_ack_completion);
1256}
1257
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001258static int bam_dmux_probe(struct platform_device *pdev)
1259{
1260 int rc;
1261
1262 DBG("%s probe called\n", __func__);
1263 if (bam_mux_initialized)
1264 return 0;
1265
Stephen Boyd1c51a492011-10-26 12:11:47 -07001266 dfab_clk = clk_get(&pdev->dev, "bus_clk");
Jeff Hugoaab7ebc2011-09-07 16:46:04 -06001267 if (IS_ERR(dfab_clk)) {
1268 pr_err("%s: did not get dfab clock\n", __func__);
1269 return -EFAULT;
1270 }
1271
1272 rc = clk_set_rate(dfab_clk, 64000000);
1273 if (rc)
1274 pr_err("%s: unable to set dfab clock rate\n", __func__);
1275
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001276 bam_mux_rx_workqueue = create_singlethread_workqueue("bam_dmux_rx");
1277 if (!bam_mux_rx_workqueue)
1278 return -ENOMEM;
1279
1280 bam_mux_tx_workqueue = create_singlethread_workqueue("bam_dmux_tx");
1281 if (!bam_mux_tx_workqueue) {
1282 destroy_workqueue(bam_mux_rx_workqueue);
1283 return -ENOMEM;
1284 }
1285
Jeff Hugo7960abd2011-08-02 15:39:38 -06001286 for (rc = 0; rc < BAM_DMUX_NUM_CHANNELS; ++rc) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001287 spin_lock_init(&bam_ch[rc].lock);
Jeff Hugo7960abd2011-08-02 15:39:38 -06001288 scnprintf(bam_ch[rc].name, BAM_DMUX_CH_NAME_MAX_LEN,
1289 "bam_dmux_ch_%d", rc);
1290 /* bus 2, ie a2 stream 2 */
1291 bam_ch[rc].pdev = platform_device_alloc(bam_ch[rc].name, 2);
1292 if (!bam_ch[rc].pdev) {
1293 pr_err("%s: platform device alloc failed\n", __func__);
1294 destroy_workqueue(bam_mux_rx_workqueue);
1295 destroy_workqueue(bam_mux_tx_workqueue);
1296 return -ENOMEM;
1297 }
1298 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001299
Jeff Hugoaab7ebc2011-09-07 16:46:04 -06001300 init_completion(&ul_wakeup_ack_completion);
1301 init_completion(&bam_connection_completion);
1302 INIT_DELAYED_WORK(&ul_timeout_work, ul_timeout);
1303
Jeff Hugoade1f842011-08-03 15:53:59 -06001304 rc = smsm_state_cb_register(SMSM_MODEM_STATE, SMSM_A2_POWER_CONTROL,
1305 bam_dmux_smsm_cb, NULL);
1306
1307 if (rc) {
1308 destroy_workqueue(bam_mux_rx_workqueue);
1309 destroy_workqueue(bam_mux_tx_workqueue);
1310 pr_err("%s: smsm cb register failed, rc: %d\n", __func__, rc);
1311 return -ENOMEM;
1312 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001313
Jeff Hugoaab7ebc2011-09-07 16:46:04 -06001314 rc = smsm_state_cb_register(SMSM_MODEM_STATE, SMSM_A2_POWER_CONTROL_ACK,
1315 bam_dmux_smsm_ack_cb, NULL);
1316
1317 if (rc) {
1318 destroy_workqueue(bam_mux_rx_workqueue);
1319 destroy_workqueue(bam_mux_tx_workqueue);
1320 smsm_state_cb_deregister(SMSM_MODEM_STATE,
1321 SMSM_A2_POWER_CONTROL,
1322 bam_dmux_smsm_cb, NULL);
1323 pr_err("%s: smsm ack cb register failed, rc: %d\n", __func__,
1324 rc);
1325 for (rc = 0; rc < BAM_DMUX_NUM_CHANNELS; ++rc)
1326 platform_device_put(bam_ch[rc].pdev);
1327 return -ENOMEM;
1328 }
1329
Eric Holmbergfd1e2ae2011-11-15 18:28:17 -07001330 if (smsm_get_state(SMSM_MODEM_STATE) & SMSM_A2_POWER_CONTROL)
1331 bam_dmux_smsm_cb(NULL, 0, smsm_get_state(SMSM_MODEM_STATE));
1332
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001333 return 0;
1334}
1335
1336static struct platform_driver bam_dmux_driver = {
1337 .probe = bam_dmux_probe,
1338 .driver = {
1339 .name = "BAM_RMNT",
1340 .owner = THIS_MODULE,
1341 },
1342};
1343
1344static int __init bam_dmux_init(void)
1345{
1346#ifdef CONFIG_DEBUG_FS
1347 struct dentry *dent;
1348
1349 dent = debugfs_create_dir("bam_dmux", 0);
Eric Holmberg2fddbcd2011-11-28 18:25:57 -07001350 if (!IS_ERR(dent)) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001351 debug_create("tbl", 0444, dent, debug_tbl);
Eric Holmberg2fddbcd2011-11-28 18:25:57 -07001352 debug_create("ul_pkt_cnt", 0444, dent, debug_ul_pkt_cnt);
1353 debug_create("stats", 0444, dent, debug_stats);
1354 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001355#endif
Jeff Hugo6e7a92a2011-10-24 05:25:13 -06001356 subsys_notif_register_notifier("modem", &restart_notifier);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001357 return platform_driver_register(&bam_dmux_driver);
1358}
1359
Jeff Hugoade1f842011-08-03 15:53:59 -06001360late_initcall(bam_dmux_init); /* needs to init after SMD */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001361MODULE_DESCRIPTION("MSM BAM DMUX");
1362MODULE_LICENSE("GPL v2");