bluetooth: add QDSP6 internal BT-SCO audio routing, fix A2DP/HSP-HFP profile handling, and add in-call Bluetooth route
This commit is contained in:
1 parent
02ce3ab1f4
commit
b2ade2dc42
70 files changed
+1182
-97
No files matched your search
+1
-1
@@ -23,7 +23,7 @@ Release versions follow the `<year-letter><MM><DD>` format (where `2026` is `a`,
|
|||||||
- Upgraded **SIP (`sip.so` / `xsip`)** with direct accountless P2P/federated SIP URI calling (`user@host[:port]` or `sip:user@host[:port]`), alphanumeric username/password multi-tap entry, RFC 3263 DNS `SRV` (`_sip._udp.<domain>`) proxy discovery, RFC 3261 Timer A `INVITE` retransmission with multi-`A` proxy failover, `Record-Route`/`Contact` dialog routing, RFC 6189 **ZRTP** media-path key agreement (`DH3k` 3072-bit / `DH2k` 2048-bit Diffie-Hellman, `H0..H3` SHA-256 hash chain, Castagnoli CRC-32C framing, `a=zrtp-hash` SDP signaling, and 4-character Base32 `SAS` verification code) with RFC 3711 **SRTP** (`AES-128-CM` + `HMAC-SHA1-80`/`32`) encrypted voice media, incoming and active `[SIP/<codec>]` / `[SIP/<codec>:<sas>]` call badges in `xcallscreen`, wideband and narrowband multi-codec RTP/SRTP audio (`G.711 PCMU`/`PCMA` 8 kHz via PJSIP `pjmedia`, `GSM 06.10` Full Rate 8 kHz, `Opus` 16 kHz / 48 kHz RTP clock with in-band FEC, `ITU-T G.722` 16 kHz wideband SB-ADPCM via PJSIP `pjmedia-codec/g722`, `ITU-T G.726-32` 8 kHz ADPCM, `IMA ADPCM DVI4` 8/16 kHz, and `L16` uncompressed 16-bit PCM 8/16 kHz) with per-account and direct-mode codec preference selection, and seamless early-media (`183 Session Progress` -> `200 OK`) `arecord`/`aplay` stream continuity.
|
- Upgraded **SIP (`sip.so` / `xsip`)** with direct accountless P2P/federated SIP URI calling (`user@host[:port]` or `sip:user@host[:port]`), alphanumeric username/password multi-tap entry, RFC 3263 DNS `SRV` (`_sip._udp.<domain>`) proxy discovery, RFC 3261 Timer A `INVITE` retransmission with multi-`A` proxy failover, `Record-Route`/`Contact` dialog routing, RFC 6189 **ZRTP** media-path key agreement (`DH3k` 3072-bit / `DH2k` 2048-bit Diffie-Hellman, `H0..H3` SHA-256 hash chain, Castagnoli CRC-32C framing, `a=zrtp-hash` SDP signaling, and 4-character Base32 `SAS` verification code) with RFC 3711 **SRTP** (`AES-128-CM` + `HMAC-SHA1-80`/`32`) encrypted voice media, incoming and active `[SIP/<codec>]` / `[SIP/<codec>:<sas>]` call badges in `xcallscreen`, wideband and narrowband multi-codec RTP/SRTP audio (`G.711 PCMU`/`PCMA` 8 kHz via PJSIP `pjmedia`, `GSM 06.10` Full Rate 8 kHz, `Opus` 16 kHz / 48 kHz RTP clock with in-band FEC, `ITU-T G.722` 16 kHz wideband SB-ADPCM via PJSIP `pjmedia-codec/g722`, `ITU-T G.726-32` 8 kHz ADPCM, `IMA ADPCM DVI4` 8/16 kHz, and `L16` uncompressed 16-bit PCM 8/16 kHz) with per-account and direct-mode codec preference selection, and seamless early-media (`183 Session Progress` -> `200 OK`) `arecord`/`aplay` stream continuity.
|
||||||
- Upgraded **IRC (`irc.so` / `xirc`)** with `1:Chat` default tab ordering, `433` nick-in-use fallback, `470` channel forwarding tracking, `/close` and `/clear` commands, targeted buffer closing (`Menu -> Close Buffer` or `BackSpace` in `Buffers`), and notification hook integration in `BG Mode`.
|
- Upgraded **IRC (`irc.so` / `xirc`)** with `1:Chat` default tab ordering, `433` nick-in-use fallback, `470` channel forwarding tracking, `/close` and `/clear` commands, targeted buffer closing (`Menu -> Close Buffer` or `BackSpace` in `Buffers`), and notification hook integration in `BG Mode`.
|
||||||
- **Bluetooth audio (`A2DP`, `HSP/HFP`), HID peripherals (keyboards, mice, gamepads), discoverability & alias settings, and active connection badges (`xnetworks`, `bananarchy-bt-obex`, `sxmo_audio.sh`, `dwm`, `libneoui.so`)**:
|
- **Bluetooth audio (`A2DP`, `HSP/HFP`), HID peripherals (keyboards, mice, gamepads), discoverability & alias settings, and active connection badges (`xnetworks`, `bananarchy-bt-obex`, `sxmo_audio.sh`, `dwm`, `libneoui.so`)**:
|
||||||
- Configured BlueZ (`/etc/bluetooth/main.conf`, `/etc/bluetooth/input.conf`) and WirePlumber (`50-bluetooth.conf`) with full **A2DP** (`a2dp_sink`, `a2dp_source` with `sbc_xq`, `aac`, `ldac`, `aptx`, `aptx_hd`), **HSP/HFP** (`hsp_hs`, `hsp_ag`, `hfp_hf`, `hfp_ag` with `mSBC` wideband speech and hardware volume), and **HID / BLE HOGP** (`uhid`, `hidp`, `uinput`, `rfcomm`, `bnep`, `xpad`) profile support, and added `Bluetooth` as a selectable audio output/input route in `sxmo_audio.sh`, `xdrawer`, and `dmenu` Audio menu (plus automatic PipeWire `"default"` ALSA routing in `gambatte` and `remedy` when Bluetooth audio is active).
|
- Configured BlueZ (`/etc/bluetooth/main.conf`, `/etc/bluetooth/input.conf`), WirePlumber (`50-bluetooth.conf` with `bluetooth.autoswitch-to-headset-profile = false`, `bluetooth.use-persistent-storage = false`, and `bluez5.enable-msbc = false`), and the `6.12.1-msm8916` QDSP6/ASoC/SMD kernel stack (`0005-msm8909-qdsp6-bt-sco-support.patch` adding `INTERNAL_BT_SCO_RX` `0x3000` / `INTERNAL_BT_SCO_TX` `0x3001` `dai@136`/`dai@137` AFE ports, `AFE_PARAM_ID_INTERNAL_BT_FM_CONFIG`, dynamic mid-call `q6voice` CVP port switching, codec-less DPCM backend links in `snd-soc-qcom-common.ko.zst` / `snd-soc-apq8016-sbc.ko.zst`, and `HCI_SCODATA_PKT` handling in `btqcomsmd.ko.zst`) with full **A2DP** (`a2dp_sink`, `a2dp_source` with `sbc_xq`, `aac`, `ldac`, `aptx`, `aptx_hd`), **HSP/HFP** (`hsp_hs`, `hsp_ag`, `hfp_hf`, `hfp_ag` 8 kHz CVSD over hardware LPASS `INT_BT_SCO_RX`/`INT_BT_SCO_TX` with automatic PipeWire SCO socket keepalive), and **HID / BLE HOGP** (`uhid`, `hidp`, `uinput`, `rfcomm`, `bnep`, `xpad`) profile support, and added `Bluetooth` as a selectable audio output/input route in `sxmo_audio.sh`, `sxmo_modemaudio.sh`, `xcallscreen` (`[3] Audio Out`), `xdrawer`, and `dmenu` Audio menu (plus automatic PipeWire `"default"` ALSA routing in `gambatte` and `remedy` when Bluetooth audio is active).
|
||||||
- Added **Discoverable** (`ON (Visible)` / `OFF (Hidden)`, persisted in `~/.config/sxmo/bt_discoverable`) and **Bluetooth Device Name** (`Name: <Alias> [Edit]` with a multi-tap modal editor persisted in `~/.config/sxmo/bt_name` and applied via `bluetoothctl system-alias` independently of the system hostname) rows to the `3:Bluetooth` tab of `xnetworks`, alongside active connection count headers (`Bluetooth: ON (N Active)`), pinned active device cards with live profile and battery badges (`[ACTIVE: A2DP]`, `[ACTIVE: HSP/HFP]`, `[ACTIVE: HID Gamepad]`, `[ACTIVE: HID Keyboard]`, `[ACTIVE: HID Mouse]`), and a **Switch Audio (A2DP / HSP-HFP)** action.
|
- Added **Discoverable** (`ON (Visible)` / `OFF (Hidden)`, persisted in `~/.config/sxmo/bt_discoverable`) and **Bluetooth Device Name** (`Name: <Alias> [Edit]` with a multi-tap modal editor persisted in `~/.config/sxmo/bt_name` and applied via `bluetoothctl system-alias` independently of the system hostname) rows to the `3:Bluetooth` tab of `xnetworks`, alongside active connection count headers (`Bluetooth: ON (N Active)`), pinned active device cards with live profile and battery badges (`[ACTIVE: A2DP]`, `[ACTIVE: HSP/HFP]`, `[ACTIVE: HID Gamepad]`, `[ACTIVE: HID Keyboard]`, `[ACTIVE: HID Mouse]`), and a **Switch Audio (A2DP / HSP-HFP)** action.
|
||||||
- Added a persistent BlueZ `NoInputNoOutput` default pairing/authorization agent (`/org/bananarchy/bt_agent`) and D-Bus `connect`/`pair` handler inside `/usr/bin/bananarchy-bt-obex` (with a 15-second discovery scan window) for seamless BLE HOGP (`00001812`) and Classic HID (`00001124`) keyboard/mouse/gamepad SMP/SSP Just-Works bonding and auto-reconnection, an automatic `/dev/uinput` gamepad-to-keypad bridge (`Bananarchy BT Gamepad Bridge`, excluding QWERTY keyboards) so Bluetooth/USB gamepads (`D-Pad` / `Left Stick` -> `Up`/`Down`/`Left`/`Right`, `South/A` -> `Enter`, `East/B` -> `8`, `West/X` -> `5`, `North/Y` -> `6`, `Start` -> `2`, `Select` -> `3`, `L1`/`R1` -> `Left`/`Right softkey`, `L2`/`R2` -> `*`/`0`, `Mode` -> `Escape`) control all NeoUI apps and games (`snake`, `tetris`, `scoundrel`, `gambatte`, `remedy`) out of the box, automatic `[KBD]` external keyboard detection (`isExternalKeyboardActive()`) in `fcitx5-t9`, `libneoui.so`, and DWM plugins so connecting a Bluetooth/USB QWERTY keyboard automatically bypasses T9 multi-tap and preedit popups for all keys (`0-9`, `*`, `#`, `Shift+0-9`, and letters), and automatic `XFixes` cursor display in `dwm` (`dwm_has_external_mouse()`) whenever a Bluetooth/USB mouse is connected.
|
- Added a persistent BlueZ `NoInputNoOutput` default pairing/authorization agent (`/org/bananarchy/bt_agent`) and D-Bus `connect`/`pair` handler inside `/usr/bin/bananarchy-bt-obex` (with a 15-second discovery scan window) for seamless BLE HOGP (`00001812`) and Classic HID (`00001124`) keyboard/mouse/gamepad SMP/SSP Just-Works bonding and auto-reconnection, an automatic `/dev/uinput` gamepad-to-keypad bridge (`Bananarchy BT Gamepad Bridge`, excluding QWERTY keyboards) so Bluetooth/USB gamepads (`D-Pad` / `Left Stick` -> `Up`/`Down`/`Left`/`Right`, `South/A` -> `Enter`, `East/B` -> `8`, `West/X` -> `5`, `North/Y` -> `6`, `Start` -> `2`, `Select` -> `3`, `L1`/`R1` -> `Left`/`Right softkey`, `L2`/`R2` -> `*`/`0`, `Mode` -> `Escape`) control all NeoUI apps and games (`snake`, `tetris`, `scoundrel`, `gambatte`, `remedy`) out of the box, automatic `[KBD]` external keyboard detection (`isExternalKeyboardActive()`) in `fcitx5-t9`, `libneoui.so`, and DWM plugins so connecting a Bluetooth/USB QWERTY keyboard automatically bypasses T9 multi-tap and preedit popups for all keys (`0-9`, `*`, `#`, `Shift+0-9`, and letters), and automatic `XFixes` cursor display in `dwm` (`dwm_has_external_mouse()`) whenever a Bluetooth/USB mouse is connected.
|
||||||
- **Universal Power button (`dmenu power`) access, lockscreen X11 grab preemption, ReMEdy `Call (green)` pause menu, JSR expansion, and 64 MB mark-and-sweep GC**:
|
- **Universal Power button (`dmenu power`) access, lockscreen X11 grab preemption, ReMEdy `Call (green)` pause menu, JSR expansion, and 64 MB mark-and-sweep GC**:
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ All twenty-five phone applications are compiled as shared-object plugins (`/usr/
|
|||||||
- **In-call controls and recording**:
|
- **In-call controls and recording**:
|
||||||
- **`[1]` / `*` — microphone mute**: toggles hardware QDSP6 and PipeWire microphone mute (`ON` / `MUTED`).
|
- **`[1]` / `*` — microphone mute**: toggles hardware QDSP6 and PipeWire microphone mute (`ON` / `MUTED`).
|
||||||
- **`[2]` / `#` — call recording**: starts or stops recording call audio (`8 kHz` mono S16_LE WAV via `MultiMedia2` `hw:0,1` with automatic peak normalization) to `~/Recordings/rec_HHMMSS_<caller>.wav`, displaying a live `REC MM:SS` timer while recording and a persistent green `SAVED MM:SS` badge once saved.
|
- **`[2]` / `#` — call recording**: starts or stops recording call audio (`8 kHz` mono S16_LE WAV via `MultiMedia2` `hw:0,1` with automatic peak normalization) to `~/Recordings/rec_HHMMSS_<caller>.wav`, displaying a live `REC MM:SS` timer while recording and a persistent green `SAVED MM:SS` badge once saved.
|
||||||
- **`[3]` — audio route**: switches between **`EARPIECE`** (default for all calls) and **`SPEAKER`**.
|
- **`[3]` — audio route**: cycles between **`BLUETOOTH`** (when a Bluetooth headset is connected, routing call audio over QDSP6 `INT_BT_SCO_RX` / `INT_BT_SCO_TX`), **`SPEAKER`**, and **`EARPIECE`** (or **`HEADPHONES`** when wired headphones are plugged in).
|
||||||
- **`Left` / `Right` — call volume**: adjusts in-call volume in `5%` steps.
|
- **`Left` / `Right` — call volume**: adjusts in-call volume in `5%` steps.
|
||||||
- **`[0]` / Left softkey (`DTMF`)**: toggles DTMF tone keypad mode.
|
- **`[0]` / Left softkey (`DTMF`)**: toggles DTMF tone keypad mode.
|
||||||
- **End (red)** or **Right softkey (`Hangup`)**: hangs up the call.
|
- **End (red)** or **Right softkey (`Hangup`)**: hangs up the call.
|
||||||
|
|||||||
Binary file not shown.
@@ -1366,6 +1366,14 @@
|
|||||||
reg = <0x15>;
|
reg = <0x15>;
|
||||||
qcom,sd-lines = <0x00 0x01>;
|
qcom,sd-lines = <0x00 0x01>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
dai@136 {
|
||||||
|
reg = <0x88>;
|
||||||
|
};
|
||||||
|
|
||||||
|
dai@137 {
|
||||||
|
reg = <0x89>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
clock-controller {
|
clock-controller {
|
||||||
@@ -1552,6 +1560,30 @@
|
|||||||
sound-dai = <0x3f>;
|
sound-dai = <0x3f>;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
dai-link-bt-sco-rx {
|
||||||
|
link-name = "Internal BT-SCO RX";
|
||||||
|
|
||||||
|
cpu {
|
||||||
|
sound-dai = <0x3e 0x88>;
|
||||||
|
};
|
||||||
|
|
||||||
|
platform {
|
||||||
|
sound-dai = <0x3f>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
dai-link-bt-sco-tx {
|
||||||
|
link-name = "Internal BT-SCO TX";
|
||||||
|
|
||||||
|
cpu {
|
||||||
|
sound-dai = <0x3e 0x89>;
|
||||||
|
};
|
||||||
|
|
||||||
|
platform {
|
||||||
|
sound-dai = <0x3f>;
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
audio-codec@771c000 {
|
audio-codec@771c000 {
|
||||||
|
|||||||
Binary file not shown.
@@ -1366,6 +1366,14 @@
|
|||||||
reg = <0x15>;
|
reg = <0x15>;
|
||||||
qcom,sd-lines = <0x00 0x01>;
|
qcom,sd-lines = <0x00 0x01>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
dai@136 {
|
||||||
|
reg = <0x88>;
|
||||||
|
};
|
||||||
|
|
||||||
|
dai@137 {
|
||||||
|
reg = <0x89>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
clock-controller {
|
clock-controller {
|
||||||
@@ -1552,6 +1560,30 @@
|
|||||||
sound-dai = <0x3f>;
|
sound-dai = <0x3f>;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
dai-link-bt-sco-rx {
|
||||||
|
link-name = "Internal BT-SCO RX";
|
||||||
|
|
||||||
|
cpu {
|
||||||
|
sound-dai = <0x3e 0x88>;
|
||||||
|
};
|
||||||
|
|
||||||
|
platform {
|
||||||
|
sound-dai = <0x3f>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
dai-link-bt-sco-tx {
|
||||||
|
link-name = "Internal BT-SCO TX";
|
||||||
|
|
||||||
|
cpu {
|
||||||
|
sound-dai = <0x3e 0x89>;
|
||||||
|
};
|
||||||
|
|
||||||
|
platform {
|
||||||
|
sound-dai = <0x3f>;
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
audio-codec@771c000 {
|
audio-codec@771c000 {
|
||||||
|
|||||||
Binary file not shown.
@@ -1366,6 +1366,14 @@
|
|||||||
reg = <0x15>;
|
reg = <0x15>;
|
||||||
qcom,sd-lines = <0x00 0x01>;
|
qcom,sd-lines = <0x00 0x01>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
dai@136 {
|
||||||
|
reg = <0x88>;
|
||||||
|
};
|
||||||
|
|
||||||
|
dai@137 {
|
||||||
|
reg = <0x89>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
clock-controller {
|
clock-controller {
|
||||||
@@ -1552,6 +1560,30 @@
|
|||||||
sound-dai = <0x3f>;
|
sound-dai = <0x3f>;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
dai-link-bt-sco-rx {
|
||||||
|
link-name = "Internal BT-SCO RX";
|
||||||
|
|
||||||
|
cpu {
|
||||||
|
sound-dai = <0x3e 0x88>;
|
||||||
|
};
|
||||||
|
|
||||||
|
platform {
|
||||||
|
sound-dai = <0x3f>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
dai-link-bt-sco-tx {
|
||||||
|
link-name = "Internal BT-SCO TX";
|
||||||
|
|
||||||
|
cpu {
|
||||||
|
sound-dai = <0x3e 0x89>;
|
||||||
|
};
|
||||||
|
|
||||||
|
platform {
|
||||||
|
sound-dai = <0x3f>;
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
audio-codec@771c000 {
|
audio-codec@771c000 {
|
||||||
|
|||||||
@@ -1,8 +1,13 @@
|
|||||||
|
wireplumber.settings = {
|
||||||
|
bluetooth.autoswitch-to-headset-profile = false
|
||||||
|
bluetooth.use-persistent-storage = false
|
||||||
|
}
|
||||||
|
|
||||||
monitor.bluez.properties = {
|
monitor.bluez.properties = {
|
||||||
bluez5.roles = [ a2dp_sink a2dp_source bap_sink bap_source hsp_hs hsp_ag hfp_hf hfp_ag ]
|
bluez5.roles = [ a2dp_sink a2dp_source bap_sink bap_source hsp_hs hsp_ag hfp_hf hfp_ag ]
|
||||||
bluez5.codecs = [ sbc sbc_xq aac ldac aptx aptx_hd aptx_ll aptx_ll_duplex faststream faststream_duplex opus_05 opus_05_51 opus_05_71 opus_05_dup opus_05_pro lc3 ]
|
bluez5.codecs = [ sbc sbc_xq aac ldac aptx aptx_hd aptx_ll aptx_ll_duplex faststream faststream_duplex opus_05 opus_05_51 opus_05_71 opus_05_dup opus_05_pro lc3 ]
|
||||||
bluez5.enable-sbc-xq = true
|
bluez5.enable-sbc-xq = true
|
||||||
bluez5.enable-msbc = true
|
bluez5.enable-msbc = false
|
||||||
bluez5.enable-hw-volume = true
|
bluez5.enable-hw-volume = true
|
||||||
bluez5.hfphsp-backend = "native"
|
bluez5.hfphsp-backend = "native"
|
||||||
bluez5.hfphsp-backend-native-modem = "any"
|
bluez5.hfphsp-backend-native-modem = "any"
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -41,6 +41,51 @@ normalize_in_dev() {
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
find_bt_card() {
|
||||||
|
pactl list short cards 2>/dev/null | awk '$2 ~ /^bluez_card\./ { print $2; exit }'
|
||||||
|
}
|
||||||
|
|
||||||
|
find_bt_profile() {
|
||||||
|
bt_card="$(find_bt_card)"
|
||||||
|
[ -z "$bt_card" ] && return 0
|
||||||
|
pactl list cards 2>/dev/null | awk -v c="$bt_card" '
|
||||||
|
$1 == "Name:" { in_card = ($2 == c) }
|
||||||
|
in_card && $1 == "Active" && $2 == "Profile:" { print $3; exit }
|
||||||
|
'
|
||||||
|
}
|
||||||
|
|
||||||
|
is_bt_hfp() {
|
||||||
|
prof="$(find_bt_profile)"
|
||||||
|
case "$prof" in
|
||||||
|
headset-head-unit*|*hfp*|*hsp*) return 0 ;;
|
||||||
|
*) return 1 ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
start_bt_sco_keepalive() {
|
||||||
|
bt_sink="$(find_bt_sink)"
|
||||||
|
[ -z "$bt_sink" ] && return 0
|
||||||
|
if [ -r /tmp/sxmo_bt_sco_keepalive.pid ]; then
|
||||||
|
read -r kpid < /tmp/sxmo_bt_sco_keepalive.pid 2>/dev/null || kpid=""
|
||||||
|
if [ -n "$kpid" ] && kill -0 "$kpid" 2>/dev/null; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if command -v pacat >/dev/null 2>&1; then
|
||||||
|
pacat --playback --device="$bt_sink" --rate=8000 --channels=1 --format=s16le /dev/zero >/dev/null 2>&1 &
|
||||||
|
printf "%d\n" "$!" > /tmp/sxmo_bt_sco_keepalive.pid 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
stop_bt_sco_keepalive() {
|
||||||
|
if [ -r /tmp/sxmo_bt_sco_keepalive.pid ]; then
|
||||||
|
read -r kpid < /tmp/sxmo_bt_sco_keepalive.pid 2>/dev/null || kpid=""
|
||||||
|
rm -f /tmp/sxmo_bt_sco_keepalive.pid 2>/dev/null || true
|
||||||
|
[ -n "$kpid" ] && kill -TERM "$kpid" 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
pkill -TERM -f "pacat --playback --device=bluez_output" 2>/dev/null || true
|
||||||
|
}
|
||||||
|
|
||||||
find_bt_sink() {
|
find_bt_sink() {
|
||||||
pactl list short sinks 2>/dev/null | awk '$2 ~ /^bluez_output\./ { print $2; exit }'
|
pactl list short sinks 2>/dev/null | awk '$2 ~ /^bluez_output\./ { print $2; exit }'
|
||||||
}
|
}
|
||||||
@@ -258,6 +303,7 @@ apply_alsa_out() {
|
|||||||
amixer -c 0 cset "name='HPHR'" 'ZERO' >/dev/null 2>&1 || true
|
amixer -c 0 cset "name='HPHR'" 'ZERO' >/dev/null 2>&1 || true
|
||||||
amixer -c 0 cset "name='RX2 MIX1 INP1'" 'ZERO' >/dev/null 2>&1 || true
|
amixer -c 0 cset "name='RX2 MIX1 INP1'" 'ZERO' >/dev/null 2>&1 || true
|
||||||
amixer -c 0 cset "name='RX2 Digital Volume'" 0 >/dev/null 2>&1 || true
|
amixer -c 0 cset "name='RX2 Digital Volume'" 0 >/dev/null 2>&1 || true
|
||||||
|
amixer -c 0 cset "name='INT_BT_SCO_RX Audio Mixer MultiMedia1'" 0 >/dev/null 2>&1 || true
|
||||||
amixer -c 0 cset "name='PRI_MI2S_RX Audio Mixer MultiMedia1'" 1 >/dev/null 2>&1 || true
|
amixer -c 0 cset "name='PRI_MI2S_RX Audio Mixer MultiMedia1'" 1 >/dev/null 2>&1 || true
|
||||||
amixer -c 0 cset "name='RDAC2 MUX'" 'RX1' >/dev/null 2>&1 || true
|
amixer -c 0 cset "name='RDAC2 MUX'" 'RX1' >/dev/null 2>&1 || true
|
||||||
if [ "$eff_pct" -gt 0 ]; then
|
if [ "$eff_pct" -gt 0 ]; then
|
||||||
@@ -274,6 +320,7 @@ apply_alsa_out() {
|
|||||||
amixer -c 0 cset "name='RX3 MIX1 INP1'" 'ZERO' >/dev/null 2>&1 || true
|
amixer -c 0 cset "name='RX3 MIX1 INP1'" 'ZERO' >/dev/null 2>&1 || true
|
||||||
amixer -c 0 cset "name='RX3 Digital Volume'" 0 >/dev/null 2>&1 || true
|
amixer -c 0 cset "name='RX3 Digital Volume'" 0 >/dev/null 2>&1 || true
|
||||||
amixer -c 0 cset "name='EAR_S'" 'ZERO' >/dev/null 2>&1 || true
|
amixer -c 0 cset "name='EAR_S'" 'ZERO' >/dev/null 2>&1 || true
|
||||||
|
amixer -c 0 cset "name='INT_BT_SCO_RX Audio Mixer MultiMedia1'" 0 >/dev/null 2>&1 || true
|
||||||
amixer -c 0 cset "name='PRI_MI2S_RX Audio Mixer MultiMedia1'" 1 >/dev/null 2>&1 || true
|
amixer -c 0 cset "name='PRI_MI2S_RX Audio Mixer MultiMedia1'" 1 >/dev/null 2>&1 || true
|
||||||
amixer -c 0 cset "name='RDAC2 MUX'" 'RX2' >/dev/null 2>&1 || true
|
amixer -c 0 cset "name='RDAC2 MUX'" 'RX2' >/dev/null 2>&1 || true
|
||||||
if [ "$eff_pct" -gt 0 ]; then
|
if [ "$eff_pct" -gt 0 ]; then
|
||||||
@@ -301,6 +348,13 @@ apply_alsa_out() {
|
|||||||
amixer -c 0 cset "name='RX1 Digital Volume'" 0 >/dev/null 2>&1 || true
|
amixer -c 0 cset "name='RX1 Digital Volume'" 0 >/dev/null 2>&1 || true
|
||||||
amixer -c 0 cset "name='RX2 Digital Volume'" 0 >/dev/null 2>&1 || true
|
amixer -c 0 cset "name='RX2 Digital Volume'" 0 >/dev/null 2>&1 || true
|
||||||
amixer -c 0 cset "name='RX3 Digital Volume'" 0 >/dev/null 2>&1 || true
|
amixer -c 0 cset "name='RX3 Digital Volume'" 0 >/dev/null 2>&1 || true
|
||||||
|
if is_bt_hfp && [ ! -r /tmp/sxmo_in_call ]; then
|
||||||
|
amixer -c 0 cset "name='PRI_MI2S_RX Audio Mixer MultiMedia1'" 0 >/dev/null 2>&1 || true
|
||||||
|
amixer -c 0 cset "name='INT_BT_SCO_RX Audio Mixer MultiMedia1'" 1 >/dev/null 2>&1 || true
|
||||||
|
else
|
||||||
|
amixer -c 0 cset "name='INT_BT_SCO_RX Audio Mixer MultiMedia1'" 0 >/dev/null 2>&1 || true
|
||||||
|
amixer -c 0 cset "name='PRI_MI2S_RX Audio Mixer MultiMedia1'" 1 >/dev/null 2>&1 || true
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
amixer -c 0 cset "name='EAR_S'" 'ZERO' >/dev/null 2>&1 || true
|
amixer -c 0 cset "name='EAR_S'" 'ZERO' >/dev/null 2>&1 || true
|
||||||
@@ -310,6 +364,7 @@ apply_alsa_out() {
|
|||||||
amixer -c 0 cset "name='RX2 MIX1 INP1'" 'ZERO' >/dev/null 2>&1 || true
|
amixer -c 0 cset "name='RX2 MIX1 INP1'" 'ZERO' >/dev/null 2>&1 || true
|
||||||
amixer -c 0 cset "name='RX1 Digital Volume'" 0 >/dev/null 2>&1 || true
|
amixer -c 0 cset "name='RX1 Digital Volume'" 0 >/dev/null 2>&1 || true
|
||||||
amixer -c 0 cset "name='RX2 Digital Volume'" 0 >/dev/null 2>&1 || true
|
amixer -c 0 cset "name='RX2 Digital Volume'" 0 >/dev/null 2>&1 || true
|
||||||
|
amixer -c 0 cset "name='INT_BT_SCO_RX Audio Mixer MultiMedia1'" 0 >/dev/null 2>&1 || true
|
||||||
amixer -c 0 cset "name='PRI_MI2S_RX Audio Mixer MultiMedia1'" 1 >/dev/null 2>&1 || true
|
amixer -c 0 cset "name='PRI_MI2S_RX Audio Mixer MultiMedia1'" 1 >/dev/null 2>&1 || true
|
||||||
amixer -c 0 cset "name='RX3 MIX1 INP1'" 'RX1' >/dev/null 2>&1 || true
|
amixer -c 0 cset "name='RX3 MIX1 INP1'" 'RX1' >/dev/null 2>&1 || true
|
||||||
if [ "$eff_pct" -gt 0 ]; then
|
if [ "$eff_pct" -gt 0 ]; then
|
||||||
@@ -326,6 +381,11 @@ apply_alsa_out() {
|
|||||||
if [ "$eff_pct" -gt 0 ]; then
|
if [ "$eff_pct" -gt 0 ]; then
|
||||||
wpctl set-mute @DEFAULT_AUDIO_SINK@ 0 >/dev/null 2>&1 || true
|
wpctl set-mute @DEFAULT_AUDIO_SINK@ 0 >/dev/null 2>&1 || true
|
||||||
if [ "$dev" = "Bluetooth" ]; then
|
if [ "$dev" = "Bluetooth" ]; then
|
||||||
|
bt_sink="$(find_bt_sink)"
|
||||||
|
if [ -n "$bt_sink" ]; then
|
||||||
|
pactl set-sink-mute "$bt_sink" 0 >/dev/null 2>&1 || true
|
||||||
|
pactl set-sink-volume "$bt_sink" "${eff_pct}%" >/dev/null 2>&1 || true
|
||||||
|
fi
|
||||||
wpctl set-volume @DEFAULT_AUDIO_SINK@ "${eff_pct}%" >/dev/null 2>&1 || true
|
wpctl set-volume @DEFAULT_AUDIO_SINK@ "${eff_pct}%" >/dev/null 2>&1 || true
|
||||||
else
|
else
|
||||||
wpctl set-volume @DEFAULT_AUDIO_SINK@ 100% >/dev/null 2>&1 || true
|
wpctl set-volume @DEFAULT_AUDIO_SINK@ 100% >/dev/null 2>&1 || true
|
||||||
@@ -353,33 +413,47 @@ apply_alsa_in() {
|
|||||||
if command -v amixer >/dev/null 2>&1; then
|
if command -v amixer >/dev/null 2>&1; then
|
||||||
amixer -c 0 cset "name='CIC1 MUX'" 'AMIC' >/dev/null 2>&1 || true
|
amixer -c 0 cset "name='CIC1 MUX'" 'AMIC' >/dev/null 2>&1 || true
|
||||||
if [ "$eff_pct" -gt 0 ]; then
|
if [ "$eff_pct" -gt 0 ]; then
|
||||||
if [ "$in_dev" = "Headset" ]; then
|
if [ "$in_dev" = "Bluetooth" ] && is_bt_hfp && [ ! -r /tmp/sxmo_in_call ]; then
|
||||||
amixer -c 0 cset "name='DEC1 MUX'" 'ADC2' >/dev/null 2>&1 || true
|
amixer -c 0 cset "name='MultiMedia2 Mixer TERT_MI2S_TX'" 0 >/dev/null 2>&1 || true
|
||||||
amixer -c 0 cset "name='ADC2 MUX'" 'INP2' >/dev/null 2>&1 || true
|
amixer -c 0 cset "name='MultiMedia2 Mixer INT_BT_SCO_TX'" 1 >/dev/null 2>&1 || true
|
||||||
amixer -c 0 cset "name='ADC2 Volume'" "$adc_hw" >/dev/null 2>&1 || true
|
|
||||||
amixer -c 0 cset "name='ADC1 Volume'" 0 >/dev/null 2>&1 || true
|
|
||||||
printf "2\n" > /tmp/xdrawer_mic_mux 2>/dev/null || true
|
|
||||||
else
|
else
|
||||||
amixer -c 0 cset "name='DEC1 MUX'" 'ADC1' >/dev/null 2>&1 || true
|
amixer -c 0 cset "name='MultiMedia2 Mixer INT_BT_SCO_TX'" 0 >/dev/null 2>&1 || true
|
||||||
amixer -c 0 cset "name='ADC2 MUX'" 'ZERO' >/dev/null 2>&1 || true
|
if [ "$in_dev" = "Headset" ]; then
|
||||||
amixer -c 0 cset "name='ADC1 Volume'" "$adc_hw" >/dev/null 2>&1 || true
|
amixer -c 0 cset "name='DEC1 MUX'" 'ADC2' >/dev/null 2>&1 || true
|
||||||
amixer -c 0 cset "name='ADC2 Volume'" 0 >/dev/null 2>&1 || true
|
amixer -c 0 cset "name='ADC2 MUX'" 'INP2' >/dev/null 2>&1 || true
|
||||||
printf "1\n" > /tmp/xdrawer_mic_mux 2>/dev/null || true
|
amixer -c 0 cset "name='ADC2 Volume'" "$adc_hw" >/dev/null 2>&1 || true
|
||||||
|
amixer -c 0 cset "name='ADC1 Volume'" 0 >/dev/null 2>&1 || true
|
||||||
|
printf "2\n" > /tmp/xdrawer_mic_mux 2>/dev/null || true
|
||||||
|
else
|
||||||
|
amixer -c 0 cset "name='DEC1 MUX'" 'ADC1' >/dev/null 2>&1 || true
|
||||||
|
amixer -c 0 cset "name='ADC2 MUX'" 'ZERO' >/dev/null 2>&1 || true
|
||||||
|
amixer -c 0 cset "name='ADC1 Volume'" "$adc_hw" >/dev/null 2>&1 || true
|
||||||
|
amixer -c 0 cset "name='ADC2 Volume'" 0 >/dev/null 2>&1 || true
|
||||||
|
printf "1\n" > /tmp/xdrawer_mic_mux 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
amixer -c 0 cset "name='TX1 Digital Volume'" "$tx_hw" >/dev/null 2>&1 || true
|
||||||
|
if [ ! -r /tmp/sxmo_in_call ]; then
|
||||||
|
amixer -c 0 cset "name='MultiMedia2 Mixer TERT_MI2S_TX'" 1 >/dev/null 2>&1 || true
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
amixer -c 0 cset "name='TX1 Digital Volume'" "$tx_hw" >/dev/null 2>&1 || true
|
|
||||||
amixer -c 0 cset "name='MultiMedia2 Mixer TERT_MI2S_TX'" 1 >/dev/null 2>&1 || true
|
|
||||||
else
|
else
|
||||||
amixer -c 0 cset "name='DEC1 MUX'" 'ZERO' >/dev/null 2>&1 || true
|
amixer -c 0 cset "name='DEC1 MUX'" 'ZERO' >/dev/null 2>&1 || true
|
||||||
amixer -c 0 cset "name='ADC1 Volume'" 0 >/dev/null 2>&1 || true
|
amixer -c 0 cset "name='ADC1 Volume'" 0 >/dev/null 2>&1 || true
|
||||||
amixer -c 0 cset "name='ADC2 Volume'" 0 >/dev/null 2>&1 || true
|
amixer -c 0 cset "name='ADC2 Volume'" 0 >/dev/null 2>&1 || true
|
||||||
amixer -c 0 cset "name='TX1 Digital Volume'" 0 >/dev/null 2>&1 || true
|
amixer -c 0 cset "name='TX1 Digital Volume'" 0 >/dev/null 2>&1 || true
|
||||||
amixer -c 0 cset "name='MultiMedia2 Mixer TERT_MI2S_TX'" 0 >/dev/null 2>&1 || true
|
amixer -c 0 cset "name='MultiMedia2 Mixer TERT_MI2S_TX'" 0 >/dev/null 2>&1 || true
|
||||||
|
amixer -c 0 cset "name='MultiMedia2 Mixer INT_BT_SCO_TX'" 0 >/dev/null 2>&1 || true
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$eff_pct" -gt 0 ]; then
|
if [ "$eff_pct" -gt 0 ]; then
|
||||||
wpctl set-mute @DEFAULT_AUDIO_SOURCE@ 0 >/dev/null 2>&1 || true
|
wpctl set-mute @DEFAULT_AUDIO_SOURCE@ 0 >/dev/null 2>&1 || true
|
||||||
if [ "$in_dev" = "Bluetooth" ]; then
|
if [ "$in_dev" = "Bluetooth" ]; then
|
||||||
|
bt_src="$(find_bt_source)"
|
||||||
|
if [ -n "$bt_src" ]; then
|
||||||
|
pactl set-source-mute "$bt_src" 0 >/dev/null 2>&1 || true
|
||||||
|
pactl set-source-volume "$bt_src" "${eff_pct}%" >/dev/null 2>&1 || true
|
||||||
|
fi
|
||||||
wpctl set-volume @DEFAULT_AUDIO_SOURCE@ "${eff_pct}%" >/dev/null 2>&1 || true
|
wpctl set-volume @DEFAULT_AUDIO_SOURCE@ "${eff_pct}%" >/dev/null 2>&1 || true
|
||||||
else
|
else
|
||||||
wpctl set-volume @DEFAULT_AUDIO_SOURCE@ 100% >/dev/null 2>&1 || true
|
wpctl set-volume @DEFAULT_AUDIO_SOURCE@ 100% >/dev/null 2>&1 || true
|
||||||
@@ -409,20 +483,62 @@ sync_pipewire_profile() {
|
|||||||
in_dev="$(normalize_in_dev "$2")"
|
in_dev="$(normalize_in_dev "$2")"
|
||||||
prof="$(profile_for_devices "$out_dev" "$in_dev")"
|
prof="$(profile_for_devices "$out_dev" "$in_dev")"
|
||||||
pactl set-card-profile alsa_card.comprC0 off >/dev/null 2>&1 || true
|
pactl set-card-profile alsa_card.comprC0 off >/dev/null 2>&1 || true
|
||||||
|
|
||||||
|
want_sco_mm=0
|
||||||
|
if [ "$out_dev" = "Bluetooth" ] && is_bt_hfp; then
|
||||||
|
start_bt_sco_keepalive
|
||||||
|
[ ! -r /tmp/sxmo_in_call ] && want_sco_mm=1
|
||||||
|
elif [ "$in_dev" = "Bluetooth" ] && is_bt_hfp; then
|
||||||
|
start_bt_sco_keepalive
|
||||||
|
[ ! -r /tmp/sxmo_in_call ] && want_sco_mm=1
|
||||||
|
elif [ ! -r /tmp/sxmo_in_call ]; then
|
||||||
|
stop_bt_sco_keepalive
|
||||||
|
fi
|
||||||
|
|
||||||
|
prev_sco_mm=0
|
||||||
|
if [ -r /tmp/sxmo_bt_sco_mm_active ]; then
|
||||||
|
read -r prev_sco_mm < /tmp/sxmo_bt_sco_mm_active 2>/dev/null || prev_sco_mm=0
|
||||||
|
fi
|
||||||
|
if [ "$want_sco_mm" != "$prev_sco_mm" ]; then
|
||||||
|
printf "%d\n" "$want_sco_mm" > /tmp/sxmo_bt_sco_mm_active 2>/dev/null || true
|
||||||
|
if [ "$want_sco_mm" = "1" ]; then
|
||||||
|
amixer -c 0 cset "name='PRI_MI2S_RX Audio Mixer MultiMedia1'" 0 >/dev/null 2>&1 || true
|
||||||
|
amixer -c 0 cset "name='INT_BT_SCO_RX Audio Mixer MultiMedia1'" 1 >/dev/null 2>&1 || true
|
||||||
|
amixer -c 0 cset "name='MultiMedia2 Mixer TERT_MI2S_TX'" 0 >/dev/null 2>&1 || true
|
||||||
|
amixer -c 0 cset "name='MultiMedia2 Mixer INT_BT_SCO_TX'" 1 >/dev/null 2>&1 || true
|
||||||
|
else
|
||||||
|
amixer -c 0 cset "name='INT_BT_SCO_RX Audio Mixer MultiMedia1'" 0 >/dev/null 2>&1 || true
|
||||||
|
amixer -c 0 cset "name='PRI_MI2S_RX Audio Mixer MultiMedia1'" 1 >/dev/null 2>&1 || true
|
||||||
|
amixer -c 0 cset "name='MultiMedia2 Mixer INT_BT_SCO_TX'" 0 >/dev/null 2>&1 || true
|
||||||
|
if [ ! -r /tmp/sxmo_in_call ]; then
|
||||||
|
amixer -c 0 cset "name='MultiMedia2 Mixer TERT_MI2S_TX'" 1 >/dev/null 2>&1 || true
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
pactl set-card-profile "$ALSA_CARD" off >/dev/null 2>&1 || true
|
||||||
|
fi
|
||||||
|
|
||||||
pactl set-card-profile "$ALSA_CARD" "$prof" >/dev/null 2>&1 || true
|
pactl set-card-profile "$ALSA_CARD" "$prof" >/dev/null 2>&1 || true
|
||||||
if [ "$out_dev" = "Bluetooth" ]; then
|
if [ "$out_dev" = "Bluetooth" ]; then
|
||||||
bt_sink="$(find_bt_sink)"
|
if [ "$want_sco_mm" = "1" ]; then
|
||||||
if [ -n "$bt_sink" ]; then
|
pactl set-default-sink "alsa_output.platform-7702000.sound.HiFi__Speaker__sink" >/dev/null 2>&1 || true
|
||||||
pactl set-default-sink "$bt_sink" >/dev/null 2>&1 || true
|
else
|
||||||
|
bt_sink="$(find_bt_sink)"
|
||||||
|
if [ -n "$bt_sink" ]; then
|
||||||
|
pactl set-default-sink "$bt_sink" >/dev/null 2>&1 || true
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
sink_name="alsa_output.platform-7702000.sound.HiFi__${out_dev}__sink"
|
sink_name="alsa_output.platform-7702000.sound.HiFi__${out_dev}__sink"
|
||||||
pactl set-default-sink "$sink_name" >/dev/null 2>&1 || true
|
pactl set-default-sink "$sink_name" >/dev/null 2>&1 || true
|
||||||
fi
|
fi
|
||||||
if [ "$in_dev" = "Bluetooth" ]; then
|
if [ "$in_dev" = "Bluetooth" ]; then
|
||||||
bt_src="$(find_bt_source)"
|
if [ "$want_sco_mm" = "1" ]; then
|
||||||
if [ -n "$bt_src" ]; then
|
pactl set-default-source "alsa_input.platform-7702000.sound.HiFi__Mic1__source" >/dev/null 2>&1 || true
|
||||||
pactl set-default-source "$bt_src" >/dev/null 2>&1 || true
|
else
|
||||||
|
bt_src="$(find_bt_source)"
|
||||||
|
if [ -n "$bt_src" ]; then
|
||||||
|
pactl set-default-source "$bt_src" >/dev/null 2>&1 || true
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
src_name="alsa_input.platform-7702000.sound.HiFi__${in_dev}__source"
|
src_name="alsa_input.platform-7702000.sound.HiFi__${in_dev}__source"
|
||||||
|
|||||||
@@ -7,30 +7,78 @@ export PATH="${XDG_CONFIG_HOME:-$HOME/.config}/sxmo/hooks:/usr/share/sxmo/defaul
|
|||||||
|
|
||||||
CFG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/sxmo"
|
CFG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/sxmo"
|
||||||
|
|
||||||
|
find_bt_card() {
|
||||||
|
pactl list short cards 2>/dev/null | awk '$2 ~ /^bluez_card\./ { print $2; exit }'
|
||||||
|
}
|
||||||
|
|
||||||
|
switch_bt_card_hfp() {
|
||||||
|
bt_card="$1"
|
||||||
|
[ -z "$bt_card" ] && return 1
|
||||||
|
pactl set-card-profile "$bt_card" headset-head-unit-cvsd >/dev/null 2>&1 || \
|
||||||
|
pactl set-card-profile "$bt_card" headset-head-unit >/dev/null 2>&1 || \
|
||||||
|
pactl set-card-profile "$bt_card" headset-head-unit-msbc >/dev/null 2>&1 || return 1
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
switch_bt_card_a2dp() {
|
||||||
|
bt_card="$1"
|
||||||
|
[ -z "$bt_card" ] && return 1
|
||||||
|
if pactl set-card-profile "$bt_card" a2dp-sink >/dev/null 2>&1; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
a2dp_prof="$(pactl list cards 2>/dev/null | awk -v c="$bt_card" '
|
||||||
|
$1 == "Name:" { in_card = ($2 == c); in_prof = 0 }
|
||||||
|
in_card && $1 == "Profiles:" { in_prof = 1; next }
|
||||||
|
in_card && in_prof && /^[[:space:]]*Active Profile:/ { in_prof = 0 }
|
||||||
|
in_card && in_prof && $1 ~ /^a2dp-sink/ && $0 !~ /available: no/ {
|
||||||
|
sub(/:$/, "", $1); print $1; exit
|
||||||
|
}
|
||||||
|
')"
|
||||||
|
if [ -n "$a2dp_prof" ]; then
|
||||||
|
pactl set-card-profile "$bt_card" "$a2dp_prof" >/dev/null 2>&1 && return 0
|
||||||
|
fi
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
enable_call_audio_mode() {
|
enable_call_audio_mode() {
|
||||||
printf "1\n" > /tmp/sxmo_in_call 2>/dev/null || true
|
printf "1\n" > /tmp/sxmo_in_call 2>/dev/null || true
|
||||||
|
|
||||||
# If wired headphones are plugged in or currently routed, keep call audio on Headphones;
|
|
||||||
# otherwise route voice call audio to Earpiece by default.
|
|
||||||
cur_out="$(sxmo_audio.sh device get 2>/dev/null || printf "Speaker")"
|
cur_out="$(sxmo_audio.sh device get 2>/dev/null || printf "Speaker")"
|
||||||
|
bt_card="$(find_bt_card)"
|
||||||
jack_plugged=0
|
jack_plugged=0
|
||||||
if [ -r /tmp/sxmo_jack_plugged ]; then
|
if [ -r /tmp/sxmo_jack_plugged ]; then
|
||||||
read -r jack_plugged < /tmp/sxmo_jack_plugged 2>/dev/null || jack_plugged=0
|
read -r jack_plugged < /tmp/sxmo_jack_plugged 2>/dev/null || jack_plugged=0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$jack_plugged" = "1" ] || [ "$cur_out" = "Headphones" ]; then
|
if [ -n "$bt_card" ]; then
|
||||||
target_out="Headphones"
|
target_out="Bluetooth"
|
||||||
|
switch_bt_card_hfp "$bt_card" || true
|
||||||
|
sxmo_audio.sh device set Bluetooth >/dev/null 2>&1 || true
|
||||||
|
sxmo_audio.sh device setinput Bluetooth >/dev/null 2>&1 || true
|
||||||
|
if command -v amixer >/dev/null 2>&1; then
|
||||||
|
amixer -c 0 cset "name='INT_BT_SCO_RX Audio Mixer MultiMedia1'" 0 >/dev/null 2>&1 || true
|
||||||
|
amixer -c 0 cset "name='MultiMedia2 Mixer INT_BT_SCO_TX'" 0 >/dev/null 2>&1 || true
|
||||||
|
amixer -c 0 cset "name='MultiMedia2 Mixer TERT_MI2S_TX'" 0 >/dev/null 2>&1 || true
|
||||||
|
amixer -c 0 cset "name='PRI_MI2S_RX Voice Mixer VoiceMMode1'" 0 >/dev/null 2>&1 || true
|
||||||
|
amixer -c 0 cset "name='VoiceMMode1 Capture Mixer TERT_MI2S_TX'" 0 >/dev/null 2>&1 || true
|
||||||
|
amixer -c 0 cset "name='INT_BT_SCO_RX Voice Mixer VoiceMMode1'" 1 >/dev/null 2>&1 || true
|
||||||
|
amixer -c 0 cset "name='VoiceMMode1 Capture Mixer INT_BT_SCO_TX'" 1 >/dev/null 2>&1 || true
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
target_out="Earpiece"
|
if [ "$jack_plugged" = "1" ] || [ "$cur_out" = "Headphones" ]; then
|
||||||
fi
|
target_out="Headphones"
|
||||||
|
else
|
||||||
sxmo_audio.sh device set "$target_out" >/dev/null 2>&1 || true
|
target_out="Earpiece"
|
||||||
|
fi
|
||||||
if command -v amixer >/dev/null 2>&1; then
|
sxmo_audio.sh device set "$target_out" >/dev/null 2>&1 || true
|
||||||
amixer -c 0 cset "name='PRI_MI2S_RX Voice Mixer VoiceMMode1'" 1 >/dev/null 2>&1 || true
|
if command -v amixer >/dev/null 2>&1; then
|
||||||
amixer -c 0 cset "name='VoiceMMode1 Capture Mixer TERT_MI2S_TX'" 1 >/dev/null 2>&1 || true
|
amixer -c 0 cset "name='INT_BT_SCO_RX Voice Mixer VoiceMMode1'" 0 >/dev/null 2>&1 || true
|
||||||
amixer -c 0 cset "name='MultiMedia2 Mixer TERT_MI2S_TX'" 0 >/dev/null 2>&1 || true
|
amixer -c 0 cset "name='VoiceMMode1 Capture Mixer INT_BT_SCO_TX'" 0 >/dev/null 2>&1 || true
|
||||||
amixer -c 0 cset "name='RX1 Mute Switch'" 0 >/dev/null 2>&1 || true
|
amixer -c 0 cset "name='PRI_MI2S_RX Voice Mixer VoiceMMode1'" 1 >/dev/null 2>&1 || true
|
||||||
|
amixer -c 0 cset "name='VoiceMMode1 Capture Mixer TERT_MI2S_TX'" 1 >/dev/null 2>&1 || true
|
||||||
|
amixer -c 0 cset "name='MultiMedia2 Mixer TERT_MI2S_TX'" 0 >/dev/null 2>&1 || true
|
||||||
|
amixer -c 0 cset "name='RX1 Mute Switch'" 0 >/dev/null 2>&1 || true
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sxmo_log "Enabled ALSA voice call audio mode ($target_out)."
|
sxmo_log "Enabled ALSA voice call audio mode ($target_out)."
|
||||||
@@ -41,24 +89,38 @@ enable_call_audio_mode() {
|
|||||||
disable_call_audio_mode() {
|
disable_call_audio_mode() {
|
||||||
rm -f /tmp/sxmo_in_call /tmp/sxmo_call_vol 2>/dev/null || true
|
rm -f /tmp/sxmo_in_call /tmp/sxmo_call_vol 2>/dev/null || true
|
||||||
|
|
||||||
|
bt_card="$(find_bt_card)"
|
||||||
jack_plugged=0
|
jack_plugged=0
|
||||||
if [ -r /tmp/sxmo_jack_plugged ]; then
|
if [ -r /tmp/sxmo_jack_plugged ]; then
|
||||||
read -r jack_plugged < /tmp/sxmo_jack_plugged 2>/dev/null || jack_plugged=0
|
read -r jack_plugged < /tmp/sxmo_jack_plugged 2>/dev/null || jack_plugged=0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$jack_plugged" = "1" ]; then
|
|
||||||
target_out="Headphones"
|
|
||||||
else
|
|
||||||
target_out="Speaker"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if command -v amixer >/dev/null 2>&1; then
|
if command -v amixer >/dev/null 2>&1; then
|
||||||
|
amixer -c 0 cset "name='INT_BT_SCO_RX Voice Mixer VoiceMMode1'" 0 >/dev/null 2>&1 || true
|
||||||
|
amixer -c 0 cset "name='VoiceMMode1 Capture Mixer INT_BT_SCO_TX'" 0 >/dev/null 2>&1 || true
|
||||||
amixer -c 0 cset "name='PRI_MI2S_RX Voice Mixer VoiceMMode1'" 0 >/dev/null 2>&1 || true
|
amixer -c 0 cset "name='PRI_MI2S_RX Voice Mixer VoiceMMode1'" 0 >/dev/null 2>&1 || true
|
||||||
amixer -c 0 cset "name='VoiceMMode1 Capture Mixer TERT_MI2S_TX'" 0 >/dev/null 2>&1 || true
|
amixer -c 0 cset "name='VoiceMMode1 Capture Mixer TERT_MI2S_TX'" 0 >/dev/null 2>&1 || true
|
||||||
|
amixer -c 0 cset "name='INT_BT_SCO_RX Audio Mixer MultiMedia1'" 0 >/dev/null 2>&1 || true
|
||||||
|
amixer -c 0 cset "name='MultiMedia2 Mixer INT_BT_SCO_TX'" 0 >/dev/null 2>&1 || true
|
||||||
|
amixer -c 0 cset "name='PRI_MI2S_RX Audio Mixer MultiMedia1'" 1 >/dev/null 2>&1 || true
|
||||||
amixer -c 0 cset "name='MultiMedia2 Mixer TERT_MI2S_TX'" 1 >/dev/null 2>&1 || true
|
amixer -c 0 cset "name='MultiMedia2 Mixer TERT_MI2S_TX'" 1 >/dev/null 2>&1 || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sxmo_audio.sh device set "$target_out" >/dev/null 2>&1 || true
|
if [ -n "$bt_card" ]; then
|
||||||
|
target_out="Bluetooth"
|
||||||
|
switch_bt_card_a2dp "$bt_card" || true
|
||||||
|
sxmo_audio.sh device setinput Mic1 >/dev/null 2>&1 || true
|
||||||
|
sxmo_audio.sh device set Bluetooth >/dev/null 2>&1 || true
|
||||||
|
else
|
||||||
|
if [ "$jack_plugged" = "1" ]; then
|
||||||
|
target_out="Headphones"
|
||||||
|
else
|
||||||
|
target_out="Speaker"
|
||||||
|
fi
|
||||||
|
sxmo_audio.sh device setinput Mic1 >/dev/null 2>&1 || true
|
||||||
|
sxmo_audio.sh device set "$target_out" >/dev/null 2>&1 || true
|
||||||
|
fi
|
||||||
|
|
||||||
sxmo_log "Disabled ALSA voice call audio mode ($target_out)."
|
sxmo_log "Disabled ALSA voice call audio mode ($target_out)."
|
||||||
sxmo_hook_statusbar.sh volume >/dev/null 2>&1 || true
|
sxmo_hook_statusbar.sh volume >/dev/null 2>&1 || true
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,623 @@
|
|||||||
|
--- a/include/dt-bindings/sound/qcom,q6dsp-lpass-ports.h
|
||||||
|
+++ b/include/dt-bindings/sound/qcom,q6dsp-lpass-ports.h
|
||||||
|
@@ -139,6 +139,8 @@
|
||||||
|
#define DISPLAY_PORT_RX_5 133
|
||||||
|
#define DISPLAY_PORT_RX_6 134
|
||||||
|
#define DISPLAY_PORT_RX_7 135
|
||||||
|
+#define INTERNAL_BT_SCO_RX 136
|
||||||
|
+#define INTERNAL_BT_SCO_TX 137
|
||||||
|
|
||||||
|
#define LPASS_CLK_ID_PRI_MI2S_IBIT 1
|
||||||
|
#define LPASS_CLK_ID_PRI_MI2S_EBIT 2
|
||||||
|
--- a/sound/soc/qcom/qdsp6/q6afe.h
|
||||||
|
+++ b/sound/soc/qcom/qdsp6/q6afe.h
|
||||||
|
@@ -3,7 +3,7 @@
|
||||||
|
#ifndef __Q6AFE_H__
|
||||||
|
#define __Q6AFE_H__
|
||||||
|
|
||||||
|
-#define AFE_PORT_MAX 129
|
||||||
|
+#define AFE_PORT_MAX 138
|
||||||
|
|
||||||
|
#define MSM_AFE_PORT_TYPE_RX 0
|
||||||
|
#define MSM_AFE_PORT_TYPE_TX 1
|
||||||
|
@@ -203,6 +203,11 @@
|
||||||
|
u16 active_channels_mask;
|
||||||
|
};
|
||||||
|
|
||||||
|
+struct q6afe_bt_fm_cfg {
|
||||||
|
+ u32 sample_rate;
|
||||||
|
+ u16 bit_width;
|
||||||
|
+ u16 num_channels;
|
||||||
|
+};
|
||||||
|
|
||||||
|
struct q6afe_port_config {
|
||||||
|
struct q6afe_hdmi_cfg hdmi;
|
||||||
|
@@ -210,6 +215,7 @@
|
||||||
|
struct q6afe_i2s_cfg i2s_cfg;
|
||||||
|
struct q6afe_tdm_cfg tdm;
|
||||||
|
struct q6afe_cdc_dma_cfg dma_cfg;
|
||||||
|
+ struct q6afe_bt_fm_cfg bt_fm_cfg;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct q6afe_port;
|
||||||
|
@@ -227,6 +233,8 @@
|
||||||
|
void q6afe_tdm_port_prepare(struct q6afe_port *port, struct q6afe_tdm_cfg *cfg);
|
||||||
|
void q6afe_cdc_dma_port_prepare(struct q6afe_port *port,
|
||||||
|
struct q6afe_cdc_dma_cfg *cfg);
|
||||||
|
+void q6afe_bt_fm_port_prepare(struct q6afe_port *port,
|
||||||
|
+ struct q6afe_bt_fm_cfg *cfg);
|
||||||
|
|
||||||
|
int q6afe_port_set_sysclk(struct q6afe_port *port, int clk_id,
|
||||||
|
int clk_src, int clk_root,
|
||||||
|
--- a/sound/soc/qcom/qdsp6/q6afe.c
|
||||||
|
+++ b/sound/soc/qcom/qdsp6/q6afe.c
|
||||||
|
@@ -44,6 +44,8 @@
|
||||||
|
#define AFE_PARAM_ID_TDM_CONFIG 0x0001029D
|
||||||
|
#define AFE_PARAM_ID_PORT_SLOT_MAPPING_CONFIG 0x00010297
|
||||||
|
#define AFE_PARAM_ID_CODEC_DMA_CONFIG 0x000102B8
|
||||||
|
+#define AFE_PARAM_ID_INTERNAL_BT_FM_CONFIG 0x00010211
|
||||||
|
+#define AFE_API_VERSION_INTERNAL_BT_FM_CONFIG 0x1
|
||||||
|
#define AFE_CMD_REMOTE_LPASS_CORE_HW_VOTE_REQUEST 0x000100f4
|
||||||
|
#define AFE_CMD_RSP_REMOTE_LPASS_CORE_HW_VOTE_REQUEST 0x000100f5
|
||||||
|
#define AFE_CMD_REMOTE_LPASS_CORE_HW_DEVOTE_REQUEST 0x000100f6
|
||||||
|
@@ -76,6 +78,8 @@
|
||||||
|
/* Port IDs */
|
||||||
|
#define AFE_API_VERSION_HDMI_CONFIG 0x1
|
||||||
|
#define AFE_PORT_ID_MULTICHAN_HDMI_RX 0x100E
|
||||||
|
+#define AFE_PORT_ID_INTERNAL_BT_SCO_RX 0x3000
|
||||||
|
+#define AFE_PORT_ID_INTERNAL_BT_SCO_TX 0x3001
|
||||||
|
#define AFE_PORT_ID_HDMI_OVER_DP_RX 0x6020
|
||||||
|
|
||||||
|
#define AFE_API_VERSION_SLIMBUS_CONFIG 0x1
|
||||||
|
@@ -513,12 +517,20 @@
|
||||||
|
u16 active_channels_mask;
|
||||||
|
} __packed;
|
||||||
|
|
||||||
|
+struct afe_param_id_internal_bt_fm_cfg {
|
||||||
|
+ u32 bt_fm_cfg_minor_version;
|
||||||
|
+ u16 num_channels;
|
||||||
|
+ u16 bit_width;
|
||||||
|
+ u32 sample_rate;
|
||||||
|
+} __packed;
|
||||||
|
+
|
||||||
|
union afe_port_config {
|
||||||
|
struct afe_param_id_hdmi_multi_chan_audio_cfg hdmi_multi_ch;
|
||||||
|
struct afe_param_id_slimbus_cfg slim_cfg;
|
||||||
|
struct afe_param_id_i2s_cfg i2s_cfg;
|
||||||
|
struct afe_param_id_tdm_cfg tdm_cfg;
|
||||||
|
struct afe_param_id_cdc_dma_cfg dma_cfg;
|
||||||
|
+ struct afe_param_id_internal_bt_fm_cfg bt_fm_cfg;
|
||||||
|
} __packed;
|
||||||
|
|
||||||
|
|
||||||
|
@@ -833,6 +845,10 @@
|
||||||
|
RX_CODEC_DMA_RX_6, 1, 1},
|
||||||
|
[RX_CODEC_DMA_RX_7] = { AFE_PORT_ID_RX_CODEC_DMA_RX_7,
|
||||||
|
RX_CODEC_DMA_RX_7, 1, 1},
|
||||||
|
+ [INTERNAL_BT_SCO_RX] = { AFE_PORT_ID_INTERNAL_BT_SCO_RX,
|
||||||
|
+ INTERNAL_BT_SCO_RX, 1, 1},
|
||||||
|
+ [INTERNAL_BT_SCO_TX] = { AFE_PORT_ID_INTERNAL_BT_SCO_TX,
|
||||||
|
+ INTERNAL_BT_SCO_TX, 0, 1},
|
||||||
|
};
|
||||||
|
|
||||||
|
static void q6afe_port_free(struct kref *ref)
|
||||||
|
@@ -1505,6 +1521,18 @@
|
||||||
|
dma_cfg->active_channels_mask = (1 << cfg->num_channels) - 1;
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(q6afe_cdc_dma_port_prepare);
|
||||||
|
+
|
||||||
|
+void q6afe_bt_fm_port_prepare(struct q6afe_port *port,
|
||||||
|
+ struct q6afe_bt_fm_cfg *cfg)
|
||||||
|
+{
|
||||||
|
+ union afe_port_config *pcfg = &port->port_cfg;
|
||||||
|
+
|
||||||
|
+ pcfg->bt_fm_cfg.bt_fm_cfg_minor_version = AFE_API_VERSION_INTERNAL_BT_FM_CONFIG;
|
||||||
|
+ pcfg->bt_fm_cfg.num_channels = cfg->num_channels;
|
||||||
|
+ pcfg->bt_fm_cfg.bit_width = cfg->bit_width;
|
||||||
|
+ pcfg->bt_fm_cfg.sample_rate = cfg->sample_rate;
|
||||||
|
+}
|
||||||
|
+EXPORT_SYMBOL_GPL(q6afe_bt_fm_port_prepare);
|
||||||
|
/**
|
||||||
|
* q6afe_port_start() - Start a afe port
|
||||||
|
*
|
||||||
|
@@ -1640,6 +1668,10 @@
|
||||||
|
case AFE_PORT_ID_WSA_CODEC_DMA_RX_0 ... AFE_PORT_ID_RX_CODEC_DMA_RX_7:
|
||||||
|
cfg_type = AFE_PARAM_ID_CODEC_DMA_CONFIG;
|
||||||
|
break;
|
||||||
|
+ case AFE_PORT_ID_INTERNAL_BT_SCO_RX:
|
||||||
|
+ case AFE_PORT_ID_INTERNAL_BT_SCO_TX:
|
||||||
|
+ cfg_type = AFE_PARAM_ID_INTERNAL_BT_FM_CONFIG;
|
||||||
|
+ break;
|
||||||
|
default:
|
||||||
|
dev_err(dev, "Invalid port id 0x%x\n", port_id);
|
||||||
|
return ERR_PTR(-EINVAL);
|
||||||
|
--- a/sound/soc/qcom/qdsp6/q6dsp-lpass-ports.h
|
||||||
|
+++ b/sound/soc/qcom/qdsp6/q6dsp-lpass-ports.h
|
||||||
|
@@ -11,6 +11,7 @@
|
||||||
|
const struct snd_soc_dai_ops *q6i2s_ops;
|
||||||
|
const struct snd_soc_dai_ops *q6tdm_ops;
|
||||||
|
const struct snd_soc_dai_ops *q6dma_ops;
|
||||||
|
+ const struct snd_soc_dai_ops *q6btfm_ops;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct snd_soc_dai_driver *q6dsp_audio_ports_set_config(struct device *dev,
|
||||||
|
--- a/sound/soc/qcom/qdsp6/q6dsp-lpass-ports.c
|
||||||
|
+++ b/sound/soc/qcom/qdsp6/q6dsp-lpass-ports.c
|
||||||
|
@@ -574,6 +574,32 @@
|
||||||
|
Q6AFE_CDC_DMA_TX_DAI(TX_CODEC_DMA_TX_5),
|
||||||
|
Q6AFE_CDC_DMA_RX_DAI(RX_CODEC_DMA_RX_6),
|
||||||
|
Q6AFE_CDC_DMA_RX_DAI(RX_CODEC_DMA_RX_7),
|
||||||
|
+ {
|
||||||
|
+ .playback = {
|
||||||
|
+ .stream_name = "Internal BT-SCO Playback",
|
||||||
|
+ .rates = SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000,
|
||||||
|
+ .formats = SNDRV_PCM_FMTBIT_S16_LE,
|
||||||
|
+ .channels_min = 1,
|
||||||
|
+ .channels_max = 1,
|
||||||
|
+ .rate_min = 8000,
|
||||||
|
+ .rate_max = 16000,
|
||||||
|
+ },
|
||||||
|
+ .name = "INT_BT_SCO_RX",
|
||||||
|
+ .id = INTERNAL_BT_SCO_RX,
|
||||||
|
+ },
|
||||||
|
+ {
|
||||||
|
+ .capture = {
|
||||||
|
+ .stream_name = "Internal BT-SCO Capture",
|
||||||
|
+ .rates = SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000,
|
||||||
|
+ .formats = SNDRV_PCM_FMTBIT_S16_LE,
|
||||||
|
+ .channels_min = 1,
|
||||||
|
+ .channels_max = 1,
|
||||||
|
+ .rate_min = 8000,
|
||||||
|
+ .rate_max = 16000,
|
||||||
|
+ },
|
||||||
|
+ .name = "INT_BT_SCO_TX",
|
||||||
|
+ .id = INTERNAL_BT_SCO_TX,
|
||||||
|
+ },
|
||||||
|
};
|
||||||
|
|
||||||
|
int q6dsp_audio_ports_of_xlate_dai_name(struct snd_soc_component *component,
|
||||||
|
@@ -624,6 +650,10 @@
|
||||||
|
case WSA_CODEC_DMA_RX_0 ... RX_CODEC_DMA_RX_7:
|
||||||
|
q6dsp_audio_fe_dais[i].ops = cfg->q6dma_ops;
|
||||||
|
break;
|
||||||
|
+ case INTERNAL_BT_SCO_RX:
|
||||||
|
+ case INTERNAL_BT_SCO_TX:
|
||||||
|
+ q6dsp_audio_fe_dais[i].ops = cfg->q6btfm_ops;
|
||||||
|
+ break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
--- a/sound/soc/qcom/qdsp6/q6afe-dai.c
|
||||||
|
+++ b/sound/soc/qcom/qdsp6/q6afe-dai.c
|
||||||
|
@@ -395,6 +395,11 @@
|
||||||
|
q6afe_cdc_dma_port_prepare(dai_data->port[dai->id],
|
||||||
|
&dai_data->port_config[dai->id].dma_cfg);
|
||||||
|
break;
|
||||||
|
+ case INTERNAL_BT_SCO_RX:
|
||||||
|
+ case INTERNAL_BT_SCO_TX:
|
||||||
|
+ q6afe_bt_fm_port_prepare(dai_data->port[dai->id],
|
||||||
|
+ &dai_data->port_config[dai->id].bt_fm_cfg);
|
||||||
|
+ break;
|
||||||
|
default:
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
@@ -692,6 +697,10 @@
|
||||||
|
{"TX_CODEC_DMA_TX_5", NULL, "TX_CODEC_DMA_TX_5 Capture"},
|
||||||
|
{"RX_CODEC_DMA_RX_6 Playback", NULL, "RX_CODEC_DMA_RX_6"},
|
||||||
|
{"RX_CODEC_DMA_RX_7 Playback", NULL, "RX_CODEC_DMA_RX_7"},
|
||||||
|
+ {"Internal BT-SCO Playback", NULL, "INT_BT_SCO_RX"},
|
||||||
|
+ {"BT_SCO_PB", NULL, "Internal BT-SCO Playback"},
|
||||||
|
+ {"INT_BT_SCO_TX", NULL, "Internal BT-SCO Capture"},
|
||||||
|
+ {"Internal BT-SCO Capture", NULL, "BT_SCO_CAP"},
|
||||||
|
};
|
||||||
|
|
||||||
|
static int msm_dai_q6_dai_probe(struct snd_soc_dai *dai)
|
||||||
|
@@ -767,6 +776,28 @@
|
||||||
|
.hw_params = q6dma_hw_params,
|
||||||
|
};
|
||||||
|
|
||||||
|
+static int q6btfm_hw_params(struct snd_pcm_substream *substream,
|
||||||
|
+ struct snd_pcm_hw_params *params,
|
||||||
|
+ struct snd_soc_dai *dai)
|
||||||
|
+{
|
||||||
|
+ struct q6afe_dai_data *dai_data = dev_get_drvdata(dai->dev);
|
||||||
|
+ struct q6afe_bt_fm_cfg *bt_fm = &dai_data->port_config[dai->id].bt_fm_cfg;
|
||||||
|
+
|
||||||
|
+ bt_fm->sample_rate = params_rate(params);
|
||||||
|
+ bt_fm->num_channels = params_channels(params);
|
||||||
|
+ bt_fm->bit_width = params_width(params);
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static const struct snd_soc_dai_ops q6btfm_ops = {
|
||||||
|
+ .probe = msm_dai_q6_dai_probe,
|
||||||
|
+ .remove = msm_dai_q6_dai_remove,
|
||||||
|
+ .prepare = q6afe_dai_prepare,
|
||||||
|
+ .hw_params = q6btfm_hw_params,
|
||||||
|
+ .shutdown = q6afe_dai_shutdown,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
static const struct snd_soc_dapm_widget q6afe_dai_widgets[] = {
|
||||||
|
SND_SOC_DAPM_AIF_IN("HDMI_RX", NULL, 0, SND_SOC_NOPM, 0, 0),
|
||||||
|
SND_SOC_DAPM_AIF_IN("SLIMBUS_0_RX", NULL, 0, SND_SOC_NOPM, 0, 0),
|
||||||
|
@@ -1017,6 +1048,10 @@
|
||||||
|
0, SND_SOC_NOPM, 0, 0),
|
||||||
|
SND_SOC_DAPM_AIF_IN("RX_CODEC_DMA_RX_7", "NULL",
|
||||||
|
0, SND_SOC_NOPM, 0, 0),
|
||||||
|
+ SND_SOC_DAPM_AIF_IN("INT_BT_SCO_RX", NULL, 0, SND_SOC_NOPM, 0, 0),
|
||||||
|
+ SND_SOC_DAPM_AIF_OUT("INT_BT_SCO_TX", NULL, 0, SND_SOC_NOPM, 0, 0),
|
||||||
|
+ SND_SOC_DAPM_OUTPUT("BT_SCO_PB"),
|
||||||
|
+ SND_SOC_DAPM_INPUT("BT_SCO_CAP"),
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct snd_soc_component_driver q6afe_dai_component = {
|
||||||
|
@@ -1131,6 +1166,7 @@
|
||||||
|
cfg.q6i2s_ops = &q6i2s_ops;
|
||||||
|
cfg.q6tdm_ops = &q6tdm_ops;
|
||||||
|
cfg.q6dma_ops = &q6dma_ops;
|
||||||
|
+ cfg.q6btfm_ops = &q6btfm_ops;
|
||||||
|
dais = q6dsp_audio_ports_set_config(dev, &cfg, &num_dais);
|
||||||
|
|
||||||
|
return devm_snd_soc_register_component(dev, &q6afe_dai_component, dais, num_dais);
|
||||||
|
--- a/sound/soc/qcom/qdsp6/q6routing.c
|
||||||
|
+++ b/sound/soc/qcom/qdsp6/q6routing.c
|
||||||
|
@@ -127,7 +127,8 @@
|
||||||
|
{ mix_name, "TX_CODEC_DMA_TX_2", "TX_CODEC_DMA_TX_2"}, \
|
||||||
|
{ mix_name, "TX_CODEC_DMA_TX_3", "TX_CODEC_DMA_TX_3"}, \
|
||||||
|
{ mix_name, "TX_CODEC_DMA_TX_4", "TX_CODEC_DMA_TX_4"}, \
|
||||||
|
- { mix_name, "TX_CODEC_DMA_TX_5", "TX_CODEC_DMA_TX_5"}
|
||||||
|
+ { mix_name, "TX_CODEC_DMA_TX_5", "TX_CODEC_DMA_TX_5"}, \
|
||||||
|
+ { mix_name, "INT_BT_SCO_TX", "INT_BT_SCO_TX"}
|
||||||
|
|
||||||
|
#define Q6ROUTING_TX_MIXERS(id) \
|
||||||
|
SOC_SINGLE_EXT("PRI_MI2S_TX", PRIMARY_MI2S_TX, \
|
||||||
|
@@ -321,6 +322,9 @@
|
||||||
|
msm_routing_put_audio_mixer), \
|
||||||
|
SOC_SINGLE_EXT("TX_CODEC_DMA_TX_5", TX_CODEC_DMA_TX_5, \
|
||||||
|
id, 1, 0, msm_routing_get_audio_mixer, \
|
||||||
|
+ msm_routing_put_audio_mixer), \
|
||||||
|
+ SOC_SINGLE_EXT("INT_BT_SCO_TX", INTERNAL_BT_SCO_TX, \
|
||||||
|
+ id, 1, 0, msm_routing_get_audio_mixer, \
|
||||||
|
msm_routing_put_audio_mixer),
|
||||||
|
|
||||||
|
struct session_data {
|
||||||
|
@@ -707,6 +711,9 @@
|
||||||
|
static const struct snd_kcontrol_new rx_codec_dma_rx_7_mixer_controls[] = {
|
||||||
|
Q6ROUTING_RX_MIXERS(RX_CODEC_DMA_RX_7) };
|
||||||
|
|
||||||
|
+static const struct snd_kcontrol_new int_bt_sco_rx_mixer_controls[] = {
|
||||||
|
+ Q6ROUTING_RX_MIXERS(INTERNAL_BT_SCO_RX) };
|
||||||
|
+
|
||||||
|
|
||||||
|
static const struct snd_kcontrol_new mmul1_mixer_controls[] = {
|
||||||
|
Q6ROUTING_TX_MIXERS(MSM_FRONTEND_DAI_MULTIMEDIA1) };
|
||||||
|
@@ -933,6 +940,9 @@
|
||||||
|
SND_SOC_DAPM_MIXER("RX_CODEC_DMA_RX_7 Audio Mixer", SND_SOC_NOPM, 0, 0,
|
||||||
|
rx_codec_dma_rx_7_mixer_controls,
|
||||||
|
ARRAY_SIZE(rx_codec_dma_rx_7_mixer_controls)),
|
||||||
|
+ SND_SOC_DAPM_MIXER("INT_BT_SCO_RX Audio Mixer", SND_SOC_NOPM, 0, 0,
|
||||||
|
+ int_bt_sco_rx_mixer_controls,
|
||||||
|
+ ARRAY_SIZE(int_bt_sco_rx_mixer_controls)),
|
||||||
|
SND_SOC_DAPM_MIXER("MultiMedia1 Mixer", SND_SOC_NOPM, 0, 0,
|
||||||
|
mmul1_mixer_controls, ARRAY_SIZE(mmul1_mixer_controls)),
|
||||||
|
SND_SOC_DAPM_MIXER("MultiMedia2 Mixer", SND_SOC_NOPM, 0, 0,
|
||||||
|
@@ -1026,6 +1036,7 @@
|
||||||
|
Q6ROUTING_RX_DAPM_ROUTE("RX_CODEC_DMA_RX_5 Audio Mixer", "RX_CODEC_DMA_RX_5"),
|
||||||
|
Q6ROUTING_RX_DAPM_ROUTE("RX_CODEC_DMA_RX_6 Audio Mixer", "RX_CODEC_DMA_RX_6"),
|
||||||
|
Q6ROUTING_RX_DAPM_ROUTE("RX_CODEC_DMA_RX_7 Audio Mixer", "RX_CODEC_DMA_RX_7"),
|
||||||
|
+ Q6ROUTING_RX_DAPM_ROUTE("INT_BT_SCO_RX Audio Mixer", "INT_BT_SCO_RX"),
|
||||||
|
Q6ROUTING_TX_DAPM_ROUTE("MultiMedia1 Mixer"),
|
||||||
|
Q6ROUTING_TX_DAPM_ROUTE("MultiMedia2 Mixer"),
|
||||||
|
Q6ROUTING_TX_DAPM_ROUTE("MultiMedia3 Mixer"),
|
||||||
|
--- a/sound/soc/qcom/qdsp6/q6voice-dai.c
|
||||||
|
+++ b/sound/soc/qcom/qdsp6/q6voice-dai.c
|
||||||
|
@@ -159,12 +159,15 @@
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (val)
|
||||||
|
+ if (val) {
|
||||||
|
+ snd_soc_dapm_mixer_update_power(dapm, kcontrol, val, NULL);
|
||||||
|
q6voice_set_port(v, path, capture, mc->reg);
|
||||||
|
- else if (q6voice_get_port(v, path, capture) == mc->reg)
|
||||||
|
- q6voice_set_port(v, path, capture, 0);
|
||||||
|
+ } else {
|
||||||
|
+ if (q6voice_get_port(v, path, capture) == mc->reg)
|
||||||
|
+ q6voice_set_port(v, path, capture, 0);
|
||||||
|
+ snd_soc_dapm_mixer_update_power(dapm, kcontrol, val, NULL);
|
||||||
|
+ }
|
||||||
|
|
||||||
|
- snd_soc_dapm_mixer_update_power(dapm, kcontrol, val, NULL);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -199,6 +202,8 @@
|
||||||
|
q6voice_get_mixer_capture, q6voice_put_mixer_capture),
|
||||||
|
SOC_SINGLE_EXT("QUIN_MI2S_TX", QUINARY_MI2S_TX, CS_VOICE, 1, 0,
|
||||||
|
q6voice_get_mixer_capture, q6voice_put_mixer_capture),
|
||||||
|
+ SOC_SINGLE_EXT("INT_BT_SCO_TX", INTERNAL_BT_SCO_TX, CS_VOICE, 1, 0,
|
||||||
|
+ q6voice_get_mixer_capture, q6voice_put_mixer_capture),
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct snd_kcontrol_new voicemmode1_tx_mixer_controls[] = {
|
||||||
|
@@ -212,6 +217,8 @@
|
||||||
|
q6voice_get_mixer_capture, q6voice_put_mixer_capture),
|
||||||
|
SOC_SINGLE_EXT("QUIN_MI2S_TX", QUINARY_MI2S_TX, VOICEMMODE1, 1, 0,
|
||||||
|
q6voice_get_mixer_capture, q6voice_put_mixer_capture),
|
||||||
|
+ SOC_SINGLE_EXT("INT_BT_SCO_TX", INTERNAL_BT_SCO_TX, VOICEMMODE1, 1, 0,
|
||||||
|
+ q6voice_get_mixer_capture, q6voice_put_mixer_capture),
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct snd_kcontrol_new primary_mi2s_rx_mixer_controls[] = {
|
||||||
|
@@ -249,6 +256,13 @@
|
||||||
|
q6voice_get_mixer_playback, q6voice_put_mixer_playback),
|
||||||
|
};
|
||||||
|
|
||||||
|
+static const struct snd_kcontrol_new int_bt_sco_rx_mixer_controls[] = {
|
||||||
|
+ SOC_SINGLE_EXT("CS-Voice", INTERNAL_BT_SCO_RX, CS_VOICE, 1, 0,
|
||||||
|
+ q6voice_get_mixer_playback, q6voice_put_mixer_playback),
|
||||||
|
+ SOC_SINGLE_EXT("VoiceMMode1", INTERNAL_BT_SCO_RX, VOICEMMODE1, 1, 0,
|
||||||
|
+ q6voice_get_mixer_playback, q6voice_put_mixer_playback),
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
static const struct snd_soc_dapm_widget q6voice_dapm_widgets[] = {
|
||||||
|
SND_SOC_DAPM_AIF_IN("CS-VOICE_DL1", "CS-VOICE Playback", 0, SND_SOC_NOPM, 0, 0),
|
||||||
|
SND_SOC_DAPM_AIF_OUT("CS-VOICE_UL1", "CS-VOICE Capture", 0, SND_SOC_NOPM, 0, 0),
|
||||||
|
@@ -275,6 +289,9 @@
|
||||||
|
SND_SOC_DAPM_MIXER("QUIN_MI2S_RX Voice Mixer", SND_SOC_NOPM, 0, 0,
|
||||||
|
quinary_mi2s_rx_mixer_controls,
|
||||||
|
ARRAY_SIZE(quinary_mi2s_rx_mixer_controls)),
|
||||||
|
+ SND_SOC_DAPM_MIXER("INT_BT_SCO_RX Voice Mixer", SND_SOC_NOPM, 0, 0,
|
||||||
|
+ int_bt_sco_rx_mixer_controls,
|
||||||
|
+ ARRAY_SIZE(int_bt_sco_rx_mixer_controls)),
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct snd_soc_dapm_route q6voice_dapm_routes[] = {
|
||||||
|
@@ -283,12 +300,14 @@
|
||||||
|
{ "CS-Voice Capture Mixer", "TERT_MI2S_TX", "TERT_MI2S_TX" },
|
||||||
|
{ "CS-Voice Capture Mixer", "QUAT_MI2S_TX", "QUAT_MI2S_TX" },
|
||||||
|
{ "CS-Voice Capture Mixer", "QUIN_MI2S_TX", "QUIN_MI2S_TX" },
|
||||||
|
+ { "CS-Voice Capture Mixer", "INT_BT_SCO_TX", "INT_BT_SCO_TX" },
|
||||||
|
{ "CS-VOICE_UL1", NULL, "CS-Voice Capture Mixer" },
|
||||||
|
{ "VoiceMMode1 Capture Mixer", "PRI_MI2S_TX", "PRI_MI2S_TX" },
|
||||||
|
{ "VoiceMMode1 Capture Mixer", "SEC_MI2S_TX", "SEC_MI2S_TX" },
|
||||||
|
{ "VoiceMMode1 Capture Mixer", "TERT_MI2S_TX", "TERT_MI2S_TX" },
|
||||||
|
{ "VoiceMMode1 Capture Mixer", "QUAT_MI2S_TX", "QUAT_MI2S_TX" },
|
||||||
|
{ "VoiceMMode1 Capture Mixer", "QUIN_MI2S_TX", "QUIN_MI2S_TX" },
|
||||||
|
+ { "VoiceMMode1 Capture Mixer", "INT_BT_SCO_TX", "INT_BT_SCO_TX" },
|
||||||
|
{ "VOICEMMODE1_UL1", NULL, "VoiceMMode1 Capture Mixer" },
|
||||||
|
|
||||||
|
{ "PRI_MI2S_RX Voice Mixer", "CS-Voice", "CS-VOICE_DL1" },
|
||||||
|
@@ -296,17 +315,20 @@
|
||||||
|
{ "TERT_MI2S_RX Voice Mixer", "CS-Voice", "CS-VOICE_DL1" },
|
||||||
|
{ "QUAT_MI2S_RX Voice Mixer", "CS-Voice", "CS-VOICE_DL1" },
|
||||||
|
{ "QUIN_MI2S_RX Voice Mixer", "CS-Voice", "CS-VOICE_DL1" },
|
||||||
|
+ { "INT_BT_SCO_RX Voice Mixer", "CS-Voice", "CS-VOICE_DL1" },
|
||||||
|
{ "PRI_MI2S_RX Voice Mixer", "VoiceMMode1", "VOICEMMODE1_DL1" },
|
||||||
|
{ "SEC_MI2S_RX Voice Mixer", "VoiceMMode1", "VOICEMMODE1_DL1" },
|
||||||
|
{ "TERT_MI2S_RX Voice Mixer", "VoiceMMode1", "VOICEMMODE1_DL1" },
|
||||||
|
{ "QUAT_MI2S_RX Voice Mixer", "VoiceMMode1", "VOICEMMODE1_DL1" },
|
||||||
|
{ "QUIN_MI2S_RX Voice Mixer", "VoiceMMode1", "VOICEMMODE1_DL1" },
|
||||||
|
+ { "INT_BT_SCO_RX Voice Mixer", "VoiceMMode1", "VOICEMMODE1_DL1" },
|
||||||
|
|
||||||
|
{ "PRI_MI2S_RX", NULL, "PRI_MI2S_RX Voice Mixer" },
|
||||||
|
{ "SEC_MI2S_RX", NULL, "SEC_MI2S_RX Voice Mixer" },
|
||||||
|
{ "TERT_MI2S_RX", NULL, "TERT_MI2S_RX Voice Mixer" },
|
||||||
|
{ "QUAT_MI2S_RX", NULL, "QUAT_MI2S_RX Voice Mixer" },
|
||||||
|
{ "QUIN_MI2S_RX", NULL, "QUIN_MI2S_RX Voice Mixer" },
|
||||||
|
+ { "INT_BT_SCO_RX", NULL, "INT_BT_SCO_RX Voice Mixer" },
|
||||||
|
};
|
||||||
|
|
||||||
|
static unsigned int q6voice_reg_read(struct snd_soc_component *component,
|
||||||
|
--- a/sound/soc/qcom/qdsp6/q6voice.c
|
||||||
|
+++ b/sound/soc/qcom/qdsp6/q6voice.c
|
||||||
|
@@ -252,11 +252,25 @@
|
||||||
|
bool capture, int index)
|
||||||
|
{
|
||||||
|
struct q6voice_path *p = &v->paths[path];
|
||||||
|
+ int old_port;
|
||||||
|
|
||||||
|
+ mutex_lock(&p->lock);
|
||||||
|
+ old_port = capture ? p->tx_port : p->rx_port;
|
||||||
|
if (capture)
|
||||||
|
p->tx_port = index;
|
||||||
|
else
|
||||||
|
p->rx_port = index;
|
||||||
|
+
|
||||||
|
+ if (old_port != index && p->runtime && p->runtime->started == 3) {
|
||||||
|
+ if (p->runtime->sessions[Q6VOICE_SERVICE_CVP]) {
|
||||||
|
+ q6voice_path_stop(p);
|
||||||
|
+ q6voice_session_release(p->runtime->sessions[Q6VOICE_SERVICE_CVP]);
|
||||||
|
+ p->runtime->sessions[Q6VOICE_SERVICE_CVP] = NULL;
|
||||||
|
+ }
|
||||||
|
+ if (p->tx_port > 0 && p->rx_port > 0)
|
||||||
|
+ q6voice_path_start(p);
|
||||||
|
+ }
|
||||||
|
+ mutex_unlock(&p->lock);
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(q6voice_set_port);
|
||||||
|
|
||||||
|
--- a/sound/soc/qcom/common.c
|
||||||
|
+++ b/sound/soc/qcom/common.c
|
||||||
|
@@ -146,6 +146,12 @@
|
||||||
|
link->no_pcm = 1;
|
||||||
|
link->ignore_pmdown_time = 1;
|
||||||
|
}
|
||||||
|
+ } else if (platform) {
|
||||||
|
+ /* DPCM backend with dummy codec (e.g. Internal BT-SCO) */
|
||||||
|
+ link->codecs = &snd_soc_dummy_dlc;
|
||||||
|
+ link->num_codecs = 1;
|
||||||
|
+ link->no_pcm = 1;
|
||||||
|
+ link->ignore_pmdown_time = 1;
|
||||||
|
} else {
|
||||||
|
/* DPCM frontend */
|
||||||
|
link->codecs = &snd_soc_dummy_dlc;
|
||||||
|
--- a/sound/soc/qcom/apq8016_sbc.c
|
||||||
|
+++ b/sound/soc/qcom/apq8016_sbc.c
|
||||||
|
@@ -186,6 +186,10 @@
|
||||||
|
{
|
||||||
|
struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
|
||||||
|
|
||||||
|
+ if (cpu_dai->id == INTERNAL_BT_SCO_RX ||
|
||||||
|
+ cpu_dai->id == INTERNAL_BT_SCO_TX)
|
||||||
|
+ return 0;
|
||||||
|
+
|
||||||
|
snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_BP_FP);
|
||||||
|
return apq8016_dai_init(rtd, qdsp6_dai_get_lpass_id(cpu_dai));
|
||||||
|
}
|
||||||
|
@@ -198,6 +202,10 @@
|
||||||
|
struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
|
||||||
|
int mi2s, ret;
|
||||||
|
|
||||||
|
+ if (cpu_dai->id == INTERNAL_BT_SCO_RX ||
|
||||||
|
+ cpu_dai->id == INTERNAL_BT_SCO_TX)
|
||||||
|
+ return 0;
|
||||||
|
+
|
||||||
|
mi2s = qdsp6_dai_get_lpass_id(cpu_dai);
|
||||||
|
if (mi2s < 0)
|
||||||
|
return mi2s;
|
||||||
|
@@ -219,6 +227,10 @@
|
||||||
|
struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
|
||||||
|
int mi2s, ret;
|
||||||
|
|
||||||
|
+ if (cpu_dai->id == INTERNAL_BT_SCO_RX ||
|
||||||
|
+ cpu_dai->id == INTERNAL_BT_SCO_TX)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
mi2s = qdsp6_dai_get_lpass_id(cpu_dai);
|
||||||
|
if (mi2s < 0)
|
||||||
|
return;
|
||||||
|
@@ -239,14 +251,21 @@
|
||||||
|
static int msm8916_qdsp6_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
|
||||||
|
struct snd_pcm_hw_params *params)
|
||||||
|
{
|
||||||
|
+ struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
|
||||||
|
struct snd_interval *rate = hw_param_interval(params,
|
||||||
|
SNDRV_PCM_HW_PARAM_RATE);
|
||||||
|
struct snd_interval *channels = hw_param_interval(params,
|
||||||
|
SNDRV_PCM_HW_PARAM_CHANNELS);
|
||||||
|
struct snd_mask *fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
|
||||||
|
|
||||||
|
- rate->min = rate->max = 48000;
|
||||||
|
- channels->min = channels->max = 2;
|
||||||
|
+ if (cpu_dai->id == INTERNAL_BT_SCO_RX ||
|
||||||
|
+ cpu_dai->id == INTERNAL_BT_SCO_TX) {
|
||||||
|
+ rate->min = rate->max = 8000;
|
||||||
|
+ channels->min = channels->max = 1;
|
||||||
|
+ } else {
|
||||||
|
+ rate->min = rate->max = 48000;
|
||||||
|
+ channels->min = channels->max = 2;
|
||||||
|
+ }
|
||||||
|
snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S16_LE);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
--- a/drivers/bluetooth/btqcomsmd.c
|
||||||
|
+++ b/drivers/bluetooth/btqcomsmd.c
|
||||||
|
@@ -84,6 +84,11 @@
|
||||||
|
hdev->stat.cmd_tx++;
|
||||||
|
hdev->stat.byte_tx += skb->len;
|
||||||
|
break;
|
||||||
|
+ case HCI_SCODATA_PKT:
|
||||||
|
+ ret = 0;
|
||||||
|
+ hdev->stat.sco_tx++;
|
||||||
|
+ hdev->stat.byte_tx += skb->len;
|
||||||
|
+ break;
|
||||||
|
default:
|
||||||
|
ret = -EILSEQ;
|
||||||
|
break;
|
||||||
|
--- a/arch/arm/boot/dts/qcom/qcom-msm8905-nokia-argon.dts
|
||||||
|
+++ b/arch/arm/boot/dts/qcom/qcom-msm8905-nokia-argon.dts
|
||||||
|
@@ -208,8 +208,8 @@
|
||||||
|
};
|
||||||
|
|
||||||
|
&pm8909_charger {
|
||||||
|
- qcom,fast-charge-safe-current = <360000>;
|
||||||
|
- qcom,fast-charge-safe-voltage = <4350000>;
|
||||||
|
+ qcom,fast-charge-safe-current = <540000>;
|
||||||
|
+ qcom,fast-charge-safe-voltage = <4375000>;
|
||||||
|
|
||||||
|
monitored-battery = <&bat>;
|
||||||
|
|
||||||
|
@@ -240,6 +240,12 @@
|
||||||
|
reg = <TERTIARY_MI2S_TX>;
|
||||||
|
qcom,sd-lines = <0 1>;
|
||||||
|
};
|
||||||
|
+ dai@136 {
|
||||||
|
+ reg = <INTERNAL_BT_SCO_RX>;
|
||||||
|
+ };
|
||||||
|
+ dai@137 {
|
||||||
|
+ reg = <INTERNAL_BT_SCO_TX>;
|
||||||
|
+ };
|
||||||
|
};
|
||||||
|
|
||||||
|
&q6asmdai {
|
||||||
|
@@ -364,6 +370,26 @@
|
||||||
|
};
|
||||||
|
platform {
|
||||||
|
sound-dai = <&q6routing>;
|
||||||
|
+ };
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ dai-link-bt-sco-rx {
|
||||||
|
+ link-name = "Internal BT-SCO RX";
|
||||||
|
+ cpu {
|
||||||
|
+ sound-dai = <&q6afedai INTERNAL_BT_SCO_RX>;
|
||||||
|
+ };
|
||||||
|
+ platform {
|
||||||
|
+ sound-dai = <&q6routing>;
|
||||||
|
+ };
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ dai-link-bt-sco-tx {
|
||||||
|
+ link-name = "Internal BT-SCO TX";
|
||||||
|
+ cpu {
|
||||||
|
+ sound-dai = <&q6afedai INTERNAL_BT_SCO_TX>;
|
||||||
|
+ };
|
||||||
|
+ platform {
|
||||||
|
+ sound-dai = <&q6routing>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
--- a/arch/arm/boot/dts/qcom/qcom-msm8909-nokia-leo-common.dtsi
|
||||||
|
+++ b/arch/arm/boot/dts/qcom/qcom-msm8909-nokia-leo-common.dtsi
|
||||||
|
@@ -202,6 +202,12 @@
|
||||||
|
reg = <TERTIARY_MI2S_TX>;
|
||||||
|
qcom,sd-lines = <0 1>;
|
||||||
|
};
|
||||||
|
+ dai@136 {
|
||||||
|
+ reg = <INTERNAL_BT_SCO_RX>;
|
||||||
|
+ };
|
||||||
|
+ dai@137 {
|
||||||
|
+ reg = <INTERNAL_BT_SCO_TX>;
|
||||||
|
+ };
|
||||||
|
};
|
||||||
|
|
||||||
|
&q6asmdai {
|
||||||
|
@@ -326,6 +332,26 @@
|
||||||
|
};
|
||||||
|
platform {
|
||||||
|
sound-dai = <&q6routing>;
|
||||||
|
+ };
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ dai-link-bt-sco-rx {
|
||||||
|
+ link-name = "Internal BT-SCO RX";
|
||||||
|
+ cpu {
|
||||||
|
+ sound-dai = <&q6afedai INTERNAL_BT_SCO_RX>;
|
||||||
|
+ };
|
||||||
|
+ platform {
|
||||||
|
+ sound-dai = <&q6routing>;
|
||||||
|
+ };
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ dai-link-bt-sco-tx {
|
||||||
|
+ link-name = "Internal BT-SCO TX";
|
||||||
|
+ cpu {
|
||||||
|
+ sound-dai = <&q6afedai INTERNAL_BT_SCO_TX>;
|
||||||
|
+ };
|
||||||
|
+ platform {
|
||||||
|
+ sound-dai = <&q6routing>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -131,9 +131,22 @@ chmod 4755 "$TARGET_ROOTFS/usr/bin/sudo" "$TARGET_ROOTFS/usr/bin/doas" "$TARGET_
|
|||||||
|
|
||||||
echo "[2/4] Installing prebuilt QDSP6/Q6Voice kernel modules, Adreno 304 DRM module, torch LED module, camera module, and DTBs..."
|
echo "[2/4] Installing prebuilt QDSP6/Q6Voice kernel modules, Adreno 304 DRM module, torch LED module, camera module, and DTBs..."
|
||||||
if [ -d "$TARGET_ROOTFS/lib/modules/6.12.1-msm8916/kernel/sound/soc/qcom/qdsp6" ]; then
|
if [ -d "$TARGET_ROOTFS/lib/modules/6.12.1-msm8916/kernel/sound/soc/qcom/qdsp6" ]; then
|
||||||
cp -af "$BASE_DIR/prebuilt/kernel-6.12.1-msm8916/qdsp6/"*.ko* \
|
rm -f "$TARGET_ROOTFS/lib/modules/6.12.1-msm8916/kernel/sound/soc/qcom/qdsp6/"*.ko
|
||||||
|
cp -af "$BASE_DIR/prebuilt/kernel-6.12.1-msm8916/qdsp6/"*.ko.zst \
|
||||||
"$TARGET_ROOTFS/lib/modules/6.12.1-msm8916/kernel/sound/soc/qcom/qdsp6/"
|
"$TARGET_ROOTFS/lib/modules/6.12.1-msm8916/kernel/sound/soc/qcom/qdsp6/"
|
||||||
fi
|
fi
|
||||||
|
if [ -d "$BASE_DIR/prebuilt/kernel-6.12.1-msm8916/qcom" ] && \
|
||||||
|
[ -d "$TARGET_ROOTFS/lib/modules/6.12.1-msm8916/kernel/sound/soc/qcom" ]; then
|
||||||
|
rm -f "$TARGET_ROOTFS/lib/modules/6.12.1-msm8916/kernel/sound/soc/qcom/"*.ko
|
||||||
|
cp -af "$BASE_DIR/prebuilt/kernel-6.12.1-msm8916/qcom/"*.ko.zst \
|
||||||
|
"$TARGET_ROOTFS/lib/modules/6.12.1-msm8916/kernel/sound/soc/qcom/"
|
||||||
|
fi
|
||||||
|
if [ -d "$BASE_DIR/prebuilt/kernel-6.12.1-msm8916/bluetooth" ] && \
|
||||||
|
[ -d "$TARGET_ROOTFS/lib/modules/6.12.1-msm8916/kernel/drivers/bluetooth" ]; then
|
||||||
|
rm -f "$TARGET_ROOTFS/lib/modules/6.12.1-msm8916/kernel/drivers/bluetooth/btqcomsmd.ko"
|
||||||
|
cp -af "$BASE_DIR/prebuilt/kernel-6.12.1-msm8916/bluetooth/"*.ko.zst \
|
||||||
|
"$TARGET_ROOTFS/lib/modules/6.12.1-msm8916/kernel/drivers/bluetooth/"
|
||||||
|
fi
|
||||||
if [ -d "$BASE_DIR/prebuilt/kernel-6.12.1-msm8916/drm" ] && \
|
if [ -d "$BASE_DIR/prebuilt/kernel-6.12.1-msm8916/drm" ] && \
|
||||||
[ -d "$TARGET_ROOTFS/lib/modules/6.12.1-msm8916/kernel/drivers/gpu/drm/msm" ]; then
|
[ -d "$TARGET_ROOTFS/lib/modules/6.12.1-msm8916/kernel/drivers/gpu/drm/msm" ]; then
|
||||||
rm -f "$TARGET_ROOTFS/lib/modules/6.12.1-msm8916/kernel/drivers/gpu/drm/msm/msm.ko"
|
rm -f "$TARGET_ROOTFS/lib/modules/6.12.1-msm8916/kernel/drivers/gpu/drm/msm/msm.ko"
|
||||||
|
|||||||
@@ -70,6 +70,10 @@ EOF
|
|||||||
echo "[2c/5] Applying MSM8909 LBC/BMS-VM/WCN36xx/WCD-digital power management patch..."
|
echo "[2c/5] Applying MSM8909 LBC/BMS-VM/WCN36xx/WCD-digital power management patch..."
|
||||||
patch -p1 < /bananarchy/patches/kernel/0004-msm8909-power-battery-wifi-audio-pm.patch
|
patch -p1 < /bananarchy/patches/kernel/0004-msm8909-power-battery-wifi-audio-pm.patch
|
||||||
fi
|
fi
|
||||||
|
if ! grep -q "INTERNAL_BT_SCO_RX" include/dt-bindings/sound/qcom,q6dsp-lpass-ports.h 2>/dev/null; then
|
||||||
|
echo "[2d/5] Applying QDSP6 Internal BT-SCO and btqcomsmd SCO patch..."
|
||||||
|
patch -p1 < /bananarchy/patches/kernel/0005-msm8909-qdsp6-bt-sco-support.patch
|
||||||
|
fi
|
||||||
if [ ! -f include/config/auto.conf ] || ! grep -q "CONFIG_NETFILTER_XT_MATCH_OWNER=m" .config 2>/dev/null; then
|
if [ ! -f include/config/auto.conf ] || ! grep -q "CONFIG_NETFILTER_XT_MATCH_OWNER=m" .config 2>/dev/null; then
|
||||||
echo "[3/5] Preparing kernel configuration..."
|
echo "[3/5] Preparing kernel configuration..."
|
||||||
cp /bananarchy/patches/kernel/config-bananarchy-msm8909.armv7 .config
|
cp /bananarchy/patches/kernel/config-bananarchy-msm8909.armv7 .config
|
||||||
@@ -95,6 +99,7 @@ EOF
|
|||||||
patch -p1 < /bananarchy/patches/kernel/0001-msm8909-qdsp6-voice-sound-nokia-argon-6.12.patch
|
patch -p1 < /bananarchy/patches/kernel/0001-msm8909-qdsp6-voice-sound-nokia-argon-6.12.patch
|
||||||
patch -p1 < /bananarchy/patches/kernel/0003-msm8909-adreno-304-gpu-support.patch
|
patch -p1 < /bananarchy/patches/kernel/0003-msm8909-adreno-304-gpu-support.patch
|
||||||
patch -p1 < /bananarchy/patches/kernel/0004-msm8909-power-battery-wifi-audio-pm.patch
|
patch -p1 < /bananarchy/patches/kernel/0004-msm8909-power-battery-wifi-audio-pm.patch
|
||||||
|
patch -p1 < /bananarchy/patches/kernel/0005-msm8909-qdsp6-bt-sco-support.patch
|
||||||
|
|
||||||
echo "[3/5] Preparing kernel configuration and Module.symvers..."
|
echo "[3/5] Preparing kernel configuration and Module.symvers..."
|
||||||
cp /bananarchy/patches/kernel/config-bananarchy-msm8909.armv7 .config
|
cp /bananarchy/patches/kernel/config-bananarchy-msm8909.armv7 .config
|
||||||
@@ -102,11 +107,13 @@ EOF
|
|||||||
make ARCH=arm CROSS_COMPILE=armv7-alpine-linux-musleabihf- modules_prepare
|
make ARCH=arm CROSS_COMPILE=armv7-alpine-linux-musleabihf- modules_prepare
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "[4/5] Building QDSP6/Q6Voice sound modules, Adreno 304 DRM module, power/WiFi/codec PM modules, torch LED module, camera module, and Nokia MSM8905/MSM8909 DTBs..."
|
echo "[4/5] Building QDSP6/Q6Voice sound modules, Adreno 304 DRM module, power/WiFi/codec PM modules, Bluetooth SMD module, torch LED module, camera module, and Nokia MSM8905/MSM8909 DTBs..."
|
||||||
make ARCH=arm CROSS_COMPILE=armv7-alpine-linux-musleabihf- -j"$(nproc)" \
|
make ARCH=arm CROSS_COMPILE=armv7-alpine-linux-musleabihf- -j"$(nproc)" \
|
||||||
KBUILD_MODPOST_WARN=1 M=sound/soc/qcom/qdsp6 modules
|
KBUILD_MODPOST_WARN=1 M=sound/soc/qcom modules
|
||||||
make ARCH=arm CROSS_COMPILE=armv7-alpine-linux-musleabihf- -j"$(nproc)" \
|
make ARCH=arm CROSS_COMPILE=armv7-alpine-linux-musleabihf- -j"$(nproc)" \
|
||||||
KBUILD_MODPOST_WARN=1 M=sound/soc/codecs modules
|
KBUILD_MODPOST_WARN=1 M=sound/soc/codecs modules
|
||||||
|
make ARCH=arm CROSS_COMPILE=armv7-alpine-linux-musleabihf- -j"$(nproc)" \
|
||||||
|
KBUILD_MODPOST_WARN=1 M=drivers/bluetooth modules
|
||||||
make ARCH=arm CROSS_COMPILE=armv7-alpine-linux-musleabihf- -j"$(nproc)" \
|
make ARCH=arm CROSS_COMPILE=armv7-alpine-linux-musleabihf- -j"$(nproc)" \
|
||||||
KBUILD_MODPOST_WARN=1 M=drivers/power/supply modules
|
KBUILD_MODPOST_WARN=1 M=drivers/power/supply modules
|
||||||
make ARCH=arm CROSS_COMPILE=armv7-alpine-linux-musleabihf- -j"$(nproc)" \
|
make ARCH=arm CROSS_COMPILE=armv7-alpine-linux-musleabihf- -j"$(nproc)" \
|
||||||
@@ -126,7 +133,9 @@ EOF
|
|||||||
|
|
||||||
echo "[5/5] Exporting built modules and DTBs to prebuilt/kernel-6.12.1-msm8916..."
|
echo "[5/5] Exporting built modules and DTBs to prebuilt/kernel-6.12.1-msm8916..."
|
||||||
mkdir -p /bananarchy/prebuilt/kernel-6.12.1-msm8916/qdsp6 \
|
mkdir -p /bananarchy/prebuilt/kernel-6.12.1-msm8916/qdsp6 \
|
||||||
|
/bananarchy/prebuilt/kernel-6.12.1-msm8916/qcom \
|
||||||
/bananarchy/prebuilt/kernel-6.12.1-msm8916/codecs \
|
/bananarchy/prebuilt/kernel-6.12.1-msm8916/codecs \
|
||||||
|
/bananarchy/prebuilt/kernel-6.12.1-msm8916/bluetooth \
|
||||||
/bananarchy/prebuilt/kernel-6.12.1-msm8916/power \
|
/bananarchy/prebuilt/kernel-6.12.1-msm8916/power \
|
||||||
/bananarchy/prebuilt/kernel-6.12.1-msm8916/wcn36xx \
|
/bananarchy/prebuilt/kernel-6.12.1-msm8916/wcn36xx \
|
||||||
/bananarchy/prebuilt/kernel-6.12.1-msm8916/drm \
|
/bananarchy/prebuilt/kernel-6.12.1-msm8916/drm \
|
||||||
@@ -135,8 +144,12 @@ EOF
|
|||||||
/bananarchy/prebuilt/kernel-6.12.1-msm8916/camera \
|
/bananarchy/prebuilt/kernel-6.12.1-msm8916/camera \
|
||||||
/bananarchy/prebuilt/kernel-6.12.1-msm8916/dtbs
|
/bananarchy/prebuilt/kernel-6.12.1-msm8916/dtbs
|
||||||
cp -a sound/soc/qcom/qdsp6/*.ko /bananarchy/prebuilt/kernel-6.12.1-msm8916/qdsp6/
|
cp -a sound/soc/qcom/qdsp6/*.ko /bananarchy/prebuilt/kernel-6.12.1-msm8916/qdsp6/
|
||||||
|
cp -a sound/soc/qcom/snd-soc-qcom-common.ko sound/soc/qcom/snd-soc-apq8016-sbc.ko \
|
||||||
|
/bananarchy/prebuilt/kernel-6.12.1-msm8916/qcom/
|
||||||
cp -a sound/soc/codecs/snd-soc-msm8916-digital.ko \
|
cp -a sound/soc/codecs/snd-soc-msm8916-digital.ko \
|
||||||
/bananarchy/prebuilt/kernel-6.12.1-msm8916/codecs/
|
/bananarchy/prebuilt/kernel-6.12.1-msm8916/codecs/
|
||||||
|
cp -a drivers/bluetooth/btqcomsmd.ko \
|
||||||
|
/bananarchy/prebuilt/kernel-6.12.1-msm8916/bluetooth/
|
||||||
cp -a drivers/power/supply/pm8916_lbc.ko drivers/power/supply/pm8916_bms_vm.ko \
|
cp -a drivers/power/supply/pm8916_lbc.ko drivers/power/supply/pm8916_bms_vm.ko \
|
||||||
/bananarchy/prebuilt/kernel-6.12.1-msm8916/power/
|
/bananarchy/prebuilt/kernel-6.12.1-msm8916/power/
|
||||||
cp -a drivers/net/wireless/ath/wcn36xx/wcn36xx.ko \
|
cp -a drivers/net/wireless/ath/wcn36xx/wcn36xx.ko \
|
||||||
@@ -150,7 +163,9 @@ EOF
|
|||||||
/bananarchy/prebuilt/kernel-6.12.1-msm8916/camera/
|
/bananarchy/prebuilt/kernel-6.12.1-msm8916/camera/
|
||||||
armv7-alpine-linux-musleabihf-strip --strip-unneeded \
|
armv7-alpine-linux-musleabihf-strip --strip-unneeded \
|
||||||
/bananarchy/prebuilt/kernel-6.12.1-msm8916/qdsp6/*.ko \
|
/bananarchy/prebuilt/kernel-6.12.1-msm8916/qdsp6/*.ko \
|
||||||
|
/bananarchy/prebuilt/kernel-6.12.1-msm8916/qcom/*.ko \
|
||||||
/bananarchy/prebuilt/kernel-6.12.1-msm8916/codecs/*.ko \
|
/bananarchy/prebuilt/kernel-6.12.1-msm8916/codecs/*.ko \
|
||||||
|
/bananarchy/prebuilt/kernel-6.12.1-msm8916/bluetooth/*.ko \
|
||||||
/bananarchy/prebuilt/kernel-6.12.1-msm8916/power/*.ko \
|
/bananarchy/prebuilt/kernel-6.12.1-msm8916/power/*.ko \
|
||||||
/bananarchy/prebuilt/kernel-6.12.1-msm8916/wcn36xx/*.ko \
|
/bananarchy/prebuilt/kernel-6.12.1-msm8916/wcn36xx/*.ko \
|
||||||
/bananarchy/prebuilt/kernel-6.12.1-msm8916/drm/*.ko \
|
/bananarchy/prebuilt/kernel-6.12.1-msm8916/drm/*.ko \
|
||||||
@@ -159,7 +174,9 @@ EOF
|
|||||||
/bananarchy/prebuilt/kernel-6.12.1-msm8916/camera/*.ko
|
/bananarchy/prebuilt/kernel-6.12.1-msm8916/camera/*.ko
|
||||||
for ko in \
|
for ko in \
|
||||||
/bananarchy/prebuilt/kernel-6.12.1-msm8916/qdsp6/*.ko \
|
/bananarchy/prebuilt/kernel-6.12.1-msm8916/qdsp6/*.ko \
|
||||||
|
/bananarchy/prebuilt/kernel-6.12.1-msm8916/qcom/*.ko \
|
||||||
/bananarchy/prebuilt/kernel-6.12.1-msm8916/codecs/*.ko \
|
/bananarchy/prebuilt/kernel-6.12.1-msm8916/codecs/*.ko \
|
||||||
|
/bananarchy/prebuilt/kernel-6.12.1-msm8916/bluetooth/*.ko \
|
||||||
/bananarchy/prebuilt/kernel-6.12.1-msm8916/power/*.ko \
|
/bananarchy/prebuilt/kernel-6.12.1-msm8916/power/*.ko \
|
||||||
/bananarchy/prebuilt/kernel-6.12.1-msm8916/wcn36xx/*.ko \
|
/bananarchy/prebuilt/kernel-6.12.1-msm8916/wcn36xx/*.ko \
|
||||||
/bananarchy/prebuilt/kernel-6.12.1-msm8916/drm/*.ko \
|
/bananarchy/prebuilt/kernel-6.12.1-msm8916/drm/*.ko \
|
||||||
@@ -168,11 +185,19 @@ EOF
|
|||||||
/bananarchy/prebuilt/kernel-6.12.1-msm8916/camera/*.ko; do
|
/bananarchy/prebuilt/kernel-6.12.1-msm8916/camera/*.ko; do
|
||||||
zstd -f -q -k "$ko" -o "${ko}.zst"
|
zstd -f -q -k "$ko" -o "${ko}.zst"
|
||||||
done
|
done
|
||||||
mkdir -p /bananarchy/overlay/rootfs/lib/modules/6.12.1-msm8916/kernel/sound/soc/codecs \
|
mkdir -p /bananarchy/overlay/rootfs/lib/modules/6.12.1-msm8916/kernel/sound/soc/qcom/qdsp6 \
|
||||||
|
/bananarchy/overlay/rootfs/lib/modules/6.12.1-msm8916/kernel/sound/soc/codecs \
|
||||||
|
/bananarchy/overlay/rootfs/lib/modules/6.12.1-msm8916/kernel/drivers/bluetooth \
|
||||||
/bananarchy/overlay/rootfs/lib/modules/6.12.1-msm8916/kernel/drivers/power/supply \
|
/bananarchy/overlay/rootfs/lib/modules/6.12.1-msm8916/kernel/drivers/power/supply \
|
||||||
/bananarchy/overlay/rootfs/lib/modules/6.12.1-msm8916/kernel/drivers/net/wireless/ath/wcn36xx
|
/bananarchy/overlay/rootfs/lib/modules/6.12.1-msm8916/kernel/drivers/net/wireless/ath/wcn36xx
|
||||||
|
cp -a /bananarchy/prebuilt/kernel-6.12.1-msm8916/qdsp6/*.ko.zst \
|
||||||
|
/bananarchy/overlay/rootfs/lib/modules/6.12.1-msm8916/kernel/sound/soc/qcom/qdsp6/
|
||||||
|
cp -a /bananarchy/prebuilt/kernel-6.12.1-msm8916/qcom/*.ko.zst \
|
||||||
|
/bananarchy/overlay/rootfs/lib/modules/6.12.1-msm8916/kernel/sound/soc/qcom/
|
||||||
cp -a /bananarchy/prebuilt/kernel-6.12.1-msm8916/codecs/*.ko.zst \
|
cp -a /bananarchy/prebuilt/kernel-6.12.1-msm8916/codecs/*.ko.zst \
|
||||||
/bananarchy/overlay/rootfs/lib/modules/6.12.1-msm8916/kernel/sound/soc/codecs/
|
/bananarchy/overlay/rootfs/lib/modules/6.12.1-msm8916/kernel/sound/soc/codecs/
|
||||||
|
cp -a /bananarchy/prebuilt/kernel-6.12.1-msm8916/bluetooth/*.ko.zst \
|
||||||
|
/bananarchy/overlay/rootfs/lib/modules/6.12.1-msm8916/kernel/drivers/bluetooth/
|
||||||
cp -a /bananarchy/prebuilt/kernel-6.12.1-msm8916/power/*.ko.zst \
|
cp -a /bananarchy/prebuilt/kernel-6.12.1-msm8916/power/*.ko.zst \
|
||||||
/bananarchy/overlay/rootfs/lib/modules/6.12.1-msm8916/kernel/drivers/power/supply/
|
/bananarchy/overlay/rootfs/lib/modules/6.12.1-msm8916/kernel/drivers/power/supply/
|
||||||
cp -a /bananarchy/prebuilt/kernel-6.12.1-msm8916/wcn36xx/*.ko.zst \
|
cp -a /bananarchy/prebuilt/kernel-6.12.1-msm8916/wcn36xx/*.ko.zst \
|
||||||
|
|||||||
@@ -447,9 +447,25 @@ int callscreen_run_main(int argc, char** argv) {
|
|||||||
bool ringMuted = false;
|
bool ringMuted = false;
|
||||||
bool micMuted = false;
|
bool micMuted = false;
|
||||||
bool speakerOn = false;
|
bool speakerOn = false;
|
||||||
|
bool btAudioOn = false;
|
||||||
int callVolumePct = 85;
|
int callVolumePct = 85;
|
||||||
int selectedRow = 0;
|
int selectedRow = 0;
|
||||||
|
|
||||||
|
auto hasBtAudioCard = []() -> bool {
|
||||||
|
FILE* fp = ::popen("pactl list short cards 2>/dev/null", "r");
|
||||||
|
if (!fp) return false;
|
||||||
|
char line[256];
|
||||||
|
bool found = false;
|
||||||
|
while (std::fgets(line, sizeof(line), fp)) {
|
||||||
|
if (std::strstr(line, "bluez_card.") != nullptr) {
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
::pclose(fp);
|
||||||
|
return found;
|
||||||
|
};
|
||||||
|
|
||||||
int64_t callStartMs = 0;
|
int64_t callStartMs = 0;
|
||||||
int64_t endedAtMs = 0;
|
int64_t endedAtMs = 0;
|
||||||
int lastFinalDurationSec = 0;
|
int lastFinalDurationSec = 0;
|
||||||
@@ -497,8 +513,17 @@ int callscreen_run_main(int argc, char** argv) {
|
|||||||
alsa.setInteger("ADC1 Volume", mute ? 0 : 8);
|
alsa.setInteger("ADC1 Volume", mute ? 0 : 8);
|
||||||
alsa.setInteger("ADC3 Volume", mute ? 0 : 8);
|
alsa.setInteger("ADC3 Volume", mute ? 0 : 8);
|
||||||
alsa.setInteger("TX1 Digital Volume", mute ? 0 : 88);
|
alsa.setInteger("TX1 Digital Volume", mute ? 0 : 88);
|
||||||
alsa.setBoolean("VoiceMMode1 Capture Mixer TERT_MI2S_TX", !mute);
|
if (btAudioOn) {
|
||||||
alsa.setBoolean("MultiMedia2 Mixer TERT_MI2S_TX", !mute);
|
alsa.setBoolean("VoiceMMode1 Capture Mixer TERT_MI2S_TX", false);
|
||||||
|
alsa.setBoolean("MultiMedia2 Mixer TERT_MI2S_TX", false);
|
||||||
|
alsa.setBoolean("VoiceMMode1 Capture Mixer INT_BT_SCO_TX", !mute);
|
||||||
|
alsa.setBoolean("MultiMedia2 Mixer INT_BT_SCO_TX", !mute);
|
||||||
|
} else {
|
||||||
|
alsa.setBoolean("VoiceMMode1 Capture Mixer INT_BT_SCO_TX", false);
|
||||||
|
alsa.setBoolean("MultiMedia2 Mixer INT_BT_SCO_TX", false);
|
||||||
|
alsa.setBoolean("VoiceMMode1 Capture Mixer TERT_MI2S_TX", !mute);
|
||||||
|
alsa.setBoolean("MultiMedia2 Mixer TERT_MI2S_TX", !mute);
|
||||||
|
}
|
||||||
runAsyncCmd(mute ? "wpctl set-mute @DEFAULT_AUDIO_SOURCE@ 1 >/dev/null 2>&1"
|
runAsyncCmd(mute ? "wpctl set-mute @DEFAULT_AUDIO_SOURCE@ 1 >/dev/null 2>&1"
|
||||||
: "wpctl set-mute @DEFAULT_AUDIO_SOURCE@ 0 >/dev/null 2>&1");
|
: "wpctl set-mute @DEFAULT_AUDIO_SOURCE@ 0 >/dev/null 2>&1");
|
||||||
statusNotice = mute ? "Microphone muted" : "Microphone unmuted";
|
statusNotice = mute ? "Microphone muted" : "Microphone unmuted";
|
||||||
@@ -510,15 +535,64 @@ int callscreen_run_main(int argc, char** argv) {
|
|||||||
activeSimSlot == 3 || activeSimSlot == 4;
|
activeSimSlot == 3 || activeSimSlot == 4;
|
||||||
};
|
};
|
||||||
|
|
||||||
auto setSpeakerRoute = [&](bool toSpeaker) {
|
auto setSpeakerRoute = [&](bool toSpeaker, bool toBt = false) {
|
||||||
speakerOn = toSpeaker;
|
speakerOn = toBt ? false : toSpeaker;
|
||||||
|
btAudioOn = toBt;
|
||||||
bool jackPlugged = (readIntFile("/tmp/sxmo_jack_plugged", 0) == 1);
|
bool jackPlugged = (readIntFile("/tmp/sxmo_jack_plugged", 0) == 1);
|
||||||
long hwVol = pctToHwVol(callVolumePct, toSpeaker, !toSpeaker && jackPlugged);
|
long hwVol = pctToHwVol(callVolumePct, speakerOn, !speakerOn && jackPlugged);
|
||||||
bool voip = isVoipCallId(callId);
|
bool voip = isVoipCallId(callId);
|
||||||
|
auto setOutDevFile = [](const char* devName) {
|
||||||
|
std::ofstream out("/tmp/sxmo_audio_out_device", std::ios::trunc);
|
||||||
|
if (out.is_open()) out << devName << "\n";
|
||||||
|
};
|
||||||
|
|
||||||
|
if (toBt) {
|
||||||
|
alsa.setBoolean("SPK DAC Switch", false);
|
||||||
|
alsa.setEnum("EAR_S", 0);
|
||||||
|
alsa.setEnum("HPHL", 0);
|
||||||
|
alsa.setEnum("HPHR", 0);
|
||||||
|
alsa.setEnum("RX1 MIX1 INP1", 0);
|
||||||
|
alsa.setEnum("RX2 MIX1 INP1", 0);
|
||||||
|
alsa.setEnum("RX3 MIX1 INP1", 0);
|
||||||
|
alsa.setInteger("RX1 Digital Volume", 0);
|
||||||
|
alsa.setInteger("RX2 Digital Volume", 0);
|
||||||
|
alsa.setInteger("RX3 Digital Volume", 0);
|
||||||
|
if (!voip) {
|
||||||
|
alsa.setBoolean("PRI_MI2S_RX Voice Mixer VoiceMMode1", false);
|
||||||
|
alsa.setBoolean("VoiceMMode1 Capture Mixer TERT_MI2S_TX", false);
|
||||||
|
alsa.setBoolean("INT_BT_SCO_RX Voice Mixer VoiceMMode1", true);
|
||||||
|
alsa.setBoolean("VoiceMMode1 Capture Mixer INT_BT_SCO_TX", !micMuted);
|
||||||
|
} else {
|
||||||
|
alsa.setBoolean("PRI_MI2S_RX Audio Mixer MultiMedia1", false);
|
||||||
|
alsa.setBoolean("MultiMedia2 Mixer TERT_MI2S_TX", false);
|
||||||
|
alsa.setBoolean("INT_BT_SCO_RX Audio Mixer MultiMedia1", true);
|
||||||
|
alsa.setBoolean("MultiMedia2 Mixer INT_BT_SCO_TX", !micMuted);
|
||||||
|
}
|
||||||
|
setOutDevFile("Bluetooth");
|
||||||
|
statusNotice = "Audio routed to Bluetooth";
|
||||||
|
runAsyncCmd(
|
||||||
|
"bt_card=$(pactl list short cards 2>/dev/null | awk '$2 ~ /^bluez_card\\./ { print $2; exit }'); "
|
||||||
|
"if [ -n \"$bt_card\" ]; then "
|
||||||
|
" pactl set-card-profile \"$bt_card\" headset-head-unit-cvsd >/dev/null 2>&1 || "
|
||||||
|
" pactl set-card-profile \"$bt_card\" headset-head-unit >/dev/null 2>&1 || "
|
||||||
|
" pactl set-card-profile \"$bt_card\" headset-head-unit-msbc >/dev/null 2>&1 || true; "
|
||||||
|
"fi; "
|
||||||
|
"sxmo_audio.sh device set Bluetooth >/dev/null 2>&1; "
|
||||||
|
"sxmo_audio.sh device setinput Bluetooth >/dev/null 2>&1; "
|
||||||
|
"PATH=\"$HOME/.config/sxmo/hooks:/usr/share/sxmo/default_hooks:$PATH\" "
|
||||||
|
"sxmo_hook_statusbar.sh volume >/dev/null 2>&1");
|
||||||
|
statusNoticeUntilMs = nowMs() + 2000;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!voip) {
|
if (!voip) {
|
||||||
|
alsa.setBoolean("INT_BT_SCO_RX Voice Mixer VoiceMMode1", false);
|
||||||
|
alsa.setBoolean("VoiceMMode1 Capture Mixer INT_BT_SCO_TX", false);
|
||||||
alsa.setBoolean("PRI_MI2S_RX Voice Mixer VoiceMMode1", true);
|
alsa.setBoolean("PRI_MI2S_RX Voice Mixer VoiceMMode1", true);
|
||||||
alsa.setBoolean("VoiceMMode1 Capture Mixer TERT_MI2S_TX", !micMuted);
|
alsa.setBoolean("VoiceMMode1 Capture Mixer TERT_MI2S_TX", !micMuted);
|
||||||
} else {
|
} else {
|
||||||
|
alsa.setBoolean("INT_BT_SCO_RX Audio Mixer MultiMedia1", false);
|
||||||
|
alsa.setBoolean("MultiMedia2 Mixer INT_BT_SCO_TX", false);
|
||||||
alsa.setBoolean("PRI_MI2S_RX Audio Mixer MultiMedia1", true);
|
alsa.setBoolean("PRI_MI2S_RX Audio Mixer MultiMedia1", true);
|
||||||
alsa.setBoolean("MultiMedia2 Mixer TERT_MI2S_TX", !micMuted);
|
alsa.setBoolean("MultiMedia2 Mixer TERT_MI2S_TX", !micMuted);
|
||||||
}
|
}
|
||||||
@@ -528,10 +602,6 @@ int callscreen_run_main(int argc, char** argv) {
|
|||||||
alsa.setInteger("ADC1 Volume", 8);
|
alsa.setInteger("ADC1 Volume", 8);
|
||||||
alsa.setInteger("TX1 Digital Volume", 88);
|
alsa.setInteger("TX1 Digital Volume", 88);
|
||||||
}
|
}
|
||||||
auto setOutDevFile = [](const char* devName) {
|
|
||||||
std::ofstream out("/tmp/sxmo_audio_out_device", std::ios::trunc);
|
|
||||||
if (out.is_open()) out << devName << "\n";
|
|
||||||
};
|
|
||||||
if (toSpeaker) {
|
if (toSpeaker) {
|
||||||
alsa.setEnum("EAR_S", 0);
|
alsa.setEnum("EAR_S", 0);
|
||||||
alsa.setEnum("HPHL", 0);
|
alsa.setEnum("HPHL", 0);
|
||||||
@@ -585,18 +655,34 @@ int callscreen_run_main(int argc, char** argv) {
|
|||||||
statusNoticeUntilMs = nowMs() + 2000;
|
statusNoticeUntilMs = nowMs() + 2000;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
auto cycleAudioRoute = [&]() {
|
||||||
|
if (hasBtAudioCard()) {
|
||||||
|
if (btAudioOn) {
|
||||||
|
setSpeakerRoute(true, false);
|
||||||
|
} else if (speakerOn) {
|
||||||
|
setSpeakerRoute(false, false);
|
||||||
|
} else {
|
||||||
|
setSpeakerRoute(false, true);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
setSpeakerRoute(!speakerOn, false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
auto adjustVolume = [&](int deltaPct) {
|
auto adjustVolume = [&](int deltaPct) {
|
||||||
callVolumePct = std::clamp(callVolumePct + deltaPct, 5, 100);
|
callVolumePct = std::clamp(callVolumePct + deltaPct, 5, 100);
|
||||||
writeIntFile("/tmp/sxmo_call_vol", callVolumePct);
|
writeIntFile("/tmp/sxmo_call_vol", callVolumePct);
|
||||||
bool jackPlugged = (readIntFile("/tmp/sxmo_jack_plugged", 0) == 1);
|
bool jackPlugged = (readIntFile("/tmp/sxmo_jack_plugged", 0) == 1);
|
||||||
if (speakerOn) {
|
if (!btAudioOn) {
|
||||||
alsa.setInteger("RX3 Digital Volume", pctToHwVol(callVolumePct, true, false));
|
if (speakerOn) {
|
||||||
} else if (jackPlugged) {
|
alsa.setInteger("RX3 Digital Volume", pctToHwVol(callVolumePct, true, false));
|
||||||
long hw = pctToHwVol(callVolumePct, false, true);
|
} else if (jackPlugged) {
|
||||||
alsa.setInteger("RX1 Digital Volume", hw);
|
long hw = pctToHwVol(callVolumePct, false, true);
|
||||||
alsa.setInteger("RX2 Digital Volume", hw);
|
alsa.setInteger("RX1 Digital Volume", hw);
|
||||||
} else {
|
alsa.setInteger("RX2 Digital Volume", hw);
|
||||||
alsa.setInteger("RX1 Digital Volume", pctToHwVol(callVolumePct, false, false));
|
} else {
|
||||||
|
alsa.setInteger("RX1 Digital Volume", pctToHwVol(callVolumePct, false, false));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
char cmd[128];
|
char cmd[128];
|
||||||
std::snprintf(cmd, sizeof(cmd),
|
std::snprintf(cmd, sizeof(cmd),
|
||||||
@@ -606,7 +692,13 @@ int callscreen_run_main(int argc, char** argv) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
auto finishRecordingFile = [&]() {
|
auto finishRecordingFile = [&]() {
|
||||||
alsa.setBoolean("MultiMedia2 Mixer TERT_MI2S_TX", !micMuted);
|
if (btAudioOn) {
|
||||||
|
alsa.setBoolean("MultiMedia2 Mixer TERT_MI2S_TX", false);
|
||||||
|
alsa.setBoolean("MultiMedia2 Mixer INT_BT_SCO_TX", !micMuted);
|
||||||
|
} else {
|
||||||
|
alsa.setBoolean("MultiMedia2 Mixer INT_BT_SCO_TX", false);
|
||||||
|
alsa.setBoolean("MultiMedia2 Mixer TERT_MI2S_TX", !micMuted);
|
||||||
|
}
|
||||||
finalizeWavHeader(recordFilePath);
|
finalizeWavHeader(recordFilePath);
|
||||||
struct stat st {};
|
struct stat st {};
|
||||||
if (!recordFilePath.empty() && ::stat(recordFilePath.c_str(), &st) == 0 &&
|
if (!recordFilePath.empty() && ::stat(recordFilePath.c_str(), &st) == 0 &&
|
||||||
@@ -686,7 +778,13 @@ int callscreen_run_main(int argc, char** argv) {
|
|||||||
alsa.setInteger("ADC1 Volume", 8);
|
alsa.setInteger("ADC1 Volume", 8);
|
||||||
alsa.setInteger("TX1 Digital Volume", 88);
|
alsa.setInteger("TX1 Digital Volume", 88);
|
||||||
}
|
}
|
||||||
alsa.setBoolean("MultiMedia2 Mixer TERT_MI2S_TX", true);
|
if (btAudioOn) {
|
||||||
|
alsa.setBoolean("MultiMedia2 Mixer TERT_MI2S_TX", false);
|
||||||
|
alsa.setBoolean("MultiMedia2 Mixer INT_BT_SCO_TX", true);
|
||||||
|
} else {
|
||||||
|
alsa.setBoolean("MultiMedia2 Mixer INT_BT_SCO_TX", false);
|
||||||
|
alsa.setBoolean("MultiMedia2 Mixer TERT_MI2S_TX", true);
|
||||||
|
}
|
||||||
|
|
||||||
pid_t pid = ::fork();
|
pid_t pid = ::fork();
|
||||||
if (pid < 0) {
|
if (pid < 0) {
|
||||||
@@ -1037,9 +1135,12 @@ int callscreen_run_main(int argc, char** argv) {
|
|||||||
"[2] Record", std::max(72, kWinWidth - vw - 44));
|
"[2] Record", std::max(72, kWinWidth - vw - 44));
|
||||||
drawPango(layoutMain, icCol, kWinWidth - vw - 8, ry, rowH, valStr);
|
drawPango(layoutMain, icCol, kWinWidth - vw - 8, ry, rowH, valStr);
|
||||||
} else if (i == 2) {
|
} else if (i == 2) {
|
||||||
|
bool jackPlugged = (readIntFile("/tmp/sxmo_jack_plugged", 0) == 1);
|
||||||
const char* ic = speakerOn ? kIconSpeaker : kIconEarpiece;
|
const char* ic = speakerOn ? kIconSpeaker : kIconEarpiece;
|
||||||
XftColor* icCol = speakerOn ? &colYellow : &colBlue;
|
XftColor* icCol = btAudioOn ? &colGreen : (speakerOn ? &colYellow : &colBlue);
|
||||||
std::string valStr = speakerOn ? "SPEAKER" : "EARPIECE";
|
std::string valStr = btAudioOn ? "BLUETOOTH"
|
||||||
|
: (speakerOn ? "SPEAKER"
|
||||||
|
: (jackPlugged ? "HEADPHONES" : "EARPIECE"));
|
||||||
int vw = pangoWidth(layoutMain, valStr);
|
int vw = pangoWidth(layoutMain, valStr);
|
||||||
drawPango(layoutIcon, icCol, 10, ry, rowH, ic);
|
drawPango(layoutIcon, icCol, 10, ry, rowH, ic);
|
||||||
drawPango(layoutMain, isSel ? &colWhite : &colLight, 34, ry, rowH,
|
drawPango(layoutMain, isSel ? &colWhite : &colLight, 34, ry, rowH,
|
||||||
@@ -1261,7 +1362,7 @@ int callscreen_run_main(int argc, char** argv) {
|
|||||||
selectedRow = 0;
|
selectedRow = 0;
|
||||||
writeActiveStateFiles();
|
writeActiveStateFiles();
|
||||||
stopRingingJobs();
|
stopRingingJobs();
|
||||||
setSpeakerRoute(false);
|
setSpeakerRoute(false, hasBtAudioCard());
|
||||||
render();
|
render();
|
||||||
|
|
||||||
if (cid.rfind("sip:", 0) == 0) {
|
if (cid.rfind("sip:", 0) == 0) {
|
||||||
@@ -1310,6 +1411,9 @@ int callscreen_run_main(int argc, char** argv) {
|
|||||||
ringMuted = false;
|
ringMuted = false;
|
||||||
writeActiveStateFiles();
|
writeActiveStateFiles();
|
||||||
stopRingingJobs();
|
stopRingingJobs();
|
||||||
|
btAudioOn = false;
|
||||||
|
alsa.setBoolean("INT_BT_SCO_RX Voice Mixer VoiceMMode1", false);
|
||||||
|
alsa.setBoolean("VoiceMMode1 Capture Mixer INT_BT_SCO_TX", false);
|
||||||
alsa.setBoolean("PRI_MI2S_RX Voice Mixer VoiceMMode1", false);
|
alsa.setBoolean("PRI_MI2S_RX Voice Mixer VoiceMMode1", false);
|
||||||
alsa.setBoolean("VoiceMMode1 Capture Mixer TERT_MI2S_TX", false);
|
alsa.setBoolean("VoiceMMode1 Capture Mixer TERT_MI2S_TX", false);
|
||||||
alsa.setEnum("EAR_S", 0);
|
alsa.setEnum("EAR_S", 0);
|
||||||
@@ -1319,22 +1423,12 @@ int callscreen_run_main(int argc, char** argv) {
|
|||||||
alsa.setBoolean("SPK DAC Switch", true);
|
alsa.setBoolean("SPK DAC Switch", true);
|
||||||
int spkPct = readIntFile(getHomeDirPath() + "/.config/sxmo/speaker_vol", 85);
|
int spkPct = readIntFile(getHomeDirPath() + "/.config/sxmo/speaker_vol", 85);
|
||||||
alsa.setInteger("RX3 Digital Volume", pctToHwVol(spkPct, true, false));
|
alsa.setInteger("RX3 Digital Volume", pctToHwVol(spkPct, true, false));
|
||||||
{
|
|
||||||
bool jackPlugged = (readIntFile("/tmp/sxmo_jack_plugged", 0) == 1);
|
|
||||||
std::ofstream out("/tmp/sxmo_audio_out_device", std::ios::trunc);
|
|
||||||
if (out.is_open()) out << (jackPlugged ? "Headphones" : "Speaker") << "\n";
|
|
||||||
}
|
|
||||||
runAsyncCmd("sxmo_jobs.sh stop ringing >/dev/null 2>&1; "
|
runAsyncCmd("sxmo_jobs.sh stop ringing >/dev/null 2>&1; "
|
||||||
"pkill -TERM -f sxmo_hook_ring.sh >/dev/null 2>&1; "
|
"pkill -TERM -f sxmo_hook_ring.sh >/dev/null 2>&1; "
|
||||||
"pkill -TERM -f 'pw-play.*ring' >/dev/null 2>&1; "
|
"pkill -TERM -f 'pw-play.*ring' >/dev/null 2>&1; "
|
||||||
"pkill -TERM -f 'mpv.*ring' >/dev/null 2>&1; "
|
"pkill -TERM -f 'mpv.*ring' >/dev/null 2>&1; "
|
||||||
"pkill -TERM -x sxmo_vibrate >/dev/null 2>&1; "
|
"pkill -TERM -x sxmo_vibrate >/dev/null 2>&1; "
|
||||||
"sxmo_modemaudio.sh disable_call_audio_mode >/dev/null 2>&1; "
|
"sxmo_modemaudio.sh disable_call_audio_mode >/dev/null 2>&1");
|
||||||
"if [ \"$(cat /tmp/sxmo_jack_plugged 2>/dev/null)\" = \"1\" ]; then "
|
|
||||||
" sxmo_audio.sh out set Headphones >/dev/null 2>&1; "
|
|
||||||
"else "
|
|
||||||
" sxmo_audio.sh out set Speaker >/dev/null 2>&1; "
|
|
||||||
"fi");
|
|
||||||
render();
|
render();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1615,13 +1709,14 @@ int callscreen_run_main(int argc, char** argv) {
|
|||||||
if (foundState == "active" && callState != CallState::Active) {
|
if (foundState == "active" && callState != CallState::Active) {
|
||||||
if (callState != CallState::Outgoing) {
|
if (callState != CallState::Outgoing) {
|
||||||
speakerOn = false;
|
speakerOn = false;
|
||||||
|
btAudioOn = hasBtAudioCard();
|
||||||
}
|
}
|
||||||
callState = CallState::Active;
|
callState = CallState::Active;
|
||||||
callStartMs = nowMs();
|
callStartMs = nowMs();
|
||||||
ringMuted = false;
|
ringMuted = false;
|
||||||
writeActiveStateFiles();
|
writeActiveStateFiles();
|
||||||
stopRingingJobs();
|
stopRingingJobs();
|
||||||
setSpeakerRoute(speakerOn);
|
setSpeakerRoute(speakerOn, btAudioOn);
|
||||||
render();
|
render();
|
||||||
} else if (foundState == "ringing-in" && callState == CallState::Idle) {
|
} else if (foundState == "ringing-in" && callState == CallState::Idle) {
|
||||||
callState = CallState::Incoming;
|
callState = CallState::Incoming;
|
||||||
@@ -1820,10 +1915,11 @@ int callscreen_run_main(int argc, char** argv) {
|
|||||||
callStartMs = nowMs();
|
callStartMs = nowMs();
|
||||||
ringMuted = false;
|
ringMuted = false;
|
||||||
speakerOn = false;
|
speakerOn = false;
|
||||||
|
btAudioOn = hasBtAudioCard();
|
||||||
dtmfMode = false;
|
dtmfMode = false;
|
||||||
dtmfSent.clear();
|
dtmfSent.clear();
|
||||||
selectedRow = 0;
|
selectedRow = 0;
|
||||||
setSpeakerRoute(false);
|
setSpeakerRoute(false, btAudioOn);
|
||||||
statusNotice.clear();
|
statusNotice.clear();
|
||||||
statusNoticeUntilMs = 0;
|
statusNoticeUntilMs = 0;
|
||||||
writeActiveStateFiles();
|
writeActiveStateFiles();
|
||||||
@@ -1840,11 +1936,12 @@ int callscreen_run_main(int argc, char** argv) {
|
|||||||
callStartMs = nowMs();
|
callStartMs = nowMs();
|
||||||
if (!wasOutgoing) {
|
if (!wasOutgoing) {
|
||||||
speakerOn = false;
|
speakerOn = false;
|
||||||
|
btAudioOn = hasBtAudioCard();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ringMuted = false;
|
ringMuted = false;
|
||||||
selectedRow = 0;
|
selectedRow = 0;
|
||||||
setSpeakerRoute(speakerOn);
|
setSpeakerRoute(speakerOn, btAudioOn);
|
||||||
statusNotice.clear();
|
statusNotice.clear();
|
||||||
statusNoticeUntilMs = 0;
|
statusNoticeUntilMs = 0;
|
||||||
writeActiveStateFiles();
|
writeActiveStateFiles();
|
||||||
@@ -2045,7 +2142,7 @@ int callscreen_run_main(int argc, char** argv) {
|
|||||||
selectedRow = 1;
|
selectedRow = 1;
|
||||||
render();
|
render();
|
||||||
} else if (dialCh == '3') {
|
} else if (dialCh == '3') {
|
||||||
setSpeakerRoute(!speakerOn);
|
cycleAudioRoute();
|
||||||
selectedRow = 2;
|
selectedRow = 2;
|
||||||
render();
|
render();
|
||||||
} else if (dialCh == '0') {
|
} else if (dialCh == '0') {
|
||||||
@@ -2120,7 +2217,7 @@ int callscreen_run_main(int argc, char** argv) {
|
|||||||
} else if (selectedRow == 1) {
|
} else if (selectedRow == 1) {
|
||||||
toggleRecording();
|
toggleRecording();
|
||||||
} else if (selectedRow == 2) {
|
} else if (selectedRow == 2) {
|
||||||
setSpeakerRoute(!speakerOn);
|
cycleAudioRoute();
|
||||||
} else if (selectedRow == 3) {
|
} else if (selectedRow == 3) {
|
||||||
adjustVolume(callVolumePct >= 95 ? -50 : +10);
|
adjustVolume(callVolumePct >= 95 ? -50 : +10);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -443,7 +443,24 @@ std::vector<BtDeviceEntry> queryBtDevices() {
|
|||||||
connectedMacs);
|
connectedMacs);
|
||||||
|
|
||||||
std::string paRaw = runCaptureCmd(
|
std::string paRaw = runCaptureCmd(
|
||||||
"pactl list sinks short 2>/dev/null; pactl list sources short 2>/dev/null");
|
"pactl list sinks short 2>/dev/null; pactl list sources short 2>/dev/null; "
|
||||||
|
"pactl list cards 2>/dev/null");
|
||||||
|
|
||||||
|
std::unordered_map<std::string, std::string> cardActiveProfile;
|
||||||
|
{
|
||||||
|
std::istringstream pss(paRaw);
|
||||||
|
std::string pline;
|
||||||
|
std::string curCard;
|
||||||
|
while (std::getline(pss, pline)) {
|
||||||
|
std::string t = trimStr(pline);
|
||||||
|
if (t.rfind("Name: bluez_card.", 0) == 0) {
|
||||||
|
curCard = trimStr(t.substr(6));
|
||||||
|
} else if (!curCard.empty() && t.rfind("Active Profile:", 0) == 0) {
|
||||||
|
cardActiveProfile[curCard] = trimStr(t.substr(15));
|
||||||
|
curCard.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::string allRaw = runCaptureCmd("timeout 2 bluetoothctl devices 2>/dev/null");
|
std::string allRaw = runCaptureCmd("timeout 2 bluetoothctl devices 2>/dev/null");
|
||||||
std::istringstream ss(allRaw);
|
std::istringstream ss(allRaw);
|
||||||
@@ -553,7 +570,14 @@ std::vector<BtDeviceEntry> queryBtDevices() {
|
|||||||
infoLow.find("icon: audio-") != std::string::npos) {
|
infoLow.find("icon: audio-") != std::string::npos) {
|
||||||
d.kind = BtDevKind::Audio;
|
d.kind = BtDevKind::Audio;
|
||||||
if (d.connected) {
|
if (d.connected) {
|
||||||
if (hasPaSrc) {
|
std::string activeProf = toLowerStr(cardActiveProfile["bluez_card." + macU]);
|
||||||
|
if (activeProf.rfind("headset-head-unit", 0) == 0 ||
|
||||||
|
activeProf.find("hfp") != std::string::npos ||
|
||||||
|
activeProf.find("hsp") != std::string::npos) {
|
||||||
|
d.profileLabel = "HSP/HFP";
|
||||||
|
} else if (activeProf.rfind("a2dp", 0) == 0) {
|
||||||
|
d.profileLabel = "A2DP";
|
||||||
|
} else if (hasPaSrc) {
|
||||||
d.profileLabel = "HSP/HFP";
|
d.profileLabel = "HSP/HFP";
|
||||||
} else if (hasPaSink) {
|
} else if (hasPaSink) {
|
||||||
d.profileLabel = "A2DP";
|
d.profileLabel = "A2DP";
|
||||||
@@ -1537,7 +1561,8 @@ int runNetworksApp(int argc, char** argv) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isConn && targetBt.kind == BtDevKind::Audio) {
|
if (isConn && targetBt.kind == BtDevKind::Audio) {
|
||||||
runAsyncCmd("sxmo_audio.sh device set Bluetooth >/dev/null 2>&1");
|
runCaptureCmd("sxmo_audio.sh device set Bluetooth >/dev/null 2>&1");
|
||||||
|
refreshCurrentTab(false);
|
||||||
}
|
}
|
||||||
setBanner(isConn ? ("Connected: " + targetBt.name) : "Connect failed");
|
setBanner(isConn ? ("Connected: " + targetBt.name) : "Connect failed");
|
||||||
} else if (act == 1) {
|
} else if (act == 1) {
|
||||||
@@ -1545,6 +1570,10 @@ int runNetworksApp(int argc, char** argv) {
|
|||||||
render();
|
render();
|
||||||
runCaptureCmd("timeout 4 bluetoothctl disconnect " + shellQuote(targetBt.mac) +
|
runCaptureCmd("timeout 4 bluetoothctl disconnect " + shellQuote(targetBt.mac) +
|
||||||
" >/dev/null 2>&1", &rc);
|
" >/dev/null 2>&1", &rc);
|
||||||
|
if (targetBt.kind == BtDevKind::Audio) {
|
||||||
|
runAsyncCmd("sxmo_audio.sh device setinput Mic1 >/dev/null 2>&1; "
|
||||||
|
"sxmo_audio.sh device set Speaker >/dev/null 2>&1");
|
||||||
|
}
|
||||||
refreshCurrentTab(false);
|
refreshCurrentTab(false);
|
||||||
setBanner("Disconnected " + targetBt.name);
|
setBanner("Disconnected " + targetBt.name);
|
||||||
} else if (act == 2) {
|
} else if (act == 2) {
|
||||||
@@ -1563,7 +1592,8 @@ int runNetworksApp(int argc, char** argv) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isPairedOrConn && targetBt.kind == BtDevKind::Audio) {
|
if (isPairedOrConn && targetBt.kind == BtDevKind::Audio) {
|
||||||
runAsyncCmd("sxmo_audio.sh device set Bluetooth >/dev/null 2>&1");
|
runCaptureCmd("sxmo_audio.sh device set Bluetooth >/dev/null 2>&1");
|
||||||
|
refreshCurrentTab(false);
|
||||||
}
|
}
|
||||||
setBanner(isPairedOrConn ? ("Paired & connected: " + targetBt.name)
|
setBanner(isPairedOrConn ? ("Paired & connected: " + targetBt.name)
|
||||||
: ("Pairing failed: " + targetBt.name));
|
: ("Pairing failed: " + targetBt.name));
|
||||||
@@ -1579,19 +1609,37 @@ int runNetworksApp(int argc, char** argv) {
|
|||||||
render();
|
render();
|
||||||
if (wantHfp) {
|
if (wantHfp) {
|
||||||
runCaptureCmd("pactl set-card-profile " + shellQuote(card) +
|
runCaptureCmd("pactl set-card-profile " + shellQuote(card) +
|
||||||
|
" headset-head-unit-cvsd >/dev/null 2>&1 || "
|
||||||
|
"pactl set-card-profile " + shellQuote(card) +
|
||||||
" headset-head-unit >/dev/null 2>&1 || "
|
" headset-head-unit >/dev/null 2>&1 || "
|
||||||
"pactl set-card-profile " + shellQuote(card) +
|
"pactl set-card-profile " + shellQuote(card) +
|
||||||
" headset-head-unit-msbc >/dev/null 2>&1 || "
|
" headset-head-unit-msbc >/dev/null 2>&1", &rc);
|
||||||
"pactl set-card-profile " + shellQuote(card) +
|
runCaptureCmd("sxmo_audio.sh device set Bluetooth >/dev/null 2>&1; "
|
||||||
" headset-head-unit-cvsd >/dev/null 2>&1", &rc);
|
"sxmo_audio.sh device setinput Bluetooth >/dev/null 2>&1");
|
||||||
runAsyncCmd("sxmo_audio.sh device set Bluetooth >/dev/null 2>&1; "
|
|
||||||
"sxmo_audio.sh device setinput Bluetooth >/dev/null 2>&1");
|
|
||||||
} else {
|
} else {
|
||||||
runCaptureCmd("pactl set-card-profile " + shellQuote(card) +
|
std::string a2dpCmd =
|
||||||
" a2dp-sink >/dev/null 2>&1", &rc);
|
"if ! pactl set-card-profile " + shellQuote(card) +
|
||||||
runAsyncCmd("sxmo_audio.sh device set Bluetooth >/dev/null 2>&1");
|
" a2dp-sink >/dev/null 2>&1; then "
|
||||||
|
" prof=$(pactl list cards 2>/dev/null | awk -v c=" +
|
||||||
|
shellQuote(card) +
|
||||||
|
" '$1==\"Name:\"{in_c=($2==c);in_p=0} "
|
||||||
|
"in_c&&$1==\"Profiles:\"{in_p=1;next} "
|
||||||
|
"in_c&&in_p&&/^[[:space:]]*Active Profile:/{in_p=0} "
|
||||||
|
"in_c&&in_p&&$1~/^a2dp-sink/&&$0!~/available: no/{sub(/:$/,\"\",$1);print $1;exit}'); "
|
||||||
|
" [ -n \"$prof\" ] && pactl set-card-profile " + shellQuote(card) +
|
||||||
|
" \"$prof\" >/dev/null 2>&1; "
|
||||||
|
"fi";
|
||||||
|
runCaptureCmd(a2dpCmd, &rc);
|
||||||
|
runCaptureCmd("sxmo_audio.sh device setinput Mic1 >/dev/null 2>&1; "
|
||||||
|
"sxmo_audio.sh device set Bluetooth >/dev/null 2>&1");
|
||||||
}
|
}
|
||||||
refreshCurrentTab(false);
|
refreshCurrentTab(false);
|
||||||
|
for (const auto& d : btList) {
|
||||||
|
if (d.mac == targetBt.mac) {
|
||||||
|
targetBt = d;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
setBanner(rc == 0 ? (std::string("Audio profile: ") + (wantHfp ? "HSP/HFP" : "A2DP"))
|
setBanner(rc == 0 ? (std::string("Audio profile: ") + (wantHfp ? "HSP/HFP" : "A2DP"))
|
||||||
: "Profile switch unsupported by device");
|
: "Profile switch unsupported by device");
|
||||||
} else if (act == 4) {
|
} else if (act == 4) {
|
||||||
|
|||||||
Reference in new issue
Block a user