https://wiki.postmarketos.org/api.php?action=feedcontributions&user=LorenDB&feedformat=atompostmarketOS - User contributions [en]2024-03-29T12:29:59ZUser contributionsMediaWiki 1.39.6https://wiki.postmarketos.org/index.php?title=Samsung_Galaxy_J3_2016_(samsung-j3)&diff=12577Samsung Galaxy J3 2016 (samsung-j3)2020-06-13T21:19:43Z<p>LorenDB: </p>
<hr />
<div>{{Infobox device<br />
| manufacturer = Samsung<br />
| name = Galaxy J3 2016 (J320P)<br />
| codename = samsung-j3ltespr<br />
| image = File:samsung-j3ltespr.jpg<br />
| imagecaption = This is the current state with non-working screen. I will upload a better pic once the screeen works.<br />
| releaseyear = 2016<br />
| originalsoftware = Android 5.1.1<br />
| chipset = Qualcomm MSM8916 Snapdragon 410<br />
| cpu = 4x 1.2 GHz Cortex-A53<br />
| gpu = Adreno 306<br />
| storage = 16 GB<br />
| display = 1280x720<br />
| memory = 1.5 GB<br />
| architecture = aarch64<br />
<!-- the following status_* questions should be answered with Y - yes, P - partial, N - no, or left blank (for untested or unknown) --><br />
| status_usbnet = Y<br />
| status_flashing = Y<br />
| status_touch = N<br />
| status_screen = N<br />
| status_wifi = P<br />
| status_xwayland = <!-- Showing X11 applications in a Wayland compositor (Weston, KWin, ...) works? --><br />
| status_fde = <!-- When installing with full disk encryption, can you type in the password with the on screen keyboard? --><br />
| status_mainline = Y<br />
| status_battery = <!-- Charging the battery with charging-sdl is possible --><br />
| status_3d = <!-- Hardware accelerated 3D graphics (e.g. with freedreno) --><br />
| status_accel = <!-- The sensor that measures proper acceleration works --><br />
| status_audio = <!-- Using the device's speakers/headphone jack works --><br />
| status_bluetooth = <!-- It's possible to pair and use other devices via the bluetooth protocol --><br />
| status_camera = <!-- Taking photos and videos works. --><br />
| status_gps = <!-- The Global Positioning System sensor works. --><br />
| status_mobiledata = <!-- Connecting to the Internet via cellular network. --><br />
| status_sms = <!-- Sending and receiving short messages works as intended. --><br />
| status_calls = <!-- Talking to other people over the cellular network. --><br />
| booting = yes<br />
}}<br />
<br />
== Contributors ==<br />
* LorenDB<br />
<br />
== Users owning this device ==<br />
{{Device owners}}<br />
<!-- autogenerated, use {{Owns device|devicepage|notes}} on your profile page --><br />
<!-- use _ instead of spaces in device page name, e.g. {{Owns device|HTC_Desire_(htc-bravo)|custom notes}}--><br />
<!-- you may need to purge page cache to see changes (more->purge cache)--><br />
<!-- you can use {{My devices}} on your profile page to show table with all your devices --><br />
<br />
== How to enter flash mode ==<br />
Press Volume Down, Power, and Home all at the same time to boot to Odin mode. After lk2nd is installed, press Volume Down and Power at the same time.<br />
<br />
== Installation ==<br />
# Install [https://github.com/msm8916-mainline/lk2nd#readme lk2nd] (alternative bootloader that provides a standard fastboot interface)<br />
# Follow the [[Installation guide]]<br />
{{note|'''Note:''' When installing lk2nd via Odin mode, I was unable to get Heimdall working as a flasher. You may need to use the Windows Odin program. I believe it works in Wine on Linux.}}<br />
{{note|'''Note:''' Enter lk2nd fastboot mode by pressing only Volume Down + Power ('''not''' the Home button). Pressing the Home button additionally will bring you to the Samsung Download mode.}}<br />
<br />
<!--<br />
If you manage to get your device packages merged, uncomment links below and change DEVICE_CODENAME with the actual one.<br />
* [https://gitlab.com/postmarketOS/pmaports/tree/master/device/testing/device-DEVICE_CODENAME Device package]<br />
* [https://gitlab.com/postmarketOS/pmaports/tree/master/device/testing/linux-DEVICE_CODENAME Kernel package]<br />
--></div>LorenDBhttps://wiki.postmarketos.org/index.php?title=MSM8916_Mainlining&diff=12528MSM8916 Mainlining2020-06-10T21:18:02Z<p>LorenDB: Fix the commit suggested for panel porting and created a link to the Github commit</p>
<hr />
<div>[https://www.qualcomm.com/products/snapdragon-processors-410 MSM8916]/[https://www.qualcomm.com/products/apq8016e APQ8016] (or Snapdragon 410) is Qualcomm SoC released in 2014. Support in mainline was originally added for the [https://www.96boards.org/product/dragonboard410c/ Dragonboard 410c], but most of it also works well on other MSM8916-based devices.<br />
<br />
== Status ==<br />
The following features provided by the MSM8916 SoC are supported in mainline and should work on most MSM8916-based devices after the device tree has been set up:<br />
* UART<br />
* USB<br />
* Internal/External Storage (eMMC/SD card)<br />
* WiFi/Bluetooth<br />
* GPU, Display ('''Note:''' There are many different display panels and each needs a custom panel driver...)<br />
* Sound ('''Note:''' Some devices use a custom speaker amplifier instead of the one provided by PM8916...)<br />
* Buttons<br />
* Modem (SMS, voice calls with audio)<br />
<br />
Certain components (e.g. touchscreen, sensors, ...) are device-specific. With a bit of luck, some will be already supported by mainline, others won't.<br />
<br />
== Overview ==<br />
The first MSM8916 devices using mainline were added in {{MR|582|pmaports}}. The following components are involved when running mainline on MSM8916 devices.<br />
<br />
=== [https://github.com/msm8916-mainline/linux msm8916-mainline/linux] ===<br />
The close-to-mainline [https://www.kernel.org/ Linux] kernel fork with patches that have not been accepted/submitted upstream yet. Patches in the <code>master</code> branch are generally in good shape unless marked otherwise. Submit a PR to add new patches there.<br />
<br />
=== [https://github.com/msm8916-mainline/lk2nd msm8916-mainline/lk2nd] ===<br />
The reference bootloader provided by Qualcomm for MSM8916 is open-source and based on [https://github.com/littlekernel/lk Little Kernel (LK)]. Most devices will use this bootloader in a more or less modified form. On Samsung devices for example, the standard Fastboot interface was replaced by their proprietary download mode.<br />
<br />
[https://github.com/msm8916-mainline/lk2nd lk2nd] is a fork of the reference bootloader with the goal to provide an unified boot interface on all MSM8916 devices. It provides a standard Fastboot interface (even on Samsung devices!). It also used for a number of mainline quirks (e.g. to set a WiFi/BT MAC address in the device tree; without lk2nd, WiFi/BT does not work out of the box). Eventually, more quirks may be added in the future. It is therefore recommended for all mainline MSM8916 devices. Porting it is generally much easier than porting mainline.<br />
<br />
{{note|'''Note:''' lk2nd does not replace your stock bootloader. It is packed into a standard Android boot image and loaded by the stock bootloader from the boot partition. The real boot partition used by lk2nd is then placed with 1 MB offset into the boot partition.}}<br />
<br />
=== soc-qcom-msm8916 ===<br />
The shared device package in postmarketOS. It contains shared dependencies and configuration files.<br />
<br />
== Getting Started ==<br />
=== Requirements ===<br />
* MSM8916-based device<br />
* UART if possible (with a bit of luck you may get USB working without UART)<br />
* (Downstream) Linux kernel source for your device (explaining ways to mainline without kernel source is out of scope for this article)<br />
* Basic knowledge about Linux, Git, C, Device Trees, ...<br />
* Willingness to learn about "mainlining" and to figure out things on your own<br />
<br />
=== Before you start ===<br />
{{note|'''Warning:''' Mainlining (or any unintended "modding") may brick your device permanently if you make a mistake. There is a good chance that nothing happens if you are a bit careful, but do not continue with a device that you need every day. You have been warned!}}<br />
<br />
Mainlining is not easy. MSM8916 is a platform where a lot components can be easily enabled by only setting up a device tree, which can be largely copied from other devices with minor changes. However, at some point you will reach the point where you would like to enable a particular component that is device-specific (e.g. the touchscreen, sensors, ...). In this case you will be largely on your own, and need to figure out how to enable it yourself. (Do you just need to add something to the device tree or even write a new kernel driver?) That requires some familiarity with the way the Linux kernel is working for MSM8916.<br />
<br />
The best way to make yourself familiar with the process is to attempt to figure out some simple things on your own. Therefore, this guide will only describe everything until (eventually) USB network is working. For everything else, this article provides only some information that might be helpful to figure it out yourself.<br />
<br />
If you have any questions, ask in [[Matrix_and_IRC|the mainline channel on Matrix or IRC]]. Make sure to mention "msm8916" if your question is specific to this article.<br />
<br />
=== Preparations ===<br />
First, let's take a short look at the downstream kernel. The device trees on downstream are usually in <code>arch/arm/boot/dts/qcom/msm8916-*.dts(i)</code> (in Samsung kernels: <code>arch/arm/boot/dts/samsung/msm8916/msm8916-*.dts(i)</code>). You need to find the <code>.dts</code> file that describes the device tree for your device. One way to check this is to look at <code>/proc/device-tree/model</code> on downstream, and search for the same string in that directory.<br />
<br />
Now, let's check how it looks on mainline. Clone [https://github.com/msm8916-mainline/linux msm8916-mainline/linux] and take a look at <code>arch/arm64/boot/dts/qcom/</code>. This is the directory where you will add your device tree later.<br />
<br />
=== lk2nd ===<br />
{{note|'''Note:''' lk2nd is not strictly required to boot mainline. However, certain features (e.g. WiFi and BT) only work with some additional mainline quirks included in lk2nd. In the future, there may be more features that depend on extra code that needs to be run in the bootloader. Therefore, lk2nd is recommended for all devices, even if your stock bootloader already provides a standard Fastboot interface.}}<br />
<br />
[https://github.com/msm8916-mainline/lk2nd msm8916-mainline/lk2nd] does not require any device-specific code. Normally, it should just run out of the box on your device. However, most stock bootloaders require a valid device tree to be present in the Android boot image. To avoid problems, a dummy device tree with the <code>qcom,board-id</code> from the downstream kernel needs to be added to lk2nd.<br />
<br />
Before you make any changes, try [https://github.com/msm8916-mainline/lk2nd#building building it]. Then, add a new file for your device to <code>dts/</code> that looks like:<br />
<br />
// SPDX-License-Identifier: GPL-2.0-only<br />
<br />
/dts-v1/;<br />
<br />
/include/ "msm8916.dtsi"<br />
<br />
/ {<br />
// This is used by the bootloader to find the correct DTB<br />
qcom,msm-id = <206 0>; // qcom,msm-id = <247 0>; for APQ8016<br />
qcom,board-id = /* FIXME: Check your downstream device tree */;<br />
<br />
model = "Device Name"; // FIXME<br />
compatible = "<vendor>,<codename>", "qcom,msm8916", "lk2nd,device"; // FIXME<br />
};<br />
<br />
<br />
Note the <code>FIXME</code> lines in the example above. This is where you still need to make changes for your device. For example, replace the <code>model</code> with a display name for your device, and the placeholders in the <code>compatible</code> string.<br />
<br />
The <code>qcom,board-id</code> property allows the bootloader to select the correct device tree. MSM8916 devices usually use [[QCDT]] (multiple device tree blobs (dtb) are packaged in one Android boot image). You should be able to find the <code>qcom,board-id</code> in the downstream <code>.dts</code> file for your device.<br />
<br />
{{note|Some devices (in particular Samsung) do not implement the [[QCDT]] specification correctly - they all have the same <code>qcom,board-id</code>. In that case, the device cannot be detected only based on the selected DTB. For Samsung devices, <code>msm8916-samsung-r0x.dts</code> covers multiple devices - the actual device is then detected using <code>androidboot.bootloader</code> version passed by the Samsung bootloader.}}<br />
<br />
Make sure to add the new file to <code>dts/rules.mk</code>, and re-compile lk2nd.<br />
<br />
With a bit of luck, flashing the boot image on your device should make it boot into a Fastboot screen, and the device should show up via USB. If either of that is not the case, we need to investigate further. Sometimes, there is some kind of [[Micro-USB_Interface_Controller]] that sits between USB and the SoC, which may require manual setup to work correctly. Setting that up would require device-specific code. If you need help, ask in [[Matrix_and_IRC|the mainline channel on Matrix or IRC]].<br />
<br />
=== Device Package ===<br />
Before you can build the mainline kernel for your device, you need to setup the postmarketOS device packages. Avoid creating the device/kernel package directly through pmbootstrap. There is no need to analyze a boot image. (The boot image offsets are not actually used on MSM8916; plus, all MSM8916 devices should use Fastboot through lk2nd...) You can start with the following examples:<br />
<br />
<code>device/device-<vendor>-<codename>/APKBUILD</code>:<br />
<br />
<nowiki><br />
# Reference: <https://postmarketos.org/devicepkg><br />
pkgname="device-<vendor>-<codename>"<br />
pkgdesc="Device Name"<br />
pkgver=1<br />
pkgrel=0<br />
url="https://postmarketos.org"<br />
license="MIT"<br />
arch="aarch64"<br />
options="!check !archcheck"<br />
depends="postmarketos-base mkbootimg linux-postmarketos-qcom-msm8916 soc-qcom-msm8916"<br />
makedepends="devicepkg-dev"<br />
source="deviceinfo"<br />
<br />
build() {<br />
devicepkg_build $startdir $pkgname<br />
}<br />
<br />
package() {<br />
devicepkg_package $startdir $pkgname<br />
}</nowiki><br />
<br />
<code>device/device-<vendor>-<codename>/deviceinfo</code>:<br />
<br />
<nowiki><br />
# Reference: <https://postmarketos.org/deviceinfo><br />
# Please use double quotes only. You can source this file in shell scripts.<br />
<br />
deviceinfo_format_version="0"<br />
deviceinfo_name="Device Name"<br />
deviceinfo_manufacturer="Vendor"<br />
deviceinfo_codename="<vendor>-<codename>"<br />
deviceinfo_year="<release year>"<br />
deviceinfo_dtb="qcom/msm8916-<vendor>-<codename>"<br />
deviceinfo_append_dtb="true"<br />
deviceinfo_modules_initfs=""<br />
deviceinfo_arch="aarch64"<br />
<br />
# Device related<br />
deviceinfo_keyboard="false"<br />
deviceinfo_external_storage="true"<br />
deviceinfo_screen_width="720"<br />
deviceinfo_screen_height="1280"<br />
deviceinfo_getty="ttyMSM0;115200"<br />
<br />
# MSM DRM cannot take over the framebuffer from the bootloader at the moment<br />
deviceinfo_no_framebuffer="true"<br />
<br />
# Bootloader related<br />
deviceinfo_flash_method="fastboot"<br />
deviceinfo_kernel_cmdline="earlycon console=ttyMSM0,115200 PMOS_NO_OUTPUT_REDIRECT"<br />
deviceinfo_generate_bootimg="true"<br />
deviceinfo_flash_offset_base="0x80000000"<br />
deviceinfo_flash_offset_kernel="0x00080000"<br />
deviceinfo_flash_offset_ramdisk="0x02000000"<br />
deviceinfo_flash_offset_second="0x00f00000"<br />
deviceinfo_flash_offset_tags="0x01e00000"<br />
deviceinfo_flash_pagesize="2048"<br />
deviceinfo_flash_sparse="true"</nowiki><br />
<br />
Follow the [[Porting_to_a_new_device#Device_specific_package|postmarketOS porting guide]] until the device package builds successfully.<br />
<br />
=== Build Kernel ===<br />
<br />
Go back to your [https://github.com/msm8916-mainline/linux msm8916-mainline/linux] clone. Try to build it with [[Compiling_kernels_with_envkernel.sh|envkernel.sh]]:<br />
<br />
$ cd path/to/msm8916-mainline/linux<br />
$ source path/to/pmbootstrap/helpers/envkernel.sh<br />
<br />
# Initialize kernel configuration<br />
$ make msm8916_defconfig pmos.config<br />
<br />
# Compile kernel; replace <cores> with the number of cores you'd like to use for compilation<br />
$ make -j<cores><br />
<br />
# Create postmarketOS package with your built kernel<br />
$ pmbootstrap build --envkernel linux-postmarketos-qcom-msm8916<br />
<br />
This is how you can build and test local changes for the kernel from now on. Now we will continue setting up an initial device tree for your device.<br />
<br />
=== Initial Device Tree ===<br />
The available hardware components of a device are described in the device tree (see e.g. [https://elinux.org/images/f/f9/Petazzoni-device-tree-dummies_0.pdf this introduction]). Components provided by the SoC (MSM8916) are described in the common include <code>msm8916.dtsi</code>. You need to create a device tree with the device-specific configuration, plus additional components used in your device (e.g. touchscreen).<br />
<br />
The device tree for your device should be placed in a new file at <code>arch/arm64/boot/dts/qcom/msm8916-<vendor>-<codename>.dts</code>. A very simple device tree that only enables UART output could look like this:<br />
<br />
<nowiki><br />
// SPDX-License-Identifier: GPL-2.0-only<br />
<br />
/dts-v1/;<br />
<br />
#include "msm8916.dtsi"<br />
#include "pm8916.dtsi"<br />
<br />
/ {<br />
model = "Device Name"; // FIXME<br />
compatible = "<vendor>,<codename>", "qcom,msm8916"; // FIXME<br />
<br />
aliases {<br />
serial0 = &blsp1_uart2;<br />
};<br />
<br />
chosen {<br />
stdout-path = "serial0";<br />
};<br />
<br />
soc {<br />
serial@78b0000 {<br />
status = "okay";<br />
pinctrl-names = "default", "sleep";<br />
pinctrl-0 = <&blsp1_uart2_default>;<br />
pinctrl-1 = <&blsp1_uart2_sleep>;<br />
};<br />
};<br />
};</nowiki><br />
<br />
MSM8916 has 122 [https://en.wikipedia.org/wiki/General-purpose_input/output GPIO] pins that can be configured with different functions. GPIO 4 and 5 can be configured to provide UART ("blsp1_uart2"). In the Linux kernel, the [https://elinux.org/images/b/b6/Pin_Control_Subsystem_Overview.pdf Pin Control Subsystem] (pinctrl) handles configuring the pins with a specific function.<br />
<br />
Therefore, the above device tree does the following:<br />
* <code>aliases</code> and <code>chosen</code>: Set up BLSP UART2 as default console output<br />
* <code>serial@78b0000</code>: This node is defined in <code>msm8916.dtsi</code> but disabled by default (<code>status = "disabled"</code>)<br />
** <code>status = "okay"</code> Enable it<br />
** pinctrl: configure GPIO 4 and 5 for UART (<code>blsp1_uart2_default</code> and <code>blsp1_uart2_sleep</code> are default pin configurations that are defined in the common <code>msm8916-pins.dtsi</code><br />
<br />
Before you build, don't forget to add an entry to <code>arch/arm64/boot/dts/qcom/Makefile</code>.<br />
This device tree should be already enough to boot with working serial console if you are able to access UART.<br />
If you don't have UART you will need to skip testing this step and hope that USB works out of the box in the next step.<br />
<br />
=== Storage & USB ===<br />
Let's look at a more complex device tree now. The goal is to enable internal/external storage ([https://en.wikipedia.org/wiki/MultiMediaCard#eMMC eMMC]) and to make USB gadget mode working so you can attach your device to a PC and get a debugging console. This is where things start to get slightly different between devices.<br />
<br />
Update your device tree with something like the following:<br />
<br />
<nowiki><br />
// SPDX-License-Identifier: GPL-2.0-only<br />
<br />
/dts-v1/;<br />
<br />
#include "msm8916.dtsi"<br />
#include "pm8916.dtsi"<br />
#include <dt-bindings/gpio/gpio.h><br />
<br />
/ {<br />
model = "Device Name"; // FIXME<br />
compatible = "<vendor>,<codename>", "qcom,msm8916"; // FIXME<br />
<br />
aliases {<br />
serial0 = &blsp1_uart2;<br />
};<br />
<br />
chosen {<br />
stdout-path = "serial0";<br />
};<br />
<br />
soc {<br />
sdhci@7824000 {<br />
status = "okay";<br />
<br />
vmmc-supply = <&pm8916_l8>;<br />
vqmmc-supply = <&pm8916_l5>;<br />
<br />
pinctrl-names = "default", "sleep";<br />
pinctrl-0 = <&sdc1_clk_on &sdc1_cmd_on &sdc1_data_on>;<br />
pinctrl-1 = <&sdc1_clk_off &sdc1_cmd_off &sdc1_data_off>;<br />
};<br />
<br />
sdhci@7864000 {<br />
status = "okay";<br />
<br />
vmmc-supply = <&pm8916_l11>;<br />
vqmmc-supply = <&pm8916_l12>;<br />
<br />
pinctrl-names = "default", "sleep";<br />
<br />
pinctrl-0 = <&sdc2_clk_on &sdc2_cmd_on &sdc2_data_on>; // add &sdc2_cd_on if you use cd-gpios below<br />
pinctrl-1 = <&sdc2_clk_off &sdc2_cmd_off &sdc2_data_off>; // add &sdc2_cd_off if you use cd-gpios below<br />
<br />
// FIXME: Either or - compare with downstream<br />
//non-removable;<br />
//cd-gpios = <&msmgpio 38 GPIO_ACTIVE_LOW>;<br />
};<br />
<br />
serial@78b0000 {<br />
status = "okay";<br />
pinctrl-names = "default", "sleep";<br />
pinctrl-0 = <&blsp1_uart2_default>;<br />
pinctrl-1 = <&blsp1_uart2_sleep>;<br />
};<br />
<br />
usb@78d9000 {<br />
status = "okay";<br />
dr_mode = "peripheral";<br />
<br />
hnp-disable;<br />
srp-disable;<br />
adp-disable;<br />
<br />
ulpi {<br />
phy {<br />
v1p8-supply = <&pm8916_l7>;<br />
v3p3-supply = <&pm8916_l13>;<br />
};<br />
};<br />
};<br />
<br />
/*<br />
* Attempting to enable these devices causes a "synchronous<br />
* external abort". Suspected cause is that the debug power<br />
* domain is not enabled by default on this device.<br />
* Disable these devices for now to avoid the crash.<br />
*<br />
* See: https://lore.kernel.org/linux-arm-msm/20190618202623.GA53651@gerhold.net/<br />
*/<br />
tpiu@820000 { status = "disabled"; };<br />
funnel@821000 { status = "disabled"; };<br />
replicator@824000 { status = "disabled"; };<br />
etf@825000 { status = "disabled"; };<br />
etr@826000 { status = "disabled"; };<br />
funnel@841000 { status = "disabled"; };<br />
debug@850000 { status = "disabled"; };<br />
debug@852000 { status = "disabled"; };<br />
debug@854000 { status = "disabled"; };<br />
debug@856000 { status = "disabled"; };<br />
etm@85c000 { status = "disabled"; };<br />
etm@85d000 { status = "disabled"; };<br />
etm@85e000 { status = "disabled"; };<br />
etm@85f000 { status = "disabled"; };<br />
};<br />
};<br />
<br />
// TODO (wiki): Explain setup of dummy extcon device to make USB work<br />
<br />
// FIXME: Verify all regulators with downstream<br />
&smd_rpm_regulators {<br />
vdd_l1_l2_l3-supply = <&pm8916_s3>;<br />
vdd_l4_l5_l6-supply = <&pm8916_s4>;<br />
vdd_l7-supply = <&pm8916_s4>;<br />
<br />
s1 {<br />
regulator-min-microvolt = <500000>;<br />
regulator-max-microvolt = <1300000>;<br />
};<br />
<br />
s3 {<br />
regulator-min-microvolt = <1200000>;<br />
regulator-max-microvolt = <1300000>;<br />
};<br />
<br />
s4 {<br />
regulator-min-microvolt = <1800000>;<br />
regulator-max-microvolt = <2100000>;<br />
};<br />
<br />
l1 {<br />
regulator-min-microvolt = <1225000>;<br />
regulator-max-microvolt = <1225000>;<br />
};<br />
<br />
l2 {<br />
regulator-min-microvolt = <1200000>;<br />
regulator-max-microvolt = <1200000>;<br />
};<br />
<br />
l3 {<br />
regulator-min-microvolt = <500000>;<br />
regulator-max-microvolt = <1287500>;<br />
};<br />
<br />
l4 {<br />
regulator-min-microvolt = <2050000>;<br />
regulator-max-microvolt = <2050000>;<br />
};<br />
<br />
l5 {<br />
regulator-min-microvolt = <1800000>;<br />
regulator-max-microvolt = <1800000>;<br />
};<br />
<br />
l6 {<br />
regulator-min-microvolt = <1800000>;<br />
regulator-max-microvolt = <1800000>;<br />
};<br />
<br />
l7 {<br />
regulator-min-microvolt = <1800000>;<br />
regulator-max-microvolt = <1800000>;<br />
};<br />
<br />
l8 {<br />
regulator-min-microvolt = <2850000>;<br />
regulator-max-microvolt = <2900000>;<br />
};<br />
<br />
l9 {<br />
regulator-min-microvolt = <3300000>;<br />
regulator-max-microvolt = <3300000>;<br />
};<br />
<br />
l10 {<br />
regulator-min-microvolt = <2700000>;<br />
regulator-max-microvolt = <2800000>;<br />
};<br />
<br />
l11 {<br />
regulator-min-microvolt = <1800000>;<br />
regulator-max-microvolt = <2950000>;<br />
regulator-allow-set-load;<br />
regulator-system-load = <200000>;<br />
};<br />
<br />
l12 {<br />
regulator-min-microvolt = <1800000>;<br />
regulator-max-microvolt = <2950000>;<br />
};<br />
<br />
l13 {<br />
regulator-min-microvolt = <3075000>;<br />
regulator-max-microvolt = <3075000>;<br />
};<br />
<br />
l14 {<br />
regulator-min-microvolt = <1800000>;<br />
regulator-max-microvolt = <3300000>;<br />
};<br />
<br />
l15 {<br />
regulator-min-microvolt = <1800000>;<br />
regulator-max-microvolt = <3300000>;<br />
};<br />
<br />
l16 {<br />
regulator-min-microvolt = <1800000>;<br />
regulator-max-microvolt = <3300000>;<br />
};<br />
<br />
l17 {<br />
regulator-min-microvolt = <2850000>;<br />
regulator-max-microvolt = <2850000>;<br />
};<br />
<br />
l18 {<br />
regulator-min-microvolt = <2700000>;<br />
regulator-max-microvolt = <2700000>;<br />
};<br />
};</nowiki><br />
<br />
Whoa! That's quite a lot of new stuff. Let's look at the new lines in detail:<br />
<br />
* <code>sdhci@7824000</code>: This enables the internal storage. There should not be any change needed here, it should work as-is.<br />
* <code>sdhci@7864000</code>: This is the external storage. There is a <code>FIXME</code> in there because there is an implementation detail that differs between devices. Some devices have their SD card slot behind the battery. In that case, they may have avoided implementing the chip detect ("cd") GPIO that is used to detect if a SD card is inserted (or removed). In any case, check if downstream defines <code>cd-gpios</code>, usually on the <code>&sdhc_2</code> node. If yes, add it together with the other comment, otherwise put <code>non-removable</code>.<br />
* <code>usb@78d9000</code>: This enables the USB code and forces it to USB gadget ("peripheral") mode. (If you want, you can attempt to get OTG/Host mode working later...)<br />
* <code>tpiu@820000</code>, <code>funnel@821000</code>, ...: This is a workaround to avoid a boot error on production MSM8916 devices. Check the link in the comment if you are curious.<br />
* <code>&smd_rpm_regulators</code>: This block defines constraints for the regulators provided by PM8916 (the [https://en.wikipedia.org/wiki/Power_management_integrated_circuit PMIC] used by MSM8916). Most importantly, you define the voltage range that can be set by drivers for the regulators. Unless your device manufacturer felt very special, all MSM8916 devices should use these regulator voltages. Nevertheless it is important to check for differences in downstream. Here are some tips and tricks:<br />
** Downstream regulators look a bit different, but they are usually defined in <code>msm8916-regulators.dtsi</code>. Note that some device trees may override the regulator voltages in a device-specific <code>.dts(i)</code>.<br />
** "Corner" regulators are a special type of regulators downstream that are used for some kind of voting mechanism. The idea is that different components in the SoC vote for the voltage level they currently require, and the Resource Power Manager (RPM) picks the appropriate voltage based on the votes. Mainline does not have corner regulators, so just ignore them for now.<br />
** s2 is special (used to control the voltage for the CPU cores) and is not touched by mainline at the moment. Just ignore it.<br />
** Also ignore the <code>-ao</code> and <code>-so</code> regulators (usually just on l7)<br />
<br />
{{note|'''Warning:''' Make sure to check the regulators carefully and ask for feedback before testing the changes in the next step.}}<br />
<br />
For testing, consider [[Inspecting_the_initramfs|enabling the <code>debug-shell</code>]] hook so you can avoid flashing the rootfs as a first step. (Note that you need to remove it explicitly using <code>hook_del</code> when you want to try flashing the rootfs later...) With a bit of luck, the device should show up on telnet via USB after booting with these changes.<br />
<br />
If USB is working, try flashing the rootfs to check if the internal storage is working. Your device should then boot into the full postmarketOS installation and provide SSH over the USB network interface.<br />
<br />
{{todo|USB does not actually work out of the box with the instructions above (note the TODO comment in the device tree example). Please ask for help in the chat for now.}}<br />
<br />
=== Finishing up ===<br />
If the features enabled during the guide are working, then it is a good time to do some cleanup and propose your changes "upstream" on [https://github.com/msm8916-mainline/linux msm8916-mainline/linux]. This repository is intended as a temporary place for patches that are already in good quality, but either pending or not quite finished to submit them on the Linux mainline mailing lists.<br />
<br />
To maintain the quality, all patches are required to:<br />
* Compile without warnings<br />
* Have no criticial (<code>ERROR:</code>) checkpatch failures (also see [https://www.kernel.org/doc/html/latest/process/submitting-patches.html#style-check-your-changes Style-check your changes in the mainline "Submitting patches" guide])<br />
** Sometimes it makes sense to ignore notes and warnings from checkpatch if the code is more readable without fixing them.<br />
* Have a properly formatted one-line summary in the commit message (there is no need to write a detailed commit message, yet)<br />
** Look at similar commits in the commit history for examples.<br />
<br />
The first two will be automatically checked for you when you open a PR - the CI build will fail otherwise - so you don't have to check it locally. Eventually, you should expect a few additional review comments to improve your code. This will help you to speed up submission of the patches upstream later! ;)<br />
<br />
When this is done, then you can continue working on whatever you would like to work on! Below are a few tips and tricks for common features. However, it is hard to write a definitive guide as they differ between devices, so you will need to do some investigation on your own.<br />
<br />
== Reference ==<br />
The general approach for mainlining is:<br />
* Look at all resources you can find, e.g.:<br />
** [https://github.com/msm8916-mainline/linux/commits/master Commits in msm8916-mainline/linux]<br />
** Existing device trees in mainline and/or commits with relevant changes (sometimes there is helpful information in the commit message)<br />
** The kernel documentation, especially the device tree binding documentation (all available device tree properties should be documented there)<br />
and compare it with what you can find on downstream (e.g. device tree, kernel code, ...). Do '''not''' take the downstream device tree as a base or even copy it as-is. That is the wrong approach. Downstream code tends to be full of mistakes and unnecessarily verbose. It's easier to start from scratch and rather take something in mainline as a base.<br />
<br />
Additional tips and tricks:<br />
* When making changes to kernel code compiled as modules, you need to update the kernel modules on the rootfs (they are not part of the boot image that is loaded via Fastboot). There are different options to do this:<br />
** Re-flash rootfs<br />
** Upgrade <code>linux-postmarketos-qcom-msm8916</code> on your device: see [[Installing packages on a running phone]]<br />
** Other hacky solutions like copying kernel modules manually via SSH<br />
<br />
=== WiFi/Bluetooth ===<br />
WiFi/Bluetooth are usually provided by the Qualcomm Wireless Connectivity Subsystem (WCNSS), which is partially built into the SoC but paired with an external RF module ("iris").<ref>[https://lwn.net/Articles/681614/ <nowiki>[PATCH v2 0/9] Qualcomm WCNSS remoteproc</nowiki>] (patch on Linux mainline mailing list)</ref> Therefore, enabling it is usually as simple as enabling the <code>wcnss</code> node in the device tree:<ref>[https://git.kernel.org/pub/scm/linux/kernel/git/qcom/linux.git/commit/?id=70db763bad9ec9e3edcc50809b58057d6a05322f arm64: dts: msm8916-samsung-a2015: Enable WCNSS for WiFi and BT] (mainline kernel patch)</ref><br />
<br />
wcnss@a21b000 {<br />
status = "okay";<br />
};<br />
<br />
By default mainline expects [https://developer.qualcomm.com/qfile/29369/lm80-p0436-33_b_wcn3620_wireless_connectivity_ic_device_spec.pdf WCN3620] as external RF module. However, MSM8916 can be also paired with other RF modules - another common chip is [https://developer.qualcomm.com/qfile/35297/lm80-p0436-70_b_wcn3680bwcn3660b_devicespecification.pdf WCN3660B] which has dual-band (5 GHz) support additionally. The chip identifier can be obtained from a downstream kernel log (dmesg): There should be a message like <code>wcnss: IRIS Reg: 04000004</code>.<ref>[https://github.com/msm8916-mainline/android_kernel_qcom_msm8916/blob/b20608408caff817ec874f325127b07609fbaeb8/drivers/net/wireless/wcnss/wcnss_vreg.c#L366 drivers/net/wireless/wcnss/wcnss_vreg.c, line 366] (downstream kernel code)</ref> Take the first 4 hex chars (i.e. <code>>> 16</code>) and compare it with the [https://github.com/msm8916-mainline/android_kernel_qcom_msm8916/blob/b20608408caff817ec874f325127b07609fbaeb8/drivers/net/wireless/wcnss/wcnss_vreg.c#L46-L53 chip IDs listed in downstream].<br />
<br />
If you do not have WCN3620, you need to override the <code>compatible</code> property of the iris node:<ref name="wcn3660b">[https://git.kernel.org/pub/scm/linux/kernel/git/qcom/linux.git/commit/?id=f087003b37aba064096984c49ffe81c1b33ce5d8 arm64: dts: msm8916-samsung-a5u: Override iris compatible] (mainline kernel patch)</ref><br />
<br />
wcnss@a21b000 {<br />
status = "okay";<br />
<br />
iris {<br />
compatible = "qcom,wcn3680"; // For WCN3660B or WCN3680<br />
};<br />
};<br />
<br />
Note the use of <code>qcom,wcn3680</code> instead of <code>qcom,wcn3660</code> for WCN3660B. WCN3660B is actually more similar to WCN3680 since it requires different regulator voltages compared to WCN3660. <code>qcom,wcn3680</code> enables the correct configuration.<ref name="wcn3660b"/><br />
<br />
* WiFi and Bluetooth share the same antenna, and they tend to conflict with each other when they are used at the same time ("WiFi/BT coexistence"). In case of problems, try disabling one of them.<br />
* Dual-band support on WCN3660B seems to be broken at the moment: only 2.4 GHz networks show up in the WiFi network list.<br />
<br />
==== Firmware ====<br />
Unfortunately, WCNSS requires firmware to run. This firmware is signed, so it must be packaged separately for each device. The following files are needed:<br />
<br />
* <code>wcnss.mdt</code> plus all related segments (<code>wcnss.b00</code>, ...), i.e. <code>wcnss.*</code> (usually installed on a separate firmware (<code>NON-HLOS</code>) partition)<br />
* <code>WCNSS_qcom_wlan_nv.bin</code> (usually installed on the system partition, e.g. <code>/system/etc/firmware/wlan/prima/WCNSS_qcom_wlan_nv.bin</code><br />
<br />
On postmarketOS it should be packaged in a separate firmware package. Look at <code>firmware/firmware-wileyfox-crackling</code> as an example.<br />
<br />
Then add a new <code>nonfree-firmware</code> subpackage to your device package:<br />
<br />
<nowiki><br />
subpackages="$pkgname-nonfree-firmware:nonfree_firmware"<br />
<br />
nonfree_firmware() {<br />
pkgdesc="GPU/WiFi/BT/Video firmware"<br />
depends="linux-firmware-qcom firmware-vendor-device-venus firmware-vendor-device-wcnss"<br />
mkdir "$subpkgdir"<br />
}</nowiki><br />
<br />
While you are at it, this is a good chance to package the <code>venus.*</code> firmware as well. It is used for hardware accelerated video codecs and should work out of the box without further changes.<br />
=== Display/GPU ===<br />
{{note|'''Note:''' Due to weird dependencies issues in the DRM MSM driver, you need to make [[#WiFi/Bluetooth|WiFi/Bluetooth]] work to have the DRM MSM driver finish loading successfully. (WCNSS takes a while to load, so it will trigger attempting to probe DRM MSM again after it fails to load on its own due to dependencies issues between the DRM driver and the panel driver...)}}<br />
<br />
The display tends to be one of the most difficult things to get working. This is because manufacturers have many different options how to implement the display in the hardware. Generally, all devices will have a display panel connected to the SoC via [https://en.wikipedia.org/wiki/Display_Serial_Interface MIPI Display Serial Interface (DSI)]. The panel can vary even for one device model; it is common to support multiple panels to be more flexible when assembling the device. As if this wasn't enough, panels are usually paired with additional controllers (e.g. for the backlight) or regulators (to provide special power supplies). Those may, or may not need to be controlled from the kernel.<br />
<br />
The easy part is usually the panel itself. To make it work we usually only need to send some special DSI commands to initialize it. [https://github.com/freedreno/freedreno/wiki/DSI-Panel-Driver-Porting DSI Panel Driver Porting] on the Freedreno wiki has an introduction how to port panels. For MSM8916 mainlining, we have created [https://github.com/msm8916-mainline/linux-mdss-dsi-panel-driver-generator linux-mdss-dsi-panel-driver-generator] which attempts to automatically parse the downstream device tree and generates panel drivers for all the supported panels.<br />
<br />
How can you figure out which panel is being used by the device you have? The panel is usually listed in a <code>mdss_mdp.panel=</code> kernel parameter provided by the (primary) bootloader. You can check it from the lk2nd log, or using <code>fastboot oem cmdline && fastboot get_staged /dev/stdout</code>. The parameter lists the name of the panel node in the device tree.<br />
<br />
{{note|'''Note:''' The generated panel driver should usually work without larger changes (follow the README). As usual, it is recommended to ask in the chat for further advice before running it.}}<br />
<br />
You also need to make changes to the device tree. <code>arm64: dts: msm8916-longcheer-l8150: Add display panel</code> ([https://github.com/msm8916-mainline/linux/commit/4da75455c36cd910fc2e69f871088831d32c9bf3 here]) is a good example how to add the panel to the device tree. In some case, you may need to turn on a GPIO to enable the power supply of the panel. On mainline, this is implemented using a [https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/regulator/fixed-regulator.yaml fixed regulator]. You can then use the <code>--regulator</code> option in the panel driver generator to add code to automatically turn on that GPIO.<br />
<br />
{{note|'''Note:''' <code>qcom,dsi-phy-regulator-ldo-mode</code> is needed if, '''and only if''' you have <code>qcom,regulator-ldo-mode</code> in downstream. Otherwise, remove it.}}<br />
<br />
Some devices have an extra backlight IC that needs to be controlled separately in the kernel. The easy case is where it is simply enabled using a GPIO: in this case it can be simply treated like a fixed regulator. But some backlight ICs have an [https://en.wikipedia.org/wiki/I%C2%B2C I²C interface] and then need an extra driver in the kernel.<br />
<br />
==== Brightness ====<br />
There are different approaches used to dim the brightness of the screen. The approach used in downstream is usually defined by the <code>qcom,mdss-dsi-bl-pmic-control-type</code> property in the panel node of the downstream device tree:<br />
<br />
* '''Pulse-width modulation (PWM)''' (<code>bl_ctrl_pwm</code>): In this case there is an external PWM generator that generates a PWM signal for the display. PM8916 (the PMIC of MSM8916) contains one PWM generator that can be configured for the display. <code>arm64: dts: msm8916-longcheer-l8150: Add PWM backlight support</code> is an example how to set it up.<br />
* '''MIPI DCS commands''' (<code>bl_ctrl_dcs</code>): In this case the panel controller handles the brightness automatically. The generated panel driver should implement brightness without further changes.<br />
* '''Custom''': Some devices (e.g. Samsung AMOLED panels) have <code>bl_ctrl_dcs</code> or something else listed, but actually use an entirely custom way to control display brightness. This needs to be implemented manually in the panel driver (or using an extra backlight driver).<br />
<br />
=== Touchscreen ===<br />
The touchscreen is usually connected to a [https://en.wikipedia.org/wiki/I%C2%B2C I²C bus], e.g. <code>blsp_i2c5</code>. Often it is either supplied by some PM8916 regulators or a set of fixed regulator. (This is often visible when the touchscreen has some "enable" GPIOs listed downstream; those usually represent a chip that can be enabled through a GPIO and then supplies a fixed voltage to the touchscreen...) This is where similarities end. There can be all sorts of touchscreens connected to the I²C bus and manufacturers like to use many different ones. Look through the supported touchscreen in mainline to see if a driver exists already, or can be modified eventually to support another version of a similar chip. Otherwise, you may need to write a simple driver yourself.<br />
<br />
=== Audio ===<br />
{{todo|}}<br />
<br />
=== Buttons ===<br />
The Power and Volume Down buttons are usually connected to the PMIC (PM8916). (The Power button is - obviously - used to power on the device. Volume Down is used in combination with the Power button to force a reboot, essentially simulating removing the battery and putting it back in. On devices without removable battery holding these two buttons allows rebooting the device...)<br />
<br />
<code>qcom,pm8941-pwrkey</code> (Power) and <code>qcom,pm8941-resin</code> (Volume Down) are used to expose these two buttons to user-space. <code>qcom,pm8941-pwrkey</code> is already set up in the common <code>pm8916.dtsi</code> and should out of the box. A new device node for <code>qcom,pm8941-resin</code> needs to be added manually:<br />
<br />
<nowiki><br />
&spmi_bus {<br />
pm8916@0 {<br />
pon@800 {<br />
volume-down {<br />
compatible = "qcom,pm8941-resin";<br />
interrupts = <0x0 0x8 1 IRQ_TYPE_EDGE_BOTH>;<br />
bias-pull-up;<br />
linux,code = <KEY_VOLUMEDOWN>;<br />
};<br />
};<br />
};<br />
};</nowiki><br />
<br />
Volume Up and other additional keys (e.g. Home on Samsung devices) are usually connected to a GPIO pin on the SoC. Therefore, setting them up is trivial using [https://www.kernel.org/doc/Documentation/devicetree/bindings/input/gpio-keys.txt gpio-keys].<br />
<br />
=== Sensors ===<br />
Like the touchscreen, sensors are usually connected to a [https://en.wikipedia.org/wiki/I%C2%B2C I²C bus], e.g. <code>blsp_i2c2</code> and usually supplied by L17. This is where similarities end. There can be all sorts of sensors connected to the I²C bus and manufacturers like to use many different ones. Look through the supported sensors in mainline to see if a driver exists already, or can be modified eventually to support another version of a similar chip. Otherwise, you may need to write a simple driver yourself.<br />
<br />
Some devices have a [https://en.wikipedia.org/wiki/Hall_effect_sensor Hall effect sensor] that is used to detect if the screen is covered by some kind of flip cover. It is usually a simple GPIO like the [[#Buttons|buttons]], and can be set up easily using [https://www.kernel.org/doc/Documentation/devicetree/bindings/input/gpio-keys.txt gpio-keys].<br />
<br />
=== Battery/Charging ===<br />
Although PM8916 provides a linear charger for batteries only few devices actually make use of it. This might be because it is comparatively inefficient compared to a switching mode battery charger. Therefore most devices actually have custom chips that manage the battery and charging. Usually it is separated in:<br />
* '''Fuel gauge:''' Measures the remaining charge of the battery.<br />
* '''Charger:''' Handles charging the battery.<br />
<br />
Similar to the sensors, battery/charger are usually connected to a [https://en.wikipedia.org/wiki/I%C2%B2C I²C bus]. Look through the supported drivers in mainline (<code>drivers/power/supply</code>) to see if a driver exists already, or can be modified eventually to support another version of a similar chip. Compare with the downstream driver just to be sure.<br />
<br />
{{note|'''Warning:''' Incorrect usage of battery/charger drivers might cause the battery to malfunction. In worst case, incorrect charging of batteries might even cause the battery to explode. Be careful.}}<br />
<br />
== Glossary ==<br />
;PM8916<br />
:The [https://en.wikipedia.org/wiki/Power_management_integrated_circuit PMIC] used together with MSM8916.<br />
;BLSP<br />
:"BAM-enabled low-speed peripheral". Controllers for UART, I²C and SPI.<br />
;LPASS<br />
:Low-power audio subsystem<br />
;MDSS<br />
:Mobile Display Subsystem - the hardware that manages the display.<br />
;MDP<br />
:Part of MDSS that manages display panels.<br />
;DSI<br />
:[https://en.wikipedia.org/wiki/Display_Serial_Interface MIPI Display Serial Interface (DSI)] - used for communication with display panel.<br />
;CAMSS<br />
:Camera Subsystem<br />
;SPMI<br />
:System Power Management Interface - used for communication between MSM8916 and PM8916.<br />
<br />
=== Remote Processors ===<br />
;WCNSS<br />
:Wireless Connectivity Subsystem (WCNSS). Provides WiFi and Bluetooth.<br />
;Venus<br />
:Provides hardware-accelerated video encoding/decoding.<br />
;Modem<br />
:Provides mobile connectivity and Audio DSP (ADSP). '''Note:''' On MSM8916, modem and ADSP are one remote processor, but the ADSP is usually separate on Qualcomm SoCs.<br />
;Hexagon<br />
:Microarchitecture for DSPs, used for ADSP (and therefore also modem in MSM8916).<br />
<br />
== Documentation ==<br />
* Specifications<br />
** [https://developer.qualcomm.com/download/sd410/snapdragon-410-processor-device-specification.pdf Snapdragon 410E (APQ8016E) Processor Device Specification]<br />
** [https://developer.qualcomm.com/download/sd410/pm8916pm8916-1-power-management-ic-device-specification.pdf PM8916/PM8916-1 Power Management IC Device Specification]<br />
** [https://developer.qualcomm.com/download/sd410/wcn3620-wireless-connectivity-ic-device-specification.pdf WCN3620 Wireless Connectivity IC Device Specification]<br />
** [https://developer.qualcomm.com/download/sd410/wcn3680b-wcn3660b-device-spec.pdf WCN3680B/WCN3660B Device Specification]<br />
* Register Descriptions<br />
** [https://developer.qualcomm.com/download/sd410/hardware-register-description-qualcomm-snapdragon-410.pdf Qualcomm Snapdragon 410E Processor (APQ 8016E) Hardware Register Description] <br />
** [https://developer.qualcomm.com/download/sd410/pm8916-hardware-register-description.pdf PM8916 Hardware Register Description]<br />
* [https://developer.qualcomm.com/download/sd410/snapdragon-410e-technical-reference-manual.pdf Snapdragon 410E Technical Reference Manual] (provides explanations for many hardware blocks)<br />
* More documentation: [https://developer.qualcomm.com/hardware/apq-8016e/tools APQ8016E Tools & Resources]<br />
<br />
[[Category:Guide]]<br />
[[Category:Technical Reference]]</div>LorenDBhttps://wiki.postmarketos.org/index.php?title=File:Samsung-j3ltespr.jpg&diff=11245File:Samsung-j3ltespr.jpg2020-04-29T12:31:54Z<p>LorenDB: Bad photo of non-working screen on my device</p>
<hr />
<div>Bad photo of non-working screen on my device</div>LorenDBhttps://wiki.postmarketos.org/index.php?title=User:LorenDB&diff=11244User:LorenDB2020-04-29T12:05:28Z<p>LorenDB: </p>
<hr />
<div>{{My devices}}<br />
{{Owns device|Samsung_Galaxy_J3_2016_(J320P)}}<br />
<br />
== Contact me ==<br />
Ping me in the mainlining channel on Matrix or just send me a direct message at @lorenb:matrix.org.</div>LorenDBhttps://wiki.postmarketos.org/index.php?title=User:LorenDB&diff=11243User:LorenDB2020-04-29T12:05:04Z<p>LorenDB: Created page with "{{My devices}} {{Owns device|Samsung_Galaxy_J3_2016_(J320P)}} {{Contact}} Ping me in the mainlining channel on Matrix or just send me a direct message at @lorenb:matrix.org."</p>
<hr />
<div>{{My devices}}<br />
{{Owns device|Samsung_Galaxy_J3_2016_(J320P)}}<br />
<br />
{{Contact}}<br />
Ping me in the mainlining channel on Matrix or just send me a direct message at @lorenb:matrix.org.</div>LorenDBhttps://wiki.postmarketos.org/index.php?title=Samsung_Galaxy_J3_2016_(samsung-j3)&diff=11242Samsung Galaxy J3 2016 (samsung-j3)2020-04-29T11:58:57Z<p>LorenDB: Created the page for this device</p>
<hr />
<div>{{Infobox device<br />
| manufacturer = Samsung<br />
| name = Galaxy J3 2016 (J320P)<br />
| codename = samsung-j3ltespr<br />
| image = File:samsung-j3ltespr.jpg<br />
| imagecaption = This is the current state with non-working screen. I will upload a better pic once the screeen works.<br />
| releaseyear = 2016<br />
| originalsoftware = Android 5.1.1<br />
| chipset = Qualcomm MSM8916 Snapdragon 410<br />
| cpu = 4x 1.2 GHz Cortex-A53<br />
| gpu = Adreno 306<br />
| storage = 16 GB<br />
| display = 1280x720<br />
| memory = 1.5 GB<br />
| architecture = aarch64<br />
<!-- the following status_* questions should be answered with Y - yes, P - partial, N - no, or left blank (for untested or unknown) --><br />
| status_usbnet = Y<br />
| status_flashing = Y<br />
| status_touch = N<br />
| status_screen = N<br />
| status_wifi = N<br />
| status_xwayland = <!-- Showing X11 applications in a Wayland compositor (Weston, KWin, ...) works? --><br />
| status_fde = <!-- When installing with full disk encryption, can you type in the password with the on screen keyboard? --><br />
| status_mainline = <!-- Instead of a Linux kernel fork, it is possible to run mainline. --><br />
| status_battery = <!-- Charging the battery with charging-sdl is possible --><br />
| status_3d = <!-- Hardware accelerated 3D graphics (e.g. with freedreno) --><br />
| status_accel = <!-- The sensor that measures proper acceleration works --><br />
| status_audio = <!-- Using the device's speakers/headphone jack works --><br />
| status_bluetooth = <!-- It's possible to pair and use other devices via the bluetooth protocol --><br />
| status_camera = <!-- Taking photos and videos works. --><br />
| status_gps = <!-- The Global Positioning System sensor works. --><br />
| status_mobiledata = <!-- Connecting to the Internet via cellular network. --><br />
| status_sms = <!-- Sending and receiving short messages works as intended. --><br />
| status_calls = <!-- Talking to other people over the cellular network. --><br />
| booting = yes<br />
}}<br />
<br />
== Contributors ==<br />
* LorenDB<br />
<br />
== Users owning this device ==<br />
{{Device owners}}<br />
<!-- autogenerated, use {{Owns device|devicepage|notes}} on your profile page --><br />
<!-- use _ instead of spaces in device page name, e.g. {{Owns device|HTC_Desire_(htc-bravo)|custom notes}}--><br />
<!-- you may need to purge page cache to see changes (more->purge cache)--><br />
<!-- you can use {{My devices}} on your profile page to show table with all your devices --><br />
<br />
== How to enter flash mode ==<br />
Press Volume Down, Power, and Home all at the same time to boot to Odin mode. After lk2nd is installed, press Volume Down and Power at the same time.<br />
<br />
== Installation ==<br />
# Install [https://github.com/msm8916-mainline/lk2nd#readme lk2nd] (alternative bootloader that provides a standard fastboot interface)<br />
# Follow the [[Installation guide]]<br />
{{note|'''Note:''' When installing lk2nd via Odin mode, I was unable to get Heimdall working as a flasher. You may need to use the Windows Odin program. I believe it works in Wine on Linux.}}<br />
{{note|'''Note:''' Enter lk2nd fastboot mode by pressing only Volume Down + Power ('''not''' the Home button). Pressing the Home button additionally will bring you to the Samsung Download mode.}}<br />
<br />
<!--<br />
If you manage to get your device packages merged, uncomment links below and change DEVICE_CODENAME with the actual one.<br />
* [https://gitlab.com/postmarketOS/pmaports/tree/master/device/testing/device-DEVICE_CODENAME Device package]<br />
* [https://gitlab.com/postmarketOS/pmaports/tree/master/device/testing/linux-DEVICE_CODENAME Kernel package]<br />
--></div>LorenDB