From patchwork Wed Aug 22 06:44:19 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajeshwari Shinde X-Patchwork-Id: 10850 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id CF6EB23F46 for ; Wed, 22 Aug 2012 06:39:24 +0000 (UTC) Received: from mail-yx0-f180.google.com (mail-yx0-f180.google.com [209.85.213.180]) by fiordland.canonical.com (Postfix) with ESMTP id C9898A18D68 for ; Wed, 22 Aug 2012 06:39:13 +0000 (UTC) Received: by yenl8 with SMTP id l8so468622yen.11 for ; Tue, 21 Aug 2012 23:39:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:x-auditid :from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-brightmail-tracker:x-tm-as-mml:x-gm-message-state; bh=NbHcRqvgFmOT0cyPScgQ0UYzq/+6wPtxmc8YqWw9jr0=; b=Ngob4yuTXd/pfKpbF7ellooYHFVTuPCGPkk9Z+MKt4UWMuCiqf8V3ZSaasZNHOIYE0 WUoetSZwJg/cN+9KSFYakRWEgNcIrzerMjRLHZ4Z0+hV/N2FrDqdyeJs+jQ+jB6LV8Tr /4/Y07wjNP1NeX/S2SKhTYnb7SVgYL06rN2v0yFWR6DSqMcwljh6coWNXI+HZzk1jQu8 e6um1drbKUdWBQ+J4mJsjqOruP91bEgemSWqF/L71g1vNtSMM8Hw3JsMWSy9iSJuv1cQ yxEhKswwXd8Vlc9qoGDLH7llcXKZKZnEocHMydu7JXeBKyJhw0kVpEqHVUOUxbiLTJvU MNsg== Received: by 10.50.159.196 with SMTP id xe4mr1000417igb.43.1345617563385; Tue, 21 Aug 2012 23:39:23 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.184.232 with SMTP id ex8csp185544igc; Tue, 21 Aug 2012 23:39:23 -0700 (PDT) Received: by 10.68.234.73 with SMTP id uc9mr3049184pbc.158.1345617562804; Tue, 21 Aug 2012 23:39:22 -0700 (PDT) Received: from mailout3.samsung.com (mailout3.samsung.com. [203.254.224.33]) by mx.google.com with ESMTP id ip5si6566870pbc.228.2012.08.21.23.39.22; Tue, 21 Aug 2012 23:39:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of rajeshwari.s@samsung.com designates 203.254.224.33 as permitted sender) client-ip=203.254.224.33; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of rajeshwari.s@samsung.com designates 203.254.224.33 as permitted sender) smtp.mail=rajeshwari.s@samsung.com Received: from epcpsbgm2.samsung.com (mailout3.samsung.com [203.254.224.33]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0M9500GYX956XL40@mailout3.samsung.com>; Wed, 22 Aug 2012 15:39:21 +0900 (KST) X-AuditID: cbfee61b-b7faf6d00000476a-88-50347e9903e2 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 9C.54.18282.99E74305; Wed, 22 Aug 2012 15:39:21 +0900 (KST) Received: from rajeshwari-linux.sisodomain.com ([107.108.215.115]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0M95002KV954XC70@mmp1.samsung.com>; Wed, 22 Aug 2012 15:39:21 +0900 (KST) From: Rajeshwari Shinde To: u-boot@lists.denx.de Cc: patches@linaro.org, alim.akhtar@samsung.com, sjg@chromium.org, mk7.kang@samsung.com, chander.kashyap@linaro.org, vapier@gentoo.org, amdyer@gmail.com Subject: [PATCH 3/9 V2] Sound: Add command for audio playback Date: Wed, 22 Aug 2012 12:14:19 +0530 Message-id: <1345617865-14199-4-git-send-email-rajeshwari.s@samsung.com> X-Mailer: git-send-email 1.7.4.4 In-reply-to: <1345617865-14199-1-git-send-email-rajeshwari.s@samsung.com> References: <1345617865-14199-1-git-send-email-rajeshwari.s@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrKJMWRmVeSWpSXmKPExsVy+t9jAd2ZdSYBBrd7VCwerr/JYjHl8BcW ByaPO9f2sAUwRnHZpKTmZJalFunbJXBltLy4wlLwQqpi1uo5jA2MV0S7GDk4JARMJNoaFboY OYFMMYkL99azgdhCAosYJXbdCupi5AKyJzJJLP+2lhUkwSZgJLH15DRGEFtEQELiV/9VMJtZ YA6jxImXIiC2sICtxJrWc2CDWARUJc43/WYC2cUr4CHxcnUhxC4FiWNTv4KN5BTwlPj8fA4T xF4Picc/zjBPYORdwMiwilE0tSC5oDgpPddIrzgxt7g0L10vOT93EyPY88+kdzCuarA4xCjA wajEw+uRYBIgxJpYVlyZe4hRgoNZSYT3ei1QiDclsbIqtSg/vqg0J7X4EKM0B4uSOC9/n2GA kEB6YklqdmpqQWoRTJaJg1OqgVGi5eVqoZlWYcrnnzxjUpTmrRL6Vplt3Wmexzzr9T6Za+o6 f9/XbFDekuGw6Mzr0we3ft4lYNpnrv/9j1DutheXe/fqfZcSeP5hXz7zu3cicVbLttp7eeVV 7uE7Oe8v76ofez5XLbSb2cpf/mJ6/tQlvycUPvOyX1TurGqjsTu4XPx2+esf7CZKLMUZiYZa zEXFiQAzxy5T+AEAAA== X-TM-AS-MML: No X-Gm-Message-State: ALoCoQlApYVq1oaTIZqghD9O2cYK9Ym0kpnjRsn9riCAfgZpmwy0ejOB4b99lQbTIiIVikopE21S This patch adds command to test audio playback. sound init - Initialises the audio subsystem (i2s and wm8994 codec) sound play - Plays predefined the audio data. Signed-off-by: Rajeshwari Shinde --- Changes in V2: - None common/Makefile | 1 + common/cmd_sound.c | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 91 insertions(+), 0 deletions(-) create mode 100644 common/cmd_sound.c diff --git a/common/Makefile b/common/Makefile index 483eb4d..a21cac9 100644 --- a/common/Makefile +++ b/common/Makefile @@ -73,6 +73,7 @@ COBJS-$(CONFIG_CMD_CONSOLE) += cmd_console.o COBJS-$(CONFIG_CMD_CPLBINFO) += cmd_cplbinfo.o COBJS-$(CONFIG_DATAFLASH_MMC_SELECT) += cmd_dataflash_mmc_mux.o COBJS-$(CONFIG_CMD_DATE) += cmd_date.o +COBJS-$(CONFIG_CMD_SOUND) += cmd_sound.o ifdef CONFIG_4xx COBJS-$(CONFIG_CMD_SETGETDCR) += cmd_dcr.o endif diff --git a/common/cmd_sound.c b/common/cmd_sound.c new file mode 100644 index 0000000..9684435 --- /dev/null +++ b/common/cmd_sound.c @@ -0,0 +1,90 @@ +/* + * Copyright (C) 2012 Samsung Electronics + * Rajeshwari Shinde + * + * See file CREDITS for list of people who contributed to this + * project. + * + * 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., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include +#include +#include +#include + +/* globaldata */ +DECLARE_GLOBAL_DATA_PTR; + +/* Initilaise sound subsystem */ +static int do_init(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) +{ + int ret; + + ret = sound_init(); + if (ret) { + printf("Initialise Audio driver failed\n"); + return CMD_RET_FAILURE; + } + + return 0; +} + +/* play sound from buffer */ +static int do_play(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) +{ + int ret = 0; + + ret = sound_play(); + if (ret) { + printf("play failed"); + return CMD_RET_FAILURE; + } + + return 0; +} + +static cmd_tbl_t cmd_sound_sub[] = { + U_BOOT_CMD_MKENT(init, 0, 1, do_init, "", ""), + U_BOOT_CMD_MKENT(play, 2, 1, do_play, "", ""), +}; + +/* process sound command */ +static int do_sound(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) +{ + cmd_tbl_t *c; + + if (argc < 1) + return CMD_RET_USAGE; + + /* Strip off leading 'sound' command argument */ + argc--; + argv++; + + c = find_cmd_tbl(argv[0], &cmd_sound_sub[0], ARRAY_SIZE(cmd_sound_sub)); + + if (c) + return c->cmd(cmdtp, flag, argc, argv); + else + return CMD_RET_USAGE; +} + +U_BOOT_CMD( + sound, 3, 1, do_sound, + "sound sub-system", + "init - initialise the sound driver\n" + "sound play - play predefind sound\n" +);