From mboxrd@z Thu Jan 1 00:00:00 1970 From: Arnaud Pouliquen Subject: Re: [RFC v2 1/6] video: hdmi: add helper function for N and CTS Date: Fri, 19 Feb 2016 09:20:43 +0100 Message-ID: <56C6D05B.8080107@st.com> References: <1453484912-24547-1-git-send-email-arnaud.pouliquen@st.com> <1453484912-24547-2-git-send-email-arnaud.pouliquen@st.com> <1455805250.3937.19.camel@pengutronix.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [62.209.51.94]) by alsa0.perex.cz (Postfix) with ESMTP id 7248C2669B8 for ; Fri, 19 Feb 2016 09:20:48 +0100 (CET) In-Reply-To: <1455805250.3937.19.camel@pengutronix.de> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Philipp Zabel Cc: Jean-Francois Moine , "alsa-devel@alsa-project.org" , Lars-Peter Clausen , Russell King - ARM Linux , David Airlie , Liam Girdwood , Jyri Sarha , Takashi Iwai , Mark Brown , Benjamin Gaignard List-Id: alsa-devel@alsa-project.org On 02/18/2016 03:20 PM, Philipp Zabel wrote: > Hi Arnaud, > > Am Freitag, den 22.01.2016, 18:48 +0100 schrieb Arnaud Pouliquen: >> From: Moise Gergaud >> >> Add helper function to compute HDMI CTS and N parameters. >> Implementation is based on HDMI 1.4b specification. >> >> Signed-off-by: Arnaud Pouliquen > > Reviewed-by: Philipp Zabel > Tested-by: Philipp Zabel > >> --- >> drivers/video/hdmi.c | 222 +++++++++++++++++++++++++++++++++++++++++++++++++++ >> include/linux/hdmi.h | 22 +++++ >> 2 files changed, 244 insertions(+) >> >> diff --git a/drivers/video/hdmi.c b/drivers/video/hdmi.c >> index 1626892..be8b8ed 100644 >> --- a/drivers/video/hdmi.c >> +++ b/drivers/video/hdmi.c >> @@ -1242,3 +1242,225 @@ int hdmi_infoframe_unpack(union hdmi_infoframe *frame, void *buffer) >> return ret; >> } >> EXPORT_SYMBOL(hdmi_infoframe_unpack); >> + >> +/** >> + * audio clock regeneration (acr) parameters >> + * N and CTS computation are based on HDMI specification 1.4b >> + */ >> +enum audio_rate { >> + HDMI_AUDIO_N_CTS_32KHZ, >> + HDMI_AUDIO_N_CTS_44_1KHZ, >> + HDMI_AUDIO_N_CTS_48KHZ, >> +}; >> + >> +struct hdmi_audio_acr { >> + unsigned int tmds_clk; >> + struct hdmi_audio_n_cts n_cts; >> +}; >> + >> +static const struct hdmi_audio_acr hdmi_audio_standard_acr[3][12] = { >> + { /*32 kHz*/ >> + { 25174825, { 4576, 28125, 0 } }, /* 25,20/1.001 MHz */ >> + { 25200000, { 4096, 25200, 0 } }, /* 25.20 MHz */ >> + { 27000000, { 4096, 27000, 0 } }, /* 27.00 MHz */ >> + { 27027000, { 4096, 27027, 0 } }, /* 27.00*1.001 MHz */ >> + { 54000000, { 4096, 54000, 0 } }, /* 54.00 MHz */ >> + { 54054000, { 4096, 54054, 0 } }, /* 54.00*1.001 MHz */ >> + { 74175824, { 11648, 210937, 50 } }, /* 74.25/1.001 MHz */ >> + { 74250000, { 4096, 74250, 0 } }, /* 74.25 MHz */ >> + { 148351648, { 11648, 421875, 0 } }, /* 148.50/1.001 MHz */ >> + { 148500000, { 4096, 148500, 0 } }, /* 148.50 MHz */ >> + { 296703296, { 5824, 421875, 0 } }, /* 297/1.001 MHz */ > > 297/1.001 is about 296703296.7. Should this be rounded to 296703297 ? For this value, the rounded and truncate values are different. I will add both value in table. Thanks and Regards Arnaud