Jump to content

Xiaomi Redmi 4 Prime (xiaomi-markw): Difference between revisions

From postmarketOS Wiki
Vipaol (talk | contribs)
No edit summary
 
(26 intermediate revisions by 5 users not shown)
Line 20: Line 20:
| status_usbnet = Y
| status_usbnet = Y
| status_flashing = Y
| status_flashing = Y
| status_touch = P
| status_touch = Y
| status_screen = Y
| status_screen = Y
| status_wifi = Y
| status_wifi = Y
| status_xwayland = Y
| status_xwayland = Y
| status_fde = N
| status_fde = Y
| status_mainline = Y
| status_mainline = Y
| status_battery = Y
| status_battery = Y
| status_3d = Y
| status_3d = Y
| status_audio = Y
| status_audio = P
| status_bluetooth = Y
| status_bluetooth = Y
| status_camera = N
| status_camera = P
| status_gps = N
| status_gps = P
| status_mobiledata = N
| status_mobiledata = P <!-- y? -->
| status_sms = N
| status_sms = Y
| status_calls = N
| status_calls = Y
| status = <!-- Text displayed in the "not booting" table on the Devices page , e.g "kernel compiles, doesn't boot" -->
| status = <!-- Text displayed in the "not booting" table on the Devices page , e.g "kernel compiles, doesn't boot" -->
| status_otg = Y
| status_otg = Y
Line 46: Line 46:
| status_irrx = -
| status_irrx = -
| status_stylus = -
| status_stylus = -
| status_haptics = N
| status_haptics = Y
| status_ethernet = -
| status_ethernet = -
| status_trustzone = <!-- TrustZone works -->
| status_trustzone = <!-- TrustZone works -->
Line 57: Line 57:
| status_powersensor = -
| status_powersensor = -
| status_fossbootloader = -
| status_fossbootloader = -
| status_emmc = Y
| booting = yes <!-- The device is booting at all, can be yes/no *IMPORTANT* -->
| booting = yes <!-- The device is booting at all, can be yes/no *IMPORTANT* -->
| pmoskernel = mainline
| pmoskernel = mainline
Line 67: Line 68:


== Device Notes ==
== Device Notes ==
=== Display Panels and Touch Screens ===
=== Touch Screens ===


