All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] msm8916-huawei-g7: Add sound and clarify installation
@ 2022-04-10 19:51 Stephan Gerhold
  2022-04-10 19:51 ` [PATCH 1/2] arm64: dts: qcom: msm8916-huawei-g7: Clarify installation instructions Stephan Gerhold
  2022-04-10 19:51 ` [PATCH 2/2] arm64: dts: qcom: msm8916-huawei-g7: Add sound card Stephan Gerhold
  0 siblings, 2 replies; 3+ messages in thread
From: Stephan Gerhold @ 2022-04-10 19:51 UTC (permalink / raw)
  To: Bjorn Andersson; +Cc: Andy Gross, linux-arm-msm, devicetree, Stephan Gerhold

This patch set adds the sound card to the msm8916-huawei-g7 device tree
and clarifies the suggested installation instructions. Speakers, 
headphones and the microphones are all functional, although the audio 
jack detection is a bit unreliable sometimes (not a big problem though).

Stephan Gerhold (2):
  arm64: dts: qcom: msm8916-huawei-g7: Clarify installation instructions
  arm64: dts: qcom: msm8916-huawei-g7: Add sound card

 .../arm64/boot/dts/qcom/msm8916-huawei-g7.dts | 59 ++++++++++++++++---
 1 file changed, 50 insertions(+), 9 deletions(-)

-- 
2.35.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] arm64: dts: qcom: msm8916-huawei-g7: Clarify installation instructions
  2022-04-10 19:51 [PATCH 0/2] msm8916-huawei-g7: Add sound and clarify installation Stephan Gerhold
@ 2022-04-10 19:51 ` Stephan Gerhold
  2022-04-10 19:51 ` [PATCH 2/2] arm64: dts: qcom: msm8916-huawei-g7: Add sound card Stephan Gerhold
  1 sibling, 0 replies; 3+ messages in thread
From: Stephan Gerhold @ 2022-04-10 19:51 UTC (permalink / raw)
  To: Bjorn Andersson; +Cc: Andy Gross, linux-arm-msm, devicetree, Stephan Gerhold

The comment with installation instructions in the huawei-g7 device tree
is a bit misleading and does not describe the recommended installation
steps very well. The bootloader is actually not patched; to avoid all
trouble with the vendor bootloader it is easier to bypass it completely
by jumping to a custom bootloader (e.g. based on the open-source LK
released by Qualcomm).

To avoid confusion, simplify the comment to state only the problem
and then refer to the wiki article which contains detailed suggested
installation instructions. This will also make it easier to keep it
up to date with new developments in the future.

Fixes: 55056b229189 ("arm64: dts: qcom: msm8916: Add device tree for Huawei Ascend G7")
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
---
 arch/arm64/boot/dts/qcom/msm8916-huawei-g7.dts | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/arch/arm64/boot/dts/qcom/msm8916-huawei-g7.dts b/arch/arm64/boot/dts/qcom/msm8916-huawei-g7.dts
index 42d93d3fba36..8ad9eb436a0c 100644
--- a/arch/arm64/boot/dts/qcom/msm8916-huawei-g7.dts
+++ b/arch/arm64/boot/dts/qcom/msm8916-huawei-g7.dts
@@ -11,15 +11,10 @@
 
 /*
  * Note: The original firmware from Huawei can only boot 32-bit kernels.
- * To boot arm64 kernels it is necessary to flash 64-bit TZ/HYP firmware
- * with EDL, e.g. taken from the DragonBoard 410c. This works because Huawei
- * forgot to set up (firmware) secure boot for some reason.
- *
- * Also note that Huawei no longer provides bootloader unlock codes.
- * This can be bypassed by patching the bootloader from a custom HYP firmware,
- * making it think the bootloader is unlocked.
- *
- * See: https://wiki.postmarketos.org/wiki/Huawei_Ascend_G7_(huawei-g7)
+ * To boot this device tree using arm64 it is necessary to flash 64-bit TZ/HYP
+ * firmware (e.g. taken from the DragonBoard 410c).
+ * See https://wiki.postmarketos.org/wiki/Huawei_Ascend_G7_(huawei-g7)
+ * for suggested installation instructions.
  */
 
 / {
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] arm64: dts: qcom: msm8916-huawei-g7: Add sound card
  2022-04-10 19:51 [PATCH 0/2] msm8916-huawei-g7: Add sound and clarify installation Stephan Gerhold
  2022-04-10 19:51 ` [PATCH 1/2] arm64: dts: qcom: msm8916-huawei-g7: Clarify installation instructions Stephan Gerhold
@ 2022-04-10 19:51 ` Stephan Gerhold
  1 sibling, 0 replies; 3+ messages in thread
