Jump to content

Qualcomm Snapdragon 670 (SDM670)

From postmarketOS Wiki
Revision as of 03:48, 25 February 2025 by Flamingradian (talk | contribs) (fix formatting and wording of some acdb sections)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Qualcomm SDM670
Manufacturer Qualcomm
Name SDM670
Codenames sdmbat
Architecture aarch64
CPU 2x 2.0 GHz Kryo 360 Gold, 6x 1.7 GHz Kryo 360 Silver
GPU Adreno 615
Year 2018
Process 10nm
Mainline yes
Community Page https://gitlab.com/sdm670-mainline
Components
CPU
Partial
UART
Broken
Storage
Partial
USB
Partial
Display
Works
GPU
Works
Pinctrl
Works
I²C
Works
SPI
Broken
Audio
Partial
Video
Partial
Thermal
Works
WiFi
Works
Bluetooth
Works
Modem
Works
GPS
No data
Camera
Works
NPU
No data
Suspend
No data
Ethernet
No data
SATA
No data


The Snapdragon 670 is a mid-range SoC used in a few devices.

Devices

Device Codename Mainline
Google Pixel 3a google-sargo Y
Google Pixel 3a XL google-bonito Y
Samsung Galaxy Tab S5e Wi-Fi (SM-T720) samsung-gts4lvwifi

Display

It is fairly easy to get a working display. See MSM8996_Mainlining#Simple_Framebuffer for details on how to do this. For full panel support (needed for backlight and 3D acceleration), there is a panel driver generator.

Regulators

The PM660 and PM660L power management ICs host most of the regulators. If you're copying regulators from other SoCs, keep in mind that SDM670 uses RPMh to communicate with the PMICs, while most other SoCs use the older RPM. The SDM670 regulators don't go in &rpm_requests, but &apps_rsc instead (and have qcom,pm660-rpmh-regulators and qcom,pm660l-rpmh-regulators compatible strings).

Disabling core components

Your device might not boot with the first dts you send it if you keep the core components enabled:

  • &tlmm - the pinctrl and gpio subsystems normally access all pins to read their state
  • &gcc - with clk_ignore_unused as a kernel command line option, this might turn on reserved clocks

Bluetooth

Bluetooth is available on uart6. Modem and WiFi are not required.

Audio Calibration

Some VoLTE calls need audio calibration to sound correct. It is possible to port audio calibration support with some extra firmware, ALSA configuration, and device tree changes.

ACDB checks

Your device's firmware should contain a global ACDB file, normally named "Global_cal.acdb". You can check if an ACDB is global with an acdbdump tool ("acdb-if" for inspect file):

~/acdbdump $ ./acdb-if Global_cal.acdb | grep 'Field "GPROPLUT"'
Field "GPROPLUT" @ 0x96

The other files should be device ACDB files containing topology IDs for sound devices. Each device has a number and can be queried with the acdb-ldp (list device properties) tool:

~/acdbdump $ ./acdb-ldp Handset_cal.acdb | grep 'voice topology ID\|name'
...
Device 7 name: HANDSET_SPKR
Device 7 voice topology ID: 268504967 / 0x10010F87
...
Device 4 name: HANDSET_MIC
Device 4 voice topology ID: 69491 / 0x00010F73
...

There will probably be many so you should triage for one topology ID most relevant to each sound codec. Keep track of the number in base 10, on the left of the '/' (e.g. 268504967 or 69491).

Firmware

To port your device, add the global ACDB to the device-specific firmware package (e.g. in /lib/firmware/qcom/sdm670/Google/sargo/Global_cal.acdb). Specify the relative path in the device tree, as a fixup to the q6core node:

&q6core {
	qcom,acdb-name = "qcom/sdm670/sargo/Global_cal.acdb";
};

ALSA configuration

For ALSA, you just need to set the "VoiceMMode1 RX Topology" (for playback codecs) or the "VoiceMMode1 TX Topology" (for capture codecs) to the topology ID from the device ACDB.

