diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2006-04-23 04:54:56 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-05-12 18:55:12 -0400 |
commit | 7d16eaa3d0d41a6e871e5c82720bcd006b202d55 (patch) | |
tree | c3d44ea9a30887aac9e3d0ed3b1fe66b25a943f7 /drivers/media/video | |
parent | 5691c8473936508c51639b6ff8467e55d8b129c1 (diff) |
V4L/DVB (3825): Remove broken 'fast firmware load' from cx25840.
The fast firmware load hack in cx25840 uses private data. In fact, it
breaks pvrusb2 and doesn't work at all with ivtv. It is a unsafe
implementation and so it is removed.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video')
-rw-r--r-- | drivers/media/video/cx25840/cx25840-firmware.c | 49 |
1 files changed, 2 insertions, 47 deletions
diff --git a/drivers/media/video/cx25840/cx25840-firmware.c b/drivers/media/video/cx25840/cx25840-firmware.c index f59ced181c55..1958d4016ea1 100644 --- a/drivers/media/video/cx25840/cx25840-firmware.c +++ b/drivers/media/video/cx25840/cx25840-firmware.c | |||
@@ -39,29 +39,12 @@ | |||
39 | 39 | ||
40 | #define FWDEV(x) &((x)->adapter->dev) | 40 | #define FWDEV(x) &((x)->adapter->dev) |
41 | 41 | ||
42 | static int fastfw = 1; | ||
43 | static char *firmware = FWFILE; | 42 | static char *firmware = FWFILE; |
44 | 43 | ||
45 | module_param(fastfw, bool, 0444); | ||
46 | module_param(firmware, charp, 0444); | 44 | module_param(firmware, charp, 0444); |
47 | 45 | ||
48 | MODULE_PARM_DESC(fastfw, "Load firmware fast [0=100MHz 1=333MHz (default)]"); | ||
49 | MODULE_PARM_DESC(firmware, "Firmware image [default: " FWFILE "]"); | 46 | MODULE_PARM_DESC(firmware, "Firmware image [default: " FWFILE "]"); |
50 | 47 | ||
51 | static void set_i2c_delay(struct i2c_client *client, int delay) | ||
52 | { | ||
53 | struct i2c_algo_bit_data *algod = client->adapter->algo_data; | ||
54 | |||
55 | /* We aren't guaranteed to be using algo_bit, | ||
56 | * so avoid the null pointer dereference | ||
57 | * and disable the 'fast firmware load' */ | ||
58 | if (algod) { | ||
59 | algod->udelay = delay; | ||
60 | } else { | ||
61 | fastfw = 0; | ||
62 | } | ||
63 | } | ||
64 | |||
65 | static void start_fw_load(struct i2c_client *client) | 48 | static void start_fw_load(struct i2c_client *client) |
66 | { | 49 | { |
67 | /* DL_ADDR_LB=0 DL_ADDR_HB=0 */ | 50 | /* DL_ADDR_LB=0 DL_ADDR_HB=0 */ |
@@ -71,16 +54,10 @@ static void start_fw_load(struct i2c_client *client) | |||
71 | cx25840_write(client, 0x803, 0x0b); | 54 | cx25840_write(client, 0x803, 0x0b); |
72 | /* AUTO_INC_DIS=1 */ | 55 | /* AUTO_INC_DIS=1 */ |
73 | cx25840_write(client, 0x000, 0x20); | 56 | cx25840_write(client, 0x000, 0x20); |
74 | |||
75 | if (fastfw) | ||
76 | set_i2c_delay(client, 3); | ||
77 | } | 57 | } |
78 | 58 | ||
79 | static void end_fw_load(struct i2c_client *client) | 59 | static void end_fw_load(struct i2c_client *client) |
80 | { | 60 | { |
81 | if (fastfw) | ||
82 | set_i2c_delay(client, 10); | ||
83 | |||
84 | /* AUTO_INC_DIS=0 */ | 61 | /* AUTO_INC_DIS=0 */ |
85 | cx25840_write(client, 0x000, 0x00); | 62 | cx25840_write(client, 0x000, 0x00); |
86 | /* DL_ENABLE=0 */ | 63 | /* DL_ENABLE=0 */ |
@@ -107,30 +84,8 @@ static int fw_write(struct i2c_client *client, u8 * data, int size) | |||
107 | int sent; | 84 | int sent; |
108 | 85 | ||
109 | if ((sent = i2c_master_send(client, data, size)) < size) { | 86 | if ((sent = i2c_master_send(client, data, size)) < size) { |
110 | 87 | v4l_err(client, "firmware load i2c failure\n"); | |
111 | if (fastfw) { | 88 | return -ENOSYS; |
112 | v4l_err(client, "333MHz i2c firmware load failed\n"); | ||
113 | fastfw = 0; | ||
114 | set_i2c_delay(client, 10); | ||
115 | |||
116 | if (sent > 2) { | ||
117 | u16 dl_addr = cx25840_read(client, 0x801) << 8; | ||
118 | dl_addr |= cx25840_read(client, 0x800); | ||
119 | dl_addr -= sent - 2; | ||
120 | cx25840_write(client, 0x801, dl_addr >> 8); | ||
121 | cx25840_write(client, 0x800, dl_addr & 0xff); | ||
122 | } | ||
123 | |||
124 | if (i2c_master_send(client, data, size) < size) { | ||
125 | v4l_err(client, "100MHz i2c firmware load failed\n"); | ||
126 | return -ENOSYS; | ||
127 | } | ||
128 | |||
129 | } else { | ||
130 | v4l_err(client, "firmware load i2c failure\n"); | ||
131 | return -ENOSYS; | ||
132 | } | ||
133 | |||
134 | } | 89 | } |
135 | 90 | ||
136 | return 0; | 91 | return 0; |