Hi i'm working on HFP profile bringup on imx8mp Phytec board using android11 platform. here i am using wm8960 external audio codec. and realtek rtl8822b bt chip connected via USB interface.

here i have tested A2DP source and sink modes. by using WM8960 dts node mentioned below.
wm8960-audio-card {
compatible = "simple-audio-card";
simple-audio-card,name = "wm8960-audio";
simple-audio-card,format = "i2s";
simple-audio-card,bitclock-master = <&dailink_master>;
simple-audio-card,frame-master = <&dailink_master>;
simple-audio-card,mclk-fs = <32>;
simple-audio-card,hp-det = <2 0>;simple-audio-card,widgets =
"Microphone", "Mic Jack",
"Line", "Line In",
"Line", "Line Out",
"Speaker", "Speaker",
"Headphone", "Headphone Jack";
simple-audio-card,routing =
"Headphone Jack", "HP_L",
"Headphone Jack", "HP_R",
"Speaker", "SPK_LP",
"Speaker", "SPK_LN",
"LINPUT1", "Mic Jack",
"LINPUT3", "Mic Jack",
"RINPUT1", "Mic Jack",
"RINPUT2", "Mic Jack";
status = "okay";
dailink_master: simple-audio-card,cpu {
sound-dai = <&sai2>;
};
simple-audio-card,codec {
sound-dai = <&codec>;
system-clock-frequency = <12288000>;
};
};
reg_audio_pwr: regulator-audio-pwr {
compatible = "regulator-fixed";
regulator-name = "audio-pwr";
regulator-min-microvolt = <3300000>;regulator-max-microvolt = <3300000>;
gpio = <&gpio4 29 GPIO_ACTIVE_HIGH>;
enable-active-high;
regulator-always-on;
status = "okay";
};
which created sound cards
Hi i'm working on HFP profile bringup on imx8mp Phytec board using android11 platform. here i am using wm8960 external audio codec. and realtek rtl8822b bt chip connected via USB interface.
here i have tested A2DP source and sink modes. by using WM8960 dts node mentioned below.
wm8960-audio-card {
compatible = "simple-audio-card";
simple-audio-card,name = "wm8960-audio";
simple-audio-card,format = "i2s";
simple-audio-card,bitclock-master = <&dailink_master>;
simple-audio-card,frame-master = <&dailink_master>;
simple-audio-card,mclk-fs = <32>;
simple-audio-card,hp-det = <2 0>;simple-audio-card,widgets =
"Microphone", "Mic Jack",
"Line", "Line In",
"Line", "Line Out",
"Speaker", "Speaker",
"Headphone", "Headphone Jack";
simple-audio-card,routing =
"Headphone Jack", "HP_L",
"Headphone Jack", "HP_R",
"Speaker", "SPK_LP",
"Speaker", "SPK_LN",
"LINPUT1", "Mic Jack",
"LINPUT3", "Mic Jack",
"RINPUT1", "Mic Jack",
"RINPUT2", "Mic Jack";
status = "okay";
dailink_master: simple-audio-card,cpu {
sound-dai = <&sai2>;
};
simple-audio-card,codec {
sound-dai = <&codec>;
system-clock-frequency = <12288000>;
};
};
reg_audio_pwr: regulator-audio-pwr {
compatible = "regulator-fixed";
regulator-name = "audio-pwr";
regulator-min-microvolt = <3300000>;regulator-max-microvolt = <3300000>;
gpio = <&gpio4 29 GPIO_ACTIVE_HIGH>;
enable-active-high;
regulator-always-on;
status = "okay";
};
which created sound cards but those cards are not supporting hfp
so i added btsco node in dts
bt_sco_codec: bt_sco_codec {
#sound-dai-cells = <1>;
compatible = "linux,bt-sco";
};
sound-bt-sco {
compatible = "simple-audio-card";
simple-audio-card,name = "bt-sco-audio";
simple-audio-card,format = "i2s";
simple-audio-card,bitclock-inversion;
simple-audio-card,frame-master = <&btcpu>;
simple-audio-card,bitclock-master = <&btcpu>;
btcpu: simple-audio-card,cpu {
sound-dai = <&sai2>;
dai-tdm-slot-num = <2>;
dai-tdm-slot-width = <16>;
};
simple-audio-card,codec {
sound-dai = <&bt_sco_codec 1>;
};
};
which created sound cards that can support hfp but sco task creation is failed can you help here?
01-30 10:47:47.130 376 439 D audio_hw_primary: HFP DEBUG: card list: 0
01-30 10:47:47.130 376 439 D audio_hw_primary: HFP DEBUG: support hfp: 1
01-30 10:47:47.130 376 439 D audio_hw_primary: HFP DEBUG: card list: 0
01-30 10:47:47.130 376 439 D audio_hw_primary: HFP DEBUG: support hfp: 1
01-30 10:47:47.130 376 439 D audio_hw_primary: get_card_for_hfp: card: 0
01-30 10:47:47.130 376 439 I audio_hw_primary: set pcm_config_sco_in.period_size to 64
01-30 10:47:47.130 376 439 I audio_hw_primary: open sco for read, card 0, port 0
01-30 10:47:47.130 376 439 I audio_hw_primary: rate 16000, channel 1, period_size 0x40, period_count 8
01-30 10:47:47.135 376 439 I audio_hw_primary: after pcm open, rate 16000, channel 1, period_size 0x40, period_count 8
01-30 10:47:47.139 376 439 I audio_hw_primary: create_resampler rsmpl_sco_rx, in rate 16000, out rate 48000
01-30 10:47:47.141 376 439 W libc : pthread_create sched_setscheduler(1, {3}) call failed: Operation not permitted
01-30 10:47:47.141 376 439 I audio_hw_primary: sco_rx_task create ret 0, tid_sco_rx -207371840
01-30 10:47:47.141 376 2411 I audio_hw_primary: enter sco_rx_task, pcm_sco_rx frames 64, szie 128
01-30 10:47:47.141 376 439 I audio_hw_primary: prepare bt tx task
01-30 10:47:47.141 376 2411 I audio_hw_primary: sco_rx_task: primary output is standy, open it
01-30 10:47:47.141 376 439 D audio_hw_primary: HFP DEBUG: card list: 0
01-30 10:47:47.141 376 2411 I audio_hw_primary: start_output_stream: primary: 1, out: 0xf40c6730, device: 2, address: , mode: 0, flags 0x2
01-30 10:47:47.141 376 439 D audio_hw_primary: HFP DEBUG: support hfp: 1
01-30 10:47:47.141 376 2411 I audio_hw_primary: select_output_device(), headphone 0 ,headset 0 ,speaker 2
01-30 10:47:47.141 376 2411 D audio_hw_primary: start_output_stream: pcm_open: out->device: 2, card: -1, pcm_device_id: 0, rate: 48000, channel: 2, format: 0, period_size: 0xc0, flag: 9
01-30 10:47:47.141 376 2411 E audio_hw_primary: start_output_stream: Invalid PCM card id: -1
01-30 10:47:47.141 376 439 D audio_hw_primary: HFP DEBUG: card list: 0
01-30 10:47:47.141 376 2411 E audio_hw_primary: sco_rx_task: start_output_stream failed, ret -22
01-30 10:47:47.141 376 2411 E audio_hw_primary: sco_rx_task, out_pcm is null
01-30 10:47:47.141 376 2411 I audio_hw_primary: leave sco_rx_task
01-30 10:47:47.141 376 439 D audio_hw_primary: HFP DEBUG: support hfp: 1
01-30 10:47:47.141 376 439 D audio_hw_primary: get_card_for_hfp: card: 0
01-30 10:47:47.141 376 439 I audio_hw_primary: open sco for write, card 0, port 0
01-30 10:47:47.141 376 439 I audio_hw_primary: rate 16000, channel 1, period_size 0xc0
01-30 10:47:47.145 554 554 I Telecom : TelecomSystem: CallerInfoAsyncQuery.startQuery number=*** cookie=(...->CS.crCo->H.CS.crCo->H.CS.crCo.pICR)->CSW.hCCC->CILH.sL->CILH.sL(cab/cast)@E-E-AEw: (...-w
01-30 10:47:47.146 554 622 I Telecom : Event: RecordEntry TC@1: CAPABILITY_CHANGE, Current: [[ sup_hld mut]], Removed [[]], Added [[ sup_hld mut]]: (...->CS.crCo->H.CS.crCo->H.CS.crCo.pICR)->CSW.hCCw
01-30 10:47:47.146 554 622 I Telecom : CallsManager: setCallState NEW -> DIALING, call: [Call id=TC@1, state=NEW, tpac=ComponentInfo{com.android.bluetooth/com.android.bluetooth.hfpclient.connserv.Hfw
01-30 10:47:47.147 554 622 I Telecom : Event: RecordEntry TC@1: SET_DIALING, successful unknown call: (...->CS.crCo->H.CS.crCo->H.CS.crCo.pICR)->CSW.hCCC(cab/cast)@E-E-AEw
01-30 10:47:47.148 554 622 I Telecom : CallsManager: onSuccessfulUnknownCall for call [Call id=TC@1, state=DIALING, tpac=ComponentInfo{com.android.bluetooth/com.android.bluetooth.hfpclient.connserv.w
01-30 10:47:47.149 376 439 W audio_hw_primary: open mic, card -1, port 0
01-30 10:47:47.149 376 439 W audio_hw_primary: rate 48000, channel 1, period_size 0x240
01-30 10:47:47.149 376 439 E audio_hw_primary: cannot open pcm_cap: cannot open device '/dev/snd/pcmC4294967295D0c': No such file or directory
01-30 10:47:47.149 376 439 I audio_hw_primary: sco_task_create, ret -1