novena-kernel-patches/0025-ASoC-es8328-Set-clock-...

50 lines
1.4 KiB
Diff

From c43196265f6a993367b7f277cf0cdd091574bc8b Mon Sep 17 00:00:00 2001
From: Sean Cross <xobs@kosagi.com>
Date: Mon, 27 Apr 2015 10:40:13 +0800
Subject: [PATCH 25/65] ASoC: es8328: Set clock rates when setting DAI format
The clock rate should be set when the I2C devices is instantiated.
However, there is a divide-by-two that gets stuck somewhere, which
resets the clock rate.
Set the clock rates again prior to setting everything up to get
around this problem.
Signed-off-by: Sean Cross <xobs@kosagi.com>
(sakaki: upstream has changed a lot, clock reset code simplified)
---
diff a/sound/soc/codecs/es8328.c b/sound/soc/codecs/es8328.c
--- a/sound/soc/codecs/es8328.c
+++ b/sound/soc/codecs/es8328.c
@@ -477,6 +477,9 @@
return 0;
}
+static int es8328_set_sysclk(struct snd_soc_dai *codec_dai,
+ int clk_id, unsigned int freq, int dir);
+
static int es8328_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
@@ -487,10 +490,15 @@
int reg;
int wl;
int ratio;
+ int clk_rate;
if (!es8328->sysclk_constraints) {
- dev_err(codec->dev, "No MCLK configured\n");
- return -EINVAL;
+ clk_rate = clk_get_rate(es8328->clk);
+ es8328_set_sysclk(dai, ES8328_MCLK, clk_rate, 0);
+ if (!es8328->sysclk_constraints) {
+ dev_err(codec->dev, "No MCLK configured\n");
+ return -EINVAL;
+ }
}
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
--
2.7.3