All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Varadarajan, Charulatha" <charu@ti.com>
To: David Lambert <dlambert@ti.com>
Cc: alsa-devel@alsa-project.org, linux-omap@vger.kernel.org,
	Tony Lindgren <tony@atomide.com>, Paul Walmsley <paul@pwsan.com>,
	Mark Brown <broonie@opensource.wolfsonmicro.com>,
	Liam Girdwood <lrg@slimlogic.co.uk>
Subject: Re: [PATCH v3 1/4] ASoC: DMIC: Adding the OMAP DMIC driver
Date: Fri, 28 Jan 2011 13:13:15 +0530	[thread overview]
Message-ID: <AANLkTi=7B9YVWsBcGBcpz+=YgheEFLLUGtBN2qsRMpZD@mail.gmail.com> (raw)
In-Reply-To: <1295992862-6154-2-git-send-email-dlambert@ti.com>

On Wed, Jan 26, 2011 at 03:30, David Lambert <dlambert@ti.com> wrote:
> This patch adds support for the OMAP4 digital microphone DAI.
>
> This DAI can support support recording in 2, 4, or 6 channels
>
> When provided with a 19.2Mhz functional clock, can encode at 96Khz or
> 192Khz (all channels must have the same sample rate).
>
> Details of the hardware interface can be found in the OMAP4 TRM in Section 23.7
>
> Signed-off-by: David Lambert <dlambert@ti.com>
> ---
>  arch/arm/plat-omap/include/plat/dmic.h |   82 +++++
>  sound/soc/omap/Kconfig                 |    3 +
>  sound/soc/omap/Makefile                |    2 +
>  sound/soc/omap/omap-dmic.c             |  534 ++++++++++++++++++++++++++++++++
>  4 files changed, 621 insertions(+), 0 deletions(-)
>  create mode 100644 arch/arm/plat-omap/include/plat/dmic.h
>  create mode 100644 sound/soc/omap/omap-dmic.c
>
> diff --git a/arch/arm/plat-omap/include/plat/dmic.h b/arch/arm/plat-omap/include/plat/dmic.h
> new file mode 100644
> index 0000000..a72e080
> --- /dev/null
> +++ b/arch/arm/plat-omap/include/plat/dmic.h
> @@ -0,0 +1,82 @@
> +/*
> + * omap-dmic.h  --  OMAP Digital Microphone Controller
> + *
> + * Author: Liam Girdwood <lrg@slimlogic.co.uk>
> + *        David Lambert <dlambert@ti.com>
> + *        Misael Lopez Cruz <misael.lopez@ti.com>

Consider adding the copyright info.

> + *
> + * 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.
> + */
> +
> +#ifndef __ASM_ARCH_OMAP_DMIC_H
> +#define __ASM_ARCH_OMAP_DMIC_H
> +
> +#define OMAP44XX_DMIC_L3_BASE  0x4902e000
> +
> +#define OMAP_DMIC_REVISION             0x00
> +#define OMAP_DMIC_SYSCONFIG            0x10

As this driver would use hwmod framework, it would be good
to avoid defining this macro in the driver. Anyway it is not
used in the driver.

> +#define OMAP_DMIC_IRQSTATUS_RAW                0x24
> +#define OMAP_DMIC_IRQSTATUS            0x28
> +#define OMAP_DMIC_IRQENABLE_SET                0x2C
> +#define OMAP_DMIC_IRQENABLE_CLR                0x30
> +#define OMAP_DMIC_IRQWAKE_EN           0x34
> +#define OMAP_DMIC_DMAENABLE_SET                0x38
> +#define OMAP_DMIC_DMAENABLE_CLR                0x3C
> +#define OMAP_DMIC_DMAWAKEEN            0x40
> +#define OMAP_DMIC_CTRL                 0x44
> +#define OMAP_DMIC_DATA                 0x48
> +#define OMAP_DMIC_FIFO_CTRL            0x4C
> +#define OMAP_DMIC_FIFO_DMIC1R_DATA     0x50
> +#define OMAP_DMIC_FIFO_DMIC1L_DATA     0x54
> +#define OMAP_DMIC_FIFO_DMIC2R_DATA     0x58
> +#define OMAP_DMIC_FIFO_DMIC2L_DATA     0x5C
> +#define OMAP_DMIC_FIFO_DMIC3R_DATA     0x60
> +#define OMAP_DMIC_FIFO_DMIC3L_DATA     0x64
> +
> +/*

<<snip>>

> diff --git a/sound/soc/omap/omap-dmic.c b/sound/soc/omap/omap-dmic.c
> new file mode 100644
> index 0000000..06dbb99
> --- /dev/null
> +++ b/sound/soc/omap/omap-dmic.c
> @@ -0,0 +1,534 @@
> +/*
> + * omap-dmic.c  --  OMAP ASoC DMIC DAI driver
> + *
> + * Copyright (C) 2010 Texas Instruments
> + *
> + * Author: Liam Girdwood <lrg@slimlogic.co.uk>
> + *        David Lambert <dlambert@ti.com>
> + *        Misael Lopez Cruz <misael.lopez@ti.com>
> + *
> + * 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
> + *
> + */
> +
> +#undef DEBUG
> +
> +#include <linux/init.h>
> +#include <linux/module.h>
> +#include <linux/platform_device.h>
> +#include <linux/wait.h>
> +#include <linux/interrupt.h>
> +#include <linux/err.h>
> +#include <linux/clk.h>
> +#include <linux/delay.h>
> +#include <linux/io.h>
> +#include <linux/slab.h>
> +#include <linux/pm_runtime.h>
> +
> +#include <plat/control.h>
> +#include <plat/dma.h>
> +#include <plat/dmic.h>
> +#include <plat/omap_hwmod.h>

