User:Knuxify/Draft:Qualcomm/Adding a new SoC to mainline Linux: Difference between revisions

Knuxify (talk | contribs)
Knuxify (talk | contribs)
Line 35: Line 35:
In order to begin mainlining your SoC, you need to have the following bits of information:
In order to begin mainlining your SoC, you need to have the following bits of information:


* The codename of your SoC. If you're lucky, it's probably already somewhere out there online. This will be useful when looking things up in the downstream kernel, as it primarily uses the codename, whereas mainline uses the model number. (TODO - we should have a table of SoC codenames somewhere!)
* The '''downstream codename''' ("DTS nickname"?) of your SoC. If you're lucky, it's probably already somewhere out there online. You'll find it in the driver names on the device. This will be useful when looking things up in the downstream kernel, as it primarily uses the codename, whereas mainline uses the model number.
* A copy of the downstream kernel; preferably the one for your device, but you can also use the kernel from another device with the same SoC, or - as a last resort - any kernel with the relevant SoC drivers (hint: search by codename).
* The '''internal codename''' of your SoC. Around mid-2025, Qualcomm's mainline Linux engineers decided that instead of using the model name for SoC drivers, they should use the codename instead... except the codename they ''want'' you to use is different from the one that's plastered all over the downstream kernel.
* A copy of the <code>qcom_proprietary_devicetree</code> or similar repo with the DTSI source files (because they're not in the kernel repo for whatever reason...). Search for <code>(codename).dtsi</code> on GitHub and you'll find the right repository eventually.
** ''Mere mortals'' shall not know these codenames... but you can probably ask your friendly neighborhood sympathizer of the mainline cause<ref>https://lore.kernel.org/lkml/[email protected]/</ref>.
* An extracted DTB from your device. Dump this from a running device using FDT (todo: instructions, would probably be good on a generic page, maybe subpage of [[Devicetree]]?
* A copy of the '''downstream kernel'''; preferably the one for your device, but you can also use the kernel from another device with the same SoC, or - as a last resort - any kernel with the relevant SoC drivers (hint: search by downstream codename).
* A copy of the '''<code>qcom_proprietary_devicetree</code>''' or similar repo with the DTSI source files (because they're not in the kernel repo for whatever reason...). Search for <code>(downstream codename).dtsi</code> on GitHub and you'll find the right repository eventually.
* An '''extracted DTB from your device'''. Dump this from a running device using FDT (todo: instructions, would probably be good on a generic page, maybe subpage of [[Devicetree]])?
* Find a similar SoC that is already supported. Usually flagship SoCs are available in mainline; try to find a flagship from around the same time as the SoC you're mainlining. Find its DTSIs as well; then you can compare the differences between downstream and mainline for the upstreamed SoC, and correlate them with differences in your SoC. You'll also be able to check the other SoC's drivers and use them as a base for your own drivers.
* Find a similar SoC that is already supported. Usually flagship SoCs are available in mainline; try to find a flagship from around the same time as the SoC you're mainlining. Find its DTSIs as well; then you can compare the differences between downstream and mainline for the upstreamed SoC, and correlate them with differences in your SoC. You'll also be able to check the other SoC's drivers and use them as a base for your own drivers.


Line 77: Line 79:


Qualcomm devices use ''multiple'' PMICs for different purposes. Often, the PMIC is paired with an SoC or series of SoCs.
Qualcomm devices use ''multiple'' PMICs for different purposes. Often, the PMIC is paired with an SoC or series of SoCs.
== References ==