Sony Xperia SP (sony-huashan)
This device has been tested with postmarketOS, but its device package has not yet been added to the postmarketOS repositories. This means that it cannot be selected in pmbootstrap. Status: Boots up. No screen so far. |
File:Sony-huashan.jpg | |
Manufacturer | Sony |
---|---|
Name | Xperia SP |
Codename | sony-huashan |
Model | C5302 (HSDPA), C5303 (LTE), C506 (LTE) |
Released | 2013 |
Type | handset |
Hardware | |
Chipset | Qualcomm Snapdragon S4 Pro (MSM8960T) |
CPU | Dual-core 1.7 GHz Krait |
GPU | Adreno 320 |
Display | 720x1280 TFT |
Storage | 8 GB |
Memory | 1 GB |
Architecture | armv7 |
Software | |
Original software The software and version the device was shipped with. |
Android 4.1 |
Extended version The most recent supported version from the manufacturer. |
Android 4.3 |
FOSS bootloader | no |
postmarketOS | |
Category | testing |
Pre-built images Whether pre-built images are available here. |
no |
Mainline Instead of a Linux kernel fork, it is possible to run (Close to) Mainline. |
yes |
pmOS kernel The kernel version that runs on the device's port. |
6.15.0 |
Flashing It is possible to flash the device with pmbootstrap flasher . |
|
---|---|
USB Networking After connecting the device with USB to your PC, you can connect to it via telnet (initramfs) or SSH (booted system). |
Works
|
Internal storage eMMC, SD cards, UFS, ... |
Works
|
SD card Also includes other external storage cards |
Works
|
Battery Charging and battery level reporting works |
Broken
|
Screen Display works. Ideally with sleep mode and brightness control. |
Broken
|
Touchscreen |
Broken
|
Multimedia | |
3D Acceleration |
Broken
|
Audio Audio playback, microphone, headset and buttons. |
Broken
|
Camera |
Broken
|
Camera Flash |
Broken
|
Connectivity | |
WiFi |
Broken
|
Bluetooth |
Broken
|
GPS |
Broken
|
NFC Near Field Communication |
Works
|
Modem | |
Calls |
Broken
|
SMS |
Broken
|
Mobile data |
Broken
|
Miscellaneous | |
FDE Full disk encryption and unlocking with unl0kr. |
Broken
|
USB OTG USB On-The-Go or USB-C Role switching |
Works
|
HDMI/DP Video and audio output with HDMI or Display Port works. |
Broken
|
Sensors | |
Accelerometer Auto screen rotation works in desktops e.g. Phosh or Plasma Mobile |
Works
|
Magnetometer Sensor to measure magnetism |
Works
|
Ambient Light |
Broken
|
Proximity |
Broken
|
Haptics |
Works
|
Contributors
Maintainer(s)
Users owning this device
- ArMor (Notes: broken SIM tray)
- Cafehaine
- DarkNeutrino
- MayeulC (Notes: Half-broken digitizer)
- Smankusors (Notes: EMMC seems half broken, digitizer half broken)
How to enter flash mode
From adb
Enter the command `adb reboot bootloader`
From Android with custom rom
The power menu might have a "Reboot to bootloader option"
With the device off
Press the
button, then plug in the USB cable. The LED bar should light up blueWhat does not work at mainline
- Wifi
- Bluetooth
- Audio
- LCD backlight (needs as3676/as3677 driver)
- Touchscreen (cyttsp4 driver was removed)
- Flashlight (might needs lm3561? but that ic doesn't exist on mine)
- Notification light (needs as3665 driver)
- Proximity light sensor (needs apds9702 driver)
- MHL (needs sii8334 driver)
- Display (needs to convert display parameters)
- Camera (custom camera module?)
- Charging (needs ncp373 driver?)
What does work at mainline
- Serial output
- Vibration
- Accelerometer, gyroscope, magnetometer (lsm303dlhc, l3gd20, ak8963)
- Physical buttons
- NFC (pn544)
Boot image format
This device uses a Sony ELF image format that includes an RPM file. Although a merge request for Sony ELF image support exists, it has not yet been accepted. For now boot image has to be generated manually with mkelf.
The mkelf tool and RPM binary are available in the following GitHub repository:
https://github.com/LineageOS/android_device_sony_huashan/blob/lineage-18.1/boot
Example command to generate a Sony ELF image:
$ python2 mkelf.py -o boot.img kernel@0x80208000 ramdisk.img@0x81900000 RPM.bin@0x00020000,rpm cmdline.txt@cmdline
Note: The device can boot using the standard Android boot.img format. However, since this format doesn't include the RPM, the RPM won't be available during boot.
lk2nd
You can bypass the ELF image requirement by inserting lk2nd (or another secondary bootloader) in between. First, obtain the lk2nd source code from GitHub:
https://github.com/msm8916-mainline/lk2nd
Next, apply the following patches: the first disables device tree fixup in lk2nd (currently, the fixup causes the boot to fail for unknown reasons), and the second forces serial output to GSBI8, as huashan uses this port.
diff --git a/lk2nd/project/msm8x60.mk b/lk2nd/project/msm8x60.mk
index 1253ff52..a128a394 100644
--- a/lk2nd/project/msm8x60.mk
+++ b/lk2nd/project/msm8x60.mk
@@ -4,7 +4,7 @@
EMMC_BOOT ?= 1
# Build with proper device tree support
-DEFINES += DEVICE_TREE=1
+# DEFINES += DEVICE_TREE=1
# Strictly speaking msm8660 uses custom PMIC code inside platform/msm8x60,
# but pm8921 seems "compatible enough" for purposes in lk2nd.
diff --git a/target/msm8960/init.c b/target/msm8960/init.c
index 9df721e1..873f35b2 100755
--- a/target/msm8960/init.c
+++ b/target/msm8960/init.c
@@ -273,7 +273,7 @@ void target_uart_init(void)
case LINUX_MACHTYPE_8960_APQ:
case LINUX_MACHTYPE_8960_LIQUID:
- if(board_baseband() == BASEBAND_SGLTE || board_baseband() == BASEBAND_SGLTE2)
+ if(board_baseband() == BASEBAND_SGLTE || board_baseband() == BASEBAND_SGLTE2 || true)
{
uart_dm_init(8, 0x1A000000, 0x1A040000);;
}
Build using the following command:
$ make ENABLE_DISPLAY=0 TOOLCHAIN_PREFIX=arm-none-eabi- lk2nd-msm8960
To load the RPM, you must package lk.bin
as a Sony ELF. Use the following command to generate it:
$ python2 mkelf.py -o lk2nd-sony.elf lk.bin@0x80208000 RPM.bin@0x00020000,rpm cmdline_lk2nd.txt@cmdline
Then flash the lk2nd-sony.elf
to the boot partition using fastboot:
$ fastboot flash boot lk2nd-sony.elf
$ fastboot reboot
Once rebooted, the device should appear in fastboot mode, allowing you to run:
$ fastboot boot <any Android boot.img>
NFC
To use NFC, the battery must be plugged in, as its power source appears to be wired from the battery.
Serial UART
To obtain bootloader logs, follow the test points shown in the image below. Note that the UART operates at 1.8V. The kernel logs for downstream kernel is available at ttyHSL0
.
For more information about serial debugging, please read Serial debugging.