diff options
author | Miroslav Slugen <thunder.mmm@gmail.com> | 2011-12-11 18:19:34 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-01-16 09:24:39 -0500 |
commit | 304bce414efce196f4051f2a5d11418c2c2ef7f9 (patch) | |
tree | de7ec66ba246e4758a17fa9f9ce4b4cf0671eb3b | |
parent | 8a538a8855aa95e5a12ae232a140e6b30c56d0c5 (diff) |
[media] Add registers names to XC2028 tuner from datahseet and use them
Signed-off-by: Miroslav Slugen <thunder.mmm@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/common/tuners/tuner-xc2028.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/drivers/media/common/tuners/tuner-xc2028.c b/drivers/media/common/tuners/tuner-xc2028.c index 27555995f7e4..b5ee3ebfcfca 100644 --- a/drivers/media/common/tuners/tuner-xc2028.c +++ b/drivers/media/common/tuners/tuner-xc2028.c | |||
@@ -24,6 +24,21 @@ | |||
24 | #include <linux/dvb/frontend.h> | 24 | #include <linux/dvb/frontend.h> |
25 | #include "dvb_frontend.h" | 25 | #include "dvb_frontend.h" |
26 | 26 | ||
27 | /* Registers (Write-only) */ | ||
28 | #define XREG_INIT 0x00 | ||
29 | #define XREG_RF_FREQ 0x02 | ||
30 | #define XREG_POWER_DOWN 0x08 | ||
31 | |||
32 | /* Registers (Read-only) */ | ||
33 | #define XREG_FREQ_ERROR 0x01 | ||
34 | #define XREG_LOCK 0x02 | ||
35 | #define XREG_VERSION 0x04 | ||
36 | #define XREG_PRODUCT_ID 0x08 | ||
37 | #define XREG_HSYNC_FREQ 0x10 | ||
38 | #define XREG_FRAME_LINES 0x20 | ||
39 | #define XREG_SNR 0x40 | ||
40 | |||
41 | #define XREG_ADC_ENV 0x0100 | ||
27 | 42 | ||
28 | static int debug; | 43 | static int debug; |
29 | module_param(debug, int, 0644); | 44 | module_param(debug, int, 0644); |
@@ -885,7 +900,7 @@ static int xc2028_signal(struct dvb_frontend *fe, u16 *strength) | |||
885 | mutex_lock(&priv->lock); | 900 | mutex_lock(&priv->lock); |
886 | 901 | ||
887 | /* Sync Lock Indicator */ | 902 | /* Sync Lock Indicator */ |
888 | rc = xc2028_get_reg(priv, 0x0002, &frq_lock); | 903 | rc = xc2028_get_reg(priv, XREG_LOCK, &frq_lock); |
889 | if (rc < 0) | 904 | if (rc < 0) |
890 | goto ret; | 905 | goto ret; |
891 | 906 | ||
@@ -894,7 +909,7 @@ static int xc2028_signal(struct dvb_frontend *fe, u16 *strength) | |||
894 | signal = 1 << 11; | 909 | signal = 1 << 11; |
895 | 910 | ||
896 | /* Get SNR of the video signal */ | 911 | /* Get SNR of the video signal */ |
897 | rc = xc2028_get_reg(priv, 0x0040, &signal); | 912 | rc = xc2028_get_reg(priv, XREG_SNR, &signal); |
898 | if (rc < 0) | 913 | if (rc < 0) |
899 | goto ret; | 914 | goto ret; |
900 | 915 | ||
@@ -1019,9 +1034,9 @@ static int generic_set_freq(struct dvb_frontend *fe, u32 freq /* in HZ */, | |||
1019 | 1034 | ||
1020 | /* CMD= Set frequency */ | 1035 | /* CMD= Set frequency */ |
1021 | if (priv->firm_version < 0x0202) | 1036 | if (priv->firm_version < 0x0202) |
1022 | rc = send_seq(priv, {0x00, 0x02, 0x00, 0x00}); | 1037 | rc = send_seq(priv, {0x00, XREG_RF_FREQ, 0x00, 0x00}); |
1023 | else | 1038 | else |
1024 | rc = send_seq(priv, {0x80, 0x02, 0x00, 0x00}); | 1039 | rc = send_seq(priv, {0x80, XREG_RF_FREQ, 0x00, 0x00}); |
1025 | if (rc < 0) | 1040 | if (rc < 0) |
1026 | goto ret; | 1041 | goto ret; |
1027 | 1042 | ||
@@ -1201,9 +1216,9 @@ static int xc2028_sleep(struct dvb_frontend *fe) | |||
1201 | mutex_lock(&priv->lock); | 1216 | mutex_lock(&priv->lock); |
1202 | 1217 | ||
1203 | if (priv->firm_version < 0x0202) | 1218 | if (priv->firm_version < 0x0202) |
1204 | rc = send_seq(priv, {0x00, 0x08, 0x00, 0x00}); | 1219 | rc = send_seq(priv, {0x00, XREG_POWER_DOWN, 0x00, 0x00}); |
1205 | else | 1220 | else |
1206 | rc = send_seq(priv, {0x80, 0x08, 0x00, 0x00}); | 1221 | rc = send_seq(priv, {0x80, XREG_POWER_DOWN, 0x00, 0x00}); |
1207 | 1222 | ||
1208 | priv->cur_fw.type = 0; /* need firmware reload */ | 1223 | priv->cur_fw.type = 0; /* need firmware reload */ |
1209 | 1224 | ||