The above header file is not required in the driver

> +
> +#include <sound/core.h>
> +#include <sound/pcm.h>
> +#include <sound/pcm_params.h>
> +#include <sound/initval.h>
> +#include <sound/soc.h>
> +

<<snip>>

> +
> +static int omap_dmic_dai_trigger(struct snd_pcm_substream *substream,
> +                                 int cmd, struct snd_soc_dai *dai)
> +{
> +       struct omap_dmic *dmic = snd_soc_dai_get_drvdata(dai);
> +       int dmic_id = dmic->link->channels;
> +
> +       switch (cmd) {
> +       case SNDRV_PCM_TRIGGER_START:
> +               omap_dmic_start(dmic, dmic_id);
> +               break;
> +       case SNDRV_PCM_TRIGGER_STOP:
> +               omap_dmic_stop(dmic, dmic_id);
> +               break;
> +       default:

You may consider adding a "command not supported" warning if it would
be meaningful.

> +               break;
> +       }
> +
> +       return 0;
> +}
> +

<<snip>>

> +
> +static struct snd_soc_dai_driver omap_dmic_dai = {
> +
> +       .name = "omap-dmic-dai-0",
> +       .capture = {
> +               .channels_min = 2,
> +               .channels_max = 6,
> +               .rates = OMAP_DMIC_RATES,
> +               .formats = OMAP_DMIC_FORMATS,
> +       },
> +       .ops = &omap_dmic_dai_ops,
> +};
> +
> +static __devinit int asoc_dmic_probe(struct platform_device *pdev)
> +{
> +       struct omap_dmic *dmic;
> +       struct resource *res;
> +       int ret;
> +
> +       dmic = kzalloc(sizeof(struct omap_dmic), GFP_KERNEL);
> +       if (!dmic)
> +               return -ENOMEM;
> +
> +       platform_set_drvdata(pdev, dmic);
> +       dmic->dev = &pdev->dev;
> +       dmic->link = &omap_dmic_link;
> +       dmic->sysclk = OMAP_DMIC_SYSCLK_SYNC_MUX_CLKS;
> +
> +       spin_lock_init(&dmic->lock);
> +
> +       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> +       if (!res) {
> +               dev_err(dmic->dev, "invalid memory resource\n");
> +               ret = -ENODEV;
> +               goto err_res;
> +       }
> +
> +       dmic->io_base = ioremap(res->start, resource_size(res));
> +       if (!dmic->io_base) {

Print the error.

> +               ret = -ENOMEM;
> +               goto err_res;
> +       }
> +
> +       res = platform_get_resource(pdev, IORESOURCE_DMA, 0);
> +       if (!res) {
> +               dev_err(dmic->dev, "invalid dma resource\n");
> +               ret = -ENODEV;
> +               goto err_dai;
> +       }
> +       omap_dmic_dai_dma_params.dma_req = res->start;
> +
> +       pm_runtime_enable(dmic->dev);
> +

Before accessing the below register, you should be doing a pm_runtime_get*()

> +       /* Disable lines while request is ongoing */
> +       omap_dmic_write(dmic, OMAP_DMIC_CTRL, 0x00);
> +
> +       ret = snd_soc_register_dais(&pdev->dev, &omap_dmic_dai, 1);
> +       if (ret)
> +               goto err_dai;
> +
> +       return 0;
> +
> +err_dai:
> +       iounmap(dmic->io_base);
> +err_res:
> +       kfree(dmic);
> +       return ret;
> +}
> +

<<snip>>
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2011-01-28  7:44 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-25 22:00 [PATCH v3 0/4] Adding OMAP DMIC driver to kernel David Lambert
2011-01-25 22:00 ` [PATCH v3 1/4] ASoC: DMIC: Adding the OMAP DMIC driver David Lambert
2011-01-28  7:43   ` Varadarajan, Charulatha [this message]
2011-01-28  8:45   ` Varadarajan, Charulatha
2011-01-25 22:01 ` [PATCH v3 2/4] OMAP4: hwmod: add entries for " David Lambert
2011-01-25 23:54   ` Paul Walmsley
2011-01-26 12:55     ` Lambert, David
2011-01-26 17:28       ` Paul Walmsley
2011-02-14 15:36   ` Cousson, Benoit
2011-01-25 22:01 ` [PATCH v3 3/4] OMAP4: DMIC: initializes the " David Lambert
2011-01-28  7:46   ` Varadarajan, Charulatha
2011-01-25 22:01 ` [PATCH v3 4/4] OMAP4: DMIC: Add DMIC codec platform devices David Lambert
2011-01-26  1:22 ` [PATCH v3 0/4] Adding OMAP DMIC driver to kernel G, Manjunath Kondaiah

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='AANLkTi=7B9YVWsBcGBcpz+=YgheEFLLUGtBN2qsRMpZD@mail.gmail.com' \
    --to=charu@ti.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=dlambert@ti.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=lrg@slimlogic.co.uk \
    --cc=paul@pwsan.com \
    --cc=tony@atomide.com \
    /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.