Xiaomi Mi A2 (xiaomi-jasmine)

From postmarketOS
Xiaomi Mi A2
Xiaomi Mi A2
Xiaomi Mi A2
Manufacturer Xiaomi
Name Mi A2
Codename xiaomi-jasmine_sprout
Released 2018
Category testing
Pre-built images no
Original software Android (MIUI)
Original version 8.1
postmarketOS kernel 4.4.226
Hardware
Chipset Qualcomm Snapdragon 660 (SDM660)
CPU 8-core (4x 2.2 GHz Kryo 260 & 4x 1.8 GHz Kryo 260)
GPU Adreno 512
Display 1080 x 2160 LTPS IPS LCD
Storage 32/64/128 GB
Memory 4/6 GB
Architecture AArch64
Type Handset
Features
USB Networking
Works
Flashing
Works
Touchscreen
Works
Display
Works
WiFi
Broken
FDE
Mainline
Broken
Battery
3D Acceleration
Broken
Audio
Broken
Bluetooth
Broken
Camera
Broken
GPS
Broken
Mobile data
Broken
Internal storage
SMS
Broken
Calls
Broken
USB OTG
NFC
Sensors
Accelerometer
Broken
Magnetometer
Ambient Light
Proximity
Hall Effect
Barometer
Power Sensor
Misc
Built-in DVB
Camera Flash
Keyboard
Touchpad
USB-A
HDMI/DP
Ir TX
Ir RX
Stylus
Memory Card
Haptics
Ethernet
FOSS bootloader


Contributors

Maintainer(s)

Users owning this device


Notes

This device is quite similar to the Xiaomi Redmi Note 7 (xiaomi-lavender) and Xiaomi Redmi Note 8T (xiaomi-willow), and many of the issues were solved with steps from that devices pages, so if you're hacking on the Mi A2 it's a good idea to read the xiaomi-lavender and the xiaomi-willow page closely.

LED / Torch / Screen brightness / Vibrator

Write brightness or boolean value to specific sysfs files:

  • Front panel LED light [0-255]: /sys/class/leds/white/{brightness,blink}
  • Torch light [0-255]: /sys/class/leds/flashlight/brightness (torch_0 is cold light, torch_1 is warm light)
  • Screen brightness [0-255]: /sys/class/leds/lcd-backlight/brightness
  • Vibrator [Miliseconds]: /sys/class/timed_output/vibrator/enable

Example: echo 255 > /sys/class/leds/lcd-backlight/brightness That maximizes the brightness of the screen

How to enter flash mode

Bootloader Unlocking

Because this device is an Android One device, it can be unlocked using fastboot oem unlock and then fastboot flashing unlock_critical from fastboot mode.

Recovery mode

  • Turn the device off (or restart also works)
  • Hold Volume Up and Power button
  • Once you feel vibration and phone turns on, release Power button
  • Keep holding Volume Up until you get to recovery.

Flashing (Download, Fastboot) mode

  • Same as recovery, but this time hold the Volume Down and Power keys.

Installation

  • Install pmbootstrap.
  • Download the device/linux package from my Github (because it is not merged) and paste it into your pmaports/device folder.
  • pmbootstrap -y zap; pmbootstrap init, choose xiaomi-jasmine_sprout as your device
    • Weston, XFCE4, and GNOME have been successfully tested. Phosh and Plasma Mobile do not work
  • pmbootstrap install
  • Enter fastboot, plug USB into computer
  • pmbootstrap flasher flash_kernel
  • pmbootstrap flasher flash_rootfs
  • pmbootstrap flasher flash_vbmeta
  • Reboot, sometimes fastboot reboot works, otherwise hold down Power until it reboots to system.
  • Hopefully weston comes up with postmarketos-demos.
  • ssh user@172.16.42.1

Hardware

Touchscreen Novatek NT36672
Main cameras (front/back) Sony IMX376
Secondary back camera Sony IMX486
Proximity sensor Liteon LTR-579ALS
Gyroscope Bosch BMI120
Compass AKM AK09918
IR Blaster Willsemi WNM2046
WiFi/Bluetooth Qualcomm WCN3980
RFFE Qualcomm QET4101
Audio amplifier Texas Instruments TAS2555
Quick Charge Controller (PMIC?) Qualcomm SMB1351

