From patchwork Tue Aug 14 05:45:26 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajeshwari Shinde X-Patchwork-Id: 10718 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 F035923E02 for ; Tue, 14 Aug 2012 05:41:16 +0000 (UTC) Received: from mail-ob0-f180.google.com (mail-ob0-f180.google.com [209.85.214.180]) by fiordland.canonical.com (Postfix) with ESMTP id B5AF4A18960 for ; Tue, 14 Aug 2012 05:41:16 +0000 (UTC) Received: by mail-ob0-f180.google.com with SMTP id eq6so12503obc.11 for ; Mon, 13 Aug 2012 22:41:16 -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=C8UL0eHqY1IETlSMacE8vQUZt8CttPMcE8fq+FFDiVg=; b=UOTqtOwneX9kpN3G3vMq+OMO6KNOp9vh/uwa2L9EVnD3hytzv1+PJJvnbUpeZ5lEMW wnyiPKW7kR9hBiq9rXFNLWVChug5EWc+cj2WMa3ahgksHSoO0+5UtZZ+ixLz1O0I+X+p A+GOd4aEYa8b0aqZ2L534I7CPkztyrtoGTRjq2v6WjgZ0tF9xNwUgm5uhx/DzSVhk4v+ PhyJZ8OOJ7R/hLkOAqcqcnYAdcr4+S3PiMdnx7xRdan95cJdHTbbNelKaJBzaHnVzS3U W8KKq2PaHqrTOdAUOWZGdscNKBWmOgYJaISBvycVSTUKoQNR1vlFp0VsUwaT0nPxZoA1 WhTg== Received: by 10.50.57.168 with SMTP id j8mr9500426igq.16.1344922876398; Mon, 13 Aug 2012 22:41:16 -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.200 with SMTP id ew8csp214469igc; Mon, 13 Aug 2012 22:41:16 -0700 (PDT) Received: by 10.68.189.99 with SMTP id gh3mr22305384pbc.31.1344922875865; Mon, 13 Aug 2012 22:41:15 -0700 (PDT) Received: from mailout3.samsung.com (mailout3.samsung.com. [203.254.224.33]) by mx.google.com with ESMTP id px6si1344269pbc.334.2012.08.13.22.41.15; Mon, 13 Aug 2012 22:41:15 -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 <0M8Q00HFED3V2290@mailout3.samsung.com>; Tue, 14 Aug 2012 14:40:56 +0900 (KST) X-AuditID: cbfee61b-b7faf6d00000476a-86-5029e4e8dd19 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id C8.42.18282.8E4E9205; Tue, 14 Aug 2012 14:40:56 +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 <0M8Q00064D2QKU20@mmp1.samsung.com>; Tue, 14 Aug 2012 14:40:56 +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 Subject: [PATCH 3/9] Sound: Add command for audio playback Date: Tue, 14 Aug 2012 11:15:26 +0530 Message-id: <1344923132-31803-4-git-send-email-rajeshwari.s@samsung.com> X-Mailer: git-send-email 1.7.4.4 In-reply-to: <1344923132-31803-1-git-send-email-rajeshwari.s@samsung.com> References: <1344923132-31803-1-git-send-email-rajeshwari.s@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrOJMWRmVeSWpSXmKPExsVy+t9jAd0XTzQDDC4+krN4uP4mi8WUw19Y HJg87lzbwxbAGMVlk5Kak1mWWqRvl8CVMWfBEcaCC1IVx559Y2lgPCzaxcjJISFgIrFw4kI2 CFtM4sK99UA2F4eQwCJGiV0XtkA5E5kkFk5pYASpYhMwkth6chqYLSIgIfGr/yqQzcHBLFAq MWViHkhYWMBK4vfmfSwgNouAqsSh6Q9ZQWxeAQ+Ju3+OsUMsU5A4NvUrWJxTwFPi1vVlYCOF gGrWvzvDOIGRdwEjwypG0dSC5ILipPRcI73ixNzi0rx0veT83E2MYO8/k97BuKrB4hCjAAej Eg9vYaJmgBBrYllxZe4hRgkOZiUR3vs9QCHelMTKqtSi/Pii0pzU4kOM0hwsSuK8Jt5f/YUE 0hNLUrNTUwtSi2CyTBycUg2MsvPzLz54xOt5dNuie3LCelqmgf46B5wuOBTeDO2YuuZCzEvf +44Or/y3LNjjUXl8TldenZ30gTVWJiVveCckfQr3ic99xPHs7b6Jd/6/kOjvd1gftNI/2a7n QdGPz0uSpjInuvslOGiePJq7zU3Kz/xm7MzaaIkpL6LU1mapefem/HhRf2yxEktxRqKhFnNR cSIAJhncSPoBAAA= X-TM-AS-MML: No X-Gm-Message-State: ALoCoQnrjASRJ/wygwh/WvoHYLZw1iojK5ha4IMntkMtiu+EHnL8dUutgWjDrnDMT5gRfVCSoo1r 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 --- 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" +);