aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/common/tuners/xc4000.c
diff options
context:
space:
mode:
authorIstvan Varga <istvan_v@mailbox.hu>2011-06-03 11:27:30 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-07-27 16:52:34 -0400
commit1368ceb266990af58a72cdb0e121eb4ff22bde6f (patch)
treebca06a1b0b6e714b2ea682897f67b472284c9da6 /drivers/media/common/tuners/xc4000.c
parent5614942bb06f5620d0d6eb67bc0268c76c5dd921 (diff)
[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>
Diffstat (limited to 'drivers/media/common/tuners/xc4000.c')
-rw-r--r--drivers/media/common/tuners/xc4000.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/media/common/tuners/xc4000.c b/drivers/media/common/tuners/xc4000.c
index be43a6dfac6c..f50dd6e713f7 100644
--- a/drivers/media/common/tuners/xc4000.c
+++ b/drivers/media/common/tuners/xc4000.c
@@ -417,8 +417,9 @@ static int xc_get_frequency_error(struct xc4000_priv *priv, u32 *freq_error_hz)
417 if (result != XC_RESULT_SUCCESS) 417 if (result != XC_RESULT_SUCCESS)
418 return result; 418 return result;
419 419
420 tmp = (u32)regData; 420 tmp = (u32)regData & 0xFFFFU;
421 (*freq_error_hz) = (tmp * 15625) / 1000; 421 tmp = (tmp < 0x8000U ? tmp : 0x10000U - tmp);
422 (*freq_error_hz) = tmp * 15625;
422 return result; 423 return result;
423} 424}
424 425