ASoC: msm: Configure gpio level insert based on the headset jack type

8x26 platforms have different headset jack types, so configure the
GPIO level based on jack type read from the device tree. Default is
"Noramlly Closed". For Normally Closed headset jack types, set GPIO
level to 0 and for Normally Open headset jack types, set GPIO level
to 1.

Change-Id: I9ed5f2545986b545bb2494f3f88659e4060b4b2a
CRs-fixed: 481386
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
diff --git a/Documentation/devicetree/bindings/sound/qcom-audio-dev.txt b/Documentation/devicetree/bindings/sound/qcom-audio-dev.txt
index 9f6cb16..2c06545 100644
--- a/Documentation/devicetree/bindings/sound/qcom-audio-dev.txt
+++ b/Documentation/devicetree/bindings/sound/qcom-audio-dev.txt
@@ -465,6 +465,8 @@
 - qcom,ext-ult-lo-amp-gpio: GPIO to enable external ultrasound lineout
 			    amplifier.
 
+- qcom,headset-jack-type-NO: Adjust GPIO level based on the headset jack type.
+
 Example:
 
 sound {
diff --git a/sound/soc/msm/msm8226.c b/sound/soc/msm/msm8226.c
index 08731f6..96a532c 100644
--- a/sound/soc/msm/msm8226.c
+++ b/sound/soc/msm/msm8226.c
@@ -1146,6 +1146,9 @@
 		}
 	}
 
+	mbhc_cfg.gpio_level_insert = of_property_read_bool(pdev->dev.of_node,
+					"qcom,headset-jack-type-NO");
+
 	ret = msm8226_prepare_codec_mclk(card);
 	if (ret)
 		goto err_vdd_spkr;