All of lore.kernel.org
 help / color / mirror / Atom feed
From: Grzegorz Daniluk <g.daniluk@elproma.com.pl>
To: alsa-devel@alsa-project.org
Subject: ASoC: WM8804: fsi-wm8804
Date: Mon, 15 Nov 2010 13:26:37 +0100	[thread overview]
Message-ID: <4CE126FD.7000407@elproma.com.pl> (raw)

Hi,
I'm trying to use the wm8804 codec in my SH4-based system (Renesas 
SH7724 to be precise). I have used the latest kernel 2.6.37-rc1 where 
there is the codec driver for wm8804. However, I have to write my own 
fsi-wm8804.c (like e.g. fsi-da7210.c). My code attached below. After 
compiling it with the rest of the kernel sources or compiling as an 
external module my alsa still does not see any soundcards. However, by 
running i2cdetect I can see that the device is correctly taken by the 
codec driver so the problem is somewhere with my fsi-wm8804 probably. 
Could you take a look at this ? Did I miss something from new ASoC api 
so that this module could correctly talk with wm8804 codec driver ? Also 
(when compiled as modules) after loading and doing lsmod I could see 
that the wm8804 module is not used by fsi-wm8804 module (as it was when 
I was playing with wm8940 on previous kernel versions).

best regards,
Greg

#include <linux/platform_device.h>
#include <sound/sh_fsi.h>

static int fsi_wm8804_init(struct snd_soc_codec *codec)
{

    return 0;
}

static int fsi_wm8804_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_dai *dai = rtd->codec_dai;

    printk("%s\n", __FUNCTION__);

    if(substream->stream == SNDRV_PCM_STREAM_CAPTURE)
    {
        snd_soc_dai_set_pll(dai, 0, 0, 12000000, 94310400);
    }
    else if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
    {
        snd_soc_dai_set_pll(dai, 0, 0, 12000000, 98304000);
    }

    snd_soc_dai_set_fmt(dai, SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF 
|  SND_SOC_DAIFMT_CBM_CFM);

    return 0;
}

static struct snd_soc_ops fsi_wm8804_ops = {
    .hw_params    = fsi_wm8804_hw_params,
};

static struct snd_soc_dai_link fsi_wm8804_dai = {
    .name        = "WM8804",
    .stream_name    = "WM8804",
    .cpu_dai_name    = "fsib-dai", /* FSI B */
    .codec_dai_name    = "wm8804-spdif",
    .platform_name    = "sh_fsi.0",
    .codec_name    = "wm8804.0-003a",    /*0x3a is codec I2C addr*/
    .init        = fsi_wm8804_init,
    .ops        = &fsi_wm8804_ops,
};

static struct snd_soc_card fsi_soc_card = {
    .name        = "FSI (WM8804)",
    .dai_link    = &fsi_wm8804_dai,
    .num_links    = 1,
};

static struct platform_device *fsi_wm8804_snd_device;

static int __init fsi_wm8804_sound_init(void)
{
    int ret;

    printk("%s\n", __FUNCTION__);

    fsi_wm8804_snd_device = platform_device_alloc("soc-audio", FSI_PORT_B);
    if (!fsi_wm8804_snd_device)
        return -ENOMEM;

    platform_set_drvdata(fsi_wm8804_snd_device, &fsi_soc_card);
    ret = platform_device_add(fsi_wm8804_snd_device);
    if (ret)
        platform_device_put(fsi_wm8804_snd_device);

    return ret;
}

static void __exit fsi_wm8804_sound_exit(void)
{
    printk("%s\n", __FUNCTION__);

    platform_device_unregister(fsi_wm8804_snd_device);
}

module_init(fsi_wm8804_sound_init);
module_exit(fsi_wm8804_sound_exit);

/* Module information */
MODULE_DESCRIPTION("ALSA SoC FSI WM8804");
MODULE_LICENSE("GPL")

             reply	other threads:[~2010-11-15 12:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-15 12:26 Grzegorz Daniluk [this message]
2010-11-15 12:33 ` ASoC: WM8804: fsi-wm8804 Mark Brown
2010-11-15 13:46   ` Grzegorz Daniluk
2010-11-15 13:50     ` Mark Brown
2010-11-15 14:03       ` Grzegorz Daniluk
2010-11-15 14:06         ` Mark Brown
2010-11-15 14:54           ` Grzegorz Daniluk
2010-11-15 15:13             ` Mark Brown

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=4CE126FD.7000407@elproma.com.pl \
    --to=g.daniluk@elproma.com.pl \
    --cc=alsa-devel@alsa-project.org \
    /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.