User:Z3ntu/Fairphone2-mainline

From postmarketOS
Jump to: navigation, search

Component support table

Component Codename Mainline kernel Since when
Volume & camera buttons gpio-keys Working v4.15-rc1
Power key pm8941-pwrkey Working already upstream
Internal storage sdhci1 Working v4.15-rc1
SD card storage sdhci2 Working v4.16-rc1
Display otm1902b Kind-of working locally
Touchscreen Synaptics DSX? Kind-of working locally
Vibration motor TI DRV2603 Working v5.3-rc1
Notification LED qpnp / lpg Working locally
Magnetometer AK8963 Not possible[1]
Gyroscope & Accelerometer LSM330D Not possible[1]
Proximity & Light Murata LT1PA01 Not possible[1]
WiFi WCN3680/prima Working locally
Bluetooth WCN3680 Working? locally
FM WCN3680 No driver
GPU Adreno 330 Not working
Modem  ? Kind-of working locally
  1. 1.0 1.1 1.2 Connected to the DSP and the driver is implemented in the adsp.b10 firmware file.

Test notes

Volume & camera buttons

evtest /dev/input/event1

Power key

evtest /dev/input/event0

Internal storage

ls /dev/mmcblk0*

SD card storage

ls /dev/mmcblk1*

Display

Framebuffer console should display the kernel messages

ls /dev/fb0
echo 255 > /sys/devices/platform/soc/fd900000.mdss/fd922800.dsi/fd922800.dsi.0/backlight/fd922800.dsi.0/brightness

Vibration motor

fftest /dev/input/event2

Notification LED

echo 255 > /sys/devices/platform/soc/fc4cf000.spmi/spmi-0/0-01/fc4cf000.spmi:pm8941@1:lpg/leds/rgb/brightness
<bamse> z3ntu: echo '200 500 0 500 :|' > pattern ; echo 1 > brightness should give you a blinking led

WiFi / Bluetooth / FM

Notes from IRC:

you have to put wcnss.* in /lib/firmware and the nv file in /lib/firmware/wlan (or something like that)

then you can retry by echo start > /sys/class/remoteproc/remoteproc0/state

[ 1130.759246] remoteproc remoteproc0: remote processor fb204000.wcnss-rproc is now up

wcn36xx is the wifi driver

and CONFIG_BT_QCOMSMD gives you bluetooth

wpa_supplicant is needed to test WiFi at least

MAC addresses

It looks like the Bluetooth initialization (including querying the MAC address via QMI and setting it) is done with hci_qcomm_init on downstream (init.qcom.bt.sh). It looks like there is no official public source version available for that.

For WiFi this seems to be done with libwcnss_qmi.so, a source version of that can be found here.

A patch adding this method to libqmi is work-in-progress.

Sensors

Notes from IRC:

the client would need to implement the sensor qmi protocols, which we haven't tried to open up

qmi is just a method of encoding structured data; exactly like protobuf

libqmi implements a set of protocols that uses qmi to encode its data

so there's another set of 10-15 protocols, that uses qmi to encode messages, related to sensors

i think these are implemented in libsensors1.so - or something like that

but iirc libsensors1 is tied to the downstream AF_MSMIPC, and won't work on AF_QIPCRTR

Modem

The modem gets detected with ofono but it looks like ofono doesn't have support for dual-SIM QMI modems.

Cameras

There is a driver on the LKML for the CCI ("Camera Control Interface") which should work on msm8974 as well with a few hacks, but I haven't gotten it to work on the FP2 yet in combination with the old front camera, ov2685.

Old modules (driver available in mainline):

  • Front: OV2685 (y)
  • Back: OV8865 (n)

New modules:

  • Front: OV5670 (y)
  • Back: OV12870 (n)

Camera Flash LED

Old camera module

The flash in the old camera module is controlled by the pm8941 and this hardware block is accessible on the address @d300. The qcom-lpg driver used for the notification LED is relatively similar but it should be a separate driver for the camera flash.

New camera module

For the new camera module (12MP one) the following driver is being used:

# cat /sys/devices/fda0c000.qcom,cci/c6.ti,flash0/leds/torch_dual/device/uevent
DRIVER=leds-lm3644
OF_NAME=ti,flash0
OF_FULLNAME=/soc/qcom,cci@fda0C000/ti,flash0@c6
OF_COMPATIBLE_0=ti,lm3644
OF_COMPATIBLE_N=1
MODALIAS=of:Nti,flash0T<NULL>Cti,lm3644

The situation is more complicated than with the old module as the lm3644 driver takes over parts of the driver controlling pm8941@d300, which might be complicated to solve nicely on mainline.

The lm3644 is an i2c device sitting on the camera interface i2c bus. There's no driver in mainline for the lm3644 yet.

http://www.ti.com/lit/ds/symlink/lm3644.pdf

GPU / Camera / Audio

See Brian Masney's Nexus 5 mainline to-do list.

Kernel config options

Base config: qcom_defconfig

Kernel config option Function
CONFIG_USB_ETH_RNDIS USB networking
CONFIG_INPUT_PM8941_PWRKEY Power key
CONFIG_DRM_PANEL_SIMPLE Display
CONFIG_DMA_CMA Also display
CONFIG_INPUT_GPIO_VIBRA Vibration motor
CONFIG_LEDS_QCOM_LPG Notification leds
CONFIG_WCN36XX WiFi
CONFIG_BT_QCOMSMD Bluetooth
CONFIG_BATTERY_BMS Battery fuel gauge
CONFIG_SYSCON_REBOOT_MODE Reboot mode
CONFIG_I2C_QCOM_CCI Camera Control Interface

cmdline

rdinit=/init PMOS_NO_OUTPUT_REDIRECT cma=64m msm.vram=16m