1 From f7045758fffa176ea68730ea855415e619bf516d Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.org>
3 Date: Sat, 3 Mar 2018 16:25:19 +0000
4 Subject: [PATCH 240/454] audioinjector-octo: Add continuous clock feature
6 By user request, add a switch to prevent the clocks being stopped when
7 the stream is paused, stopped or shutdown. Provide access to the switch
8 by adding a 'non-stop-clocks' parameter to the audioinjector-addons
11 See: https://github.com/raspberrypi/linux/issues/2409
13 Signed-off-by: Phil Elwell <phil@raspberrypi.org>
15 arch/arm/boot/dts/overlays/README | 5 +++--
16 .../overlays/audioinjector-addons-overlay.dts | 6 +++++-
17 sound/soc/bcm/audioinjector-octo-soundcard.c | 19 +++++++++++--------
18 3 files changed, 19 insertions(+), 11 deletions(-)
20 --- a/arch/arm/boot/dts/overlays/README
21 +++ b/arch/arm/boot/dts/overlays/README
22 @@ -357,8 +357,9 @@ Params: interrupt GPIO use
24 Name: audioinjector-addons
25 Info: Configures the audioinjector.net audio add on soundcards
26 -Load: dtoverlay=audioinjector-addons
28 +Load: dtoverlay=audioinjector-addons,<param>=<val>
29 +Params: non-stop-clocks Keeps the clocks running even when the stream
30 + is paused or stopped (default off)
33 Name: audioinjector-wm8731-audio
34 --- a/arch/arm/boot/dts/overlays/audioinjector-addons-overlay.dts
35 +++ b/arch/arm/boot/dts/overlays/audioinjector-addons-overlay.dts
42 compatible = "ai,audioinjector-octo-soundcard";
43 mult-gpios = <&gpio 27 0>, <&gpio 22 0>, <&gpio 23 0>,
51 + non-stop-clocks = <&snd>, "non-stop-clocks?";
54 --- a/sound/soc/bcm/audioinjector-octo-soundcard.c
55 +++ b/sound/soc/bcm/audioinjector-octo-soundcard.c
57 static struct gpio_descs *mult_gpios;
58 static struct gpio_desc *codec_rst_gpio;
59 static unsigned int audioinjector_octo_rate;
60 +static bool non_stop_clocks;
62 static const unsigned int audioinjector_octo_rates[] = {
63 96000, 48000, 32000, 24000, 16000, 8000, 88200, 44100, 29400, 22050, 14700,
64 @@ -133,12 +134,16 @@ static int audioinjector_octo_hw_params(
65 static int audioinjector_octo_trigger(struct snd_pcm_substream *substream,
73 + memset(mult, 0, sizeof(mult));
76 + case SNDRV_PCM_TRIGGER_STOP:
77 + case SNDRV_PCM_TRIGGER_SUSPEND:
78 + case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
79 + if (!non_stop_clocks)
81 + /* Drop through... */
82 case SNDRV_PCM_TRIGGER_START:
83 case SNDRV_PCM_TRIGGER_RESUME:
84 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
85 @@ -177,10 +182,6 @@ static int audioinjector_octo_trigger(st
89 - case SNDRV_PCM_TRIGGER_STOP:
90 - case SNDRV_PCM_TRIGGER_SUSPEND:
91 - case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
96 @@ -276,6 +277,8 @@ static int audioinjector_octo_probe(stru
97 if (IS_ERR(codec_rst_gpio))
98 return PTR_ERR(codec_rst_gpio);
100 + non_stop_clocks = of_property_read_bool(pdev->dev.of_node, "non-stop-clocks");
103 gpiod_set_value(codec_rst_gpio, 1);