aboutsummaryrefslogtreecommitdiffstats
path: root/GTA04
diff options
context:
space:
mode:
authorAndreas Kemnade <andreas@kemnade.info>2013-11-01 16:29:06 +0100
committerH. Nikolaus Schaller <hns@goldelico.com>2013-11-03 15:34:09 +0100
commit8c52a7cf8e066d7ce202e38863c225a7d4d0bfeb (patch)
tree548e9743c79c096a9867d054b8a547067b09cbee /GTA04
parentd4b3d5c8e6a0cf80192bce9a19cb5573fb08d235 (diff)
downloadkernel_goldelico_gta04-8c52a7cf8e066d7ce202e38863c225a7d4d0bfeb.zip
kernel_goldelico_gta04-8c52a7cf8e066d7ce202e38863c225a7d4d0bfeb.tar.gz
kernel_goldelico_gta04-8c52a7cf8e066d7ce202e38863c225a7d4d0bfeb.tar.bz2
usb: various hacks related to otg
- start switch to b_host role via sysfs - control vbus output power - can be used to start charging when a charger with ID grounded is first connected to the device and then to the wall outlet - enable/disable pulldown resistors via sysfs, can be used to emulate a connection to a usb host, useful for switching to b_host when using y-cables - script for entering b_host mode Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
Diffstat (limited to 'GTA04')
-rw-r--r--GTA04/README5
-rwxr-xr-xGTA04/scripts/b_host.sh35
2 files changed, 40 insertions, 0 deletions
diff --git a/GTA04/README b/GTA04/README
index dad8c0a..fcb638d 100644
--- a/GTA04/README
+++ b/GTA04/README
@@ -28,3 +28,8 @@
simple tasks
+ vibra.py shows how to program the vibrator as a rumble effect.
+ + b_host.sh helps to switch to b_host otg state (GTA04 is external
+ powered but plays the role of an usb host, the id pin is
+ not grounded in that situation). First apply power or switch on
+ software-controlled charging, run that script, then also connect
+ the usb data lines
diff --git a/GTA04/scripts/b_host.sh b/GTA04/scripts/b_host.sh
new file mode 100755
index 0000000..16e04c1
--- /dev/null
+++ b/GTA04/scripts/b_host.sh
@@ -0,0 +1,35 @@
+#!/bin/sh
+# if not in software-controlled charging mode, Vbus (and only that)
+# has to be applied before running the script
+#MUSB_MODE=/sys/bus/platform/devices/musb-hdrc/mode
+#MUSB_MODE=/sys/bus/platform/devices/musb-hdrc.0/mode
+MUSB_MODE=/sys/bus/platform/devices/musb-hdrc.1.auto/mode
+
+MUSB_M=`cat $MUSB_MODE`
+echo "$MUSB_M"
+if [ "$MUSB_M" != b_idle ] ; then
+ echo Invalid mode at start
+ exit
+fi
+# trigger a transition from b_idle to b_peripheral by simulating
+# a connection to a host (enable pull-down resistors)
+echo on > /sys/bus/platform/devices/twl4030_usb/fake_host
+sleep 0.2
+cat $MUSB_MODE
+# trigger a transition from b_peripheral to b_hnp_enable
+echo host >$MUSB_MODE
+cat $MUSB_MODE
+sleep 0.2
+# simulate a disconnection from host
+echo off > /sys/bus/platform/devices/twl4030_usb/fake_host
+sleep 0.2
+cat $MUSB_MODE
+# be a host by ourselfs (if we wouldn't mess with this bit,
+# it would be already set here)
+echo on > /sys/bus/platform/devices/twl4030_usb/fake_host
+MUSB_M=`cat $MUSB_MODE`
+echo "$MUSB_M"
+
+if [ "$MUSB_M" = b_wait_acon ] ; then
+ echo "Prepared for being usb host, time to attach your device"
+fi