Skip to content

Enable modem on mainline MSM8916 devices

Minecrell requested to merge Minecrell/pmaports:msm8916-modem into master

Together with @TravMurav I've been working on enabling the modem for the mainline MSM8916 devices. This has been WIP since Christmas since it turned out to be quite complicated - we ran into a few problems that were really hard to track down. But at this point it is now working quite well with:

  • SMS
  • Starting/Ending voice calls

working fine. Note that

  • Voice call audio
  • Mobile Internet

are entirely different beasts and are currently not working.

The MSM8916 device packages now allow choosing between two mainline kernel variants - mainline or mainline-modem. Both are actually exactly the same kernel (binary), they just switch between two different device trees (with the modem enabled or disabled). The reason for this is that there are two different ways to route audio on MSM8916.

As far as I understand it, the audio routing looks like this on most QCOM SoCs:

          (Remote Processors)
              +---------+                                       
              |  Modem  |                                       
              +---------+                                       
                   |                                            
              +---------+                                        
              |         |                                        
+-------+     |  ADSP   |    +-------+                          
|       |<--->|         |<-->|       |--- Internal Codec        
| Linux |     +---------+    | LPASS |    (Speaker, Microphones)
| (CPU) |                    |       |                          
|       |                    |       |--- External Codec        
+-------+                    +-------+    (e.g. HDMI)           

Audio needs to go through the ADSP, which requires non-free firmware. The modem is separate and talks to the ADSP for audio.

On MSM8916 it looks slightly different:

          (Remote Processor)
              +---------+                                       
              |         |                                       
              |  Modem  |                                   
              |         |                                       
+-------+     |  ADSP   |    +-------+                          
|       |<--->|         |<-->|       |--- Internal Codec        
| Linux |     +---------+    | LPASS |    (Speaker, Microphones)
| (CPU) |         OR         |       |                          
|       |<------------------>|       |--- External Codec        
+-------+                    +-------+    (e.g. HDMI)           

There is just one remote processor that runs both modem and ADSP. But it is also possible to bypass it and talk directly to LPASS (Low-power audio subsystem). This bypass makes it possible to have audio working without non-free firmware. At the moment mainline uses this bypass for MSM8916.
However, as soon as the modem is started, it assumes control over LPASS and bypassing the ADSP is no longer working. Therefore we had to make audio work through the ADSP (which caused a bunch of problems we had to track down).

Users who would like to use the modem will want to route audio through the ADSP (otherwise audio is not working). But there are also users who prefer not running the non-free modem - they can still have working audio by using the bypass.

Therefore, the difference between the two kernel variants is:

  • mainline: no modem, audio routed directly
  • mainline-modem: non-free modem, audio routed through ADSP

Otherwise the kernels are exactly the same. See commit log for other changes made in this MR.

Cc: @Mis012

Edited by Minecrell

Merge request reports