Skip to content

Commit e6f57f0

Browse files
flatmaxpelwell
authored andcommitted
Audioinjector Octo : add extra sample rates, fix rst and use bcm270x regs
This patch adds new sample rates to the Audioinjector Octo sound card. The new supported rates are (in kHz) : 96, 48, 32, 24, 16, 8, 88.2, 44.1, 29.4, 22.05, 14.7 This patch also replaces the regulators in the device tree overlay with the ones declared in bcm270x.dtsi include file. This patch also adds an extra codec reset and delay on probe.
1 parent ef959b3 commit e6f57f0

File tree

2 files changed

+52
-28
lines changed

2 files changed

+52
-28
lines changed

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

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,6 @@
1313
};
1414

1515
fragment@1 {
16-
target = <&soc>;
17-
__overlay__ {
18-
reg_digital: reg_digital@0 {
19-
compatible = "regulator-fixed";
20-
regulator-name = "cs42448_dig_supply";
21-
regulator-min-microvolt = <3300000>;
22-
regulator-max-microvolt = <3300000>;
23-
regulator-always-on;
24-
};
25-
reg_analogue: reg_analogue@0 {
26-
compatible = "regulator-fixed";
27-
regulator-name = "cs42448_ana_supply";
28-
regulator-min-microvolt = <5000000>;
29-
regulator-max-microvolt = <5000000>;
30-
regulator-always-on;
31-
};
32-
};
33-
};
34-
35-
fragment@2 {
3616
target = <&i2c1>;
3717
__overlay__ {
3818
#address-cells = <1>;
@@ -45,10 +25,10 @@
4525
reg = <0x48>;
4626
clocks = <&cs42448_mclk>;
4727
clock-names = "mclk";
48-
VA-supply = <&reg_analogue>;
49-
VD-supply = <&reg_digital>;
50-
VLS-supply = <&reg_digital>;
51-
VLC-supply = <&reg_digital>;
28+
VA-supply = <&vdd_5v0_reg>;
29+
VD-supply = <&vdd_3v3_reg>;
30+
VLS-supply = <&vdd_3v3_reg>;
31+
VLC-supply = <&vdd_3v3_reg>;
5232
status = "okay";
5333
};
5434

@@ -60,7 +40,7 @@
6040
};
6141
};
6242

63-
fragment@3 {
43+
fragment@2 {
6444
target = <&sound>;
6545
__overlay__ {
6646
compatible = "ai,audioinjector-octo-soundcard";

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

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ static struct gpio_desc *codec_rst_gpio;
3131
static unsigned int audioinjector_octo_rate;
3232

3333
static const unsigned int audioinjector_octo_rates[] = {
34-
96000, 48000, 88200, 44100,
34+
96000, 48000, 32000, 24000, 16000, 8000, 88200, 44100, 29400, 22050, 14700,
3535
};
3636

3737
static struct snd_pcm_hw_constraint_list audioinjector_octo_constraints = {
@@ -98,11 +98,33 @@ static int audioinjector_octo_hw_params(struct snd_pcm_substream *substream,
9898
return snd_soc_dai_set_sysclk(rtd->codec_dai, 0, 49152000,
9999
0);
100100
break;
101+
case 24000:
102+
return snd_soc_dai_set_sysclk(rtd->codec_dai, 0, 49152000/2,
103+
0);
104+
break;
105+
case 32000:
106+
case 16000:
107+
return snd_soc_dai_set_sysclk(rtd->codec_dai, 0, 49152000/3,
108+
0);
109+
break;
110+
case 8000:
111+
return snd_soc_dai_set_sysclk(rtd->codec_dai, 0, 49152000/6,
112+
0);
113+
break;
101114
case 88200:
102115
case 44100:
103116
return snd_soc_dai_set_sysclk(rtd->codec_dai, 0, 45185400,
104117
0);
105118
break;
119+
case 22050:
120+
return snd_soc_dai_set_sysclk(rtd->codec_dai, 0, 45185400/2,
121+
0);
122+
break;
123+
case 29400:
124+
case 14700:
125+
return snd_soc_dai_set_sysclk(rtd->codec_dai, 0, 45185400/3,
126+
0);
127+
break;
106128
default:
107129
return -EINVAL;
108130
}
@@ -132,6 +154,25 @@ static int audioinjector_octo_trigger(struct snd_pcm_substream *substream,
132154
case 44100:
133155
mult[2] = 1;
134156
break;
157+
case 32000:
158+
mult[3] = 1;
159+
case 29400:
160+
mult[0] = 1;
161+
mult[1] = 1;
162+
break;
163+
case 24000:
164+
mult[3] = 1;
165+
case 22050:
166+
mult[1] = 1;
167+
break;
168+
case 16000:
169+
mult[3] = 1;
170+
case 14700:
171+
mult[0] = 1;
172+
break;
173+
case 8000:
174+
mult[3] = 1;
175+
break;
135176
default:
136177
return -EINVAL;
137178
}
@@ -233,12 +274,15 @@ static int audioinjector_octo_probe(struct platform_device *pdev)
233274
if (IS_ERR(codec_rst_gpio))
234275
return PTR_ERR(codec_rst_gpio);
235276

277+
if (codec_rst_gpio)
278+
gpiod_set_value(codec_rst_gpio, 1);
279+
msleep(500);
236280
if (codec_rst_gpio)
237281
gpiod_set_value(codec_rst_gpio, 0);
238-
msleep(5);
282+
msleep(500);
239283
if (codec_rst_gpio)
240284
gpiod_set_value(codec_rst_gpio, 1);
241-
msleep(50);
285+
msleep(500);
242286

243287
if (i2s_node && codec_node) {
244288
dai->cpu_dai_name = NULL;

0 commit comments

Comments
 (0)