Commit 6ea54d93 authored by Douglas Schilling Landgraf's avatar Douglas Schilling Landgraf Committed by Mauro Carvalho Chehab

V4L/DVB (7607): CodingStyle fixes

Signed-off-by: default avatarDouglas Schilling Landgraf <dougsland@gmail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent e6a353b0
...@@ -436,10 +436,10 @@ MODULE_DEVICE_TABLE(usb, em28xx_id_table); ...@@ -436,10 +436,10 @@ MODULE_DEVICE_TABLE(usb, em28xx_id_table);
/* Board Hauppauge WinTV HVR 900 analog */ /* Board Hauppauge WinTV HVR 900 analog */
struct em28xx_reg_seq hauppauge_wintv_hvr_900_analog[] = { struct em28xx_reg_seq hauppauge_wintv_hvr_900_analog[] = {
{ -1, -1, 6}, { -1, -1, 6},
{0x08, 0x2d, 10}, {0x08, 0x2d, 10},
{0x08, 0x3d, 5}, {0x08, 0x3d, 5},
{ -1, -1, -1}, { -1, -1, -1},
}; };
/* Board Hauppauge WinTV HVR 900 digital */ /* Board Hauppauge WinTV HVR 900 digital */
struct em28xx_reg_seq hauppauge_wintv_hvr_900_digital[] = { struct em28xx_reg_seq hauppauge_wintv_hvr_900_digital[] = {
......
...@@ -77,12 +77,12 @@ int em28xx_read_reg_req_len(struct em28xx *dev, u8 req, u16 reg, ...@@ -77,12 +77,12 @@ int em28xx_read_reg_req_len(struct em28xx *dev, u8 req, u16 reg,
USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
0x0000, reg, buf, len, HZ); 0x0000, reg, buf, len, HZ);
if (reg_debug){ if (reg_debug) {
printk(ret < 0 ? " failed!\n" : "%02x values: ", ret); printk(ret < 0 ? " failed!\n" : "%02x values: ", ret);
for (byte = 0; byte < len; byte++) { for (byte = 0; byte < len; byte++)
printk(" %02x", (unsigned char)buf[byte]); printk(KERN_INFO " %02x", (unsigned char)buf[byte]);
}
printk("\n"); printk(KERN_INFO "\n");
} }
return ret; return ret;
...@@ -143,8 +143,8 @@ int em28xx_write_regs_req(struct em28xx *dev, u8 req, u16 reg, char *buf, ...@@ -143,8 +143,8 @@ int em28xx_write_regs_req(struct em28xx *dev, u8 req, u16 reg, char *buf,
if (reg_debug) { if (reg_debug) {
int i; int i;
for (i = 0; i < len; ++i) for (i = 0; i < len; ++i)
printk (" %02x", (unsigned char)buf[i]); printk(KERN_INFO " %02x", (unsigned char)buf[i]);
printk ("\n"); printk(KERN_INFO "\n");
} }
if (!bufs) if (!bufs)
...@@ -173,8 +173,12 @@ static int em28xx_write_reg_bits(struct em28xx *dev, u16 reg, u8 val, ...@@ -173,8 +173,12 @@ static int em28xx_write_reg_bits(struct em28xx *dev, u16 reg, u8 val,
{ {
int oldval; int oldval;
u8 newval; u8 newval;
if ((oldval = em28xx_read_reg(dev, reg)) < 0)
oldval = em28xx_read_reg(dev, reg);
if (oldval < 0)
return oldval; return oldval;
newval = (((u8) oldval) & ~bitmask) | (val & bitmask); newval = (((u8) oldval) & ~bitmask) | (val & bitmask);
return em28xx_write_regs(dev, reg, &newval, 1); return em28xx_write_regs(dev, reg, &newval, 1);
} }
...@@ -187,20 +191,26 @@ static int em28xx_write_ac97(struct em28xx *dev, u8 reg, u8 *val) ...@@ -187,20 +191,26 @@ static int em28xx_write_ac97(struct em28xx *dev, u8 reg, u8 *val)
{ {
int ret, i; int ret, i;
u8 addr = reg & 0x7f; u8 addr = reg & 0x7f;
if ((ret = em28xx_write_regs(dev, AC97LSB_REG, val, 2)) < 0)
ret = em28xx_write_regs(dev, AC97LSB_REG, val, 2);
if (ret < 0)
return ret; return ret;
if ((ret = em28xx_write_regs(dev, AC97ADDR_REG, &addr, 1)) < 0)
ret = em28xx_write_regs(dev, AC97ADDR_REG, &addr, 1);
if (ret < 0)
return ret; return ret;
/* Wait up to 50 ms for AC97 command to complete */ /* Wait up to 50 ms for AC97 command to complete */
for (i = 0; i < 10; i++) { for (i = 0; i < 10; i++) {
if ((ret = em28xx_read_reg(dev, AC97BUSY_REG)) < 0) ret = em28xx_read_reg(dev, AC97BUSY_REG);
if (ret < 0)
return ret; return ret;
if (!(ret & 0x01)) if (!(ret & 0x01))
return 0; return 0;
msleep(5); msleep(5);
} }
em28xx_warn ("AC97 command still being executed: not handled properly!\n"); em28xx_warn("AC97 command still being executed: not handled properly!\n");
return 0; return 0;
} }
...@@ -338,11 +348,11 @@ int em28xx_capture_start(struct em28xx *dev, int start) ...@@ -338,11 +348,11 @@ int em28xx_capture_start(struct em28xx *dev, int start)
rc = em28xx_write_regs_req(dev, 0x00, 0x48, "\x00", 1); rc = em28xx_write_regs_req(dev, 0x00, 0x48, "\x00", 1);
if (dev->mode == EM28XX_ANALOG_MODE) if (dev->mode == EM28XX_ANALOG_MODE)
rc = em28xx_write_regs(dev, VINENABLE_REG,"\x67", 1); rc = em28xx_write_regs(dev, VINENABLE_REG, "\x67", 1);
else else
rc = em28xx_write_regs(dev, VINENABLE_REG,"\x37", 1); rc = em28xx_write_regs(dev, VINENABLE_REG, "\x37", 1);
msleep (6); msleep(6);
return rc; return rc;
} }
...@@ -357,7 +367,8 @@ int em28xx_outfmt_set_yuv422(struct em28xx *dev) ...@@ -357,7 +367,8 @@ int em28xx_outfmt_set_yuv422(struct em28xx *dev)
static int em28xx_accumulator_set(struct em28xx *dev, u8 xmin, u8 xmax, static int em28xx_accumulator_set(struct em28xx *dev, u8 xmin, u8 xmax,
u8 ymin, u8 ymax) u8 ymin, u8 ymax)
{ {
em28xx_coredbg("em28xx Scale: (%d,%d)-(%d,%d)\n", xmin, ymin, xmax, ymax); em28xx_coredbg("em28xx Scale: (%d,%d)-(%d,%d)\n",
xmin, ymin, xmax, ymax);
em28xx_write_regs(dev, XMIN_REG, &xmin, 1); em28xx_write_regs(dev, XMIN_REG, &xmin, 1);
em28xx_write_regs(dev, XMAX_REG, &xmax, 1); em28xx_write_regs(dev, XMAX_REG, &xmax, 1);
...@@ -372,7 +383,8 @@ static int em28xx_capture_area_set(struct em28xx *dev, u8 hstart, u8 vstart, ...@@ -372,7 +383,8 @@ static int em28xx_capture_area_set(struct em28xx *dev, u8 hstart, u8 vstart,
u8 cheight = height; u8 cheight = height;
u8 overflow = (height >> 7 & 0x02) | (width >> 8 & 0x01); u8 overflow = (height >> 7 & 0x02) | (width >> 8 & 0x01);
em28xx_coredbg("em28xx Area Set: (%d,%d)\n", (width | (overflow & 2) << 7), em28xx_coredbg("em28xx Area Set: (%d,%d)\n",
(width | (overflow & 2) << 7),
(height | (overflow & 1) << 8)); (height | (overflow & 1) << 8));
em28xx_write_regs(dev, HSTART_REG, &hstart, 1); em28xx_write_regs(dev, HSTART_REG, &hstart, 1);
...@@ -386,7 +398,7 @@ static int em28xx_scaler_set(struct em28xx *dev, u16 h, u16 v) ...@@ -386,7 +398,7 @@ static int em28xx_scaler_set(struct em28xx *dev, u16 h, u16 v)
{ {
u8 mode; u8 mode;
/* the em2800 scaler only supports scaling down to 50% */ /* the em2800 scaler only supports scaling down to 50% */
if(dev->is_em2800) if (dev->is_em2800)
mode = (v ? 0x20 : 0x00) | (h ? 0x10 : 0x00); mode = (v ? 0x20 : 0x00) | (h ? 0x10 : 0x00);
else { else {
u8 buf[2]; u8 buf[2];
...@@ -396,7 +408,8 @@ static int em28xx_scaler_set(struct em28xx *dev, u16 h, u16 v) ...@@ -396,7 +408,8 @@ static int em28xx_scaler_set(struct em28xx *dev, u16 h, u16 v)
buf[0] = v; buf[0] = v;
buf[1] = v >> 8; buf[1] = v >> 8;
em28xx_write_regs(dev, VSCALELOW_REG, (char *)buf, 2); em28xx_write_regs(dev, VSCALELOW_REG, (char *)buf, 2);
/* it seems that both H and V scalers must be active to work correctly */ /* it seems that both H and V scalers must be active
to work correctly */
mode = (h || v)? 0x30: 0x00; mode = (h || v)? 0x30: 0x00;
} }
return em28xx_write_reg_bits(dev, COMPR_REG, mode, 0x30); return em28xx_write_reg_bits(dev, COMPR_REG, mode, 0x30);
...@@ -449,7 +462,7 @@ int em28xx_set_alternate(struct em28xx *dev) ...@@ -449,7 +462,7 @@ int em28xx_set_alternate(struct em28xx *dev)
dev->alt, dev->max_pkt_size); dev->alt, dev->max_pkt_size);
errCode = usb_set_interface(dev->udev, 0, dev->alt); errCode = usb_set_interface(dev->udev, 0, dev->alt);
if (errCode < 0) { if (errCode < 0) {
em28xx_errdev ("cannot change alternate number to %d (error=%i)\n", em28xx_errdev("cannot change alternate number to %d (error=%i)\n",
dev->alt, errCode); dev->alt, errCode);
return errCode; return errCode;
} }
...@@ -507,9 +520,9 @@ void em28xx_uninit_isoc(struct em28xx *dev) ...@@ -507,9 +520,9 @@ void em28xx_uninit_isoc(struct em28xx *dev)
usb_unlink_urb(urb); usb_unlink_urb(urb);
if (dev->isoc_ctl.transfer_buffer[i]) { if (dev->isoc_ctl.transfer_buffer[i]) {
usb_buffer_free(dev->udev, usb_buffer_free(dev->udev,
urb->transfer_buffer_length, urb->transfer_buffer_length,
dev->isoc_ctl.transfer_buffer[i], dev->isoc_ctl.transfer_buffer[i],
urb->transfer_dma); urb->transfer_dma);
} }
usb_free_urb(urb); usb_free_urb(urb);
dev->isoc_ctl.urb[i] = NULL; dev->isoc_ctl.urb[i] = NULL;
...@@ -596,7 +609,9 @@ int em28xx_init_isoc(struct em28xx *dev, int max_packets, ...@@ -596,7 +609,9 @@ int em28xx_init_isoc(struct em28xx *dev, int max_packets,
'desc.bEndpointAddress & USB_ENDPOINT_NUMBER_MASK' 'desc.bEndpointAddress & USB_ENDPOINT_NUMBER_MASK'
should also be using 'desc.bInterval' should also be using 'desc.bInterval'
*/ */
pipe = usb_rcvisocpipe(dev->udev, cap_type == EM28XX_ANALOG_CAPTURE ? 0x82 : 0x84); pipe = usb_rcvisocpipe(dev->udev,
cap_type == EM28XX_ANALOG_CAPTURE ? 0x82 : 0x84);
usb_fill_int_urb(urb, dev->udev, pipe, usb_fill_int_urb(urb, dev->udev, pipe,
dev->isoc_ctl.transfer_buffer[i], sb_size, dev->isoc_ctl.transfer_buffer[i], sb_size,
em28xx_irq_callback, dma_q, 1); em28xx_irq_callback, dma_q, 1);
......
...@@ -97,7 +97,8 @@ static inline void print_err_status(struct em28xx *dev, ...@@ -97,7 +97,8 @@ static inline void print_err_status(struct em28xx *dev,
if (packet < 0) { if (packet < 0) {
dprintk(1, "URB status %d [%s].\n", status, errmsg); dprintk(1, "URB status %d [%s].\n", status, errmsg);
} else { } else {
dprintk(1, "URB packet %d, status %d [%s].\n", packet, status, errmsg); dprintk(1, "URB packet %d, status %d [%s].\n",
packet, status, errmsg);
} }
} }
...@@ -134,18 +135,20 @@ static inline int dvb_isoc_copy(struct em28xx *dev, struct urb *urb) ...@@ -134,18 +135,20 @@ static inline int dvb_isoc_copy(struct em28xx *dev, struct urb *urb)
return 0; return 0;
} }
static int start_streaming(struct em28xx_dvb* dvb) { static int start_streaming(struct em28xx_dvb *dvb)
{
struct em28xx *dev = dvb->adapter.priv; struct em28xx *dev = dvb->adapter.priv;
usb_set_interface(dev->udev, 0, 1); usb_set_interface(dev->udev, 0, 1);
dev->em28xx_write_regs_req(dev,0x00,0x48,"\x00",1); dev->em28xx_write_regs_req(dev, 0x00, 0x48, "\x00", 1);
return em28xx_init_isoc(dev, EM28XX_DVB_MAX_PACKETS, return em28xx_init_isoc(dev, EM28XX_DVB_MAX_PACKETS,
EM28XX_DVB_NUM_BUFS, EM28XX_DVB_MAX_PACKETSIZE, EM28XX_DVB_NUM_BUFS, EM28XX_DVB_MAX_PACKETSIZE,
dvb_isoc_copy, EM28XX_DIGITAL_CAPTURE); dvb_isoc_copy, EM28XX_DIGITAL_CAPTURE);
} }
static int stop_streaming(struct em28xx_dvb* dvb) { static int stop_streaming(struct em28xx_dvb *dvb)
{
struct em28xx *dev = dvb->adapter.priv; struct em28xx *dev = dvb->adapter.priv;
em28xx_uninit_isoc(dev); em28xx_uninit_isoc(dev);
...@@ -167,7 +170,8 @@ static int start_feed(struct dvb_demux_feed *feed) ...@@ -167,7 +170,8 @@ static int start_feed(struct dvb_demux_feed *feed)
if (dvb->nfeeds == 1) { if (dvb->nfeeds == 1) {
ret = start_streaming(dvb); ret = start_streaming(dvb);
if(ret < 0) rc = ret; if (ret < 0)
rc = ret;
} }
mutex_unlock(&dvb->lock); mutex_unlock(&dvb->lock);
...@@ -182,9 +186,10 @@ static int stop_feed(struct dvb_demux_feed *feed) ...@@ -182,9 +186,10 @@ static int stop_feed(struct dvb_demux_feed *feed)
mutex_lock(&dvb->lock); mutex_lock(&dvb->lock);
dvb->nfeeds--; dvb->nfeeds--;
if (0 == dvb->nfeeds) {
if (0 == dvb->nfeeds)
err = stop_streaming(dvb); err = stop_streaming(dvb);
}
mutex_unlock(&dvb->lock); mutex_unlock(&dvb->lock);
return err; return err;
} }
...@@ -212,7 +217,7 @@ static int attach_xc3028(u8 addr, struct em28xx *dev) ...@@ -212,7 +217,7 @@ static int attach_xc3028(u8 addr, struct em28xx *dev)
struct xc2028_ctrl ctl; struct xc2028_ctrl ctl;
struct xc2028_config cfg; struct xc2028_config cfg;
memset (&cfg, 0, sizeof(cfg)); memset(&cfg, 0, sizeof(cfg));
cfg.i2c_adap = &dev->i2c_adap; cfg.i2c_adap = &dev->i2c_adap;
cfg.i2c_addr = addr; cfg.i2c_addr = addr;
cfg.ctrl = &ctl; cfg.ctrl = &ctl;
...@@ -360,8 +365,9 @@ static int dvb_init(struct em28xx *dev) ...@@ -360,8 +365,9 @@ static int dvb_init(struct em28xx *dev)
struct em28xx_dvb *dvb; struct em28xx_dvb *dvb;
dvb = kzalloc(sizeof(struct em28xx_dvb), GFP_KERNEL); dvb = kzalloc(sizeof(struct em28xx_dvb), GFP_KERNEL);
if(dvb == NULL) {
printk("em28xx_dvb: memory allocation failed\n"); if (dvb == NULL) {
printk(KERN_INFO "em28xx_dvb: memory allocation failed\n");
return -ENOMEM; return -ENOMEM;
} }
dev->dvb = dvb; dev->dvb = dvb;
...@@ -410,9 +416,8 @@ static int dvb_init(struct em28xx *dev) ...@@ -410,9 +416,8 @@ static int dvb_init(struct em28xx *dev)
/* register everything */ /* register everything */
result = register_dvb(dvb, THIS_MODULE, dev, &dev->udev->dev); result = register_dvb(dvb, THIS_MODULE, dev, &dev->udev->dev);
if (result < 0) { if (result < 0)
goto out_free; goto out_free;
}
printk(KERN_INFO "Successfully loaded em28xx-dvb\n"); printk(KERN_INFO "Successfully loaded em28xx-dvb\n");
return 0; return 0;
......
...@@ -41,11 +41,21 @@ static unsigned int i2c_debug; ...@@ -41,11 +41,21 @@ static unsigned int i2c_debug;
module_param(i2c_debug, int, 0644); module_param(i2c_debug, int, 0644);
MODULE_PARM_DESC(i2c_debug, "enable debug messages [i2c]"); MODULE_PARM_DESC(i2c_debug, "enable debug messages [i2c]");
#define dprintk1(lvl,fmt, args...) if (i2c_debug>=lvl) do {\
printk(fmt, ##args); } while (0) #define dprintk1(lvl, fmt, args...) \
#define dprintk2(lvl,fmt, args...) if (i2c_debug>=lvl) do{ \ do { \
printk(KERN_DEBUG "%s at %s: " fmt, \ if (i2c_debug >= lvl) { \
dev->name, __func__ , ##args); } while (0) printk(fmt, ##args); \
} \
} while (0)
#define dprintk2(lvl, fmt, args...) \
do { \
if (i2c_debug >= lvl) { \
printk(KERN_DEBUG "%s at %s: " fmt, \
dev->name, __func__ , ##args); \
} \
} while (0)
/* /*
* em2800_i2c_send_max4() * em2800_i2c_send_max4()
...@@ -235,16 +245,16 @@ static int em28xx_i2c_xfer(struct i2c_adapter *i2c_adap, ...@@ -235,16 +245,16 @@ static int em28xx_i2c_xfer(struct i2c_adapter *i2c_adap,
return 0; return 0;
for (i = 0; i < num; i++) { for (i = 0; i < num; i++) {
addr = msgs[i].addr << 1; addr = msgs[i].addr << 1;
dprintk2(2,"%s %s addr=%x len=%d:", dprintk2(2, "%s %s addr=%x len=%d:",
(msgs[i].flags & I2C_M_RD) ? "read" : "write", (msgs[i].flags & I2C_M_RD) ? "read" : "write",
i == num - 1 ? "stop" : "nonstop", addr, msgs[i].len); i == num - 1 ? "stop" : "nonstop", addr, msgs[i].len);
if (!msgs[i].len) { /* no len: check only for device presence */ if (!msgs[i].len) { /* no len: check only for device presence */
if (dev->is_em2800) if (dev->is_em2800)
rc = em2800_i2c_check_for_device(dev, addr); rc = em2800_i2c_check_for_device(dev, addr);
else else
rc = em28xx_i2c_check_for_device(dev, addr); rc = em28xx_i2c_check_for_device(dev, addr);
if (rc < 0) { if (rc < 0) {
dprintk2(2," no device\n"); dprintk2(2, " no device\n");
return rc; return rc;
} }
...@@ -258,14 +268,13 @@ static int em28xx_i2c_xfer(struct i2c_adapter *i2c_adap, ...@@ -258,14 +268,13 @@ static int em28xx_i2c_xfer(struct i2c_adapter *i2c_adap,
rc = em28xx_i2c_recv_bytes(dev, addr, rc = em28xx_i2c_recv_bytes(dev, addr,
msgs[i].buf, msgs[i].buf,
msgs[i].len); msgs[i].len);
if (i2c_debug>=2) { if (i2c_debug >= 2) {
for (byte = 0; byte < msgs[i].len; byte++) { for (byte = 0; byte < msgs[i].len; byte++)
printk(" %02x", msgs[i].buf[byte]); printk(" %02x", msgs[i].buf[byte]);
}
} }
} else { } else {
/* write bytes */ /* write bytes */
if (i2c_debug>=2) { if (i2c_debug >= 2) {
for (byte = 0; byte < msgs[i].len; byte++) for (byte = 0; byte < msgs[i].len; byte++)
printk(" %02x", msgs[i].buf[byte]); printk(" %02x", msgs[i].buf[byte]);
} }
...@@ -281,13 +290,13 @@ static int em28xx_i2c_xfer(struct i2c_adapter *i2c_adap, ...@@ -281,13 +290,13 @@ static int em28xx_i2c_xfer(struct i2c_adapter *i2c_adap,
} }
if (rc < 0) if (rc < 0)
goto err; goto err;
if (i2c_debug>=2) if (i2c_debug >= 2)
printk("\n"); printk("\n");
} }
return num; return num;
err: err:
dprintk2(2," ERROR: %i\n", rc); dprintk2(2, " ERROR: %i\n", rc);
return rc; return rc;
} }
...@@ -330,7 +339,9 @@ static int em28xx_i2c_eeprom(struct em28xx *dev, unsigned char *eedata, int len) ...@@ -330,7 +339,9 @@ static int em28xx_i2c_eeprom(struct em28xx *dev, unsigned char *eedata, int len)
return -1; return -1;
buf = 0; buf = 0;
if (1 != (err = i2c_master_send(&dev->i2c_client, &buf, 1))) {
err = i2c_master_send(&dev->i2c_client, &buf, 1);
if (err != 1) {
printk(KERN_INFO "%s: Huh, no eeprom present (err=%d)?\n", printk(KERN_INFO "%s: Huh, no eeprom present (err=%d)?\n",
dev->name, err); dev->name, err);
return -1; return -1;
...@@ -403,8 +414,10 @@ static int em28xx_i2c_eeprom(struct em28xx *dev, unsigned char *eedata, int len) ...@@ -403,8 +414,10 @@ static int em28xx_i2c_eeprom(struct em28xx *dev, unsigned char *eedata, int len)
break; break;
} }
printk(KERN_INFO "Table at 0x%02x, strings=0x%04x, 0x%04x, 0x%04x\n", printk(KERN_INFO "Table at 0x%02x, strings=0x%04x, 0x%04x, 0x%04x\n",
em_eeprom->string_idx_table,em_eeprom->string1, em_eeprom->string_idx_table,
em_eeprom->string2,em_eeprom->string3); em_eeprom->string1,
em_eeprom->string2,
em_eeprom->string3);
return 0; return 0;
} }
...@@ -430,58 +443,61 @@ static int attach_inform(struct i2c_client *client) ...@@ -430,58 +443,61 @@ static int attach_inform(struct i2c_client *client)
struct em28xx *dev = client->adapter->algo_data; struct em28xx *dev = client->adapter->algo_data;
switch (client->addr << 1) { switch (client->addr << 1) {
case 0x86: case 0x86:
case 0x84: case 0x84:
case 0x96: case 0x96:
case 0x94: case 0x94:
{ {
struct v4l2_priv_tun_config tda9887_cfg; struct v4l2_priv_tun_config tda9887_cfg;
struct tuner_setup tun_setup; struct tuner_setup tun_setup;
tun_setup.mode_mask = T_ANALOG_TV | T_RADIO; tun_setup.mode_mask = T_ANALOG_TV | T_RADIO;
tun_setup.type = TUNER_TDA9887; tun_setup.type = TUNER_TDA9887;
tun_setup.addr = client->addr; tun_setup.addr = client->addr;
em28xx_i2c_call_clients(dev, TUNER_SET_TYPE_ADDR, &tun_setup); em28xx_i2c_call_clients(dev, TUNER_SET_TYPE_ADDR,
&tun_setup);
tda9887_cfg.tuner = TUNER_TDA9887;
tda9887_cfg.priv = &dev->tda9887_conf; tda9887_cfg.tuner = TUNER_TDA9887;
em28xx_i2c_call_clients(dev, TUNER_SET_CONFIG, tda9887_cfg.priv = &dev->tda9887_conf;
&tda9887_cfg); em28xx_i2c_call_clients(dev, TUNER_SET_CONFIG,
break; &tda9887_cfg);
} break;
case 0x42: }
dprintk1(1,"attach_inform: saa7114 detected.\n"); case 0x42:
break; dprintk1(1, "attach_inform: saa7114 detected.\n");
case 0x4a: break;
dprintk1(1,"attach_inform: saa7113 detected.\n"); case 0x4a:
break; dprintk1(1, "attach_inform: saa7113 detected.\n");
case 0xa0: break;
dprintk1(1,"attach_inform: eeprom detected.\n"); case 0xa0:
break; dprintk1(1, "attach_inform: eeprom detected.\n");
case 0x60: break;
case 0x8e: case 0x60:
{ case 0x8e:
struct IR_i2c *ir = i2c_get_clientdata(client); {
dprintk1(1,"attach_inform: IR detected (%s).\n",ir->phys); struct IR_i2c *ir = i2c_get_clientdata(client);
em28xx_set_ir(dev,ir); dprintk1(1, "attach_inform: IR detected (%s).\n",
break; ir->phys);
} em28xx_set_ir(dev, ir);
case 0x80: break;
case 0x88: }
dprintk1(1,"attach_inform: msp34xx detected.\n"); case 0x80:
break; case 0x88:
case 0xb8: dprintk1(1, "attach_inform: msp34xx detected.\n");
case 0xba: break;
dprintk1(1,"attach_inform: tvp5150 detected.\n"); case 0xb8:
break; case 0xba:
dprintk1(1, "attach_inform: tvp5150 detected.\n");
default: break;
if (!dev->tuner_addr)
dev->tuner_addr = client->addr; default:
if (!dev->tuner_addr)
dprintk1(1,"attach inform: detected I2C address %x\n", client->addr << 1); dev->tuner_addr = client->addr;
dprintk1(1, "attach inform: detected I2C address %x\n",
client->addr << 1);
} }
......
...@@ -32,10 +32,12 @@ ...@@ -32,10 +32,12 @@
static unsigned int ir_debug; static unsigned int ir_debug;
module_param(ir_debug, int, 0644); module_param(ir_debug, int, 0644);
MODULE_PARM_DESC(ir_debug,"enable debug messages [IR]"); MODULE_PARM_DESC(ir_debug, "enable debug messages [IR]");
#define dprintk(fmt, arg...) if (ir_debug) \ #define dprintk(fmt, arg...) \
printk(KERN_DEBUG "%s/ir: " fmt, ir->c.name , ## arg) if (ir_debug) { \
printk(KERN_DEBUG "%s/ir: " fmt, ir->c.name , ## arg); \
}
/* ----------------------------------------------------------------------- */ /* ----------------------------------------------------------------------- */
...@@ -44,7 +46,7 @@ int em28xx_get_key_terratec(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) ...@@ -44,7 +46,7 @@ int em28xx_get_key_terratec(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
unsigned char b; unsigned char b;
/* poll IR chip */ /* poll IR chip */
if (1 != i2c_master_recv(&ir->c,&b,1)) { if (1 != i2c_master_recv(&ir->c, &b, 1)) {
dprintk("read error\n"); dprintk("read error\n");
return -EIO; return -EIO;
} }
...@@ -74,24 +76,25 @@ int em28xx_get_key_em_haup(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) ...@@ -74,24 +76,25 @@ int em28xx_get_key_em_haup(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
unsigned char code; unsigned char code;
/* poll IR chip */ /* poll IR chip */
if (2 != i2c_master_recv(&ir->c,buf,2)) if (2 != i2c_master_recv(&ir->c, buf, 2))
return -EIO; return -EIO;
/* Does eliminate repeated parity code */ /* Does eliminate repeated parity code */
if (buf[1]==0xff) if (buf[1] == 0xff)
return 0; return 0;
ir->old=buf[1]; ir->old = buf[1];
/* Rearranges bits to the right order */ /* Rearranges bits to the right order */
code= ((buf[0]&0x01)<<5) | /* 0010 0000 */ code = ((buf[0]&0x01)<<5) | /* 0010 0000 */
((buf[0]&0x02)<<3) | /* 0001 0000 */ ((buf[0]&0x02)<<3) | /* 0001 0000 */
((buf[0]&0x04)<<1) | /* 0000 1000 */ ((buf[0]&0x04)<<1) | /* 0000 1000 */
((buf[0]&0x08)>>1) | /* 0000 0100 */ ((buf[0]&0x08)>>1) | /* 0000 0100 */
((buf[0]&0x10)>>3) | /* 0000 0010 */ ((buf[0]&0x10)>>3) | /* 0000 0010 */
((buf[0]&0x20)>>5); /* 0000 0001 */ ((buf[0]&0x20)>>5); /* 0000 0001 */
dprintk("ir hauppauge (em2840): code=0x%02x (rcv=0x%02x)\n",code,buf[0]); dprintk("ir hauppauge (em2840): code=0x%02x (rcv=0x%02x)\n",
code, buf[0]);
/* return key */ /* return key */
*ir_key = code; *ir_key = code;
...@@ -106,15 +109,14 @@ int em28xx_get_key_pinnacle_usb_grey(struct IR_i2c *ir, u32 *ir_key, ...@@ -106,15 +109,14 @@ int em28xx_get_key_pinnacle_usb_grey(struct IR_i2c *ir, u32 *ir_key,
/* poll IR chip */ /* poll IR chip */
if (3 != i2c_master_recv(&ir->c,buf,3)) { if (3 != i2c_master_recv(&ir->c, buf, 3)) {
dprintk("read error\n"); dprintk("read error\n");
return -EIO; return -EIO;
} }
dprintk("key %02x\n", buf[2]&0x3f); dprintk("key %02x\n", buf[2]&0x3f);
if (buf[0]!=0x00){ if (buf[0] != 0x00)
return 0; return 0;
}
*ir_key = buf[2]&0x3f; *ir_key = buf[2]&0x3f;
*ir_raw = buf[2]&0x3f; *ir_raw = buf[2]&0x3f;
......
/* /*
em28xx-video.c - driver for Empia EM2800/EM2820/2840 USB video capture devices em28xx-video.c - driver for Empia EM2800/EM2820/2840 USB
video capture devices
Copyright (C) 2005 Ludovico Cavedon <cavedon@sssup.it> Copyright (C) 2005 Ludovico Cavedon <cavedon@sssup.it>
Markus Rechberger <mrechberger@gmail.com> Markus Rechberger <mrechberger@gmail.com>
...@@ -58,10 +59,13 @@ static unsigned int isoc_debug; ...@@ -58,10 +59,13 @@ static unsigned int isoc_debug;
module_param(isoc_debug, int, 0644); module_param(isoc_debug, int, 0644);
MODULE_PARM_DESC(isoc_debug, "enable debug messages [isoc transfers]"); MODULE_PARM_DESC(isoc_debug, "enable debug messages [isoc transfers]");
#define em28xx_isocdbg(fmt, arg...) do {\ #define em28xx_isocdbg(fmt, arg...) \
if (isoc_debug) \ do {\
if (isoc_debug) { \
printk(KERN_INFO "%s %s :"fmt, \ printk(KERN_INFO "%s %s :"fmt, \
dev->name, __func__ , ##arg); } while (0) dev->name, __func__ , ##arg); \
} \
} while (0)
MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_DESCRIPTION(DRIVER_DESC); MODULE_DESCRIPTION(DRIVER_DESC);
...@@ -84,8 +88,8 @@ MODULE_PARM_DESC(vbi_nr, "vbi device numbers"); ...@@ -84,8 +88,8 @@ MODULE_PARM_DESC(vbi_nr, "vbi device numbers");
MODULE_PARM_DESC(radio_nr, "radio device numbers"); MODULE_PARM_DESC(radio_nr, "radio device numbers");
static unsigned int video_debug; static unsigned int video_debug;
module_param(video_debug,int,0644); module_param(video_debug, int, 0644);
MODULE_PARM_DESC(video_debug,"enable debug messages [video]"); MODULE_PARM_DESC(video_debug, "enable debug messages [video]");
/* Bitmask marking allocated devices from 0 to EM28XX_MAXBOARDS */ /* Bitmask marking allocated devices from 0 to EM28XX_MAXBOARDS */
static unsigned long em28xx_devused; static unsigned long em28xx_devused;
...@@ -102,7 +106,7 @@ static struct v4l2_queryctrl em28xx_qctrl[] = { ...@@ -102,7 +106,7 @@ static struct v4l2_queryctrl em28xx_qctrl[] = {
.step = 0x1, .step = 0x1,
.default_value = 0x1f, .default_value = 0x1f,
.flags = 0, .flags = 0,
},{ }, {
.id = V4L2_CID_AUDIO_MUTE, .id = V4L2_CID_AUDIO_MUTE,
.type = V4L2_CTRL_TYPE_BOOLEAN, .type = V4L2_CTRL_TYPE_BOOLEAN,
.name = "Mute", .name = "Mute",
...@@ -390,7 +394,7 @@ buffer_setup(struct videobuf_queue *vq, unsigned int *count, unsigned int *size) ...@@ -390,7 +394,7 @@ buffer_setup(struct videobuf_queue *vq, unsigned int *count, unsigned int *size)
dev->mode = EM28XX_ANALOG_MODE; dev->mode = EM28XX_ANALOG_MODE;
/* Ask tuner to go to analog mode */ /* Ask tuner to go to analog mode */
memset (&f, 0, sizeof(f)); memset(&f, 0, sizeof(f));
f.frequency = dev->ctl_freq; f.frequency = dev->ctl_freq;
em28xx_i2c_call_clients(dev, VIDIOC_S_FREQUENCY, &f); em28xx_i2c_call_clients(dev, VIDIOC_S_FREQUENCY, &f);
...@@ -483,7 +487,8 @@ buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb) ...@@ -483,7 +487,8 @@ buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb)
} }
static void buffer_release(struct videobuf_queue *vq, struct videobuf_buffer *vb) static void buffer_release(struct videobuf_queue *vq,
struct videobuf_buffer *vb)
{ {
struct em28xx_buffer *buf = container_of(vb, struct em28xx_buffer, vb); struct em28xx_buffer *buf = container_of(vb, struct em28xx_buffer, vb);
struct em28xx_fh *fh = vq->priv_data; struct em28xx_fh *fh = vq->priv_data;
...@@ -501,7 +506,7 @@ static struct videobuf_queue_ops em28xx_video_qops = { ...@@ -501,7 +506,7 @@ static struct videobuf_queue_ops em28xx_video_qops = {
.buf_release = buffer_release, .buf_release = buffer_release,
}; };
/********************* v4l2 interface ******************************************/ /********************* v4l2 interface **************************************/
/* /*
* em28xx_config() * em28xx_config()
...@@ -516,9 +521,9 @@ static int em28xx_config(struct em28xx *dev) ...@@ -516,9 +521,9 @@ static int em28xx_config(struct em28xx *dev)
/* enable vbi capturing */ /* enable vbi capturing */
/* em28xx_write_regs_req(dev,0x00,0x0e,"\xC0",1); audio register */ /* em28xx_write_regs_req(dev, 0x00, 0x0e, "\xC0", 1); audio register */
/* em28xx_write_regs_req(dev,0x00,0x0f,"\x80",1); clk register */ /* em28xx_write_regs_req(dev, 0x00, 0x0f, "\x80", 1); clk register */
em28xx_write_regs_req(dev,0x00,0x11,"\x51",1); em28xx_write_regs_req(dev, 0x00, 0x11, "\x51", 1);
dev->mute = 1; /* maybe not the right place... */ dev->mute = 1; /* maybe not the right place... */
dev->volume = 0x1f; dev->volume = 0x1f;
...@@ -557,12 +562,15 @@ static void video_mux(struct em28xx *dev, int index) ...@@ -557,12 +562,15 @@ static void video_mux(struct em28xx *dev, int index)
em28xx_i2c_call_clients(dev, VIDIOC_INT_S_VIDEO_ROUTING, &route); em28xx_i2c_call_clients(dev, VIDIOC_INT_S_VIDEO_ROUTING, &route);
if (dev->has_msp34xx) { if (dev->has_msp34xx) {
if (dev->i2s_speed) if (dev->i2s_speed) {
em28xx_i2c_call_clients(dev, VIDIOC_INT_I2S_CLOCK_FREQ, &dev->i2s_speed); em28xx_i2c_call_clients(dev, VIDIOC_INT_I2S_CLOCK_FREQ,
&dev->i2s_speed);
}
route.input = dev->ctl_ainput; route.input = dev->ctl_ainput;
route.output = MSP_OUTPUT(MSP_SC_IN_DSP_SCART1); route.output = MSP_OUTPUT(MSP_SC_IN_DSP_SCART1);
/* Note: this is msp3400 specific */ /* Note: this is msp3400 specific */
em28xx_i2c_call_clients(dev, VIDIOC_INT_S_AUDIO_ROUTING, &route); em28xx_i2c_call_clients(dev, VIDIOC_INT_S_AUDIO_ROUTING,
&route);
} }
em28xx_audio_analog_set(dev); em28xx_audio_analog_set(dev);
...@@ -802,7 +810,7 @@ static int vidioc_s_fmt_cap(struct file *file, void *priv, ...@@ -802,7 +810,7 @@ static int vidioc_s_fmt_cap(struct file *file, void *priv,
return rc; return rc;
} }
static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id *norm) static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id * norm)
{ {
struct em28xx_fh *fh = priv; struct em28xx_fh *fh = priv;
struct em28xx *dev = fh->dev; struct em28xx *dev = fh->dev;
...@@ -919,11 +927,11 @@ static int vidioc_g_audio(struct file *file, void *priv, struct v4l2_audio *a) ...@@ -919,11 +927,11 @@ static int vidioc_g_audio(struct file *file, void *priv, struct v4l2_audio *a)
index = dev->ctl_ainput; index = dev->ctl_ainput;
if (index == 0) { if (index == 0)
strcpy(a->name, "Television"); strcpy(a->name, "Television");
} else { else
strcpy(a->name, "Line In"); strcpy(a->name, "Line In");
}
a->capability = V4L2_AUDCAP_STEREO; a->capability = V4L2_AUDCAP_STEREO;
a->index = index; a->index = index;
...@@ -1501,7 +1509,7 @@ static int em28xx_v4l2_open(struct inode *inode, struct file *filp) ...@@ -1501,7 +1509,7 @@ static int em28xx_v4l2_open(struct inode *inode, struct file *filp)
{ {
int minor = iminor(inode); int minor = iminor(inode);
int errCode = 0, radio = 0; int errCode = 0, radio = 0;
struct em28xx *h,*dev = NULL; struct em28xx *h, *dev = NULL;
struct em28xx_fh *fh; struct em28xx_fh *fh;
enum v4l2_buf_type fh_type = 0; enum v4l2_buf_type fh_type = 0;
...@@ -1602,12 +1610,13 @@ static void em28xx_release_resources(struct em28xx *dev) ...@@ -1602,12 +1610,13 @@ static void em28xx_release_resources(struct em28xx *dev)
usb_put_dev(dev->udev); usb_put_dev(dev->udev);
/* Mark device as unused */ /* Mark device as unused */
em28xx_devused&=~(1<<dev->devno); em28xx_devused &= ~(1<<dev->devno);
} }
/* /*
* em28xx_v4l2_close() * em28xx_v4l2_close()
* stops streaming and deallocates all resources allocated by the v4l2 calls and ioctls * stops streaming and deallocates all resources allocated by the v4l2
* calls and ioctls
*/ */
static int em28xx_v4l2_close(struct inode *inode, struct file *filp) static int em28xx_v4l2_close(struct inode *inode, struct file *filp)
{ {
...@@ -1660,7 +1669,7 @@ static int em28xx_v4l2_close(struct inode *inode, struct file *filp) ...@@ -1660,7 +1669,7 @@ static int em28xx_v4l2_close(struct inode *inode, struct file *filp)
* will allocate buffers when called for the first time * will allocate buffers when called for the first time
*/ */
static ssize_t static ssize_t
em28xx_v4l2_read(struct file *filp, char __user * buf, size_t count, em28xx_v4l2_read(struct file *filp, char __user *buf, size_t count,
loff_t *pos) loff_t *pos)
{ {
struct em28xx_fh *fh = filp->private_data; struct em28xx_fh *fh = filp->private_data;
...@@ -1825,7 +1834,7 @@ static struct video_device em28xx_radio_template = { ...@@ -1825,7 +1834,7 @@ static struct video_device em28xx_radio_template = {
#endif #endif
}; };
/******************************** usb interface *****************************************/ /******************************** usb interface ******************************/
static LIST_HEAD(em28xx_extension_devlist); static LIST_HEAD(em28xx_extension_devlist);
...@@ -2088,22 +2097,24 @@ static int em28xx_usb_probe(struct usb_interface *interface, ...@@ -2088,22 +2097,24 @@ static int em28xx_usb_probe(struct usb_interface *interface,
ifnum = interface->altsetting[0].desc.bInterfaceNumber; ifnum = interface->altsetting[0].desc.bInterfaceNumber;
/* Check to see next free device and mark as used */ /* Check to see next free device and mark as used */
nr=find_first_zero_bit(&em28xx_devused,EM28XX_MAXBOARDS); nr = find_first_zero_bit(&em28xx_devused, EM28XX_MAXBOARDS);
em28xx_devused|=1<<nr; em28xx_devused |= 1<<nr;
/* Don't register audio interfaces */ /* Don't register audio interfaces */
if (interface->altsetting[0].desc.bInterfaceClass == USB_CLASS_AUDIO) { if (interface->altsetting[0].desc.bInterfaceClass == USB_CLASS_AUDIO) {
em28xx_err(DRIVER_NAME " audio device (%04x:%04x): interface %i, class %i\n", em28xx_err(DRIVER_NAME " audio device (%04x:%04x): interface %i, class %i\n",
udev->descriptor.idVendor,udev->descriptor.idProduct, udev->descriptor.idVendor,
udev->descriptor.idProduct,
ifnum, ifnum,
interface->altsetting[0].desc.bInterfaceClass); interface->altsetting[0].desc.bInterfaceClass);
em28xx_devused&=~(1<<nr); em28xx_devused &= ~(1<<nr);
return -ENODEV; return -ENODEV;
} }
em28xx_err(DRIVER_NAME " new video device (%04x:%04x): interface %i, class %i\n", em28xx_err(DRIVER_NAME " new video device (%04x:%04x): interface %i, class %i\n",
udev->descriptor.idVendor,udev->descriptor.idProduct, udev->descriptor.idVendor,
udev->descriptor.idProduct,
ifnum, ifnum,
interface->altsetting[0].desc.bInterfaceClass); interface->altsetting[0].desc.bInterfaceClass);
...@@ -2113,18 +2124,19 @@ static int em28xx_usb_probe(struct usb_interface *interface, ...@@ -2113,18 +2124,19 @@ static int em28xx_usb_probe(struct usb_interface *interface,
if ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != if ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) !=
USB_ENDPOINT_XFER_ISOC) { USB_ENDPOINT_XFER_ISOC) {
em28xx_err(DRIVER_NAME " probing error: endpoint is non-ISO endpoint!\n"); em28xx_err(DRIVER_NAME " probing error: endpoint is non-ISO endpoint!\n");
em28xx_devused&=~(1<<nr); em28xx_devused &= ~(1<<nr);
return -ENODEV; return -ENODEV;
} }
if ((endpoint->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT) { if ((endpoint->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT) {
em28xx_err(DRIVER_NAME " probing error: endpoint is ISO OUT endpoint!\n"); em28xx_err(DRIVER_NAME " probing error: endpoint is ISO OUT endpoint!\n");
em28xx_devused&=~(1<<nr); em28xx_devused &= ~(1<<nr);
return -ENODEV; return -ENODEV;
} }
if (nr >= EM28XX_MAXBOARDS) { if (nr >= EM28XX_MAXBOARDS) {
printk (DRIVER_NAME ": Supports only %i em28xx boards.\n",EM28XX_MAXBOARDS); printk(DRIVER_NAME ": Supports only %i em28xx boards.\n",
em28xx_devused&=~(1<<nr); EM28XX_MAXBOARDS);
em28xx_devused &= ~(1<<nr);
return -ENOMEM; return -ENOMEM;
} }
...@@ -2132,7 +2144,7 @@ static int em28xx_usb_probe(struct usb_interface *interface, ...@@ -2132,7 +2144,7 @@ static int em28xx_usb_probe(struct usb_interface *interface,
dev = kzalloc(sizeof(*dev), GFP_KERNEL); dev = kzalloc(sizeof(*dev), GFP_KERNEL);
if (dev == NULL) { if (dev == NULL) {
em28xx_err(DRIVER_NAME ": out of memory!\n"); em28xx_err(DRIVER_NAME ": out of memory!\n");
em28xx_devused&=~(1<<nr); em28xx_devused &= ~(1<<nr);
return -ENOMEM; return -ENOMEM;
} }
...@@ -2156,14 +2168,14 @@ static int em28xx_usb_probe(struct usb_interface *interface, ...@@ -2156,14 +2168,14 @@ static int em28xx_usb_probe(struct usb_interface *interface,
/* compute alternate max packet sizes */ /* compute alternate max packet sizes */
uif = udev->actconfig->interface[0]; uif = udev->actconfig->interface[0];
dev->num_alt=uif->num_altsetting; dev->num_alt = uif->num_altsetting;
em28xx_info("Alternate settings: %i\n",dev->num_alt); em28xx_info("Alternate settings: %i\n", dev->num_alt);
// dev->alt_max_pkt_size = kmalloc(sizeof(*dev->alt_max_pkt_size)* /* dev->alt_max_pkt_size = kmalloc(sizeof(*dev->alt_max_pkt_size)* */
dev->alt_max_pkt_size = kmalloc(32* dev->alt_max_pkt_size = kmalloc(32 * dev->num_alt, GFP_KERNEL);
dev->num_alt,GFP_KERNEL);
if (dev->alt_max_pkt_size == NULL) { if (dev->alt_max_pkt_size == NULL) {
em28xx_errdev("out of memory!\n"); em28xx_errdev("out of memory!\n");
em28xx_devused&=~(1<<nr); em28xx_devused &= ~(1<<nr);
kfree(dev); kfree(dev);
return -ENOMEM; return -ENOMEM;
} }
...@@ -2173,11 +2185,11 @@ static int em28xx_usb_probe(struct usb_interface *interface, ...@@ -2173,11 +2185,11 @@ static int em28xx_usb_probe(struct usb_interface *interface,
wMaxPacketSize); wMaxPacketSize);
dev->alt_max_pkt_size[i] = dev->alt_max_pkt_size[i] =
(tmp & 0x07ff) * (((tmp & 0x1800) >> 11) + 1); (tmp & 0x07ff) * (((tmp & 0x1800) >> 11) + 1);
em28xx_info("Alternate setting %i, max size= %i\n",i, em28xx_info("Alternate setting %i, max size= %i\n", i,
dev->alt_max_pkt_size[i]); dev->alt_max_pkt_size[i]);
} }
if ((card[nr]>=0)&&(card[nr]<em28xx_bcount)) if ((card[nr] >= 0) && (card[nr] < em28xx_bcount))
dev->model = card[nr]; dev->model = card[nr];
/* allocate device struct */ /* allocate device struct */
...@@ -2213,7 +2225,8 @@ static void em28xx_usb_disconnect(struct usb_interface *interface) ...@@ -2213,7 +2225,8 @@ static void em28xx_usb_disconnect(struct usb_interface *interface)
em28xx_info("disconnecting %s\n", dev->vdev->name); em28xx_info("disconnecting %s\n", dev->vdev->name);
/* wait until all current v4l2 io is finished then deallocate resources */ /* wait until all current v4l2 io is finished then deallocate
resources */
mutex_lock(&dev->lock); mutex_lock(&dev->lock);
wake_up_interruptible_all(&dev->open); wake_up_interruptible_all(&dev->open);
......
...@@ -365,7 +365,8 @@ struct em28xx { ...@@ -365,7 +365,8 @@ struct em28xx {
unsigned int video_bytesread; /* Number of bytes read */ unsigned int video_bytesread; /* Number of bytes read */
unsigned long hash; /* eeprom hash - for boards with generic ID */ unsigned long hash; /* eeprom hash - for boards with generic ID */
unsigned long i2c_hash; /* i2c devicelist hash - for boards with generic ID */ unsigned long i2c_hash; /* i2c devicelist hash -
for boards with generic ID */
struct em28xx_audio *adev; struct em28xx_audio *adev;
...@@ -399,14 +400,14 @@ struct em28xx { ...@@ -399,14 +400,14 @@ struct em28xx {
struct urb *urb[EM28XX_NUM_BUFS]; /* urb for isoc transfers */ struct urb *urb[EM28XX_NUM_BUFS]; /* urb for isoc transfers */
char *transfer_buffer[EM28XX_NUM_BUFS]; /* transfer buffers for isoc transfer */ char *transfer_buffer[EM28XX_NUM_BUFS]; /* transfer buffers for isoc transfer */
/* helper funcs that call usb_control_msg */ /* helper funcs that call usb_control_msg */
int (*em28xx_write_regs) (struct em28xx * dev, u16 reg, char *buf, int (*em28xx_write_regs) (struct em28xx *dev, u16 reg,
int len);
int (*em28xx_read_reg) (struct em28xx * dev, u16 reg);
int (*em28xx_read_reg_req_len) (struct em28xx * dev, u8 req, u16 reg,
char *buf, int len); char *buf, int len);
int (*em28xx_write_regs_req) (struct em28xx * dev, u8 req, u16 reg, int (*em28xx_read_reg) (struct em28xx *dev, u16 reg);
int (*em28xx_read_reg_req_len) (struct em28xx *dev, u8 req, u16 reg,
char *buf, int len);
int (*em28xx_write_regs_req) (struct em28xx *dev, u8 req, u16 reg,
char *buf, int len); char *buf, int len);
int (*em28xx_read_reg_req) (struct em28xx * dev, u8 req, u16 reg); int (*em28xx_read_reg_req) (struct em28xx *dev, u8 req, u16 reg);
enum em28xx_mode mode; enum em28xx_mode mode;
...@@ -459,7 +460,7 @@ int em28xx_register_extension(struct em28xx_ops *dev); ...@@ -459,7 +460,7 @@ int em28xx_register_extension(struct em28xx_ops *dev);
void em28xx_unregister_extension(struct em28xx_ops *dev); void em28xx_unregister_extension(struct em28xx_ops *dev);
/* Provided by em28xx-cards.c */ /* Provided by em28xx-cards.c */
extern int em2800_variant_detect(struct usb_device* udev,int model); extern int em2800_variant_detect(struct usb_device *udev, int model);
extern void em28xx_pre_card_setup(struct em28xx *dev); extern void em28xx_pre_card_setup(struct em28xx *dev);
extern void em28xx_card_setup(struct em28xx *dev); extern void em28xx_card_setup(struct em28xx *dev);
extern struct em28xx_board em28xx_boards[]; extern struct em28xx_board em28xx_boards[];
...@@ -557,80 +558,80 @@ int em28xx_get_key_pinnacle_usb_grey(struct IR_i2c *ir, u32 *ir_key, ...@@ -557,80 +558,80 @@ int em28xx_get_key_pinnacle_usb_grey(struct IR_i2c *ir, u32 *ir_key,
printk(KERN_WARNING "%s: "fmt,\ printk(KERN_WARNING "%s: "fmt,\
dev->name , ##arg); } while (0) dev->name , ##arg); } while (0)
inline static int em28xx_compression_disable(struct em28xx *dev) static inline int em28xx_compression_disable(struct em28xx *dev)
{ {
/* side effect of disabling scaler and mixer */ /* side effect of disabling scaler and mixer */
return em28xx_write_regs(dev, COMPR_REG, "\x00", 1); return em28xx_write_regs(dev, COMPR_REG, "\x00", 1);
} }
inline static int em28xx_contrast_get(struct em28xx *dev) static inline int em28xx_contrast_get(struct em28xx *dev)
{ {
return em28xx_read_reg(dev, YGAIN_REG) & 0x1f; return em28xx_read_reg(dev, YGAIN_REG) & 0x1f;
} }
inline static int em28xx_brightness_get(struct em28xx *dev) static inline int em28xx_brightness_get(struct em28xx *dev)
{ {
return em28xx_read_reg(dev, YOFFSET_REG); return em28xx_read_reg(dev, YOFFSET_REG);
} }
inline static int em28xx_saturation_get(struct em28xx *dev) static inline int em28xx_saturation_get(struct em28xx *dev)
{ {
return em28xx_read_reg(dev, UVGAIN_REG) & 0x1f; return em28xx_read_reg(dev, UVGAIN_REG) & 0x1f;
} }
inline static int em28xx_u_balance_get(struct em28xx *dev) static inline int em28xx_u_balance_get(struct em28xx *dev)
{ {
return em28xx_read_reg(dev, UOFFSET_REG); return em28xx_read_reg(dev, UOFFSET_REG);
} }
inline static int em28xx_v_balance_get(struct em28xx *dev) static inline int em28xx_v_balance_get(struct em28xx *dev)
{ {
return em28xx_read_reg(dev, VOFFSET_REG); return em28xx_read_reg(dev, VOFFSET_REG);
} }
inline static int em28xx_gamma_get(struct em28xx *dev) static inline int em28xx_gamma_get(struct em28xx *dev)
{ {
return em28xx_read_reg(dev, GAMMA_REG) & 0x3f; return em28xx_read_reg(dev, GAMMA_REG) & 0x3f;
} }
inline static int em28xx_contrast_set(struct em28xx *dev, s32 val) static inline int em28xx_contrast_set(struct em28xx *dev, s32 val)
{ {
u8 tmp = (u8) val; u8 tmp = (u8) val;
return em28xx_write_regs(dev, YGAIN_REG, &tmp, 1); return em28xx_write_regs(dev, YGAIN_REG, &tmp, 1);
} }
inline static int em28xx_brightness_set(struct em28xx *dev, s32 val) static inline int em28xx_brightness_set(struct em28xx *dev, s32 val)
{ {
u8 tmp = (u8) val; u8 tmp = (u8) val;
return em28xx_write_regs(dev, YOFFSET_REG, &tmp, 1); return em28xx_write_regs(dev, YOFFSET_REG, &tmp, 1);
} }
inline static int em28xx_saturation_set(struct em28xx *dev, s32 val) static inline int em28xx_saturation_set(struct em28xx *dev, s32 val)
{ {
u8 tmp = (u8) val; u8 tmp = (u8) val;
return em28xx_write_regs(dev, UVGAIN_REG, &tmp, 1); return em28xx_write_regs(dev, UVGAIN_REG, &tmp, 1);
} }
inline static int em28xx_u_balance_set(struct em28xx *dev, s32 val) static inline int em28xx_u_balance_set(struct em28xx *dev, s32 val)
{ {
u8 tmp = (u8) val; u8 tmp = (u8) val;
return em28xx_write_regs(dev, UOFFSET_REG, &tmp, 1); return em28xx_write_regs(dev, UOFFSET_REG, &tmp, 1);
} }
inline static int em28xx_v_balance_set(struct em28xx *dev, s32 val) static inline int em28xx_v_balance_set(struct em28xx *dev, s32 val)
{ {
u8 tmp = (u8) val; u8 tmp = (u8) val;
return em28xx_write_regs(dev, VOFFSET_REG, &tmp, 1); return em28xx_write_regs(dev, VOFFSET_REG, &tmp, 1);
} }
inline static int em28xx_gamma_set(struct em28xx *dev, s32 val) static inline int em28xx_gamma_set(struct em28xx *dev, s32 val)
{ {
u8 tmp = (u8) val; u8 tmp = (u8) val;
return em28xx_write_regs(dev, GAMMA_REG, &tmp, 1); return em28xx_write_regs(dev, GAMMA_REG, &tmp, 1);
} }
/*FIXME: maxw should be dependent of alt mode */ /*FIXME: maxw should be dependent of alt mode */
inline static unsigned int norm_maxw(struct em28xx *dev) static inline unsigned int norm_maxw(struct em28xx *dev)
{ {
if (dev->max_range_640_480) if (dev->max_range_640_480)
return 640; return 640;
...@@ -638,7 +639,7 @@ inline static unsigned int norm_maxw(struct em28xx *dev) ...@@ -638,7 +639,7 @@ inline static unsigned int norm_maxw(struct em28xx *dev)
return 720; return 720;
} }
inline static unsigned int norm_maxh(struct em28xx *dev) static inline unsigned int norm_maxh(struct em28xx *dev)
{ {
if (dev->max_range_640_480) if (dev->max_range_640_480)
return 480; return 480;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment