public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Olof Johansson <olof@lixom•net>
To: Timur Tabi <timur@freescale•com>
Cc: linuxppc-dev@ozlabs•org, alsa-devel@alsa-project•org
Subject: Re: [PATCH] ASoC drivers for the Freescale MPC8610 SoC
Date: Wed, 19 Dec 2007 22:06:34 -0600	[thread overview]
Message-ID: <20071220040633.GA6732@lixom.net> (raw)
In-Reply-To: <11981089894052-git-send-email-timur@freescale.com>

Hi,

This is a fairly substantial driver to get through, but here are some
initial comments on some of the simpler stuff:


On Wed, Dec 19, 2007 at 06:03:09PM -0600, Timur Tabi wrote:
> This patch adds ALSA SoC device drivers for the Freescale MPC8610 SoC
> and the MPC8610-HPCD reference board.

[...]

> diff --git a/arch/powerpc/platforms/86xx/mpc8610_hpcd.c b/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
> index 6390895..6e1bde3 100644
> --- a/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
> +++ b/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
> @@ -34,9 +34,27 @@
>  
>  #include <asm/mpic.h>
>  
> +#include <asm/of_platform.h>
>  #include <sysdev/fsl_pci.h>
>  #include <sysdev/fsl_soc.h>
>  
> +static struct of_device_id mpc8610_ids[] = {
> +	{ .type = "soc", },
> +	{}

Please scan based on compatible instead of device_type.

> diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig
> new file mode 100644
> index 0000000..4a5bbd2
> --- /dev/null
> +++ b/sound/soc/fsl/Kconfig
> @@ -0,0 +1,21 @@
> +menu "ALSA SoC audio for Freescale SOCs"
> +
> +config SND_SOC_MPC8610
> +	bool "ALSA SoC support for the MPC8610 SOC"
> +	depends on SND_SOC #&& MPC8610_HPCD
> +	default y #if MPC8610
> +	help
> +	  Say Y if you want to add support for codecs attached to the SSI
> +          device on an MPC8610.

Don't default configs to 'y'. Also, what's with the commented-out
dependencies and if?

> +config SND_SOC_MPC8610_HPCD
> +	# ALSA SoC support for Freescale MPC8610HPCD
> +	bool "ALSA SoC support for the Freescale MPC8610 HPCD board"
> +	depends on SND_SOC_MPC8610
> +	select SND_SOC_CS4270
> +	select SND_SOC_CS4270_VD33_ERRATA
> +	default y #if MPC8610_HPCD
> +	help
> +	  Say Y if you want to enable audio on the Freescale MPC8610 HPCD.

Same here w.r.t. defaults and dependencies.

> diff --git a/sound/soc/fsl/fsl_dma.c b/sound/soc/fsl/fsl_dma.c
> new file mode 100644
> index 0000000..6b86be0
> --- /dev/null
> +++ b/sound/soc/fsl/fsl_dma.c
> @@ -0,0 +1,819 @@
> +/*
> + * Freescale DMA ALSA SoC PCM driver
> + *
> + * Author: Timur Tabi <timur@freescale•com>
> + *
> + * Copyright 2007 Freescale Semiconductor, Inc.  This file is licensed under
> + * the terms of the GNU General Public License version 2.  This program
> + * is licensed "as is" without any warranty of any kind, whether express
> + * or implied.
> + *
> + * This driver implements ASoC support for the Elo DMA controller, which is
> + * the DMA controller on Freescale 83xx, 85xx, and 86xx SOCs. In ALSA terms,
> + * the PCM driver is what handles the DMA buffer.
> + */
> +
> +#include <linux/module.h>
> +#include <linux/init.h>
> +#include <linux/platform_device.h>
> +#include <linux/dma-mapping.h>
> +#include <linux/interrupt.h>
> +#include <linux/delay.h>
> +
> +#include <sound/driver.h>
> +#include <sound/core.h>
> +#include <sound/pcm.h>
> +#include <sound/pcm_params.h>
> +#include <sound/soc.h>
> +
> +#include <asm/io.h>
> +
> +#include "fsl_dma.h"
> +
> +/*
> + * The formats that the DMA controller supports, which is anything
> + * that is 8, 16, or 32 bits.
> + */
> +#define FSLDMA_PCM_FORMATS (SNDRV_PCM_FMTBIT_S8 	| \
> +			    SNDRV_PCM_FMTBIT_U8 	| \
> +			    SNDRV_PCM_FMTBIT_S16_LE     | \
> +			    SNDRV_PCM_FMTBIT_S16_BE     | \
> +			    SNDRV_PCM_FMTBIT_U16_LE     | \
> +			    SNDRV_PCM_FMTBIT_U16_BE     | \
> +			    SNDRV_PCM_FMTBIT_S24_LE     | \
> +			    SNDRV_PCM_FMTBIT_S24_BE     | \
> +			    SNDRV_PCM_FMTBIT_U24_LE     | \
> +			    SNDRV_PCM_FMTBIT_U24_BE     | \
> +			    SNDRV_PCM_FMTBIT_S32_LE     | \
> +			    SNDRV_PCM_FMTBIT_S32_BE     | \
> +			    SNDRV_PCM_FMTBIT_U32_LE     | \
> +			    SNDRV_PCM_FMTBIT_U32_BE)
> +
> +#define FSLDMA_PCM_RATES (SNDRV_PCM_RATE_5512 | SNDRV_PCM_RATE_8000_192000 | \
> +			  SNDRV_PCM_RATE_CONTINUOUS)
> +
> +/* DMA global data.  This structure is used by fsl_dma_open() to determine
> + * which DMA channels to assign to a substream.  Unfortunately, ASoC V1 does
> + * not allow the machine driver to provide this information to the PCM
> + * driver in advance, and there's no way to differentiate between the two
> + * DMA controllers.  So for now, this driver only supports one SSI device
> + * using two DMA channels.  We cannot support multiple DMA devices.
> + *
> + * ssi_stx_phys: bus address of SSI STX register
> + * ssi_srx_phys: bus address of SSI SRX register
> + * dma_channel: pointer to the DMA channel's registers
> + * irq: IRQ for this DMA channel
> + * assigned: set to 1 if that DMA channel is assigned to a substream
> + */

This goes for the whole patch: You've got good documentation, but it's
not in docbook format. Please reformat it since it should be a pretty
simple thing to do.

> +/*
> + * Initialize this PCM driver.
> + *
> + * This function is called when the codec driver calls snd_soc_new_pcms(),
> + * once for each .dai_link in the machine driver's snd_soc_machine
> + * structure.
> + */
> +static int fsl_dma_new(struct snd_card *card, struct snd_soc_codec_dai *dai,
> +	struct snd_pcm *pcm)
> +{
> +	static u64 fsl_dma_dmamask = 0xffffffff;
> +	int ret;
> +
> +	if (!card->dev->dma_mask)
> +		card->dev->dma_mask = &fsl_dma_dmamask;

I haven't read how your channel allocation works, but providing a
pointer to a local static variable is a bit fishy no matter what.

> +	/* Find the DMA channels to use.  For now, we always use the first DMA
> +	   controller. */
> +	for_each_compatible_node(dma_np, NULL, "fsl,mpc8610-dma") {
> +		iprop = of_get_property(dma_np, "cell-index", NULL);
> +		if (iprop && (*iprop == 0)) {
> +			of_node_put(dma_np);
> +			break;
> +		}
> +	}

Do you ever anticipate having other dma users on the system, such as
memcpy offload? You'll probably need allocation support for channels
when that day comes (I ended up writing a simple library for dma channel
management for that very reason on my platform).


-Olof

  reply	other threads:[~2007-12-20  4:00 UTC|newest]

Thread overview: 89+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-20  0:03 [PATCH] ASoC drivers for the Freescale MPC8610 SoC Timur Tabi
2007-12-20  4:06 ` Olof Johansson [this message]
2007-12-20 14:24   ` Timur Tabi
2007-12-20 13:54     ` [alsa-devel] " Takashi Iwai
2007-12-20 17:04       ` Timur Tabi
2007-12-21  5:28       ` Lee Revell
2007-12-23  3:23         ` Timur Tabi
2007-12-20 22:39     ` Olof Johansson
2007-12-20 22:37       ` Timur Tabi
2007-12-20 22:43         ` Scott Wood
2007-12-23  2:58           ` Timur Tabi
2008-01-02 18:08             ` Scott Wood
2007-12-20 14:47 ` Jon Loeliger
2007-12-20 22:29 ` Jon Smirl
2007-12-20 22:32   ` Timur Tabi
2007-12-20 22:38     ` Jon Smirl
2007-12-20 22:40       ` Timur Tabi
2007-12-20 22:44         ` Scott Wood
2007-12-20 23:13           ` Jon Smirl
2007-12-21  0:00             ` David Gibson
2008-01-01 17:25 ` Jon Smirl
2008-01-01 17:42   ` Jon Smirl
2008-01-02 15:19     ` Timur Tabi
2008-01-02 15:34       ` Jon Smirl
2008-01-03 17:54         ` Timur Tabi
2008-01-03 18:13           ` Grant Likely
2008-01-03 18:20             ` Timur Tabi
2008-01-03 18:32               ` Grant Likely
2008-01-03 23:51           ` David Gibson
2008-01-05  2:39             ` [alsa-devel] " Timur Tabi
2008-01-06  0:46               ` David Gibson
2008-01-07 14:24                 ` Mark Brown
2008-01-07 15:52                 ` Timur Tabi
2008-01-07 18:28                   ` Mark Brown
2008-01-10  3:49                     ` David Gibson
2008-01-10  5:41                       ` Jon Smirl
2008-01-10 10:30                         ` Liam Girdwood
2008-01-10 15:39                           ` Timur Tabi
2008-01-10 16:01                             ` Grant Likely
2008-01-10 16:03                               ` Timur Tabi
2008-01-10 20:10                                 ` Jon Smirl
2008-01-10 20:13                                   ` Timur Tabi
2008-01-10 20:24                                     ` Grant Likely
2008-01-10 20:35                                       ` Timur Tabi
2008-01-10 20:39                                     ` Jon Smirl
2008-01-10 20:44                                       ` Timur Tabi
2008-01-07 18:44                   ` Liam Girdwood
2008-01-07 18:45                     ` Timur Tabi
2008-01-02 16:12       ` Grant Likely
2008-01-03 18:08         ` Timur Tabi
2008-01-03 18:17           ` Grant Likely
2008-01-03 18:54             ` Scott Wood
2008-01-03 19:13               ` Grant Likely
2008-01-03 19:18                 ` Scott Wood
2008-01-03 23:13                   ` [alsa-devel] " Mark Brown
2008-01-05  2:35                 ` Timur Tabi
2008-01-05  3:28                   ` Grant Likely
2008-01-02  0:26   ` David Gibson
2008-01-02 15:10   ` Timur Tabi
2008-01-02 17:23     ` [alsa-devel] " Mark Brown
2008-01-03 18:23       ` Timur Tabi
2008-01-03 23:00         ` Mark Brown
2008-01-05  2:43           ` Timur Tabi
2008-01-07 13:37             ` Mark Brown
2008-01-02  4:27 ` Jon Smirl
2008-01-02 15:29   ` Timur Tabi
2008-01-02 15:56     ` Jon Smirl
2008-01-02 16:32       ` Grant Likely
2008-01-02 17:12         ` Jon Smirl
2008-01-02 17:22           ` Grant Likely
2008-01-02 18:43             ` Jon Smirl
2008-01-02 18:50               ` Grant Likely
2008-01-02 18:56                 ` Jon Smirl
2008-01-03  4:46           ` David Gibson
2008-01-03 14:33             ` Jon Smirl
2008-01-03 17:57       ` Timur Tabi
2008-01-02 16:28     ` Grant Likely
2008-01-02 18:49       ` [alsa-devel] " Mark Brown
2008-01-03 18:16         ` Timur Tabi
2008-01-03 23:47           ` David Gibson
2008-01-04 13:39             ` Mark Brown
2008-01-03 18:14       ` Timur Tabi
2008-01-03 18:25         ` Grant Likely
2008-01-03 18:28           ` Timur Tabi
2008-01-03 18:38             ` Grant Likely
2008-01-03  4:44     ` David Gibson
2008-01-03 14:54       ` Jon Smirl
2008-01-04  5:01         ` David Gibson
2008-01-03 18:16       ` Timur Tabi

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=20071220040633.GA6732@lixom.net \
    --to=olof@lixom$(echo .)net \
    --cc=alsa-devel@alsa-project$(echo .)org \
    --cc=linuxppc-dev@ozlabs$(echo .)org \
    --cc=timur@freescale$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox