[alsa-devel] [RFC v2 1/6] video: hdmi: add helper function for N and CTS

Arnaud Pouliquen arnaud.pouliquen at st.com
Fri Feb 19 09:20:43 CET 2016



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 <moise.gergaud at st.com>
>>
>> Add helper function to compute HDMI CTS and N parameters.
>> Implementation is based on HDMI 1.4b specification.
>>
>> Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen at st.com>
> 
> Reviewed-by: Philipp Zabel <p.zabel at pengutronix.de>
> Tested-by: Philipp Zabel <p.zabel at pengutronix.de>
> 
>> ---
>>  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


More information about the Alsa-devel mailing list