[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7ed1287d00da70de13627480b1601bfd2c6e570a.1584720678.git.alexander.riesen@cetitec.com>
Date: Fri, 20 Mar 2020 17:12:02 +0100
From: Alex Riesen <alexander.riesen@...itec.com>
To: Kieran Bingham <kieran.bingham@...asonboard.com>
CC: Geert Uytterhoeven <geert@...ux-m68k.org>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Hans Verkuil <hverkuil-cisco@...all.nl>,
"Laurent Pinchart" <laurent.pinchart@...asonboard.com>,
Rob Herring <robh+dt@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>,
<devel@...verdev.osuosl.org>, <linux-media@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <devicetree@...r.kernel.org>,
<linux-renesas-soc@...r.kernel.org>
Subject: [PATCH v3 06/11] media: adv748x: prepare/enable mclk when the audio
is used
As there is nothing else (the consumers are supposed to do that) which
enables the clock, do it in the driver.
Signed-off-by: Alexander Riesen <alexander.riesen@...itec.com>
--
v3: added
---
drivers/media/i2c/adv748x/adv748x-dai.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/drivers/media/i2c/adv748x/adv748x-dai.c b/drivers/media/i2c/adv748x/adv748x-dai.c
index 6fce7d000423..1c673efd4745 100644
--- a/drivers/media/i2c/adv748x/adv748x-dai.c
+++ b/drivers/media/i2c/adv748x/adv748x-dai.c
@@ -117,11 +117,22 @@ static int adv748x_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
static int adv748x_dai_startup(struct snd_pcm_substream *sub, struct snd_soc_dai *dai)
{
+ int ret;
struct adv748x_state *state = state_of(dai);
if (sub->stream != SNDRV_PCM_STREAM_CAPTURE)
return -EINVAL;
- return set_audio_pads_state(state, 1);
+ ret = set_audio_pads_state(state, 1);
+ if (ret)
+ goto fail;
+ ret = clk_prepare_enable(state->dai.mclk);
+ if (ret)
+ goto fail_pwdn;
+ return 0;
+fail_pwdn:
+ set_audio_pads_state(state, 0);
+fail:
+ return ret;
}
static int adv748x_dai_hw_params(struct snd_pcm_substream *sub,
@@ -174,6 +185,7 @@ static void adv748x_dai_shutdown(struct snd_pcm_substream *sub, struct snd_soc_d
{
struct adv748x_state *state = state_of(dai);
+ clk_disable_unprepare(state->dai.mclk);
set_audio_pads_state(state, 0);
}
--
2.25.1.25.g9ecbe7eb18
Powered by blists - more mailing lists