0100-HiFiBerry-Amp-fix-device-tree-problems.patch 1.9 KB

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