Jump to content

Xiaomi Redmi 4X (xiaomi-santoni): Difference between revisions

From postmarketOS Wiki
NatNamor (talk | contribs)
Bczeman (talk | contribs)
m Set camera flash to partial. (no v4l control for flash)
 
(29 intermediate revisions by 11 users not shown)
Line 6: Line 6:
| imagecaption = xiaomi-santoni running pmOS demos
| imagecaption = xiaomi-santoni running pmOS demos
| releaseyear = 2017
| releaseyear = 2017
| originalsoftware = Android 6.0 (can be upgradable to 7.1)
| originalsoftware = Android (MIUI)
| chipset = Qualcomm MSM8940 Snapdragon 435
| originalversion = 6.0
| extendedversion = 7.1
| chipset = Qualcomm Snapdragon 435 (MSM8940)
| cpu = Octa-core 1.4 GHz Cortex-A53
| cpu = Octa-core 1.4 GHz Cortex-A53
| gpu = Adreno 505
| gpu = Adreno 505
Line 14: Line 16:
| memory = 2 GB / 3 GB / 4 GB
| memory = 2 GB / 3 GB / 4 GB
| architecture = aarch64
| architecture = aarch64
| type = Handset
| status_usbnet = Y
| status_usbnet = Y
| status_flashing = Y
| status_flashing = Y
Line 20: Line 23:
| status_wifi = Y
| status_wifi = Y
| status_xwayland = Y
| status_xwayland = Y
| status_fde = P
| status_fde = Y
| status_mainline =
| status_mainline = Y
| status_battery = Y
| status_battery = Y
| status_3d =  
| status_3d = Y
| status_accel =  
| status_accel = N
| status_audio = Y
| status_audio = Y
| status_bluetooth = P
| status_bluetooth = Y
| status_camera = N
| status_camera = N
| status_gps =  
| status_cameraflash = P
| status_mobiledata =  
| status_gps = N
| status_sms =  
| status_mobiledata = N
| status_calls =  
| status_sms = N
| status_calls = N
| status_otg = Y
| status_otg = Y
| pmoskernel = 3.18.140
| status_sdcard = Y
| status_emmc = Y
| pmoskernel = 6.13
| genericdevice = Generic MSM89x7 (qcom-msm89x7)
| optionalgenericdevice = no
| whet_dhry = 1526.7
| whet_dhry = 1526.7
| booting = yes
| booting = yes
}}
}}{{Based on SoC|Qualcomm_Snapdragon_425/427/430/435_(MSM8917/MSM8920/MSM8937/MSM8940)|Snapdragon 435}}


== Contributors ==
== Contributors ==
Line 49: Line 57:
{{Device owners}}
{{Device owners}}


== What works ==
== Components ==
* Install to SD Card
* Boots
* Flashing
* Touch
* Wayland
* XWayland
* USB Ethernet/Internet
* WiFi
* Vibrator
* Audio
* Xorg
* USB OTG
* charging-sdl
 
== What does not work ==
* Camera
* GPS
* Mobile Data
* SMS
* Calls
* Accelerometers
* Bluetooth (partially)
* 3D Acceleration (possible on mainline)
* Display Power Management on Wayland
* Full Disk Encryption (does unlock, but failed to look up the partition after booting)
 
== Bugs? ==
* alsamixer doesn't work, will result in a error telling mixer controls doesn't exist, workaround to control the volume is to use PulseAudio.
 
== Mainline kernel? ==
There's ongoing effort to bring up mainline kernel on MSM8937 platform, with initial focus on santoni: [https://github.com/dreemurrs-embedded/santoni-linux].
 
MSM8937/40 is pretty close to [https://wiki.postmarketos.org/wiki/Qualcomm_Snapdragon_410/412_(MSM8916) MSM8916], so a lot of drivers can be re-used with proper device tree and minimal address remapping in some places.


{| class="wikitable"
{| class="wikitable"
Line 116: Line 91:
| scope="row"| Magnetometer
| scope="row"| Magnetometer
| YAS537
| YAS537
| No
| Yes ([https://github.com/torvalds/linux/blob/master/drivers/iio/magnetometer/yamaha-yas530.c yamaha-yas530.c])
|-
|-
| scope="row"| Sound
| scope="row"| Sound
Line 134: Line 109:
| No
| No
|}
|}
== More information on this port ==
* The upstream msm-3.18 kernel is a fork of https://github.com/bitrvmpd/msm-3.18
* Most of this work was done for my project ([https://github.com/danct12/arch-linux-santoni Arch Linux on Redmi 4X]), and the progress are backported to postmarketOS in order to help development.


== Bootloader Unlocking ==
== Bootloader Unlocking ==
Line 143: Line 114:


The device will not unlock if the device isn't 7 days old (from the time when your device connects to internet and powered on)
The device will not unlock if the device isn't 7 days old (from the time when your device connects to internet and powered on)
If unlock fails at "Can't get info", start unlock process, disconnect USB and reconnect it once the counter hits 99%.


== Key combinations for entering Recovery/Fastboot ==
== Key combinations for entering Recovery/Fastboot ==
Line 154: Line 127:


== Installation ==
== Installation ==
[[Installation guide|Installation]] over fastboot works, Android recovery zip installation is untested.
* Follow the [[Installation guide]]
{{Note|'''Warning:''' Flashing [[lk2nd]] is '''required''', as it is a hard dependency.}}
<syntaxhighlight lang="shell-session">
$ pmbootstrap init # choose Vendor: qcom Device codename: msm89x7
$ pmbootstrap install
$ pmbootstrap flasher flash_lk2nd
$ pmbootstrap flasher flash_rootfs
</syntaxhighlight>


== Bluetooth ==
== Serial Connection (UART)==
Bluetooth on this phone is using the WCNSS chip, which provides two SMD channels to the BT core, one for command and one for event packets. Support for  Bluetooth HCI SMD can be added using [https://gitlab.com/postmarketOS/pmaports/blob/master/device/linux-xiaomi-santoni/bt-hci-smd.patch this patch].
The Serial Connection of the santoni has been tested only on reception mode, with 3.3v TTL to USB FT232RL. [https://pastebin.com/hpFCKtjA This example] is an output when starting to fastboot.


With that patch applied, the Bluetooth interface can be bring up by set /sys/module/hci_smd/parameters/hcismd_set to 1. Then install bluez, start the service and use bluetoothctl to control it.
Warning: the test point is very small, try to solder only if you're an expert on soldering or you may break the motherboard wirings.


As right now, it seems to connect, but disconnect very quickly, it doesn't ask for pair code when connecting, so this needs to be investigated.
Wiring: (Santoni TX --> FT232RL RX) and (Santoni GND --> FT232RL GND)


== libhybris ==
<gallery>
Hybris implementation for this device has been added in [https://gitlab.com/postmarketOS/pmaports/merge_requests/420 !420]. test_hwcomposer_7_caf passes, and even hwcomposer driver for X11 works!
File:santoni-uart-1.png|frame|left|UART connected to GPIO 4,5
 
File:santoni-uart-2.png|frame|left|UART connected to GPIO 4,5
You can download Halium image for use here:
File:santoni-uart-3.png|frame|left|UART connected to TP29 (TX) and TP30 (RX)
https://github.com/dreemurrs-embedded/halium-santoni
File:santoni-uart-4.png|frame|left|Location of TP29 on front side of motherboard
 
File:santoni-uart-5.png|frame|left|Location of TP30 on front side of motherboard
[[File:Hybris-santoni-howto.png]]
File:santoni-uart-6.jpg|frame|left|Location of TP29 and GND
 
File:santoni-uart-7.jpg|frame|left|Example of connection, in this case RX is not used.
After downloading the system image, drop it to '''/var/lib/lxc/android/system.img''' in the device's rootfs.
File:santoni-uart-8.jpg|frame|left|All the wiring done.
 
</gallery>
As for the HWcomposer implementation for X11, it's not that fast and there are artifacts on the screen, and [https://user-images.githubusercontent.com/13084776/49331880-06657c00-f5b5-11e8-915a-a33be2b15bc7.jpg kwin on this device gives repeating texture].


== Photos ==
== Photos ==
Line 187: Line 166:
* [https://twrp.me/xiaomi/xiaomiredmi4x.html Official TWRP image for Redmi 4X (santoni)]
* [https://twrp.me/xiaomi/xiaomiredmi4x.html Official TWRP image for Redmi 4X (santoni)]
* [https://github.com/MiCode/Xiaomi_Kernel_OpenSource/tree/santoni-n-oss Xiaomi Redmi 4X Official Kernel Source]
* [https://github.com/MiCode/Xiaomi_Kernel_OpenSource/tree/santoni-n-oss Xiaomi Redmi 4X Official Kernel Source]
* [https://github.com/Danct12/msm-3.18/tree/rel/msm-3.18-gnulinux msm-3.18 upstreamed kernel for santoni]
* [https://gitlab.postmarketos.org/postmarketOS/pmaports/merge_requests/335 Pull request !335 for osk-sdl]
* [https://gitlab.com/postmarketOS/pmaports/merge_requests/289 Pull request for msm-3.18 upstreamed kernel]
* [https://github.com/dreemurrs-embedded/arch-linux-santoni Arch Linux on Santoni] with 3.18 kernel (historic)
* [https://gitlab.com/postmarketOS/pmaports/merge_requests/335 Pull request !335 for osk-sdl]
 
[[Category:Devices with known UART pinout]]

Latest revision as of 23:06, 16 March 2025

Note This device is supported as part of a generic port. Refer to Generic MSM89x7 (qcom-msm89x7) for installation instructions and more information.
Xiaomi Redmi 4x
xiaomi-santoni running pmOS demos
xiaomi-santoni running pmOS demos
Manufacturer Xiaomi
Name Redmi 4x
Codename xiaomi-santoni
Released 2017
Type handset
Hardware
Chipset Qualcomm Snapdragon 435 (MSM8940)
CPU Octa-core 1.4 GHz Cortex-A53
GPU Adreno 505
Display 720x1280
Storage 16 GB / 32 GB / 64GB
Memory 2 GB / 3 GB / 4 GB
Architecture aarch64
Software
Original software Android (MIUI)
Original version 6.0
Extended version 7.1
postmarketOS
Category testing
Pre-built images no
Mainline yes
postmarketOS kernel 6.13
Unixbench Whet/Dhry score 1526.7
Generic port Generic MSM89x7 (qcom-msm89x7)
Features
Flashing
Works
USB Networking
Works
Internal storage
Works
SD card
Works
Battery
Works
Screen
Works
Touchscreen
Works
Multimedia
3D Acceleration
Works
Audio
Works
Camera
Broken
Camera Flash
Partial
Connectivity
WiFi
Works
Bluetooth
Works
GPS
Broken
NFC
No data
Modem
Calls
Broken
SMS
Broken
Mobile data
Broken
Miscellaneous
FDE
Works
USB OTG
Works
HDMI/DP
No data
Sensors
Accelerometer
Broken
Magnetometer
No data
Ambient Light
No data
Proximity
No data
Hall Effect
No data
Haptics
No data
Barometer
No data

Contributors

  • pinoaffe
  • asriel-danctnix
  • Danct12

Maintainer(s)

  • Danct12

Users owning this device


Components

Parts Components In Torvalds tree?
Chipset MSM8940 No
GPU Adreno 505 Yes (a5xx_gpu.c)
Touch Screen FT5X06 Yes (edt-ft5x06.c)
Fingerprint Sensor FPC1020/Goodix No
Accelerometer + Gyroscope ICM20607/BMI120 No/Yes (bmi160_i2c.c)
ALSPS STK3X1X Yes (stk3310.c)
Magnetometer YAS537 Yes (yamaha-yas530.c)
Sound AW87319 No
Notifications LED AW2013 Yes (leds-aw2013.c)
Front Camera OV5675 Yes (ov5675.c)
Back Camera S5K3L8 No

Bootloader Unlocking

Like other Xiaomi devices, the user will have to acquire the bootloader unlock key: https://en.miui.com/unlock

The device will not unlock if the device isn't 7 days old (from the time when your device connects to internet and powered on)

If unlock fails at "Can't get info", start unlock process, disconnect USB and reconnect it once the counter hits 99%.

Key combinations for entering Recovery/Fastboot

Recovery

  • Turn the device off (or restart also works)
  • Hold both volume buttons (+ and -) and power button
  • Keep holding until you got to recovery.

Fastboot

  • Same as recovery, but this time hold the volume down key instead of both keys.

Installation

Note Warning: Flashing lk2nd is required, as it is a hard dependency.
$ pmbootstrap init # choose Vendor: qcom Device codename: msm89x7
$ pmbootstrap install
$ pmbootstrap flasher flash_lk2nd
$ pmbootstrap flasher flash_rootfs

Serial Connection (UART)

The Serial Connection of the santoni has been tested only on reception mode, with 3.3v TTL to USB FT232RL. This example is an output when starting to fastboot.

Warning: the test point is very small, try to solder only if you're an expert on soldering or you may break the motherboard wirings.

Wiring: (Santoni TX --> FT232RL RX) and (Santoni GND --> FT232RL GND)

Photos

See also