From: Stephan Gerhold @ 2022-04-10 19:51 UTC (permalink / raw)
  To: Bjorn Andersson; +Cc: Andy Gross, linux-arm-msm, devicetree, Stephan Gerhold

The huawei-g7 uses the msm8916-wcd-digital/analog audio codecs similar
to apq8016-sbc, so we can mostly copy paste it from there to make audio
work correctly. The main difference is the hphl-jack-type-normally-open
property, which is needed to avoid inverted audio jack detection.

Note that at least on my device the jack detection is not fully
reliable: sometimes headphones are detected as headsets (with
microphone). However, this is not a big problem for typical usage.

Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
---
 .../arm64/boot/dts/qcom/msm8916-huawei-g7.dts | 46 +++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/msm8916-huawei-g7.dts b/arch/arm64/boot/dts/qcom/msm8916-huawei-g7.dts
index 8ad9eb436a0c..00488afb413d 100644
--- a/arch/arm64/boot/dts/qcom/msm8916-huawei-g7.dts
+++ b/arch/arm64/boot/dts/qcom/msm8916-huawei-g7.dts
@@ -8,6 +8,7 @@
 #include <dt-bindings/input/input.h>
 #include <dt-bindings/interrupt-controller/irq.h>
 #include <dt-bindings/leds/common.h>
+#include <dt-bindings/sound/apq8016-lpass.h>
 
 /*
  * Note: The original firmware from Huawei can only boot 32-bit kernels.
@@ -211,6 +212,10 @@ &blsp1_uart2 {
 	status = "okay";
 };
 
+&lpass {
+	status = "okay";
+};
+
 &pm8916_resin {
 	status = "okay";
 	linux,code = <KEY_VOLUMEDOWN>;
@@ -255,6 +260,40 @@ &sdhc_2 {
 	cd-gpios = <&msmgpio 56 GPIO_ACTIVE_LOW>;
 };
 
+&sound {
+	status = "okay";
+
+	model = "msm8916";
+	audio-routing =
+		"AMIC1", "MIC BIAS External1",
+		"AMIC2", "MIC BIAS External2",
+		"AMIC3", "MIC BIAS External1";
+
+	pinctrl-names = "default", "sleep";
+	pinctrl-0 = <&cdc_pdm_lines_act>;
+	pinctrl-1 = <&cdc_pdm_lines_sus>;
+
+	primary-dai-link {
+		link-name = "WCD";
+		cpu {
+			sound-dai = <&lpass MI2S_PRIMARY>;
+		};
+		codec {
+			sound-dai = <&lpass_codec 0>, <&wcd_codec 0>;
+		};
+	};
+
+	tertiary-dai-link {
+		link-name = "WCD-Capture";
+		cpu {
+			sound-dai = <&lpass MI2S_TERTIARY>;
+		};
+		codec {
+			sound-dai = <&lpass_codec 1>, <&wcd_codec 1>;
+		};
+	};
+};
+
 &usb {
 	status = "okay";
 	extcon = <&usb_id>, <&usb_id>;
@@ -264,6 +303,13 @@ &usb_hs_phy {
 	extcon = <&usb_id>;
 };
 
+&wcd_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;
+};
+
 &smd_rpm_regulators {
 	vdd_l1_l2_l3-supply = <&pm8916_s3>;
 	vdd_l4_l5_l6-supply = <&pm8916_s4>;
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-04-10 20:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-10 19:51 [PATCH 0/2] msm8916-huawei-g7: Add sound and clarify installation Stephan Gerhold
2022-04-10 19:51 ` [PATCH 1/2] arm64: dts: qcom: msm8916-huawei-g7: Clarify installation instructions Stephan Gerhold
2022-04-10 19:51 ` [PATCH 2/2] arm64: dts: qcom: msm8916-huawei-g7: Add sound card Stephan Gerhold

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.