0367-Add-dt-param-to-force-HiFiBerry-DAC-Pro-into-slave-m.patch 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. From 8f9baa887c3328ee17a78b05eba51af6c8ffc83e Mon Sep 17 00:00:00 2001
  2. From: DigitalDreamtime <clive.messer@digitaldreamtime.co.uk>
  3. Date: Sun, 29 May 2016 05:22:29 +0100
  4. Subject: [PATCH] Add dt param to force HiFiBerry DAC+ Pro into slave mode
  5. "dtoverlay=hifiberry-dacplus,slave"
  6. Add 'slave' param to use HiFiBerry DAC+ Pro in slave mode,
  7. with Pi as master for bit and frame clock.
  8. Signed-off-by: DigitalDreamtime <clive.messer@digitaldreamtime.co.uk>
  9. ---
  10. arch/arm/boot/dts/overlays/README | 2 ++
  11. arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts | 6 ++++--
  12. sound/soc/bcm/hifiberry_dacplus.c | 10 ++++++++--
  13. 3 files changed, 14 insertions(+), 4 deletions(-)
  14. --- a/arch/arm/boot/dts/overlays/README
  15. +++ b/arch/arm/boot/dts/overlays/README
  16. @@ -344,6 +344,8 @@ Params: 24db_digital_gain Allow ga
  17. responsibility of the user to ensure that
  18. the Digital volume control is set to a value
  19. that does not result in clipping/distortion!)
  20. + slave Force DAC+ Pro into slave mode, using Pi as
  21. + master for bit clock and frame clock.
  22. Name: hifiberry-digi
  23. --- a/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts
  24. +++ b/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts
  25. @@ -41,7 +41,7 @@
  26. fragment@3 {
  27. target = <&sound>;
  28. - frag3: __overlay__ {
  29. + hifiberry_dacplus: __overlay__ {
  30. compatible = "hifiberry,hifiberry-dacplus";
  31. i2s-controller = <&i2s>;
  32. status = "okay";
  33. @@ -49,6 +49,8 @@
  34. };
  35. __overrides__ {
  36. - 24db_digital_gain = <&frag3>,"hifiberry,24db_digital_gain?";
  37. + 24db_digital_gain =
  38. + <&hifiberry_dacplus>,"hifiberry,24db_digital_gain?";
  39. + slave = <&hifiberry_dacplus>,"hifiberry-dacplus,slave?";
  40. };
  41. };
  42. --- a/sound/soc/bcm/hifiberry_dacplus.c
  43. +++ b/sound/soc/bcm/hifiberry_dacplus.c
  44. @@ -47,6 +47,7 @@ struct pcm512x_priv {
  45. /* Clock rate of CLK48EN attached to GPIO3 pin */
  46. #define CLK_48EN_RATE 24576000UL
  47. +static bool slave;
  48. static bool snd_rpi_hifiberry_is_dacpro;
  49. static bool digital_gain_0db_limit = true;
  50. @@ -145,8 +146,11 @@ static int snd_rpi_hifiberry_dacplus_ini
  51. struct snd_soc_codec *codec = rtd->codec;
  52. struct pcm512x_priv *priv;
  53. - snd_rpi_hifiberry_is_dacpro
  54. - = snd_rpi_hifiberry_dacplus_is_pro_card(codec);
  55. + if (slave)
  56. + snd_rpi_hifiberry_is_dacpro = false;
  57. + else
  58. + snd_rpi_hifiberry_is_dacpro =
  59. + snd_rpi_hifiberry_dacplus_is_pro_card(codec);
  60. if (snd_rpi_hifiberry_is_dacpro) {
  61. struct snd_soc_dai_link *dai = rtd->dai_link;
  62. @@ -314,6 +318,8 @@ static int snd_rpi_hifiberry_dacplus_pro
  63. digital_gain_0db_limit = !of_property_read_bool(
  64. pdev->dev.of_node, "hifiberry,24db_digital_gain");
  65. + slave = of_property_read_bool(pdev->dev.of_node,
  66. + "hifiberry-dacplus,slave");
  67. }
  68. ret = snd_soc_register_card(&snd_rpi_hifiberry_dacplus);