SectionDevice."Speakers" {
	Comment "Earpiece (L) and Speaker (R)"

	...

	EnableSequence [
		# ACDB file: Handset_cal.acdb
		# ACDB device ID: 7
		# ACDB device name: HANDSET_SPKR
		cset "name='VoiceMMode1 RX Topology' 268504967"
		...
	]

	...
]

Testing

Calibrated call audio makes a difference in some specific circumstances, making it possible to hear the other end. A call should be VoLTE to be a valid test (with 4G or higher). The phone on the other end also matters.

Peer phones that can be heard without calibrated call audio (not useful for testing):

  • (most?) landlines
  • Rogers wireless voicemail
  • iPhone 6
  • postmarketOS phones without calibrated call audio

Other platforms

Calibrated call audio depends on the latest q6voice patches from the MSM8916 and MSM8953 kernels. In linux-patches, these patches are:

MSM8916 patches:

ASoC-qdsp6-Add-shared-session-management-for-q6voice-services.patch
ASoC-qdsp6-Add-driver-for-Q6-Multimode-Voice-Manager-q6mvm.patch
ASoC-qdsp6-Add-driver-for-Q6-Core-Voice-Processor-q6cvp.patch
ASoC-qdsp6-Add-driver-for-Q6-Core-Voice-Stream-q6cvs.patch
ASoC-qdsp6-Add-voice-call-functionality-in-Q6-Voice-driver.patch
ASoC-qdsp6-Add-Q6-Voice-DAI-driver-v2.1.patch
ASoC-qdsp6-q6voice-Add-getter-setter-for-rx-and-tx-ports.patch
ASoC-qdsp6-q6voice-dai-Add-controls-for-voice-rx-and-tx-ports.patch

MSM8953 patches:

ASoC-qdsp6-q6voice-dai-Add-VoiceMMode1-DAI.patch

SDM670 patches:

ASoC-qdsp6-q6core-add-support-for-registering-topologies.patch
ASoC-qdsp6-q6cvp-add-topology-ID-parameters-to-session-functions.patch
ASoC-qdsp6-q6voice-pass-new-topology-property-to-q6cvp.patch
ASoC-qdsp6-q6voice-dai-add-ALSA-controls-for-the-topology-ID.patch

The SoC device tree should label q6core to let devices specify the global ACDB path, e.g.:

q6core: service@3 {
	reg = <APR_SVC_ADSP_CORE>;
	compatible = "qcom,q6core";
	qcom,protection-domain = "avs/audio", "msm/adsp/audio_pd";
};

The rest of the porting can be done per-device as in the above sections.

Feature table

Audio

The internal sound card and generic WCD codecs are supported. Some device-specific codecs may not be set up by the sound card driver.

ADSP crashes after suspended to RAM if hexagonrpcd is running.

Call audio

The q6voice drivers and q6voiced daemon set up call audio to go directly from the modem to ADSP. The Snapdragon 670 uses CVD revision 2.3, which requires a different initialization sequence.

Call audio may be loud depending on how the UCM configuration is set up for your device. Volume cannot be controlled in software, so it must be controlled in hardware. The headphone jack has 2 hardware volume controls, one for each channel, and can be controlled like so:

$ amixer -c 0 cset name='Digital RX1 Digital Volume' 23%
$ amixer -c 0 cset name='Digital RX2 Digital Volume' 23%
# alsactl store # Make this configuration persist across reboots

Pinctrl

There is a pin control driver but it has no wakeirqs. There is also an LPI TLMM for audio with no mainline driver.

Storage

eMMC is added but not UFS.

Thermals

Thermal zones are partially provided by the PMIC device tree, but are not actively tested.

USB

There is currently only USB 2.0.

Video

Video decoding works, but not encoding. There is still bad userspace support for video (ffmpeg isn't even packaged in Alpine with v4l2 video acceleration).

The video decoder is underclocked at 1920x1080 30fps, but not 24fps.

Who's working on it