数字mic系列,注册codec
对应dts如下
dummy_codec: dummy-codec {
compatible = "rockchip,dummy-codec";
#sound-dai-cells = <0>;
};
驱动代码 sound/soc/codecs/dummy-codec.c
static int rockchip_dummy_codec_probe(struct platform_device *pdev)
{
struct dummy_codec_priv *dcp;
dcp = devm_kzalloc(&pdev->dev, sizeof(*dcp), GFP_KERNEL);
if (!dcp)
return -ENOMEM;
platform_set_drvdata(pdev, dcp);
/* optional mclk, if needs, assign mclk in dts node */
dcp->mclk = devm_clk_get(&pdev->dev, "mclk");
if (IS_ERR(dcp->mclk)) {
if (PTR_ERR(dcp->mclk) == -EPROBE_DEFER)
return -EPROBE_DEFER;
else if (PTR_ERR(dcp->mclk) != -ENOENT)
return -EINVAL;
}
/* 将component通过list挂载到 component_list (全局) 上*/
return devm_snd_soc_register_component(&pdev->dev, &soc_dummy_codec,
&dummy_dai, 1);
}
static const struct of_device_id rockchip_dummy_codec_of_match[] = {
{ .compatible = "rockchip,dummy-codec", },
{},
};
MODULE_DEVICE_TABLE(of, rockchip_dummy_codec_of_match);
static struct platform_driver rockchip_dummy_codec_driver = {
.driver = {
.name = "dummy_codec",
.of_match_table = of_match_ptr(rockchip_dummy_codec_of_match),
},
.probe = rockchip_dummy_codec_probe,
};
于是就有了这样的链接