Skip to content

Commit 7837702

Browse files
AngeloGioacchino Del RegnoChun-Kuang Hu
authored andcommitted
drm/mediatek: mtk_hdmi: Move N/CTS setting to new function
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 <[email protected]> Signed-off-by: AngeloGioacchino Del Regno <[email protected]> Link: https://patchwork.kernel.org/project/dri-devel/patch/[email protected]/ Signed-off-by: Chun-Kuang Hu <[email protected]>
1 parent c92493e commit 7837702

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

drivers/gpu/drm/mediatek/mtk_hdmi.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,13 @@ static unsigned int hdmi_expected_cts(unsigned int audio_sample_rate,
675675
128 * audio_sample_rate);
676676
}
677677

678+
static void mtk_hdmi_get_ncts(unsigned int sample_rate, unsigned int clock,
679+
unsigned int *n, unsigned int *cts)
680+
{
681+
*n = hdmi_recommended_n(sample_rate, clock);
682+
*cts = hdmi_expected_cts(sample_rate, clock, *n);
683+
}
684+
678685
static void do_hdmi_hw_aud_set_ncts(struct mtk_hdmi *hdmi, unsigned int n,
679686
unsigned int cts)
680687
{
@@ -705,8 +712,7 @@ static void mtk_hdmi_hw_aud_set_ncts(struct mtk_hdmi *hdmi,
705712
{
706713
unsigned int n, cts;
707714

708-
n = hdmi_recommended_n(sample_rate, clock);
709-
cts = hdmi_expected_cts(sample_rate, clock, n);
715+
mtk_hdmi_get_ncts(sample_rate, clock, &n, &cts);
710716

711717
dev_dbg(hdmi->dev, "%s: sample_rate=%u, clock=%d, cts=%u, n=%u\n",
712718
__func__, sample_rate, clock, n, cts);

0 commit comments

Comments
 (0)