Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7ca348d2 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "ASoC: msm: Parse the jack type property"

parents 5167a43c 2eae604f
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -524,6 +524,11 @@ Optional properties:
			   for headset detection.
- qcom,dock-plug-det-irq: Interrupt line to detect Docking/Undocking of Liquid
			  device
- qcom,mbhc-audio-jack-type : String to indicate the jack type on the hardware.
		Possible Values:
		4-pole-jack : Jack on the hardware is 4-pole.
		5-pole-jack : Jack on the hardware is 5-pole.
		6-pole-jack : Jack on the hardware is 6-pole.

* APQ8074 ASoC Machine driver

@@ -589,6 +594,7 @@ sound {
	qcom,sec-auxpcm-gpio-sync = <&msmgpio 80 0>;
	qcom,sec-auxpcm-gpio-din  = <&msmgpio 81 0>;
	qcom,sec-auxpcm-gpio-dout = <&msmgpio 82 0>;
	qcom,mbhc-audio-jack-type = "4-pole-jack";
};

* msm-dai-mi2s
+8 −1
Original line number Diff line number Diff line
/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -94,6 +94,12 @@ enum wcd9xxx_micbias_num {
	MBHC_MICBIAS4,
};

enum hw_jack_type {
	FOUR_POLE_JACK = 0,
	FIVE_POLE_JACK,
	SIX_POLE_JACK,
};

enum wcd9xx_mbhc_micbias_enable_bits {
	MBHC_MICBIAS_ENABLE_THRESHOLD_HEADSET,
	MBHC_MICBIAS_ENABLE_REGULAR_HEADSET,
@@ -240,6 +246,7 @@ struct wcd9xxx_mbhc_config {
	bool do_recalibration;
	bool use_vddio_meas;
	bool enable_anc_mic_detect;
	enum hw_jack_type hw_jack_type;
};

struct wcd9xxx_cfilt_mode {
+31 −0
Original line number Diff line number Diff line
@@ -97,6 +97,7 @@ static struct wcd9xxx_mbhc_config mbhc_cfg = {
	.do_recalibration = true,
	.use_vddio_meas = true,
	.enable_anc_mic_detect = false,
	.hw_jack_type = FOUR_POLE_JACK,
};

struct msm_auxpcm_gpio {
@@ -1974,6 +1975,7 @@ static int msm8226_asoc_machine_probe(struct platform_device *pdev)
	struct msm8226_asoc_mach_data *pdata;
	int ret;
	const char *auxpcm_pri_gpio_set = NULL;
	const char *mbhc_audio_jack_type = NULL;

