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

Commit ad80efc4 authored by Cliff Cai's avatar Cliff Cai Committed by Mark Brown
Browse files

ASoC: Blackfin I2S: fix resuming when device hasn't been used



If the sound system hasn't been utilized yet and we suspend, then we
attempt to save/restore using state that doesn't exist.  So use a global
handle instead to reconfigure properly.

Signed-off-by: default avatarCliff Cai <cliff.cai@analog.com>
Signed-off-by: default avatarMike Frysinger <vapier@gentoo.org>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent fab19bae
Loading
Loading
Loading
Loading
+7 −12
Original line number Original line Diff line number Diff line
@@ -237,36 +237,31 @@ static void bf5xx_i2s_remove(struct platform_device *pdev,
#ifdef CONFIG_PM
#ifdef CONFIG_PM
static int bf5xx_i2s_suspend(struct snd_soc_dai *dai)
static int bf5xx_i2s_suspend(struct snd_soc_dai *dai)
{
{
	struct sport_device *sport =
		(struct sport_device *)dai->private_data;


	pr_debug("%s : sport %d\n", __func__, dai->id);
	pr_debug("%s : sport %d\n", __func__, dai->id);
	if (!dai->active)

		return 0;
	if (dai->capture.active)
	if (dai->capture.active)
		sport_rx_stop(sport);
		sport_rx_stop(sport_handle);
	if (dai->playback.active)
	if (dai->playback.active)
		sport_tx_stop(sport);
		sport_tx_stop(sport_handle);
	return 0;
	return 0;
}
}


static int bf5xx_i2s_resume(struct snd_soc_dai *dai)
static int bf5xx_i2s_resume(struct snd_soc_dai *dai)
{
{
	int ret;
	int ret;
	struct sport_device *sport =
		(struct sport_device *)dai->private_data;


	pr_debug("%s : sport %d\n", __func__, dai->id);
	pr_debug("%s : sport %d\n", __func__, dai->id);
	if (!dai->active)
		return 0;


	ret = sport_config_rx(sport, RFSR | RCKFE, RSFSE|0x1f, 0, 0);
	ret = sport_config_rx(sport_handle, bf5xx_i2s.rcr1,
				      bf5xx_i2s.rcr2, 0, 0);
	if (ret) {
	if (ret) {
		pr_err("SPORT is busy!\n");
		pr_err("SPORT is busy!\n");
		return -EBUSY;
		return -EBUSY;
	}
	}


	ret = sport_config_tx(sport, TFSR | TCKFE, TSFSE|0x1f, 0, 0);
	ret = sport_config_tx(sport_handle, bf5xx_i2s.tcr1,
				      bf5xx_i2s.tcr2, 0, 0);
	if (ret) {
	if (ret) {
		pr_err("SPORT is busy!\n");
		pr_err("SPORT is busy!\n");
		return -EBUSY;
		return -EBUSY;