I have achieved a CLEAR AUDIO HFP test call.
Two things left to do;
- figure out how to set it to mono,
- Figure out how to tell Android where to find it.
Kernel diff;
diff --git a/arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts b/arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts
index c7dfbd1..eb0fad7 100644
--- a/arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts
+++ b/arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts
@@ -271,6 +271,7 @@
};
ldo11: LDO11 { /* Low Speed Connector */
+ regulator-always-on;
regulator-name = "VOUT11_1V8_2V95";
regulator-min-microvolt = <1750000>;
regulator-max-microvolt = <3300000>;
diff --git a/arch/arm64/boot/dts/hisilicon/hi3660.dtsi b/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
index 12544c3..fd4b838 100644
--- a/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
+++ b/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
@@ -1338,9 +1338,14 @@
status = "ok";
};
+ sco_codec: bt_sco {
+ compatible = "linux,bt-sco";
+ #sound-dai-cells = <0>;
+ };
+
sound {
compatible = "simple-audio-card";
- simple-audio-card,name = "hikey-hdmi";
+ simple-audio-card,name = "hikey-btsco";
simple-audio-card,format = "i2s";
simple-audio-card,bitclock-master = <&sound_master>;
@@ -1351,7 +1356,7 @@
};
simple-audio-card,codec {
- sound-dai = <&adv7533>;
+ sound-dai = <&sco_codec>;
};
};
};
diff --git a/arch/arm64/configs/hikey960_defconfig b/arch/arm64/configs/hikey960_defconfig
index 8613e46..9462f23 100644
--- a/arch/arm64/configs/hikey960_defconfig
+++ b/arch/arm64/configs/hikey960_defconfig
@@ -323,6 +323,7 @@ CONFIG_SND_USB_AUDIO=y
CONFIG_SND_SOC=y
CONFIG_SND_I2S_HISI_I2S=y
CONFIG_SND_SIMPLE_CARD=y
+CONFIG_SND_SOC_BT_SCO=y
CONFIG_HIDRAW=y
CONFIG_UHID=y
CONFIG_HID_A4TECH=y
diff --git a/sound/soc/codecs/bt-sco.c b/sound/soc/codecs/bt-sco.c
index 8014e69..ae03023 100644
--- a/sound/soc/codecs/bt-sco.c
+++ b/sound/soc/codecs/bt-sco.c
@@ -31,34 +31,17 @@ static struct snd_soc_dai_driver bt_sco_dai[] = {
.playback = {
.stream_name = "Playback",
.channels_min = 1,
- .channels_max = 1,
+ .channels_max = 2,
.rates = SNDRV_PCM_RATE_8000,
.formats = SNDRV_PCM_FMTBIT_S16_LE,
},
.capture = {
.stream_name = "Capture",
.channels_min = 1,
- .channels_max = 1,
+ .channels_max = 2,
.rates = SNDRV_PCM_RATE_8000,
.formats = SNDRV_PCM_FMTBIT_S16_LE,
},
- },
- {
- .name = "bt-sco-pcm-wb",
- .playback = {
- .stream_name = "Playback",
- .channels_min = 1,
- .channels_max = 1,
- .rates = SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000,
- .formats = SNDRV_PCM_FMTBIT_S16_LE,
- },
- .capture = {
- .stream_name = "Capture",
- .channels_min = 1,
- .channels_max = 1,
- .rates = SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000,
- .formats = SNDRV_PCM_FMTBIT_S16_LE,
- },
}
};
diff --git a/sound/soc/hisilicon/hisi-i2s.c b/sound/soc/hisilicon/hisi-i2s.c
index 4c74a6c..b0028ca 100644
--- a/sound/soc/hisilicon/hisi-i2s.c
+++ b/sound/soc/hisilicon/hisi-i2s.c
@@ -276,18 +276,18 @@ struct snd_soc_dai_driver hisi_i2s_dai_init = {
.name = "hisi_i2s",
.probe = hisi_i2s_dai_probe,
.playback = {
- .channels_min = 2,
+ .channels_min = 1,
.channels_max = 2,
.formats = SNDRV_PCM_FMTBIT_S16_LE |
SNDRV_PCM_FMTBIT_U16_LE,
- .rates = SNDRV_PCM_RATE_48000,
+ .rates = SNDRV_PCM_RATE_8000,
},
.capture = {
- .channels_min = 2,
+ .channels_min = 1,
.channels_max = 2,
.formats = SNDRV_PCM_FMTBIT_S16_LE |
SNDRV_PCM_FMTBIT_U16_LE,
- .rates = SNDRV_PCM_RATE_48000,
+ .rates = SNDRV_PCM_RATE_8000,
},
.ops = &hisi_i2s_dai_ops,
};
@@ -305,7 +305,7 @@ static const struct snd_pcm_hardware snd_hisi_hardware = {
SNDRV_PCM_INFO_RESUME |
SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_HALF_DUPLEX,
- .period_bytes_min = 4096,
+ .period_bytes_min = 1024,
.period_bytes_max = 4096,
.periods_min = 4,
.periods_max = UINT_MAX,
diff --git a/sound/soc/hisilicon/hisi-i2s.h b/sound/soc/hisilicon/hisi-i2s.h
index 7dc0801..9db85f8 100644
--- a/sound/soc/hisilicon/hisi-i2s.h
+++ b/sound/soc/hisilicon/hisi-i2s.h
@@ -79,7 +79,7 @@ enum hisi_i2s_rates {
#define HI_ASP_CFG_R_CLK_SEL_EN BIT(2)
#define HI_ASP_CFG_R_CLK_SEL 0x140010
#define HI_ASP_CFG_R_CLK1_DIV_SEL 0xbcdc9a
-#define HI_ASP_CFG_R_CLK4_DIV_SEL 0x00ff000f
+#define HI_ASP_CFG_R_CLK4_DIV_SEL 0x00ff005f
#define HI_ASP_CFG_R_CLK6_DIV_SEL 0x00ff003f
#define HI_ASP_CFG_SIO_MODE 0
#define HI_ASP_SIO_MODE_SEL_EN BIT(0)
WL1837MOD PCM configuration;
dut_mode_send 0x3f 0x0106 0x00 0x02 0x01 0x40 0x1f 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x10 0x00 0x01 0x00 0x01 0x10 0x00 0x01 0x00 0x00 0x00 0x10 0x00 0x21 0x00 0x01 0x10 0x00 0x21 0x00 0x00 0x00
The patch to run that command is up a few comments.