1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (C) 2012 Samsung Electronics
4 * Rajeshwari Shinde <rajeshwari.s@samsung.com>
12 DECLARE_GLOBAL_DATA_PTR;
14 /* Initilaise sound subsystem */
15 static int do_init(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
19 ret = sound_init(gd->fdt_blob);
21 printf("Initialise Audio driver failed\n");
22 return CMD_RET_FAILURE;
28 /* play sound from buffer */
29 static int do_play(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
36 msec = simple_strtoul(argv[1], NULL, 10);
38 freq = simple_strtoul(argv[2], NULL, 10);
40 ret = sound_play(msec, freq);
42 printf("play failed");
43 return CMD_RET_FAILURE;
49 static cmd_tbl_t cmd_sound_sub[] = {
50 U_BOOT_CMD_MKENT(init, 0, 1, do_init, "", ""),
51 U_BOOT_CMD_MKENT(play, 2, 1, do_play, "", ""),
54 /* process sound command */
55 static int do_sound(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
62 /* Strip off leading 'sound' command argument */
66 c = find_cmd_tbl(argv[0], &cmd_sound_sub[0], ARRAY_SIZE(cmd_sound_sub));
69 return c->cmd(cmdtp, flag, argc, argv);
75 sound, 4, 1, do_sound,
77 "init - initialise the sound driver\n"
78 "sound play [len] [freq] - play a sound for len ms at freq hz\n"