struct snd_pcm_runtime *runtime = substream->runtime;
struct mxc_spdif_priv *spdif_priv = snd_soc_codec_get_drvdata(codec);
struct mxc_spdif_platform_data *plat_data = spdif_priv->plat_data;
- int err;
+ int err = 0;
if (!plat_data->spdif_tx)
return -EINVAL;
spdif_priv->tx_active = true;
- clk_enable(plat_data->spdif_clk);
- clk_enable(plat_data->spdif_audio_clk);
+ err = clk_enable(plat_data->spdif_clk);
+ if (err < 0)
+ goto failed_clk;
err = snd_pcm_hw_constraint_list(runtime, 0,
SNDRV_PCM_HW_PARAM_RATE,
goto failed;
return 0;
+
failed:
- clk_disable(plat_data->spdif_audio_clk);
clk_disable(plat_data->spdif_clk);
+failed_clk:
spdif_priv->tx_active = false;
return err;
}
regval |= SCR_LOW_POWER;
__raw_writel(regval, SPDIF_REG_SCR + spdif_base_addr);
- clk_disable(plat_data->spdif_audio_clk);
clk_disable(plat_data->spdif_clk);
spdif_priv->tx_active = false;
spdif_priv->rx_active = true;
/* enable rx bus clock */
- clk_enable(plat_data->spdif_clk);
+ err = clk_enable(plat_data->spdif_clk);
+ if (err < 0)
+ goto failed_clk;
/* set hw param constraints */
err = snd_pcm_hw_constraint_list(runtime, 0,
failed:
clk_disable(plat_data->spdif_clk);
+failed_clk:
spdif_priv->rx_active = false;
return err;
}
struct snd_soc_codec *codec = dai->codec;
struct mxc_spdif_priv *spdif_priv = snd_soc_codec_get_drvdata(codec);
struct mxc_spdif_platform_data *plat_data = spdif_priv->plat_data;
- int ret;
+ int ret = 0;
/* enable spdif_xtal_clk */
- clk_enable(plat_data->spdif_core_clk);
+ ret = clk_enable(plat_data->spdif_core_clk);
+ if (ret < 0)
+ goto failed_clk;
+
spdif_softreset();
/* disable all the interrupts */
spdif_intr_enable(0xffffff, 0);
else
ret = mxc_spdif_capture_startup(substream, dai);
+failed_clk:
return ret;
}
else
ret = mxc_spdif_capture_shutdown(substream, dai);
/* disable spdif_core clock */
- clk_put(plat_data->spdif_clk);
clk_disable(plat_data->spdif_core_clk);
}
plat_data = spdif_priv->plat_data;
- if (spdif_priv->tx_active) {
- clk_disable(plat_data->spdif_audio_clk);
+ if (spdif_priv->tx_active)
clk_disable(plat_data->spdif_clk);
- }
if (spdif_priv->rx_active)
clk_disable(plat_data->spdif_clk);
clk_enable(plat_data->spdif_core_clk);
- if (spdif_priv->tx_active) {
+ if (spdif_priv->tx_active)
clk_enable(plat_data->spdif_clk);
- clk_enable(plat_data->spdif_audio_clk);
- }
if (spdif_priv->rx_active)
clk_enable(plat_data->spdif_clk);
card_err:
clk_put(plat_data->spdif_clk);
- clk_disable(plat_data->spdif_core_clk);
failed_clk:
platform_set_drvdata(pdev, NULL);
kfree(spdif_priv);