From patchwork Tue Dec 28 04:17:03 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Lambert X-Patchwork-Id: 435541 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oBS63ofY003623 for ; Tue, 28 Dec 2010 06:04:19 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753371Ab0L1ERn (ORCPT ); Mon, 27 Dec 2010 23:17:43 -0500 Received: from devils.ext.ti.com ([198.47.26.153]:37540 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753244Ab0L1ERn (ORCPT ); Mon, 27 Dec 2010 23:17:43 -0500 Received: from dlep36.itg.ti.com ([157.170.170.91]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id oBS4HU3s009244 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 27 Dec 2010 22:17:31 -0600 Received: from legion.dal.design.ti.com (localhost [127.0.0.1]) by dlep36.itg.ti.com (8.13.8/8.13.8) with ESMTP id oBS4HTSb011204; Mon, 27 Dec 2010 22:17:29 -0600 (CST) Received: from localhost (dta0193948-ubuntu.am.dhcp.ti.com [128.247.75.14]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id oBS4HTf24884; Mon, 27 Dec 2010 22:17:29 -0600 (CST) From: David Lambert To: alsa-devel@alsa-project.org, linux-omap@vger.kernel.org Cc: Liam Girdwood , Mark Brown , Tony Lindgren , Paul Walmsley , David Lambert Subject: [PATCH 2/5] ASoC: DMIC codec: Adding a generic DMIC codec Date: Mon, 27 Dec 2010 22:17:03 -0600 Message-Id: <1293509826-23253-3-git-send-email-dlambert@ti.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1293509826-23253-1-git-send-email-dlambert@ti.com> References: <1293509826-23253-1-git-send-email-dlambert@ti.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Tue, 28 Dec 2010 06:04:19 +0000 (UTC) diff --git a/sound/soc/codecs/dmic.c b/sound/soc/codecs/dmic.c new file mode 100644 index 0000000..6f54bc5 --- /dev/null +++ b/sound/soc/codecs/dmic.c @@ -0,0 +1,79 @@ +/* + * dmic.c -- SoC audio for Generic Digital MICs + * + * Author: Liam Girdwood + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * 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., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + * + */ + +#include +#include +#include +#include +#include +#include + +static struct snd_soc_dai_driver dmic_dai = { + .name = "dmic-hifi", + .capture = { + .stream_name = "Capture", + .channels_min = 1, + .channels_max = 8, + .rates = SNDRV_PCM_RATE_CONTINUOUS, + .formats = SNDRV_PCM_FMTBIT_S32_LE + | SNDRV_PCM_FMTBIT_S24_LE + | SNDRV_PCM_FMTBIT_S16_LE, + }, +}; + +static struct snd_soc_codec_driver soc_dmic = {}; + +static int __devinit dmic_dev_probe(struct platform_device *pdev) +{ + return snd_soc_register_codec(&pdev->dev, + &soc_dmic, &dmic_dai, 1); +} + +static int __devexit dmic_dev_remove(struct platform_device *pdev) +{ + snd_soc_unregister_codec(&pdev->dev); + return 0; +} + +static struct platform_driver dmic_driver = { + .driver = { + .name = "dmic-codec", + .owner = THIS_MODULE, + }, + .probe = dmic_dev_probe, + .remove = __devexit_p(dmic_dev_remove), +}; + +static int __init dmic_init(void) +{ + return platform_driver_register(&dmic_driver); +} +module_init(dmic_init); + +static void __exit dmic_exit(void) +{ + platform_driver_unregister(&dmic_driver); +} +module_exit(dmic_exit); + +MODULE_DESCRIPTION("Generic DMIC driver"); +MODULE_AUTHOR("Liam Girdwood "); +MODULE_LICENSE("GPL");