Fix audio master clock use for Silab sii902x HDMI transceiver.
Make audio master clock optional, as this clock is not mandatory.
Changes in v2:
- Rely on clk framework to manage undefined mclk case.
- Use devm_clk_get_optional instead of devm_clk_get.
Olivier Moysan (3):
drm/bridge: sii902x: fix missing reference to mclk clock
dt-bindings: display: sii902x: Change audio mclk binding
drm/bridge: sii902x: make audio mclk optional
.../devicetree/bindings/display/bridge/sii902x.txt | 5 ++---
drivers/gpu/drm/bridge/sii902x.c | 18 ++++++++++--------
2 files changed, 12 insertions(+), 11 deletions(-)
--
2.7.4
As stated in SiL9022/24 datasheet, master clock is not required for I2S.
Make mclk property optional in DT bindings.
Fixes: 3f18021f43a3 ("dt-bindings: display: sii902x: Add HDMI audio bindings")
Signed-off-by: Olivier Moysan <[email protected]>
Reviewed-by: Jyri Sarha <[email protected]>
Acked-by: Andrzej Hajda <[email protected]>
---
Documentation/devicetree/bindings/display/bridge/sii902x.txt | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/Documentation/devicetree/bindings/display/bridge/sii902x.txt b/Documentation/devicetree/bindings/display/bridge/sii902x.txt
index 2df44b7d3821..6e14e087c0d0 100644
--- a/Documentation/devicetree/bindings/display/bridge/sii902x.txt
+++ b/Documentation/devicetree/bindings/display/bridge/sii902x.txt
@@ -26,9 +26,8 @@ Optional properties:
- clocks: phandle and clock specifier for each clock listed in
the clock-names property
- clock-names: "mclk"
- Describes SII902x MCLK input. MCLK is used to produce
- HDMI audio CTS values. This property is required if
- "#sound-dai-cells"-property is present. This property follows
+ Describes SII902x MCLK input. MCLK can be used to produce
+ HDMI audio CTS values. This property follows
Documentation/devicetree/bindings/clock/clock-bindings.txt
consumer binding.
--
2.7.4
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 <[email protected]>
Reviewed-by: Jyri Sarha <[email protected]>
Acked-by: Andrzej Hajda <[email protected]>
---
drivers/gpu/drm/bridge/sii902x.c | 19 ++++++++++---------
1 file 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(
--
2.7.4
Le lun. 22 juil. 2019 à 18:06, Olivier Moysan <[email protected]> a écrit :
>
> The master clock on i2s bus is not mandatory,
> as sii902X internal PLL can be used instead.
> Make use of mclk optional.
Applied on drm-misc-next.
Thanks,
Benjamin
>
> Signed-off-by: Olivier Moysan <[email protected]>
> Reviewed-by: Jyri Sarha <[email protected]>
> Acked-by: Andrzej Hajda <[email protected]>
> ---
> drivers/gpu/drm/bridge/sii902x.c | 19 ++++++++++---------
> 1 file 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(
> --
> 2.7.4
>
> _______________________________________________
> dri-devel mailing list
> [email protected]
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
Le lun. 22 juil. 2019 à 18:06, Olivier Moysan <[email protected]> a écrit :
>
> As stated in SiL9022/24 datasheet, master clock is not required for I2S.
> Make mclk property optional in DT bindings.
>
> Fixes: 3f18021f43a3 ("dt-bindings: display: sii902x: Add HDMI audio bindings")
>
Applied on drm-misc-next.
Thanks,
Benjamin
> Signed-off-by: Olivier Moysan <[email protected]>
> Reviewed-by: Jyri Sarha <[email protected]>
> Acked-by: Andrzej Hajda <[email protected]>
> ---
> Documentation/devicetree/bindings/display/bridge/sii902x.txt | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/display/bridge/sii902x.txt b/Documentation/devicetree/bindings/display/bridge/sii902x.txt
> index 2df44b7d3821..6e14e087c0d0 100644
> --- a/Documentation/devicetree/bindings/display/bridge/sii902x.txt
> +++ b/Documentation/devicetree/bindings/display/bridge/sii902x.txt
> @@ -26,9 +26,8 @@ Optional properties:
> - clocks: phandle and clock specifier for each clock listed in
> the clock-names property
> - clock-names: "mclk"
> - Describes SII902x MCLK input. MCLK is used to produce
> - HDMI audio CTS values. This property is required if
> - "#sound-dai-cells"-property is present. This property follows
> + Describes SII902x MCLK input. MCLK can be used to produce
> + HDMI audio CTS values. This property follows
> Documentation/devicetree/bindings/clock/clock-bindings.txt
> consumer binding.
>
> --
> 2.7.4
>
> _______________________________________________
> dri-devel mailing list
> [email protected]
> https://lists.freedesktop.org/mailman/listinfo/dri-devel