hostapd: update to 2011-02-21, use PKG_MIRROR_MD5SUM, includes fixes for WPS
[openwrt.git] / package / lqtapi / src / mps / vmmc-signal.c
1 #include <linux/kernel.h>
2
3 #include "vmmc.h"
4 #include "vmmc-sig.h"
5 #include "vmmc-cmds.h"
6
7 static struct vmmc_sig *vmmc_module_to_sig(struct vmmc_module *module)
8 {
9 return container_of(module, struct vmmc_sig, module);
10 }
11
12 static int vmmc_sig_enable(struct vmmc_module *module, bool enabled)
13 {
14 struct vmmc_sig *sig = vmmc_module_to_sig(module);
15
16 return 0;
17
18 sig->sig_cache = VMMC_CMD_SIG_SET_ENABLE(sig->sig_cache, enabled);
19
20 return vmmc_command_write(sig->vmmc, VMMC_CMD_SIG(sig->id), &sig->sig_cache);
21 }
22
23 static int vmmc_sig_sync(struct vmmc_module *module)
24 {
25 struct vmmc_sig *sig = vmmc_module_to_sig(module);
26
27 sig->sig_cache = VMMC_CMD_SIG_SET_INPUTS(sig->sig_cache,
28 module->pins[0], module->pins[1]);
29
30 vmmc_command_write(sig->vmmc, VMMC_CMD_SIG(sig->id),
31 &sig->sig_cache);
32
33 return vmmc_command_write(sig->vmmc, VMMC_CMD_DTMFR(sig->id),
34 &sig->dtmfr_cache);
35 }
36
37 static const struct vmmc_module_ops vmmc_sig_ops = {
38 .enable = vmmc_sig_enable,
39 .sync = vmmc_sig_sync,
40 };
41
42 int vmmc_sig_init(struct vmmc_sig *sig, struct vmmc *vmmc, unsigned int id)
43 {
44 int ret;
45
46 ret = vmmc_module_init(&sig->module, 2, &vmmc_sig_ops);
47 if (ret)
48 return ret;
49
50 sig->id = id;
51 sig->module.id = id + 0x1e;
52 sig->vmmc = vmmc;
53 sig->sig_cache = VMMC_CMD_SIG_DATA(1, 1, 0, 0, 0, 0, 0);
54 sig->dtmfr_cache = VMMC_CMD_DTMFR_DATA(1, 1, id);
55
56 vmmc_register_module(vmmc, &sig->module);
57
58 vmmc_command_write(sig->vmmc, VMMC_CMD_SIG(sig->id),
59 &sig->sig_cache);
60 vmmc_command_write(sig->vmmc, VMMC_CMD_DTMFR(sig->id),
61 &sig->dtmfr_cache);
62
63 return ret;
64 }
65
66 void vmmc_sig_dtmf_event_handler(struct vmmc *vmmc, uint32_t id, uint32_t data)
67 {
68 tapi_report_dtmf_event(&vmmc->tdev, &vmmc->tdev.ports[id], data & 0xf);
69 }
This page took 0.041248 seconds and 5 git commands to generate.