UART

Bootloader UART logs:

Format: Log Type - Time(microsec) - Message - Optional Info
Log Type: B - Since Boot(Power On Reset),  D - Delta,  S - Statistic
S - QC_IMAGE_VERSION_STRING=BOOT.XF.1.4-00262-S660LZB-1
S - IMAGE_VARIANT_STRING=Sdm660LA
S - OEM_IMAGE_VERSION_STRING=c3-bsp-builder-job004.bj
S - Boot Interface: eMMC
S - Secure Boot: On
S - Boot Config @ 0x00786070 = 0x000001c1
S - JTAG ID @ 0x00786130 = 0x0008c0e1
S - OEM ID @ 0x00786138 = 0x00000000
S - Serial Number @ 0x00784138 = 0xf688ea69
S - Feature Config Row 0 @ 0x007841a0 = 0x0050200010f80000
S - Feature Config Row 1 @ 0x007841a8 = 0x00000000000000c0
S - Core 0 Frequency, 3715 MHz
S - PBL Patch Ver: 5
S - I-cache: On
S - D-cache: On
B -         0 - PBL, Start
B -      7027 - bootable_media_detect_entry, Start
B -     80724 - bootable_media_detect_success, Start
B -     80730 - elf_loader_entry, Start
B -     82294 - auth_hash_seg_entry, Start
B -    109960 - auth_hash_seg_exit, Start
B -    160810 - elf_segs_hash_verify_entry, Start
B -    210662 - elf_segs_hash_verify_exit, Start
B -    210678 - auth_xbl_sec_hash_seg_entry, Start
B -    239734 - auth_xbl_sec_hash_seg_exit, Start
B -    239736 - xbl_sec_segs_hash_verify_entry, Start
B -    246449 - xbl_sec_segs_hash_verify_exit, Start
B -    246494 - PBL, End
B -    272487 - SBL1, Start
B -    387960 - usb: hs_phy_nondrive_start
B -    388295 - usb: hs_phy_nondrive_finish
B -    391162 - boot_flash_init, Start
D -         0 - boot_flash_init, Delta
B -    398513 - sbl1_ddr_set_default_params, Start
D -       122 - sbl1_ddr_set_default_params, Delta
B -    406473 - boot_config_data_table_init, Start
B -    425810 - Using default CDT
D -     14823 - boot_config_data_table_init, Delta - (0 Bytes)
B -    427732 - CDT Version:3,Platform ID:8,Major ID:1,Minor ID:0,Subtype:0
B -    433191 - Image Load, Start
D -     17660 - Auth Metadata
D -       488 - Segments hash check
D -     28091 - PMIC Image Loaded, Delta - (34240 Bytes)
B -    464545 - pm_device_init, Start
B -    471774 - PM: PON REASON: PM0=0x8000028000000001:0x0 PM1=0x8000088000000020:0x0 
B -    513986 - PM: SET_VAL:Skip
D -     45079 - pm_device_init, Delta
B -    515907 - pm_driver_init, Start
B -    523075 - PM: OCP Clearing for L4A is Skipped :PM660 is not supported the LDO4
D -      4239 - pm_driver_init, Delta
B -    530120 - pm_sbl_chg_init, Start
B -    535549 - PM: Trigger FG IMA Reset
B -    537013 - PM: Trigger FG IMA Reset.Completed
B -    541893 - PM: EntryVbat: 4202; EntrySOC: -1
B -    545065 - PM: BATT TEMP: 27 DegC
D -     16226 - pm_sbl_chg_init, Delta
B -    552843 - vsense_init, Start
D -         0 - vsense_init, Delta
B -    608749 - Pre_DDR_clock_init, Start
D -       396 - Pre_DDR_clock_init, Delta
D -         0 - sbl1_ddr_set_params, Delta
B -    620309 - DSF version = 35.0, DSF RPM version = 22.0
B -    620309 - Max Frequency = 1804 MHz
B -    624426 - do_ddr_training, Start
B -    636840 - Bootup frequency set to 1296000
D -      8814 - do_ddr_training, Delta
B -    656756 - clock_init, Start
D -       274 - clock_init, Delta
B -    659227 - Image Load, Start
D -      2501 - APDP Image Loaded, Delta - (0 Bytes)
B -    664808 - usb: EMMC Serial - 2a2bca61
B -    669536 - usb: fedl, vbus_low
B -    676764 - PM: 0: PON=0x1:HARD_RESET: ON=0x80:PON_SEQ: POFF=0x2:PS_HOLD: OFF=0x80:POFF_SEQ
B -    676856 - PM: 1: PON=0x20:PON1: ON=0x80:PON_SEQ: POFF=0x8:GP1: OFF=0x80:POFF_SEQ
B -    685152 - PM: SMEM Chgr Info Write Success
B -    692533 - alloc smem for SMEM_ID_VENDOR2 successful
B -    697077 - sbl1_efs_handle_cookies, Start
D -       762 - sbl1_efs_handle_cookies, Delta
B -    706166 - Image Load, Start
D -     19764 - Auth Metadata
D -      1037 - Segments hash check
D -     27481 - QSEE Dev Config Image Loaded, Delta - (42084 Bytes)
B -    736148 - Image Load, Start
D -       579 - SEC Image Loaded, Delta - (4096 Bytes)
B -    744993 - Image Load, Start
D -     57127 - Auth Metadata
D -     18269 - Segments hash check
D -     98362 - QSEE Image Loaded, Delta - (1946008 Bytes)
B -    845216 - Image Load, Start
D -     19764 - Auth Metadata
D -      4026 - Segments hash check
D -     34038 - QHEE Image Loaded, Delta - (273136 Bytes)
B -    881297 - Image Load, Start
D -     19856 - Auth Metadata
D -      2196 - Segments hash check
D -     33184 - RPM Image Loaded, Delta - (219340 Bytes)
B -    917226 - Image Load, Start
D -      4331 - STI Image Loaded, Delta - (0 Bytes)
B -    925065 - Image Load, Start
D -     19764 - Auth Metadata
D -      1586 - Segments hash check
D -     28273 - ABL Image Loaded, Delta - (146000 Bytes)
B -    955656 - Image Load, Start
D -     20374 - Auth Metadata
D -     13969 - Segments hash check
D -     50843 - APPSBL Image Loaded, Delta - (1792000 Bytes)
B -   1008879 - SBL1, End
D -    741302 - SBL1, Delta
S - Flash Throughput, 95000 KB/s  (4462116 Bytes,  46962 us)
S - DDR Frequency, 1296 MHz


