From patchwork Fri Jul 16 14:46:59 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raffaele Recalcati X-Patchwork-Id: 112447 Received: from bear.ext.ti.com (bear.ext.ti.com [192.94.94.41]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o6GElUdq028978 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 16 Jul 2010 14:48:06 GMT Received: from dlep35.itg.ti.com ([157.170.170.118]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id o6GElTxH002462 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 16 Jul 2010 09:47:29 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by dlep35.itg.ti.com (8.13.7/8.13.7) with ESMTP id o6GElTD5013805 for ; Fri, 16 Jul 2010 09:47:29 -0500 (CDT) Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 2A5DB80683 for ; Fri, 16 Jul 2010 09:47:24 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp53.itg.ti.com (dflp53.itg.ti.com [128.247.5.6]) by linux.omap.com (Postfix) with ESMTP id 075E48062B for ; Fri, 16 Jul 2010 09:47:16 -0500 (CDT) Received: from neches.ext.ti.com (localhost [127.0.0.1]) by dflp53.itg.ti.com (8.13.8/8.13.8) with ESMTP id o6GElFF7020603 for ; Fri, 16 Jul 2010 09:47:15 -0500 (CDT) Received: from psmtp.com (na3sys009amx174.postini.com [74.125.149.100]) by neches.ext.ti.com (8.13.7/8.13.7) with SMTP id o6GElE52005712 for ; Fri, 16 Jul 2010 09:47:14 -0500 Received: from source ([74.125.82.173]) by na3sys009amx174.postini.com ([74.125.148.10]) with SMTP; Fri, 16 Jul 2010 14:47:14 GMT Received: by mail-wy0-f173.google.com with SMTP id 35so1982961wyb.4 for ; Fri, 16 Jul 2010 07:47:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references; bh=BCZdZg7eoAIoKYLQ3w0+aXrA5Ba4DaOTIHrMe54nsrw=; b=e5zOQQ/85FOBB7ARxmvxuOeKLcn65Z9ouJtHgDuBmIXHejFitxzVoLHcNf84zNsZ1L 4F71X3Zbx5XO7O3dihC9LFQdhNdu+pSanuYDv+WYVKRdU6KK2XZGLdEEHP7U4BLL53Xg fdy19D+q6nuIKC7/JaHdr94jYfEbCkU1Or0/A= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=PtHXD7UPfwqkbmStB+MLy9609NoAhopiy5c3D5eIg+AVfp1EKB9ErD9MvLCH5eUKKx ohR/NWZEMiVAhsHT8yRHHzl0YuoK38J4jKxwaprb2R9aHL2IFnybq9a0Airr5doF1s2l MStpYO0CAegDxg6W0BDdz4ZEfQvesgTzZtnbU= Received: by 10.227.37.220 with SMTP id y28mr1019155wbd.79.1279291633725; Fri, 16 Jul 2010 07:47:13 -0700 (PDT) Received: from localhost.localdomain (host81-90-static.72-81-b.business.telecomitalia.it [81.72.90.81]) by mx.google.com with ESMTPS id l55sm783885weq.41.2010.07.16.07.47.11 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 16 Jul 2010 07:47:12 -0700 (PDT) From: Raffaele Recalcati To: davinci-linux-open-source@linux.davincidsp.com Subject: [PATCH 3/3] ASoC: DaVinci: Voicecodec: Added support based on davinci-pcm-copyfromuser Date: Fri, 16 Jul 2010 16:46:59 +0200 Message-Id: <1279291619-5081-4-git-send-email-lamiaposta71@gmail.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1279291619-5081-1-git-send-email-lamiaposta71@gmail.com> References: <1279291619-5081-1-git-send-email-lamiaposta71@gmail.com> X-pstn-neptune: 0/0/0.00/0 X-pstn-levels: (S:19.54543/99.90000 CV:99.9000 FC:95.5390 LC:95.5390 R:95.9108 P:95.9108 M:97.0282 C:98.6951 ) X-pstn-settings: 2 (0.5000:0.5000) s cv gt3 gt2 gt1 r p m c X-pstn-addresses: from [db-null] Cc: alsa-devel@alsa-project.org, Mark Brown , Raffaele Recalcati , Liam Girdwood X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: davinci-linux-open-source-bounces+patchwork-davinci=patchwork.kernel.org@linux.davincidsp.com Errors-To: davinci-linux-open-source-bounces+patchwork-davinci=patchwork.kernel.org@linux.davincidsp.com X-Greylist: Sender succeeded STARTTLS authentication, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Fri, 16 Jul 2010 14:48:06 +0000 (UTC) diff --git a/sound/soc/davinci/Makefile b/sound/soc/davinci/Makefile index 7d6a9a1..44c17ad 100644 --- a/sound/soc/davinci/Makefile +++ b/sound/soc/davinci/Makefile @@ -1,6 +1,7 @@ # DAVINCI Platform Support snd-soc-davinci-objs := davinci-pcm.o snd-soc-davinci-objs += davinci-pcm-copyfromuser.o +snd-soc-davinci-objs += cq93vc_copy.o snd-soc-davinci-i2s-objs := davinci-i2s.o snd-soc-davinci-mcasp-objs:= davinci-mcasp.o snd-soc-davinci-vcif-objs:= davinci-vcif.o @@ -13,9 +14,11 @@ obj-$(CONFIG_SND_DAVINCI_SOC_VCIF) += snd-soc-davinci-vcif.o # DAVINCI Machine Support snd-soc-evm-objs := davinci-evm.o snd-soc-sffsdr-objs := davinci-sffsdr.o +snd-soc-bmx-objs := davinci-bmx.o obj-$(CONFIG_SND_DAVINCI_SOC_EVM) += snd-soc-evm.o obj-$(CONFIG_SND_DM6467_SOC_EVM) += snd-soc-evm.o obj-$(CONFIG_SND_DA830_SOC_EVM) += snd-soc-evm.o obj-$(CONFIG_SND_DA850_SOC_EVM) += snd-soc-evm.o obj-$(CONFIG_SND_DAVINCI_SOC_SFFSDR) += snd-soc-sffsdr.o +obj-$(CONFIG_SND_DAVINCI_SOC_BMX) += snd-soc-bmx.o diff --git a/sound/soc/davinci/cq93vc_copy.c b/sound/soc/davinci/cq93vc_copy.c new file mode 100644 index 0000000..41747dd --- /dev/null +++ b/sound/soc/davinci/cq93vc_copy.c @@ -0,0 +1,130 @@ +/* + * + * Copyright (C) 2010 Bticino S.p.a + * Author: Davide Bonfanti + * + * Contributors: + * Raffaele Recalcati + * + * 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 version 2. + * + * This program is distributed "as is" WITHOUT ANY WARRANTY of any + * kind, whether express or implied; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include "davinci-pcm-copy.h" +#include "cq93vc_copy.h" + +#define DAVINCI_VOICECODEC_MODULE_BASE 0x01D0C000 +#define VC_PID 0x00 +#define VC_CTRL 0x04 +#define VC_INTEN 0x08 +#define VC_INTSTATUS 0x0C +#define VC_INTCLR 0x10 +#define VC_EMUL_CTRL 0x14 +#define RFIFO 0x20 +#define WFIFO 0x24 +#define FIFOSTAT 0x28 +#define VC_REG00 0x80 +#define VC_REG01 0x84 +#define VC_REG02 0x88 +#define VC_REG03 0x8C +#define VC_REG04 0x90 +#define VC_REG05 0x94 +#define VC_REG06 0x98 +#define VC_REG09 0xA4 +#define VC_REG10 0xA8 +#define VC_REG12 0xB0 + +/* bit definitions */ +#define VC_CTRL_WFIFOMD BIT(14) +#define VC_CTRL_WFIFOCL BIT(13) +#define VC_CTRL_WFIFOEN BIT(12) +#define VC_CTRL_RFIFOMD BIT(10) +#define VC_CTRL_RFIFOCL BIT(9) +#define VC_CTRL_RFIFOEN BIT(8) +#define VC_CTRL_WDUNSIGNED BIT(7) +#define VC_CTRL_WDSIZE BIT(6) +#define VC_CTRL_RDUNSIGNED BIT(5) +#define VC_CTRL_RDSIZE BIT(4) +#define VC_CTRL_RSTDAC BIT(1) +#define VC_CTRL_RSTADC BIT(0) + +#define VC_INTSTATUS_WDREQ BIT(3) + +#define FIFOSTAT_WDATACOUNT_MASK 0x1F00 +#define FIFOSTAT_WDATACOUNT_OFFSET 8 + +#define HW_FIFO_SIZE 0x10 + +void __iomem *voice_codec_base; + +void cq93vc_enable(void) +{ + __raw_writel(0, voice_codec_base + VC_CTRL); + __raw_writel(0, voice_codec_base + VC_INTEN); + __raw_writel(VC_CTRL_RFIFOMD | VC_CTRL_WFIFOEN | + VC_CTRL_WFIFOMD, voice_codec_base + VC_CTRL); +} + +void cq93vc_write(u16 data) +{ + __raw_writew(data, voice_codec_base + WFIFO); +} + +void cq93vc_wait_fifo_ready(void) +{ + u32 diff; + do { + diff = __raw_readl(voice_codec_base + VC_INTSTATUS); + } while (!(diff & VC_INTSTATUS_WDREQ)); +} + +int cq93vc_get_fifo_size(void) +{ + return HW_FIFO_SIZE; +} + +int cq93vc_get_fifo_status(void) +{ + int fifo; + fifo = __raw_readl(voice_codec_base + FIFOSTAT); + fifo = (fifo & FIFOSTAT_WDATACOUNT_MASK) >> FIFOSTAT_WDATACOUNT_OFFSET; + return fifo; +} + +void cq93vc_init(void) +{ + voice_codec_base = ioremap(DAVINCI_VOICECODEC_MODULE_BASE, SZ_4K); + +} + +struct davinci_pcm_copy_ops cq93vc_pcm_copy_ops = { + .enable = cq93vc_enable, + .write = cq93vc_write, + .wait_fifo_ready = cq93vc_wait_fifo_ready, + .get_fifo_size = cq93vc_get_fifo_size, + .get_fifo_status = cq93vc_get_fifo_status, + .init = cq93vc_init, +}; +EXPORT_SYMBOL_GPL(cq93vc_pcm_copy_ops); diff --git a/sound/soc/davinci/cq93vc_copy.h b/sound/soc/davinci/cq93vc_copy.h new file mode 100644 index 0000000..bcc4458 --- /dev/null +++ b/sound/soc/davinci/cq93vc_copy.h @@ -0,0 +1,26 @@ +/* + * + * Copyright (C) 2010 Bticino S.p.a + * Author: Davide Bonfanti + * + * Contributors: + * Raffaele Recalcati + * + * 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 version 2. + * + * This program is distributed "as is" WITHOUT ANY WARRANTY of any + * kind, whether express or implied; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#ifndef _DAVINCI_CQ93VC_COPY_H +#define _DAVINCI_CQ93VC_COPY_H +#include "davinci-pcm-copy.h" + +extern struct davinci_pcm_copy_ops cq93vc_pcm_copy_ops; + +#endif /* _DAVINCI_CQ93VC_COPY_H */