Skip to content

Instantly share code, notes, and snippets.

@HiassofT
Last active May 9, 2016 18:38
Show Gist options
  • Save HiassofT/33beeaf5a78d2819a324a11e2e3423fe to your computer and use it in GitHub Desktop.
Save HiassofT/33beeaf5a78d2819a324a11e2e3423fe to your computer and use it in GitHub Desktop.
diff --git a/sound/soc/bcm/iqaudio-dac.c b/sound/soc/bcm/iqaudio-dac.c
index b6b6dcf..b9a0c31 100644
--- a/sound/soc/bcm/iqaudio-dac.c
+++ b/sound/soc/bcm/iqaudio-dac.c
@@ -54,6 +54,38 @@ static int snd_rpi_iqaudio_dac_hw_params(struct snd_pcm_substream *substream,
return snd_soc_dai_set_bclk_ratio(cpu_dai, sample_bits * 2);
}
+static int snd_rpi_iqaudio_set_bias_level(struct snd_soc_card *card,
+ struct snd_soc_dapm_context *dapm,
+ enum snd_soc_bias_level level)
+{
+ struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai;
+
+ if (dapm->dev != codec_dai->dev)
+ return 0;
+
+ switch (level) {
+ case SND_SOC_BIAS_PREPARE:
+ if (dapm->bias_level != SND_SOC_BIAS_STANDBY)
+ break;
+
+ /* TODO unmute etc. */
+ break;
+
+ case SND_SOC_BIAS_STANDBY:
+ if (dapm->bias_level != SND_SOC_BIAS_PREPARE)
+ break;
+
+ /* TODO mute etc. */
+ break;
+
+ default:
+ break;
+ }
+
+ return 0;
+}
+
+
/* machine stream operations */
static struct snd_soc_ops snd_rpi_iqaudio_dac_ops = {
.hw_params = snd_rpi_iqaudio_dac_hw_params,
@@ -77,6 +109,7 @@ static struct snd_soc_card snd_rpi_iqaudio_dac = {
.owner = THIS_MODULE,
.dai_link = snd_rpi_iqaudio_dac_dai,
.num_links = ARRAY_SIZE(snd_rpi_iqaudio_dac_dai),
+ .set_bias_level = snd_rpi_iqaudio_set_bias_level,
};
static int snd_rpi_iqaudio_dac_probe(struct platform_device *pdev)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment