summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/bridge/sii902x.c
diff options
context:
space:
mode:
authorOlivier Moysan <olivier.moysan@st.com>2019-07-22 18:06:00 +0200
committerBenjamin Gaignard <benjamin.gaignard@linaro.org>2019-07-25 12:03:59 +0200
commit6b72c7a98bd631533c4f4ab293c8082abbb42601 (patch)
treecece53347195ddd5d27b94f3e53cb3a13b81be73 /drivers/gpu/drm/bridge/sii902x.c
parentdt-bindings: display: sii902x: Change audio mclk binding (diff)
downloadlinux-6b72c7a98bd631533c4f4ab293c8082abbb42601.tar.xz
linux-6b72c7a98bd631533c4f4ab293c8082abbb42601.zip
drm/bridge: sii902x: make audio mclk optional
The master clock on i2s bus is not mandatory, as sii902X internal PLL can be used instead. Make use of mclk optional. Signed-off-by: Olivier Moysan <olivier.moysan@st.com> Reviewed-by: Jyri Sarha <jsarha@ti.com> Acked-by: Andrzej Hajda <a.hajda@samsung.com> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org> Link: https://patchwork.freedesktop.org/patch/msgid/1563811560-29589-4-git-send-email-olivier.moysan@st.com
Diffstat (limited to 'drivers/gpu/drm/bridge/sii902x.c')
-rw-r--r--drivers/gpu/drm/bridge/sii902x.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/gpu/drm/bridge/sii902x.c b/drivers/gpu/drm/bridge/sii902x.c
index 962931c20efe..a323815aa9b6 100644
--- a/drivers/gpu/drm/bridge/sii902x.c
+++ b/drivers/gpu/drm/bridge/sii902x.c
@@ -568,13 +568,14 @@ static int sii902x_audio_hw_params(struct device *dev, void *data,
return ret;
}
- mclk_rate = clk_get_rate(sii902x->audio.mclk);
-
- ret = sii902x_select_mclk_div(&i2s_config_reg, params->sample_rate,
- mclk_rate);
- if (mclk_rate != ret * params->sample_rate)
- dev_dbg(dev, "Inaccurate reference clock (%ld/%d != %u)\n",
- mclk_rate, ret, params->sample_rate);
+ if (sii902x->audio.mclk) {
+ mclk_rate = clk_get_rate(sii902x->audio.mclk);
+ ret = sii902x_select_mclk_div(&i2s_config_reg,
+ params->sample_rate, mclk_rate);
+ if (mclk_rate != ret * params->sample_rate)
+ dev_dbg(dev, "Inaccurate reference clock (%ld/%d != %u)\n",
+ mclk_rate, ret, params->sample_rate);
+ }
mutex_lock(&sii902x->mutex);
@@ -751,11 +752,11 @@ static int sii902x_audio_codec_init(struct sii902x *sii902x,
sii902x->audio.i2s_fifo_sequence[i] |= audio_fifo_id[i] |
i2s_lane_id[lanes[i]] | SII902X_TPI_I2S_FIFO_ENABLE;
- sii902x->audio.mclk = devm_clk_get(dev, "mclk");
+ sii902x->audio.mclk = devm_clk_get_optional(dev, "mclk");
if (IS_ERR(sii902x->audio.mclk)) {
dev_err(dev, "%s: No clock (audio mclk) found: %ld\n",
__func__, PTR_ERR(sii902x->audio.mclk));
- return 0;
+ return PTR_ERR(sii902x->audio.mclk);
}
sii902x->audio.pdev = platform_device_register_data(