From patchwork Thu Aug 20 12:01:24 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 42880 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n7KC2B2Z009935 for ; Thu, 20 Aug 2009 12:02:12 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754162AbZHTMBi (ORCPT ); Thu, 20 Aug 2009 08:01:38 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754169AbZHTMBi (ORCPT ); Thu, 20 Aug 2009 08:01:38 -0400 Received: from mail.renesas.com ([202.234.163.13]:63960 "EHLO mail01.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754162AbZHTMBe (ORCPT ); Thu, 20 Aug 2009 08:01:34 -0400 X-AuditID: ac140384-00000004000004f6-9e-4a8d3b14181e Received: from guardian01.idc.renesas.com ([172.20.8.200]) by mail01.idc.renesas.com (sendmail) with ESMTP id n7KC1O8V028917; Thu, 20 Aug 2009 21:01:24 +0900 (JST) Received: (from root@localhost) by guardian01.idc.renesas.com with id n7KC1PAf011211; Thu, 20 Aug 2009 21:01:25 +0900 (JST) Received: from mta02.idc.renesas.com (localhost [127.0.0.1]) by mta02.idc.renesas.com with ESMTP id n7KC1OxT012501; Thu, 20 Aug 2009 21:01:24 +0900 (JST) Received: from PG10870.renesas.com ([172.30.8.159]) by ims05.idc.renesas.com (Sendmail) with ESMTPA id <0KOO00AA7C2C7Z@ims05.idc.renesas.com>; Thu, 20 Aug 2009 21:01:24 +0900 (JST) Date: Thu, 20 Aug 2009 21:01:24 +0900 From: Kuninori Morimoto Subject: [PATCH v2 3/4] Add FSI-AK4642 sound support for SuperH To: linux-sh@vger.kernel.org, alsa-devel@alsa-project.org Cc: Takashi Iwai , lethal@linux-sh.org, Magnus Damm , broonie@opensource.wolfsonmicro.com Message-id: MIME-version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-type: text/plain; charset=US-ASCII User-Agent: SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL/10.7 Emacs/22.1 (i386-mingw-nt5.1.2600) MULE/5.0 (SAKAKI) Meadow/3.00-dev (KIKU) X-Brightmail-Tracker: AAAAAA== Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org This patch is tested by ms7724se Signed-off-by: Kuninori Morimoto --- v1 -> v2 o move to sound/soc/sh sound/soc/sh/Kconfig | 8 +++ sound/soc/sh/Makefile | 2 + sound/soc/sh/fsi-ak4642.c | 111 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 121 insertions(+), 0 deletions(-) create mode 100644 sound/soc/sh/fsi-ak4642.c diff --git a/sound/soc/sh/Kconfig b/sound/soc/sh/Kconfig index 01943a1..9154b43 100644 --- a/sound/soc/sh/Kconfig +++ b/sound/soc/sh/Kconfig @@ -40,4 +40,12 @@ config SND_SH7760_AC97 This option enables generic sound support for the first AC97 unit of the SH7760. +config SND_FSI_AK4642 + bool "FSI-AK4642 sound support" + depends on SND_SOC_SH4_FSI + select SND_SOC_AK4642 + help + This option enables generic sound support for the + FSI - AK4642 unit + endmenu diff --git a/sound/soc/sh/Makefile b/sound/soc/sh/Makefile index 9fbcc4a..a699787 100644 --- a/sound/soc/sh/Makefile +++ b/sound/soc/sh/Makefile @@ -12,5 +12,7 @@ obj-$(CONFIG_SND_SOC_SH4_FSI) += snd-soc-fsi.o ## boards snd-soc-sh7760-ac97-objs := sh7760-ac97.o +snd-soc-fsi-ak4642-objs := fsi-ak4642.o obj-$(CONFIG_SND_SH7760_AC97) += snd-soc-sh7760-ac97.o +obj-$(CONFIG_SND_FSI_AK4642) += snd-soc-fsi-ak4642.o diff --git a/sound/soc/sh/fsi-ak4642.c b/sound/soc/sh/fsi-ak4642.c new file mode 100644 index 0000000..3e5498e --- /dev/null +++ b/sound/soc/sh/fsi-ak4642.c @@ -0,0 +1,111 @@ +/* + * FSI-AK464x sound support for ms7724se + * + * Copyright (C) 2009 Renesas Solutions Corp. + * Kuninori Morimoto + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include <../sound/soc/codecs/ak4642.h> + +static struct snd_soc_dai_link fsi_dai_link = { + .name = "AK4642", + .stream_name = "AK4642", + .cpu_dai = &fsi_soc_dai[0], /* fsi */ + .codec_dai = &ak4642_dai, + .ops = NULL, +}; + +static struct snd_soc_card fsi_soc_card = { + .name = "FSI", + .platform = &fsi_soc_platform, + .dai_link = &fsi_dai_link, + .num_links = 1, +}; + +struct ak4642_setup_data ak4642_setup = { + .i2c_bus = 0, + .i2c_address = 0x12, /* 0x13 */ +}; + +static struct snd_soc_device fsi_snd_devdata = { + .card = &fsi_soc_card, + .codec_dev = &soc_codec_dev_ak4642, + .codec_data = &ak4642_setup, +}; + +static int ak4642_add_i2c_device(const struct ak4642_setup_data *setup) +{ + struct i2c_board_info info; + struct i2c_adapter *adapter; + struct i2c_client *client; + + memset(&info, 0, sizeof(struct i2c_board_info)); + info.addr = setup->i2c_address; + strlcpy(info.type, "ak4642", I2C_NAME_SIZE); + + adapter = i2c_get_adapter(setup->i2c_bus); + if (!adapter) { + printk(KERN_DEBUG "can't get i2c adapter\n"); + return -ENODEV; + } + + client = i2c_new_device(adapter, &info); + i2c_put_adapter(adapter); + if (!client) { + printk(KERN_DEBUG "can't add i2c device\n"); + return -ENODEV; + } + + return 0; +} + +static struct platform_device *fsi_snd_device; + +static int __init fsi_ak4642_init(void) +{ + int ret = -ENOMEM; + + ak4642_add_i2c_device(&ak4642_setup); + + fsi_snd_device = platform_device_alloc("soc-audio", -1); + if (!fsi_snd_device) + goto out; + + platform_set_drvdata(fsi_snd_device, + &fsi_snd_devdata); + fsi_snd_devdata.dev = &fsi_snd_device->dev; + ret = platform_device_add(fsi_snd_device); + + if (ret) + platform_device_put(fsi_snd_device); + +out: + return ret; +} + +static void __exit fsi_ak4642_exit(void) +{ + platform_device_unregister(fsi_snd_device); +} + +module_init(fsi_ak4642_init); +module_exit(fsi_ak4642_exit); + +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("Generic SH4 FSI-AK4642 sound card"); +MODULE_AUTHOR("Kuninori Morimoto ");