Skip to content

Commit 5b76df0

Browse files
author
Phil Elwell
committed
audioinjector-octo: Add continuous clock feature
By user request, add a switch to prevent the clocks being stopped when the stream is paused, stopped or shutdown. Provide access to the switch by adding a 'non-stop-clocks' parameter to the audioinjector-addons overlay. See: #2409 Signed-off-by: Phil Elwell <[email protected]>
1 parent 029dcfd commit 5b76df0

File tree

3 files changed

+19
-11
lines changed

3 files changed

+19
-11
lines changed

arch/arm/boot/dts/overlays/README

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,8 +365,9 @@ Params: interrupt GPIO used for INT (default 23)
365365

366366
Name: audioinjector-addons
367367
Info: Configures the audioinjector.net audio add on soundcards
368-
Load: dtoverlay=audioinjector-addons
369-
Params: <None>
368+
Load: dtoverlay=audioinjector-addons,<param>=<val>
369+
Params: non-stop-clocks Keeps the clocks running even when the stream
370+
is paused or stopped (default off)
370371

371372

372373
Name: audioinjector-wm8731-audio

arch/arm/boot/dts/overlays/audioinjector-addons-overlay.dts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242

4343
fragment@2 {
4444
target = <&sound>;
45-
__overlay__ {
45+
snd: __overlay__ {
4646
compatible = "ai,audioinjector-octo-soundcard";
4747
mult-gpios = <&gpio 27 0>, <&gpio 22 0>, <&gpio 23 0>,
4848
<&gpio 24 0>;
@@ -52,4 +52,8 @@
5252
status = "okay";
5353
};
5454
};
55+
56+
__overrides__ {
57+
non-stop-clocks = <&snd>, "non-stop-clocks?";
58+
};
5559
};

sound/soc/bcm/audioinjector-octo-soundcard.c

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
static struct gpio_descs *mult_gpios;
3030
static struct gpio_desc *codec_rst_gpio;
3131
static unsigned int audioinjector_octo_rate;
32+
static bool non_stop_clocks;
3233

3334
static const unsigned int audioinjector_octo_rates[] = {
3435
96000, 48000, 32000, 24000, 16000, 8000, 88200, 44100, 29400, 22050, 14700,
@@ -133,12 +134,16 @@ static int audioinjector_octo_hw_params(struct snd_pcm_substream *substream,
133134
static int audioinjector_octo_trigger(struct snd_pcm_substream *substream,
134135
int cmd){
135136
int mult[4];
136-
mult[0] = 0;
137-
mult[1] = 0;
138-
mult[2] = 0;
139-
mult[3] = 0;
137+
138+
memset(mult, 0, sizeof(mult));
140139

141140
switch (cmd) {
141+
case SNDRV_PCM_TRIGGER_STOP:
142+
case SNDRV_PCM_TRIGGER_SUSPEND:
143+
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
144+
if (!non_stop_clocks)
145+
break;
146+
/* Drop through... */
142147
case SNDRV_PCM_TRIGGER_START:
143148
case SNDRV_PCM_TRIGGER_RESUME:
144149
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
@@ -177,10 +182,6 @@ static int audioinjector_octo_trigger(struct snd_pcm_substream *substream,
177182
return -EINVAL;
178183
}
179184
break;
180-
case SNDRV_PCM_TRIGGER_STOP:
181-
case SNDRV_PCM_TRIGGER_SUSPEND:
182-
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
183-
break;
184185
default:
185186
return -EINVAL;
186187
}
@@ -276,6 +277,8 @@ static int audioinjector_octo_probe(struct platform_device *pdev)
276277
if (IS_ERR(codec_rst_gpio))
277278
return PTR_ERR(codec_rst_gpio);
278279

280+
non_stop_clocks = of_property_read_bool(pdev->dev.of_node, "non-stop-clocks");
281+
279282
if (codec_rst_gpio)
280283
gpiod_set_value(codec_rst_gpio, 1);
281284
msleep(500);

0 commit comments

Comments
 (0)