blob: ffc27adea1323f9a8724b6622d4a37978a2ee3c3 [file] [log] [blame]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001/* Copyright (c) 2010-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#ifndef AUDIO_LPA_H
14#define AUDIO_LPA_H
15
16#include <linux/earlysuspend.h>
17#include <linux/wakelock.h>
18
19#define ADRV_STATUS_OBUF_GIVEN 0x00000001
20#define ADRV_STATUS_IBUF_GIVEN 0x00000002
21#define ADRV_STATUS_FSYNC 0x00000004
22#define ADRV_STATUS_PAUSE 0x00000008
23
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070024struct buffer {
25 void *data;
26 unsigned size;
27 unsigned used; /* Input usage actual DSP produced PCM size */
28 unsigned addr;
29};
30
31#ifdef CONFIG_HAS_EARLYSUSPEND
32struct audlpa_suspend_ctl {
33 struct early_suspend node;
34 struct audio *audio;
35};
36#endif
37
38struct codec_operations {
39 long (*ioctl)(struct file *, unsigned int, unsigned long);
40 int (*set_params)(void *);
41};
42
43struct audio {
44 spinlock_t dsp_lock;
45
46 uint8_t out_needed; /* number of buffers the dsp is waiting for */
47 struct list_head out_queue; /* queue to retain output buffers */
48
49 struct mutex lock;
50 struct mutex write_lock;
51 wait_queue_head_t write_wait;
52
53 struct audio_client *ac;
54
55 /* configuration to use on next enable */
56 uint32_t out_sample_rate;
57 uint32_t out_channel_mode;
58 uint32_t out_bits; /* bits per sample (used by PCM decoder) */
59
60 int32_t phys; /* physical address of write buffer */
61
62 uint32_t drv_status;
63 int wflush; /* Write flush */
64 int opened;
65 int out_enabled;
66 int out_prefill;
67 int running;
68 int stopped; /* set when stopped, cleared on flush */
69 int buf_refresh;
70 int teos; /* valid only if tunnel mode & no data left for decoder */
71
72#ifdef CONFIG_HAS_EARLYSUSPEND
73 struct audlpa_suspend_ctl suspend_ctl;
74#endif
75
76 struct wake_lock wakelock;
77#ifdef CONFIG_DEBUG_FS
78 struct dentry *dentry;
79#endif
80
81 wait_queue_head_t wait;
82 struct list_head free_event_queue;
83 struct list_head event_queue;
84 wait_queue_head_t event_wait;
85 spinlock_t event_queue_lock;
86 struct mutex get_event_lock;
87 int event_abort;
88
89 uint32_t device_events;
90
91 struct list_head pmem_region_queue; /* protected by lock */
92
93 int eq_enable;
94 int eq_needs_commit;
95 uint32_t volume;
96
97 unsigned int minor_no;
98 struct codec_operations codec_ops;
99 uint32_t buffer_size;
100 uint32_t buffer_count;
101 uint32_t bytes_consumed;
102};
103
104#endif /* !AUDIO_LPA_H */