gpt4 book ai didi

audio - BeagleBoneBlack-在ALSA上注册I2S ADC

转载 作者:行者123 更新时间:2023-12-02 23:15:05 28 4
gpt4 key购买 nike

我正在尝试将音频ADC(wm8782 / pcm1803a)与Beagle Black连接。我已经对文件 davinci-evm wm8782.c 和BB-BONE-AUDI-01设备树覆盖文件进行了一些更改(请参见下面的代码)。
我的问题是,在加载dtbo文件时,dmesg返回:

"...Codec DAI wm8782-hifi not found"



我假设我的编解码器(wm8782)没有被alsa core注册,但是我必须在哪里做?
我正在运行Ubuntu 13.10,内核:3.8.13-bone39

谢谢!

davinci-evm.c
/*
* ASoC Driver.
*
*
*
*
* 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.
*/

#include <linux/module.h>
#include <linux/platform_device.h>

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

static int evm_wm8782_init(struct snd_soc_pcm_runtime *rtd)
{
return 0;
}

static int evm_wm8782_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 *cpu_dai = rtd->cpu_dai;

/*return snd_soc_dai_set_bclk_ratio(cpu_dai, 32*2);*/
return 0;
}

/* machine stream operations */
static struct snd_soc_ops evm_wm8782_ops = {
.hw_params = evm_wm8782_hw_params,
};

static struct snd_soc_dai_link evm_wm8782_dai[] = {
{
.name = "PCM1803 board",
.stream_name = "PCM1803 board",
.cpu_dai_name = "davinci-mcasp.0",
.codec_dai_name = "wm8782-hifi",
.platform_name = "davinci-pcm-audio",
.codec_name = "wm8782-codec",
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBS_CFS,
.ops = &evm_wm8782_ops,
.init = evm_wm8782_init,
},
};

/* audio machine driver */
static struct snd_soc_card snd_wm8782_adc = {
.name = "snd_wm8782_adc",
.dai_link = evm_wm8782_dai,
.num_links = ARRAY_SIZE(evm_wm8782_dai),
};

static int snd_wm8782_probe(struct platform_device *pdev)
{
int ret = 0;

snd_wm8782_adc.dev = &pdev->dev;
ret = snd_soc_register_card(&snd_wm8782_adc);
if (ret)
dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret);

return ret;
}

static int snd_wm8782_remove(struct platform_device *pdev)
{
return snd_soc_unregister_card(&snd_wm8782_adc);
}

static struct platform_driver snd_wm8782_driver = {
.driver = {
.name = "snd-wm8782-adc",
.owner = THIS_MODULE,
},
.probe = snd_wm8782_probe,
.remove = snd_wm8782_remove,
};

module_platform_driver(snd_wm8782_driver);

MODULE_AUTHOR("E.E.R");
MODULE_DESCRIPTION("ASoC Driver for pcm1803 ADC");
MODULE_LICENSE("GPL v2");

wm8782.c
/*
* sound/soc/codecs/wm8782.c
* simple, strap-pin configured 24bit 2ch ADC
*
* Copyright: 2011 Raumfeld GmbH
* Author: Johannes Stezenbach <js@sig21.net>
*
* based on ad73311.c
* Copyright: Analog Device Inc.
* Author: Cliff Cai <cliff.cai@analog.com>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*/

#include <linux/init.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/device.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/ac97_codec.h>
#include <sound/initval.h>
#include <sound/soc.h>

static struct snd_soc_dai_driver wm8782_dai = {
.name = "wm8782-hifi",
.capture = {
.stream_name = "Capture",
.channels_min = 1,
.channels_max = 2,
.rates = SNDRV_PCM_RATE_8000_192000,
.formats = SNDRV_PCM_FMTBIT_S16_LE |
SNDRV_PCM_FMTBIT_S24_LE,
},
};

static struct snd_soc_codec_driver soc_codec_dev_wm8782;

static int wm8782_probe(struct platform_device *pdev)
{
return snd_soc_register_codec(&pdev->dev,
&soc_codec_dev_wm8782, &wm8782_dai, 1);
}

static int wm8782_remove(struct platform_device *pdev)
{
snd_soc_unregister_codec(&pdev->dev);
return 0;
}

static struct platform_driver wm8782_codec_driver = {
.driver = {
.name = "wm8782",
.owner = THIS_MODULE,
},
.probe = wm8782_probe,
.remove = wm8782_remove,
};