	if (!pdev->dev.of_node) {
		dev_err(&pdev->dev, "No platform supplied from device tree\n");
@@ -2038,6 +2040,35 @@ static int msm8226_asoc_machine_probe(struct platform_device *pdev)
	mbhc_cfg.gpio_level_insert = of_property_read_bool(pdev->dev.of_node,
					"qcom,headset-jack-type-NC");

	ret = of_property_read_string(pdev->dev.of_node,
		"qcom,mbhc-audio-jack-type", &mbhc_audio_jack_type);
	if (ret) {
		dev_dbg(&pdev->dev, "Looking up %s property in node %s failed",
			"qcom,mbhc-audio-jack-type",
			pdev->dev.of_node->full_name);
		mbhc_cfg.hw_jack_type = FOUR_POLE_JACK;
		mbhc_cfg.enable_anc_mic_detect = false;
		dev_dbg(&pdev->dev, "Jack type properties set to default");
	} else {
		if (!strcmp(mbhc_audio_jack_type, "4-pole-jack")) {
			mbhc_cfg.hw_jack_type = FOUR_POLE_JACK;
			mbhc_cfg.enable_anc_mic_detect = false;
			dev_dbg(&pdev->dev, "This hardware has 4 pole jack");
		} else if (!strcmp(mbhc_audio_jack_type, "5-pole-jack")) {
			mbhc_cfg.hw_jack_type = FIVE_POLE_JACK;
			mbhc_cfg.enable_anc_mic_detect = true;
			dev_dbg(&pdev->dev, "This hardware has 5 pole jack");
		} else if (!strcmp(mbhc_audio_jack_type, "6-pole-jack")) {
			mbhc_cfg.hw_jack_type = SIX_POLE_JACK;
			mbhc_cfg.enable_anc_mic_detect = true;
			dev_dbg(&pdev->dev, "This hardware has 6 pole jack");
		} else {
			mbhc_cfg.hw_jack_type = FOUR_POLE_JACK;
			mbhc_cfg.enable_anc_mic_detect = false;
			dev_dbg(&pdev->dev, "Unknown value, hence setting to default");
		}
	}

	ret = snd_soc_register_card(card);
	if (ret) {
		dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n",
+31 −1
Original line number Diff line number Diff line
/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -132,6 +132,7 @@ static struct wcd9xxx_mbhc_config mbhc_cfg = {
	.do_recalibration = true,
	.use_vddio_meas = true,
	.enable_anc_mic_detect = false,
	.hw_jack_type = SIX_POLE_JACK,
};

struct msm_auxpcm_gpio {
@@ -2711,6 +2712,7 @@ static int msm8974_asoc_machine_probe(struct platform_device *pdev)
	int ret;
	const char *auxpcm_pri_gpio_set = NULL;
	const char *prop_name_ult_lo_gpio = "qcom,ext-ult-lo-amp-gpio";
	const char *mbhc_audio_jack_type = NULL;
	struct resource	*pri_muxsel;
	struct resource	*sec_muxsel;

@@ -2770,6 +2772,34 @@ static int msm8974_asoc_machine_probe(struct platform_device *pdev)
	if (ret)
		goto err;

	ret = of_property_read_string(pdev->dev.of_node,
		"qcom,mbhc-audio-jack-type", &mbhc_audio_jack_type);
	if (ret) {
		dev_dbg(&pdev->dev, "Looking up %s property in node %s failed",
			"qcom,mbhc-audio-jack-type",
			pdev->dev.of_node->full_name);
		mbhc_cfg.hw_jack_type = FOUR_POLE_JACK;
		mbhc_cfg.enable_anc_mic_detect = false;
		dev_dbg(&pdev->dev, "Jack type properties set to default");
	} else {
		if (!strcmp(mbhc_audio_jack_type, "4-pole-jack")) {
			mbhc_cfg.hw_jack_type = FOUR_POLE_JACK;
			mbhc_cfg.enable_anc_mic_detect = false;
			dev_dbg(&pdev->dev, "This hardware has 4 pole jack");
		} else if (!strcmp(mbhc_audio_jack_type, "5-pole-jack")) {
			mbhc_cfg.hw_jack_type = FIVE_POLE_JACK;
			mbhc_cfg.enable_anc_mic_detect = true;
			dev_dbg(&pdev->dev, "This hardware has 5 pole jack");
		} else if (!strcmp(mbhc_audio_jack_type, "6-pole-jack")) {
			mbhc_cfg.hw_jack_type = SIX_POLE_JACK;
			mbhc_cfg.enable_anc_mic_detect = true;
			dev_dbg(&pdev->dev, "This hardware has 6 pole jack");
		} else {
			mbhc_cfg.hw_jack_type = FOUR_POLE_JACK;
			mbhc_cfg.enable_anc_mic_detect = false;
			dev_dbg(&pdev->dev, "Unknown value, hence setting to default");
		}
	}
	if (of_property_read_bool(pdev->dev.of_node, "qcom,hdmi-audio-rx")) {
		dev_info(&pdev->dev, "%s(): hdmi audio support present\n",
				__func__);
+32 −1
Original line number Diff line number Diff line
 /* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
 /* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -80,6 +80,7 @@ static struct wcd9xxx_mbhc_config mbhc_cfg = {
			    1 << MBHC_CS_ENABLE_REMOVAL),
	.do_recalibration = false,
	.use_vddio_meas = false,
	.hw_jack_type = FOUR_POLE_JACK,
};

/*
@@ -1046,6 +1047,7 @@ struct snd_soc_card snd_soc_card_msm8x10 = {
static int msm8x10_asoc_machine_probe(struct platform_device *pdev)
{
	struct snd_soc_card *card = &snd_soc_card_msm8x10;
	const char *mbhc_audio_jack_type = NULL;
	int ret;

	dev_dbg(&pdev->dev, "%s\n", __func__);
@@ -1073,6 +1075,35 @@ static int msm8x10_asoc_machine_probe(struct platform_device *pdev)
	mbhc_cfg.use_int_rbias = of_property_read_bool(pdev->dev.of_node,
						"qcom,mbhc-bias-internal");

	ret = of_property_read_string(pdev->dev.of_node,
		"qcom,mbhc-audio-jack-type", &mbhc_audio_jack_type);
	if (ret) {
		dev_dbg(&pdev->dev, "Looking up %s property in node %s failed",
			"qcom,mbhc-audio-jack-type",
			pdev->dev.of_node->full_name);
		mbhc_cfg.hw_jack_type = FOUR_POLE_JACK;
		mbhc_cfg.enable_anc_mic_detect = false;
		dev_dbg(&pdev->dev, "Jack type properties set to default");
	} else {
		if (!strcmp(mbhc_audio_jack_type, "4-pole-jack")) {
			mbhc_cfg.hw_jack_type = FOUR_POLE_JACK;
			mbhc_cfg.enable_anc_mic_detect = false;
			dev_dbg(&pdev->dev, "This hardware has 4 pole jack");
		} else if (!strcmp(mbhc_audio_jack_type, "5-pole-jack")) {
			mbhc_cfg.hw_jack_type = FIVE_POLE_JACK;
			mbhc_cfg.enable_anc_mic_detect = true;
			dev_dbg(&pdev->dev, "This hardware has 5 pole jack");
		} else if (!strcmp(mbhc_audio_jack_type, "6-pole-jack")) {
			mbhc_cfg.hw_jack_type = SIX_POLE_JACK;
			mbhc_cfg.enable_anc_mic_detect = true;
			dev_dbg(&pdev->dev, "This hardware has 6 pole jack");
		} else {
			mbhc_cfg.hw_jack_type = FOUR_POLE_JACK;
			mbhc_cfg.enable_anc_mic_detect = false;
			dev_dbg(&pdev->dev, "Unknown value, hence setting to default");
		}
	}

	spdev = pdev;
	mutex_init(&cdc_mclk_mutex);
	ret = snd_soc_register_card(card);