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

Commit 31833ead authored by Charles Keepax's avatar Charles Keepax Committed by Mark Brown
Browse files

ASoC: arizona: Move request of speaker IRQs into bus probe



It is more idiomatic to request all resources in the bus level probe,
this patch moves the request of the speaker thermal event IRQs from the
ASoC level probe into the bus level probe.

Signed-off-by: default avatarCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent ae1ea48c
Loading
Loading
Loading
Loading
+11 −6
Original line number Diff line number Diff line
@@ -191,6 +191,14 @@ int arizona_init_spk(struct snd_soc_codec *codec)
		break;
	}

	return 0;
}
EXPORT_SYMBOL_GPL(arizona_init_spk);

int arizona_init_spk_irqs(struct arizona *arizona)
{
	int ret;

	ret = arizona_request_irq(arizona, ARIZONA_IRQ_SPK_OVERHEAT_WARN,
				  "Thermal warning", arizona_thermal_warn,
				  arizona);
@@ -209,19 +217,16 @@ int arizona_init_spk(struct snd_soc_codec *codec)

	return 0;
}
EXPORT_SYMBOL_GPL(arizona_init_spk);
EXPORT_SYMBOL_GPL(arizona_init_spk_irqs);

int arizona_free_spk(struct snd_soc_codec *codec)
int arizona_free_spk_irqs(struct arizona *arizona)
{
	struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec);
	struct arizona *arizona = priv->arizona;

	arizona_free_irq(arizona, ARIZONA_IRQ_SPK_OVERHEAT_WARN, arizona);
	arizona_free_irq(arizona, ARIZONA_IRQ_SPK_OVERHEAT, arizona);

	return 0;
}
EXPORT_SYMBOL_GPL(arizona_free_spk);
EXPORT_SYMBOL_GPL(arizona_free_spk_irqs);

static const struct snd_soc_dapm_route arizona_mono_routes[] = {
	{ "OUT1R", NULL, "OUT1L" },
+2 −1
Original line number Diff line number Diff line
@@ -317,7 +317,8 @@ extern int arizona_init_gpio(struct snd_soc_codec *codec);
extern int arizona_init_mono(struct snd_soc_codec *codec);
extern int arizona_init_notifiers(struct snd_soc_codec *codec);

extern int arizona_free_spk(struct snd_soc_codec *codec);
extern int arizona_init_spk_irqs(struct arizona *arizona);
extern int arizona_free_spk_irqs(struct arizona *arizona);

extern int arizona_init_dai(struct arizona_priv *priv, int dai);

+15 −4
Original line number Diff line number Diff line
@@ -1170,8 +1170,6 @@ static int cs47l24_codec_remove(struct snd_soc_codec *codec)

	arizona_free_irq(arizona, ARIZONA_IRQ_DSP_IRQ1, priv);

	arizona_free_spk(codec);

	return 0;
}

@@ -1287,19 +1285,30 @@ static int cs47l24_probe(struct platform_device *pdev)
	pm_runtime_enable(&pdev->dev);
	pm_runtime_idle(&pdev->dev);

	ret = arizona_init_spk_irqs(arizona);
	if (ret < 0)
		return ret;

	ret = snd_soc_register_platform(&pdev->dev, &cs47l24_compr_platform);
	if (ret < 0) {
		dev_err(&pdev->dev, "Failed to register platform: %d\n", ret);
		return ret;
		goto err_spk_irqs;
	}

	ret = snd_soc_register_codec(&pdev->dev, &soc_codec_dev_cs47l24,
				      cs47l24_dai, ARRAY_SIZE(cs47l24_dai));
	if (ret < 0) {
		dev_err(&pdev->dev, "Failed to register codec: %d\n", ret);
		snd_soc_unregister_platform(&pdev->dev);
		goto err_platform;
	}

	return ret;

err_platform:
	snd_soc_unregister_platform(&pdev->dev);
err_spk_irqs:
	arizona_free_spk_irqs(arizona);

	return ret;
}

@@ -1314,6 +1323,8 @@ static int cs47l24_remove(struct platform_device *pdev)
	wm_adsp2_remove(&cs47l24->core.adsp[1]);
	wm_adsp2_remove(&cs47l24->core.adsp[2]);

	arizona_free_spk_irqs(arizona);

	return 0;
}