UEFI Start     [ 1182] SEC
PROD Mode   : On
DEBUG Mode : On
ASLR        : On
Timer Delta : +7 mS
RAM Entry 0 : Base 0x0000000080000000  Size 0x0000000080000000
RAM Entry 1 : Base 0x0000000100000000  Size 0x000000007E4C0000
UEFI Ver    : 4.2.181123.BOOT.XF.1.4-00262-S660LZB-1
Build Info  : 64b Nov 23 2018 20:52:46
Boot Device : eMMC
DALLOG Device [0x2000145]: Cannot turn on source[ACPL
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, PmicDxe:: PmicSchgSetChargerDefaultSetting Setting ICL = 500 mA 
1, PmicDxe:: PmicSchgInitialChargerCheckup APSD done status: 0, Port Type = 8 
1, 1, 1, 1, QcomChargerDxe:: ChargerPlatform_Init Enabled WDOG.
Setvariable returned Success
zjl  haptic_on
zjl  haptic_off
[CheckPanel] panel reg[0xc] value: 0x00000007, uReponseSize:2
Panel_CDP_GetID: temp1 =0;temp2 =1
Display:jdi nt36672!
ReadKeyInternal: gEfiSimpleTextInputExProtocolGuid handles = 3
ReadKeyInternal: Read KEY = 0x0
 bootstate = 0
PanelWidth=1080,PanelHeight=2160
ImageWidth=1080,ImageHeight=2160,LogoPosX=0,LogoPosY=0
Avoid flicking for 2160x1080 images 
PanelWidth=1080,PanelHeight=2160
Render Splash  [ 1913]
EnvDxe Render Callback
LoadSecureApps: Load app from partition(keymaster): Status = 0x0, AppId = 65537
APC1 IDDQ WC 0 , L2:0, CPU[0]:175, CPU[1]:175, CPU[2]:175, CPU[3]:175
 APC1 Total 700
Load CPU 0 Slp: 0x8A, Int: 0xA
Load CPU 1 Slp: 0x1, Int: 0x0
Load CPU 2 Slp: 0xB3, Int: 0x1F
Load CPU 3 Slp: 0x1, Int: 0x0
GLD IDDQ WC 0
CPU PART GOOD [0x0] SUB_BIN[0x0]
-----------------------------
Platform Init  [ 2073] BDS
UEFI Ver   : 4.2.181123.BOOT.XF.1.4-00262-S660LZB-1
Platform   : MTP
Chip Name  : SDM660
Chip Ver   : 1.0
Core 0 Freq: 1382400 MHz
-----------------------------
2, ChargerLib:: ChargerLib_GetErrors Battery Presence = 1 
ChargerLib:: ChargerLib_GetBatteryID BATT_ID_2 = 68589 
2, PmicDxe:: PmicFgCommon_GetBatteryStatus StateOfCharge = 98, VBat = 4206 mV Current = 205 mA Temperature = 27 C
2, PmicDxe:: PmicFgCommon_GetBatteryStatus StateOfCharge = 98, VBat = 4206 mV Current = 205 mA Temperature = 27 C
ChargerLib::ChargerLib_GetErrors ERROR Charging source not detected 
2, 2, 2, 2, 2, 2, 2, ChargerLib:: ChargerLib_GetErrors Battery Presence = 1 
ChargerLib:: ChargerLib_GetBatteryID BATT_ID_2 = 68589 
2, PmicDxe:: PmicFgCommon_GetBatteryStatus StateOfCharge = 98, VBat = 4206 mV Current = 205 mA Temperature = 27 C
2, PmicDxe:: PmicFgCommon_GetBatteryStatus StateOfCharge = 98, VBat = 4206 mV Current = 205 mA Temperature = 27 C
ChargerLib::ChargerLib_GetErrors ERROR Charging source not detected 
2, PmicDxe:: PmicFgCommon_GetBatteryStatus StateOfCharge = 98, VBat = 4206 mV Current = 205 mA Temperature = 27 C
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, PmicDxe:: PmicFgSram_ReadBattID: BATT_ID_2 = 68589 
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, PmicDxe:: PmicFgSram_CondRestart VShadw = 4206 mv VEmpty = 2843 mv VPred = 4191 mv VBattEst = -15 mv 
2, 2, 2, 2, 2, 2, 2, 2, ChargerLib:: ChargerLib_GetErrors Battery Presence = 1 
ChargerLib:: ChargerLib_GetBatteryID BATT_ID_2 = 68589 
2, PmicDxe:: PmicFgCommon_GetBatteryStatus StateOfCharge = 98, VBat = 4206 mV Current = 205 mA Temperature = 27 C
2, PmicDxe:: PmicFgCommon_GetBatteryStatus StateOfCharge = 98, VBat = 4206 mV Current = 205 mA Temperature = 27 C
ChargerLib::ChargerLib_GetErrors ERROR Charging source not detected 
2, ChargerLib:: ChargerLib_GetErrors Battery Presence = 1 
ChargerLib:: ChargerLib_GetBatteryID BATT_ID_2 = 68589 
2, PmicDxe:: PmicFgCommon_GetBatteryStatus StateOfCharge = 98, VBat = 4206 mV Current = 205 mA Temperature = 27 C
2, PmicDxe:: PmicFgCommon_GetBatteryStatus StateOfCharge = 98, VBat = 4206 mV Current = 205 mA Temperature = 27 C
ChargerLib::ChargerLib_GetErrors ERROR Charging source not detected 
2, PmicDxe:: PmicFgCommon_GetBatteryStatus StateOfCharge = 98, VBat = 4206 mV Current = 205 mA Temperature = 27 C
2, 2, 2, PmicDxe:: PmicFgCommon_GetBatteryStatus StateOfCharge = 98, VBat = 4206 mV Current = 205 mA Temperature = 27 C
2, 2, 2, PmicDxe:: PmicSchgSetChargerDefaultSetting Setting ICL = 500 mA 
zjlz 3333 QcomChargerApp:: ChargerLib_Exit Error getting platform type  
2, UEFI Total : 915 ms
POST Time      [ 2097] OS Loader
Loader Build Info: Dec  6 2018 19:53:30
VB: RWDeviceState: Succeed using rpmb!
KeyPressed = (0x9CE58000)
Reboot reason: 0
Platform version : 0x10000
Booting from slot (_b)
Loading Image Start : 2115 ms
Loading Image Done : 2115 ms
Total Image Read size : 512 Bytes
Loading Image Start : 2116 ms
Loading Image Done : 2285 ms
Total Image Read size : 28921856 Bytes
No dtbo partition is found, Skip dtbo
VB: DeviceInit: Device is unlocked! Skipping verification!
ReadKeyInternal: gEfiSimpleTextInputExProtocolGuid handles = 3
ReadKeyInternal: Read KEY = 0x0
 bootstate = 4
var = UNLOCK splash update
Cannot find GraphicsHandles.
ImageWidth=1080,ImageHeight=2160,LogoPosX=0,LogoPosY=0
Avoid flicking for 2160x1080 images 
Cannot find GraphicsHandles.
Render Splash  [ 2351]
VB: VerifyImage: Image verification done! boot state is: ORANGE
Exit key detection timer
No Ffbm cookie found, ignore: Not Found
Memory Base Address: 0x80000000
Decompressing kernel image start: 12539 ms
Decompressing kernel image done: 13023 ms
BootLinux: failed to get dtbo image
Best match DTB tags 317/00000008/0x00000000/0/1001B/102001A/0/0/(offset)0x99F32B30/(size)0x0005C540
Using pmic info 0x1001B/0x102001A/0x0/0x0 for device 0x2001B/0x102001A/0x0/0x0
Memory Base Address: 0x80000000
smem protocol = 9C2FD0A0
board_id1 is 1
 board_id2 is 0
 board_id3 is 1
board_id is 1
get_boardid_from_smem,SUCCESS ,board_id=0x102
 PON Reason is 0x200001 cold_boot:1 charger path: 0
GetCheckPanelPressGuid:checkPanel = 0x1;Status:0x0
panel is Exist
get_hwconfig_cmdline, board_id=0x102
get_hwconfig_cmdline, hwlevel=0x1
get_hwconfig_cmdline, maxcount=0x30
aaaaaa
get_hwconfig_cmdline, i=0x15
Cmdline: ttyMSM0,115200,n8 androidboot.console=ttyMSM0 earlycon=msm_serial_dm,0xc170000 androidboot.hardware=qcom user_debug=31 msm_rtb.filter=0x37 ehci-hcd.park=3 lpm_levels.sleep_disabled=1 sched_enable_hmp=1 sched_enable_power_aware=1 service_locator.e
RAM Partitions
Add Base: 0x0000000080000000 Available Length: 0x0000000080000000 
Add Base: 0x0000000100000000 Available Length: 0x000000007E4C0000 
WARNING: Could not find mem-offline node.
kaslr-Seed is added to chosen node
pureason = 40001

Shutting Down UEFI Boot Services: 13118 ms
BDS: LogFs sync skipped, Unsupported
App Log Flush : 14 ms
Exit BS        [13139] UEFI End
  • Pins GPIO_4 and GPIO_5 from U201 are connected to TP11 and TP10.
  • GPIO4 = TP11 = UART TX
  • GPIO5 = TP10 = UART RX
  • UART interface is 1.8v. Not sure if RX is working yet, because there's no voltage on this pin.

Additional Info

Info from the Xiaomi Redmi Note 7, and Redmi Note 8 port that also applies to the Mi A2:

Photos

See also