Skip to content

Commit 1368ceb

Browse files
istvan-vMauro Carvalho Chehab
authored andcommitted
[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: Istvan Varga <istvan_v@mailbox.hu> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
1 parent 5614942 commit 1368ceb

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎drivers/media/common/tuners/xc4000.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,8 +417,9 @@ static int xc_get_frequency_error(struct xc4000_priv *priv, u32 *freq_error_hz)
417417
if (result != XC_RESULT_SUCCESS)
418418
return result;
419419

420-
tmp = (u32)regData;
421-
(*freq_error_hz) = (tmp * 15625) / 1000;
420+
tmp = (u32)regData & 0xFFFFU;
421+
tmp = (tmp < 0x8000U ? tmp : 0x10000U - tmp);
422+
(*freq_error_hz) = tmp * 15625;
422423
return result;
423424
}
424425

0 commit comments

Comments
 (0)