module_platform_driver(wm8782_codec_driver);

MODULE_DESCRIPTION("ASoC WM8782 driver");
MODULE_AUTHOR("Johannes Stezenbach <js@sig21.net>");
MODULE_LICENSE("GPL");

BB-BONE-AUDI-01-00A0.dts
/*
* Copyright (C) 2012 Texas Instruments Incorporated - http://www.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.
*/
/dts-v1/;
/plugin/;

/ {
compatible = "ti,beaglebone", "ti,beaglebone-black";

/* identification */
part-number = "BB-BONE-AUDI-01";
version = "00A0", "A0";

/* state the resources this cape uses */
exclusive-use =
/* the pin header uses */
"P9.14", /* leds: gpio1_18 */
"P9.16", /* leds: gpio1_19 */
"P9.31", /* mcasp0: mcasp0_aclkx */
"P9.29", /* mcasp0: mcasp0_fsx */
"P9.28", /* mcasp0: mcasp0_axr2 */
"P9.25", /* mcasp0: mcasp0_ahclkx */
/* the hardware ip uses */
"gpio1_18", "gpio1_19",
"mcasp0";

fragment@0 {
target = <&am33xx_pinmux>;
__overlay__ {

bone_audio_cape_led_pins: pinmux_bone_audio_cape_led_pins {
pinctrl-single,pins = <
0x48 0x07 /* gpmc_a2.gpio1_18, OUTPUT | MODE7 */
0x4c 0x07 /* gpmc_a3.gpio1_19, OUTPUT | MODE7 */
>;
};

bone_audio_cape_audio_pins: pinmux_bone_audio_cape_audio_pins {
pinctrl-single,pins = <
0x190 0x20 /* mcasp0_aclkx.mcasp0_aclkx, INPUT | MODE0 */
0x194 0x20 /* mcasp0_fsx.mcasp0_fsx, INPUT | MODE0 */
0x19c 0x22 /* mcasp0_ahclkr.mcasp0_axr2, INPUT | MODE2 */
0x1ac 0x22 /* mcasp0_ahclkx.mcasp0_axr3, INPUT | MODE2 */

>;
};
};
};

fragment@1 {
target = <&ocp>;
__overlay__ {

/* avoid stupid warning */
#address-cells = <1>;
#size-cells = <1>;

gpio-leds-cape-audio {
compatible = "gpio-leds";
pinctrl-names = "default";
pinctrl-0 = <&bone_audio_cape_led_pins>;

audio-led0 {
label = "audio:green:usr0";
gpios = <&gpio2 18 0>;
linux,default-trigger = "heartbeat";
default-state = "off";
};

audio-led1 {
label = "audio:green:usr1";
gpios = <&gpio2 19 0>;
linux,default-trigger = "mmc0";
default-state = "off";
};
};
};
};


fragment@2 {
target = <&mcasp0>;
__overlay__ {
pinctrl-names = "default";
pinctrl-0 = <&bone_audio_cape_audio_pins>;

status = "okay";

op-mode = <0>; /* MCASP_IIS_MODE */
tdm-slots = <2>;
num-serializer = <16>;
serial-dir = < /* 0: INACTIVE, 1: TX, 2: RX */
0 0 2 1
0 0 0 0
0 0 0 0
0 0 0 0
>;
tx-num-evt = <1>;
rx-num-evt = <1>;
};
};


};

最佳答案

您可以使编解码器驱动程序与设备树兼容,并进行加载,只需在dts文件中为编解码器添加一个节点即可。

根据您的情况,将此部分添加到编解码器驱动程序中:

.
.
.
#ifdef CONFIG_OF
static const struct of_device_id wm8782_dt_ids[] = {
{ .compatible = "ti,wm8782", },
{ }
};
MODULE_DEVICE_TABLE(of, wm8782_dt_ids);
#endif

static struct platform_driver wm8782_codec_driver = {
.driver = {
.name = "wm8782",
.owner = THIS_MODULE,
.of_match_table = of_match_ptr(wm8782_dt_ids),
},
.
.
.

然后,将此节点添加到您的dts文件中:
wm8782: wm8782 {
wm8782 = "ti,wm8782";
};

关于audio - BeagleBoneBlack-在ALSA上注册I2S ADC,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21611369/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com