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

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