diff options
author | Tyler Trafford <tatrafford@comcast.net> | 2006-01-09 12:25:29 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@brturbo.com.br> | 2006-01-09 12:25:29 -0500 |
commit | 210e207c1d98348f5993e6f580cd20cf20086d7d (patch) | |
tree | 7975b53bb1d6f5e360e4ea8d71819f7a5ca2efb2 | |
parent | 83ac8722be6d34b9bbcaabfff825d5847ce3a9d4 (diff) |
V4L/DVB (3198): make cx25840 recover from some firmware load failures
- In the rare event that a 333MHz i2c firmware load fails after
writing some data, this fix makes the driver reset the DL_ADDR
registers to the proper values before continuing on with 100MHz
transfers.
Signed-off-by: Tyler Trafford <tatrafford@comcast.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
-rw-r--r-- | drivers/media/video/cx25840/cx25840-firmware.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/media/video/cx25840/cx25840-firmware.c b/drivers/media/video/cx25840/cx25840-firmware.c index df9d50a75542..f43024f2aaef 100644 --- a/drivers/media/video/cx25840/cx25840-firmware.c +++ b/drivers/media/video/cx25840/cx25840-firmware.c | |||
@@ -15,7 +15,6 @@ | |||
15 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 15 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
16 | */ | 16 | */ |
17 | 17 | ||
18 | |||
19 | #include <linux/module.h> | 18 | #include <linux/module.h> |
20 | #include <linux/i2c.h> | 19 | #include <linux/i2c.h> |
21 | #include <linux/i2c-algo-bit.h> | 20 | #include <linux/i2c-algo-bit.h> |
@@ -94,13 +93,23 @@ static inline int check_fw_load(struct i2c_client *client, int size) | |||
94 | 93 | ||
95 | static inline int fw_write(struct i2c_client *client, u8 * data, int size) | 94 | static inline int fw_write(struct i2c_client *client, u8 * data, int size) |
96 | { | 95 | { |
97 | if (i2c_master_send(client, data, size) < size) { | 96 | int sent; |
97 | |||
98 | if ((sent = i2c_master_send(client, data, size)) < size) { | ||
98 | 99 | ||
99 | if (fastfw) { | 100 | if (fastfw) { |
100 | cx25840_err("333MHz i2c firmware load failed\n"); | 101 | cx25840_err("333MHz i2c firmware load failed\n"); |
101 | fastfw = 0; | 102 | fastfw = 0; |
102 | set_i2c_delay(client, 10); | 103 | set_i2c_delay(client, 10); |
103 | 104 | ||
105 | if (sent > 2) { | ||
106 | u16 dl_addr = cx25840_read(client, 0x801) << 8; | ||
107 | dl_addr |= cx25840_read(client, 0x800); | ||
108 | dl_addr -= sent - 2; | ||
109 | cx25840_write(client, 0x801, dl_addr >> 8); | ||
110 | cx25840_write(client, 0x800, dl_addr & 0xff); | ||
111 | } | ||
112 | |||
104 | if (i2c_master_send(client, data, size) < size) { | 113 | if (i2c_master_send(client, data, size) < size) { |
105 | cx25840_err | 114 | cx25840_err |
106 | ("100MHz i2c firmware load failed\n"); | 115 | ("100MHz i2c firmware load failed\n"); |