summaryrefslogtreecommitdiff
path: root/linux
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2007-07-18 13:33:23 -0300
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-07-18 13:33:23 -0300
commitd8052d9ecc1214929a538a3147d65f8550b70733 (patch)
tree5124a78361ce0a9a42dbd96fcd4c4375843d4404 /linux
parent0f878821893fd3ecaa207f773994c536e5f3f5d1 (diff)
downloadmediapointer-dvb-s2-d8052d9ecc1214929a538a3147d65f8550b70733.tar.gz
mediapointer-dvb-s2-d8052d9ecc1214929a538a3147d65f8550b70733.tar.bz2
Some fixes on tuner-xc2028
From: Mauro Carvalho Chehab <mchehab@infradead.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org> --- linux/drivers/media/video/tuner-xc2028.c | 113 +++++++++++++------------------ 1 file changed, 48 insertions(+), 65 deletions(-)
Diffstat (limited to 'linux')
-rw-r--r--linux/drivers/media/video/tuner-xc2028.c113
1 files changed, 48 insertions, 65 deletions
diff --git a/linux/drivers/media/video/tuner-xc2028.c b/linux/drivers/media/video/tuner-xc2028.c
index dc85e4333..a387f03d4 100644
--- a/linux/drivers/media/video/tuner-xc2028.c
+++ b/linux/drivers/media/video/tuner-xc2028.c
@@ -28,15 +28,19 @@
#define V4L2_STD_DTV_8MHZ ((v4l2_std_id)0x10000000)
/* Firmwares used on tm5600/tm6000 + xc2028/xc3028 */
-static const char *firmware_6M = "tm6000_xc3028_DTV_6M.fw";
-// static const char *firmware_78M = "tm6000_xc3028_78M.fw";
-static const char *firmware_7M = "tm6000_xc3028_7M.fw";
-static const char *firmware_8M = "tm6000_xc3028_8M.fw";
-static const char *firmware_B = "tm6000_xc3028_B_PAL.fw";
-static const char *firmware_DK = "tm6000_xc3028_DK_PAL_MTS.fw";
-static const char *firmware_MN = "tm6000_xc3028_MN_BTSC.fw";
-static const char *firmware_INIT0 = "tm6000_xc3028_INIT0.fw";
-static const char *firmware_8MHZ_INIT0 = "tm6000_xc3028_8MHZ_INIT0.fw";
+
+/* Generic firmwares */
+static const char *firmware_INIT0 = "tm_xc3028_MTS_init0.fw";
+static const char *firmware_8MHZ_INIT0 = "tm_xc3028_8M_MTS_init0.fw";
+static const char *firmware_INIT1 = "tm_xc3028_68M_MTS_init1.fw";
+
+/* Standard-specific firmwares */
+static const char *firmware_6M = "tm_xc3028_DTV_6M.fw";
+static const char *firmware_7M = "tm_xc3028_7M.fw";
+static const char *firmware_8M = "tm_xc3028_8M.fw";
+static const char *firmware_B = "tm_xc3028_B_PAL.fw";
+static const char *firmware_DK = "tm_xc3028_DK_PAL_MTS.fw";
+static const char *firmware_MN = "tm_xc3028_MN_BTSC.fw";
struct xc2028_data {
v4l2_std_id firm_type; /* video stds supported
@@ -83,13 +87,14 @@ static int xc2028_get_reg(struct i2c_client *c, u16 reg)
if (rc<0)
return rc;
+#if 0
if (t->tuner_callback) {
rc = t->tuner_callback( c->adapter->algo_data,
XC2028_RESET_CLK, 0);
if (rc<0)
return rc;
}
-
+#endif
i2c_rcv(rc, c, buf, 2);
if (rc<0)
return rc;
@@ -108,7 +113,11 @@ static int load_firmware (struct i2c_client *c, const char *name)
tuner_info("xc2028: Loading firmware %s\n", name);
rc = request_firmware(&fw, name, &c->dev);
if (rc < 0) {
- tuner_info("Error %d while requesting firmware\n", rc);
+ if (rc==-ENOENT)
+ tuner_info("Error: firmware %s not found.\n", name);
+ else
+ tuner_info("Error %d while requesting firmware %s \n", rc, name);
+
return rc;
}
p=fw->data;
@@ -208,10 +217,11 @@ static int check_firmware(struct i2c_client *c, enum tuner_mode new_mode,
bandwidth);
if (xc2028->need_load_generic) {
- if (xc2028->bandwidth==6)
- name = firmware_INIT0;
- else
+ if (xc2028->bandwidth==8)
name = firmware_8MHZ_INIT0;
+ else
+ name = firmware_INIT0;
+
/* Reset is needed before loading firmware */
rc = t->tuner_callback(c->adapter->algo_data,
XC2028_TUNER_RESET, 0);
@@ -252,30 +262,22 @@ static int check_firmware(struct i2c_client *c, enum tuner_mode new_mode,
xc2028->bandwidth = bandwidth;
}
- if (xc2028->firm_type & t->std)
+ if (xc2028->firm_type & t->std) {
+ tuner_info("xc3028: no need to load a std-specific firmware.\n");
return 0;
+ }
#if 0
- send_seq (c, {0x12, 0x39});
- send_seq (c, {0x0c, 0x80, 0xf0, 0xf7, 0x3e, 0x75, 0xc1, 0x8a, 0xe4});
- send_seq (c, {0x0c, 0x02, 0x00});
- send_seq (c, {0x05, 0x0f, 0xee, 0xaa, 0x5f, 0xea, 0x90});
- send_seq (c, {0x06, 0x00, 0x0a, 0x4d, 0x8c, 0xf2, 0xd8, 0xcf, 0x30});
- send_seq (c, {0x06, 0x79, 0x9f});
- send_seq (c, {0x0b, 0x0d, 0xa4, 0x6c});
- send_seq (c, {0x0a, 0x01, 0x67, 0x24, 0x40, 0x08, 0xc3, 0x20, 0x10});
- send_seq (c, {0x0a, 0x64, 0x3c, 0xfa, 0xf7, 0xe1, 0x0c, 0x2c});
- send_seq (c, {0x09, 0x0b});
- send_seq (c, {0x10, 0x13});
- send_seq (c, {0x16, 0x12});
- send_seq (c, {0x1f, 0x02});
- send_seq (c, {0x21, 0x02});
- send_seq (c, {0x01, 0x02});
- send_seq (c, {0x2b, 0x10});
- send_seq (c, {0x02, 0x02});
- send_seq (c, {0x02, 0x03});
- send_seq (c, {0x00, 0x8c});
+ /* Reset GPIO 1 */
+ if (t->tuner_callback) {
+ rc = t->tuner_callback( c->adapter->algo_data,
+ XC2028_TUNER_RESET, 0);
+ if (rc<0)
+ return;
+ }
+ msleep(10);
#endif
+ rc = load_firmware(c,firmware_INIT1);
if (t->std & V4L2_STD_MN)
name=firmware_MN;
@@ -291,7 +293,6 @@ static int check_firmware(struct i2c_client *c, enum tuner_mode new_mode,
name=firmware_DK;
tuner_info("xc2028: loading firmware named %s.\n", name);
-
rc = load_firmware(c, name);
if (rc<0)
return rc;
@@ -335,6 +336,13 @@ static void generic_set_tv_freq(struct i2c_client *c, u32 freq /* in Hz */,
struct tuner *t = i2c_get_clientdata(c);
u32 div, offset = 0;
+#if 0
+ /* HACK: It seems that specific firmware need to be reloaded
+ when freq is changed */
+ struct xc2028_data *xc2028 = t->priv;
+
+ xc2028->firm_type=0;
+#endif
printk("xc3028: should set frequency %d kHz)\n", freq / 1000);
if (check_firmware(c, new_mode, bandwidth)<0)
@@ -358,6 +366,7 @@ static void generic_set_tv_freq(struct i2c_client *c, u32 freq /* in Hz */,
div = (freq - offset + DIV/2)/DIV;
+#if 1
/* Reset GPIO 1 */
if (t->tuner_callback) {
rc = t->tuner_callback( c->adapter->algo_data,
@@ -366,39 +375,13 @@ static void generic_set_tv_freq(struct i2c_client *c, u32 freq /* in Hz */,
return;
}
msleep(10);
+#endif
-#if 0
- send_seq (c, {0x00, 0x01, 0x00, 0x00});
- send_seq (c, {0x00, 0xcc, 0x20, 0x06});
- send_seq (c, {0x2b, 0x1a});
- send_seq (c, {0x2b, 0x1b});
- send_seq (c, {0x14, 0x01, 0x1b, 0x19, 0xb5, 0x29, 0xab, 0x09, 0x55});
- send_seq (c, {0x14, 0x44, 0x05, 0x65});
- send_seq (c, {0x13, 0x18, 0x08, 0x00, 0x00, 0x6c, 0x18, 0x16, 0x8c});
- send_seq (c, {0x13, 0x49, 0x2a, 0xab});
- send_seq (c, {0x0d, 0x01, 0x4b, 0x03, 0x97, 0x55, 0xc7, 0xd7, 0x00});
- send_seq (c, {0x0d, 0xa1, 0xeb, 0x8f, 0x5c});
- send_seq (c, {0x1a, 0x00, 0x00, 0x16, 0x8a, 0x40, 0x00, 0x00, 0x00, 0x20});
- send_seq (c, {0x2d, 0x01});
- send_seq (c, {0x18, 0x00});
- send_seq (c, {0x1b, 0x0d, 0x86, 0x51, 0xd2, 0x35, 0xa4, 0x92, 0xa5});
- send_seq (c, {0x1b, 0xb5, 0x25, 0x65});
- send_seq (c, {0x1d, 0x00});
- send_seq (c, {0x0f, 0x00, 0x29, 0x56, 0xb0, 0x00, 0xb6});
- send_seq (c, {0x20, 0x00});
- send_seq (c, {0x1e, 0x09, 0x02, 0x5b, 0x6c, 0x00, 0x4b, 0x81, 0x56});
- send_seq (c, {0x1e, 0x46, 0x69, 0x0b});
- send_seq (c, {0x22, 0x32});
- send_seq (c, {0x23, 0x0a});
- send_seq (c, {0x25, 0x00, 0x09, 0x90, 0x09, 0x06, 0x64, 0x02, 0x41});
- send_seq (c, {0x26, 0xcc});
- send_seq (c, {0x29, 0x40});
- send_seq (c, {0x21, 0x03});
- send_seq (c, {0x00, 0x8c});
- send_seq (c, {0x00, 0x00, 0x00, 0x00});
-//#else
+#if 1
char *name;
+ rc = load_firmware(c,firmware_INIT1);
+
if (t->std & V4L2_STD_MN)
name=firmware_MN;
else