diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-04-17 20:42:14 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-04-24 13:09:42 -0400 |
commit | 89b329ef9d7cc16ed46fc991b21b2d45e7bf452c (patch) | |
tree | 1cd9ce2b15423282d50e6a96ed5ff789030e7cdf | |
parent | 7640ea99339c687864f6131598e2eee2ca73cb9c (diff) |
V4L/DVB (7610): em28xx: Select reg wait time based on chip ID
This is more conservative than just removing the msleep() from
em28xx_write_regs_req(), since some old hardware may still need it.
So, it will remove the sleep time only for those chips where this
removal were tested.
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r-- | drivers/media/video/em28xx/em28xx-cards.c | 14 | ||||
-rw-r--r-- | drivers/media/video/em28xx/em28xx-core.c | 3 | ||||
-rw-r--r-- | drivers/media/video/em28xx/em28xx-video.c | 4 | ||||
-rw-r--r-- | drivers/media/video/em28xx/em28xx.h | 3 |
4 files changed, 20 insertions, 4 deletions
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index 7dfea3ac9b2f..0c71e599c140 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c | |||
@@ -525,6 +525,20 @@ static void em28xx_set_model(struct em28xx *dev) | |||
525 | */ | 525 | */ |
526 | void em28xx_pre_card_setup(struct em28xx *dev) | 526 | void em28xx_pre_card_setup(struct em28xx *dev) |
527 | { | 527 | { |
528 | int rc; | ||
529 | |||
530 | dev->wait_after_write = 5; | ||
531 | rc = em28xx_read_reg(dev, CHIPID_REG); | ||
532 | if (rc > 0) { | ||
533 | switch (rc) { | ||
534 | case 36: | ||
535 | em28xx_info("chip ID is em2882/em2883\n"); | ||
536 | dev->wait_after_write = 0; | ||
537 | break; | ||
538 | default: | ||
539 | em28xx_info("em28xx chip ID = %d\n", rc); | ||
540 | } | ||
541 | } | ||
528 | em28xx_set_model(dev); | 542 | em28xx_set_model(dev); |
529 | 543 | ||
530 | /* request some modules */ | 544 | /* request some modules */ |
diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c index 9cbc4788090c..e47b206187b5 100644 --- a/drivers/media/video/em28xx/em28xx-core.c +++ b/drivers/media/video/em28xx/em28xx-core.c | |||
@@ -153,6 +153,9 @@ int em28xx_write_regs_req(struct em28xx *dev, u8 req, u16 reg, char *buf, | |||
153 | ret = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0), req, | 153 | ret = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0), req, |
154 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | 154 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
155 | 0x0000, reg, bufs, len, HZ); | 155 | 0x0000, reg, bufs, len, HZ); |
156 | if (dev->wait_after_write) | ||
157 | msleep(dev->wait_after_write); | ||
158 | |||
156 | kfree(bufs); | 159 | kfree(bufs); |
157 | return ret; | 160 | return ret; |
158 | } | 161 | } |
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index 1ac90322d681..a8aa09c5bc5f 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c | |||
@@ -1927,10 +1927,6 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev, | |||
1927 | dev->em28xx_read_reg_req = em28xx_read_reg_req; | 1927 | dev->em28xx_read_reg_req = em28xx_read_reg_req; |
1928 | dev->is_em2800 = em28xx_boards[dev->model].is_em2800; | 1928 | dev->is_em2800 = em28xx_boards[dev->model].is_em2800; |
1929 | 1929 | ||
1930 | errCode = em28xx_read_reg(dev, CHIPID_REG); | ||
1931 | if (errCode >= 0) | ||
1932 | em28xx_info("em28xx chip ID = %d\n", errCode); | ||
1933 | |||
1934 | em28xx_pre_card_setup(dev); | 1930 | em28xx_pre_card_setup(dev); |
1935 | 1931 | ||
1936 | errCode = em28xx_config(dev); | 1932 | errCode = em28xx_config(dev); |
diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h index 5b21efaf7844..8f12b848b1d1 100644 --- a/drivers/media/video/em28xx/em28xx.h +++ b/drivers/media/video/em28xx/em28xx.h | |||
@@ -331,6 +331,9 @@ struct em28xx { | |||
331 | unsigned int max_range_640_480:1; | 331 | unsigned int max_range_640_480:1; |
332 | unsigned int has_dvb:1; | 332 | unsigned int has_dvb:1; |
333 | 333 | ||
334 | /* Some older em28xx chips needs a waiting time after writing */ | ||
335 | unsigned int wait_after_write; | ||
336 | |||
334 | /* GPIO sequences for tuner callback */ | 337 | /* GPIO sequences for tuner callback */ |
335 | struct em28xx_reg_seq *analog_gpio, *digital_gpio; | 338 | struct em28xx_reg_seq *analog_gpio, *digital_gpio; |
336 | 339 | ||