Machine driver for adau1701

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Machine driver for adau1701

1,714件の閲覧回数
anilghadiya
Contributor II

Hi,

We are trying to build the existing adau1701 driver, insert it as independent module and test the codec functionality using ALSA utils.

So, we took the following files from the kernel source(for SD card image(trusty) for iMX6Q) and build the .ko file.

     adaua701.c/h

     sigmadsp.c/h

We are able to insert this module. Then, we built the machine driver as .ko file and able to insert that as module using insmod.

But, Probe functions of these modules are not getting called and there is no card in /proc/asound/cards.

When does the probe functions of these module gets invoked?

Below is the my machine driver code.

Thanks in Advance,

Anil Patel

=================================================================================

#include <linux/module.h>

#include <linux/device.h>

#include <sound/core.h>

#include <sound/pcm.h>

#include <sound/soc.h>

#include <sound/pcm_params.h>

#include "adau1701.h"

static const struct snd_soc_dapm_widget imx_adau1701_dapm_widgets[] = {

  SND_SOC_DAPM_SPK("Speaker", NULL),

  SND_SOC_DAPM_LINE("Line Out", NULL),

  SND_SOC_DAPM_LINE("Line In", NULL),

};

static const struct snd_soc_dapm_route imx_adau1701_dapm_routes[] = {

  { "Speaker", NULL, "OUT0" },

  { "Speaker", NULL, "OUT1" },

  { "Line Out", NULL, "OUT2" },

  { "Line Out", NULL, "OUT3" },

  { "IN0", NULL, "Line In" },

  { "IN1", NULL, "Line In" },

};

static int imx_adau1701_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 *codec_dai = rtd->codec_dai;

  int ret;

  ret = snd_soc_dai_set_sysclk(codec_dai, ADAU1701_CLK_SRC_OSC, 12288000,  SND_SOC_CLOCK_IN);

  return ret;

}

static struct snd_soc_ops imx_adau1701_ops = {

  .hw_params = imx_adau1701_hw_params,

};

#define IMX_ADAU1701_DAI_FMT (SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM)

static struct snd_soc_dai_link imx_adau1701_dai[] = {

  .name = "adau1701",

  .stream_name = "adau1701",

  .cpu_dai_name = "imx-i2s.0",

  .codec_dai_name = "adau1701",

  .platform_name = "imx-i2s-pcm-audio",

  .codec_name = "adau1701.0-0034",

  .ops = &imx_adau1701_ops,

  .dai_fmt = IMX_ADAU1701_DAI_FMT,

};

static struct snd_soc_card imx_adau1701 = {

  .name = "imx-adau1701",

  .owner = THIS_MODULE,

  .dai_link = &imx_adau1701_dai,

  .num_links = 1,

  .dapm_widgets = imx_adau1701_dapm_widgets,

  .num_dapm_widgets = ARRAY_SIZE(imx_adau1701_dapm_widgets),

  .dapm_routes = imx_adau1701_dapm_routes,

  .num_dapm_routes = ARRAY_SIZE(imx_adau1701_dapm_routes),

};

static int imx_adau1701_probe(struct platform_device *pdev)

{

  struct snd_soc_card *card = &imx_adau1701;

  card->dev = &pdev->dev;

  return snd_soc_register_card(&imx_adau1701);

}

static int imx_adau1701_remove(struct platform_device *pdev)

{

  struct snd_soc_card *card = platform_get_drvdata(pdev);

  snd_soc_unregister_card(card);

  return 0;

}

static struct platform_driver imx_adau1701_driver = {

  .driver = {

       .name = "imx-adau1701",

       .owner = THIS_MODULE,

       .pm = &snd_soc_pm_ops,

  },

  .probe = imx_adau1701_probe,

  .remove = imx_adau1701_remove,

};

module_platform_driver(imx_adau1701_driver);

MODULE_AUTHOR("xyz");

MODULE_DESCRIPTION("ALSA SoC imx6q ADAU1701 driver");

MODULE_LICENSE("GPL");

MODULE_ALIAS("platform:imx-adau1701");

ラベル(3)
0 件の賞賛
返信
4 返答(返信)

1,235件の閲覧回数
igorpadykov
NXP Employee
NXP Employee

Hi Anil

one can look at audio driver initialization at Linux Porting Guides

included in L3.0.35_4.1.0_LINUX_DOCS, L3.10.17_1.0.0_LINUX_DOCS,

MX53UG and link below

How to enable TLV320 on IMX6Q?

Best regards

igor

0 件の賞賛
返信

1,235件の閲覧回数
anilghadiya
Contributor II

Hi Igor,

Thanks for the reply. I followed the same code as in sgtl5000.c and imx-sgtl5000.c files to generate the codec and machine driver for adau1701 codec on imx platform. I build the two adau1701 files as separate modules and load using 'insmod' over kernel image 3.10. But I do not see any of the probe functions (adau1701_probe and imx_adau1701_probe()) being called. I put printk log messages in the start of both probe functions for debug. Is there anything else I need to take care if I want to load modules using insmod instead of building along with the kernel? Appreciate your help here.


Regards,

Anil

0 件の賞賛
返信

1,235件の閲覧回数
igorpadykov
NXP Employee
NXP Employee

Hi Anil

I would suggest to add printf to probe function

to verify if it is called by kernel.

Best regards

igor

0 件の賞賛
返信

1,235件の閲覧回数
anilghadiya
Contributor II

Hi Igor,

I checked as you said. It seems like probe itself is not getting called by the kernel.

Do you have any idea why?

Thanks and Regards,

Anil Ghadiya

0 件の賞賛
返信