forked from manuel-rhdt/snd-microbookii
-
Notifications
You must be signed in to change notification settings - Fork 0
/
control.h
59 lines (43 loc) · 1.53 KB
/
control.h
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#ifndef __MICROBOOKII_CONTROL_H
#define __MICROBOOKII_CONTROL_H
#define MSG_BUF_LEN 40
#define MICROBOOKII_POll_MS 130
#include <linux/mutex.h>
#include <linux/workqueue.h>
#include <linux/completion.h>
#include <linux/hrtimer.h>
#include <linux/ktime.h>
#include <sound/control.h>
struct microbookii;
struct microbookii_message;
typedef void (*message_callback_t)(struct microbookii_message *msg);
struct microbookii_message {
struct microbookii *mbii;
struct urb *urb;
unsigned char message_num;
int len;
struct completion responded;
struct work_struct work;
message_callback_t callback;
unsigned char buffer[MSG_BUF_LEN];
};
struct microbookii_control {
struct microbookii *mbii;
unsigned char message_counter;
struct workqueue_struct *message_queue;
struct hrtimer poll_timer;
struct completion device_setup;
unsigned int current_rate;
struct snd_kcontrol *master_volume;
struct snd_kcontrol *phones_volume;
};
int microbookii_init_control(struct microbookii *mbii);
void microbookii_free_control(struct microbookii *mbii);
struct microbookii_message *microbookii_message_alloc(struct microbookii *mbii);
void microbookii_message_free(struct microbookii_message *msg);
int microbookii_message_send(struct microbookii_message *msg);
int microbookii_message_send_async(struct microbookii_message *msg,
message_callback_t callback);
int microbookii_wait_device_ready(struct microbookii *mbii);
int microbookii_set_rate(struct microbookii *mbii, unsigned int rate);
#endif /* __MICROBOOKII_CONTROL_H */