Commit 1368ceb2 authored by Istvan Varga's avatar Istvan Varga Committed by Mauro Carvalho Chehab

[media] xc4000: fixed frequency error

The xc_get_frequency_error() function reported the frequency error
incorrectly. The data read from the hardware is a signed integer, in
15625 Hz units. The attached patch fixes the bug.
Signed-off-by: default avatarIstvan Varga <istvan_v@mailbox.hu>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 5614942b
......@@ -417,8 +417,9 @@ static int xc_get_frequency_error(struct xc4000_priv *priv, u32 *freq_error_hz)
if (result != XC_RESULT_SUCCESS)
return result;
tmp = (u32)regData;
(*freq_error_hz) = (tmp * 15625) / 1000;
tmp = (u32)regData & 0xFFFFU;
tmp = (tmp < 0x8000U ? tmp : 0x10000U - tmp);
(*freq_error_hz) = tmp * 15625;
return result;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment