Xiaomi Redmi 4 Prime (xiaomi-markw)

From postmarketOS
Xiaomi Redmi 4 Prime
xiaomi-markw showing neofetch
xiaomi-markw showing neofetch
Manufacturer Xiaomi
Name Redmi 4 Prime
Codename xiaomi-markw
Released 2016
Category community
Pre-built images yes
Original software Android (MIUI)
Original version 6.0.1
postmarketOS kernel mainline
Hardware
Chipset Qualcomm Snapdragon 625 (MSM8953)
CPU Octa-core 2 GHz Cortex-A53
GPU Adreno 506
Display 1080x1920 IPS
Storage 32 GB
Memory 3 GB
Architecture AArch64
Type handset
Features
USB Networking
Works
Flashing
Works
Touchscreen
Works
Display
Works
WiFi
Works
FDE
Works
Mainline
Works
Battery
Works
3D Acceleration
Works
Audio
Works
Bluetooth
Works
Camera
Partial
GPS
Partial
Mobile data
Partial
Internal storage
Works
SMS
Works
Calls
Works
USB OTG
Works
Sensors
Accelerometer
Works
Magnetometer
Works
Ambient Light
Partial
Proximity
Works
Misc
Built-in DVB
Camera Flash
Broken
Ir TX
Broken
Memory Card
Haptics
Broken
This device is based on the Snapdragon 625.
See the SoC page for common tips, guides and troubleshooting steps

Device Notes

Touch Screens

Touch Screen Status
atmel,maxtouch Partial
edt,edt-5336 (edt,edt-ft5x06) Works

Both variants of touch screen use the same pins, so we can't just enable both drivers at a same time. Starting from 6.7.9, we let lk2nd to enable a device tree node of a touch screen. The touch screen won't work until you update lk2nd. For now, lk2nd can only enable focaltech, so you need to build lk2nd by youself if you have atmel (just comment ft and uncomment atmel in dts/msm8953-xiaomi-markw.dts in the sources)

Modem

Voice calls are working, SMS - untested yet, but should work. Mobile data doesn't work for me (vipaol), but maybe you're lucky.

Cameras

Both sensors are working in megapixels, but camera switching doesn't work for an unknown reason (probably it used to be a bug of megapixels, but now we also have some problems with VFEs in the kernel). The config for megapixels is below:

markw:~$ cat /usr/share/megapixels/config/xiaomi,markw.ini
[device]
make=Xiaomi
model=Redmi 4 Prime

[rear]
driver=s5k3l8
media-driver=qcom-camss
capture-width=4208
capture-height=3120
capture-rate=30
capture-fmt=GRBG10P
preview-width=4208
preview-height=3120
preview-rate=30
preview-fmt=GRBG10P
rotate=270
media-links=s5k3l8 3-002d:0->msm_csiphy0:0,msm_csiphy0:1->msm_csid0:0,msm_csid0:1->msm_ispif0:0,msm_ispif0:1->msm_vfe0_rdi0:0

[front]
driver=ov5670
media-driver=qcom-camss
capture-width=2592
capture-height=1944
capture-rate=30
capture-fmt=GRBG10P
preview-width=2592
preview-height=1944
preview-rate=30
preview-fmt=GRBG10P
rotate=90
mirrored=true
flash-display=true
media-links=ov5670 4-0036:0->msm_csiphy2:0,msm_csiphy2:1->msm_csid1:0,msm_csid1:1->msm_ispif1:0,msm_ispif1:1->msm_vfe1_rdi1:0

Sometimes numbers of i2c buses with the cameras can be different (aliases in i2c should help, but the maintainer is lazy) and they should be changed in the config ("media-links" lines).

markw:~$ media-ctl -p | grep -E "s5|ov"
  <- "s5k3l8 3-002d":0 [ENABLED,IMMUTABLE]
  <- "ov5670 4-0036":0 [ENABLED,IMMUTABLE]
- entity 184: ov5670 4-0036 (1 pad, 1 link)
- entity 186: s5k3l8 3-002d (1 pad, 1 link)

# we can see rear camera on i2c-3, and front on 4

None of vfeX_rdiX other than vfe0_rdi0 don't work on recent kernel versions, so we can't use both cameras at a same time because we have only one working "output channel". Also csid2 doesn't work, but csid0 and csid1 work.

Sensors

Connected to i2c-gpio

Sensor Model Status
Accelerometer/Gyroscope bosch,bmi120 (bosch,bmi160) Works
Light/Proximity liteon,ltr559 (liteon,ltr501) Works
Magnetometer yamaha,yas537 (yamaha,yas530) Works

How to enter flash mode

[Power] + [Vol-] to fastboot mode

Installation

Icon WARNING: Installation on the internal memory will erase all your data!

Pre-built images

The device was moved to community recently, so can download a pre-built image.

  • You need only "<...>-xiaomi-markw-lk2nd.img.xz" and "<...>-xiaomi-markw.img.xz". lk2nd can boot from a file on the "pmOS_boot" subpartition, so you don't need "<...>-xiaomi-markw-boot.img.xz".

Follow the installation article to download image files. Once downloaded, decompress the files with unxz or any compatible graphical archiver.

Step 1. Flash rootfs:

- To SD-card
The downloaded rootfs img is a sparse img. You need to convert it to a normal img before flashing it to an SD-card:
$ simg2img <...>-xiaomi-markw.img nonsparse-converted.img
Then just write it using a tool for writing images.
- To internal memory
$ fastboot flash userdata <...>-xiaomi-markw.img

Step 2. Flash lk2nd:

Note Note: lk2nd is a hard dependency, without it the mainline kernel will not select the display panel and you'll get a black screen.
$ fastboot flash boot [the file that ends in -lk2nd.img]

lk2nd is a second stage bootloader that is used for some device-spicific hacks. It can boot from a file on the "pmOS_boot" subpartition, so we don't need to flash a boot.img.

If you see < waiting for any device >, try running as sudo and restart your device into fastboot mode again.

Manual build

  • Do not use "android recovery zip" method, because it can't install lk2nd and have some other problems.

Step 1. Flash rootfs:

- To SD-card
Find your SD-card: lsblk
Install (change /dev/sdX to your card)
$ pmbootstrap install --sdcard /dev/sdX
- To internal memory
$ pmbootstrap install
$ pmbootstrap flasher flash_rootfs

Step 2. Flash lk2nd:

Note Note: lk2nd is a hard dependency, without it the mainline kernel will not select the display panel and you'll get a black screen.
$ pmbootstrap flasher flash_lk2nd

lk2nd boots the kernel from file. Flashing the kernel is not needed

Users owning this device

  • Vipaol (Notes: (Ebbg/Atmel) Mainlining.)

Maintainer(s)

Contributors

See also