Qualcomm Snapdragon Sensor Core support for SDM845 devices
Newer Qualcomm SoCs do not expose their sensors directly, instead they use a DSP which is called Snapdragon Sensor Core.
The latter uses QMI to transfer messages where the content of these messages is encoded as Protobuf.
These sensors are supported by the newly created libssc
library which uses libqmi
and protobuf-c
libraries.
This library is integrated with iio-sensor-proxy
to expose these sensors to Phosh and other UIs which use iio-sensor-proxy
.
This MR allows:
- Auto-rotate screen
- Auto-brightness screen
- Screen turning OFF during a call when you hold the phone against your ear
- Compass functionality. However, it seems to be a bit off still on my SHIFT6mq, testing appreciated as it could be the firmware.
Dependencies
-
libqmi
: support for QRTR-only services, sent upstream: https://gitlab.freedesktop.org/mobile-broadband/libqmi/-/merge_requests/346 -
iio-sensor-proxy
:libssc
integration. Will send upstream once the rest is merged as everything comes together here. -
linux
: FastRPC and SLPI patches for SDM845, sent upstream. Upstream patches required to revert several ones in downstream SDM845 mainline Linux tree since they supersede the downstream patches. Downstream pulled in the patches already.-
SLPI remoteproc support (pending): https://lore.kernel.org/linux-remoteproc/20230330164633.117335-1-me@dylanvanassche.be/ -
FastRPC SDM845 for SLPI (pending): https://lore.kernel.org/linux-arm-msm/20230511141146.30465-1-me@dylanvanassche.be/ -
DTS patches (applied): https://lore.kernel.org/linux-devicetree/20230406173148.28309-1-me@dylanvanassche.be/
-
-
firmware-shift-sdm845
: sensor calibration and registry files, sent upstream and merged: https://gitlab.com/sdm845-mainline/firmware-shift-sdm845/-/merge_requests/1 -
hexagonrpcd
: DSP filesystem access daemon, SDM845 support accepted upstream: https://gitlab.com/flamingradian/sensh/-/merge_requests/1 Will send to Alpine once a release is made.
Status
Do not ship this yet, this MR is aimed at testing on more devices than the SHIFT6mq. Seems to be working great, moving things upstream now.
Some issues remain with the orientation matrixes of the sensors, but might be solved soon.
Testing welcome on all kinds of Qualcomm devices such as SDM670/SDM845/SMxxx but requires changes to your device packages such as firmware which you need to figure out yourself
12/12/2023: safe to be merged, still needs some parts upstreamed, see dependencies. Planned to do that soon.
Testing
-
Pull the firmware from your device and add it to the firmware package. See the SHIFT6mq one for paths and as example.
-
Sensors can be tested with
monitor-sensor
:- Accelerometer, light, proximity with
root
and thenmonitor-sensor --$SENSOR
- Compass requires to be come the
geoclue
user first:su geoclue -s=/bin/sh
and thenmonitor-sensor --compass
. Be aware that this user cannot access the other sensors when using thegeoclue
user.
- Accelerometer, light, proximity with
-
SHIFT6mq -
OP6 -
OP6T. Multiple reports that portrait orientation is wrong. Some user needs to find the correct mount matrix to fix it --> Turns out to be a glibc vs musl thing. On musl it was fine according to the reports. TODO: figure out why glibc behaves differently.