diff options
author | Michael Hunold <devnull@localhost> | 2004-06-23 10:34:45 +0000 |
---|---|---|
committer | Michael Hunold <devnull@localhost> | 2004-06-23 10:34:45 +0000 |
commit | 0bf6ad26278afdb8ee4b2876c79f1a31936ea158 (patch) | |
tree | 421f00c758d1d8ee9eb8bb3544169bdb339561e8 /linux/drivers/media | |
parent | b7ef74a78a3e2ce1daea3d3cbf41c6f5aa43b0ae (diff) | |
download | mediapointer-dvb-s2-0bf6ad26278afdb8ee4b2876c79f1a31936ea158.tar.gz mediapointer-dvb-s2-0bf6ad26278afdb8ee4b2876c79f1a31936ea158.tar.bz2 |
- convert to kernel i2c
- firmware upload works, but access to the sp5659 tuner module fails (so no tuning)
(maybe my card is broken... 8-(
Diffstat (limited to 'linux/drivers/media')
-rw-r--r-- | linux/drivers/media/dvb/frontends/alps_tdlb7.c | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/linux/drivers/media/dvb/frontends/alps_tdlb7.c b/linux/drivers/media/dvb/frontends/alps_tdlb7.c index 4ddd7d863..12f546d4c 100644 --- a/linux/drivers/media/dvb/frontends/alps_tdlb7.c +++ b/linux/drivers/media/dvb/frontends/alps_tdlb7.c @@ -27,9 +27,9 @@ This page is worth a look: http://www.heise.de/ct/ftp/projekte/vdr/firmware.shtml - Copy 'Sc_main.mc' to '/usr/lib/hotplug/firmware/dvb-fe-tdlb7.fw'. + Copy 'Sc_main.mc' to '/usr/lib/hotplug/firmware/dvb-fe-tdlb7-2.16.fw'. */ -#define SP887X_DEFAULT_FIRMWARE "dvb-fe-tdlb7.fw" +#define SP887X_DEFAULT_FIRMWARE "dvb-fe-tdlb7-2.16.fw" #include <linux/init.h> #include <linux/module.h> @@ -42,7 +42,7 @@ /* fixme: add this to i2c-id.h */ #define I2C_DRIVERID_TDLB7 I2C_DRIVERID_EXP3 -static int debug = 0; +static int debug = 255; #define dprintk if (debug) printk @@ -106,14 +106,20 @@ static u16 sp8870_readreg (struct i2c_adapter *i2c, u16 reg) static int sp5659_write (struct i2c_adapter *i2c, u8 data [4]) { int ret; - struct i2c_msg msg = { .addr = 0x60, .flags = 0, .buf = data, .len = 4 }; - ret = i2c_transfer (i2c, &msg, 1); + u8 buf_open [] = { 0x206 >> 8, 0x206 & 0xff, 0x001 >> 8, 0x001 & 0xff }; + u8 buf_close [] = { 0x206 >> 8, 0x206 & 0xff, 0x000 >> 8, 0x000 & 0xff }; - if (ret != 1) + struct i2c_msg msg[3] = { {.addr = 0x71, .flags = 0, .buf = buf_open, .len = 4 }, + {.addr = 0x60, .flags = 0, .buf = data, .len = 4 }, + {.addr = 0x71, .flags = 0, .buf = buf_close, .len = 4 } }; + + ret = i2c_transfer (i2c, &msg[0], 3); + + if (ret != 3) printk("%s: i/o error (ret == %i)\n", __FUNCTION__, ret); - return (ret != 1) ? -1 : 0; + return (ret != 3) ? -EREMOTEIO : 0; } static void sp5659_set_tv_freq (struct i2c_adapter *i2c, u32 freq) @@ -133,9 +139,7 @@ static void sp5659_set_tv_freq (struct i2c_adapter *i2c, u32 freq) buf[3] = pwr << 6; /* open i2c gate for PLL message transmission... */ - sp8870_writereg(i2c, 0x206, 0x001); sp5659_write (i2c, buf); - sp8870_writereg(i2c, 0x206, 0x000); } static int sp8870_firmware_upload (struct i2c_adapter *i2c, const struct firmware *fw) @@ -149,8 +153,8 @@ static int sp8870_firmware_upload (struct i2c_adapter *i2c, const struct firmwar dprintk ("%s: ...\n", __FUNCTION__); - if (fw->size < SP8870_FIRMWARE_SIZE) - return -ENODEV; + if (fw->size < SP8870_FIRMWARE_SIZE + SP8870_FIRMWARE_OFFSET) + return -EINVAL; // system controller stop sp8870_writereg(i2c, 0x0F00, 0x0000); @@ -162,9 +166,9 @@ static int sp8870_firmware_upload (struct i2c_adapter *i2c, const struct firmwar sp8870_writereg(i2c, 0x8F0A, ((SP8870_FIRMWARE_SIZE / 2) >> 16)); // do firmware upload - fw_pos = 0; - while (fw_pos < SP8870_FIRMWARE_SIZE){ - tx_len = (fw_pos <= SP8870_FIRMWARE_SIZE - 252) ? 252 : SP8870_FIRMWARE_SIZE - fw_pos; + fw_pos = SP8870_FIRMWARE_OFFSET; + while (fw_pos < SP8870_FIRMWARE_SIZE + SP8870_FIRMWARE_OFFSET){ + tx_len = (fw_pos <= SP8870_FIRMWARE_SIZE + SP8870_FIRMWARE_OFFSET - 252) ? 252 : SP8870_FIRMWARE_SIZE + SP8870_FIRMWARE_OFFSET - fw_pos; // write register 0xCF0A tx_buf[0] = 0xCF; tx_buf[1] = 0x0A; |