diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-07-18 12:33:23 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-01-25 16:01:04 -0500 |
commit | 2e4160ca8046e3c35277bed62b2c180427d57dd7 (patch) | |
tree | b8edb354f29f0ef7c3445e331370e3366ecd6053 /drivers/media/video/tuner-xc2028.c | |
parent | 701672eb7387390bff43f0c979026dd317836626 (diff) |
V4L/DVB (6426): Some fixes on tuner-xc2028
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/tuner-xc2028.c')
-rw-r--r-- | drivers/media/video/tuner-xc2028.c | 58 |
1 files changed, 36 insertions, 22 deletions
diff --git a/drivers/media/video/tuner-xc2028.c b/drivers/media/video/tuner-xc2028.c index 2bb695490ab2..838db8187a9c 100644 --- a/drivers/media/video/tuner-xc2028.c +++ b/drivers/media/video/tuner-xc2028.c | |||
@@ -24,15 +24,19 @@ | |||
24 | #define V4L2_STD_DTV_8MHZ ((v4l2_std_id)0x10000000) | 24 | #define V4L2_STD_DTV_8MHZ ((v4l2_std_id)0x10000000) |
25 | 25 | ||
26 | /* Firmwares used on tm5600/tm6000 + xc2028/xc3028 */ | 26 | /* Firmwares used on tm5600/tm6000 + xc2028/xc3028 */ |
27 | static const char *firmware_6M = "tm6000_xc3028_DTV_6M.fw"; | 27 | |
28 | // static const char *firmware_78M = "tm6000_xc3028_78M.fw"; | 28 | /* Generic firmwares */ |
29 | static const char *firmware_7M = "tm6000_xc3028_7M.fw"; | 29 | static const char *firmware_INIT0 = "tm_xc3028_MTS_init0.fw"; |
30 | static const char *firmware_8M = "tm6000_xc3028_8M.fw"; | 30 | static const char *firmware_8MHZ_INIT0 = "tm_xc3028_8M_MTS_init0.fw"; |
31 | static const char *firmware_B = "tm6000_xc3028_B_PAL.fw"; | 31 | static const char *firmware_INIT1 = "tm_xc3028_68M_MTS_init1.fw"; |
32 | static const char *firmware_DK = "tm6000_xc3028_DK_PAL_MTS.fw"; | 32 | |
33 | static const char *firmware_MN = "tm6000_xc3028_MN_BTSC.fw"; | 33 | /* Standard-specific firmwares */ |
34 | static const char *firmware_INIT0 = "tm6000_xc3028_INIT0.fw"; | 34 | static const char *firmware_6M = "tm_xc3028_DTV_6M.fw"; |
35 | static const char *firmware_8MHZ_INIT0 = "tm6000_xc3028_8MHZ_INIT0.fw"; | 35 | static const char *firmware_7M = "tm_xc3028_7M.fw"; |
36 | static const char *firmware_8M = "tm_xc3028_8M.fw"; | ||
37 | static const char *firmware_B = "tm_xc3028_B_PAL.fw"; | ||
38 | static const char *firmware_DK = "tm_xc3028_DK_PAL_MTS.fw"; | ||
39 | static const char *firmware_MN = "tm_xc3028_MN_BTSC.fw"; | ||
36 | 40 | ||
37 | struct xc2028_data { | 41 | struct xc2028_data { |
38 | v4l2_std_id firm_type; /* video stds supported | 42 | v4l2_std_id firm_type; /* video stds supported |
@@ -79,13 +83,6 @@ static int xc2028_get_reg(struct i2c_client *c, u16 reg) | |||
79 | if (rc<0) | 83 | if (rc<0) |
80 | return rc; | 84 | return rc; |
81 | 85 | ||
82 | if (t->tuner_callback) { | ||
83 | rc = t->tuner_callback( c->adapter->algo_data, | ||
84 | XC2028_RESET_CLK, 0); | ||
85 | if (rc<0) | ||
86 | return rc; | ||
87 | } | ||
88 | |||
89 | i2c_rcv(rc, c, buf, 2); | 86 | i2c_rcv(rc, c, buf, 2); |
90 | if (rc<0) | 87 | if (rc<0) |
91 | return rc; | 88 | return rc; |
@@ -104,7 +101,11 @@ static int load_firmware (struct i2c_client *c, const char *name) | |||
104 | tuner_info("xc2028: Loading firmware %s\n", name); | 101 | tuner_info("xc2028: Loading firmware %s\n", name); |
105 | rc = request_firmware(&fw, name, &c->dev); | 102 | rc = request_firmware(&fw, name, &c->dev); |
106 | if (rc < 0) { | 103 | if (rc < 0) { |
107 | tuner_info("Error %d while requesting firmware\n", rc); | 104 | if (rc==-ENOENT) |
105 | tuner_info("Error: firmware %s not found.\n", name); | ||
106 | else | ||
107 | tuner_info("Error %d while requesting firmware %s \n", rc, name); | ||
108 | |||
108 | return rc; | 109 | return rc; |
109 | } | 110 | } |
110 | p=fw->data; | 111 | p=fw->data; |
@@ -204,10 +205,11 @@ static int check_firmware(struct i2c_client *c, enum tuner_mode new_mode, | |||
204 | bandwidth); | 205 | bandwidth); |
205 | 206 | ||
206 | if (xc2028->need_load_generic) { | 207 | if (xc2028->need_load_generic) { |
207 | if (xc2028->bandwidth==6) | 208 | if (xc2028->bandwidth==8) |
208 | name = firmware_INIT0; | ||
209 | else | ||
210 | name = firmware_8MHZ_INIT0; | 209 | name = firmware_8MHZ_INIT0; |
210 | else | ||
211 | name = firmware_INIT0; | ||
212 | |||
211 | /* Reset is needed before loading firmware */ | 213 | /* Reset is needed before loading firmware */ |
212 | rc = t->tuner_callback(c->adapter->algo_data, | 214 | rc = t->tuner_callback(c->adapter->algo_data, |
213 | XC2028_TUNER_RESET, 0); | 215 | XC2028_TUNER_RESET, 0); |
@@ -248,9 +250,12 @@ static int check_firmware(struct i2c_client *c, enum tuner_mode new_mode, | |||
248 | xc2028->bandwidth = bandwidth; | 250 | xc2028->bandwidth = bandwidth; |
249 | } | 251 | } |
250 | 252 | ||
251 | if (xc2028->firm_type & t->std) | 253 | if (xc2028->firm_type & t->std) { |
254 | tuner_info("xc3028: no need to load a std-specific firmware.\n"); | ||
252 | return 0; | 255 | return 0; |
256 | } | ||
253 | 257 | ||
258 | rc = load_firmware(c,firmware_INIT1); | ||
254 | 259 | ||
255 | if (t->std & V4L2_STD_MN) | 260 | if (t->std & V4L2_STD_MN) |
256 | name=firmware_MN; | 261 | name=firmware_MN; |
@@ -266,7 +271,6 @@ static int check_firmware(struct i2c_client *c, enum tuner_mode new_mode, | |||
266 | name=firmware_DK; | 271 | name=firmware_DK; |
267 | 272 | ||
268 | tuner_info("xc2028: loading firmware named %s.\n", name); | 273 | tuner_info("xc2028: loading firmware named %s.\n", name); |
269 | |||
270 | rc = load_firmware(c, name); | 274 | rc = load_firmware(c, name); |
271 | if (rc<0) | 275 | if (rc<0) |
272 | return rc; | 276 | return rc; |
@@ -342,6 +346,16 @@ static void generic_set_tv_freq(struct i2c_client *c, u32 freq /* in Hz */, | |||
342 | } | 346 | } |
343 | msleep(10); | 347 | msleep(10); |
344 | 348 | ||
349 | char *name; | ||
350 | |||
351 | rc = load_firmware(c,firmware_INIT1); | ||
352 | |||
353 | if (t->std & V4L2_STD_MN) | ||
354 | name=firmware_MN; | ||
355 | else | ||
356 | name=firmware_DK; | ||
357 | |||
358 | rc = load_firmware(c,name); | ||
345 | /* CMD= Set frequency */ | 359 | /* CMD= Set frequency */ |
346 | send_seq(c, {0x00, 0x02, 0x00, 0x00}); | 360 | send_seq(c, {0x00, 0x02, 0x00, 0x00}); |
347 | if (t->tuner_callback) { | 361 | if (t->tuner_callback) { |