2023-09-26 21:22:42

by Stephan Gerhold

[permalink] [raw]
Subject: [PATCH 09/13] arm64: dts: qcom: msm8916-longcheer-l8150: Add sound and modem

From: Nikita Travkin <[email protected]>

Enable sound and modem for the Longcheer L8150 (e.g. Wileyfox Swift).
The setup is similar to most MSM8916 devices, i.e.:

- QDSP6 audio
- Speaker/earpiece/headphones/microphones via digital/analog codec
in MSM8916/PM8916
- Audio jack detection via analog codec in PM8916
- WWAN Internet via BAM-DMUX

except:

- The mpss firmware region must be relocated to a different address.
This is because the wcnss firmware is not relocatable for some
reason. The mpss firmware is too large to avoid overlap with wcnss
when placed at the default address (0x86800000).

Surprisingly the vendor kernel does not handle this. The firmware
regions end up overlapping there and somehow this does not explode.
We try to handle this more safely by relocating the mpss region to
the first higher address that is working correctly: 0x8e800000.

Signed-off-by: Nikita Travkin <[email protected]>
Co-developed-by: Stephan Gerhold <[email protected]>
Signed-off-by: Stephan Gerhold <[email protected]>
---
.../boot/dts/qcom/msm8916-longcheer-l8150.dts | 32 ++++++++++++++++++++--
1 file changed, 29 insertions(+), 3 deletions(-)

diff --git a/arch/arm64/boot/dts/qcom/msm8916-longcheer-l8150.dts b/arch/arm64/boot/dts/qcom/msm8916-longcheer-l8150.dts
index 47d1c5cb13f4..78f08254b287 100644
--- a/arch/arm64/boot/dts/qcom/msm8916-longcheer-l8150.dts
+++ b/arch/arm64/boot/dts/qcom/msm8916-longcheer-l8150.dts
@@ -3,6 +3,8 @@
/dts-v1/;

#include "msm8916-pm8916.dtsi"
+#include "msm8916-modem-qdsp6.dtsi"
+
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include <dt-bindings/interrupt-controller/irq.h>
@@ -25,17 +27,26 @@ chosen {

/*
* For some reason, the signed wcnss firmware is not relocatable.
- * It must be loaded at 0x8b600000. All other firmware is relocatable,
- * so place wcnss at the fixed address and then all other firmware
- * regions will be automatically allocated at a fitting place.
+ * It must be loaded at 0x8b600000. Unfortunately, this also means that
+ * mpss_mem does not fit when loaded to the typical address at 0x86800000.
+ *
+ * Load wcnss_mem to the fixed address and relocate mpss_mem to the next
+ * working higher address. For some reason the modem firmware does not
+ * boot when placed at 0x8a800000 to 0x8e800000.
*/
reserved-memory {
+ /delete-node/ mpss@86800000;
/delete-node/ wcnss;

wcnss_mem: wcnss@8b600000 {
reg = <0x0 0x8b600000 0x0 0x600000>;
no-map;
};
+
+ mpss_mem: mpss@8e800000 {
+ reg = <0x0 0x8e800000 0x0 0x5000000>;
+ no-map;
+ };
};

gpio-keys {
@@ -225,6 +236,13 @@ &blsp_uart2 {
status = "okay";
};

+&pm8916_codec {
+ qcom,micbias-lvl = <2800>;
+ qcom,mbhc-vthreshold-low = <75 150 237 450 500>;
+ qcom,mbhc-vthreshold-high = <75 150 237 450 500>;
+ qcom,hphl-jack-type-normally-open;
+};
+
&pm8916_resin {
status = "okay";
linux,code = <KEY_VOLUMEDOWN>;
@@ -254,6 +272,14 @@ &sdhc_2 {
non-removable;
};

+&sound {
+ status = "okay";
+ audio-routing =
+ "AMIC1", "MIC BIAS Internal1",
+ "AMIC2", "MIC BIAS Internal2",
+ "AMIC3", "MIC BIAS Internal3";
+};
+
&usb {
status = "okay";
dr_mode = "peripheral";

--
2.42.0


2023-09-27 02:07:38

by Stephan Gerhold

[permalink] [raw]
Subject: Re: [PATCH 09/13] arm64: dts: qcom: msm8916-longcheer-l8150: Add sound and modem

On Tue, Sep 26, 2023 at 08:59:52PM +0200, Konrad Dybcio wrote:
> On 26.09.2023 18:51, Stephan Gerhold wrote:
> > From: Nikita Travkin <[email protected]>
> >
> > Enable sound and modem for the Longcheer L8150 (e.g. Wileyfox Swift).
> e.g. -> i.e., or is that thing sold under many labels?
>
> [...]
>
> > reserved-memory {
> > + /delete-node/ mpss@86800000;
> > /delete-node/ wcnss;
> delete by label, please
>

I would say the same as on PATCH 07/13 here:
https://lore.kernel.org/linux-arm-msm/[email protected]/

Thanks,
Stephan

2023-09-27 12:47:58

by Konrad Dybcio

[permalink] [raw]
Subject: Re: [PATCH 09/13] arm64: dts: qcom: msm8916-longcheer-l8150: Add sound and modem

On 26.09.2023 18:51, Stephan Gerhold wrote:
> From: Nikita Travkin <[email protected]>
>
> Enable sound and modem for the Longcheer L8150 (e.g. Wileyfox Swift).
e.g. -> i.e., or is that thing sold under many labels?

[...]

> reserved-memory {
> + /delete-node/ mpss@86800000;
> /delete-node/ wcnss;
delete by label, please

Konrad

2023-09-30 20:02:15

by Stephan Gerhold

[permalink] [raw]
Subject: Re: [PATCH 09/13] arm64: dts: qcom: msm8916-longcheer-l8150: Add sound and modem

On Tue, Sep 26, 2023 at 08:59:52PM +0200, Konrad Dybcio wrote:
> On 26.09.2023 18:51, Stephan Gerhold wrote:
> > From: Nikita Travkin <[email protected]>
> >
> > Enable sound and modem for the Longcheer L8150 (e.g. Wileyfox Swift).
> e.g. -> i.e., or is that thing sold under many labels?
>

Yes, "e.g." is indeed correct here. AFAIK the MSM8916-based Android One
devices (aka "google-seed") are also based on the Longcheer L8150. They
are available under names like "Cherry Mobile One G1", "i-mobile IQ II",
and "General Mobile 4G". They are also covered by this device tree.

Thanks,
Stephan

2023-10-02 13:48:46

by Konrad Dybcio

[permalink] [raw]
Subject: Re: [PATCH 09/13] arm64: dts: qcom: msm8916-longcheer-l8150: Add sound and modem



On 9/30/23 18:59, Stephan Gerhold wrote:
> On Tue, Sep 26, 2023 at 08:59:52PM +0200, Konrad Dybcio wrote:
>> On 26.09.2023 18:51, Stephan Gerhold wrote:
>>> From: Nikita Travkin <[email protected]>
>>>
>>> Enable sound and modem for the Longcheer L8150 (e.g. Wileyfox Swift).
>> e.g. -> i.e., or is that thing sold under many labels?
>>
>
> Yes, "e.g." is indeed correct here. AFAIK the MSM8916-based Android One
> devices (aka "google-seed") are also based on the Longcheer L8150. They
> are available under names like "Cherry Mobile One G1", "i-mobile IQ II",
> and "General Mobile 4G". They are also covered by this device tree.
Oh wow.. That's surely fun

Konrad