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>
This commit is contained in:
parent
7640ea9933
commit
89b329ef9d
|
@ -525,6 +525,20 @@ static void em28xx_set_model(struct em28xx *dev)
|
||||||
*/
|
*/
|
||||||
void em28xx_pre_card_setup(struct em28xx *dev)
|
void em28xx_pre_card_setup(struct em28xx *dev)
|
||||||
{
|
{
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
dev->wait_after_write = 5;
|
||||||
|
rc = em28xx_read_reg(dev, CHIPID_REG);
|
||||||
|
if (rc > 0) {
|
||||||
|
switch (rc) {
|
||||||
|
case 36:
|
||||||
|
em28xx_info("chip ID is em2882/em2883\n");
|
||||||
|
dev->wait_after_write = 0;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
em28xx_info("em28xx chip ID = %d\n", rc);
|
||||||
|
}
|
||||||
|
}
|
||||||
em28xx_set_model(dev);
|
em28xx_set_model(dev);
|
||||||
|
|
||||||
/* request some modules */
|
/* request some modules */
|
||||||
|
|
|
@ -153,6 +153,9 @@ int em28xx_write_regs_req(struct em28xx *dev, u8 req, u16 reg, char *buf,
|
||||||
ret = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0), req,
|
ret = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0), req,
|
||||||
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
|
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
|
||||||
0x0000, reg, bufs, len, HZ);
|
0x0000, reg, bufs, len, HZ);
|
||||||
|
if (dev->wait_after_write)
|
||||||
|
msleep(dev->wait_after_write);
|
||||||
|
|
||||||
kfree(bufs);
|
kfree(bufs);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1927,10 +1927,6 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev,
|
||||||
dev->em28xx_read_reg_req = em28xx_read_reg_req;
|
dev->em28xx_read_reg_req = em28xx_read_reg_req;
|
||||||
dev->is_em2800 = em28xx_boards[dev->model].is_em2800;
|
dev->is_em2800 = em28xx_boards[dev->model].is_em2800;
|
||||||
|
|
||||||
errCode = em28xx_read_reg(dev, CHIPID_REG);
|
|
||||||
if (errCode >= 0)
|
|
||||||
em28xx_info("em28xx chip ID = %d\n", errCode);
|
|
||||||
|
|
||||||
em28xx_pre_card_setup(dev);
|
em28xx_pre_card_setup(dev);
|
||||||
|
|
||||||
errCode = em28xx_config(dev);
|
errCode = em28xx_config(dev);
|
||||||
|
|
|
@ -331,6 +331,9 @@ struct em28xx {
|
||||||
unsigned int max_range_640_480:1;
|
unsigned int max_range_640_480:1;
|
||||||
unsigned int has_dvb:1;
|
unsigned int has_dvb:1;
|
||||||
|
|
||||||
|
/* Some older em28xx chips needs a waiting time after writing */
|
||||||
|
unsigned int wait_after_write;
|
||||||
|
|
||||||
/* GPIO sequences for tuner callback */
|
/* GPIO sequences for tuner callback */
|
||||||
struct em28xx_reg_seq *analog_gpio, *digital_gpio;
|
struct em28xx_reg_seq *analog_gpio, *digital_gpio;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue