Skip to content

Commit

Permalink
HiFiBerry Amp: fix device-tree problems
Browse files Browse the repository at this point in the history
Some code to load the driver based on device-tree-overlays was missing. This is added by this patch.
  • Loading branch information
Daniel Matuschek authored and popcornmix committed Feb 6, 2015
1 parent d8dad82 commit e84183b
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions sound/soc/bcm/hifiberry_amp.c
Expand Up @@ -65,13 +65,33 @@ static struct snd_soc_card snd_rpi_hifiberry_amp = {
.num_links = ARRAY_SIZE(snd_rpi_hifiberry_amp_dai),
};

static const struct of_device_id snd_rpi_hifiberry_amp_of_match[] = {
{ .compatible = "hifiberry,hifiberry-amp", },
{},
};
MODULE_DEVICE_TABLE(of, snd_rpi_hifiberry_amp_of_match);


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

snd_rpi_hifiberry_amp.dev = &pdev->dev;

if (pdev->dev.of_node) {
struct device_node *i2s_node;
struct snd_soc_dai_link *dai = &snd_rpi_hifiberry_amp_dai[0];
i2s_node = of_parse_phandle(pdev->dev.of_node,
"i2s-controller", 0);

if (i2s_node) {
dai->cpu_dai_name = NULL;
dai->cpu_of_node = i2s_node;
dai->platform_name = NULL;
dai->platform_of_node = i2s_node;
}
}

ret = snd_soc_register_card(&snd_rpi_hifiberry_amp);

if (ret != 0) {
Expand All @@ -92,6 +112,7 @@ static struct platform_driver snd_rpi_hifiberry_amp_driver = {
.driver = {
.name = "snd-hifiberry-amp",
.owner = THIS_MODULE,
.of_match_table = snd_rpi_hifiberry_amp_of_match,
},
.probe = snd_rpi_hifiberry_amp_probe,
.remove = snd_rpi_hifiberry_amp_remove,
Expand Down

0 comments on commit e84183b

Please sign in to comment.