snd-soc - platform_device_add failed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I am trying to create alsa driver for MAX9880 which is connected to
S3C6410. I "copied" the initialization code from other examples in
sound/soc/ but during initialization I am getting "platform_device_add
failed". I attached the code for kernel 2.6.29, ALSA 1.0.18a. For me
it does not have anything which can fail. But I never wrote drivers
for ALSA.

I have another question. In the kernel code sound/soc/s3c_64xx/, there
is a plenty of s3c_i2s files. Different versions but no description,
which version should I use. Does anybody know, which one is the right
version ?

Thank you in advance,
Vaclav
/*
 * Samsung S8000 Jet Audio Subsystem
 *
 * (c) 2010 Vaclav Peroutka - vaclavpe@xxxxxxxxx
 *
 * Licensed under the GPLv2.
 *
 *  Revision history
 *    2010/11/11   Initial version
 *
 */

#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/timer.h>
#include <linux/interrupt.h>
#include <linux/platform_device.h>
#include <linux/i2c.h>
#include <linux/delay.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/soc.h>
#include <sound/soc-dapm.h>

#include <asm/mach-types.h>
#include <asm/hardware/scoop.h>
#include <asm/io.h>

#include <mach/hardware.h>
#include <mach/audio.h>
#include <mach/map.h>

#include <plat/gpio-cfg.h>
#include <plat/regs-gpio.h>
#include <plat/regs-iic.h>
#include <plat/regs-clock.h>
#include <plat/regs-iis.h>

#include "s3c-pcm.h"
#include "s3c6410-i2s.h"
#include "../codecs/max9880.h"

#define SUBJECT "Jet_max9880"

static struct max9880_setup_data max9880_setup = {
   .i2c_address = (0x20 >> 1),
};

static struct snd_soc_dai_link s3c6410_max9880_dai = {
   .name = "MAX9880",
   .stream_name = "MAX9880 Codec",
   .cpu_dai = &s3c_i2s_dai,
   .codec_dai = &max9880_dai,
   .init = NULL,
   .ops = NULL,
};

static struct snd_soc_card s3c6410_max9880_soc_card  = {
   .name = "S3C6410 MAX9880",
   .platform = &s3c24xx_soc_platform,
   .dai_link = &s3c6410_max9880_dai,
   .num_links = 1,
};

static struct snd_soc_device s3c6410_max9880_snd_devdata = {
   .card = &s3c6410_max9880_soc_card,
   .codec_dev = &soc_codec_dev_max9880,
   .codec_data = &max9880_setup,
};

static struct platform_device *s3c6410_max9880_snd_device;

static int __init s3c6410_max9880_init(void)
{
   int ret;

   printk("[%s]", __FUNCTION__);

   s3c6410_max9880_snd_device = platform_device_alloc("soc-audio", -1);
   if (!s3c6410_max9880_snd_device)
   {   
      printk(" - soc-audio create fail \n");
      return -ENOMEM;
   }

   printk("[%s] platform_set_drvdata \n",__FUNCTION__);
   platform_set_drvdata( s3c6410_max9880_snd_device, &s3c6410_max9880_snd_devdata);

   s3c6410_max9880_snd_devdata.dev = &s3c6410_max9880_snd_device->dev;

   ret = platform_device_add( s3c6410_max9880_snd_device);
   if (ret) {
      platform_device_put( s3c6410_max9880_snd_device);
      printk("[s3c6410_max9880] init passed \n");
   } else {
      printk("[s3c6410_max9880] platform_device_add fail \n");
   }

   return ret;
}

static void __exit s3c6410_max9880_exit(void)
{
   platform_device_unregister(s3c6410_max9880_snd_device);
}

module_init(s3c6410_max9880_init);
module_exit(s3c6410_max9880_exit);

MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Samsung S8000 Jet Audio Subsystem");
MODULE_AUTHOR("Vaclav Peroutka <vaclavpe@xxxxxxxxx>");
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux