<html><body><p>
<pre>
Hi, Angelo:

On Tue, 2024-12-17 at 16:43 +0100, AngeloGioacchino Del Regno wrote:
> External email : Please do not click links or open attachments until you have verified the sender or the content.
>
>
> In preparation for splitting common bits of this driver, moving
> the hdmi_rec_n_table struct array, and the hdmi_recommended_n(),
> hdmi_mode_clock_to_hz(), hdmi_expected_cts() functions, add one
> function called mtk_hdmi_get_ncts() that sets both N and CTS in
> a single call.

Reviewed-by: CK Hu <ck.hu@mediatek.com>

>
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
> drivers/gpu/drm/mediatek/mtk_hdmi.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c b/drivers/gpu/drm/mediatek/mtk_hdmi.c
> index f60c4effe905..ef8dfcb77318 100644
> --- a/drivers/gpu/drm/mediatek/mtk_hdmi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c
> @@ -682,6 +682,13 @@ static unsigned int hdmi_expected_cts(unsigned int audio_sample_rate,
> 128 * audio_sample_rate);
> }
>
> +static void mtk_hdmi_get_ncts(unsigned int sample_rate, unsigned int clock,
> + unsigned int *n, unsigned int *cts)
> +{
> + *n = hdmi_recommended_n(sample_rate, clock);
> + *cts = hdmi_expected_cts(sample_rate, clock, *n);
> +}
> +
> static void do_hdmi_hw_aud_set_ncts(struct mtk_hdmi *hdmi, unsigned int n,
> unsigned int cts)
> {
> @@ -712,8 +719,7 @@ static void mtk_hdmi_hw_aud_set_ncts(struct mtk_hdmi *hdmi,
> {
> unsigned int n, cts;
>
> - n = hdmi_recommended_n(sample_rate, clock);
> - cts = hdmi_expected_cts(sample_rate, clock, n);
> + mtk_hdmi_get_ncts(sample_rate, clock, &n, &cts);
>
> dev_dbg(hdmi->dev, "%s: sample_rate=%u, clock=%d, cts=%u, n=%u\n",
> __func__, sample_rate, clock, n, cts);
> --
> 2.47.0
>


</pre>
</p></body></html><!--type:text--><!--{--><pre>************* MEDIATEK Confidentiality Notice ********************
The information contained in this e-mail message (including any 
attachments) may be confidential, proprietary, privileged, or otherwise
exempt from disclosure under applicable laws. It is intended to be 
conveyed only to the designated recipient(s). Any use, dissemination, 
distribution, printing, retaining or copying of this e-mail (including its 
attachments) by unintended recipient(s) is strictly prohibited and may 
be unlawful. If you are not an intended recipient of this e-mail, or believe 
that you have received this e-mail in error, please notify the sender 
immediately (by replying to this e-mail), delete any and all copies of 
this e-mail (including any attachments) from your system, and do not
disclose the content of this e-mail to any other person. Thank you!
</pre><!--}-->