Merge pull request #580 from wigyori/cc-libpcap
[15.05/openwrt.git] / target / linux / brcm2708 / patches-3.18 / 0100-HiFiBerry-Amp-fix-device-tree-problems.patch
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
5
6 Some code to load the driver based on device-tree-overlays was missing. This is added by this patch.
7 ---
8  sound/soc/bcm/hifiberry_amp.c | 21 +++++++++++++++++++++
9  1 file changed, 21 insertions(+)
10
11 --- a/sound/soc/bcm/hifiberry_amp.c
12 +++ b/sound/soc/bcm/hifiberry_amp.c
13 @@ -65,6 +65,12 @@ static struct snd_soc_card snd_rpi_hifib
14         .num_links    = ARRAY_SIZE(snd_rpi_hifiberry_amp_dai),
15  };
16  
17 +static const struct of_device_id snd_rpi_hifiberry_amp_of_match[] = {
18 +        { .compatible = "hifiberry,hifiberry-amp", },
19 +        {},
20 +};
21 +MODULE_DEVICE_TABLE(of, snd_rpi_hifiberry_amp_of_match);
22 +
23  
24  static int snd_rpi_hifiberry_amp_probe(struct platform_device *pdev)
25  {
26 @@ -72,6 +78,20 @@ static int snd_rpi_hifiberry_amp_probe(s
27  
28         snd_rpi_hifiberry_amp.dev = &pdev->dev;
29  
30 +        if (pdev->dev.of_node) {
31 +            struct device_node *i2s_node;
32 +            struct snd_soc_dai_link *dai = &snd_rpi_hifiberry_amp_dai[0];
33 +            i2s_node = of_parse_phandle(pdev->dev.of_node,
34 +                                        "i2s-controller", 0);
35 +
36 +            if (i2s_node) {
37 +                dai->cpu_dai_name = NULL;
38 +                dai->cpu_of_node = i2s_node;
39 +                dai->platform_name = NULL;
40 +                dai->platform_of_node = i2s_node;
41 +            }
42 +        }
43 +
44         ret = snd_soc_register_card(&snd_rpi_hifiberry_amp);
45  
46         if (ret != 0) {
47 @@ -92,6 +112,7 @@ static struct platform_driver snd_rpi_hi
48          .driver = {
49                  .name   = "snd-hifiberry-amp",
50                  .owner  = THIS_MODULE,
51 +               .of_match_table = snd_rpi_hifiberry_amp_of_match,
52          },
53          .probe          = snd_rpi_hifiberry_amp_probe,
54          .remove         = snd_rpi_hifiberry_amp_remove,