{| class="wikitable"
{| class="wikitable"
|-
|-
! Display
! Touch Screen
! Status
! Touch
! Status
! Status
|-
|-
| Ebbg
| class="feature feature-yes" | Works
| [https://github.com/torvalds/linux/blob/master/drivers/input/touchscreen/atmel_mxt_ts.c atmel,maxtouch]
| [https://github.com/torvalds/linux/blob/master/drivers/input/touchscreen/atmel_mxt_ts.c atmel,maxtouch]
| class="feature feature-partial" | Partial
| class="feature feature-partial" | Partial
|-
|-
| Tianma
| edt,edt-5336 ([https://github.com/torvalds/linux/blob/master/drivers/input/touchscreen/edt-ft5x06.c edt,edt-ft5x06])
| class="feature feature-yes" | Works
| class="feature feature-yes" | Works
| edt,edt-5336 ([https://github.com/torvalds/linux/blob/master/drivers/input/touchscreen/edt-ft5x06.c edt,edt-ft5x06])
| class="feature feature-partial" | Partial
|}
|}


<b>A temp solution is applied, touchscreens should work for now: https://gitlab.com/postmarketOS/pmaports/-/merge_requests/4631</b>
Both variants of touch screen use the same pins, so we can't just enable both drivers at a same time.
<b>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.</b>
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. <s>''Mobile data doesn't work for me (vipaol), but maybe you're lucky.''</s> Mobile data works fine (apertureua), was this fixed?


=== Sound ===
Appears to struggle from a broken PipeWire config on UIs that use it as of March 2025, see [[Sxmo/Sound]]


Touch screens are unstable due to a [https://gist.github.com/vipaoL/a393aa2fd81b9277d81be82e8ef9e891 conflict of their drivers] (initialization on boot may fail, but if it is successful, the driver will work until the device is rebooted). If the touch screen does not work, you can reboot the device several times or reload the driver manually:
=== Cameras ===
<source lang="shell-session">
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). <s>The config for megapixels is below: ...</s> Now megapixels have [https://gitlab.com/megapixels-org/Megapixels/-/blob/legacy/config/xiaomi,markw.ini config for markw] out of the box.
$ sudo rmmod atmel_mxt_ts ; sudo modprobe atmel_mxt_ts # if your ts is atmel
</source>
<source lang="shell-session">
$ sudo rmmod edt-ft5x06 ; sudo modprobe edt-ft5x06 # if your ts is focaltech
</source>


== How to enter flash mode ==
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).
[Power] + [Vol-] to fastboot mode
<syntaxhighlight lang="shell-session">
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)


== Installation ==
# we can see rear camera on i2c-3, and front on 4
{{warning|Installation on the internal memory will erase all your data!}}
</syntaxhighlight>
===Pre-built images===
The device was moved to community recently, so can [https://postmarketos.org/download/ 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 <code>unxz</code> or any compatible graphical archiver.


====Step 1. Flash rootfs:====
None of vfeX_rdiX other than vfe0_rdi0 will 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.
; - 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: <source lang="shell-session">
$ simg2img <...>-xiaomi-markw.img nonsparse-converted.img
</source>
:: Then just write it using a tool for writing images.
; - To internal memory
:: <source lang="shell-session">
$ fastboot flash userdata <...>-xiaomi-markw.img
</source>
 
====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'''.}}
:: <source lang="shell-session">
$ fastboot flash boot [the file that ends in -lk2nd.img]
</source>
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 <code>< waiting for any device ></code>, try running as <code>sudo</code> 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: <code>lsblk</code>
:: Install (change /dev/sdX to your card) <source lang="shell-session">$ pmbootstrap install --sdcard /dev/sdX</source>
; - To internal memory
:: <source lang="shell-session">$ pmbootstrap install
$ pmbootstrap flasher flash_rootfs</source>
 
====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'''.}}
<source lang="shell-session">$ pmbootstrap flasher flash_lk2nd</source>
[[lk2nd]] boots the kernel from file. Flashing the kernel is not needed


=== Sensors ===
=== Sensors ===
Line 166: Line 130:
| class="feature feature-yes" | Works
| class="feature feature-yes" | Works
|}
|}
=== UART ===
The working voltage is 1.8 V.
<b>Warning: the test points are very small, soldering is not recommended. It's probably better to just hold a wire with a hard thin end with your hands.</b>
[[File:xiaomi-markw_uart.jpg|200px]]
See also: [[Serial debugging]]
== How to enter flash mode ==
[Power] + [Vol-] to fastboot mode
== Installation ==
{{Note|The device now uses the [[Generic_MSM8953_(qcom-msm8953)|generic device port]]. You need to select '''qcom-msm8953 (Generic MSM8953)''' instead of xiaomi-markw.}}
{{warning|Installation on the internal memory will erase all your data!}}
===Pre-built images===
[https://postmarketos.org/download/ Download] the image and lk2nd for '''Generic MSM8953'''. Once downloaded, extract the files with <code>unxz</code> or any compatible 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: <syntaxhighlight lang="shell-session">
$ simg2img <...>-qcom-msm8953.img nonsparse-converted.img
</syntaxhighlight>
:: Then just write it using a tool for writing images.
; - To internal memory
:: <syntaxhighlight lang="shell-session">
$ fastboot flash userdata <...>-qcom-msm8953.img
</syntaxhighlight>
====Step 2. Flash lk2nd:====
:: <syntaxhighlight lang="shell-session">
$ fastboot flash boot <...>-lk2nd.img
</syntaxhighlight>
lk2nd is a second stage bootloader that is used for booting the generic image and for some device-specific hacks. It boots the kernel with initramfs from the "pmOS_boot" subpartition using extlinux.
If you see <code>< waiting for any device ></code>, try running as <code>sudo</code> and restart your device into fastboot mode again.
===Manual build===
{{Note|The device now uses the [[Generic_MSM8953_(qcom-msm8953)|generic device port]]. You need to select '''qcom-msm8953''' instead of xiaomi-markw.}}
====Step 1. Flash rootfs:====
; - To SD-card:
:: Find your SD-card: <code>lsblk</code>
:: Install (change /dev/sdX to your card) <syntaxhighlight lang="shell-session">$ pmbootstrap install --sdcard /dev/sdX</syntaxhighlight>
; - To internal memory
:: <syntaxhighlight lang="shell-session">$ pmbootstrap install
$ pmbootstrap flasher flash_rootfs</syntaxhighlight>
====Step 2. Flash lk2nd:====
<syntaxhighlight lang="shell-session">$ pmbootstrap flasher flash_lk2nd</syntaxhighlight>
lk2nd is a second stage bootloader that is used for booting the generic image and for some device-specific hacks. It boots the kernel with initramfs from the "pmOS_boot" subpartition using extlinux, so you '''don't''' need to use flash_kernel


== Users owning this device ==
== Users owning this device ==
Line 181: Line 195:


== See also ==
== See also ==
* {{Device package|xiaomi-markw}}, msm8953 {{Kernel package|postmarketos-qcom-msm8953}}, {{Firmware package|xiaomi-markw}}
* {{Device package|qcom-msm8953|community}}
* {{Kernel package|postmarketos-qcom-msm8953|community}}
* {{Firmware package|qcom-msm8953|community}}
* [https://github.com/msm8953-mainline/linux/ mainline kernel sources]
* [https://github.com/msm8953-mainline/linux/ mainline kernel sources]
* [https://github.com/msm8953-mainline/lk2nd/ lk2nd sources]
* [https://github.com/msm8916-mainline/lk2nd/ lk2nd sources]
* [https://deviceinfohw.ru/devices/item.php?item=77832 Device Info HW database entry]
* [https://deviceinfohw.ru/devices/item.php?item=77832 Device Info HW database entry]
* [https://www.gsmarena.com/xiaomi_redmi_4_prime-8263.php GSMArena page]
* [https://www.gsmarena.com/xiaomi_redmi_4_prime-8263.php GSMArena page]
Line 194: Line 210:
* [https://redmine.replicant.us/projects/replicant/wiki/GalaxyS2I9100 Replicant wiki page]
* [https://redmine.replicant.us/projects/replicant/wiki/GalaxyS2I9100 Replicant wiki page]
-->
-->
[[Category:Devices with known UART pinout]]

Latest revision as of 20:19, 6 March 2025

Xiaomi Redmi 4 Prime
xiaomi-markw showing neofetch
xiaomi-markw showing neofetch
Manufacturer Xiaomi
Name Redmi 4 Prime
Codename xiaomi-markw
Released 2016
Type handset
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
Software
Original software Android (MIUI)
Original version 6.0.1
postmarketOS
Category community
Pre-built images yes
postmarketOS kernel mainline
Features
Flashing
Works
USB Networking
Works
Internal storage
Works
SD card
No data
Battery
Works
Screen
Works
Touchscreen
Works
Multimedia
3D Acceleration
Works
Audio
Partial
Camera
Partial
Camera Flash
Broken
IR TX
Broken
Connectivity
WiFi
Works
Bluetooth
Works
GPS
Partial
Modem
Calls
Works
SMS
Works
Mobile data
Partial
Miscellaneous
FDE
Works
USB OTG
Works
Sensors
Accelerometer
Works
Magnetometer
Works
Ambient Light
Partial
Proximity
Works
Haptics
Works

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. Mobile data works fine (apertureua), was this fixed?

Sound

Appears to struggle from a broken PipeWire config on UIs that use it as of March 2025, see Sxmo/Sound

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: ... Now megapixels have config for markw out of the box.

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 will 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

UART

The working voltage is 1.8 V. Warning: the test points are very small, soldering is not recommended. It's probably better to just hold a wire with a hard thin end with your hands.

See also: Serial debugging

How to enter flash mode

[Power] + [Vol-] to fastboot mode

Installation

Note The device now uses the generic device port. You need to select qcom-msm8953 (Generic MSM8953) instead of xiaomi-markw.
Warning WARNING: Installation on the internal memory will erase all your data!

Pre-built images

Download the image and lk2nd for Generic MSM8953. Once downloaded, extract the files with unxz or any compatible 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 <...>-qcom-msm8953.img nonsparse-converted.img
Then just write it using a tool for writing images.
- To internal memory
$ fastboot flash userdata <...>-qcom-msm8953.img

Step 2. Flash lk2nd:

$ fastboot flash boot <...>-lk2nd.img

lk2nd is a second stage bootloader that is used for booting the generic image and for some device-specific hacks. It boots the kernel with initramfs from the "pmOS_boot" subpartition using extlinux.

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

Manual build

Note The device now uses the generic device port. You need to select qcom-msm8953 instead of xiaomi-markw.

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:

$ pmbootstrap flasher flash_lk2nd

lk2nd is a second stage bootloader that is used for booting the generic image and for some device-specific hacks. It boots the kernel with initramfs from the "pmOS_boot" subpartition using extlinux, so you don't need to use flash_kernel

Users owning this device

  • ApertureUA (Notes: Atmel with green lightsaber stripe in the middle focaltech, unlocked with aboot patch)
  • Vipaol (Notes: pmOS,Ebbg+Atmel)

Maintainer(s)

Contributors

See also