声卡不会显示在/ proc / asound / cards中

时间:2017-12-07 10:13:40

标签: linux-kernel driver alsa

我是这个司机:

#include <linux/acpi.h>
#include <linux/device.h>
#include <linux/err.h>
#include <linux/gpio.h>
#include <linux/gpio/consumer.h>
#include <linux/kernel.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <sound/pcm.h>
#include <sound/soc.h>
#include <sound/soc-dai.h>
#include <sound/soc-dapm.h>

static const struct snd_soc_dapm_route max9880_dapm_routes[] = {
        {"Mono out", NULL, "Mono Mixer"}
};

static struct snd_soc_codec_driver soc_codec_dev_max9880 = {
        .component_driver = {
                .dapm_routes = max9880_dapm_routes,
                .num_dapm_routes = ARRAY_SIZE(max9880_dapm_routes)
        }
};

static struct snd_soc_dai_driver max9880_dai = {
                .name = "max9880",
                .playback = {
                        .stream_name = "Playback",
                        .channels_min = 1,
                        .channels_max = 1
                }
};

static int max9880_platform_probe(struct platform_device *pdev)
{
        int ret;

        snd_printk(KERN_ALERT "1. platform probe");

        ret = snd_soc_register_codec(&pdev->dev, &soc_codec_dev_max9880,
                                     &max9880_dai, 1);
        return ret;
}

static int max9880_platform_remove(struct platform_device *pdev)
{
                snd_printk(KERN_ALERT "2. platform remove");
        snd_soc_unregister_codec(&pdev->dev);

        return 0;
}

static const struct of_device_id max9880_device_id[] = {
        { .compatible = "max9880" },
        {}
};
MODULE_DEVICE_TABLE(of, max9880_device_id);

static struct platform_driver max9880_platform_driver = {
        .driver = {
                .name = "max9880",
                .of_match_table = of_match_ptr(max9880_device_id),
        },
        .probe  = &max9880_platform_probe,
        .remove = &max9880_platform_remove,
};
module_platform_driver(max9880_platform_driver);

我使用insmod将模块加载到内核中。这一切似乎运作良好,我也能够毫无问题地做一个rmmod。但是,我没有在/ proc / asound / cards中获得任何条目,这意味着我的模块不会被重新设置为声卡。我错过了什么?

0 个答案:

没有答案
相关问题