summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2015-03-19 16:39:46 (GMT)
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-03-23 23:29:08 (GMT)
commit6fa77e33d04f47879da3a11edf079823b1e0ed7b (patch)
tree5a1619ec1180fd5ec1aefb7ec288005465013612
parenta166875091d52ca0b71163195482acc4329a4016 (diff)
downloaddepthcharge-stabilize-6909.B.tar.gz
depthcharge-stabilize-6909.B.tar.xz
cli: add ability to set audio volumestabilize-6909.B
If the user passes in a third argument to the 'audio' CLI command, use it as an integer to set the audio level. BRANCH=storm BUG=none TEST=tried generating sounds using the CLI on storm, observed proper volume control. Change-Id: I236d34405f20889275438e5fdc2381d6a7723b07 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/261078 Reviewed-by: Aaron Durbin <adurbin@chromium.org>
-rw-r--r--src/debug/cli/audio.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/debug/cli/audio.c b/src/debug/cli/audio.c
index 88b7dfa..8e20a1e 100644
--- a/src/debug/cli/audio.c
+++ b/src/debug/cli/audio.c
@@ -38,6 +38,13 @@ static int do_audio(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
duration = MAX_DURATION_MS;
}
+ if (argc > 3) {
+ uint32_t volume = (uint32_t) strtoul(argv[3], 0, 10);
+
+ printf("Setting volume to %d\n", volume);
+ sound_set_volume(volume);
+ }
+
res = sound_start(freq);
if (!res) {
/* Nonblocking API must be used. */
@@ -65,8 +72,9 @@ static int do_audio(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
}
U_BOOT_CMD(
- audio, 3, 1,
+ audio, 4, 1,
"rudimentary audio capabilities test",
- "<freq> <duration> - play sound of <freq> Hz "
- "for <duration> milliseconds"
+ "\n<freq> <duration> [<volume>] - play sound of <freq> Hz for "
+ "<duration>\n"
+ " milliseconds at volume <volume>"
);