kernel: bump 4.14 to 4.14.93
[openwrt/staging/chunkeey.git] / target / linux / brcm2708 / patches-4.14 / 950-0240-audioinjector-octo-Add-continuous-clock-feature.patch
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
5
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
9 overlay.
10
11 See: https://github.com/raspberrypi/linux/issues/2409
12
13 Signed-off-by: Phil Elwell <phil@raspberrypi.org>
14 ---
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(-)
19
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
23
24 Name: audioinjector-addons
25 Info: Configures the audioinjector.net audio add on soundcards
26 -Load: dtoverlay=audioinjector-addons
27 -Params: <None>
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)
31
32
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
36 @@ -42,7 +42,7 @@
37
38 fragment@2 {
39 target = <&sound>;
40 - __overlay__ {
41 + snd: __overlay__ {
42 compatible = "ai,audioinjector-octo-soundcard";
43 mult-gpios = <&gpio 27 0>, <&gpio 22 0>, <&gpio 23 0>,
44 <&gpio 24 0>;
45 @@ -52,4 +52,8 @@
46 status = "okay";
47 };
48 };
49 +
50 + __overrides__ {
51 + non-stop-clocks = <&snd>, "non-stop-clocks?";
52 + };
53 };
54 --- a/sound/soc/bcm/audioinjector-octo-soundcard.c
55 +++ b/sound/soc/bcm/audioinjector-octo-soundcard.c
56 @@ -29,6 +29,7 @@
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;
61
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,
66 int cmd){
67 int mult[4];
68 - mult[0] = 0;
69 - mult[1] = 0;
70 - mult[2] = 0;
71 - mult[3] = 0;
72 +
73 + memset(mult, 0, sizeof(mult));
74
75 switch (cmd) {
76 + case SNDRV_PCM_TRIGGER_STOP:
77 + case SNDRV_PCM_TRIGGER_SUSPEND:
78 + case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
79 + if (!non_stop_clocks)
80 + break;
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
86 return -EINVAL;
87 }
88 break;
89 - case SNDRV_PCM_TRIGGER_STOP:
90 - case SNDRV_PCM_TRIGGER_SUSPEND:
91 - case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
92 - break;
93 default:
94 return -EINVAL;
95 }
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);
99
100 + non_stop_clocks = of_property_read_bool(pdev->dev.of_node, "non-stop-clocks");
101 +
102 if (codec_rst_gpio)
103 gpiod_set_value(codec_rst_gpio, 1);
104 msleep(500);