1 From 115f744544291c3529868e72f101df652b156e56 Mon Sep 17 00:00:00 2001
2 From: Daniel Matuschek <daniel@hifiberry.com>
3 Date: Tue, 3 Feb 2015 07:15:19 +0100
4 Subject: [PATCH 100/114] HiFiBerry Amp: fix device-tree problems
6 Some code to load the driver based on device-tree-overlays was missing. This is added by this patch.
8 sound/soc/bcm/hifiberry_amp.c | 21 +++++++++++++++++++++
9 1 file changed, 21 insertions(+)
11 diff --git a/sound/soc/bcm/hifiberry_amp.c b/sound/soc/bcm/hifiberry_amp.c
12 index 1e87ee0..5903915 100644
13 --- a/sound/soc/bcm/hifiberry_amp.c
14 +++ b/sound/soc/bcm/hifiberry_amp.c
15 @@ -65,6 +65,12 @@ static struct snd_soc_card snd_rpi_hifiberry_amp = {
16 .num_links = ARRAY_SIZE(snd_rpi_hifiberry_amp_dai),
19 +static const struct of_device_id snd_rpi_hifiberry_amp_of_match[] = {
20 + { .compatible = "hifiberry,hifiberry-amp", },
23 +MODULE_DEVICE_TABLE(of, snd_rpi_hifiberry_amp_of_match);
26 static int snd_rpi_hifiberry_amp_probe(struct platform_device *pdev)
28 @@ -72,6 +78,20 @@ static int snd_rpi_hifiberry_amp_probe(struct platform_device *pdev)
30 snd_rpi_hifiberry_amp.dev = &pdev->dev;
32 + if (pdev->dev.of_node) {
33 + struct device_node *i2s_node;
34 + struct snd_soc_dai_link *dai = &snd_rpi_hifiberry_amp_dai[0];
35 + i2s_node = of_parse_phandle(pdev->dev.of_node,
36 + "i2s-controller", 0);
39 + dai->cpu_dai_name = NULL;
40 + dai->cpu_of_node = i2s_node;
41 + dai->platform_name = NULL;
42 + dai->platform_of_node = i2s_node;
46 ret = snd_soc_register_card(&snd_rpi_hifiberry_amp);
49 @@ -92,6 +112,7 @@ static struct platform_driver snd_rpi_hifiberry_amp_driver = {
51 .name = "snd-hifiberry-amp",
53 + .of_match_table = snd_rpi_hifiberry_amp_of_match,
55 .probe = snd_rpi_hifiberry_amp_probe,
56 .remove = snd_rpi_hifiberry_amp_remove,