From: "Vladimir A. Barinov" <vbarinov@ru.mvista.com>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: tiwai@suse.de, liam.girdwood@opensource.wolfsonmicro.com,
alsa-devel@alsa-project.org,
Liam Girdwood <liam@localhost.localdomain>,
Nicola Perrino <nicola.perrino@atlab.it>
Subject: Re: [PATCH] Add Amesom ASoC machine support.
Date: Tue, 20 Nov 2007 15:31:30 +0300 [thread overview]
Message-ID: <4742D3A2.4020606@ru.mvista.com> (raw)
In-Reply-To: <1195550746-6892-20-git-send-email-broonie@opensource.wolfsonmicro.com>
Mark,
I suggest to do the same naming changes in the machine part like I 've
suggested for tlv32024K codec driver: rename all tlv320 places to
tlv320aic2x and "aic2x_"
Also I suggest to name all static functions in the machine ASoC part to
begin from ameson_ and not the codec one.
Regards,
Vladimir
Mark Brown wrote:
> From: Liam Girdwood <liam@localhost.localdomain>
>
> Signed-off-by: Nicola Perrino <nicola.perrino@atlab.it>
> Signed-off-by: Liam Girdwood <lg@opensource.wolfsonmicro.com>
> ---
> sound/soc/pxa/Kconfig | 10 ++
> sound/soc/pxa/Makefile | 3 +-
> sound/soc/pxa/amesom_tlv320.c | 211 +++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 223 insertions(+), 1 deletions(-)
> create mode 100644 sound/soc/pxa/amesom_tlv320.c
>
> diff --git a/sound/soc/pxa/Kconfig b/sound/soc/pxa/Kconfig
> index ca825e6..bcb3aa0 100644
> --- a/sound/soc/pxa/Kconfig
> +++ b/sound/soc/pxa/Kconfig
> @@ -57,3 +57,13 @@ config SND_PXA2XX_SOC_TOSA
> help
> Say Y if you want to add support for SoC audio on Sharp
> Zaurus SL-C6000x models (Tosa).
> +
> +config SND_PXA2XX_SOC_AMESOM_TLV320
> + tristate "SoC SSP Audio support for AMESOM - TLV320AIC24k"
> + depends on SND_PXA2XX_SOC && MACH_AMESOM
> + select SND_PXA2XX_SOC_I2S
> + select SND_PXA2XX_SOC_SSP
> + select SND_SOC_TLV320
> + help
> + Say Y if you want to add support for SoC audio on Amesom
> + with the tlv320.
> diff --git a/sound/soc/pxa/Makefile b/sound/soc/pxa/Makefile
> index c631651..931bdc7 100644
> --- a/sound/soc/pxa/Makefile
> +++ b/sound/soc/pxa/Makefile
> @@ -14,9 +14,10 @@ snd-soc-corgi-objs := corgi.o
> snd-soc-poodle-objs := poodle.o
> snd-soc-tosa-objs := tosa.o
> snd-soc-spitz-objs := spitz.o
> +snd-soc-amesom-tlv320-objs := amesom_tlv320.o
>
> obj-$(CONFIG_SND_PXA2XX_SOC_CORGI) += snd-soc-corgi.o
> obj-$(CONFIG_SND_PXA2XX_SOC_POODLE) += snd-soc-poodle.o
> obj-$(CONFIG_SND_PXA2XX_SOC_TOSA) += snd-soc-tosa.o
> obj-$(CONFIG_SND_PXA2XX_SOC_SPITZ) += snd-soc-spitz.o
> -
> +obj-$(CONFIG_SND_PXA2XX_SOC_AMESOM_TLV320) += snd-soc-amesom-tlv320.o
> diff --git a/sound/soc/pxa/amesom_tlv320.c b/sound/soc/pxa/amesom_tlv320.c
> new file mode 100644
> index 0000000..6aa1c2c
> --- /dev/null
> +++ b/sound/soc/pxa/amesom_tlv320.c
> @@ -0,0 +1,211 @@
> +/*
> + * amesom_tlv320.c -- SoC audio for Amesom
> + *
> + * Copyright 2005 Wolfson Microelectronics PLC.
> + * Copyright 2006 Atlab srl.
> + *
> + * Authors: Liam Girdwood <liam.girdwood@wolfsonmicro.com>
> + * Nicola Perrino <nicola.perrino@atlab.it>
> + *
> + * 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.
> + *
> + * Revision history
> + * 5th Dec 2006 Initial version.
> + *
> + */
> +
> +#include <linux/module.h>
> +#include <linux/moduleparam.h>
> +#include <linux/device.h>
> +#include <linux/i2c.h>
> +#include <sound/driver.h>
> +#include <sound/core.h>
> +#include <sound/pcm.h>
> +#include <sound/soc.h>
> +#include <sound/soc-dapm.h>
> +
> +#include <asm/hardware.h>
> +#include <asm/arch/pxa-regs.h>
> +#include <asm/arch/audio.h>
> +
> +#include "../codecs/tlv320.h"
> +#include "pxa2xx-pcm.h"
> +#include "pxa2xx-i2s.h"
> +#include "pxa2xx-ssp.h"
> +
> +
> +/*
> + * SSP2 GPIO's
> + */
> +
> +#define GPIO11_SSP2RX_MD (11 | GPIO_ALT_FN_2_IN)
> +#define GPIO13_SSP2TX_MD (13 | GPIO_ALT_FN_1_OUT)
> +#define GPIO50_SSP2CLKS_MD (50 | GPIO_ALT_FN_3_IN)
> +#define GPIO14_SSP2FRMS_MD (14 | GPIO_ALT_FN_2_IN)
> +#define GPIO50_SSP2CLKM_MD (50 | GPIO_ALT_FN_3_OUT)
> +#define GPIO14_SSP2FRMM_MD (14 | GPIO_ALT_FN_2_OUT)
> +
> +
> +static struct snd_soc_machine amesom;
> +
> +
> +static int amesom_probe(struct platform_device *pdev)
> +{
> + return 0;
> +}
> +
> +static int amesom_remove(struct platform_device *pdev)
> +{
> + return 0;
> +}
> +
> +static int tlv320_voice_startup(struct snd_pcm_substream *substream)
> +{
> + return 0;
> +}
> +
> +static void tlv320_voice_shutdown(struct snd_pcm_substream *substream)
> +{
> + return;
> +}
> +
> +/*
> + * Tlv320 uses SSP port for playback.
> + */
> +static int tlv320_voice_hw_params(struct snd_pcm_substream *substream,
> + struct snd_pcm_hw_params *params)
> +{
> + struct snd_soc_pcm_runtime *rtd = substream->private_data;
> + struct snd_soc_codec_dai *codec_dai = rtd->dai->codec_dai;
> + struct snd_soc_cpu_dai *cpu_dai = rtd->dai->cpu_dai;
> + int ret = 0;
> +
> + //printk("tlv320_voice_hw_params enter\n");
> + switch(params_rate(params)) {
> + case 8000:
> + //printk("tlv320_voice_hw_params 8000\n");
> + break;
> + case 16000:
> + //printk("tlv320_voice_hw_params 16000\n");
> + break;
> + default:
> + break;
> + }
> +
> + // CODEC MASTER, SSP SLAVE
> +
> + /* set codec DAI configuration */
> + ret = codec_dai->dai_ops.set_fmt(codec_dai, SND_SOC_DAIFMT_MSB |
> + SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM);
> + if (ret < 0)
> + return ret;
> +
> + /* set cpu DAI configuration */
> + ret = cpu_dai->dai_ops.set_fmt(cpu_dai, SND_SOC_DAIFMT_MSB |
> + SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM);
> + if (ret < 0)
> + return ret;
> +
> + /* set the SSP system clock as input (unused) */
> + ret = cpu_dai->dai_ops.set_sysclk(cpu_dai, PXA2XX_SSP_CLK_NET_PLL, 0,
> + SND_SOC_CLOCK_IN);
> + if (ret < 0)
> + return ret;
> +
> + /* set SSP slots */
> + //ret = cpu_dai->dai_ops.set_tdm_slot(cpu_dai, 0x1, slots);
> + ret = cpu_dai->dai_ops.set_tdm_slot(cpu_dai, 0x3, 1);
> + if (ret < 0)
> + return ret;
> +
> + return 0;
> +}
> +
> +static int tlv320_voice_hw_free(struct snd_pcm_substream *substream)
> +{
> + return 0;
> +}
> +
> +static struct snd_soc_ops tlv320_voice_ops = {
> + .startup = tlv320_voice_startup,
> + .shutdown = tlv320_voice_shutdown,
> + .hw_params = tlv320_voice_hw_params,
> + .hw_free = tlv320_voice_hw_free,
> +};
> +
> +
> +static struct snd_soc_dai_link amesom_dai[] = {
> +{
> + .name = "TLV320",
> + .stream_name = "TLV320 Voice",
> + .cpu_dai = &pxa_ssp_dai[PXA2XX_DAI_SSP2],
> + .codec_dai = &tlv320_dai[TLV320_DAI_MODE1_VOICE],
> + .ops = &tlv320_voice_ops,
> +},
> +};
> +
> +static struct snd_soc_machine amesom = {
> + .name = "Amesom",
> + .probe = amesom_probe,
> + .remove = amesom_remove,
> + .dai_link = amesom_dai,
> + .num_links = ARRAY_SIZE(amesom_dai),
> +};
> +
> +static struct tlv320_setup_data amesom_tlv320_setup = {
> +#ifdef TLV320AIC24K //codec2
> + .i2c_address = 0x41,
> +#else // TLV320AIC14k
> + .i2c_address = 0x40,
> +#endif
> +};
> +
> +static struct snd_soc_device amesom_snd_devdata = {
> + .machine = &amesom,
> + .platform = &pxa2xx_soc_platform,
> + .codec_dev = &soc_codec_dev_tlv320,
> + .codec_data = &amesom_tlv320_setup,
> +};
> +
> +static struct platform_device *amesom_snd_device;
> +
> +static int __init amesom_init(void)
> +{
> + int ret;
> +
> + amesom_snd_device = platform_device_alloc("soc-audio", -1);
> + if (!amesom_snd_device)
> + return -ENOMEM;
> +
> + platform_set_drvdata(amesom_snd_device, &amesom_snd_devdata);
> + amesom_snd_devdata.dev = &amesom_snd_device->dev;
> + ret = platform_device_add(amesom_snd_device);
> +
> + if (ret)
> + platform_device_put(amesom_snd_device);
> +
> +
> + /* SSP port 2 slave */
> + pxa_gpio_mode(GPIO11_SSP2RX_MD);
> + pxa_gpio_mode(GPIO13_SSP2TX_MD);
> + pxa_gpio_mode(GPIO50_SSP2CLKS_MD);
> + pxa_gpio_mode(GPIO14_SSP2FRMS_MD);
> +
> + return ret;
> +}
> +
> +static void __exit amesom_exit(void)
> +{
> + platform_device_unregister(amesom_snd_device);
> +}
> +
> +module_init(amesom_init);
> +module_exit(amesom_exit);
> +
> +/* Module information */
> +MODULE_AUTHOR("Nicola Perrino");
> +MODULE_DESCRIPTION("ALSA SoC TLV320 Amesom");
> +MODULE_LICENSE("GPL");
>
next prev parent reply other threads:[~2007-11-20 12:31 UTC|newest]
Thread overview: 63+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-20 9:25 ASoC merge Mark Brown
2007-11-20 9:25 ` [PATCH] Update MAINTAINERS for ALSA SoC Mark Brown
2007-11-20 9:25 ` [PATCH] Reinitialise DMA on every resume Mark Brown
2007-11-20 9:25 ` [PATCH] Support suspend and resume of the I2S interface on s3c24xx Mark Brown
2007-11-20 9:25 ` [PATCH] Fix inverted Bass, Treble, Mono volume and Phone volume WM9712 mixer controls Mark Brown
2007-11-20 9:25 ` [PATCH] Add device level DAPM event Mark Brown
2007-11-20 9:25 ` [PATCH] ASoC TLV support Mark Brown
2007-11-20 9:25 ` [PATCH] Add D1 power event to power down event sequence Mark Brown
2007-11-20 9:25 ` [PATCH] Ensure PCMs are suspended Mark Brown
2007-11-20 9:25 ` [PATCH] Fix power switching support for DAPM_SWITCH widgets Mark Brown
2007-11-20 9:25 ` [PATCH] Clean up tabs Mark Brown
2007-11-20 9:25 ` [PATCH] Add support for passing kcontrols with events Mark Brown
2007-11-20 9:25 ` [PATCH] Bump ASoC core version number Mark Brown
2007-11-20 9:25 ` [PATCH] Add ASoC WM9713 codec driver Mark Brown
2007-11-20 9:25 ` [PATCH] Initial WM8753 TLV support for capture mixer Mark Brown
2007-11-20 9:25 ` [PATCH] Add ASoC AK4535 codec driver Mark Brown
2007-11-20 9:25 ` [PATCH] Add ASoC TLV320 Codec driver Mark Brown
2007-11-20 9:25 ` [PATCH] Add ASoC UDA1380 codec driver Mark Brown
2007-11-20 9:25 ` [PATCH] Add pxa2xx SSP audio support Mark Brown
2007-11-20 9:25 ` [PATCH] Add Amesom ASoC machine support Mark Brown
2007-11-20 9:25 ` [PATCH] Add ASoC Magician " Mark Brown
2007-11-20 9:25 ` [PATCH] Add TLV support for UDA1380 Mark Brown
2007-11-20 9:25 ` [PATCH] Add ASoC WM8510 codec driver Mark Brown
2007-11-20 9:25 ` [PATCH] Add ASoC WM8711 " Mark Brown
2007-11-20 11:09 ` Takashi Iwai
2007-11-20 13:12 ` Mark Brown
2007-11-20 11:07 ` [PATCH] Add TLV support for UDA1380 Takashi Iwai
2007-11-20 11:03 ` [PATCH] Add ASoC Magician machine support Takashi Iwai
2007-11-20 14:20 ` Mark Brown
2007-11-20 14:34 ` pHilipp Zabel
2007-11-20 15:43 ` Mark Brown
2007-11-20 18:48 ` pHilipp Zabel
2007-11-20 11:01 ` [PATCH] Add Amesom ASoC " Takashi Iwai
2007-11-20 12:31 ` Vladimir A. Barinov [this message]
2007-11-20 12:43 ` Mark Brown
2007-11-20 10:53 ` [PATCH] Add ASoC TLV320 Codec driver Takashi Iwai
2007-11-20 12:22 ` Mark Brown
2007-11-20 21:34 ` Jean Delvare
2007-11-21 9:48 ` Takashi Iwai
2007-11-21 12:33 ` Mark Brown
2007-11-20 12:26 ` Vladimir A. Barinov
2007-11-20 10:40 ` [PATCH] Add ASoC AK4535 codec driver Takashi Iwai
2007-11-20 15:05 ` Mark Brown
2007-11-20 14:42 ` Takashi Iwai
2007-11-20 15:35 ` Mark Brown
2007-11-20 15:20 ` Takashi Iwai
2007-11-20 10:15 ` [PATCH] Initial WM8753 TLV support for capture mixer Takashi Iwai
2007-11-20 13:45 ` Mark Brown
2007-11-20 10:33 ` [PATCH] Add ASoC WM9713 codec driver Takashi Iwai
2007-11-20 12:02 ` Clemens Ladisch
2007-11-21 16:16 ` Mark Brown
2007-11-20 10:20 ` [PATCH] Bump ASoC core version number Takashi Iwai
2007-11-20 10:07 ` [PATCH] Ensure PCMs are suspended Takashi Iwai
2007-11-20 10:06 ` [PATCH] Add D1 power event to power down event sequence Takashi Iwai
2007-11-20 10:07 ` [PATCH] Fix inverted Bass, Treble, Mono volume and Phone volume WM9712 mixer controls Takashi Iwai
2007-11-20 10:52 ` Mark Brown
2007-11-20 12:08 ` Mike Rapoport
2007-11-20 17:40 ` Mark Brown
2007-11-20 10:19 ` ASoC merge Takashi Iwai
2007-11-20 10:56 ` Mark Brown
2007-11-20 14:59 ` Jon Smirl
2007-11-20 16:56 ` Mark Brown
2007-11-20 17:43 ` Jon Smirl
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4742D3A2.4020606@ru.mvista.com \
--to=vbarinov@ru.mvista.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=liam.girdwood@opensource.wolfsonmicro.com \
--cc=liam@localhost.localdomain \
--cc=nicola.perrino@atlab.it \
--cc=tiwai@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.