+16 −4
Original line number Diff line number Diff line
@@ -1978,8 +1978,6 @@ static int wm5102_codec_remove(struct snd_soc_codec *codec)

	arizona_free_irq(arizona, ARIZONA_IRQ_DSP_IRQ1, priv);

	arizona_free_spk(codec);

	return 0;
}

@@ -2097,25 +2095,37 @@ static int wm5102_probe(struct platform_device *pdev)
	pm_runtime_enable(&pdev->dev);
	pm_runtime_idle(&pdev->dev);

	ret = arizona_init_spk_irqs(arizona);
	if (ret < 0)
		return ret;

	ret = snd_soc_register_platform(&pdev->dev, &wm5102_compr_platform);
	if (ret < 0) {
		dev_err(&pdev->dev, "Failed to register platform: %d\n", ret);
		return ret;
		goto err_spk_irqs;
	}

	ret = snd_soc_register_codec(&pdev->dev, &soc_codec_dev_wm5102,
				      wm5102_dai, ARRAY_SIZE(wm5102_dai));
	if (ret < 0) {
		dev_err(&pdev->dev, "Failed to register codec: %d\n", ret);
		snd_soc_unregister_platform(&pdev->dev);
		goto err_platform;
	}

	return ret;

err_platform:
	snd_soc_unregister_platform(&pdev->dev);
err_spk_irqs:
	arizona_free_spk_irqs(arizona);

	return ret;
}

static int wm5102_remove(struct platform_device *pdev)
{
	struct wm5102_priv *wm5102 = platform_get_drvdata(pdev);
	struct arizona *arizona = wm5102->core.arizona;

	snd_soc_unregister_platform(&pdev->dev);
	snd_soc_unregister_codec(&pdev->dev);
@@ -2123,6 +2133,8 @@ static int wm5102_remove(struct platform_device *pdev)

	wm_adsp2_remove(&wm5102->core.adsp[0]);

	arizona_free_spk_irqs(arizona);

	return 0;
}

+16 −4
Original line number Diff line number Diff line
@@ -2330,8 +2330,6 @@ static int wm5110_codec_remove(struct snd_soc_codec *codec)

	arizona_free_irq(arizona, ARIZONA_IRQ_DSP_IRQ1, priv);

	arizona_free_spk(codec);

	return 0;
}

@@ -2453,25 +2451,37 @@ static int wm5110_probe(struct platform_device *pdev)
	pm_runtime_enable(&pdev->dev);
	pm_runtime_idle(&pdev->dev);

	ret = arizona_init_spk_irqs(arizona);
	if (ret < 0)
		return ret;

	ret = snd_soc_register_platform(&pdev->dev, &wm5110_compr_platform);
	if (ret < 0) {
		dev_err(&pdev->dev, "Failed to register platform: %d\n", ret);
		return ret;
		goto err_spk_irqs;
	}

	ret = snd_soc_register_codec(&pdev->dev, &soc_codec_dev_wm5110,
				      wm5110_dai, ARRAY_SIZE(wm5110_dai));
	if (ret < 0) {
		dev_err(&pdev->dev, "Failed to register codec: %d\n", ret);
		snd_soc_unregister_platform(&pdev->dev);
		goto err_platform;
	}

	return ret;

err_platform:
	snd_soc_unregister_platform(&pdev->dev);
err_spk_irqs:
	arizona_free_spk_irqs(arizona);

	return ret;
}

static int wm5110_remove(struct platform_device *pdev)
{
	struct wm5110_priv *wm5110 = platform_get_drvdata(pdev);
	struct arizona *arizona = wm5110->core.arizona;
	int i;

	snd_soc_unregister_platform(&pdev->dev);
@@ -2481,6 +2491,8 @@ static int wm5110_remove(struct platform_device *pdev)
	for (i = 0; i < WM5110_NUM_ADSP; i++)
		wm_adsp2_remove(&wm5110->core.adsp[i]);

	arizona_free_spk_irqs(arizona);

	return 0;
}

Loading