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

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

Merge "ASoC: apq8084: Defer probe during sound card registration"

parents 09e5d7b0 4822a687
Loading
Loading
Loading
Loading
+37 −32
Original line number Diff line number Diff line
@@ -378,6 +378,8 @@ static int apq8084_liquid_init_docking(struct snd_soc_dapm_context *dapm)
			&apq8084_liquid_dock_dev->irq_work,
			apq8084_liquid_docking_irq_work);
	}
	return 0;

out2:
	gpio_free(apq8084_liquid_dock_dev->dock_plug_gpio);
out:
@@ -2404,24 +2406,6 @@ static int apq8084_asoc_machine_probe(struct platform_device *pdev)
		return -ENOMEM;
	}

	/* Parse Primary AUXPCM info from DT */
	ret = apq8084_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 = apq8084_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;
	platform_set_drvdata(pdev, card);
	snd_soc_card_set_drvdata(card, pdata);
@@ -2484,6 +2468,40 @@ static int apq8084_asoc_machine_probe(struct platform_device *pdev)
		card->num_links	= ARRAY_SIZE(apq8084_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;
	apq8084_liquid_dock_dev = NULL;

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

	/* Parse Primary AUXPCM info from DT */
	ret = apq8084_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 = apq8084_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;
	}

	pdata->us_euro_gpio = of_get_named_gpio(pdev->dev.of_node,
				"qcom,us-euro-gpios", 0);
	if (pdata->us_euro_gpio < 0) {
@@ -2501,20 +2519,6 @@ static int apq8084_asoc_machine_probe(struct platform_device *pdev)
		dev_err(&pdev->dev, "apq8084_prepare_us_euro failed (%d)\n",
			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;
	apq8084_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;
	}

	ret = of_property_read_string(pdev->dev.of_node,
			"qcom,prim-auxpcm-gpio-set", &auxpcm_pri_gpio_set);
	if (ret) {
@@ -2559,6 +2563,7 @@ err:
		gpio_free(pdata->us_euro_gpio);
		pdata->us_euro_gpio = 0;
	}
	mutex_destroy(&cdc_mclk_mutex);
	devm_kfree(&pdev->dev, pdata);
	return ret;
}