aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorMarcin Mielczarczyk <marcin.mielczarczyk@tieto.com>2011-02-16 14:51:16 +0100
committerMarcin Mielczarczyk <marcin.mielczarczyk@tieto.com>2011-02-17 07:08:18 +0100
commitcef09789e6ff61d8c55a9ee8645cf6e2edd8906f (patch)
tree2f923225379bc0fdf4ad2341bb5cd9d0d79a7598 /common
parent3d64b95e4bcc06a7a00aa3bd178ccfd594c6e534 (diff)
sciphone_g2: Vibrator functionality
This patch adds vibrator functionality. It implements vibrator driver and introduces new U-Boot command: vibrate Signed-off-by: Marcin Mielczarczyk <marcin.mielczarczyk@tieto.com>
Diffstat (limited to 'common')
-rw-r--r--common/Makefile1
-rw-r--r--common/cmd_vibrate.c45
2 files changed, 46 insertions, 0 deletions
diff --git a/common/Makefile b/common/Makefile
index 048df0cbc..83e3735ac 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -143,6 +143,7 @@ COBJS-$(CONFIG_CMD_TSI148) += cmd_tsi148.o
COBJS-$(CONFIG_CMD_UBI) += cmd_ubi.o
COBJS-$(CONFIG_CMD_UBIFS) += cmd_ubifs.o
COBJS-$(CONFIG_CMD_UNIVERSE) += cmd_universe.o
+COBJS-$(CONFIG_CMD_VIBRATE) += cmd_vibrate.o
ifdef CONFIG_CMD_USB
COBJS-y += cmd_usb.o
COBJS-y += usb.o
diff --git a/common/cmd_vibrate.c b/common/cmd_vibrate.c
new file mode 100644
index 000000000..753dd74d9
--- /dev/null
+++ b/common/cmd_vibrate.c
@@ -0,0 +1,45 @@
+/*
+ * (C) 2010 by Tieto <www.tieto.com>
+ * Marcin Mielczarczyk <marcin.mielczarczyk@tieto.com>
+ *
+ * All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+
+#include <common.h>
+#include <command.h>
+#include <asm/arch-mtk/vibra.h>
+
+int do_vibrate(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+ if (2 != argc)
+ goto usage;
+
+ vibra_on();
+ udelay(1000 * simple_strtoul(argv[1], NULL, 10));
+ vibra_off();
+
+ return 0;
+usage:
+ return cmd_usage(cmdtp);
+}
+
+U_BOOT_CMD(
+ vibrate, 2, 1, do_vibrate,
+ "vibrator control",
+ "time_in_ms - starts vibrator for given time"
+);