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

Commit 1bb82524 authored by Gopikrishnaiah Anandan's avatar Gopikrishnaiah Anandan Committed by Stephen Boyd
Browse files

ASoC: msm8974: Upgrade to kernel 3.10 ASoC



ASoC frame work in 3.10 kernel defers the machine driver
probe if all required modules for sound card installation
is not initialized.

Change-Id: I85632225aefb58a9190432bc20df89862627b170
Signed-off-by: default avatarGopikrishnaiah Anandan <agopik@codeaurora.org>
parent 511cb962
Loading
Loading
Loading
Loading
+57 −53
Original line number Original line Diff line number Diff line
@@ -269,7 +269,8 @@ static int msm8974_liquid_ext_spk_power_amp_init(void)
static void msm8974_liquid_ext_ult_spk_power_amp_enable(u32 on)
static void msm8974_liquid_ext_ult_spk_power_amp_enable(u32 on)
{
{
	if (on) {
	if (on) {
		regulator_enable(ext_spk_amp_regulator);
		if (regulator_enable(ext_spk_amp_regulator))
			pr_err("%s: enabled failed ext_spk_amp_reg\n", __func__);
		gpio_direction_output(ext_ult_spk_amp_gpio, 1);
		gpio_direction_output(ext_ult_spk_amp_gpio, 1);
		/* time takes enable the external power class AB amplifier */
		/* time takes enable the external power class AB amplifier */
		usleep_range(EXT_CLASS_AB_EN_DELAY,
		usleep_range(EXT_CLASS_AB_EN_DELAY,
@@ -289,7 +290,8 @@ static void msm8974_liquid_ext_ult_spk_power_amp_enable(u32 on)
static void msm8974_liquid_ext_spk_power_amp_enable(u32 on)
static void msm8974_liquid_ext_spk_power_amp_enable(u32 on)
{
{
	if (on) {
	if (on) {
		regulator_enable(ext_spk_amp_regulator);
		if (regulator_enable(ext_spk_amp_regulator))
			pr_err("%s: enabled failed ext_spk_amp_reg\n", __func__);
		gpio_direction_output(ext_spk_amp_gpio, on);
		gpio_direction_output(ext_spk_amp_gpio, on);
		/*time takes enable the external power amplifier*/
		/*time takes enable the external power amplifier*/
		usleep_range(EXT_CLASS_D_EN_DELAY,
		usleep_range(EXT_CLASS_D_EN_DELAY,
@@ -2659,24 +2661,6 @@ static int msm8974_asoc_machine_probe(struct platform_device *pdev)
		return -ENOMEM;
		return -ENOMEM;
	}
	}


	/* Parse Primary AUXPCM info from DT */
	ret = msm8974_dtparse_auxpcm(pdev, &pdata->pri_auxpcm_ctrl,
					msm_prim_auxpcm_gpio_name);
	if (ret) {
		dev_err(&pdev->dev,
		"%s: Primary Auxpcm pin data parse failed\n", __func__);
		goto err;
	}

	/* Parse Secondary AUXPCM info from DT */
	ret = msm8974_dtparse_auxpcm(pdev, &pdata->sec_auxpcm_ctrl,
					msm_sec_auxpcm_gpio_name);
	if (ret) {
		dev_err(&pdev->dev,
		"%s: Secondary Auxpcm pin data parse failed\n", __func__);
		goto err;
	}

	card->dev = &pdev->dev;
	card->dev = &pdev->dev;
	platform_set_drvdata(pdev, card);
	platform_set_drvdata(pdev, card);
	snd_soc_card_set_drvdata(card, pdata);
	snd_soc_card_set_drvdata(card, pdata);
@@ -2717,26 +2701,9 @@ static int msm8974_asoc_machine_probe(struct platform_device *pdev)
		goto err;
		goto err;
	}
	}


	ext_ult_lo_amp_gpio = of_get_named_gpio(pdev->dev.of_node,
						prop_name_ult_lo_gpio, 0);
	if (!gpio_is_valid(ext_ult_lo_amp_gpio)) {
		dev_dbg(&pdev->dev,
			"Couldn't find %s property in node %s, %d\n",
			prop_name_ult_lo_gpio, pdev->dev.of_node->full_name,
			ext_ult_lo_amp_gpio);
	} else {
		ret = gpio_request(ext_ult_lo_amp_gpio, "US_AMP_GPIO");
		if (ret) {
			dev_err(card->dev,
				"%s: Failed to request US amp gpio %d\n",
				__func__, ext_ult_lo_amp_gpio);
			goto err;
		}
	}

	ret = msm8974_prepare_codec_mclk(card);
	ret = msm8974_prepare_codec_mclk(card);
	if (ret)
	if (ret)
		goto err1;
		goto err;


	if (of_property_read_bool(pdev->dev.of_node, "qcom,hdmi-audio-rx")) {
	if (of_property_read_bool(pdev->dev.of_node, "qcom,hdmi-audio-rx")) {
		dev_info(&pdev->dev, "%s(): hdmi audio support present\n",
		dev_info(&pdev->dev, "%s(): hdmi audio support present\n",
@@ -2756,6 +2723,56 @@ static int msm8974_asoc_machine_probe(struct platform_device *pdev)
		card->dai_link	= msm8974_common_dai_links;
		card->dai_link	= msm8974_common_dai_links;
		card->num_links	= ARRAY_SIZE(msm8974_common_dai_links);
		card->num_links	= ARRAY_SIZE(msm8974_common_dai_links);
	}
	}
	mutex_init(&cdc_mclk_mutex);
	atomic_set(&prim_auxpcm_rsc_ref, 0);
	atomic_set(&sec_auxpcm_rsc_ref, 0);
	spdev = pdev;
	ext_spk_amp_regulator = NULL;
	msm8974_liquid_dock_dev = NULL;

	ret = snd_soc_register_card(card);
	if (ret) {
		dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n",
			ret);
		goto err;
	}

	/* Parse Primary AUXPCM info from DT */
	ret = msm8974_dtparse_auxpcm(pdev, &pdata->pri_auxpcm_ctrl,
					msm_prim_auxpcm_gpio_name);
	if (ret) {
		dev_err(&pdev->dev,
		"%s: Primary Auxpcm pin data parse failed\n", __func__);
		goto err;
	}

	/* Parse Secondary AUXPCM info from DT */
	ret = msm8974_dtparse_auxpcm(pdev, &pdata->sec_auxpcm_ctrl,
					msm_sec_auxpcm_gpio_name);
	if (ret) {
		dev_err(&pdev->dev,
		"%s: Secondary Auxpcm pin data parse failed\n", __func__);
		goto err;
	}


	ext_ult_lo_amp_gpio = of_get_named_gpio(pdev->dev.of_node,
						prop_name_ult_lo_gpio, 0);
	if (!gpio_is_valid(ext_ult_lo_amp_gpio)) {
		dev_dbg(&pdev->dev,
			"Couldn't find %s property in node %s, %d\n",
			prop_name_ult_lo_gpio, pdev->dev.of_node->full_name,
			ext_ult_lo_amp_gpio);
	} else {
		ret = gpio_request(ext_ult_lo_amp_gpio, "US_AMP_GPIO");
		if (ret) {
			dev_err(card->dev,
				"%s: Failed to request US amp gpio %d\n",
				__func__, ext_ult_lo_amp_gpio);
			goto err;
		}
	}



	pdata->us_euro_gpio = of_get_named_gpio(pdev->dev.of_node,
	pdata->us_euro_gpio = of_get_named_gpio(pdev->dev.of_node,
				"qcom,us-euro-gpios", 0);
				"qcom,us-euro-gpios", 0);
@@ -2774,20 +2791,6 @@ static int msm8974_asoc_machine_probe(struct platform_device *pdev)
		dev_err(&pdev->dev, "msm8974_prepare_us_euro failed (%d)\n",
		dev_err(&pdev->dev, "msm8974_prepare_us_euro failed (%d)\n",
			ret);
			ret);


	mutex_init(&cdc_mclk_mutex);
	atomic_set(&prim_auxpcm_rsc_ref, 0);
	atomic_set(&sec_auxpcm_rsc_ref, 0);
	spdev = pdev;
	ext_spk_amp_regulator = NULL;
	msm8974_liquid_dock_dev = NULL;

	ret = snd_soc_register_card(card);
	if (ret) {
		dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n",
			ret);
		goto err1;
	}

	ret = of_property_read_string(pdev->dev.of_node,
	ret = of_property_read_string(pdev->dev.of_node,
			"qcom,prim-auxpcm-gpio-set", &auxpcm_pri_gpio_set);
			"qcom,prim-auxpcm-gpio-set", &auxpcm_pri_gpio_set);
	if (ret) {
	if (ret) {
@@ -2820,6 +2823,7 @@ static int msm8974_asoc_machine_probe(struct platform_device *pdev)
	return 0;
	return 0;


err1:
err1:
	if (ext_ult_lo_amp_gpio > 0)
		gpio_free(ext_ult_lo_amp_gpio);
		gpio_free(ext_ult_lo_amp_gpio);
	ext_ult_lo_amp_gpio = -1;
	ext_ult_lo_amp_gpio = -1;
err:
err: