aboutsummaryrefslogtreecommitdiffstats
path: root/package/lqtapi/src/mps/vmmc-signal.c
diff options
context:
space:
mode:
authorJohn Crispin <john@openwrt.org>2010-11-03 19:12:34 +0000
committerJohn Crispin <john@openwrt.org>2010-11-03 19:12:34 +0000
commita8b2a07f375edefec242de9f20d4aefafa927517 (patch)
treed15f5bb696bfa9dfd9555788d411e0ba59b99a65 /package/lqtapi/src/mps/vmmc-signal.c
parent72ae8452cda47d6e18e664097a4adbc0eee3fc7b (diff)
downloadupstream-a8b2a07f375edefec242de9f20d4aefafa927517.tar.gz
upstream-a8b2a07f375edefec242de9f20d4aefafa927517.tar.bz2
upstream-a8b2a07f375edefec242de9f20d4aefafa927517.zip
* adds a rewrite of the tapi drivers + sip app. this is the result of lars' gsoc 2010 project, Thanks !
SVN-Revision: 23840
Diffstat (limited to 'package/lqtapi/src/mps/vmmc-signal.c')
-rw-r--r--package/lqtapi/src/mps/vmmc-signal.c69
1 files changed, 69 insertions, 0 deletions
diff --git a/package/lqtapi/src/mps/vmmc-signal.c b/package/lqtapi/src/mps/vmmc-signal.c
new file mode 100644
index 0000000000..83fea60839
--- /dev/null
+++ b/package/lqtapi/src/mps/vmmc-signal.c
@@ -0,0 +1,69 @@
+#include <linux/kernel.h>
+
+#include "vmmc.h"
+#include "vmmc-sig.h"
+#include "vmmc-cmds.h"
+
+static struct vmmc_sig *vmmc_module_to_sig(struct vmmc_module *module)
+{
+ return container_of(module, struct vmmc_sig, module);
+}
+
+static int vmmc_sig_enable(struct vmmc_module *module, bool enabled)
+{
+ struct vmmc_sig *sig = vmmc_module_to_sig(module);
+
+ return 0;
+
+ sig->sig_cache = VMMC_CMD_SIG_SET_ENABLE(sig->sig_cache, enabled);
+
+ return vmmc_command_write(sig->vmmc, VMMC_CMD_SIG(sig->id), &sig->sig_cache);
+}
+
+static int vmmc_sig_sync(struct vmmc_module *module)
+{
+ struct vmmc_sig *sig = vmmc_module_to_sig(module);
+
+ sig->sig_cache = VMMC_CMD_SIG_SET_INPUTS(sig->sig_cache,
+ module->pins[0], module->pins[1]);
+
+ vmmc_command_write(sig->vmmc, VMMC_CMD_SIG(sig->id),
+ &sig->sig_cache);
+
+ return vmmc_command_write(sig->vmmc, VMMC_CMD_DTMFR(sig->id),
+ &sig->dtmfr_cache);
+}
+
+static const struct vmmc_module_ops vmmc_sig_ops = {
+ .enable = vmmc_sig_enable,
+ .sync = vmmc_sig_sync,
+};
+
+int vmmc_sig_init(struct vmmc_sig *sig, struct vmmc *vmmc, unsigned int id)
+{
+ int ret;
+
+ ret = vmmc_module_init(&sig->module, 2, &vmmc_sig_ops);
+ if (ret)
+ return ret;
+
+ sig->id = id;
+ sig->module.id = id + 0x1e;
+ sig->vmmc = vmmc;
+ sig->sig_cache = VMMC_CMD_SIG_DATA(1, 1, 0, 0, 0, 0, 0);
+ sig->dtmfr_cache = VMMC_CMD_DTMFR_DATA(1, 1, id);
+
+ vmmc_register_module(vmmc, &sig->module);
+
+ vmmc_command_write(sig->vmmc, VMMC_CMD_SIG(sig->id),
+ &sig->sig_cache);
+ vmmc_command_write(sig->vmmc, VMMC_CMD_DTMFR(sig->id),
+ &sig->dtmfr_cache);
+
+ return ret;
+}
+
+void vmmc_sig_dtmf_event_handler(struct vmmc *vmmc, uint32_t id, uint32_t data)
+{
+ tapi_report_dtmf_event(&vmmc->tdev, &vmmc->tdev.ports[id], data & 0xf);
+}