diff mbox

[PATCH/RFC,11/14] ASoC: samsung: odroidx2: Handle I2S CDCLK clock conditionally

Message ID 1418319952-10163-12-git-send-email-s.nawrocki@samsung.com (mailing list archive)
State Accepted
Commit ecb400cabb37cfef3221e45e4f6370a855aa7a44
Headers show

Commit Message

If the codec control it's master clock provider by the I2S module
we should not be touching it with set_sysclk() calls.
So skip the set_sysclk() call in the machine driver if "clocks"
property is found in the codec device node.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
---
 sound/soc/samsung/odroidx2_max98090.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Mark Brown Dec. 12, 2014, 6:53 p.m. UTC | #1
On Thu, Dec 11, 2014 at 06:45:49PM +0100, Sylwester Nawrocki wrote:
> If the codec control it's master clock provider by the I2S module
> we should not be touching it with set_sysclk() calls.
> So skip the set_sysclk() call in the machine driver if "clocks"
> property is found in the codec device node.

Please clarify in the changelog here that this is a transition measure
to support old DTs, it's not clear why we might want to do things for
the I2S controller by fishing around in the CODEC DT otherwise.
On 12/12/14 19:53, Mark Brown wrote:
> On Thu, Dec 11, 2014 at 06:45:49PM +0100, Sylwester Nawrocki wrote:
>> > If the codec control it's master clock provider by the I2S module
>> > we should not be touching it with set_sysclk() calls.
>> > So skip the set_sysclk() call in the machine driver if "clocks"
>> > property is found in the codec device node.
>
> Please clarify in the changelog here that this is a transition measure
> to support old DTs, it's not clear why we might want to do things for
> the I2S controller by fishing around in the CODEC DT otherwise.

Indeed, there is some room for improvement. I'll add such note to the
commit description. Presumably this whole driver could be removed
after a kernel release or two, since we switched Odroid X2/U3 to
the simple-card.
diff mbox

Patch

diff --git a/sound/soc/samsung/odroidx2_max98090.c b/sound/soc/samsung/odroidx2_max98090.c
index 3c8f604..ca94938 100644
--- a/sound/soc/samsung/odroidx2_max98090.c
+++ b/sound/soc/samsung/odroidx2_max98090.c
@@ -21,6 +21,8 @@  struct odroidx2_drv_data {
 /* The I2S CDCLK output clock frequency for the MAX98090 codec */
 #define MAX98090_MCLK 19200000
 
+static struct snd_soc_dai_link odroidx2_dai[];
+
 static int odroidx2_late_probe(struct snd_soc_card *card)
 {
 	struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai;
@@ -29,7 +31,9 @@  static int odroidx2_late_probe(struct snd_soc_card *card)
 
 	ret = snd_soc_dai_set_sysclk(codec_dai, 0, MAX98090_MCLK,
 						SND_SOC_CLOCK_IN);
-	if (ret < 0)
+
+	if (ret < 0 || of_find_property(odroidx2_dai[0].codec_of_node,
+					"clocks", NULL))
 		return ret;
 
 	/* Set the cpu DAI configuration in order to use CDCLK */